From f74a36574a9292888c5409bfe6740afc910b02e0 Mon Sep 17 00:00:00 2001 From: Ian Bolton Date: Fri, 16 Feb 2024 15:50:01 -0500 Subject: [PATCH] :bug: Show disabled tooltip for export when no apps available for export Signed-off-by: Ian Bolton --- .../pages/migration-waves/migration-waves.tsx | 28 +++++++++++++++---- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/client/src/app/pages/migration-waves/migration-waves.tsx b/client/src/app/pages/migration-waves/migration-waves.tsx index 19117b6f38..5dc78ca762 100644 --- a/client/src/app/pages/migration-waves/migration-waves.tsx +++ b/client/src/app/pages/migration-waves/migration-waves.tsx @@ -42,7 +42,7 @@ import { useFetchMigrationWaves, useUpdateMigrationWaveMutation, } from "@app/queries/migration-waves"; -import { MigrationWave, Ref } from "@app/api/models"; +import { MigrationWave, Ref, Ticket } from "@app/api/models"; import { FilterToolbar, FilterType } from "@app/components/FilterToolbar"; import { useLocalTableControls } from "@app/hooks/table-controls"; import { SimplePagination } from "@app/components/SimplePagination"; @@ -68,6 +68,7 @@ import { AppPlaceholder } from "@app/components/AppPlaceholder"; import { ToolbarBulkSelector } from "@app/components/ToolbarBulkSelector"; import { ConfirmDialog } from "@app/components/ConfirmDialog"; import { toRefs } from "@app/utils/model-utils"; +import { useFetchTickets } from "@app/queries/tickets"; export const MigrationWaves: React.FC = () => { const { t } = useTranslation(); @@ -76,6 +77,7 @@ export const MigrationWaves: React.FC = () => { const currentTimezone = dayjs.tz.guess(); const { migrationWaves, isFetching, fetchError } = useFetchMigrationWaves(); + const { tickets } = useFetchTickets(); const { trackers: trackers } = useFetchTrackers(); const { data: applications } = useFetchApplications(); @@ -495,16 +497,24 @@ export const MigrationWaves: React.FC = () => { setApplicationsToExport( @@ -666,3 +676,11 @@ export const MigrationWaves: React.FC = () => { ); }; + +const hasExportableApplications = (tickets: Ticket[], applicationRefs: Ref[]) => + applicationRefs.some( + (applicationRef) => + !tickets + ?.map((ticket) => ticket?.application?.id) + .includes(applicationRef.id) + );