Skip to content

Commit

Permalink
Fix reset button behavior based on feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
AbrarAlHasan committed Jun 12, 2023
1 parent 18cffa9 commit 3eb79f3
Showing 1 changed file with 6 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,9 @@ export const CustomizePanelEditor = (props: CustomizePanelProps) => {
<EuiButtonEmpty
size="xs"
data-test-subj="resetCustomEmbeddablePanelTitleButton"
onClick={() => {
setPanelTitle(embeddable.getInput().title ?? embeddable.getOutput().defaultTitle);
}}
onClick={() => setPanelTitle(embeddable.getOutput().defaultTitle)}
disabled={
hideTitle || !editMode || embeddable.getInput().title != undefined
? embeddable.getInput().title === panelTitle
: embeddable.getOutput().defaultTitle === panelTitle || panelTitle === ''
hideTitle || !editMode || embeddable.getOutput().defaultTitle === panelTitle
}
aria-label={i18n.translate(
'embeddableApi.customizePanel.flyout.optionsMenuForm.resetCustomTitleButtonAriaLabel',
Expand Down Expand Up @@ -176,15 +172,12 @@ export const CustomizePanelEditor = (props: CustomizePanelProps) => {
size="xs"
data-test-subj="resetCustomEmbeddablePanelDescriptionButton"
onClick={() => {
setPanelDescription(
embeddable.getInput().description ?? embeddable.getOutput().defaultDescription
);
setPanelDescription(embeddable.getOutput().defaultDescription);
}}
disabled={
hideTitle || !editMode || embeddable.getInput().description != undefined
? embeddable.getInput().description === panelDescription
: embeddable.getOutput().defaultDescription === panelDescription ||
panelDescription === ''
hideTitle ||
!editMode ||
embeddable.getOutput().defaultDescription === panelDescription
}
aria-label={i18n.translate(
'embeddableApi.customizePanel.flyout.optionsMenuForm.resetCustomDescriptionButtonAriaLabel',
Expand Down

0 comments on commit 3eb79f3

Please sign in to comment.