fix(striker-ui): remove MTU from manifest forms

main^2
Tsu-ba-me 6 months ago
parent f5351cb50c
commit 9f888fbe27
  1. 2
      striker-ui/components/ManageManifest/AddManifestInputGroup.tsx
  2. 44
      striker-ui/components/ManageManifest/AnNetworkConfigInputGroup.tsx
  3. 2
      striker-ui/components/ManageManifest/EditManifestInputGroup.tsx
  4. 7
      striker-ui/components/ManageManifest/ManageManifestPanel.tsx
  5. 8
      striker-ui/components/ManageManifest/RunManifestInputGroup.tsx
  6. 2
      striker-ui/types/ManageManifest.d.ts

@ -8,7 +8,6 @@ import AnIdInputGroup, {
} from './AnIdInputGroup'; } from './AnIdInputGroup';
import AnNetworkConfigInputGroup, { import AnNetworkConfigInputGroup, {
INPUT_ID_ANC_DNS, INPUT_ID_ANC_DNS,
INPUT_ID_ANC_MTU,
INPUT_ID_ANC_NTP, INPUT_ID_ANC_NTP,
} from './AnNetworkConfigInputGroup'; } from './AnNetworkConfigInputGroup';
import FlexBox from '../FlexBox'; import FlexBox from '../FlexBox';
@ -41,7 +40,6 @@ const AddManifestInputGroup = <
| typeof INPUT_ID_AI_PREFIX | typeof INPUT_ID_AI_PREFIX
| typeof INPUT_ID_AI_SEQUENCE | typeof INPUT_ID_AI_SEQUENCE
| typeof INPUT_ID_ANC_DNS | typeof INPUT_ID_ANC_DNS
| typeof INPUT_ID_ANC_MTU
| typeof INPUT_ID_ANC_NTP]: string; | typeof INPUT_ID_ANC_NTP]: string;
}, },
>({ >({

@ -10,21 +10,16 @@ import Grid from '../Grid';
import IconButton from '../IconButton'; import IconButton from '../IconButton';
import InputWithRef from '../InputWithRef'; import InputWithRef from '../InputWithRef';
import OutlinedInputWithLabel from '../OutlinedInputWithLabel'; import OutlinedInputWithLabel from '../OutlinedInputWithLabel';
import { import { buildIpCsvTestBatch } from '../../lib/test_input';
buildIpCsvTestBatch,
buildNumberTestBatch,
} from '../../lib/test_input';
const INPUT_ID_PREFIX_AN_NETWORK_CONFIG = 'an-network-config-input'; const INPUT_ID_PREFIX_AN_NETWORK_CONFIG = 'an-network-config-input';
const INPUT_CELL_ID_PREFIX_ANC = `${INPUT_ID_PREFIX_AN_NETWORK_CONFIG}-cell`; const INPUT_CELL_ID_PREFIX_ANC = `${INPUT_ID_PREFIX_AN_NETWORK_CONFIG}-cell`;
const INPUT_ID_ANC_DNS = `${INPUT_ID_PREFIX_AN_NETWORK_CONFIG}-dns`; const INPUT_ID_ANC_DNS = `${INPUT_ID_PREFIX_AN_NETWORK_CONFIG}-dns`;
const INPUT_ID_ANC_MTU = `${INPUT_ID_PREFIX_AN_NETWORK_CONFIG}-mtu`;
const INPUT_ID_ANC_NTP = `${INPUT_ID_PREFIX_AN_NETWORK_CONFIG}-ntp`; const INPUT_ID_ANC_NTP = `${INPUT_ID_PREFIX_AN_NETWORK_CONFIG}-ntp`;
const INPUT_LABEL_ANC_DNS = 'DNS'; const INPUT_LABEL_ANC_DNS = 'DNS';
const INPUT_LABEL_ANC_MTU = 'MTU';
const INPUT_LABEL_ANC_NTP = 'NTP'; const INPUT_LABEL_ANC_NTP = 'NTP';
const DEFAULT_DNS_CSV = '8.8.8.8,8.8.4.4'; const DEFAULT_DNS_CSV = '8.8.8.8,8.8.4.4';
@ -73,17 +68,13 @@ const guessNetworkMinIp = ({
const AnNetworkConfigInputGroup = < const AnNetworkConfigInputGroup = <
M extends MapToInputTestID & { M extends MapToInputTestID & {
[K in [K in typeof INPUT_ID_ANC_DNS | typeof INPUT_ID_ANC_NTP]: string;
| typeof INPUT_ID_ANC_DNS
| typeof INPUT_ID_ANC_MTU
| typeof INPUT_ID_ANC_NTP]: string;
}, },
>({ >({
formUtils, formUtils,
networkListEntries, networkListEntries,
previous: { previous: {
dnsCsv: previousDnsCsv = DEFAULT_DNS_CSV, dnsCsv: previousDnsCsv = DEFAULT_DNS_CSV,
mtu: previousMtu,
ntpCsv: previousNtpCsv, ntpCsv: previousNtpCsv,
} = {}, } = {},
setNetworkList, setNetworkList,
@ -448,41 +439,12 @@ const AnNetworkConfigInputGroup = <
/> />
), ),
}, },
'an-network-config-input-cell-mtu': {
children: (
<InputWithRef
input={
<OutlinedInputWithLabel
id={INPUT_ID_ANC_MTU}
inputProps={{ placeholder: '1500' }}
label={INPUT_LABEL_ANC_MTU}
value={previousMtu}
/>
}
inputTestBatch={buildNumberTestBatch(
INPUT_LABEL_ANC_MTU,
() => {
setMessage(INPUT_ID_ANC_MTU);
},
{
onFinishBatch:
buildFinishInputTestBatchFunction(INPUT_ID_ANC_MTU),
},
(message) => {
setMessage(INPUT_ID_ANC_MTU, { children: message });
},
)}
onFirstRender={buildInputFirstRenderFunction(INPUT_ID_ANC_MTU)}
valueType="number"
/>
),
},
}} }}
spacing="1em" spacing="1em"
/> />
); );
}; };
export { INPUT_ID_ANC_DNS, INPUT_ID_ANC_MTU, INPUT_ID_ANC_NTP }; export { INPUT_ID_ANC_DNS, INPUT_ID_ANC_NTP };
export default AnNetworkConfigInputGroup; export default AnNetworkConfigInputGroup;

