From dcdfd220276e66d8427b540e89e78a85da119f08 Mon Sep 17 00:00:00 2001 From: suzhou Date: Tue, 3 Jan 2023 12:13:41 +0800 Subject: [PATCH] feat: update Signed-off-by: suzhou --- .../DeleteAliasModal/DeleteAliasModal.tsx | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/public/pages/Aliases/containers/DeleteAliasModal/DeleteAliasModal.tsx b/public/pages/Aliases/containers/DeleteAliasModal/DeleteAliasModal.tsx index 1613fb69d..5b3b320e0 100644 --- a/public/pages/Aliases/containers/DeleteAliasModal/DeleteAliasModal.tsx +++ b/public/pages/Aliases/containers/DeleteAliasModal/DeleteAliasModal.tsx @@ -7,6 +7,7 @@ import React, { useCallback, useContext, useEffect, useState } from "react"; import { EuiButton, EuiButtonEmpty, + EuiCallOut, EuiFieldText, EuiModal, EuiModalBody, @@ -16,9 +17,11 @@ import { EuiSpacer, EuiText, } from "@elastic/eui"; +import { CoreStart } from "opensearch-dashboards/public"; import { ServicesContext } from "../../../../services"; import { CoreServicesContext } from "../../../../components/core_services"; -import { CoreStart } from "opensearch-dashboards/public"; +import { filterByMinimatch } from "../../../../../utils/helper"; +import { SYSTEM_ALIAS } from "../../../../../utils/constants"; interface DeleteAliasModalProps { selectedItems: string[]; @@ -60,6 +63,8 @@ export default function DeleteAliasModal(props: DeleteAliasModalProps) { return null; } + const hasSystemIndex = props.selectedItems.some((index) => filterByMinimatch(index, SYSTEM_ALIAS)); + return ( @@ -67,6 +72,12 @@ export default function DeleteAliasModal(props: DeleteAliasModalProps) { + {hasSystemIndex ? ( + <> + You are trying to delete system-like alias, please be careful. + + + ) : null}

The following alias will be permanently deleted. This action cannot be undone.