Skip to content

Commit cf385db

Browse files
authored
Add "Activate vPro" button to host actions (#304)
1 parent b993541 commit cf385db

20 files changed

Lines changed: 306 additions & 84 deletions

File tree

apps/cluster-orch/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.2.1
1+
3.2.2

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: 3.2.1
7+
version: 3.2.2
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: "3.2.1"
11+
appVersion: "3.2.2"
1212
annotations: {}
1313
dependencies: []

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,12 @@ describe("<DeauthorizeNodeConfirmationDialog/>", () => {
3333
"host-dh38bjw9",
3434
);
3535

36-
pom.interceptApis([pom.api.putClusterNode]);
36+
pom.interceptApis([pom.api.patchHost, pom.api.putClusterNode]);
3737
pom.el.reason.type("sample-deauthorize-reason");
3838
cy.get(".spark-modal-footer").contains("Deauthorize").click();
3939

40+
cy.wait(`@${pom.api.patchHost}`);
41+
4042
cy.get(`@${pom.api.putClusterNode}`)
4143
.its("request.url")
4244
.then((url) => {
@@ -70,6 +72,8 @@ describe("<DeauthorizeNodeConfirmationDialog/>", () => {
7072
/>,
7173
);
7274

75+
pom.interceptApis([pom.api.patchHost, pom.api.putClusterNode]);
76+
7377
pom.el.reason.type("sample-deauthorize-reason");
7478

7579
cyGet("confirmBtn").click();

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { CyApiDetails, CyPom } from "@orch-ui/tests";
99
const dataCySelectors = ["reason"] as const;
1010
type Selectors = (typeof dataCySelectors)[number];
1111

12-
type ApiAliases = "putClusterNode";
12+
type ApiAliases = "putClusterNode" | "patchHost";
1313

1414
const endpoints: CyApiDetails<
1515
ApiAliases,
@@ -21,6 +21,12 @@ const endpoints: CyApiDetails<
2121
statusCode: 200,
2222
response: undefined,
2323
},
24+
patchHost: {
25+
route: "**/hosts/*",
26+
method: "PATCH",
27+
statusCode: 200,
28+
response: undefined,
29+
},
2430
};
2531

2632
class DeauthorizeNodeConfirmationDialogPom extends CyPom<

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

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55

6-
import { cm } from "@orch-ui/apis";
6+
import { cm, infra } from "@orch-ui/apis";
77
import { ConfirmationDialog } from "@orch-ui/components";
88
import {
99
hostsRoute,
@@ -59,6 +59,7 @@ const DeauthorizeNodeConfirmationDialog = ({
5959

6060
const [removeHostNodeFromCluster] =
6161
cm.usePutV2ProjectsByProjectNameClustersAndNameNodesMutation();
62+
const [patchHost] = infra.useHostServicePatchHostMutation();
6263

6364
const [deauthorizeReason, setDeauthorizeReason] = useState<string>();
6465

@@ -68,6 +69,16 @@ const DeauthorizeNodeConfirmationDialog = ({
6869

6970
const removeNodeFn = async () => {
7071
try {
72+
await patchHost({
73+
projectName: SharedStorage.project?.name ?? "",
74+
resourceId: hostId,
75+
hostResource: {
76+
name: hostName || hostId,
77+
desiredAmtState: "AMT_STATE_UNPROVISIONED",
78+
desiredPowerState: "POWER_STATE_OFF",
79+
},
80+
}).unwrap();
81+
7182
const deauthorizeFnList: (() => Promise<any>)[] = [];
7283

7384
if (name && hostUuid) {

apps/infra/VERSION

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

apps/infra/deploy/Chart.yaml

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

10-
appVersion: "3.2.4-dev"
10+
appVersion: "3.2.4"
1111
dependencies: []
1212
annotations: {}

apps/infra/src/components/molecules/ProvisionedHostPopup/ProvisionedHostPopup.cy.tsx

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,4 +117,46 @@ describe("<ProvisionedHostPopup />", () => {
117117
cy.get("@onDeauthorizeWithoutWorkloadStub").should("be.called");
118118
});
119119
});
120+
121+
describe("Provisioned host with vPro capabilities", () => {
122+
it("should show the Activate vPro option when AMT state is not provisioned", () => {
123+
const props: ProvisionedHostPopupProps = {
124+
host: {
125+
...provisionedHostOne,
126+
instance: {
127+
...hostOne.instance,
128+
workloadMembers: undefined,
129+
},
130+
amtSku: "AMT_SKU_AMT",
131+
currentAmtState: "AMT_STATE_UNSPECIFIED",
132+
},
133+
};
134+
cy.mount(<ProvisionedHostPopup {...props} />);
135+
pom.root.click();
136+
137+
pom.hostPopupPom
138+
.getActionPopupBySearchText("Activate vPro")
139+
.should("exist");
140+
});
141+
142+
it("should show the De-Activate vPro option when AMT state is provisioned", () => {
143+
const props: ProvisionedHostPopupProps = {
144+
host: {
145+
...provisionedHostOne,
146+
instance: {
147+
...hostOne.instance,
148+
workloadMembers: undefined,
149+
},
150+
amtSku: "AMT_SKU_AMT",
151+
currentAmtState: "AMT_STATE_PROVISIONED",
152+
},
153+
};
154+
cy.mount(<ProvisionedHostPopup {...props} />);
155+
pom.root.click();
156+
157+
pom.hostPopupPom
158+
.getActionPopupBySearchText("De-Activate vPro")
159+
.should("exist");
160+
});
161+
});
120162
});

apps/infra/src/components/molecules/ProvisionedHostPopup/ProvisionedHostPopup.tsx

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,18 @@ export type ProvisionedHostPopupProps = Omit<
3535
host: infra.HostResourceRead;
3636
onDeauthorizeHostWithoutWorkload?: (hostId: string) => void;
3737
onScheduleMaintenance?: (targetEntity: infra.HostResourceRead) => void;
38+
onToggleVpro?: (boolean) => void;
3839
};
3940

4041
/** This will show all available host actions within popup menu (active/configured, i.e, assigned/unassigned host only) */
4142
const ProvisionedHostPopup = (props: ProvisionedHostPopupProps) => {
4243
const cy = { "data-cy": dataCy };
43-
const { host, onDeauthorizeHostWithoutWorkload, onScheduleMaintenance } =
44-
props;
44+
const {
45+
host,
46+
onDeauthorizeHostWithoutWorkload,
47+
onScheduleMaintenance,
48+
onToggleVpro,
49+
} = props;
4550

4651
const navigate = useInfraNavigate();
4752

@@ -95,6 +100,24 @@ const ProvisionedHostPopup = (props: ProvisionedHostPopupProps) => {
95100
disable: !checkAuthAndRole([Role.INFRA_MANAGER_WRITE]),
96101
onSelect: () => onScheduleMaintenance && onScheduleMaintenance(host),
97102
},
103+
...((host.amtSku === "AMT_SKU_AMT" || host.amtSku === "AMT_SKU_ISM") &&
104+
host.currentAmtState !== "AMT_STATE_PROVISIONED"
105+
? [
106+
{
107+
displayText: "Activate vPro",
108+
onSelect: () => onToggleVpro && onToggleVpro(true),
109+
},
110+
]
111+
: []),
112+
...((host.amtSku === "AMT_SKU_AMT" || host.amtSku === "AMT_SKU_ISM") &&
113+
host.currentAmtState === "AMT_STATE_PROVISIONED"
114+
? [
115+
{
116+
displayText: "De-Activate vPro",
117+
onSelect: () => onToggleVpro && onToggleVpro(false),
118+
},
119+
]
120+
: []),
98121
];
99122

100123
// Graphana: add Dashboard access

apps/infra/src/components/organism/ConfigureAllHosts/ConfigureAllHosts.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import {
2424
setCommonPublicSshKey,
2525
setCommonSecurityFeature,
2626
setCommonSite,
27-
setCommonVPro,
2827
setShowAdvancedOptions,
2928
setValidationError,
3029
} from "../../../store/provisionHost";
@@ -151,7 +150,7 @@ const ConfigureAllHosts = () => {
151150
>
152151
<Section title="Security options">
153152
<Flex cols={[6]} gap="2" align="start">
154-
<div>
153+
{/* <div>
155154
<Heading semanticLevel={6}>vPro</Heading>
156155
<p>Enable vPro</p>
157156
<ToggleSwitch
@@ -162,7 +161,7 @@ const ConfigureAllHosts = () => {
162161
>
163162
{commonHostData.vPro ? "Enabled" : "Disabled"}
164163
</ToggleSwitch>
165-
</div>
164+
</div> */}
166165
<div>
167166
<Heading semanticLevel={6}>
168167
Secure Boot and Full Disk Encryption

0 commit comments

Comments
 (0)