npmSteven / Unraid-VM-CP

GNU Affero General Public License v3.0
11 stars 1 forks source link

Add support for different API responses #2

Open ReddotCleaner opened 1 year ago

ReddotCleaner commented 1 year ago

image log:

[0] ERROR TypeError: Cannot read properties of null (reading '0')
[0]     at Element.<anonymous> (file:///app/backend/build/src/services/unraid.js:237:79)
[0]     at LoadedCheerio.map (file:///app/backend/node_modules/.pnpm/cheerio@1.0.0-rc.12/node_modules/cheerio/lib/esm/api/traversing.js:495:24)
[0]     at getVMsUnraid (file:///app/backend/build/src/services/unraid.js:224:36)
[0]     at processTicksAndRejections (node:internal/process/task_queues:96:5)
[0]     at async file:///app/backend/build/src/api/v1/vms/vms.js:24:25
npmSteven commented 1 year ago

@ReddotCleaner Thanks for reporting with image and error message, do you have any VMs and if so please could you send a screenshot

ReddotCleaner commented 1 year ago

@ReddotCleaner Thanks for reporting with image and error message, do you have any VMs and if so please could you send a screenshot

image these are my vms.

npmSteven commented 1 year ago

Ahh at the moment we do not currently support Mandarin. I'd be happy to add this support but I would obvious need some assistance from you or someone who knows Mandarin. If Unraid had an official api this would work but because of the nature of how I have to get the VM's from your Unraid server I have to do a lot of regex.

For now what would be helpful is if you could send me your HTML that you get from this endpoint (You can get it from your network tab and just refresh your VMs in Unraid) http://<ip>/plugins/dynamix.vm.manager/include/VMMachines.php Once you've sent me the HTML I will try and add support.

npmSteven commented 1 year ago

I have updated the code, please check for updates on the docker tab and hopefully that'll fix it, if it does please follow the instructions above

ReddotCleaner commented 1 year ago

I have updated the code, please check for updates on the docker tab and hopefully that'll fix it, if it does please follow the instructions above

Just updated it. Still have the same problem. I just fork this and uploaded VMMachines.php, here's the link: https://raw.githubusercontent.com/ReddotCleaner/Unraid-VM-CP/master/i18n/VMMachines.php.html And i would love to help u translate.

npmSteven commented 1 year ago

Thanks for that mate, it was really helpful. What version of Unraid are you using? That'd be wonderful, I will get i18n setup so you can assist with translations, thank you very much.

ReddotCleaner commented 1 year ago

Thanks for that mate, it was really helpful. What version of Unraid are you using? That'd be wonderful, I will get i18n setup so you can assist with translations, thank you very much.

using 6.11.5

npmSteven commented 1 year ago

That's very odd your on latest (same as me), it seems that the response the VMMachines gives is different from mine. What I'll try and do is get it to work with your response data for now, and in the future I'll create an additional package that is just for communicating with Unraid itself so that we have a standard output. I think I should be done with a fix in the next hour or so.

ReddotCleaner commented 1 year ago

That's very odd your on latest (same as me), it seems that the response the VMMachines gives is different from mine. What I'll try and do is get it to work with your response data for now, and in the future I'll create an additional package that is just for communicating with Unraid itself so that we have a standard output. I think I should be done with a fix in the next hour or so.

ok, i will be back in an hour and try that new update. Thanks.

npmSteven commented 1 year ago

Just pushed a new update, when you get a chance give it a go, you will be missing two fields from the UI storage and memory, as I can't find a reliable way of getting them, this will be solved in the future.

ReddotCleaner commented 1 year ago

Just pushed a new update, when you get a chance give it a go, you will be missing two fields from the UI storage and memory, as I can't find a reliable way of getting them, this will be solved in the future.

It worked. Nice job.👍

npmSteven commented 1 year ago

Just pushed a new update, when you get a chance give it a go, you will be missing two fields from the UI storage and memory, as I can't find a reliable way of getting them, this will be solved in the future.

It worked. Nice job.👍

Wonderful news, I am going to make some unit tests with the data you provided, so that this won't happen again. Thanks for all of your help! When I get to translations I'll create an issue for you.

ReddotCleaner commented 1 year ago

Just pushed a new update, when you get a chance give it a go, you will be missing two fields from the UI storage and memory, as I can't find a reliable way of getting them, this will be solved in the future.

It worked. Nice job.👍

Wonderful news, I am going to make some unit tests with the data you provided, so that this won't happen again. Thanks for all of your help! When I get to translations I'll create an issue for you.

Sure thing.