Skip to content

Commit

Permalink
🐛 Show disabled tooltip for export when no apps available for export (#…
Browse files Browse the repository at this point in the history
…1691)

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.

 
<img width="351" alt="Screenshot 2024-02-16 at 3 49 30 PM"
src="https://github.com/konveyor/tackle2-ui/assets/11218376/b432205b-98c6-42a2-8950-2132cbd41152">

Signed-off-by: Ian Bolton <[email protected]>
  • Loading branch information
ibolton336 authored Feb 22, 2024
1 parent 4cdd553 commit a302446
Showing 1 changed file with 23 additions and 5 deletions.
28 changes: 23 additions & 5 deletions client/src/app/pages/migration-waves/migration-waves.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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();
Expand All @@ -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();

Expand Down Expand Up @@ -495,16 +497,24 @@ export const MigrationWaves: React.FC = () => {
<ConditionalTooltip
key="export-to-issue-manager"
isTooltipEnabled={
migrationWave.applications?.length < 1
migrationWave.applications?.length < 1 ||
!hasExportableApplications(
tickets,
migrationWave?.applications
)
}
content={
"There are no applications assigned to this migration wave to export."
"No applications are available for export."
}
>
<DropdownItem
key="export-to-issue-manager"
isDisabled={
migrationWave.applications?.length < 1
isAriaDisabled={
migrationWave.applications?.length < 1 ||
!hasExportableApplications(
tickets,
migrationWave?.applications
)
}
onClick={() =>
setApplicationsToExport(
Expand Down Expand Up @@ -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)
);

0 comments on commit a302446

Please sign in to comment.