From a302446aabf9e70662fe12d6f1221fd375f83b02 Mon Sep 17 00:00:00 2001 From: Ian Bolton Date: Thu, 22 Feb 2024 11:19:48 -0500 Subject: [PATCH] :bug: Show disabled tooltip for export when no apps available for export (#1691) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Resolves https://issues.redhat.com/browse/MTA-1845 After discussions with UXD ( @JustinXHale ), determined that this export functionality can safely be disabled when no apps are available to export. Apps that have already been exported already are assigned to a ticket and Jira and cannot be re-exported until they are unlinked. Screenshot 2024-02-16 at 3 49 30 PM 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) + );