fix(striker-ui): include host id in an-host input ids

main
Tsu-ba-me 2 years ago
parent 8110a3daaf
commit 515d3b3b9e
  1. 1
      striker-ui/components/ManageManifest/AnHostConfigInputGroup.tsx
  2. 23
      striker-ui/components/ManageManifest/AnHostInputGroup.tsx
  3. 1
      striker-ui/types/ManageManifest.d.ts

@ -95,6 +95,7 @@ const AnHostConfigInputGroup = <M extends MapToInputTestID>({
children: ( children: (
<AnHostInputGroup <AnHostInputGroup
formUtils={formUtils} formUtils={formUtils}
hostId={hostId}
hostLabel={hostLabel} hostLabel={hostLabel}
previous={{ fences, networks, upses }} previous={{ fences, networks, upses }}
/> />

@ -20,14 +20,14 @@ const INPUT_CELL_ID_PREFIX_AH = `${INPUT_ID_PREFIX_AN_HOST}-cell`;
const GRID_SPACING = '1em'; const GRID_SPACING = '1em';
const buildInputIdAHFencePort = (fenceId: string): string => const buildInputIdAHFencePort = (hostId: string, fenceId: string): string =>
`${INPUT_ID_PREFIX_AN_HOST}-${fenceId}-port`; `${INPUT_ID_PREFIX_AN_HOST}-${hostId}-${fenceId}-port`;
const buildInputIdAHNetworkIp = (networkId: string): string => const buildInputIdAHNetworkIp = (hostId: string, networkId: string): string =>
`${INPUT_ID_PREFIX_AN_HOST}-${networkId}-ip`; `${INPUT_ID_PREFIX_AN_HOST}-${hostId}-${networkId}-ip`;
const buildInputIdAHUpsPowerHost = (upsId: string): string => const buildInputIdAHUpsPowerHost = (hostId: string, upsId: string): string =>
`${INPUT_ID_PREFIX_AN_HOST}-${upsId}-power-host`; `${INPUT_ID_PREFIX_AN_HOST}-${hostId}-${upsId}-power-host`;
const AnHostInputGroup = <M extends MapToInputTestID>({ const AnHostInputGroup = <M extends MapToInputTestID>({
formUtils: { formUtils: {
@ -36,6 +36,7 @@ const AnHostInputGroup = <M extends MapToInputTestID>({
msgSetters, msgSetters,
setMsgSetter, setMsgSetter,
}, },
hostId,
hostLabel, hostLabel,
previous: { previous: {
fences: fenceList = {}, fences: fenceList = {},
@ -72,7 +73,7 @@ const AnHostInputGroup = <M extends MapToInputTestID>({
(previous, [fenceId, { fenceName, fencePort }]) => { (previous, [fenceId, { fenceName, fencePort }]) => {
const cellId = `${INPUT_CELL_ID_PREFIX_AH}-${fenceId}-port`; const cellId = `${INPUT_CELL_ID_PREFIX_AH}-${fenceId}-port`;
const inputId = buildInputIdAHFencePort(fenceId); const inputId = buildInputIdAHFencePort(hostId, fenceId);
const inputLabel = `Port on ${fenceName}`; const inputLabel = `Port on ${fenceName}`;
setMsgSetter(inputId); setMsgSetter(inputId);
@ -111,6 +112,7 @@ const AnHostInputGroup = <M extends MapToInputTestID>({
buildFinishInputTestBatchFunction, buildFinishInputTestBatchFunction,
buildInputFirstRenderFunction, buildInputFirstRenderFunction,
fenceListEntries, fenceListEntries,
hostId,
msgSetters, msgSetters,
setMsgSetter, setMsgSetter,
], ],
@ -122,7 +124,7 @@ const AnHostInputGroup = <M extends MapToInputTestID>({
(previous, [networkId, { networkIp, networkNumber, networkType }]) => { (previous, [networkId, { networkIp, networkNumber, networkType }]) => {
const cellId = `${INPUT_CELL_ID_PREFIX_AH}-${networkId}-ip`; const cellId = `${INPUT_CELL_ID_PREFIX_AH}-${networkId}-ip`;
const inputId = buildInputIdAHNetworkIp(networkIp); const inputId = buildInputIdAHNetworkIp(hostId, networkIp);
const inputLabel = `${NETWORK_TYPES[networkType]} ${networkNumber}`; const inputLabel = `${NETWORK_TYPES[networkType]} ${networkNumber}`;
setMsgSetter(inputId); setMsgSetter(inputId);
@ -159,6 +161,7 @@ const AnHostInputGroup = <M extends MapToInputTestID>({
), ),
[ [
networkListEntries, networkListEntries,
hostId,
setMsgSetter, setMsgSetter,
buildFinishInputTestBatchFunction, buildFinishInputTestBatchFunction,
buildInputFirstRenderFunction, buildInputFirstRenderFunction,
@ -172,7 +175,7 @@ const AnHostInputGroup = <M extends MapToInputTestID>({
(previous, [upsId, { isUsed, upsName }]) => { (previous, [upsId, { isUsed, upsName }]) => {
const cellId = `${INPUT_CELL_ID_PREFIX_AH}-${upsId}-power-host`; const cellId = `${INPUT_CELL_ID_PREFIX_AH}-${upsId}-power-host`;
const inputId = buildInputIdAHUpsPowerHost(upsId); const inputId = buildInputIdAHUpsPowerHost(hostId, upsId);
const inputLabel = `Uses ${upsName}`; const inputLabel = `Uses ${upsName}`;
previous[cellId] = { previous[cellId] = {
@ -195,7 +198,7 @@ const AnHostInputGroup = <M extends MapToInputTestID>({
}, },
{}, {},
), ),
[upsListEntries], [hostId, upsListEntries],
); );
return ( return (

@ -118,6 +118,7 @@ type AnHostInputGroupOptionalProps = {
type AnHostInputGroupProps<M extends MapToInputTestID> = type AnHostInputGroupProps<M extends MapToInputTestID> =
AnHostInputGroupOptionalProps & { AnHostInputGroupOptionalProps & {
formUtils: FormUtils<M>; formUtils: FormUtils<M>;
hostId: string;
hostLabel: string; hostLabel: string;
}; };

Loading…
Cancel
Save