mirror of
https://github.com/datahub-project/datahub.git
synced 2025-11-08 15:30:55 +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 ? (
|
return entityData ? (
|
||||||
<>
|
<>
|
||||||
<Modal
|
<Modal
|
||||||
@ -162,7 +176,7 @@ export const LinkList = ({ refetch }: LinkListProps) => {
|
|||||||
<Button onClick={() => handleEditLink(link)} type="text" shape="circle">
|
<Button onClick={() => handleEditLink(link)} type="text" shape="circle">
|
||||||
<EditOutlined />
|
<EditOutlined />
|
||||||
</Button>
|
</Button>
|
||||||
<Button onClick={() => handleDeleteLink(link)} type="text" shape="circle" danger>
|
<Button onClick={() => onConfirmDelete(link)} type="text" shape="circle" danger>
|
||||||
<DeleteOutlined />
|
<DeleteOutlined />
|
||||||
</Button>
|
</Button>
|
||||||
</>
|
</>
|
||||||
|
|||||||
@ -77,7 +77,11 @@ const clearAndDelete = () => {
|
|||||||
cy.clickOptionWithTestId("description-editor-save-button");
|
cy.clickOptionWithTestId("description-editor-save-button");
|
||||||
cy.waitTextVisible("No documentation");
|
cy.waitTextVisible("No documentation");
|
||||||
cy.mouseover(".ant-list-item-meta-content");
|
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");
|
cy.waitTextVisible("Link Removed");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -35,7 +35,11 @@ describe("edit documentation and link to dataset", () => {
|
|||||||
);
|
);
|
||||||
cy.openEntityTab("Documentation");
|
cy.openEntityTab("Documentation");
|
||||||
cy.contains("Sample doc").trigger("mouseover", { force: true });
|
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.waitTextVisible("Link Removed");
|
||||||
cy.clickOptionWithTestId("add-link-button").wait(1000);
|
cy.clickOptionWithTestId("add-link-button").wait(1000);
|
||||||
cy.enterTextInTestId("add-link-modal-url", wrong_url);
|
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("[data-testid='edit-documentation-button']").should("be.visible");
|
||||||
cy.get(`[href='${correct_url}']`).should("be.visible");
|
cy.get(`[href='${correct_url}']`).should("be.visible");
|
||||||
cy.contains("Sample doc").trigger("mouseover", { force: true });
|
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.waitTextVisible("Link Removed");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user