Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

visu doesn't get updated after changes #15

Open
triessner opened this issue Jan 4, 2021 · 20 comments
Open

visu doesn't get updated after changes #15

triessner opened this issue Jan 4, 2021 · 20 comments
Labels
bug Something isn't working

Comments

@triessner
Copy link

It is frustrating. With every change of the programme the variables get more and more mixed up in the javascript visu. If I look in the visu of codesys everything shows up right.
The old variables, which I didn't touch are still displayed correctly, but variables, that I recently changed get mixed up. Even dump lables, which I added just for testing, are not shown.
It seams like webvisu.js uses still the old visu. But the plc_visu.xml is defenitely updated in the controller. I also tried to clear the cache of firefox (ctrl+F5). Without success.
I opened the visu in chrome for the first time, and there everything was displayed correct. But the next changes are lost again (I deletet the dump label, which I added just earlier for testing, and it is still there)

@triessner
Copy link
Author

Got the solution, but it is not satisfying. If I delete all data for the website of the visualisation in preferences-> Privacy & Security -> Manage Data, the visu works again in the newest version.
There should be an easy and more intuitive way to achieve this (like F5 or ctrl+F5). If it is not possible, there should at least be a hint in the readme file. It took me hours to solve this issue.

@Ekristoffe
Copy link
Collaborator

is it ok to for a full reload only when closing and opening the tab again ?
or do you prefers to reload everything on a normal reload ?

@Ekristoffe Ekristoffe added the bug Something isn't working label Jan 6, 2021
@Ekristoffe
Copy link
Collaborator

Could you test with this version:
https://github.com/Ekristoffe/WebVisu/tree/Dev/dist
It should reload from scratch the whole visu on a browser reopen or tab reopen.

@triessner
Copy link
Author

triessner commented Jan 7, 2021

Closing the tab and opening a new one works. Even just opening a new one without closing the old one works.
Answering your question above. I would prefer CTRL+F5 to reload the visu, I think it is most intuitive, as normally CTRL+F5 reloads and clears the cache. Most computer affine people know that, and do it if something wired happens during a normal reload. But I don't know javascript and have no idea, whether it is possible to achieve with moderate effort.
Reopening the tab is ok for me, but you should make a notice about it in the readme file.

@tnentwig
Copy link
Owner

tnentwig commented Jan 7, 2021

The loaded visu files are stored in the local storage intentionally. This was implemented to reduce the load time for big sized visualisations, like Wago own facility solutions. They are quit heavy, so the storaging should be kept in my opinion. It improves the user experience.
Actually the process should be:
Has the XML changed?
No -> Load from storage
Yes -> Reload
I thought the <download-id></download-id> tag in the visu_ini.xml changes with an application change. But this is apparently not the case. Maybe the <time-stamp></time-stamp> tag in the xml file would be accurate?

@triessner
Copy link
Author

triessner commented Jan 7, 2021

I see the advantage of storing the visu locally. But there should definitely be an easy, intuitive way to reload the visu like CTRL+F5, as long, as the automatic reload doesn't work reliable. If it works, it would be of course the best solution.
In my visu there is no <download-id> tag at all. Maybe this is the problem. The <time-stamp> tag may be more suitable. In my visu the actual tag is <time-stamp>1610038976,1586465552</time-stamp> which doesn't seam to be a typical unix like time-stamp, but if it changes with each new version, that doesn't matter. In a first test, the part left from the comma changed after a new upload of the visu, in the right part there was no change <time-stamp>1610053743,1586465552</time-stamp>

@tnentwig
Copy link
Owner

tnentwig commented Jan 7, 2021

Okay, thanks for your help. We have to include the functionality of a CTRL+F5 hard reload.

@Ekristoffe
Copy link
Collaborator

Ekristoffe commented Jan 8, 2021

I see the advantage of storing the visu locally. But there should definitely be an easy, intuitive way to reload the visu like CTRL+F5, as long, as the automatic reload doesn't work reliable. If it works, it would be of course the best solution.
In my visu there is no <download-id> tag at all. Maybe this is the problem. The <time-stamp> tag may be more suitable. In my visu the actual tag is <time-stamp>1610038976,1586465552</time-stamp> which doesn't seam to be a typical unix like time-stamp, but if it changes with each new version, that doesn't matter. In a first test, the part left from the comma changed after a new upload of the visu, in the right part there was no change <time-stamp>1610053743,1586465552</time-stamp>

The <download-id> tag is in the visu_ini.xml file.
The <time-stamp> tag is in each visu pages and can only be accessed by reloading the page again.
I will see what can be done.

Edit: I may have found a way to keep the local storage and having the update file without reloading everything.
I need more time to test it.

@Ekristoffe
Copy link
Collaborator

I made a new system which check the file "last modified" parameter to determined if we need to download it again or not.
Could you check it and tell me if it work fine with your application ?
Thanks you.

@triessner
Copy link
Author

The visu_ini.xml file isn't updated every time, I change the visu. Till now, I wasn't able to find out, what kind of changes in the program or visu result in a change of the visu_ini.xml (and so maybe a change of the <download-id>). Where is the last modified parameter? I can't find it in visu_ini.xml and in plc_visu.xml.

@Ekristoffe
Copy link
Collaborator

Indeed there is no information.
That’s why now I am using the last modified parameter (you can find it for example in windows when you right click a file ans select property)
On a internet file it is in the header of the file when you download it.
I just request the header without the file every time I need to load a file.

@tnentwig
Copy link
Owner

I have tested it. The problem should be solved. Every change will be trigger a reload of the visu.

@Ekristoffe
Copy link
Collaborator

Ekristoffe commented Jan 13, 2021

Yes after a page refresh just the changed page is redownload and updated.

@triessner
Copy link
Author

great, sounds good. I'm out of office for one week now and can't test this (and the other issues) till I'm back end of next week.
Nevertheless, thanks for your work, it is really amazing, how fast the two of you are responding to my questions and solving my issues.

@triessner
Copy link
Author

yes, works for me too. Just a F5 in the browser and the page gets reloaded. Maybe Ctrl+F5 would be better, so that the long loading time for complex visus can be avoided for a normal reload (like mentioned earlier from tnentwig), but I have no idea, whether it is possible with javascript.

@Ekristoffe
Copy link
Collaborator

unfortunately it doesn't also the page reloading is automatic even on page change (no need to reload normally).
I have selected this just in case there is a pointer change in the webvisu,
If we don't reload and the pointer has change the webvisu could write on another variable which is unwanted.

@tnentwig
Copy link
Owner

tnentwig commented Feb 15, 2021

I made a reworking with sessionstorage who is cleared on page reload. This will be the best option in my opinion, a revisit of a site inside a session is faster then.
Your idea with last-modified is not working on currently available controller like 750-884. They return always the actual timestamp.
@Ekristoffe Do you made the same experience with the 880?

@triessner
Copy link
Author

For me it is a good solution now. It works like a normal user would expect it. Thanks for your solution.

@triessner triessner reopened this Mar 5, 2021
@triessner
Copy link
Author

Does not update the visu on a 750-841 controler. I changed the plx_visu.xml file manually (changed the text tag of a rectangle), made a reload, and it doesn't show the new text. Even after closing an reopening the tab it doesn't show the change.
Reason for this change was an error in the format string. I forgot to double the %. So it was not shown in the javascript visu (which I think is a correct behaviour), but it is shown in the java version (which is incorrect in my opinion, and the reason, why I didn't realize this error earlier).

@tnentwig
Copy link
Owner

Hopefully should be fixed now in the latest release. We will use only the sessionStorage now. A F5 will clear all prefetched visus.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants