Skip to content

Commit

Permalink
Add SucceededWithErrors for the ApplicationTasksStatus
Browse files Browse the repository at this point in the history
Signed-off-by: Scott J Dickerson <[email protected]>
  • Loading branch information
sjd78 committed Jul 15, 2024
1 parent 461a4e2 commit 0f04a08
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
TimesCircleIcon,
InProgressIcon,
ExclamationCircleIcon,
ExclamationTriangleIcon,
PendingIcon,
} from "@patternfly/react-icons";

Expand Down Expand Up @@ -79,6 +80,15 @@ const statusMap: Record<ApplicationTasksStatus, StatusData> = {
</Icon>
),
},
SuccessWithErrors: {
popoverVariant: "warning",
headerText: "All tasks succeeded, but some errors occurred",
icon: () => (
<Icon status="warning">
<ExclamationTriangleIcon />
</Icon>
),
},
};

const linkToTasks = (applicationName: string) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ export type ApplicationTasksStatus =
| "Queued"
| "Failed"
| "Canceled"
| "Success";
| "Success"
| "SuccessWithErrors";

export interface DecoratedApplication extends Application {
/** reference to the Application being decorated */
Expand All @@ -33,6 +34,7 @@ export interface DecoratedApplication extends Application {
latestHasQueued: boolean;
latestHasRunning: boolean;
latestHasSuccess: boolean;
latestHasSuccessWithErrors: boolean;

/** The most recently created `kind === "analyzer"` task for the application */
currentAnalyzer: Task | undefined;
Expand Down Expand Up @@ -83,6 +85,8 @@ const chooseApplicationTaskStatus = ({
? "Failed"
: tasks.latestHasCanceled
? "Canceled"
: tasks.latestHasSuccessWithErrors
? "SuccessWithErrors"
: "Success";
};

Expand Down Expand Up @@ -125,6 +129,9 @@ const decorateApplications = (
latestHasSuccess: latest.some((task) =>
TaskStates.Success.includes(task.state ?? "")
),
latestHasSuccessWithErrors: latest.some((task) =>
TaskStates.SuccessWithErrors.includes(task.state ?? "")
),

currentAnalyzer: tasksByKind["analyzer"]?.[0],
},
Expand Down
1 change: 1 addition & 0 deletions client/src/app/queries/tasks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export const TaskStates = {
Queued: ["Ready", "Postponed", "Pending", "Running"], // "Created", "QuotaBlocked" ??
Running: ["Running"],
Success: ["Succeeded", "SucceededWithErrors"],
SuccessWithErrors: ["SucceededWithErrors"],
};

export const TasksQueryKey = "tasks";
Expand Down

0 comments on commit 0f04a08

Please sign in to comment.