-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into refactor_withuiid
- Loading branch information
Showing
6 changed files
with
164 additions
and
54 deletions.
There are no files selected for viewing
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
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
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
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
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