diff --git a/client/public/locales/en/translation.json b/client/public/locales/en/translation.json index 6bdace9ef6..69b7dfe931 100644 --- a/client/public/locales/en/translation.json +++ b/client/public/locales/en/translation.json @@ -276,6 +276,7 @@ "credentialType": "Credential type", "criticality": "Criticality", "currentLandscape": "Current landscape", + "customTargetOfType": "custom migration target: {{type}}", "customTarget": "Custom migration target", "customTargets": "Custom migration targets", "customTargetsDetails": "Create and manage custom migration targets. You can also drag and drop the cards to rearrange them. Note that any changes to the layout here will be reflected in the Analysis wizard", diff --git a/client/src/app/api/models.ts b/client/src/app/api/models.ts index e6ce4904e6..582522cf1f 100644 --- a/client/src/app/api/models.ts +++ b/client/src/app/api/models.ts @@ -761,3 +761,4 @@ export interface Archetype { assessed?: boolean; review?: Ref; } +export type ProviderType = "Java" | "Go"; diff --git a/client/src/app/pages/migration-targets/components/custom-target-form.tsx b/client/src/app/pages/migration-targets/components/custom-target-form.tsx index 013300964a..12bbf8ba7f 100644 --- a/client/src/app/pages/migration-targets/components/custom-target-form.tsx +++ b/client/src/app/pages/migration-targets/components/custom-target-form.tsx @@ -28,7 +28,14 @@ import { } from "@app/components/HookFormPFFields"; import { getAxiosErrorMessage } from "@app/utils/utils"; import { useCreateFileMutation } from "@app/queries/targets"; -import { IReadFile, New, Rule, Target, TargetLabel } from "@app/api/models"; +import { + IReadFile, + New, + ProviderType, + Rule, + Target, + TargetLabel, +} from "@app/api/models"; import { getParsedLabel, parseRules } from "@app/utils/rules-utils"; import { OptionWithValue, SimpleSelect } from "@app/components/SimpleSelect"; import { toOptionLike } from "@app/utils/model-utils"; @@ -47,6 +54,7 @@ export interface CustomTargetFormProps { target?: Target | null; onSaved: (response: AxiosResponse) => void; onCancel: () => void; + providerType: ProviderType; } export interface CustomTargetFormValues { @@ -67,6 +75,7 @@ export const CustomTargetForm: React.FC = ({ target: initialTarget, onSaved, onCancel, + providerType, }) => { const { pushNotification } = useContext(NotificationsContext); const { t } = useTranslation(); @@ -298,6 +307,7 @@ export const CustomTargetForm: React.FC = ({ }, }), }, + provider: providerType || "Java", }; if (target) { diff --git a/client/src/app/pages/migration-targets/migration-targets.tsx b/client/src/app/pages/migration-targets/migration-targets.tsx index 70e5a5d2d5..07f7e241a2 100644 --- a/client/src/app/pages/migration-targets/migration-targets.tsx +++ b/client/src/app/pages/migration-targets/migration-targets.tsx @@ -35,13 +35,13 @@ import { getAxiosErrorMessage } from "@app/utils/utils"; import { CustomTargetForm } from "./components/custom-target-form"; import { useSetting, useSettingMutation } from "@app/queries/settings"; import { useDeleteTargetMutation, useFetchTargets } from "@app/queries/targets"; -import { Target } from "@app/api/models"; +import { ProviderType, Target } from "@app/api/models"; import { SimpleSelect } from "@app/components/SimpleSelect"; export const MigrationTargets: React.FC = () => { const { t } = useTranslation(); const { pushNotification } = React.useContext(NotificationsContext); - const [provider, setProvider] = useState("Java"); + const [provider, setProvider] = useState("Java"); const { targets, refetch: refetchTargets } = useFetchTargets(); @@ -181,7 +181,7 @@ export const MigrationTargets: React.FC = () => { value={provider} options={["Java", "Go"]} onChange={(selection) => { - setProvider(selection as string); + setProvider(selection as ProviderType); }} /> @@ -203,7 +203,9 @@ export const MigrationTargets: React.FC = () => { title={t( targetToUpdate ? "dialog.title.update" : "dialog.title.new", { - what: t("terms.customTarget").toLowerCase(), + what: `${t("terms.customTargetOfType", { + type: provider, + })}`, } )} variant="medium" @@ -211,6 +213,7 @@ export const MigrationTargets: React.FC = () => { onClose={() => setCreateUpdateModalState(null)} > setCreateUpdateModalState(null)}