diff --git a/client/src/app/pages/identities/components/identity-form/identity-form.tsx b/client/src/app/pages/identities/components/identity-form/identity-form.tsx index 33f5e7499a..d9972c5457 100644 --- a/client/src/app/pages/identities/components/identity-form/identity-form.tsx +++ b/client/src/app/pages/identities/components/identity-form/identity-form.tsx @@ -690,6 +690,7 @@ export const IdentityForm: React.FC = ({ type={isPasswordHidden ? "password" : "text"} formGroupProps={{ labelIcon: !isPasswordEncrypted ? ( + // TODO: add info icon for auth text explanation = ({ { return item.kind || ""; }, }, - { - key: "createdBy", - title: "Created By", - type: FilterType.search, - placeholderText: "Filter by created by User...", - getItemValue: (item) => { - return item.createUser || ""; - }, - }, ]; const { filterValues, setFilterValues, filteredItems } = useLegacyFilterState( @@ -148,7 +139,6 @@ export const Identities: React.FC = () => { identity?.name || "", "", // description column identity?.kind || "", - identity?.createUser || "", "", // Action column ]; const { sortBy, onSort, sortedItems } = useLegacySortState( @@ -167,7 +157,6 @@ export const Identities: React.FC = () => { }, { title: "Description", transforms: [cellWidth(25)] }, { title: "Type", transforms: [sortable, cellWidth(20)] }, - { title: "Created by", transforms: [sortable, cellWidth(10)] }, { title: "", props: { @@ -203,11 +192,6 @@ export const Identities: React.FC = () => { ), }, - { - title: ( - {item.createUser} - ), - }, { title: ( = ({ }) => { const { t } = useTranslation(); - const { migrationWaves } = useFetchMigrationWaves(); const { pushNotification } = React.useContext(NotificationsContext); const { stakeholders } = useFetchStakeholders(); diff --git a/client/src/app/pages/migration-waves/migration-waves.tsx b/client/src/app/pages/migration-waves/migration-waves.tsx index c7011b4f15..feb69001ef 100644 --- a/client/src/app/pages/migration-waves/migration-waves.tsx +++ b/client/src/app/pages/migration-waves/migration-waves.tsx @@ -78,9 +78,7 @@ export const MigrationWaves: React.FC = () => { const { t } = useTranslation(); const { pushNotification } = React.useContext(NotificationsContext); - const { migrationWaves, isFetching, fetchError, refetch } = - useFetchMigrationWaves(); - + const { migrationWaves, isFetching, fetchError } = useFetchMigrationWaves(); const { trackers: trackers } = useFetchTrackers(); const { data: applications } = useFetchApplications(); diff --git a/client/src/app/queries/migration-waves.ts b/client/src/app/queries/migration-waves.ts index 07afd1ea4c..3e96a9315b 100644 --- a/client/src/app/queries/migration-waves.ts +++ b/client/src/app/queries/migration-waves.ts @@ -8,7 +8,10 @@ import { deleteAllMigrationWaves, } from "@app/api/rest"; import { getWavesWithStatus } from "@app/utils/waves-selector"; -import { TicketsQueryKey } from "./tickets"; +import { useFetchTickets } from "./tickets"; +import { TrackersQueryKey } from "./trackers"; +import { useFetchApplications } from "./applications"; +import { useFetchStakeholders } from "./stakeholders"; export const MigrationWavesQueryKey = "migration-waves"; @@ -29,14 +32,19 @@ export const useCreateMigrationWaveMutation = ( }; export const useFetchMigrationWaves = () => { + const { tickets } = useFetchTickets(); + const { stakeholders } = useFetchStakeholders(); + const { data: applications } = useFetchApplications(); + const queryClient = useQueryClient(); const { isLoading, error, refetch, data } = useQuery({ queryKey: [MigrationWavesQueryKey], queryFn: getMigrationWaves, refetchInterval: 5000, onError: (error) => console.log("error, ", error), - onSuccess: () => queryClient.invalidateQueries([TicketsQueryKey]), - select: (waves) => getWavesWithStatus(queryClient, waves), + onSuccess: () => queryClient.invalidateQueries([TrackersQueryKey]), + select: (waves) => + getWavesWithStatus(waves, tickets, stakeholders, applications), }); return { migrationWaves: data || [], diff --git a/client/src/app/utils/waves-selector.ts b/client/src/app/utils/waves-selector.ts index 313e563097..21c4da4c41 100644 --- a/client/src/app/utils/waves-selector.ts +++ b/client/src/app/utils/waves-selector.ts @@ -8,25 +8,14 @@ import { TicketStatus, WaveWithStatus, } from "@app/api/models"; -import { ApplicationsQueryKey } from "@app/queries/applications"; -import { StakeholdersQueryKey } from "@app/queries/stakeholders"; -import { TicketsQueryKey } from "@app/queries/tickets"; -import { QueryClient, useQueryClient } from "@tanstack/react-query"; import dayjs from "dayjs"; export const getWavesWithStatus = ( - queryClient: QueryClient, - waves: MigrationWave[] + waves: MigrationWave[], + tickets: Ticket[], + stakeholders: StakeholderWithRole[], + applications: Application[] ) => { - const tickets = queryClient.getQueryData([TicketsQueryKey]) || []; - - const stakeholders = - queryClient.getQueryData([StakeholdersQueryKey]) || - []; - - const applications = - queryClient.getQueryData([ApplicationsQueryKey]) || []; - const aggregatedTicketStatus = ( wave: MigrationWave, tickets: Ticket[] @@ -45,6 +34,10 @@ export const getWavesWithStatus = ( } } else if (statuses.includes("New")) { return "Issues Created"; + } else if (statuses.includes("In Progress")) { + return "In Progress"; + } else if (statuses.every((status) => status === "Done")) { + return "Completed"; } else { return "Not Started"; } @@ -56,14 +49,16 @@ export const getWavesWithStatus = ( wave: MigrationWave, tickets: Ticket[] ): TicketStatus[] => - wave.applications.map((application): TicketStatus => { - const matchingTicket = getTicketByApplication(tickets, application.id); - if (matchingTicket?.error) { - return "Error"; - } else if (matchingTicket?.status) { - return matchingTicket.status; - } else return ""; - }); + wave.applications + .map((application): TicketStatus => { + const matchingTicket = getTicketByApplication(tickets, application.id); + if (matchingTicket?.error) { + return "Error"; + } else if (matchingTicket?.status) { + return matchingTicket.status; + } else return ""; + }) + .filter((ticketStatus) => ticketStatus !== ""); const getApplicationsOwners = (id: number) => { const applicationOwnerIds = applications @@ -143,6 +138,7 @@ export const getWavesWithStatus = ( }; const wavesWithStatus: WaveWithStatus[] = waves.map( (wave): WaveWithStatus => { + console.log({ ticketStatus: aggregatedTicketStatus(wave, tickets) }); return { ...wave, ticketStatus: getTicketStatus(wave, tickets),