From e910613540073b19516b713582f66d5eef58736c Mon Sep 17 00:00:00 2001 From: Sarthak Negi <122533767+sarthaksarthak9@users.noreply.github.com> Date: Thu, 19 Oct 2023 20:45:45 +0530 Subject: [PATCH] :sparkles: refelect ID -> Id (#1482) Appears that konveyor have since settled on "ID->Id". There are still a few places where we need to reflect this decision in the code. E.g. getKindIDByRef, useFetchBusinessServiceByID, etc closes #1307 --------- Signed-off-by: sarthaksarthak9 Signed-off-by: Sarthak Negi <122533767+sarthaksarthak9@users.noreply.github.com> --- .../components/application-business-service.tsx | 4 ++-- .../application-detail-drawer-analysis.tsx | 6 +++--- .../application-identity-form.tsx | 10 +++++----- .../manage-imports-details/manage-imports-details.tsx | 4 ++-- client/src/app/queries/businessservices.ts | 2 +- client/src/app/queries/imports.ts | 4 ++-- client/src/app/utils/model-utils.tsx | 2 +- 7 files changed, 16 insertions(+), 16 deletions(-) diff --git a/client/src/app/pages/applications/components/application-business-service.tsx b/client/src/app/pages/applications/components/application-business-service.tsx index ca223ad6c8..575f0dad6a 100644 --- a/client/src/app/pages/applications/components/application-business-service.tsx +++ b/client/src/app/pages/applications/components/application-business-service.tsx @@ -1,6 +1,6 @@ import React from "react"; -import { useFetchBusinessServiceByID } from "@app/queries/businessservices"; +import { useFetchBusinessServiceById } from "@app/queries/businessservices"; export interface ApplicationBusinessServiceProps { id: number | string | undefined; @@ -9,7 +9,7 @@ export interface ApplicationBusinessServiceProps { export const ApplicationBusinessService: React.FC< ApplicationBusinessServiceProps > = ({ id }) => { - const { businessService, fetchError } = useFetchBusinessServiceByID(id || ""); + const { businessService, fetchError } = useFetchBusinessServiceById(id || ""); if (fetchError) { return <>; diff --git a/client/src/app/pages/applications/components/application-detail-drawer/application-detail-drawer-analysis.tsx b/client/src/app/pages/applications/components/application-detail-drawer/application-detail-drawer-analysis.tsx index ad3aaa4629..234678ec22 100644 --- a/client/src/app/pages/applications/components/application-detail-drawer/application-detail-drawer-analysis.tsx +++ b/client/src/app/pages/applications/components/application-detail-drawer/application-detail-drawer-analysis.tsx @@ -18,7 +18,7 @@ import { } from "@patternfly/react-icons"; import spacing from "@patternfly/react-styles/css/utilities/Spacing/spacing"; import { Identity, MimeType, Task } from "@app/api/models"; -import { getKindIDByRef } from "@app/utils/model-utils"; +import { getKindIdByRef } from "@app/utils/model-utils"; import { useFetchIdentities } from "@app/queries/identities"; import { ApplicationDetailDrawer, @@ -53,8 +53,8 @@ export const ApplicationDetailDrawerAnalysis: React.FC< let matchingSourceCredsRef: Identity | undefined; let matchingMavenCredsRef: Identity | undefined; if (application && identities) { - matchingSourceCredsRef = getKindIDByRef(identities, application, "source"); - matchingMavenCredsRef = getKindIDByRef(identities, application, "maven"); + matchingSourceCredsRef = getKindIdByRef(identities, application, "source"); + matchingMavenCredsRef = getKindIdByRef(identities, application, "maven"); } const notAvailable = ; diff --git a/client/src/app/pages/applications/components/application-identity-form/application-identity-form.tsx b/client/src/app/pages/applications/components/application-identity-form/application-identity-form.tsx index 55bf78180f..2c2e42fd45 100644 --- a/client/src/app/pages/applications/components/application-identity-form/application-identity-form.tsx +++ b/client/src/app/pages/applications/components/application-identity-form/application-identity-form.tsx @@ -13,7 +13,7 @@ import WarningTriangleIcon from "@patternfly/react-icons/dist/esm/icons/warning- import { Application, Ref } from "@app/api/models"; import { DEFAULT_SELECT_MAX_HEIGHT } from "@app/Constants"; import spacing from "@patternfly/react-styles/css/utilities/Spacing/spacing"; -import { getKindIDByRef, toOptionLike } from "@app/utils/model-utils"; +import { getKindIdByRef, toOptionLike } from "@app/utils/model-utils"; import { APPLICATION_NAME, MAVEN_SETTINGS, @@ -148,12 +148,12 @@ export const ApplicationIdentityForm: React.FC< } = useForm({ defaultValues: { [APPLICATION_NAME]: getApplicationNames(applications) || "", - [SOURCE_CREDENTIALS]: getKindIDByRef( + [SOURCE_CREDENTIALS]: getKindIdByRef( identities, applications[0], "source" )?.name, - [MAVEN_SETTINGS]: getKindIDByRef(identities, applications[0], "maven") + [MAVEN_SETTINGS]: getKindIdByRef(identities, applications[0], "maven") ?.name, }, resolver: yupResolver( @@ -165,10 +165,10 @@ export const ApplicationIdentityForm: React.FC< useEffect(() => { if (identities && applications) { const isExistingSourceCreds = applications.some((app) => { - return getKindIDByRef(identities, app, "source"); + return getKindIdByRef(identities, app, "source"); }); const isExistingMavenCreds = applications.some((app) => { - return getKindIDByRef(identities, app, "maven"); + return getKindIdByRef(identities, app, "maven"); }); setExistingIdentitiesError(isExistingMavenCreds || isExistingSourceCreds); } diff --git a/client/src/app/pages/applications/manage-imports-details/manage-imports-details.tsx b/client/src/app/pages/applications/manage-imports-details/manage-imports-details.tsx index 2aba12f003..c83e3346ad 100644 --- a/client/src/app/pages/applications/manage-imports-details/manage-imports-details.tsx +++ b/client/src/app/pages/applications/manage-imports-details/manage-imports-details.tsx @@ -19,7 +19,7 @@ import { getAxiosErrorMessage } from "@app/utils/utils"; import { useLegacyPaginationState } from "@app/hooks/useLegacyPaginationState"; import { useFetchImports, - useFetchImportSummaryByID, + useFetchImportSummaryById, } from "@app/queries/imports"; import { FilterCategory, @@ -63,7 +63,7 @@ export const ManageImportsDetails: React.FC = () => { false ); - const { importSummary } = useFetchImportSummaryByID(importId); + const { importSummary } = useFetchImportSummaryById(importId); const rows: IRow[] = []; imports?.forEach((item) => { diff --git a/client/src/app/queries/businessservices.ts b/client/src/app/queries/businessservices.ts index abd764355c..f452af60c6 100644 --- a/client/src/app/queries/businessservices.ts +++ b/client/src/app/queries/businessservices.ts @@ -27,7 +27,7 @@ export const useFetchBusinessServices = () => { }; }; -export const useFetchBusinessServiceByID = (id: number | string) => { +export const useFetchBusinessServiceById = (id: number | string) => { const { data, isLoading, error } = useQuery({ queryKey: [BusinessServicesQueryKey, id], queryFn: () => getBusinessServiceById(id), diff --git a/client/src/app/queries/imports.ts b/client/src/app/queries/imports.ts index 12592ab026..048d77ae60 100644 --- a/client/src/app/queries/imports.ts +++ b/client/src/app/queries/imports.ts @@ -43,13 +43,13 @@ export const useFetchImportSummaries = () => { }; }; -export const useFetchImportSummaryByID = (id: number | string) => { +export const useFetchImportSummaryById = (id: number | string) => { const { data, isLoading, error, refetch } = useQuery({ queryKey: [ImportQueryKey, id], queryFn: () => getApplicationImportSummaryById(id), onError: (error) => console.log(error), }); - + return { importSummary: data, isFetching: isLoading, diff --git a/client/src/app/utils/model-utils.tsx b/client/src/app/utils/model-utils.tsx index 1136fad3ee..017e5878c7 100644 --- a/client/src/app/utils/model-utils.tsx +++ b/client/src/app/utils/model-utils.tsx @@ -181,7 +181,7 @@ export function toISimpleOptionDropdownWithValue( }; } -export const getKindIDByRef = ( +export const getKindIdByRef = ( identities: Identity[], application: Application, kind: IdentityKind