From f7918d7d6cfcd07f921f8fc9cfadcfd70cc7e76e Mon Sep 17 00:00:00 2001 From: Tsu-ba-me Date: Thu, 22 Jun 2023 03:28:11 -0400 Subject: [PATCH] fix(striker-ui): align request method, body in striker init form with API --- striker-ui/components/NetworkInitForm.tsx | 16 ++++++++-------- striker-ui/components/StrikerInitForm.tsx | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/striker-ui/components/NetworkInitForm.tsx b/striker-ui/components/NetworkInitForm.tsx index e4f599e9..82316682 100644 --- a/striker-ui/components/NetworkInitForm.tsx +++ b/striker-ui/components/NetworkInitForm.tsx @@ -78,7 +78,7 @@ type NetworkInterfaceInputMap = Record< >; type NetworkInitFormValues = { - domainNameServerCSV?: string; + dns?: string; gateway?: string; gatewayInterface?: string; networks: Omit[]; @@ -148,7 +148,7 @@ const NODE_REQUIRED_NETWORKS: NetworkInput[] = [ const MAX_INTERFACES_PER_NETWORK = 2; const IT_IDS = { - dnsCSV: 'domainNameServerCSV', + dnsCSV: 'dns', gateway: 'gateway', networkInterfaces: (prefix: string) => `${prefix}Interface`, networkIPAddress: (prefix: string) => `${prefix}IPAddress`, @@ -645,7 +645,7 @@ const NetworkInitForm = forwardRef< messageGroupRef.current.setMessageRe?.call(null, re, message), [], ); - const setDomainNameServerCSVInputMessage = useCallback( + const setDnsInputMessage = useCallback( (message?: Message) => setMessage(IT_IDS.dnsCSV, message), [setMessage], ); @@ -743,13 +743,13 @@ const NetworkInitForm = forwardRef< defaults: { getValue: () => dnsCSVInputRef.current.getValue?.call(null), onSuccess: () => { - setDomainNameServerCSVInputMessage(); + setDnsInputMessage(); }, }, tests: [ { onFailure: () => { - setDomainNameServerCSVInputMessage({ + setDnsInputMessage({ children: 'Domain name servers should be a comma-separated list of IPv4 addresses without trailing comma(s).', }); @@ -958,7 +958,7 @@ const NetworkInitForm = forwardRef< return tests; }, [ networkInputs, - setDomainNameServerCSVInputMessage, + setDnsInputMessage, setGatewayInputMessage, setMessage, subnetContains, @@ -1166,7 +1166,7 @@ const NetworkInitForm = forwardRef< ref, () => ({ get: () => ({ - domainNameServerCSV: dnsCSVInputRef.current.getValue?.call(null), + dns: dnsCSVInputRef.current.getValue?.call(null), gateway: gatewayInputRef.current.getValue?.call(null), gatewayInterface, networks: networkInputs.map( @@ -1400,7 +1400,7 @@ const NetworkInitForm = forwardRef< testInputToToggleSubmitDisabled({ inputs: { [IT_IDS.dnsCSV]: { value } }, }); - setDomainNameServerCSVInputMessage(); + setDnsInputMessage(); }} label="Domain name server(s)" value={xDns} diff --git a/striker-ui/components/StrikerInitForm.tsx b/striker-ui/components/StrikerInitForm.tsx index db20990e..578b069f 100644 --- a/striker-ui/components/StrikerInitForm.tsx +++ b/striker-ui/components/StrikerInitForm.tsx @@ -206,7 +206,7 @@ const StrikerInitForm: FC = () => { Domain name server(s) - {requestBody?.domainNameServerCSV} + {requestBody?.dns} } @@ -220,7 +220,7 @@ const StrikerInitForm: FC = () => { setIsOpenConfirm(false); api - .post('/init', requestBody) + .put('/init', requestBody) .then(() => { setIsSubmittingForm(false); })