Skip to content

Commit

Permalink
✨ refelect ID -> Id (#1482)
Browse files Browse the repository at this point in the history
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 <sarthaknegi908@gmail.com>
Signed-off-by: Sarthak Negi <122533767+sarthaksarthak9@users.noreply.github.com>
  • Loading branch information
sarthaksarthak9 authored Oct 19, 2023
1 parent ba66b4f commit e910613
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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 <></>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 = <EmptyTextMessage message={t("terms.notAvailable")} />;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -148,12 +148,12 @@ export const ApplicationIdentityForm: React.FC<
} = useForm<FormValues>({
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(
Expand All @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -63,7 +63,7 @@ export const ManageImportsDetails: React.FC = () => {
false
);

const { importSummary } = useFetchImportSummaryByID(importId);
const { importSummary } = useFetchImportSummaryById(importId);

const rows: IRow[] = [];
imports?.forEach((item) => {
Expand Down
2 changes: 1 addition & 1 deletion client/src/app/queries/businessservices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
4 changes: 2 additions & 2 deletions client/src/app/queries/imports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion client/src/app/utils/model-utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ export function toISimpleOptionDropdownWithValue<T>(
};
}

export const getKindIDByRef = (
export const getKindIdByRef = (
identities: Identity[],
application: Application,
kind: IdentityKind
Expand Down

0 comments on commit e910613

Please sign in to comment.