From 4948e387b81119c8fc3ec804e7eacede6c11f25c Mon Sep 17 00:00:00 2001 From: Caleb Ellis Date: Thu, 11 Mar 2021 10:41:48 +1000 Subject: [PATCH] fix(ui): add proxmox field names to add_chassis parameter map --- .../CommissionForm/CommissionForm.tsx | 9 +++++++++ .../ActionFormWrapper/TestForm/TestForm.js | 9 +++++++++ ui/src/app/utils/formatPowerParameters.js | 3 +++ ui/src/app/utils/formatPowerParameters.test.js | 13 +++++++++++-- 4 files changed, 32 insertions(+), 2 deletions(-) diff --git a/ui/src/app/machines/views/MachineList/MachineListHeader/ActionFormWrapper/CommissionForm/CommissionForm.tsx b/ui/src/app/machines/views/MachineList/MachineListHeader/ActionFormWrapper/CommissionForm/CommissionForm.tsx index 4ad69c456a..95fc763d44 100644 --- a/ui/src/app/machines/views/MachineList/MachineListHeader/ActionFormWrapper/CommissionForm/CommissionForm.tsx +++ b/ui/src/app/machines/views/MachineList/MachineListHeader/ActionFormWrapper/CommissionForm/CommissionForm.tsx @@ -1,3 +1,4 @@ +import { Spinner, Strip } from "@canonical/react-components"; import PropTypes from "prop-types"; import React, { useEffect } from "react"; import { useDispatch, useSelector } from "react-redux"; @@ -63,6 +64,7 @@ export const CommissionForm = ({ setSelectedAction }: Props): JSX.Element => { const dispatch = useDispatch(); const selectedMachines = useSelector(machineSelectors.selected); const errors = useSelector(machineSelectors.errors); + const scriptsLoaded = useSelector(scriptSelectors.loaded); const commissioningScripts = useSelector(scriptSelectors.commissioning); const preselectedCommissioningScripts = useSelector( scriptSelectors.preselectedCommissioning @@ -102,6 +104,13 @@ export const CommissionForm = ({ setSelectedAction }: Props): JSX.Element => { } }, [dispatch, scriptsLoaded]); + if (!scriptsLoaded) { + return ( + + + + ); + } return ( { const errors = useSelector(machineSelectors.errors); const testingSelected = useSelector(machineSelectors.testingSelected); const scripts = useSelector(scriptSelectors.testing); + const scriptsLoaded = useSelector(scriptSelectors.loaded); const urlScripts = useSelector(scriptSelectors.testingWithUrl); const formattedScripts = scripts.map((script) => ({ @@ -61,6 +63,13 @@ export const TestForm = ({ setSelectedAction }) => { } }, [dispatch, scriptsLoaded]); + if (!scriptsLoaded) { + return ( + + + + ); + } return ( { { name: "power_pass" }, { name: "power_port" }, { name: "power_protocol" }, + { name: "power_token_name" }, + { name: "power_token_secret" }, { name: "power_user" }, + { name: "power_verify_ssl" }, ], }; @@ -32,7 +35,10 @@ describe("formatPowerParameters", () => { power_pass: "value2", power_port: "value3", power_protocol: "value4", - power_user: "value5", + power_token_name: "value5", + power_token_secret: "value6", + power_user: "value7", + power_verify_ssl: "value8", }; expect( formatPowerParameters(powerType, powerParameters, "chassis") @@ -41,7 +47,10 @@ describe("formatPowerParameters", () => { password: "value2", port: "value3", protocol: "value4", - username: "value5", + token_name: "value5", + token_secret: "value6", + username: "value7", + verify_ssl: "value8", }); });