opensmarthouse / opensmarthouse-web

Provides public elements of OpenSmartHouse web site including ZWave database import/export and log file processors.
0 stars 2 forks source link

Adding devices does not work #5

Closed sihui62 closed 3 years ago

sihui62 commented 3 years ago

Adding devices does not work, not in Firefox, not in Chrome. After hitting the "Save changes" button nothing happens, no error message.

grafik

sihui62 commented 3 years ago

Ahh, it is there:

https://opensmarthouse.org/zwavedatabase/1274

But the dialog does not close after hitting the "Save changes" button.

bwosborne2 commented 3 years ago

I noticed that when I got the xml import working. Some files were missed and our troubleshooting debug log location had changed in the reorganization.

cdjackson commented 3 years ago

@bwosborne2 I think this might be an issue with the return from the script - there is currently no return. It does seem to return success (200), but there is no data and I'm wondering if that's causing the problem. I just checked that the site is set for the dialog to close, and I've also added a toast to say success (I'll add one for failure too) and neither of these things happen.

Can you take a look to see what happens if you maybe just return [] or something?

bwosborne2 commented 3 years ago

Can you take a look to see what happens if you maybe just return [] or something?

I just return after possibly sending the email. What do you wish me to send?

cdjackson commented 3 years ago

Just try adding “return ‘{}';” and see what happens...

bwosborne2 commented 3 years ago

Done (fixing the single quotes)

cdjackson commented 3 years ago

Ok, after much messing around, I've got this to work. What was needed is to use echo to get it to return the '{}'.

My thinking is we might want to better handle errors in here by returning some sort of json string or something when there is an error. The UI now presents a toast if there's an error, and presents a success toast when it works (well, I assumed it works - it closes the dialog ;) ) but I'm thinking a bit more feedback when things go wrong might be useful.

cdjackson commented 3 years ago

I think this is now resolved so I'll close. If I've missed something, please yell...