eclipse-archived / smarthome

Eclipse SmartHome™ project
https://www.eclipse.org/smarthome/
Eclipse Public License 2.0
863 stars 782 forks source link

PaperUI uses outdated JS files from browser cache after an update #2636

Open MHerbst opened 7 years ago

MHerbst commented 7 years ago

I made a fresh install of build 634 (on Windows 10) and installed only the Yahoo binding.

In the first test I did not create any items. Instead I opened the thing configuration and selected the option "+Create New Item" image When I press the "Link" button I get an error message "Error 405 Method not allowed" (the log shows nothing).

Then I created manually a new item of type "Number" (I entered a name, label and selected the type "Number"). When I try to assign this item to the temperature channel I only get this selection: image The entry marked in yellow seems to be my newly created item. But linking is not possible (also error 405).

The I switched to "Simple mode" and activated the "Temperature" channel. This works fine and the automatically created item is linked.

kaikreuzer commented 7 years ago

The LINK button should not be active if "create new item" is chosen. Instead you should be able to either create an item yourself or to link an existing one here.

@aounhaider1 Could you please have a look?

MHerbst commented 7 years ago

That's right, but if you select "create new item" it should be somehow possible to "jump" to the item definition page. After I selecte "Create new item" the blue text "item" appeared above the selection. Becaue of its colour it looks like a hyperlink, but it has no function. So the meaning of this text is also not clear.

kaikreuzer commented 7 years ago

Could you try to clear your browser cache? I just tested it and it correctly opens a "create item" dialog:

screen shot 2016-12-09 at 21 28 28
MHerbst commented 7 years ago

That's it. After cleaning the cache it worked as expected. This solution apparently was too easy for me ...

Maybe it would be a good idea to prevent these pages from caching as long as it is in beta state. Or at least to set short expiry dates, e.g. maximum 1 day.

maggu2810 commented 7 years ago

@MHerbst Is there still something missing or could the issue be closed?

kaikreuzer commented 7 years ago

I was waiting for @aounhaider1 to comment whether there can be anything enhanced wrt cache expiry.

MHerbst commented 7 years ago

@maggu2810 My particular problem was solved by cleaning the browser cache, but the general problem remain. @kaikreuzer The https protocol allows to configure a cache expiry for each file that is transferred. So in general it is possible to limit the cache time to e.g. 1 day by settings in the http header that is sent with each file. If the files are served by a web server like NGINS or Apache the configuration is quite easy but I don't know how I can be done e.g. with Ajax requests. Another way to solve the problem would be to add a version number the the javascript files and increment the version each time it is changed.

aounhaider1 commented 7 years ago

For JS files we can use an auto incrementing version number. There are libraries like https://www.npmjs.com/package/gulp-rev that can be used. For html files we can set the cache-control header with max-age. What do you think?

MHerbst commented 7 years ago

@aounhaider1 Sounds good. I know the technique with incremented version numbers from CMS like Wordpress where it is working perfectly.

sjsf commented 7 years ago

I just adapted the issue title to reflect the underlying root-cause