Skip to content

Commit

Permalink
dashboard Reset button disable (elastic#159430)
Browse files Browse the repository at this point in the history
Disables reset button on title and description when they are the same as default.
  • Loading branch information
AbrarAlHasan authored and saarikabhasi committed Jun 14, 2023
1 parent 4672d44 commit 139c2a2
Showing 1 changed file with 8 additions and 2 deletions.
Expand Up @@ -126,7 +126,9 @@ export const CustomizePanelEditor = (props: CustomizePanelProps) => {
size="xs"
data-test-subj="resetCustomEmbeddablePanelTitleButton"
onClick={() => setPanelTitle(embeddable.getOutput().defaultTitle)}
disabled={hideTitle || !editMode}
disabled={
hideTitle || !editMode || embeddable.getOutput().defaultTitle === panelTitle
}
aria-label={i18n.translate(
'embeddableApi.customizePanel.flyout.optionsMenuForm.resetCustomTitleButtonAriaLabel',
{
Expand Down Expand Up @@ -172,7 +174,11 @@ export const CustomizePanelEditor = (props: CustomizePanelProps) => {
onClick={() => {
setPanelDescription(embeddable.getOutput().defaultDescription);
}}
disabled={hideTitle || !editMode}
disabled={
hideTitle ||
!editMode ||
embeddable.getOutput().defaultDescription === panelDescription
}
aria-label={i18n.translate(
'embeddableApi.customizePanel.flyout.optionsMenuForm.resetCustomDescriptionButtonAriaLabel',
{
Expand Down

0 comments on commit 139c2a2

Please sign in to comment.