@ -7,7 +7,6 @@ import {
} from './AnIdInputGroup'; } from './AnIdInputGroup';
import { import {
INPUT_ID_ANC_DNS, INPUT_ID_ANC_DNS,
INPUT_ID_ANC_MTU,
INPUT_ID_ANC_NTP, INPUT_ID_ANC_NTP,
} from './AnNetworkConfigInputGroup'; } from './AnNetworkConfigInputGroup';
import AddManifestInputGroup from './AddManifestInputGroup'; import AddManifestInputGroup from './AddManifestInputGroup';
@ -19,7 +18,6 @@ const EditManifestInputGroup = <
| typeof INPUT_ID_AI_PREFIX | typeof INPUT_ID_AI_PREFIX
| typeof INPUT_ID_AI_SEQUENCE | typeof INPUT_ID_AI_SEQUENCE
| typeof INPUT_ID_ANC_DNS | typeof INPUT_ID_ANC_DNS
| typeof INPUT_ID_ANC_MTU
| typeof INPUT_ID_ANC_NTP]: string; | typeof INPUT_ID_ANC_NTP]: string;
}, },
>({ >({

@ -18,7 +18,6 @@ import {
} from './AnNetworkInputGroup'; } from './AnNetworkInputGroup';
import { import {
INPUT_ID_ANC_DNS, INPUT_ID_ANC_DNS,
INPUT_ID_ANC_MTU,
INPUT_ID_ANC_NTP, INPUT_ID_ANC_NTP,
} from './AnNetworkConfigInputGroup'; } from './AnNetworkConfigInputGroup';
import api from '../../lib/api'; import api from '../../lib/api';
@ -66,14 +65,10 @@ const getFormData = (
const { value: dnsCsv } = elements.namedItem( const { value: dnsCsv } = elements.namedItem(
INPUT_ID_ANC_DNS, INPUT_ID_ANC_DNS,
) as HTMLInputElement; ) as HTMLInputElement;
const { value: rawMtu } = elements.namedItem(
INPUT_ID_ANC_MTU,
) as HTMLInputElement;
const { value: ntpCsv } = elements.namedItem( const { value: ntpCsv } = elements.namedItem(
INPUT_ID_ANC_NTP, INPUT_ID_ANC_NTP,
) as HTMLInputElement; ) as HTMLInputElement;
const mtu = Number.parseInt(rawMtu, 10);
const sequence = Number.parseInt(rawSequence, 10); const sequence = Number.parseInt(rawSequence, 10);
return Object.values(elements).reduce<APIBuildManifestRequestBody>( return Object.values(elements).reduce<APIBuildManifestRequestBody>(
@ -105,7 +100,6 @@ const getFormData = (
hostConfig: { hosts: {} }, hostConfig: { hosts: {} },
networkConfig: { networkConfig: {
dnsCsv, dnsCsv,
mtu,
networks: {}, networks: {},
ntpCsv, ntpCsv,
}, },
@ -193,7 +187,6 @@ const ManageManifestPanel: FC = () => {
INPUT_ID_AI_PREFIX, INPUT_ID_AI_PREFIX,
INPUT_ID_AI_SEQUENCE, INPUT_ID_AI_SEQUENCE,
INPUT_ID_ANC_DNS, INPUT_ID_ANC_DNS,
INPUT_ID_ANC_MTU,
INPUT_ID_ANC_NTP, INPUT_ID_ANC_NTP,
], ],
messageGroupRef, messageGroupRef,

@ -45,7 +45,7 @@ const RunManifestInputGroup = <M extends MapToInputTestID>({
const passwordRef = useRef<InputForwardedRefContent<'string'>>({}); const passwordRef = useRef<InputForwardedRefContent<'string'>>({});
const { hosts: initHostList = {} } = hostConfig; const { hosts: initHostList = {} } = hostConfig;
const { dnsCsv, mtu, networks: initNetworkList = {}, ntpCsv } = networkConfig; const { dnsCsv, networks: initNetworkList = {}, ntpCsv } = networkConfig;
const hostListEntries = useMemo( const hostListEntries = useMemo(
() => Object.entries(initHostList), () => Object.entries(initHostList),
@ -426,12 +426,6 @@ const RunManifestInputGroup = <M extends MapToInputTestID>({
'run-manifest-ntp-csv-cell': { 'run-manifest-ntp-csv-cell': {
children: <EndMono>{ntpCsv || MANIFEST_PARAM_NONE}</EndMono>, children: <EndMono>{ntpCsv || MANIFEST_PARAM_NONE}</EndMono>,
}, },
'run-manifest-mtu-cell-header': {
children: <BodyText>MTU</BodyText>,
},
'run-manifest-mtu-cell': {
children: <EndMono>{mtu}</EndMono>,
},
}} }}
spacing="0.4em" spacing="0.4em"
/> />

@ -18,8 +18,6 @@ type ManifestNetworkList = {
type ManifestNetworkConfig = { type ManifestNetworkConfig = {
dnsCsv: string; dnsCsv: string;
/** Max Transmission Unit (MTU); unit: bytes */
mtu: number;
networks: ManifestNetworkList; networks: ManifestNetworkList;
ntpCsv: string; ntpCsv: string;
}; };

Loading…
Cancel
Save