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

[bug] Unsaved changes alert triggered unnecessarily when required templates are in use #469

Closed
nemesifier opened this issue May 22, 2021 · 7 comments
Assignees
Labels

Comments

@nemesifier
Copy link
Member

How to replicate

Add a required template to the system.
Create a new device in the same organization of the template just created.
Open the device detail page, do not change anything, reload or click on anywhere to go to a different page.

Expected behavior

Device page is left without alerts.

Actual behavior

Unsaved changes alert is triggered.

Demo

unsaved-changes

We need tests

This problem has been happening too much lately.
In order to avoid keep banging our head on it, I think we need to start introducing selenium tests, this could be the first (failing) test to add.

@pandafy
Copy link
Member

pandafy commented Jun 2, 2021

I was not able to replicate the bug described in the issue description. But I found another issue:

The required templates are always shown at top, irrespective of the ordering set by user.

@nemesifier
Copy link
Member Author

nemesifier commented Jun 2, 2021

I was not able to replicate the bug described in the issue description. But I found another issue:

I will double check.

The required templates are always shown at top, irrespective of the ordering set by user.

That's the intended behavior and documented: https://github.com/openwisp/openwisp-controller/tree/797b41e1048f9b8c2939298c2f506a55e811e46b#required-templates.

@pandafy
Copy link
Member

pandafy commented Jun 2, 2021

That's the intended behavior and documented: https://github.com/openwisp/openwisp-controller/tree/797b41e1048f9b8c2939298c2f506a55e811e46b#required-templates.

But if you add them from shell using `Config.templates.add(''), then they'll appear at the end of the list. Since this is a thing which won't happen in real world, I don't think we should worry about it.

@pandafy
Copy link
Member

pandafy commented Jun 2, 2021

I just noticed in the GIF attached in the issue description, the required template is not at the top.

@nemesifier
Copy link
Member Author

That's the intended behavior and documented: https://github.com/openwisp/openwisp-controller/tree/797b41e1048f9b8c2939298c2f506a55e811e46b#required-templates.

But if you add them from shell using `Config.templates.add(''), then they'll appear at the end of the list. Since this is a thing which won't happen in real world, I don't think we should worry about it.

Correct, they'll be reordered again sooner or later when the user hits save again on the same device.

@nemesifier
Copy link
Member Author

I just noticed in the GIF attached in the issue description, the required template is not at the top.

Yes, that's the issue. I'll need to try again on an empty system.

@nemesifier
Copy link
Member Author

The problem happens on devices that exist before a required template is added to a system, I opened an issue to deal with required/default templates that should be automatically assigned to devices: #480.

A problem with the unsaved changes code is still present but opened a dedicated issue for it: #481.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Development

No branches or pull requests

2 participants