fix(striker-ui): rename anvil->an (anvil or anvil node)

main
Tsu-ba-me 2 years ago
parent 5897353d7b
commit e73f67d50e
  1. 40
      striker-ui/components/ManageManifest/AddManifestInputGroup.tsx
  2. 20
      striker-ui/components/ManageManifest/AnHostConfigInputGroup.tsx
  3. 24
      striker-ui/components/ManageManifest/AnHostInputGroup.tsx
  4. 141
      striker-ui/components/ManageManifest/AnIdInputGroup.tsx
  5. 86
      striker-ui/components/ManageManifest/AnNetworkConfigInputGroup.tsx
  6. 6
      striker-ui/components/ManageManifest/AnNetworkInputGroup.tsx
  7. 152
      striker-ui/components/ManageManifest/AnvilIdInputGroup.tsx
  8. 28
      striker-ui/components/ManageManifest/EditManifestInputGroup.tsx
  9. 40
      striker-ui/components/ManageManifest/ManageManifestPanel.tsx
  10. 65
      striker-ui/components/ManageManifest/RunManifestInputGroup.tsx
  11. 46
      striker-ui/types/ManageManifest.d.ts

@ -1,16 +1,16 @@
import { ReactElement, useMemo, useState } from 'react';
import AnvilHostConfigInputGroup from './AnvilHostConfigInputGroup';
import AnvilIdInputGroup, {
INPUT_ID_ANVIL_ID_DOMAIN,
INPUT_ID_ANVIL_ID_PREFIX,
INPUT_ID_ANVIL_ID_SEQUENCE,
} from './AnvilIdInputGroup';
import AnvilNetworkConfigInputGroup, {
INPUT_ID_ANVIL_NETWORK_CONFIG_DNS,
INPUT_ID_ANVIL_NETWORK_CONFIG_MTU,
INPUT_ID_ANVIL_NETWORK_CONFIG_NTP,
} from './AnvilNetworkConfigInputGroup';
import AnHostConfigInputGroup from './AnHostConfigInputGroup';
import AnIdInputGroup, {
INPUT_ID_AI_DOMAIN,
INPUT_ID_AI_PREFIX,
INPUT_ID_AI_SEQUENCE,
} from './AnIdInputGroup';
import AnNetworkConfigInputGroup, {
INPUT_ID_ANC_DNS,
INPUT_ID_ANC_MTU,
INPUT_ID_ANC_NTP,
} from './AnNetworkConfigInputGroup';
import FlexBox from '../FlexBox';
const DEFAULT_NETWORK_LIST: ManifestNetworkList = {
@ -37,12 +37,12 @@ const DEFAULT_NETWORK_LIST: ManifestNetworkList = {
const AddManifestInputGroup = <
M extends {
[K in
| typeof INPUT_ID_ANVIL_ID_DOMAIN
| typeof INPUT_ID_ANVIL_ID_PREFIX
| typeof INPUT_ID_ANVIL_ID_SEQUENCE
| typeof INPUT_ID_ANVIL_NETWORK_CONFIG_DNS
| typeof INPUT_ID_ANVIL_NETWORK_CONFIG_MTU
| typeof INPUT_ID_ANVIL_NETWORK_CONFIG_NTP]: string;
| typeof INPUT_ID_AI_DOMAIN
| typeof INPUT_ID_AI_PREFIX
| typeof INPUT_ID_AI_SEQUENCE
| typeof INPUT_ID_ANC_DNS
| typeof INPUT_ID_ANC_MTU
| typeof INPUT_ID_ANC_NTP]: string;
},
>({
formUtils,
@ -67,14 +67,14 @@ const AddManifestInputGroup = <
return (
<FlexBox>
<AnvilIdInputGroup formUtils={formUtils} previous={previousAnId} />
<AnvilNetworkConfigInputGroup
<AnIdInputGroup formUtils={formUtils} previous={previousAnId} />
<AnNetworkConfigInputGroup
formUtils={formUtils}
networkListEntries={networkListEntries}
previous={previousNetworkConfig}
setNetworkList={setNetworkList}
/>
<AnvilHostConfigInputGroup
<AnHostConfigInputGroup
formUtils={formUtils}
knownFences={knownFences}
knownUpses={knownUpses}

@ -1,31 +1,33 @@
import { ReactElement, useMemo } from 'react';
import AnvilHostInputGroup from './AnvilHostInputGroup';
import AnHostInputGroup from './AnHostInputGroup';
import Grid from '../Grid';
const INPUT_ID_PREFIX_ANVIL_HOST_CONFIG = 'anvil-host-config-input';
const INPUT_ID_PREFIX_AN_HOST_CONFIG = 'an-host-config-input';
const INPUT_GROUP_ID_PREFIX_ANVIL_HOST_CONFIG = `${INPUT_ID_PREFIX_ANVIL_HOST_CONFIG}-group`;
const INPUT_GROUP_CELL_ID_PREFIX_ANVIL_HOST_CONFIG = `${INPUT_GROUP_ID_PREFIX_ANVIL_HOST_CONFIG}-cell`;
const INPUT_GROUP_ID_PREFIX_AHC = `${INPUT_ID_PREFIX_AN_HOST_CONFIG}-group`;
const INPUT_GROUP_CELL_ID_PREFIX_AHC = `${INPUT_GROUP_ID_PREFIX_AHC}-cell`;
const DEFAULT_HOST_LIST: ManifestHostList = {
node1: {
hostName: '',
hostNumber: 1,
hostType: 'node',
},
node2: {
hostName: '',
hostNumber: 2,
hostType: 'node',
},
};
const AnvilHostConfigInputGroup = <M extends MapToInputTestID>({
const AnHostConfigInputGroup = <M extends MapToInputTestID>({
formUtils,
knownFences = {},
knownUpses = {},
networkListEntries,
previous: { hosts: previousHostList = DEFAULT_HOST_LIST } = {},
}: AnvilHostConfigInputGroupProps<M>): ReactElement => {
}: AnHostConfigInputGroupProps<M>): ReactElement => {
const hostListEntries = useMemo(
() => Object.entries(previousHostList),
[previousHostList],
@ -86,12 +88,12 @@ const AnvilHostConfigInputGroup = <M extends MapToInputTestID>({
{},
);
const cellId = `${INPUT_GROUP_CELL_ID_PREFIX_ANVIL_HOST_CONFIG}-${hostId}`;
const cellId = `${INPUT_GROUP_CELL_ID_PREFIX_AHC}-${hostId}`;
const hostLabel = `${hostType} ${hostNumber}`;
previous[cellId] = {
children: (
<AnvilHostInputGroup
<AnHostInputGroup
formUtils={formUtils}
hostLabel={hostLabel}
previous={{ fences, networks, upses }}
@ -123,4 +125,4 @@ const AnvilHostConfigInputGroup = <M extends MapToInputTestID>({
);
};
export default AnvilHostConfigInputGroup;
export default AnHostConfigInputGroup;

@ -14,13 +14,13 @@ import {
} from '../../lib/test_input';
import { BodyText } from '../Text';
const INPUT_ID_PREFIX_ANVIL_HOST = 'anvil-host-input';
const INPUT_ID_PREFIX_AN_HOST = 'an-host-input';
const INPUT_CELL_ID_PREFIX_ANVIL_HOST = `${INPUT_ID_PREFIX_ANVIL_HOST}-cell`;
const INPUT_CELL_ID_PREFIX_AN_HOST = `${INPUT_ID_PREFIX_AN_HOST}-cell`;
const GRID_SPACING = '1em';
const AnvilHostInputGroup = <M extends MapToInputTestID>({
const AnHostInputGroup = <M extends MapToInputTestID>({
formUtils: {
buildFinishInputTestBatchFunction,
buildInputFirstRenderFunction,
@ -33,7 +33,7 @@ const AnvilHostInputGroup = <M extends MapToInputTestID>({
networks: networkList = {},
upses: upsList = {},
} = {},
}: AnvilHostInputGroupProps<M>): ReactElement => {
}: AnHostInputGroupProps<M>): ReactElement => {
const fenceListEntries = useMemo(
() => Object.entries(fenceList),
[fenceList],
@ -63,9 +63,9 @@ const AnvilHostInputGroup = <M extends MapToInputTestID>({
(previous, [fenceId, { fenceName, fencePort }]) => {
const idPostfix = `${fenceId}-port`;
const cellId = `${INPUT_CELL_ID_PREFIX_ANVIL_HOST}-${idPostfix}`;
const cellId = `${INPUT_CELL_ID_PREFIX_AN_HOST}-${idPostfix}`;
const inputId = `${INPUT_ID_PREFIX_ANVIL_HOST}-${idPostfix}`;
const inputId = `${INPUT_ID_PREFIX_AN_HOST}-${idPostfix}`;
const inputLabel = `Port on ${fenceName}`;
setMsgSetter(inputId);
@ -115,9 +115,9 @@ const AnvilHostInputGroup = <M extends MapToInputTestID>({
(previous, [networkId, { networkIp, networkNumber, networkType }]) => {
const idPostfix = `${networkId}-ip`;
const cellId = `${INPUT_CELL_ID_PREFIX_ANVIL_HOST}-${idPostfix}`;
const cellId = `${INPUT_CELL_ID_PREFIX_AN_HOST}-${idPostfix}`;
const inputId = `${INPUT_ID_PREFIX_ANVIL_HOST}-${idPostfix}`;
const inputId = `${INPUT_ID_PREFIX_AN_HOST}-${idPostfix}`;
const inputLabel = `${NETWORK_TYPES[networkType]} ${networkNumber}`;
setMsgSetter(inputId);
@ -167,9 +167,9 @@ const AnvilHostInputGroup = <M extends MapToInputTestID>({
(previous, [upsId, { isUsed, upsName }]) => {
const idPostfix = `${upsId}-power-host`;
const cellId = `${INPUT_CELL_ID_PREFIX_ANVIL_HOST}-${idPostfix}`;
const cellId = `${INPUT_CELL_ID_PREFIX_AN_HOST}-${idPostfix}`;
const inputId = `${INPUT_ID_PREFIX_ANVIL_HOST}-${idPostfix}`;
const inputId = `${INPUT_ID_PREFIX_AN_HOST}-${idPostfix}`;
previous[cellId] = {
children: (
@ -238,6 +238,6 @@ const AnvilHostInputGroup = <M extends MapToInputTestID>({
);
};
export { INPUT_ID_PREFIX_ANVIL_HOST };
export { INPUT_ID_PREFIX_AN_HOST };
export default AnvilHostInputGroup;
export default AnHostInputGroup;

@ -0,0 +1,141 @@
import { ReactElement } from 'react';
import Grid from '../Grid';
import InputWithRef from '../InputWithRef';
import OutlinedInputWithLabel from '../OutlinedInputWithLabel';
import {
buildNumberTestBatch,
buildPeacefulStringTestBatch,
} from '../../lib/test_input';
const INPUT_ID_PREFIX_AN_ID = 'an-id-input';
const INPUT_ID_AI_DOMAIN = `${INPUT_ID_PREFIX_AN_ID}-domain`;
const INPUT_ID_AI_PREFIX = `${INPUT_ID_PREFIX_AN_ID}-prefix`;
const INPUT_ID_AI_SEQUENCE = `${INPUT_ID_PREFIX_AN_ID}-sequence`;
const INPUT_LABEL_AI_DOMAIN = 'Domain name';
const INPUT_LABEL_AI_PREFIX = 'Prefix';
const INPUT_LABEL_AI_SEQUENCE = 'Sequence';
const AnIdInputGroup = <
M extends {
[K in
| typeof INPUT_ID_AI_DOMAIN
| typeof INPUT_ID_AI_PREFIX
| typeof INPUT_ID_AI_SEQUENCE]: string;
},
>({
formUtils: {
buildFinishInputTestBatchFunction,
buildInputFirstRenderFunction,
msgSetters,
},
previous: {
domain: previousDomain,
prefix: previousPrefix,
sequence: previousSequence,
} = {},
}: AnIdInputGroupProps<M>): ReactElement => (
<Grid
columns={{ xs: 1, sm: 2, md: 3 }}
layout={{
'an-id-input-cell-prefix': {
children: (
<InputWithRef
input={
<OutlinedInputWithLabel
id={INPUT_ID_AI_PREFIX}
label={INPUT_LABEL_AI_PREFIX}
value={previousPrefix}
/>
}
inputTestBatch={buildPeacefulStringTestBatch(
INPUT_LABEL_AI_PREFIX,
() => {
msgSetters[INPUT_ID_AI_PREFIX]();
},
{
onFinishBatch:
buildFinishInputTestBatchFunction(INPUT_ID_AI_PREFIX),
},
(message) => {
msgSetters[INPUT_ID_AI_PREFIX]({
children: message,
});
},
)}
onFirstRender={buildInputFirstRenderFunction(INPUT_ID_AI_PREFIX)}
required
/>
),
},
'an-id-input-cell-domain': {
children: (
<InputWithRef
input={
<OutlinedInputWithLabel
id={INPUT_ID_AI_DOMAIN}
label={INPUT_LABEL_AI_DOMAIN}
value={previousDomain}
/>
}
inputTestBatch={buildPeacefulStringTestBatch(
INPUT_LABEL_AI_DOMAIN,
() => {
msgSetters[INPUT_ID_AI_DOMAIN]();
},
{
onFinishBatch:
buildFinishInputTestBatchFunction(INPUT_ID_AI_DOMAIN),
},
(message) => {
msgSetters[INPUT_ID_AI_DOMAIN]({
children: message,
});
},
)}
onFirstRender={buildInputFirstRenderFunction(INPUT_ID_AI_DOMAIN)}
required
/>
),
},
'an-id-input-cell-sequence': {
children: (
<InputWithRef
input={
<OutlinedInputWithLabel
id={INPUT_ID_AI_SEQUENCE}
label={INPUT_LABEL_AI_SEQUENCE}
value={previousSequence}
/>
}
inputTestBatch={buildNumberTestBatch(
INPUT_LABEL_AI_SEQUENCE,
() => {
msgSetters[INPUT_ID_AI_SEQUENCE]();
},
{
onFinishBatch:
buildFinishInputTestBatchFunction(INPUT_ID_AI_SEQUENCE),
},
(message) => {
msgSetters[INPUT_ID_AI_SEQUENCE]({
children: message,
});
},
)}
onFirstRender={buildInputFirstRenderFunction(INPUT_ID_AI_SEQUENCE)}
required
valueType="number"
/>
),
},
}}
spacing="1em"
/>
);
export { INPUT_ID_AI_DOMAIN, INPUT_ID_AI_PREFIX, INPUT_ID_AI_SEQUENCE };
export default AnIdInputGroup;

@ -3,7 +3,7 @@ import { v4 as uuidv4 } from 'uuid';
import NETWORK_TYPES from '../../lib/consts/NETWORK_TYPES';
import AnvilNetworkInputGroup from './AnvilNetworkInputGroup';
import AnNetworkInputGroup from './AnNetworkInputGroup';
import buildObjectStateSetterCallback from '../../lib/buildObjectStateSetterCallback';
import Grid from '../Grid';
import IconButton from '../IconButton';
@ -11,31 +11,31 @@ import InputWithRef from '../InputWithRef';
import OutlinedInputWithLabel from '../OutlinedInputWithLabel';
import { buildNumberTestBatch } from '../../lib/test_input';
const INPUT_ID_PREFIX_ANVIL_NETWORK_CONFIG = 'anvil-network-config-input';
const INPUT_ID_PREFIX_AN_NETWORK_CONFIG = 'an-network-config-input';
const INPUT_CELL_ID_PREFIX_ANVIL_NETWORK_CONFIG = `${INPUT_ID_PREFIX_ANVIL_NETWORK_CONFIG}-cell`;
const INPUT_CELL_ID_PREFIX_ANC = `${INPUT_ID_PREFIX_AN_NETWORK_CONFIG}-cell`;
const INPUT_ID_ANVIL_NETWORK_CONFIG_DNS = 'anvil-network-config-input-dns';
const INPUT_ID_ANVIL_NETWORK_CONFIG_MTU = 'anvil-network-config-input-mtu';
const INPUT_ID_ANVIL_NETWORK_CONFIG_NTP = 'anvil-network-config-input-ntp';
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_LABEL_ANVIL_NETWORK_CONFIG_DNS = 'DNS';
const INPUT_LABEL_ANVIL_NETWORK_CONFIG_MTU = 'MTU';
const INPUT_LABEL_ANVIL_NETWORK_CONFIG_NTP = 'NTP';
const INPUT_LABEL_ANC_DNS = 'DNS';
const INPUT_LABEL_ANC_MTU = 'MTU';
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';
const NETWORK_TYPE_ENTRIES = Object.entries(NETWORK_TYPES);
const assertIfn = (type: string) => type === 'ifn';
const assertMn = (type: string) => type === 'mn';
const AnvilNetworkConfigInputGroup = <
const AnNetworkConfigInputGroup = <
M extends MapToInputTestID & {
[K in
| typeof INPUT_ID_ANVIL_NETWORK_CONFIG_DNS
| typeof INPUT_ID_ANVIL_NETWORK_CONFIG_MTU
| typeof INPUT_ID_ANVIL_NETWORK_CONFIG_NTP]: string;
| typeof INPUT_ID_ANC_DNS
| typeof INPUT_ID_ANC_MTU
| typeof INPUT_ID_ANC_NTP]: string;
},
>({
formUtils,
@ -46,7 +46,7 @@ const AnvilNetworkConfigInputGroup = <
ntpCsv: previousNtpCsv,
} = {},
setNetworkList,
}: AnvilNetworkConfigInputGroupProps<M>): ReactElement => {
}: AnNetworkConfigInputGroupProps<M>): ReactElement => {
const {
buildFinishInputTestBatchFunction,
buildInputFirstRenderFunction,
@ -120,8 +120,7 @@ const AnvilNetworkConfigInputGroup = <
[setNetworkList],
);
const handleNetworkTypeChange =
useCallback<AnvilNetworkTypeChangeEventHandler>(
const handleNetworkTypeChange = useCallback<AnNetworkTypeChangeEventHandler>(
(
{ networkId: targetId, networkType: previousType },
{ target: { value } },
@ -176,7 +175,7 @@ const AnvilNetworkConfigInputGroup = <
[networkListEntries, setNetworkList],
);
const handleNetworkRemove = useCallback<AnvilNetworkCloseEventHandler>(
const handleNetworkRemove = useCallback<AnNetworkCloseEventHandler>(
({ networkId: rmId, networkType: rmType }) => {
let isIdMatch = false;
let networkNumber = 0;
@ -224,11 +223,11 @@ const AnvilNetworkConfigInputGroup = <
},
],
) => {
const cellId = `${INPUT_CELL_ID_PREFIX_ANVIL_NETWORK_CONFIG}-${networkId}`;
const cellId = `${INPUT_CELL_ID_PREFIX_ANC}-${networkId}`;
const idPrefix = `anvil-network-${networkId}`;
const idPrefix = `an-network-${networkId}`;
const inputIdPrefix = `${INPUT_ID_PREFIX_ANVIL_NETWORK_CONFIG}-${networkId}`;
const inputIdPrefix = `${INPUT_ID_PREFIX_AN_NETWORK_CONFIG}-${networkId}`;
const inputGatewayId = `${inputIdPrefix}-gateway`;
const inputMinIpId = `${inputIdPrefix}-min-ip`;
const inputNetworkTypeId = `${inputIdPrefix}-network-type`;
@ -241,7 +240,7 @@ const AnvilNetworkConfigInputGroup = <
previous[cellId] = {
children: (
<AnvilNetworkInputGroup
<AnNetworkInputGroup
formUtils={formUtils}
idPrefix={idPrefix}
inputGatewayId={inputGatewayId}
@ -287,7 +286,7 @@ const AnvilNetworkConfigInputGroup = <
columns={{ xs: 1, sm: 2, md: 3 }}
layout={{
...networksGridLayout,
'anvil-network-config-cell-add-network': {
'an-network-config-cell-add-network': {
children: (
<IconButton
mapPreset="add"
@ -303,13 +302,13 @@ const AnvilNetworkConfigInputGroup = <
md: 3,
sm: 2,
},
'anvil-network-config-input-cell-dns': {
'an-network-config-input-cell-dns': {
children: (
<InputWithRef
input={
<OutlinedInputWithLabel
id={INPUT_ID_ANVIL_NETWORK_CONFIG_DNS}
label={INPUT_LABEL_ANVIL_NETWORK_CONFIG_DNS}
id={INPUT_ID_ANC_DNS}
label={INPUT_LABEL_ANC_DNS}
value={previousDnsCsv}
/>
}
@ -317,49 +316,46 @@ const AnvilNetworkConfigInputGroup = <
/>
),
},
'anvil-network-config-input-cell-ntp': {
'an-network-config-input-cell-ntp': {
children: (
<InputWithRef
input={
<OutlinedInputWithLabel
id={INPUT_ID_ANVIL_NETWORK_CONFIG_NTP}
label={INPUT_LABEL_ANVIL_NETWORK_CONFIG_NTP}
id={INPUT_ID_ANC_NTP}
label={INPUT_LABEL_ANC_NTP}
value={previousNtpCsv}
/>
}
/>
),
},
'anvil-network-config-input-cell-mtu': {
'an-network-config-input-cell-mtu': {
children: (
<InputWithRef
input={
<OutlinedInputWithLabel
id={INPUT_ID_ANVIL_NETWORK_CONFIG_MTU}
id={INPUT_ID_ANC_MTU}
inputProps={{ placeholder: '1500' }}
label={INPUT_LABEL_ANVIL_NETWORK_CONFIG_MTU}
label={INPUT_LABEL_ANC_MTU}
value={previousMtu}
/>
}
inputTestBatch={buildNumberTestBatch(
INPUT_LABEL_ANVIL_NETWORK_CONFIG_MTU,
INPUT_LABEL_ANC_MTU,
() => {
msgSetters[INPUT_ID_ANVIL_NETWORK_CONFIG_MTU]();
msgSetters[INPUT_ID_ANC_MTU]();
},
{
onFinishBatch: buildFinishInputTestBatchFunction(
INPUT_ID_ANVIL_NETWORK_CONFIG_MTU,
),
onFinishBatch:
buildFinishInputTestBatchFunction(INPUT_ID_ANC_MTU),
},
(message) => {
msgSetters[INPUT_ID_ANVIL_NETWORK_CONFIG_MTU]({
msgSetters[INPUT_ID_ANC_MTU]({
children: message,
});
},
)}
onFirstRender={buildInputFirstRenderFunction(
INPUT_ID_ANVIL_NETWORK_CONFIG_MTU,
)}
onFirstRender={buildInputFirstRenderFunction(INPUT_ID_ANC_MTU)}
valueType="number"
/>
),
@ -370,10 +366,6 @@ const AnvilNetworkConfigInputGroup = <
);
};
export {
INPUT_ID_ANVIL_NETWORK_CONFIG_DNS,
INPUT_ID_ANVIL_NETWORK_CONFIG_MTU,
INPUT_ID_ANVIL_NETWORK_CONFIG_NTP,
};
export { INPUT_ID_ANC_DNS, INPUT_ID_ANC_MTU, INPUT_ID_ANC_NTP };
export default AnvilNetworkConfigInputGroup;
export default AnNetworkConfigInputGroup;

@ -10,7 +10,7 @@ import { InnerPanel, InnerPanelBody, InnerPanelHeader } from '../Panels';
import SelectWithLabel from '../SelectWithLabel';
import { buildIPAddressTestBatch } from '../../lib/test_input';
const AnvilNetworkInputGroup = <M extends MapToInputTestID>({
const AnNetworkInputGroup = <M extends MapToInputTestID>({
formUtils: {
buildFinishInputTestBatchFunction,
buildInputFirstRenderFunction,
@ -39,7 +39,7 @@ const AnvilNetworkInputGroup = <M extends MapToInputTestID>({
readonlyNetworkName: isReadonlyNetworkName,
showCloseButton: isShowCloseButton,
showGateway: isShowGateway,
}: AnvilNetworkInputGroupProps<M>): ReactElement => {
}: AnNetworkInputGroupProps<M>): ReactElement => {
const networkName = useMemo(
() => `${NETWORK_TYPES[networkType]} ${networkNumber}`,
[networkNumber, networkType],
@ -217,4 +217,4 @@ const AnvilNetworkInputGroup = <M extends MapToInputTestID>({
);
};
export default AnvilNetworkInputGroup;
export default AnNetworkInputGroup;

@ -1,152 +0,0 @@
import { ReactElement } from 'react';
import Grid from '../Grid';
import InputWithRef from '../InputWithRef';
import OutlinedInputWithLabel from '../OutlinedInputWithLabel';
import {
buildNumberTestBatch,
buildPeacefulStringTestBatch,
} from '../../lib/test_input';
const INPUT_ID_ANVIL_ID_DOMAIN = 'anvil-id-input-domain';
const INPUT_ID_ANVIL_ID_PREFIX = 'anvil-id-input-prefix';
const INPUT_ID_ANVIL_ID_SEQUENCE = 'anvil-id-input-sequence';
const INPUT_LABEL_ANVIL_ID_DOMAIN = 'Domain name';
const INPUT_LABEL_ANVIL_ID_PREFIX = 'Anvil! prefix';
const INPUT_LABEL_ANVIL_ID_SEQUENCE = 'Anvil! sequence';
const AnvilIdInputGroup = <
M extends {
[K in
| typeof INPUT_ID_ANVIL_ID_DOMAIN
| typeof INPUT_ID_ANVIL_ID_PREFIX
| typeof INPUT_ID_ANVIL_ID_SEQUENCE]: string;
},
>({
formUtils: {
buildFinishInputTestBatchFunction,
buildInputFirstRenderFunction,
msgSetters,
},
previous: {
domain: previousDomain,
prefix: previousPrefix,
sequence: previousSequence,
} = {},
}: AnvilIdInputGroupProps<M>): ReactElement => (
<Grid
columns={{ xs: 1, sm: 2, md: 3 }}
layout={{
'anvil-id-input-cell-prefix': {
children: (
<InputWithRef
input={
<OutlinedInputWithLabel
id={INPUT_ID_ANVIL_ID_PREFIX}
label={INPUT_LABEL_ANVIL_ID_PREFIX}
value={previousPrefix}
/>
}
inputTestBatch={buildPeacefulStringTestBatch(
INPUT_LABEL_ANVIL_ID_PREFIX,
() => {
msgSetters[INPUT_ID_ANVIL_ID_PREFIX]();
},
{
onFinishBatch: buildFinishInputTestBatchFunction(
INPUT_ID_ANVIL_ID_PREFIX,
),
},
(message) => {
msgSetters[INPUT_ID_ANVIL_ID_PREFIX]({
children: message,
});
},
)}
onFirstRender={buildInputFirstRenderFunction(
INPUT_ID_ANVIL_ID_PREFIX,
)}
required
/>
),
},
'anvil-id-input-cell-domain': {
children: (
<InputWithRef
input={
<OutlinedInputWithLabel
id={INPUT_ID_ANVIL_ID_DOMAIN}
label={INPUT_LABEL_ANVIL_ID_DOMAIN}
value={previousDomain}
/>
}
inputTestBatch={buildPeacefulStringTestBatch(
INPUT_LABEL_ANVIL_ID_DOMAIN,
() => {
msgSetters[INPUT_ID_ANVIL_ID_DOMAIN]();
},
{
onFinishBatch: buildFinishInputTestBatchFunction(
INPUT_ID_ANVIL_ID_DOMAIN,
),
},
(message) => {
msgSetters[INPUT_ID_ANVIL_ID_DOMAIN]({
children: message,
});
},
)}
onFirstRender={buildInputFirstRenderFunction(
INPUT_ID_ANVIL_ID_DOMAIN,
)}
required
/>
),
},
'anvil-id-input-cell-sequence': {
children: (
<InputWithRef
input={
<OutlinedInputWithLabel
id={INPUT_ID_ANVIL_ID_SEQUENCE}
label={INPUT_LABEL_ANVIL_ID_SEQUENCE}
value={previousSequence}
/>
}
inputTestBatch={buildNumberTestBatch(
INPUT_LABEL_ANVIL_ID_SEQUENCE,
() => {
msgSetters[INPUT_ID_ANVIL_ID_SEQUENCE]();
},
{
onFinishBatch: buildFinishInputTestBatchFunction(
INPUT_ID_ANVIL_ID_SEQUENCE,
),
},
(message) => {
msgSetters[INPUT_ID_ANVIL_ID_SEQUENCE]({
children: message,
});
},
)}
onFirstRender={buildInputFirstRenderFunction(
INPUT_ID_ANVIL_ID_SEQUENCE,
)}
required
valueType="number"
/>
),
},
}}
spacing="1em"
/>
);
export {
INPUT_ID_ANVIL_ID_DOMAIN,
INPUT_ID_ANVIL_ID_PREFIX,
INPUT_ID_ANVIL_ID_SEQUENCE,
};
export default AnvilIdInputGroup;

@ -1,26 +1,26 @@
import { ReactElement } from 'react';
import {
INPUT_ID_ANVIL_ID_DOMAIN,
INPUT_ID_ANVIL_ID_PREFIX,
INPUT_ID_ANVIL_ID_SEQUENCE,
} from './AnvilIdInputGroup';
INPUT_ID_AI_DOMAIN,
INPUT_ID_AI_PREFIX,
INPUT_ID_AI_SEQUENCE,
} from './AnIdInputGroup';
import {
INPUT_ID_ANVIL_NETWORK_CONFIG_DNS,
INPUT_ID_ANVIL_NETWORK_CONFIG_MTU,
INPUT_ID_ANVIL_NETWORK_CONFIG_NTP,
} from './AnvilNetworkConfigInputGroup';
INPUT_ID_ANC_DNS,
INPUT_ID_ANC_MTU,
INPUT_ID_ANC_NTP,
} from './AnNetworkConfigInputGroup';
import AddManifestInputGroup from './AddManifestInputGroup';
const EditManifestInputGroup = <
M extends {
[K in
| typeof INPUT_ID_ANVIL_ID_DOMAIN
| typeof INPUT_ID_ANVIL_ID_PREFIX
| typeof INPUT_ID_ANVIL_ID_SEQUENCE
| typeof INPUT_ID_ANVIL_NETWORK_CONFIG_DNS
| typeof INPUT_ID_ANVIL_NETWORK_CONFIG_MTU
| typeof INPUT_ID_ANVIL_NETWORK_CONFIG_NTP]: string;
| typeof INPUT_ID_AI_DOMAIN
| typeof INPUT_ID_AI_PREFIX
| typeof INPUT_ID_AI_SEQUENCE
| typeof INPUT_ID_ANC_DNS
| typeof INPUT_ID_ANC_MTU
| typeof INPUT_ID_ANC_NTP]: string;
},
>({
formUtils,

@ -4,15 +4,15 @@ import API_BASE_URL from '../../lib/consts/API_BASE_URL';
import AddManifestInputGroup from './AddManifestInputGroup';
import {
INPUT_ID_ANVIL_ID_DOMAIN,
INPUT_ID_ANVIL_ID_PREFIX,
INPUT_ID_ANVIL_ID_SEQUENCE,
} from './AnvilIdInputGroup';
INPUT_ID_AI_DOMAIN,
INPUT_ID_AI_PREFIX,
INPUT_ID_AI_SEQUENCE,
} from './AnIdInputGroup';
import {
INPUT_ID_ANVIL_NETWORK_CONFIG_DNS,
INPUT_ID_ANVIL_NETWORK_CONFIG_MTU,
INPUT_ID_ANVIL_NETWORK_CONFIG_NTP,
} from './AnvilNetworkConfigInputGroup';
INPUT_ID_ANC_DNS,
INPUT_ID_ANC_MTU,
INPUT_ID_ANC_NTP,
} from './AnNetworkConfigInputGroup';
import api from '../../lib/api';
import ConfirmDialog from '../ConfirmDialog';
import EditManifestInputGroup from './EditManifestInputGroup';
@ -25,9 +25,9 @@ import MessageGroup, { MessageGroupForwardedRefContent } from '../MessageGroup';
import { Panel, PanelHeader } from '../Panels';
import periodicFetch from '../../lib/fetchers/periodicFetch';
import RunManifestInputGroup, {
INPUT_ID_AN_CONFIRM_PASSWORD,
INPUT_ID_AN_DESCRIPTION,
INPUT_ID_AN_PASSWORD,
INPUT_ID_RM_AN_CONFIRM_PASSWORD,
INPUT_ID_RM_AN_DESCRIPTION,
INPUT_ID_RM_AN_PASSWORD,
} from './RunManifestInputGroup';
import Spinner from '../Spinner';
import { BodyText, HeaderText } from '../Text';
@ -73,12 +73,12 @@ const ManageManifestPanel: FC = () => {
const formUtils = useFormUtils(
[
INPUT_ID_ANVIL_ID_DOMAIN,
INPUT_ID_ANVIL_ID_PREFIX,
INPUT_ID_ANVIL_ID_SEQUENCE,
INPUT_ID_ANVIL_NETWORK_CONFIG_DNS,
INPUT_ID_ANVIL_NETWORK_CONFIG_MTU,
INPUT_ID_ANVIL_NETWORK_CONFIG_NTP,
INPUT_ID_AI_DOMAIN,
INPUT_ID_AI_PREFIX,
INPUT_ID_AI_SEQUENCE,
INPUT_ID_ANC_DNS,
INPUT_ID_ANC_MTU,
INPUT_ID_ANC_NTP,
],
messageGroupRef,
);
@ -86,9 +86,9 @@ const ManageManifestPanel: FC = () => {
const runFormUtils = useFormUtils(
[
INPUT_ID_AN_CONFIRM_PASSWORD,
INPUT_ID_AN_DESCRIPTION,
INPUT_ID_AN_PASSWORD,
INPUT_ID_RM_AN_CONFIRM_PASSWORD,
INPUT_ID_RM_AN_DESCRIPTION,
INPUT_ID_RM_AN_PASSWORD,
],
messageGroupRef,
);

@ -10,15 +10,15 @@ import SelectWithLabel from '../SelectWithLabel';
import { BodyText, MonoText } from '../Text';
const INPUT_ID_PREFIX_RUN_MANIFEST = 'run-manifest-input';
const INPUT_ID_PREFIX_HOST = `${INPUT_ID_PREFIX_RUN_MANIFEST}-host`;
const INPUT_ID_PREFIX_RM_HOST = `${INPUT_ID_PREFIX_RUN_MANIFEST}-host`;
const INPUT_ID_AN_DESCRIPTION = `${INPUT_ID_PREFIX_RUN_MANIFEST}-an-description`;
const INPUT_ID_AN_PASSWORD = `${INPUT_ID_PREFIX_RUN_MANIFEST}-an-password`;
const INPUT_ID_AN_CONFIRM_PASSWORD = `${INPUT_ID_PREFIX_RUN_MANIFEST}-an-confirm-password`;
const INPUT_ID_RM_AN_DESCRIPTION = `${INPUT_ID_PREFIX_RUN_MANIFEST}-an-description`;
const INPUT_ID_RM_AN_PASSWORD = `${INPUT_ID_PREFIX_RUN_MANIFEST}-an-password`;
const INPUT_ID_RM_AN_CONFIRM_PASSWORD = `${INPUT_ID_PREFIX_RUN_MANIFEST}-an-confirm-password`;
const INPUT_LABEL_AN_DESCRIPTION = 'Description';
const INPUT_LABEL_AN_PASSWORD = 'Password';
const INPUT_LABEL_AN_CONFIRM_PASSWORD = 'Confirm password';
const INPUT_LABEL_RM_AN_DESCRIPTION = 'Description';
const INPUT_LABEL_RM_AN_PASSWORD = 'Password';
const INPUT_LABEL_RM_AN_CONFIRM_PASSWORD = 'Confirm password';
const MANIFEST_PARAM_NONE = '--';
@ -96,7 +96,7 @@ const RunManifestInputGroup = <M extends MapToInputTestID>({
children: <BodyText>{prettyId}</BodyText>,
};
const inputId = `${INPUT_ID_PREFIX_HOST}-${hostId}`;
const inputId = `${INPUT_ID_PREFIX_RM_HOST}-${hostId}`;
const inputLabel = `${prettyId} host`;
setMsgSetter(inputId);
@ -276,73 +276,76 @@ const RunManifestInputGroup = <M extends MapToInputTestID>({
<Grid
columns={{ xs: 1, sm: 2 }}
layout={{
'anvil-description-input-cell': {
'run-manifest-input-cell-an-description': {
children: (
<InputWithRef
input={
<OutlinedInputWithLabel
id={INPUT_ID_AN_DESCRIPTION}
label={INPUT_LABEL_AN_DESCRIPTION}
id={INPUT_ID_RM_AN_DESCRIPTION}
label={INPUT_LABEL_RM_AN_DESCRIPTION}
/>
}
inputTestBatch={buildPeacefulStringTestBatch(
INPUT_LABEL_AN_DESCRIPTION,
INPUT_LABEL_RM_AN_DESCRIPTION,
() => {
msgSetters[INPUT_ID_AN_DESCRIPTION]();
msgSetters[INPUT_ID_RM_AN_DESCRIPTION]();
},
{
onFinishBatch: buildFinishInputTestBatchFunction(
INPUT_ID_AN_DESCRIPTION,
INPUT_ID_RM_AN_DESCRIPTION,
),
},
(message) => {
msgSetters[INPUT_ID_AN_DESCRIPTION]({ children: message });
msgSetters[INPUT_ID_RM_AN_DESCRIPTION]({
children: message,
});
},
)}
onFirstRender={buildInputFirstRenderFunction(
INPUT_ID_AN_DESCRIPTION,
INPUT_ID_RM_AN_DESCRIPTION,
)}
required
/>
),
sm: 2,
},
'anvil-password-input-cell': {
'run-manifest-input-cell-an-password': {
children: (
<InputWithRef
input={
<OutlinedInputWithLabel
id={INPUT_ID_AN_PASSWORD}
label={INPUT_LABEL_AN_PASSWORD}
id={INPUT_ID_RM_AN_PASSWORD}
label={INPUT_LABEL_RM_AN_PASSWORD}
/>
}
inputTestBatch={buildPeacefulStringTestBatch(
INPUT_LABEL_AN_PASSWORD,
INPUT_LABEL_RM_AN_PASSWORD,
() => {
msgSetters[INPUT_ID_AN_PASSWORD]();
msgSetters[INPUT_ID_RM_AN_PASSWORD]();
},
{
onFinishBatch:
buildFinishInputTestBatchFunction(INPUT_ID_AN_PASSWORD),
onFinishBatch: buildFinishInputTestBatchFunction(
INPUT_ID_RM_AN_PASSWORD,
),
},
(message) => {
msgSetters[INPUT_ID_AN_PASSWORD]({ children: message });
msgSetters[INPUT_ID_RM_AN_PASSWORD]({ children: message });
},
)}
onFirstRender={buildInputFirstRenderFunction(
INPUT_ID_AN_PASSWORD,
INPUT_ID_RM_AN_PASSWORD,
)}
required
/>
),
},
'anvil-confirm-password-input-cell': {
'run-manifest-input-cell-an-confirm-password': {
children: (
<InputWithRef
input={
<OutlinedInputWithLabel
id={INPUT_ID_AN_CONFIRM_PASSWORD}
label={INPUT_LABEL_AN_CONFIRM_PASSWORD}
id={INPUT_ID_RM_AN_CONFIRM_PASSWORD}
label={INPUT_LABEL_RM_AN_CONFIRM_PASSWORD}
/>
}
required
@ -396,9 +399,9 @@ const RunManifestInputGroup = <M extends MapToInputTestID>({
};
export {
INPUT_ID_AN_CONFIRM_PASSWORD,
INPUT_ID_AN_DESCRIPTION,
INPUT_ID_AN_PASSWORD,
INPUT_ID_RM_AN_CONFIRM_PASSWORD,
INPUT_ID_RM_AN_DESCRIPTION,
INPUT_ID_RM_AN_PASSWORD,
};
export default RunManifestInputGroup;

@ -63,36 +63,36 @@ type ManifestHostConfig = {
hosts: ManifestHostList;
};
type AnvilIdInputGroupOptionalProps = {
type AnIdInputGroupOptionalProps = {
previous?: Partial<ManifestAnId>;
};
type AnvilIdInputGroupProps<M extends MapToInputTestID> =
AnvilIdInputGroupOptionalProps & {
type AnIdInputGroupProps<M extends MapToInputTestID> =
AnIdInputGroupOptionalProps & {
formUtils: FormUtils<M>;
};
type AnvilNetworkEventHandlerPreviousArgs = {
type AnNetworkEventHandlerPreviousArgs = {
networkId: string;
} & Pick<ManifestNetwork, 'networkType'>;
type AnvilNetworkCloseEventHandler = (
args: AnvilNetworkEventHandlerPreviousArgs,
type AnNetworkCloseEventHandler = (
args: AnNetworkEventHandlerPreviousArgs,
...handlerArgs: Parameters<IconButtonMouseEventHandler>
) => ReturnType<IconButtonMouseEventHandler>;
type AnvilNetworkTypeChangeEventHandler = (
args: AnvilNetworkEventHandlerPreviousArgs,
type AnNetworkTypeChangeEventHandler = (
args: AnNetworkEventHandlerPreviousArgs,
...handlerArgs: Parameters<SelectChangeEventHandler>
) => ReturnType<SelectChangeEventHandler>;
type AnvilNetworkInputGroupOptionalProps = {
type AnNetworkInputGroupOptionalProps = {
inputGatewayId?: string;
inputGatewayLabel?: string;
inputMinIpLabel?: string;
inputSubnetMaskLabel?: string;
onClose?: AnvilNetworkCloseEventHandler;
onNetworkTypeChange?: AnvilNetworkTypeChangeEventHandler;
onClose?: AnNetworkCloseEventHandler;
onNetworkTypeChange?: AnNetworkTypeChangeEventHandler;
previous?: {
gateway?: string;
minIp?: string;
@ -103,8 +103,8 @@ type AnvilNetworkInputGroupOptionalProps = {
showGateway?: boolean;
};
type AnvilNetworkInputGroupProps<M extends MapToInputTestID> =
AnvilNetworkInputGroupOptionalProps & {
type AnNetworkInputGroupProps<M extends MapToInputTestID> =
AnNetworkInputGroupOptionalProps & {
formUtils: FormUtils<M>;
idPrefix: string;
inputMinIpId: string;
@ -116,22 +116,22 @@ type AnvilNetworkInputGroupProps<M extends MapToInputTestID> =
networkTypeOptions: SelectItem[];
};
type AnvilHostInputGroupOptionalProps = {
type AnHostInputGroupOptionalProps = {
previous?: Pick<ManifestHost, 'fences' | 'networks' | 'upses'>;
};
type AnvilHostInputGroupProps<M extends MapToInputTestID> =
AnvilHostInputGroupOptionalProps & {
type AnHostInputGroupProps<M extends MapToInputTestID> =
AnHostInputGroupOptionalProps & {
formUtils: FormUtils<M>;
hostLabel: string;
};
type AnvilNetworkConfigInputGroupOptionalProps = {
type AnNetworkConfigInputGroupOptionalProps = {
previous?: Partial<ManifestNetworkConfig>;
};
type AnvilNetworkConfigInputGroupProps<M extends MapToInputTestID> =
AnvilNetworkConfigInputGroupOptionalProps & {
type AnNetworkConfigInputGroupProps<M extends MapToInputTestID> =
AnNetworkConfigInputGroupOptionalProps & {
formUtils: FormUtils<M>;
networkListEntries: Array<[string, ManifestNetwork]>;
setNetworkList: import('react').Dispatch<
@ -139,20 +139,20 @@ type AnvilNetworkConfigInputGroupProps<M extends MapToInputTestID> =
>;
};
type AnvilHostConfigInputGroupOptionalProps = {
type AnHostConfigInputGroupOptionalProps = {
knownFences?: APIManifestTemplateFenceList;
knownUpses?: APIManifestTemplateUpsList;
previous?: Partial<ManifestHostConfig>;
};
type AnvilHostConfigInputGroupProps<M extends MapToInputTestID> =
AnvilHostConfigInputGroupOptionalProps & {
type AnHostConfigInputGroupProps<M extends MapToInputTestID> =
AnHostConfigInputGroupOptionalProps & {
formUtils: FormUtils<M>;
networkListEntries: Array<[string, ManifestNetwork]>;
};
type AddManifestInputGroupOptionalProps = Pick<
AnvilHostConfigInputGroupOptionalProps,
AnHostConfigInputGroupOptionalProps,
'knownFences' | 'knownUpses'
> & {
previous?: Partial<ManifestAnId> & {

Loading…
Cancel
Save