diff --git a/public/components/CustomLabel/CustomLabel.tsx b/public/components/CustomLabel/CustomLabel.tsx index 43443b869..64bd235b3 100644 --- a/public/components/CustomLabel/CustomLabel.tsx +++ b/public/components/CustomLabel/CustomLabel.tsx @@ -10,15 +10,14 @@ interface CustomLabelProps { title: string | JSX.Element; isOptional?: boolean; helpText?: string | JSX.Element; - checkboxLable?: boolean; } -const CustomLabel = ({ title, isOptional = false, helpText, checkboxLable = false }: CustomLabelProps) => ( +const CustomLabel = ({ title, isOptional = false, helpText }: CustomLabelProps) => ( <> {title && typeof title == "string" ? ( - {checkboxLable ?

{title}

:

{title}

}
+ {

{title}

}
{isOptional ? ( @@ -35,7 +34,7 @@ const CustomLabel = ({ title, isOptional = false, helpText, checkboxLable = fals {helpText && typeof helpText === "string" ? {helpText} : helpText} - {checkboxLable ? null : } + ); diff --git a/public/pages/CreateSnapshotPolicy/components/SnapshotAdvancedSettings/SnapshotAdvancedSettings.tsx b/public/pages/CreateSnapshotPolicy/components/SnapshotAdvancedSettings/SnapshotAdvancedSettings.tsx index 99944e676..eebd7696b 100644 --- a/public/pages/CreateSnapshotPolicy/components/SnapshotAdvancedSettings/SnapshotAdvancedSettings.tsx +++ b/public/pages/CreateSnapshotPolicy/components/SnapshotAdvancedSettings/SnapshotAdvancedSettings.tsx @@ -6,6 +6,7 @@ import { EuiCompressedCheckbox, EuiFlexGroup, EuiFlexItem, EuiSpacer, EuiText } from "@elastic/eui"; import CustomLabel from "../../../../components/CustomLabel"; import React, { ChangeEvent } from "react"; +import { CheckBoxLabel } from "../../../Snapshots/helper"; interface SnapshotAdvancedSettingsProps { includeGlobalState: boolean; @@ -41,7 +42,7 @@ const SnapshotAdvancedSettings = ({
} + label={} checked={includeGlobalState} onChange={onIncludeGlobalStateToggle} /> @@ -51,10 +52,9 @@ const SnapshotAdvancedSettings = ({ } checked={ignoreUnavailable} @@ -65,13 +65,7 @@ const SnapshotAdvancedSettings = ({ - } + label={} checked={partial} onChange={onPartialToggle} /> diff --git a/public/pages/CreateSnapshotPolicy/containers/CreateSnapshotPolicy/CreateSnapshotPolicy.tsx b/public/pages/CreateSnapshotPolicy/containers/CreateSnapshotPolicy/CreateSnapshotPolicy.tsx index aa9f2cf74..6c2bed828 100644 --- a/public/pages/CreateSnapshotPolicy/containers/CreateSnapshotPolicy/CreateSnapshotPolicy.tsx +++ b/public/pages/CreateSnapshotPolicy/containers/CreateSnapshotPolicy/CreateSnapshotPolicy.tsx @@ -579,9 +579,9 @@ export class CreateSnapshotPolicy extends MDSEnabledComponent ) : ( <> - +

{isEdit ? "Edit" : "Create"} policy

-
+ {subTitleText} @@ -928,7 +928,7 @@ export class CreateSnapshotPolicy extends MDSEnabledComponent - + Cancel diff --git a/public/pages/Reindex/components/CreateIndexFlyout/__snapshots__/CreateIndexFlyout.test.tsx.snap b/public/pages/Reindex/components/CreateIndexFlyout/__snapshots__/CreateIndexFlyout.test.tsx.snap index 5ff8cf96a..65b709610 100644 --- a/public/pages/Reindex/components/CreateIndexFlyout/__snapshots__/CreateIndexFlyout.test.tsx.snap +++ b/public/pages/Reindex/components/CreateIndexFlyout/__snapshots__/CreateIndexFlyout.test.tsx.snap @@ -821,7 +821,7 @@ Object { class="euiFlyoutFooter" >
- - {_.truncate(policyId)} - + +

{_.truncate(policyId)}

+
diff --git a/public/pages/Snapshots/components/CreateSnapshotFlyout/CreateSnapshotFlyout.tsx b/public/pages/Snapshots/components/CreateSnapshotFlyout/CreateSnapshotFlyout.tsx index 8b93eb477..78e46619d 100644 --- a/public/pages/Snapshots/components/CreateSnapshotFlyout/CreateSnapshotFlyout.tsx +++ b/public/pages/Snapshots/components/CreateSnapshotFlyout/CreateSnapshotFlyout.tsx @@ -259,7 +259,14 @@ export class CreateSnapshotFlyout extends MDSEnabledComponent - + +

Advanced options

+ + } + > { + onRestore = (success: boolean, response: object = {}) => { const { selectedItems } = this.state; let errorMessage: string | undefined; if (!success) { let optionalMessage = ""; + const errorString = response.error || JSON.stringify(response); - if (error.reason.indexOf("open index with same name") >= 0) { + if (errorString.indexOf("open index with same name") >= 0) { optionalMessage = "You have an index with the same name. Try a different prefix."; } - errorMessage = `${optionalMessage}`; + errorMessage = `${optionalMessage} ${errorString}`; } const toasts = success - ? getToasts("success_restore_toast", errorMessage, selectedItems[0].id, this.onClickTab) + ? getToasts("success_restore_toast", undefined, selectedItems[0].id, this.onClickTab) : getToasts("error_restore_toast", errorMessage, selectedItems[0].id, this.onOpenError); - this.setState({ toasts, error: error }); + this.setState({ toasts, error: response.error }); }; onOpenError = () => { @@ -534,7 +535,7 @@ export class Snapshots extends MDSEnabledComponent Restore , - + Take snapshot , ]; @@ -555,6 +556,7 @@ export class Snapshots extends MDSEnabledComponent -

Snapshots

- - ); + const showTitle = useNewUX ? undefined : ( + +

Snapshots

+
+ ); const SnapshotTabName = useNewUX ? "Index snapshots" : "Snapshots"; const useActions = useNewUX ? undefined : actions; const useSubTitle = useNewUX ? undefined : subTitleText; diff --git a/public/pages/Snapshots/helper.tsx b/public/pages/Snapshots/helper.tsx index cd9eda19a..311b53d06 100644 --- a/public/pages/Snapshots/helper.tsx +++ b/public/pages/Snapshots/helper.tsx @@ -71,15 +71,17 @@ export const getToasts = (id: string, message: string | undefined, snapshotId: s interface CheckboxLabelProps { title: string; - helpText: string; + helpText?: string; } export const CheckBoxLabel = ({ title, helpText }: CheckboxLabelProps) => ( <> {title} - - {helpText} - + {helpText ? ( + + {helpText} + + ) : null} ); diff --git a/public/pages/VisualCreatePolicy/components/FlyoutFooter/FlyoutFooter.tsx b/public/pages/VisualCreatePolicy/components/FlyoutFooter/FlyoutFooter.tsx index 227479a1f..8b0de80a1 100644 --- a/public/pages/VisualCreatePolicy/components/FlyoutFooter/FlyoutFooter.tsx +++ b/public/pages/VisualCreatePolicy/components/FlyoutFooter/FlyoutFooter.tsx @@ -18,14 +18,20 @@ interface FlyoutFooterProps { } const FlyoutFooter = ({ edit, action, disabledAction = false, onClickCancel, onClickAction, save, restore, text }: FlyoutFooterProps) => ( - + Cancel - + {text ? text : restore ? "Restore snapshot" : !save ? `${edit ? "Edit" : "Add"} ${action}` : save ? "Save" : "Create"} diff --git a/public/pages/VisualCreatePolicy/components/FlyoutFooter/__snapshots__/FlyoutFooter.test.tsx.snap b/public/pages/VisualCreatePolicy/components/FlyoutFooter/__snapshots__/FlyoutFooter.test.tsx.snap index 4e160c81a..c227dabf4 100644 --- a/public/pages/VisualCreatePolicy/components/FlyoutFooter/__snapshots__/FlyoutFooter.test.tsx.snap +++ b/public/pages/VisualCreatePolicy/components/FlyoutFooter/__snapshots__/FlyoutFooter.test.tsx.snap @@ -2,7 +2,7 @@ exports[` spec renders the component 1`] = `