diff --git a/client/src/app/pages/migration-waves/components/ticket-issue.tsx b/client/src/app/pages/migration-waves/components/ticket-issue.tsx index 3f70f0a551..a1004ffcb5 100644 --- a/client/src/app/pages/migration-waves/components/ticket-issue.tsx +++ b/client/src/app/pages/migration-waves/components/ticket-issue.tsx @@ -1,7 +1,9 @@ import React from "react"; -import { Text } from "@patternfly/react-core"; +import { Text, TextVariants } from "@patternfly/react-core"; import { Ticket } from "@app/api/models"; +import { useTranslation } from "react-i18next"; +import ExternalLink from "@app/components/ExternalLink"; import { useTrackerTypesByProjectId } from "@app/queries/trackers"; export interface ITicketIssueProps { @@ -9,17 +11,26 @@ export interface ITicketIssueProps { } export const TicketIssue: React.FC = ({ ticket }) => { - const useTicketIssue = () => { - const types = useTrackerTypesByProjectId( - ticket?.tracker?.name, - ticket?.parent - ); - const type = types.find((kind) => kind.id === ticket?.kind); - if (type) return type.name; - return ""; - }; + const { t } = useTranslation(); + const ticketIssue = useTicketIssue(ticket); - const ticketIssue = useTicketIssue(); + return ( + + {ticket?.link ? ( + {ticketIssue} + ) : ( + t("terms.unassigned") + )} + + ); +}; + +const useTicketIssue = (ticket?: Ticket) => { + const types = useTrackerTypesByProjectId( + ticket?.tracker?.name, + ticket?.parent + ); + const type = types.find((kind) => kind.id === ticket?.kind); - return {ticketIssue}; + return type ? type.name : ""; }; diff --git a/client/src/app/pages/migration-waves/components/wave-status-table.tsx b/client/src/app/pages/migration-waves/components/wave-status-table.tsx index b59d981837..2be8d576fb 100644 --- a/client/src/app/pages/migration-waves/components/wave-status-table.tsx +++ b/client/src/app/pages/migration-waves/components/wave-status-table.tsx @@ -27,6 +27,8 @@ import { useHistory } from "react-router-dom"; import { useFetchTickets } from "@app/queries/tickets"; import { Paths } from "@app/Paths"; import { TicketIssue } from "./ticket-issue"; +import { useDeleteTicketMutation } from "@app/queries/migration-waves"; +import UnlinkIcon from "@patternfly/react-icons/dist/esm/icons/unlink-icon"; export interface IWaveStatusTableProps { migrationWave: WaveWithStatus; @@ -44,6 +46,7 @@ export const WaveStatusTable: React.FC = ({ const history = useHistory(); const { tickets } = useFetchTickets(); + const { mutate: deleteTicket } = useDeleteTicketMutation(); const tableControls = useLocalTableControls({ idProperty: "name", @@ -130,52 +133,63 @@ export const WaveStatusTable: React.FC = ({ } > - {currentPageItems?.map((app, rowIndex) => ( - - - - {app.name} - - - {getTicketByApplication(tickets, app.id)?.error ? ( + {currentPageItems?.map((app, rowIndex) => { + const ticket = getTicketByApplication(tickets, app.id); + return ( + + + + {app.name} + + + {getTicketByApplication(tickets, app.id)?.error ? ( + + ) : ( + getTicketByApplication(tickets, app?.id)?.status || "" + )} + + + + + + {ticket?.id && ( + - ) : ( - getTicketByApplication(tickets, app?.id)?.status || "" - )} - - - - - - - - - - ))} + + + + ); + })}