Skip to content

Commit

Permalink
DEVPROD-9751 Fix label not being shown for Failing command (#307)
Browse files Browse the repository at this point in the history
  • Loading branch information
khelif96 authored Aug 13, 2024
1 parent 198443c commit 83b9c64
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 16 deletions.
28 changes: 25 additions & 3 deletions apps/parsley/src/gql/generated/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -879,14 +879,14 @@ export type Image = {
__typename?: "Image";
ami: Scalars["String"]["output"];
distros: Array<Distro>;
events: Array<ImageEvent>;
events: ImageEventsPayload;
id: Scalars["String"]["output"];
kernel: Scalars["String"]["output"];
lastDeployed: Scalars["Time"]["output"];
latestTask?: Maybe<Task>;
name: Scalars["String"]["output"];
packages: Array<Package>;
toolchains: Array<Toolchain>;
packages: ImagePackagesPayload;
toolchains: ImageToolchainsPayload;
versionId: Scalars["String"]["output"];
};

Expand Down Expand Up @@ -943,6 +943,26 @@ export enum ImageEventType {
Toolchain = "TOOLCHAIN",
}

export type ImageEventsPayload = {
__typename?: "ImageEventsPayload";
count: Scalars["Int"]["output"];
eventLogEntries: Array<ImageEvent>;
};

export type ImagePackagesPayload = {
__typename?: "ImagePackagesPayload";
data: Array<Package>;
filteredCount: Scalars["Int"]["output"];
totalCount: Scalars["Int"]["output"];
};

export type ImageToolchainsPayload = {
__typename?: "ImageToolchainsPayload";
data: Array<Toolchain>;
filteredCount: Scalars["Int"]["output"];
totalCount: Scalars["Int"]["output"];
};

export type InstanceTag = {
__typename?: "InstanceTag";
canBeModified: Scalars["Boolean"]["output"];
Expand Down Expand Up @@ -1570,6 +1590,7 @@ export type Patch = {
createTime?: Maybe<Scalars["Time"]["output"]>;
description: Scalars["String"]["output"];
duration?: Maybe<PatchDuration>;
generatedTaskCounts: Scalars["Map"]["output"];
githash: Scalars["String"]["output"];
hidden: Scalars["Boolean"]["output"];
id: Scalars["ID"]["output"];
Expand Down Expand Up @@ -3231,6 +3252,7 @@ export type Version = {
errors: Array<Scalars["String"]["output"]>;
externalLinksForMetadata: Array<ExternalLinkForMetadata>;
finishTime?: Maybe<Scalars["Time"]["output"]>;
generatedTaskCounts: Scalars["Map"]["output"];
gitTags?: Maybe<Array<GitTag>>;
id: Scalars["String"]["output"];
ignored: Scalars["Boolean"]["output"];
Expand Down
20 changes: 18 additions & 2 deletions apps/spruce/src/gql/generated/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -885,8 +885,8 @@ export type Image = {
lastDeployed: Scalars["Time"]["output"];
latestTask?: Maybe<Task>;
name: Scalars["String"]["output"];
packages: Array<Package>;
toolchains: Array<Toolchain>;
packages: ImagePackagesPayload;
toolchains: ImageToolchainsPayload;
versionId: Scalars["String"]["output"];
};

Expand Down Expand Up @@ -949,6 +949,20 @@ export type ImageEventsPayload = {
eventLogEntries: Array<ImageEvent>;
};

export type ImagePackagesPayload = {
__typename?: "ImagePackagesPayload";
data: Array<Package>;
filteredCount: Scalars["Int"]["output"];
totalCount: Scalars["Int"]["output"];
};

export type ImageToolchainsPayload = {
__typename?: "ImageToolchainsPayload";
data: Array<Toolchain>;
filteredCount: Scalars["Int"]["output"];
totalCount: Scalars["Int"]["output"];
};

export type InstanceTag = {
__typename?: "InstanceTag";
canBeModified: Scalars["Boolean"]["output"];
Expand Down Expand Up @@ -1576,6 +1590,7 @@ export type Patch = {
createTime?: Maybe<Scalars["Time"]["output"]>;
description: Scalars["String"]["output"];
duration?: Maybe<PatchDuration>;
generatedTaskCounts: Scalars["Map"]["output"];
githash: Scalars["String"]["output"];
hidden: Scalars["Boolean"]["output"];
id: Scalars["ID"]["output"];
Expand Down Expand Up @@ -3237,6 +3252,7 @@ export type Version = {
errors: Array<Scalars["String"]["output"]>;
externalLinksForMetadata: Array<ExternalLinkForMetadata>;
finishTime?: Maybe<Scalars["Time"]["output"]>;
generatedTaskCounts: Scalars["Map"]["output"];
gitTags?: Maybe<Array<GitTag>>;
id: Scalars["String"]["output"];
ignored: Scalars["Boolean"]["output"];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
class="css-1spnncu-Item-wordBreakCss e1ul56zb0 leafygreen-ui-1tb6tuo"
>
<b
class="css-60sdmx-StyledBody ebphozh0"
class="css-qyvtrs-StyledB ebphozh0"
>
Failing Command:
</b>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
class="css-1spnncu-Item-wordBreakCss e1ul56zb0 leafygreen-ui-1tb6tuo"
>
<b
class="css-60sdmx-StyledBody ebphozh0"
class="css-qyvtrs-StyledB ebphozh0"
>
Failing Command:
</b>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
class="css-1spnncu-Item-wordBreakCss e1ul56zb0 leafygreen-ui-1tb6tuo"
>
<b
class="css-60sdmx-StyledBody ebphozh0"
class="css-qyvtrs-StyledB ebphozh0"
>
Failing Command:
</b>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
class="css-1spnncu-Item-wordBreakCss e1ul56zb0 leafygreen-ui-1tb6tuo"
>
<b
class="css-60sdmx-StyledBody ebphozh0"
class="css-qyvtrs-StyledB ebphozh0"
>
Failing Command:
</b>
Expand Down
19 changes: 12 additions & 7 deletions apps/spruce/src/pages/task/metadata/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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 (
<MetadataItem>
{isFailingTask ? (
<StyledB>Failing Command: </StyledB>
) : (
<span>Command: </span>
)}
{shouldTruncate ? (
<>
<StyledBody>Failing Command: </StyledBody>
{truncatedText}{" "}
<ExpandedText
align="right"
Expand Down Expand Up @@ -534,6 +539,6 @@ const OOMTrackerMessage = styled(MetadataItem)`
font-weight: 500;
`;

const StyledBody = styled.b`
const StyledB = styled.b`
color: ${red.base};
`;

0 comments on commit 83b9c64

Please sign in to comment.