From 83b9c64556682fe3c9e9edbc54b9da0656421495 Mon Sep 17 00:00:00 2001 From: Mohamed Khelif Date: Tue, 13 Aug 2024 19:26:11 -0400 Subject: [PATCH] DEVPROD-9751 Fix label not being shown for Failing command (#307) --- apps/parsley/src/gql/generated/types.ts | 28 +++++++++++++++++-- apps/spruce/src/gql/generated/types.ts | 20 +++++++++++-- .../Metadata_ContainerizedTask.storyshot | 2 +- .../__snapshots__/Metadata_Default.storyshot | 2 +- .../Metadata_WithAbortMessage.storyshot | 2 +- .../Metadata_WithDependencies.storyshot | 2 +- apps/spruce/src/pages/task/metadata/index.tsx | 19 ++++++++----- 7 files changed, 59 insertions(+), 16 deletions(-) diff --git a/apps/parsley/src/gql/generated/types.ts b/apps/parsley/src/gql/generated/types.ts index d36821080..727b97dd2 100644 --- a/apps/parsley/src/gql/generated/types.ts +++ b/apps/parsley/src/gql/generated/types.ts @@ -879,14 +879,14 @@ export type Image = { __typename?: "Image"; ami: Scalars["String"]["output"]; distros: Array; - events: Array; + events: ImageEventsPayload; id: Scalars["String"]["output"]; kernel: Scalars["String"]["output"]; lastDeployed: Scalars["Time"]["output"]; latestTask?: Maybe; name: Scalars["String"]["output"]; - packages: Array; - toolchains: Array; + packages: ImagePackagesPayload; + toolchains: ImageToolchainsPayload; versionId: Scalars["String"]["output"]; }; @@ -943,6 +943,26 @@ export enum ImageEventType { Toolchain = "TOOLCHAIN", } +export type ImageEventsPayload = { + __typename?: "ImageEventsPayload"; + count: Scalars["Int"]["output"]; + eventLogEntries: Array; +}; + +export type ImagePackagesPayload = { + __typename?: "ImagePackagesPayload"; + data: Array; + filteredCount: Scalars["Int"]["output"]; + totalCount: Scalars["Int"]["output"]; +}; + +export type ImageToolchainsPayload = { + __typename?: "ImageToolchainsPayload"; + data: Array; + filteredCount: Scalars["Int"]["output"]; + totalCount: Scalars["Int"]["output"]; +}; + export type InstanceTag = { __typename?: "InstanceTag"; canBeModified: Scalars["Boolean"]["output"]; @@ -1570,6 +1590,7 @@ export type Patch = { createTime?: Maybe; description: Scalars["String"]["output"]; duration?: Maybe; + generatedTaskCounts: Scalars["Map"]["output"]; githash: Scalars["String"]["output"]; hidden: Scalars["Boolean"]["output"]; id: Scalars["ID"]["output"]; @@ -3231,6 +3252,7 @@ export type Version = { errors: Array; externalLinksForMetadata: Array; finishTime?: Maybe; + generatedTaskCounts: Scalars["Map"]["output"]; gitTags?: Maybe>; id: Scalars["String"]["output"]; ignored: Scalars["Boolean"]["output"]; diff --git a/apps/spruce/src/gql/generated/types.ts b/apps/spruce/src/gql/generated/types.ts index 8be4643f4..b203658b0 100644 --- a/apps/spruce/src/gql/generated/types.ts +++ b/apps/spruce/src/gql/generated/types.ts @@ -885,8 +885,8 @@ export type Image = { lastDeployed: Scalars["Time"]["output"]; latestTask?: Maybe; name: Scalars["String"]["output"]; - packages: Array; - toolchains: Array; + packages: ImagePackagesPayload; + toolchains: ImageToolchainsPayload; versionId: Scalars["String"]["output"]; }; @@ -949,6 +949,20 @@ export type ImageEventsPayload = { eventLogEntries: Array; }; +export type ImagePackagesPayload = { + __typename?: "ImagePackagesPayload"; + data: Array; + filteredCount: Scalars["Int"]["output"]; + totalCount: Scalars["Int"]["output"]; +}; + +export type ImageToolchainsPayload = { + __typename?: "ImageToolchainsPayload"; + data: Array; + filteredCount: Scalars["Int"]["output"]; + totalCount: Scalars["Int"]["output"]; +}; + export type InstanceTag = { __typename?: "InstanceTag"; canBeModified: Scalars["Boolean"]["output"]; @@ -1576,6 +1590,7 @@ export type Patch = { createTime?: Maybe; description: Scalars["String"]["output"]; duration?: Maybe; + generatedTaskCounts: Scalars["Map"]["output"]; githash: Scalars["String"]["output"]; hidden: Scalars["Boolean"]["output"]; id: Scalars["ID"]["output"]; @@ -3237,6 +3252,7 @@ export type Version = { errors: Array; externalLinksForMetadata: Array; finishTime?: Maybe; + generatedTaskCounts: Scalars["Map"]["output"]; gitTags?: Maybe>; id: Scalars["String"]["output"]; ignored: Scalars["Boolean"]["output"]; diff --git a/apps/spruce/src/pages/task/metadata/__snapshots__/Metadata_ContainerizedTask.storyshot b/apps/spruce/src/pages/task/metadata/__snapshots__/Metadata_ContainerizedTask.storyshot index b6f054618..b0a9423cb 100644 --- a/apps/spruce/src/pages/task/metadata/__snapshots__/Metadata_ContainerizedTask.storyshot +++ b/apps/spruce/src/pages/task/metadata/__snapshots__/Metadata_ContainerizedTask.storyshot @@ -96,7 +96,7 @@ class="css-1spnncu-Item-wordBreakCss e1ul56zb0 leafygreen-ui-1tb6tuo" > Failing Command: diff --git a/apps/spruce/src/pages/task/metadata/__snapshots__/Metadata_Default.storyshot b/apps/spruce/src/pages/task/metadata/__snapshots__/Metadata_Default.storyshot index 8e445de1a..e5c242934 100644 --- a/apps/spruce/src/pages/task/metadata/__snapshots__/Metadata_Default.storyshot +++ b/apps/spruce/src/pages/task/metadata/__snapshots__/Metadata_Default.storyshot @@ -96,7 +96,7 @@ class="css-1spnncu-Item-wordBreakCss e1ul56zb0 leafygreen-ui-1tb6tuo" > Failing Command: diff --git a/apps/spruce/src/pages/task/metadata/__snapshots__/Metadata_WithAbortMessage.storyshot b/apps/spruce/src/pages/task/metadata/__snapshots__/Metadata_WithAbortMessage.storyshot index 8e445de1a..e5c242934 100644 --- a/apps/spruce/src/pages/task/metadata/__snapshots__/Metadata_WithAbortMessage.storyshot +++ b/apps/spruce/src/pages/task/metadata/__snapshots__/Metadata_WithAbortMessage.storyshot @@ -96,7 +96,7 @@ class="css-1spnncu-Item-wordBreakCss e1ul56zb0 leafygreen-ui-1tb6tuo" > Failing Command: diff --git a/apps/spruce/src/pages/task/metadata/__snapshots__/Metadata_WithDependencies.storyshot b/apps/spruce/src/pages/task/metadata/__snapshots__/Metadata_WithDependencies.storyshot index 453d98544..b146b7836 100644 --- a/apps/spruce/src/pages/task/metadata/__snapshots__/Metadata_WithDependencies.storyshot +++ b/apps/spruce/src/pages/task/metadata/__snapshots__/Metadata_WithDependencies.storyshot @@ -96,7 +96,7 @@ class="css-1spnncu-Item-wordBreakCss e1ul56zb0 leafygreen-ui-1tb6tuo" > Failing Command: diff --git a/apps/spruce/src/pages/task/metadata/index.tsx b/apps/spruce/src/pages/task/metadata/index.tsx index eaf1fb1ac..5820faa42 100644 --- a/apps/spruce/src/pages/task/metadata/index.tsx +++ b/apps/spruce/src/pages/task/metadata/index.tsx @@ -34,6 +34,7 @@ import { TaskQuery } from "gql/generated/types"; import { useDateFormat } from "hooks"; import { TaskStatus } from "types/task"; import { string } from "utils"; +import { isFailedTaskStatus } from "utils/statuses"; import { AbortMessage } from "./AbortMessage"; import { DependsOn } from "./DependsOn"; import ETATimer from "./ETATimer"; @@ -473,20 +474,24 @@ const DetailsDescription = ({ status: string; }) => { const MAX_CHAR = 100; - + const isFailingTask = isFailedTaskStatus(status); const baseCopy = description || failingCommand; - const fullText = - status === TaskStatus.Failed - ? `${processFailingCommand(baseCopy, isContainerTask)}` - : `Command: ${baseCopy}`; + const fullText = isFailingTask + ? `${processFailingCommand(baseCopy, isContainerTask)}` + : `${baseCopy}`; + const shouldTruncate = fullText.length > MAX_CHAR; const truncatedText = fullText.substring(0, MAX_CHAR).concat("..."); return ( + {isFailingTask ? ( + Failing Command: + ) : ( + Command: + )} {shouldTruncate ? ( <> - Failing Command: {truncatedText}{" "}