Skip to content

Commit

Permalink
WIP, refactor modals to apply recommended PF component structure
Browse files Browse the repository at this point in the history
  • Loading branch information
jenny-s51 committed Oct 23, 2024
1 parent e43803e commit de46108
Showing 1 changed file with 33 additions and 27 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
import * as React from 'react';
import { Flex, FlexItem, Stack, StackItem, TextInput } from '@patternfly/react-core';
import { Modal } from '@patternfly/react-core/deprecated';
import {
Form,
FormGroup,
Modal,
ModalBody,
ModalHeader,
TextInput,
} from '@patternfly/react-core';
import DashboardModalFooter from '~/app/components/DashboardModalFooter';

interface ArchiveModelVersionModalProps {
Expand Down Expand Up @@ -41,35 +47,26 @@ export const ArchiveModelVersionModal: React.FC<ArchiveModelVersionModalProps> =
}
}, [onSubmit, onClose]);

const description = (
<>
<b>{modelVersionName}</b> will be archived and unavailable for use unless it is restored.
<br />
<br />
Type <strong>{modelVersionName}</strong> to confirm archiving:
</>
);

return (
<Modal
isOpen={isOpen}
title="Archive version?"
titleIconVariant="warning"
variant="small"
onClose={onClose}
footer={
<DashboardModalFooter
onCancel={onClose}
onSubmit={onConfirm}
submitLabel="Archive"
isSubmitLoading={isSubmitting}
isSubmitDisabled={isDisabled}
error={error}
alertTitle="Error"
/>
}
data-testid="archive-model-version-modal"
>
<Stack hasGutter>
<StackItem>
<b>{modelVersionName}</b> will be archived and unavailable for use unless it is restored.
</StackItem>
<StackItem>
<Flex direction={{ default: 'column' }} spaceItems={{ default: 'spaceItemsSm' }}>
<FlexItem>
Type <strong>{modelVersionName}</strong> to confirm archiving:
</FlexItem>
<ModalHeader title="Archive version?" description={description} titleIconVariant="warning" />
<ModalBody>
<Form>
<FormGroup>
<TextInput
id="confirm-archive-input"
data-testid="confirm-archive-input"
Expand All @@ -82,9 +79,18 @@ export const ArchiveModelVersionModal: React.FC<ArchiveModelVersionModalProps> =
}
}}
/>
</Flex>
</StackItem>
</Stack>
</FormGroup>
</Form>
</ModalBody>
<DashboardModalFooter
onCancel={onClose}
onSubmit={onConfirm}
submitLabel="Archive"
isSubmitLoading={isSubmitting}
isSubmitDisabled={isDisabled}
error={error}
alertTitle="Error"
/>
</Modal>
);
};

0 comments on commit de46108

Please sign in to comment.