|
|
@ -1,27 +1,40 @@ |
|
|
|
import { FC, ReactElement, useMemo } from 'react'; |
|
|
|
import { ReactElement, useMemo } from 'react'; |
|
|
|
|
|
|
|
|
|
|
|
import AddUpsInputGroup from './AddUpsInputGroup'; |
|
|
|
import AddUpsInputGroup, { INPUT_ID_UPS_TYPE } from './AddUpsInputGroup'; |
|
|
|
|
|
|
|
import { INPUT_ID_UPS_IP, INPUT_ID_UPS_NAME } from './CommonUpsInputGroup'; |
|
|
|
import Spinner from '../Spinner'; |
|
|
|
import Spinner from '../Spinner'; |
|
|
|
|
|
|
|
|
|
|
|
const INPUT_ID_UPS_UUID = 'edit-ups-input-ups-uuid'; |
|
|
|
const INPUT_ID_UPS_UUID = 'edit-ups-input-ups-uuid'; |
|
|
|
|
|
|
|
|
|
|
|
const EditUpsInputGroup: FC<EditUpsInputGroupProps> = ({ |
|
|
|
const EditUpsInputGroup = < |
|
|
|
|
|
|
|
M extends { |
|
|
|
|
|
|
|
[K in |
|
|
|
|
|
|
|
| typeof INPUT_ID_UPS_IP |
|
|
|
|
|
|
|
| typeof INPUT_ID_UPS_NAME |
|
|
|
|
|
|
|
| typeof INPUT_ID_UPS_TYPE]: string; |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
>({ |
|
|
|
|
|
|
|
formUtils, |
|
|
|
loading: isExternalLoading, |
|
|
|
loading: isExternalLoading, |
|
|
|
previous, |
|
|
|
previous, |
|
|
|
upsTemplate, |
|
|
|
upsTemplate, |
|
|
|
upsUUID, |
|
|
|
upsUUID, |
|
|
|
}) => { |
|
|
|
}: EditUpsInputGroupProps<M>): ReactElement => { |
|
|
|
const content = useMemo<ReactElement>( |
|
|
|
const content = useMemo<ReactElement>( |
|
|
|
() => |
|
|
|
() => |
|
|
|
isExternalLoading ? ( |
|
|
|
isExternalLoading ? ( |
|
|
|
<Spinner /> |
|
|
|
<Spinner /> |
|
|
|
) : ( |
|
|
|
) : ( |
|
|
|
<> |
|
|
|
<> |
|
|
|
<AddUpsInputGroup previous={previous} upsTemplate={upsTemplate} /> |
|
|
|
<AddUpsInputGroup |
|
|
|
|
|
|
|
formUtils={formUtils} |
|
|
|
|
|
|
|
previous={previous} |
|
|
|
|
|
|
|
upsTemplate={upsTemplate} |
|
|
|
|
|
|
|
/> |
|
|
|
<input hidden id={INPUT_ID_UPS_UUID} readOnly value={upsUUID} /> |
|
|
|
<input hidden id={INPUT_ID_UPS_UUID} readOnly value={upsUUID} /> |
|
|
|
</> |
|
|
|
</> |
|
|
|
), |
|
|
|
), |
|
|
|
[isExternalLoading, previous, upsTemplate, upsUUID], |
|
|
|
[formUtils, isExternalLoading, previous, upsTemplate, upsUUID], |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
return content; |
|
|
|
return content; |
|
|
|