Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ [backport release-0.2] MigrationWave form: Properly notify user of duplicate wave (#1173) #1194

Merged
merged 1 commit into from
Jul 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions client/public/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@
"couldNotFetchBody": "Resource doesn't exists or you don't have access to it",
"couldNotFetchTitle": "Not available",
"duplicateTag": "A tag with this name already exists. Use a different name.",
"duplicateWave": "The migration wave could not be created due to a conflict with an existing wave. Make sure the name and start/end dates are unique and try again.",
"importErrorCheckDocumentation": "For status Error imports, check the documentation to ensure your file is structured correctly.",
"insecureTracker": "Insecure mode deactivates certificate verification. Use insecure mode for instances that have self-signed certificates.",
"jiraInstanceNotConnected": "Jira instance {{name}} is not connected.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,18 @@ export const WaveForm: React.FC<WaveFormProps> = ({
};

const onCreateMigrationWaveError = (error: AxiosError) => {
pushNotification({
title: t("toastr.fail.create", {
type: t("terms.migrationWave").toLowerCase(),
}),
variant: "danger",
});
if (error.response?.status === 409)
pushNotification({
title: t("message.duplicateWave"),
variant: "danger",
});
else
pushNotification({
title: t("toastr.fail.create", {
type: t("terms.migrationWave").toLowerCase(),
}),
variant: "danger",
});
};

const { mutate: createMigrationWave } = useCreateMigrationWaveMutation(
Expand All @@ -119,12 +125,18 @@ export const WaveForm: React.FC<WaveFormProps> = ({
};

const onUpdateMigrationWaveError = (error: AxiosError) => {
pushNotification({
title: t("toastr.fail.save", {
type: t("terms.migrationWave").toLowerCase(),
}),
variant: "danger",
});
if (error.response?.status === 409)
pushNotification({
title: t("message.duplicateWave"),
variant: "danger",
});
else
pushNotification({
title: t("toastr.fail.save", {
type: t("terms.migrationWave").toLowerCase(),
}),
variant: "danger",
});
};

const { mutate: updateMigrationWave } = useUpdateMigrationWaveMutation(
Expand Down