Skip to content

Commit c8587de

Browse files
authored
Fix modal for deauthorizing provisioned hosts (#251)
1 parent 437421e commit c8587de

5 files changed

Lines changed: 21 additions & 6 deletions

File tree

apps/cluster-orch/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.0.26-dev
1+
2.0.26

apps/cluster-orch/deploy/Chart.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ apiVersion: v2
44
name: orch-ui-cluster-orch
55
description: Deploy the Edge Orchestrator cluster-orch pod
66
type: application
7-
version: 2.0.26-dev
7+
version: 2.0.26
88
# Default appVersion will be overwritten by a the build to use the version from package.json.
99

1010
# This value is supplied only to enable local unbuilt deployment of released content.
11-
appVersion: "2.0.26-dev"
11+
appVersion: "2.0.26"
1212
annotations: {}
1313
dependencies: []

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ describe("<DeauthorizeNodeConfirmationDialog/>", () => {
3434
);
3535

3636
pom.interceptApis([pom.api.putClusterNode]);
37+
pom.el.reason.type("sample-deauthorize-reason");
3738
cy.get(".spark-modal-footer").contains("Deauthorize").click();
3839

3940
cy.get(`@${pom.api.putClusterNode}`)
@@ -46,6 +47,12 @@ describe("<DeauthorizeNodeConfirmationDialog/>", () => {
4647

4748
cy.get("#pathname").contains("/infrastructure/hosts");
4849
});
50+
51+
it("should enable the Deauthorize button only if a valid deauthorization reason is provided", () => {
52+
cyGet("confirmBtn").should("have.attr", "aria-disabled", "true");
53+
pom.el.reason.type("sample-deauthorize-reason");
54+
cyGet("confirmBtn").should("have.attr", "aria-disabled", "false");
55+
});
4956
});
5057

5158
describe("calls deathorize host function", () => {
@@ -62,6 +69,9 @@ describe("<DeauthorizeNodeConfirmationDialog/>", () => {
6269
setErrorInfo={() => {}}
6370
/>,
6471
);
72+
73+
pom.el.reason.type("sample-deauthorize-reason");
74+
6575
cyGet("confirmBtn").click();
6676
cy.get("@deauthorizeHostStub").should("have.been.called");
6777
});

apps/cluster-orch/src/components/organism/DeauthorizeNodeConfirmationDialog/DeauthorizeNodeConfirmationDialog.pom.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import { cm } from "@orch-ui/apis";
77
import { CyApiDetails, CyPom } from "@orch-ui/tests";
88

9-
const dataCySelectors = [] as const;
9+
const dataCySelectors = ["reason"] as const;
1010
type Selectors = (typeof dataCySelectors)[number];
1111

1212
type ApiAliases = "putClusterNode";

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,12 @@ const DeauthorizeNodeConfirmationDialog = ({
117117
render={({ field }) => (
118118
<TextField
119119
{...field}
120-
label="Deauthorize reason (Optional)"
120+
label="Reason for deauthorization"
121121
data-cy="reason"
122122
onInput={(e) => {
123-
setDeauthorizeReason(e.currentTarget.value);
123+
const value = e.currentTarget.value;
124+
setDeauthorizeReason(value);
125+
field.onChange(value);
124126
}}
125127
size={InputSize.Large}
126128
className="text-field-align"
@@ -151,6 +153,9 @@ const DeauthorizeNodeConfirmationDialog = ({
151153
cancelCb={() => setDeauthorizeConfirmationOpen(false)}
152154
buttonPlacement="left-reverse"
153155
size={ModalSize.Medium}
156+
confirmBtnDisabled={
157+
!deauthorizeReason || deauthorizeReason.trim().length === 0
158+
}
154159
/>
155160
) : (
156161
<></>

0 commit comments

Comments
 (0)