mirror of
https://github.com/datahub-project/datahub.git
synced 2025-11-02 03:39:03 +00:00
feat(UI): Confirmation before deleting Link (#12162)
This commit is contained in:
parent
1cb916550e
commit
468112b11c
@ -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>
|
||||
</>
|
||||
|
||||
@ -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");
|
||||
};
|
||||
|
||||
|
||||
@ -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");
|
||||
});
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user