feat(UI): Confirmation before deleting Link (#12162)

This commit is contained in:
Pinaki Bhattacharjee 2025-02-06 00:38:01 +05:30 committed by GitHub
parent 1cb916550e
commit 468112b11c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 30 additions and 4 deletions

View File

@ -103,6 +103,20 @@ export const LinkList = ({ refetch }: LinkListProps) => {
}
};
const onConfirmDelete = (link) => {
Modal.confirm({
title: `Delete Link '${link?.description}'`,
content: `Are you sure you want to remove this Link?`,
onOk() {
handleDeleteLink(link);
},
onCancel() {},
okText: 'Yes',
maskClosable: true,
closable: true,
});
};
return entityData ? (
<>
<Modal
@ -162,7 +176,7 @@ export const LinkList = ({ refetch }: LinkListProps) => {
<Button onClick={() => handleEditLink(link)} type="text" shape="circle">
<EditOutlined />
</Button>
<Button onClick={() => handleDeleteLink(link)} type="text" shape="circle" danger>
<Button onClick={() => onConfirmDelete(link)} type="text" shape="circle" danger>
<DeleteOutlined />
</Button>
</>

View File

@ -77,7 +77,11 @@ const clearAndDelete = () => {
cy.clickOptionWithTestId("description-editor-save-button");
cy.waitTextVisible("No documentation");
cy.mouseover(".ant-list-item-meta-content");
cy.get('[aria-label="delete"]').click();
cy.get('[aria-label="delete"]').click().wait(1000);
cy.get("button")
.contains("span", "Yes")
.should("be.visible")
.click({ force: true });
cy.waitTextVisible("Link Removed");
};

View File

@ -35,7 +35,11 @@ describe("edit documentation and link to dataset", () => {
);
cy.openEntityTab("Documentation");
cy.contains("Sample doc").trigger("mouseover", { force: true });
cy.get('[data-icon="delete"]').click();
cy.get('[data-icon="delete"]').click().wait(1000);
cy.get("button")
.contains("span", "Yes")
.should("be.visible")
.click({ force: true });
cy.waitTextVisible("Link Removed");
cy.clickOptionWithTestId("add-link-button").wait(1000);
cy.enterTextInTestId("add-link-modal-url", wrong_url);
@ -69,7 +73,11 @@ describe("edit documentation and link to dataset", () => {
cy.get("[data-testid='edit-documentation-button']").should("be.visible");
cy.get(`[href='${correct_url}']`).should("be.visible");
cy.contains("Sample doc").trigger("mouseover", { force: true });
cy.get('[data-icon="delete"]').click();
cy.get('[data-icon="delete"]').click().wait(1000);
cy.get("button")
.contains("span", "Yes")
.should("be.visible")
.click({ force: true });
cy.waitTextVisible("Link Removed");
});