diff --git a/client/src/app/pages/migration-waves/migration-waves.tsx b/client/src/app/pages/migration-waves/migration-waves.tsx index 19117b6f38..23e2eb2d9a 100644 --- a/client/src/app/pages/migration-waves/migration-waves.tsx +++ b/client/src/app/pages/migration-waves/migration-waves.tsx @@ -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(); @@ -372,198 +374,211 @@ export const MigrationWaves: React.FC = () => { } numRenderedColumns={numRenderedColumns} > - {currentPageItems?.map((migrationWave, rowIndex) => ( - - - - - {migrationWave.name} - - - {dayjs(migrationWave.startDate) - .tz(currentTimezone) - .format("MM/DD/YYYY")} - - - {dayjs(migrationWave.endDate) - .tz(currentTimezone) - .format("MM/DD/YYYY")} - - - {migrationWave?.applications?.length.toString()} - - - {migrationWave.allStakeholders.length} - - { + const hasExportableApplications = + migrationWave.applications.some( + (application) => + !tickets + ?.map((ticket) => ticket?.application?.id) + .includes(application.id) + ); + return ( + + + - {migrationWave.applications.length - ? migrationWave.status - : "--"} - - - setIsRowDropdownOpen(null)} - onOpenChange={(_isOpen) => - setIsRowDropdownOpen(null) - } - popperProps={{ position: "right" }} - toggle={( - toggleRef: React.Ref - ) => ( - { - isRowDropdownOpen - ? setIsRowDropdownOpen(null) - : setIsRowDropdownOpen(migrationWave.id); - }} - isExpanded={isRowDropdownOpen === rowIndex} - > - - - )} - shouldFocusToggleOnSelect + + {migrationWave.name} + + - setWaveModalState(migrationWave)} - > - {t("actions.edit")} - - + + {dayjs(migrationWave.endDate) + .tz(currentTimezone) + .format("MM/DD/YYYY")} + + + {migrationWave?.applications?.length.toString()} + + + {migrationWave.allStakeholders.length} + + + {migrationWave.applications.length + ? migrationWave.status + : "--"} + + + setIsRowDropdownOpen(null)} + onOpenChange={(_isOpen) => + setIsRowDropdownOpen(null) } + popperProps={{ position: "right" }} + toggle={( + toggleRef: React.Ref + ) => ( + { + isRowDropdownOpen + ? setIsRowDropdownOpen(null) + : setIsRowDropdownOpen(migrationWave.id); + }} + isExpanded={isRowDropdownOpen === rowIndex} + > + + + )} + shouldFocusToggleOnSelect > { - setWaveToManageModalState(migrationWave); - }} + key="edit" + component="button" + onClick={() => setWaveModalState(migrationWave)} > - {t("composed.manage", { - what: t("terms.applications").toLowerCase(), - })} + {t("actions.edit")} - - - + { + setWaveToManageModalState(migrationWave); + }} + > + {t("composed.manage", { + what: t("terms.applications").toLowerCase(), + })} + + + + + setApplicationsToExport( + migrationWave.fullApplications + ) + } + > + {t("terms.exportToIssue")} + + + - setApplicationsToExport( - migrationWave.fullApplications - ) + setMigrationWaveToDelete({ + id: migrationWave.id, + name: migrationWave.name, + }) } > - {t("terms.exportToIssue")} + {t("actions.delete")} - - - setMigrationWaveToDelete({ - id: migrationWave.id, - name: migrationWave.name, - }) - } - > - {t("actions.delete")} - - - - - - {isCellExpanded(migrationWave) ? ( - - - - {isCellExpanded(migrationWave, "applications") && - !!migrationWave.applications.length ? ( - - ) : isCellExpanded(migrationWave, "stakeholders") && - !!migrationWave.allStakeholders.length ? ( - - ) : ( - isCellExpanded(migrationWave, "status") && ( - + + + + {isCellExpanded(migrationWave) ? ( + + + + {isCellExpanded(migrationWave, "applications") && + !!migrationWave.applications.length ? ( + - ) - )} - - - - ) : null} - - ))} + ) : isCellExpanded( + migrationWave, + "stakeholders" + ) && !!migrationWave.allStakeholders.length ? ( + + ) : ( + isCellExpanded(migrationWave, "status") && ( + + ) + )} + + + + ) : null} + + ); + })}