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

Modal to prevent losing REST datasource changes #15752

Merged

Conversation

adrinr
Copy link
Collaborator

@adrinr adrinr commented Mar 17, 2025

Description

REST datasources currently behave quite differently from the other datasources and the rest of the platform, as it is one of the few points where we don't autosave on actions: the user is required to save via the save click. This might be confusing as the UI and some of its elements might give the impression that the data is persisted on change. This will be even more problematic as we are changing some of its configuration elements from dropdowns to context buttons and menus.
This PR introduces a mechanism to detect if you are leaving a REST config with unsaved changes. If this is the case, the user will have 2 options:

  1. Leave discarding the changes
  2. Leave saving the changes
  3. Close the modal and stay on the current page (this required some extra props on the confirm modal)

Screenshots

No modal when no changes

no modal

Modal appears when there are changes

modal on changes

Saving on exiting the screen

save on quit

Discard changes on exit

discarding

Closing the modal will prevent from exiting

cancelling

On new endpoint, we will validate if it's saved

new

We will not validate new endpoint "save" status if there is no changes at all

empty new

Launchcontrol

Confirm modal when leaving a rest configuration page with unsaved changes

Copy link

linear bot commented Mar 17, 2025

Copy link

qa-wolf bot commented Mar 17, 2025

QA Wolf here! As you write new code it's important that your test coverage is keeping up.
Click here to request test coverage for this PR!

@github-actions github-actions bot added firestorm Data/Infra/Revenue Team size/m labels Mar 17, 2025
@adrinr adrinr changed the title Budi 9127/modal to prevent losing rest datasource changes Modal to prevent losing REST datasource changes Mar 17, 2025
@adrinr adrinr marked this pull request as ready for review March 17, 2025 08:46
Copy link
Member

@aptkingston aptkingston left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! The confirm util is very nice.

NAB - could we update the "Save and continue" button to be a CTA variant instead? The current red button makes it look like saving is a bad/dangerous thing, but it's probably what they want to press.

return true
}

return await confirm({
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a nice util to have 👌

@adrinr
Copy link
Collaborator Author

adrinr commented Mar 18, 2025

LGTM! The confirm util is very nice.

NAB - could we update the "Save and continue" button to be a CTA variant instead? The current red button makes it look like saving is a bad/dangerous thing, but it's probably what they want to press.

Good catch! Updated:
image

@adrinr adrinr enabled auto-merge March 18, 2025 11:29
@adrinr adrinr merged commit 2e22509 into master Mar 18, 2025
22 checks passed
@adrinr adrinr deleted the BUDI-9127/modal-to-prevent-losing-rest-datasource-changes branch March 18, 2025 11:34
@github-actions github-actions bot locked and limited conversation to collaborators Mar 18, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
firestorm Data/Infra/Revenue Team size/m
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants