fix(striker-ui): allow UPS type selection in EditUpsInputGroup

main
Tsu-ba-me 2 years ago committed by digimer
parent f97463f2c4
commit 5e2f7b4974
  1. 13
      striker-ui/components/ManageUps/EditUpsInputGroup.tsx
  2. 4
      striker-ui/types/EditUpsInputGroup.d.ts

@ -1,11 +1,14 @@
import { FC, ReactElement, useMemo } from 'react'; import { FC, ReactElement, useMemo } from 'react';
import CommonUpsInputGroup from './CommonUpsInputGroup'; import AddUpsInputGroup from './AddUpsInputGroup';
import Spinner from '../Spinner'; import Spinner from '../Spinner';
const INPUT_ID_UPS_UUID = 'edit-ups-input-ups-uuid';
const EditUpsInputGroup: FC<EditUpsInputGroupProps> = ({ const EditUpsInputGroup: FC<EditUpsInputGroupProps> = ({
loading: isExternalLoading, loading: isExternalLoading,
previous, previous,
upsTemplate,
upsUUID, upsUUID,
}) => { }) => {
const content = useMemo<ReactElement>( const content = useMemo<ReactElement>(
@ -14,14 +17,16 @@ const EditUpsInputGroup: FC<EditUpsInputGroupProps> = ({
<Spinner /> <Spinner />
) : ( ) : (
<> <>
<CommonUpsInputGroup previous={previous} /> <AddUpsInputGroup previous={previous} upsTemplate={upsTemplate} />
<input hidden id="edit-ups-input-ups-uuid" readOnly value={upsUUID} /> <input hidden id={INPUT_ID_UPS_UUID} readOnly value={upsUUID} />
</> </>
), ),
[isExternalLoading, previous, upsUUID], [isExternalLoading, previous, upsTemplate, upsUUID],
); );
return content; return content;
}; };
export { INPUT_ID_UPS_UUID };
export default EditUpsInputGroup; export default EditUpsInputGroup;

@ -3,4 +3,6 @@ type EditUpsInputGroupOptionalProps = {
}; };
type EditUpsInputGroupProps = EditUpsInputGroupOptionalProps & type EditUpsInputGroupProps = EditUpsInputGroupOptionalProps &
Pick<CommonUpsInputGroupProps, 'previous'> & { upsUUID: string }; Pick<AddUpsInputGroupProps, 'previous' | 'upsTemplate'> & {
upsUUID: string;
};

Loading…
Cancel
Save