Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Add link for jira ticket in drawer view #1546

Merged
merged 4 commits into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions client/src/app/api/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@
identity?: Ref;
createTime?: string;
createUser?: string;
id: any;

Check warning on line 212 in client/src/app/api/models.ts

View workflow job for this annotation

GitHub Actions / unit-test (18.x)

Unexpected any. Specify a different type
enabled: boolean;
}

Expand Down Expand Up @@ -366,7 +366,7 @@

export interface TaskgroupTask {
name: string;
data: any;

Check warning on line 369 in client/src/app/api/models.ts

View workflow job for this annotation

GitHub Actions / unit-test (18.x)

Unexpected any. Specify a different type
application: Ref;
}

Expand Down Expand Up @@ -619,6 +619,7 @@
reference?: string | null;
readonly status?: TicketStatus | null;
error?: boolean;
link?: string;
}

export type Role = "Owner" | "Contributor" | null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,28 @@ import {
Button,
Grid,
GridItem,
Spinner,
} from "@patternfly/react-core";
import { Application } from "@app/api/models";
import spacing from "@patternfly/react-styles/css/utilities/Spacing/spacing";
import { ApplicationBusinessService } from "../application-business-service";
import { EmptyTextMessage } from "@app/components/EmptyTextMessage";
import { EditIcon } from "@patternfly/react-icons";
import { useFetchTickets } from "@app/queries/tickets";
import { useDeleteTicketMutation } from "@app/queries/migration-waves";
import { UnlinkIcon } from "@patternfly/react-icons";

export const ApplicationDetailFields: React.FC<{
application: Application | null;
onEditClick: () => void;
onCloseClick: () => void;
}> = ({ application, onEditClick, onCloseClick }) => {
const { t } = useTranslation();

const { tickets } = useFetchTickets();
const { mutate: deleteTicket, isLoading } = useDeleteTicketMutation();
const matchingTicket = tickets?.find(
(ticket) => ticket.application?.id === application?.id
);
return (
<>
<TextContent className={spacing.mtLg}>
Expand Down Expand Up @@ -143,11 +151,51 @@ export const ApplicationDetailFields: React.FC<{
<Title headingLevel="h3" size="md">
{t("terms.migrationWave")}
</Title>
<Text component="small">
<Text
component={TextVariants.small}
className="pf-v5-u-color-200 pf-v5-u-font-weight-light"
>
Wave name{": "}
</Text>
<Text
component={TextVariants.small}
className="pf-v5-u-color-200 pf-v5-u-font-weight-light"
>
{application?.migrationWave
? application.migrationWave.name
: t("terms.unassigned")}
</Text>
<br />
<Text
component={TextVariants.small}
className="pf-v5-u-color-200 pf-v5-u-font-weight-light"
>
Ticket{": "}
</Text>
<Text
component={TextVariants.small}
className="pf-v5-u-color-200 pf-v5-u-font-weight-light"
>
{matchingTicket ? (
<a href={matchingTicket.link} target="_">
{matchingTicket?.link}
</a>
) : (
t("terms.unassigned")
)}
{matchingTicket?.id ? (
isLoading ? (
<Spinner role="status" size="sm" />
) : (
<Button
variant="link"
icon={<UnlinkIcon />}
onClick={() => deleteTicket(matchingTicket.id)}
/>
)
) : null}
</Text>

<Title headingLevel="h3" size="md">
{t("terms.commentsFromApplication")}
</Title>
Expand Down
3 changes: 2 additions & 1 deletion client/src/app/queries/migration-waves.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
deleteTicket,
} from "@app/api/rest";
import { getWavesWithStatus } from "@app/utils/waves-selector";
import { useFetchTickets } from "./tickets";
import { TicketsQueryKey, useFetchTickets } from "./tickets";
import { TrackersQueryKey } from "./trackers";
import { useFetchApplications } from "./applications";
import { useFetchStakeholders } from "./stakeholders";
Expand Down Expand Up @@ -111,6 +111,7 @@ export const useDeleteTicketMutation = (
onSuccess: (res) => {
onSuccess && onSuccess(res);
queryClient.invalidateQueries([MigrationWavesQueryKey]);
queryClient.invalidateQueries([TicketsQueryKey]);
},
onError: onError,
});
Expand Down
Loading