Skip to content

Commit ecc70d7

Browse files
[ITEP-25067] Fix Deauthorized 404 Page visit for new UI upon Deauth Host with cluster (#32)
Co-authored-by: Matteo <teone@users.noreply.github.com>
1 parent 9673b92 commit ecc70d7

4 files changed

Lines changed: 16 additions & 3 deletions

File tree

apps/cluster-orch/src/components/organism/DeauthorizeNodeConfirmationDialog/DeauthorizeNodeConfirmationDialog.cy.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ describe("<DeauthorizeNodeConfirmationDialog/>", () => {
4444
expect(match && match.length > 0).to.eq(true);
4545
});
4646

47-
cy.get("#pathname").contains("/infrastructure/deauthorized-hosts");
47+
cy.get("#pathname").contains("/infrastructure/hosts");
4848
});
4949
});
5050

apps/cluster-orch/src/components/organism/DeauthorizeNodeConfirmationDialog/DeauthorizeNodeConfirmationDialog.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ const DeauthorizeNodeConfirmationDialog = ({
9393
})
9494
.then(() => {
9595
setErrorInfo();
96-
navigate("/infrastructure/deauthorized-hosts");
96+
navigate("/infrastructure/hosts", { relative: "path" });
9797
});
9898
} catch (e) {
9999
setErrorInfo(e);

apps/infra/src/components/atom/GenericHostPopup/GenericHostPopup.cy.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,19 @@ describe("<GenericHostPopup/>", () => {
7373
pom.getActionPopupBySearchText("Deauthorize").click();
7474
cy.get("@onDeauthorize").should("be.called");
7575
});
76+
it("should disable Deauthorize button when host.currentState is HOST_STATE_UNTRUSTED", () => {
77+
cy.mount(
78+
<GenericHostPopup
79+
host={{ ...hostOne, currentState: "HOST_STATE_UNTRUSTED" }}
80+
showViewDetailsOption
81+
onDeauthorize={cy.stub().as("onDeauthorize")}
82+
/>,
83+
);
84+
pom.popupPom.root.click();
85+
pom
86+
.getActionPopupBySearchText("Deauthorize")
87+
.should("have.class", "popup__option-item-disable");
88+
});
7689
it("should call onDelete when `Delete` is clicked", () => {
7790
pom.getActionPopupBySearchText("Delete").click();
7891
cy.get("@onDelete").should("be.called");

apps/infra/src/components/atom/GenericHostPopup/GenericHostPopup.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ const GenericHostPopup = ({
102102
// Add additional options
103103
popupOptions.push({
104104
displayText: "Deauthorize",
105-
disable: hasPermission,
105+
disable: hasPermission || host.currentState === "HOST_STATE_UNTRUSTED",
106106
onSelect: () => onDeauthorize && onDeauthorize(hostId),
107107
});
108108

0 commit comments

Comments
 (0)