Skip to content
This repository has been archived by the owner on Jul 2, 2024. It is now read-only.

DEVPROD-1971: Remove table for custom tickets #2171

Merged
merged 6 commits into from
Dec 12, 2023
Merged
Show file tree
Hide file tree
Changes from 5 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import WithToastContext from "test_utils/toast-decorator";
import { CustomMeta, CustomStoryObj } from "test_utils/types";
import CustomCreatedTickets from "./CustomCreatedTickets";

export default {
component: CustomCreatedTickets,
decorators: [(Story: () => JSX.Element) => WithToastContext(Story)],
} satisfies CustomMeta<typeof CustomCreatedTickets>;

export const Default: CustomStoryObj<typeof CustomCreatedTickets> = {
render: (args) => <CustomCreatedTickets {...args} />,
argTypes: {},
args: {
execution: 0,
taskId: "123",
tickets: [
{
confidenceScore: 0.25,
issueKey: "DEVPROD-1",
jiraTicket: {
key: "key",
fields: {
summary: "Issue Summary",
status: {
id: "id",
name: "Done",
},
created: "2020-01-27",
updated: "2023-11-28",
assigneeDisplayName: "sophie.stadler",
assignedTeam: "evg-ui",
},
},
url: "https://spruce.mongodb.com",
},
{
confidenceScore: 0.5,
issueKey: "DEVPROD-2",
jiraTicket: {
key: "key",
fields: {
summary: "Issue Summary",
status: {
id: "id",
name: "In Progress",
},
created: "2020-01-28",
updated: "2023-11-29",
assigneeDisplayName: "mohamed.khelif",
assignedTeam: "evg-ui",
},
},
url: "https://spruce.mongodb.com",
},
],
},
};
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import styled from "@emotion/styled";
import { size } from "constants/tokens";
import { IssueLink } from "gql/generated/types";
import { AnnotationTicketRow } from "../AnnotationTicketsTable/AnnotationTicketRow";
import { TicketsTitle } from "../BBComponents";
import FileTicketButton from "../FileTicketButton";
import CustomCreatedTicketsTable from "./CustomCreatedTicketsTable";

interface CustomCreatedTicketProps {
taskId: string;
Expand All @@ -17,13 +19,29 @@ const CustomCreatedTickets: React.FC<CustomCreatedTicketProps> = ({
<>
<TicketsTitle>Create a New Ticket</TicketsTitle>
<FileTicketButton taskId={taskId} execution={execution} />
{!!tickets?.length && (
{tickets?.length > 0 && (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: avoid mixed type operands (in this case it's undefined and number)

<>
<TicketsTitle>Tickets Created From This Task</TicketsTitle>
<CustomCreatedTicketsTable tickets={tickets} />
<TicketsTitle margin>Tickets Created From This Task</TicketsTitle>
<TicketContainer>
{tickets.map(({ confidenceScore, issueKey, jiraTicket, url }) => (
<AnnotationTicketRow
confidenceScore={confidenceScore}
issueKey={issueKey}
jiraTicket={jiraTicket}
key={issueKey}
url={url}
/>
))}
</TicketContainer>
</>
)}
</>
);

const TicketContainer = styled.div`
display: flex;
flex-direction: column;
gap: ${size.s};
`;

export default CustomCreatedTickets;

This file was deleted.