ESI-FAR / INA-tool

A tool for visualising and analysing Institutional Statements
MIT License
2 stars 0 forks source link

Refactor file upload/page refresh logic #103

Closed sjvrijn closed 2 months ago

sjvrijn commented 3 months ago

Combined PR for three issues that are all part of refactoring and streamlining the code flow when either uploading a file or refreshing the page.

ermannolocascio commented 2 months ago

Unless I'm doing something wrong with the browser caching, if I switch to this branch, after testing it I observe that the data is lost on F5 and page navigation due to the elimination of the session variable. Reasonably, this is not the behaviour expected from a web app, i.e. the user has to be able to navigate the pages (like the help page) and go back to the workspace in the index page without loosing the information.

To achive this, we have to store the information into a session variable or using a local storage. I don't see other option than that. Concluding, I think this PR emerges from the presence of the PHP code. Just try to achieve the same storing with JavaScript if you prefer.

I have no experience with that but you may want to try:

// Storing data localStorage.setItem("user", JSON.stringify({ ... }));

// Session storage sessionStorage.setItem("sessionData", "Session Info");

Thanks. :)

Before image

After visiting the help page

image

sjvrijn commented 2 months ago

@ermannolocascio Good find, I've looked into it, and it seems like this was already broken by #93: The session is not maintained when data is loaded from a json file. I've created issue #110 about this.

sjvrijn commented 2 months ago

Latest commits seem to have solved the issue, which would also fix #110. @ermannolocascio can you confirm?

ermannolocascio commented 2 months ago

Hi @sjvrijn, thanks for the update. The chart and table now remains on on F5 press. I notice few problems that I list here, to be discussed:

  1. Reset position after page refresh. When I drag the statements and then I press F5 the position of the item is reset. We can eventually accept this. At the same time it would be nice to update the new position when the user unclick the mouse (I guess this is not as simple as is sounds to code).

  2. The connection between the statements fails sometimes. I see an extra connection and the positioning goes bad when dragging. We knew it. Sometime we should also fix it :)

image

For the rest, it looks ok so far. Thanks again.

sjvrijn commented 2 months ago

Thanks for checking, let's indeed make new issues for the two problems you indicated.