-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🐛 Add link to associated ticket (#1565)
Resolves https://issues.redhat.com/browse/MTA-701 Resolves https://issues.redhat.com/browse/MTA-1539 --------- Signed-off-by: ibolton336 <[email protected]>
- Loading branch information
1 parent
1c663a4
commit c7c6d7c
Showing
2 changed files
with
78 additions
and
53 deletions.
There are no files selected for viewing
35 changes: 23 additions & 12 deletions
35
client/src/app/pages/migration-waves/components/ticket-issue.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,36 @@ | ||
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 { | ||
ticket?: Ticket; | ||
} | ||
|
||
export const TicketIssue: React.FC<ITicketIssueProps> = ({ 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 ( | ||
<Text component={TextVariants.p}> | ||
{ticket?.link ? ( | ||
<ExternalLink href={ticket.link}>{ticketIssue}</ExternalLink> | ||
) : ( | ||
t("terms.unassigned") | ||
)} | ||
</Text> | ||
); | ||
}; | ||
|
||
const useTicketIssue = (ticket?: Ticket) => { | ||
const types = useTrackerTypesByProjectId( | ||
ticket?.tracker?.name, | ||
ticket?.parent | ||
); | ||
const type = types.find((kind) => kind.id === ticket?.kind); | ||
|
||
return <Text>{ticketIssue}</Text>; | ||
return type ? type.name : ""; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters