Skip to content

Commit

Permalink
🐛 Alert archetype has already been reviewed (#1449)
Browse files Browse the repository at this point in the history
Resolves [No warning that archetype has already been
reviewed](https://issues.redhat.com/browse/MTA-1383)

Signed-off-by: ibolton336 <ibolton@redhat.com>
  • Loading branch information
ibolton336 authored Oct 9, 2023
1 parent 15b5c84 commit 316f877
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 5 deletions.
1 change: 1 addition & 0 deletions client/public/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@
"overrideAssessmentDescription": "The application {{name}} already is associated with archetypes: {{what}}.",
"overrideAssessmentConfirmation": "Do you want to create a dedicated assessment for this application and override the inherited archetype assessment(s)?",
"overrideReviewConfirmation": "This application has already been reviewed. Do you want to continue?",
"overrideArchetypeReviewConfirmation": "This archetype has already been reviewed. Do you want to continue?",
"reasonForError": "The reported reason for the error:",
"reviewInstructions": "Use this section to provide your assessment of the possible migration/modernization plan and effort estimation.",
"savingSelection": "Saving selection",
Expand Down
42 changes: 37 additions & 5 deletions client/src/app/pages/archetypes/archetypes-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ const Archetypes: React.FC = () => {
const [openCreateArchetype, setOpenCreateArchetype] =
useState<boolean>(false);

const [reviewToEdit, setReviewToEdit] = React.useState<number | null>(null);

const [archetypeToEdit, setArchetypeToEdit] = useState<Archetype | null>(
null
);
Expand Down Expand Up @@ -186,6 +188,19 @@ const Archetypes: React.FC = () => {
setArchetypeToAssess(null);
}
};

const reviewSelectedArchetype = (archetype: Archetype) => {
if (archetype.review) {
setReviewToEdit(archetype.id);
} else {
history.push(
formatPath(Paths.archetypeReview, {
archetypeId: archetype.id,
})
);
}
};

return (
<>
<PageSection variant={PageSectionVariants.light}>
Expand Down Expand Up @@ -297,11 +312,7 @@ const Archetypes: React.FC = () => {
{
title: t("actions.review"),
onClick: () =>
history.push(
formatPath(Paths.archetypeReview, {
archetypeId: archetype.id,
})
),
reviewSelectedArchetype(archetype),
},
{
title: t("actions.edit"),
Expand Down Expand Up @@ -418,6 +429,27 @@ const Archetypes: React.FC = () => {
setArchetypeToAssess(null);
}}
/>
<ConfirmDialog
title={t("composed.editQuestion", {
what: t("terms.review").toLowerCase(),
})}
titleIconVariant={"warning"}
isOpen={reviewToEdit !== null}
message={t("message.overrideArchetypeReviewConfirmation")}
confirmBtnVariant={ButtonVariant.primary}
confirmBtnLabel={t("actions.continue")}
cancelBtnLabel={t("actions.cancel")}
onCancel={() => setReviewToEdit(null)}
onClose={() => setReviewToEdit(null)}
onConfirm={() => {
history.push(
formatPath(Paths.archetypeReview, {
archetypeId: reviewToEdit,
})
);
setReviewToEdit(null);
}}
/>
</>
);
};
Expand Down

0 comments on commit 316f877

Please sign in to comment.