-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Dashboard] Add reset button #154872
[Dashboard] Add reset button #154872
Changes from all commits
a1e0b3a
59f9e39
fac881b
e90884c
c70504a
24294b8
16c70b1
322378b
5e1e855
a04a9bd
10ac4aa
9c6c5ac
29a06ab
c8fbeb5
aba508e
9f51d45
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
* Side Public License, v 1. | ||
*/ | ||
|
||
import { ViewMode } from '@kbn/embeddable-plugin/public'; | ||
import { i18n } from '@kbn/i18n'; | ||
|
||
export const dashboardListingErrorStrings = { | ||
|
@@ -91,32 +92,32 @@ export const dashboardUnsavedListingStrings = { | |
defaultMessage: 'Continue editing', | ||
}), | ||
getDiscardAriaLabel: (title: string) => | ||
i18n.translate('dashboard.listing.unsaved.discardAria', { | ||
defaultMessage: 'Discard changes to {title}', | ||
i18n.translate('dashboard.listing.unsaved.resetAria', { | ||
defaultMessage: 'Reset changes to {title}', | ||
values: { title }, | ||
}), | ||
getDiscardTitle: () => | ||
i18n.translate('dashboard.listing.unsaved.discardTitle', { | ||
defaultMessage: 'Discard changes', | ||
i18n.translate('dashboard.listing.unsaved.resetTitle', { | ||
defaultMessage: 'Reset changes', | ||
}), | ||
}; | ||
|
||
export const discardConfirmStrings = { | ||
getDiscardTitle: () => | ||
i18n.translate('dashboard.discardChangesConfirmModal.discardChangesTitle', { | ||
defaultMessage: 'Discard changes to dashboard?', | ||
}), | ||
getDiscardSubtitle: () => | ||
i18n.translate('dashboard.discardChangesConfirmModal.discardChangesDescription', { | ||
defaultMessage: `Once you discard your changes, there's no getting them back.`, | ||
}), | ||
getDiscardConfirmButtonText: () => | ||
i18n.translate('dashboard.discardChangesConfirmModal.confirmButtonLabel', { | ||
defaultMessage: 'Discard changes', | ||
}), | ||
getDiscardCancelButtonText: () => | ||
i18n.translate('dashboard.discardChangesConfirmModal.cancelButtonLabel', { | ||
defaultMessage: 'Cancel', | ||
export const resetConfirmStrings = { | ||
getResetTitle: () => | ||
i18n.translate('dashboard.resetChangesConfirmModal.resetChangesTitle', { | ||
defaultMessage: 'Reset dashboard?', | ||
}), | ||
getResetSubtitle: (viewMode: ViewMode) => | ||
viewMode === ViewMode.EDIT | ||
? i18n.translate('dashboard.discardChangesConfirmModal.discardChangesDescription', { | ||
defaultMessage: `All unsaved changes will be lost.`, | ||
}) | ||
: i18n.translate('dashboard.resetChangesConfirmModal.resetChangesDescription', { | ||
defaultMessage: `This dashboard will return to its last saved state. You might lose changes to filters and queries.`, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @cqliu1 Brought up a good point that this could be rephrased to be something like Not sure we want to hold up this PR on a small copy change, but throwing it out there 💃 |
||
}), | ||
getResetConfirmButtonText: () => | ||
i18n.translate('dashboard.resetChangesConfirmModal.confirmButtonLabel', { | ||
defaultMessage: 'Reset dashboard', | ||
}), | ||
}; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -129,6 +129,10 @@ export class CustomizePanelAction implements Action<CustomizePanelActionContext> | |
{ | ||
size: 's', | ||
'data-test-subj': 'customizePanel', | ||
onClose: (overlayRef) => { | ||
if (overlayTracker) overlayTracker.clearOverlays(); | ||
overlayRef.close(); | ||
}, | ||
Comment on lines
+132
to
+135
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
} | ||
); | ||
overlayTracker?.openOverlay(handle); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is possible for a
view
view mode to be included in a dashboard's saved input - for example, in the sample dashboards, their imported state is inview
mode which meant that hitting the "reset" would actually flip them from edit mode into view mode (since this is included as part of the last saved input). This line ensures that view mode is ignored when resetting to the last saved input.