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

[dev.icinga.com #6059] Save/restore form data when navigating away/back #586

Closed
icinga-migration opened this issue Apr 24, 2014 · 11 comments
Labels
area/javascript Affects the javascript framework enhancement New feature or improvement wontfix Deprecated, not supported or not worth any effort

Comments

@icinga-migration
Copy link

This issue has been migrated from Redmine: https://dev.icinga.com/issues/6059

Created by jmeyer on 2014-04-24 07:36:04 +00:00

Assignee: (none)
Status: New
Target Version: Backlog
Last Update: 2015-03-30 08:57:43 +00:00 (in Redmine)


lippser wrote:

Our history implementation should save form data when navigating away and restore them when navigating back to the form via the history. If JavaScript is disabled, this already works because the browser's cache does the work for us.

Original description:

Johannes wrote:

As a user, I want to be warned when I am going to leave a form where I changed something. (We did have this functionality earlier but it was vanished somehow...)

Acceptance criteria:
* Should be enabled/disabled on a per form basis
* Show message box in case unsaved changes are present
* Do only show a warning if the user changed something


Relations:

@icinga-migration
Copy link
Author

Updated by elippmann on 2014-06-01 13:15:25 +00:00

  • Target Version changed from 140 to 2.0-6

@icinga-migration
Copy link
Author

Updated by elippmann on 2014-07-22 13:41:01 +00:00

  • Target Version changed from 2.0-6 to 2.0-11

@icinga-migration
Copy link
Author

Updated by elippmann on 2014-07-23 07:43:02 +00:00

  • Target Version changed from 2.0-11 to Backlog

@icinga-migration
Copy link
Author

Updated by jmeyer on 2014-08-12 13:22:31 +00:00

  • Status changed from New to Assigned
  • Assigned to set to jmeyer

@icinga-migration
Copy link
Author

Updated by jmeyer on 2014-08-13 11:41:32 +00:00

  • Status changed from Assigned to Feedback
  • Assigned to changed from jmeyer to elippmann

We need to intercept the navigation at these events:

  1. When closing the browser or current tab

  2. When moving the history up/down

  3. When navigating in the app

  4. is easy to accomplish as we are already using a centralized approach to handle "local" navigation (icinga.loader.loadUrl)
    For 1) and 2) it should have been possible accomplishing it by using a browser's "beforeUnload"-event but that's unfortunately not working. The reason for this is the browser compatibility with the "unload"-event that is currently in use by us to clean up all the icinga javascript stuff. Since some browsers do not support or properly handle the "unload"-event (see http://stackoverflow.com/a/14647730), the "beforeUnload"-event is being used as well for cleaning up. But since it is not possible to get the user response back from the dialog that is displayed when returning a string in the "beforeUnload"-event, we can't clean up anything in the "beforeUnload"-event as the user might have canceled the navigation-action and keeps staying on the page. (Note that it is discouraged to display a modal dialog during these two events.)

Another issue is, that most mobile browsers do not support the "beforeUnload"-event. (see https://developer.mozilla.org/en-US/docs/Web/API/Window.onbeforeunload)

We can try to circumvent these issues by displaying a pseudo-modal dialog during the "beforeUnload"-event but that does not resolve the issue with mobile browsers not supporting this event at all.

But there's another and even much more proper way handling this. Using this undo-technique it's probably getting more complicated to implement this, but it's a clean and powerful alternative. (e.g. think of #4133 where this might be useful as well)

I'd prefer implementing the undo-technique but would also be fine not using it, as 3) is already fully implemented.

@icinga-migration
Copy link
Author

Updated by elippmann on 2014-08-22 08:12:42 +00:00

  • Category changed from 146 to JavaScript
  • Status changed from Feedback to New
  • Assigned to deleted elippmann

Hi Johannes,

Johannes wrote:

We need to intercept the navigation at these events:

  1. When closing the browser or current tab

  2. When moving the history up/down

  3. When navigating in the app

  4. is easy to accomplish as we are already using a centralized approach to handle "local" navigation (icinga.loader.loadUrl)
    For 1) and 2) it should have been possible accomplishing it by using a browser's "beforeUnload"-event but that's unfortunately not working. The reason for this is the browser compatibility with the "unload"-event that is currently in use by us to clean up all the icinga javascript stuff. Since some browsers do not support or properly handle the "unload"-event (see http://stackoverflow.com/a/14647730), the "beforeUnload"-event is being used as well for cleaning up. But since it is not possible to get the user response back from the dialog that is displayed when returning a string in the "beforeUnload"-event, we can't clean up anything in the "beforeUnload"-event as the user might have canceled the navigation-action and keeps staying on the page. (Note that it is discouraged to display a modal dialog during these two events.)

Another issue is, that most mobile browsers do not support the "beforeUnload"-event. (see https://developer.mozilla.org/en-US/docs/Web/API/Window.onbeforeunload)

We can try to circumvent these issues by displaying a pseudo-modal dialog during the "beforeUnload"-event but that does not resolve the issue with mobile browsers not supporting this event at all.

But there's another and even much more proper way handling this. Using this undo-technique it's probably getting more complicated to implement this, but it's a clean and powerful alternative. (e.g. think of #4133 where this might be useful as well)

I'd prefer implementing the undo-technique but would also be fine not using it, as 3) is already fully implemented.

The undo-technique is in fact a good idea. Our history implementation should save form data when navigating away and restore them when navigating back to form via the history. If JavaScript is disabled, this already works because the browser's cache does the work for us.

Cheers,
Eric

@icinga-migration
Copy link
Author

Updated by tgelf on 2014-09-09 08:38:01 +00:00

  • Relates set to 7146

@icinga-migration
Copy link
Author

Updated by elippmann on 2014-10-28 08:58:42 +00:00

  • Target Version changed from Backlog to 2.0-16

@icinga-migration
Copy link
Author

Updated by elippmann on 2014-11-21 15:38:59 +00:00

  • Target Version changed from 2.0-16 to Backlog

@icinga-migration
Copy link
Author

Updated by elippmann on 2015-03-30 08:57:30 +00:00

  • Subject changed from Warn about unsaved changes when leaving forms to Save/restore form data when navigating away/back
  • Description updated

@icinga-migration
Copy link
Author

Updated by elippmann on 2015-03-30 08:57:43 +00:00

  • Description updated

@icinga-migration icinga-migration added enhancement New feature or improvement area/javascript Affects the javascript framework labels Jan 17, 2017
@icinga-migration icinga-migration added this to the Backlog milestone Jan 17, 2017
@lippserd lippserd added the wontfix Deprecated, not supported or not worth any effort label Mar 30, 2017
@lippserd lippserd removed this from the Backlog milestone Sep 22, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/javascript Affects the javascript framework enhancement New feature or improvement wontfix Deprecated, not supported or not worth any effort
Projects
None yet
Development

No branches or pull requests

2 participants