Skip to content

[Global Pins] Shows a confirmation dialog when disabling the global pin feature #6843

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

Merged
merged 4 commits into from
Apr 30, 2024

Conversation

roseayeon
Copy link
Contributor

@roseayeon roseayeon commented Apr 26, 2024

Motivation for features / changes

Regarding #6831 , this PR adds confirmation dialog" that appears when the user clears the checkbox to make the user aware that local storage is disappearing.

Technical description of changes

0e63b07 created a saving pins dialog component

05e06f5 Created a saving pins checkbox component

  • The Save Pin checkbox prevents the default click and must be done after confirmation in the modal. So I added MAT_CHECKBOX_DEFAULT_OPTIONS (https://v15.material.angular.io/comComponents/checkbox/overview#click-action-config) to prevent the default click event. However, if I add this directly to the settings view component, all checkboxes will be disabled, including other unwanted ones. So, I created a separate checkbox for the Save Pin checkbox. Please let me know is there any other good way to do this.

6ba778e Make the dialog shows up when user clears the checkbox

  • Passes to onEnableSavingPinsToggled whether the checkbox is selected.
    • If the checkbox is selected and user clicks it, it means that the user disables the global pin, so a dialog box is displayed.
    • If the checkbox is not checked but is clicked, it means the user is trying to enable a global pin and no dialog box will be displayed.
  • onEnableSavingPinsToggled and isSavingPinsEnabled is passed to saving-pins-checkbox component.

Screenshots of UI changes (or N/A)

image

Detailed steps to verify changes work correctly (as executed by you)

unit test passes + TAP presubmit passes

Alternate designs / implementations considered (or N/A)

@roseayeon roseayeon changed the title [Global Pins] Add confirm dialog if users disable the global pins feature [Global Pins] Shows a confirmation dialog when disabling the global pin feature Apr 26, 2024
@roseayeon roseayeon marked this pull request as draft April 26, 2024 16:40
@roseayeon roseayeon requested a review from hoonji April 29, 2024 13:01
@roseayeon roseayeon marked this pull request as ready for review April 30, 2024 03:04
Copy link
Member

@hoonji hoonji left a comment

Choose a reason for hiding this comment

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

Not much to say here as both the code and the feature are very high quality. Thank you for your efforts!

import {SavingPinsDialogModule} from './saving_pins_dialog_module';
import {SavingPinsDialogComponent} from './saving_pins_dialog_component';

describe('saving_pins_dialog', () => {
Copy link
Member

Choose a reason for hiding this comment

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

nit: Using underscores doesn't match the selector (or anything else) and can make the code harder to search for. Suggest: saving-pins-dialog or saving pins dialog.

(I know some other tests use underscores, but it doesn't seem to be consistent and I think we can adopt a better policy)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Applied! Thanks!

@roseayeon roseayeon merged commit af34605 into tensorflow:master Apr 30, 2024
AnuarTB pushed a commit to AnuarTB/tensorboard that referenced this pull request May 3, 2024
…in feature (tensorflow#6843)

## Motivation for features / changes
Regarding tensorflow#6831 , this PR adds confirmation dialog" that appears when
the user clears the checkbox to make the user aware that local storage
is disappearing.

## Technical description of changes
0e63b07 created a `saving pins dialog` component

05e06f5 Created a `saving pins checkbox` component
* The Save Pin checkbox prevents the default click and must be done
after confirmation in the modal. So I added
`MAT_CHECKBOX_DEFAULT_OPTIONS`
(https://v15.material.angular.io/comComponents/checkbox/overview#click-action-config)
to prevent the default click event. However, if I add this directly to
the `settings view component`, all checkboxes will be disabled,
including other unwanted ones. So, I created a separate checkbox for the
Save Pin checkbox. Please let me know is there any other good way to do
this.

6ba778e Make the dialog shows up when user clears the checkbox
* Passes to `onEnableSavingPinsToggled` whether the checkbox is
selected.
* If the checkbox is selected and user clicks it, it means that the user
disables the global pin, so a dialog box is displayed.
* If the checkbox is not checked but is clicked, it means the user is
trying to enable a global pin and no dialog box will be displayed.
* `onEnableSavingPinsToggled` and `isSavingPinsEnabled` is passed to
`saving-pins-checkbox` component.

## Screenshots of UI changes (or N/A)

![image](https://github.com/tensorflow/tensorboard/assets/24772412/eb442565-4f39-45e7-b893-4866ee3fc1e4)

## Detailed steps to verify changes work correctly (as executed by you)
unit test passes + TAP presubmit passes 
## Alternate designs / implementations considered (or N/A)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants