Skip to content

Commit

Permalink
feat(UI): Confirmation before deleting Link (#12162)
Browse files Browse the repository at this point in the history
  • Loading branch information
pinakipb2 authored Feb 5, 2025
1 parent 1cb9165 commit 468112b
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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>
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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");
});

Expand Down

0 comments on commit 468112b

Please sign in to comment.