Skip to content
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
6 changes: 3 additions & 3 deletions web_src/.eslint-budget-baseline.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"maxAllowedTotalIssues": 774,
"maxAllowedTotalIssues": 772,
"maxAllowedByRule": {
"complexity": 245,
"@typescript-eslint/no-explicit-any": 173,
"@typescript-eslint/no-explicit-any": 171,
"max-statements": 86,
"max-lines-per-function": 83,
"@typescript-eslint/no-non-null-asserted-optional-chain": 83,
Expand All @@ -12,5 +12,5 @@
"max-depth": 9,
"max-params": 6
},
"updatedAt": "2026-04-07T18:57:58.369Z"
"updatedAt": "2026-04-07T19:28:09.729Z"
}
3 changes: 1 addition & 2 deletions web_src/src/pages/workflowv2/mappers/approval.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import type { CanvasesCanvasNodeExecution } from "@/api-client";
import type {
ComponentBaseContext,
ComponentBaseMapper,
Expand Down Expand Up @@ -95,7 +94,7 @@ export const APPROVAL_STATE_MAP: EventStateMap = {
/**
* Approval-specific state logic function
*/
export const approvalStateFunction: StateFunction = (execution: CanvasesCanvasNodeExecution): EventState => {
export const approvalStateFunction: StateFunction = (execution: ExecutionInfo): EventState => {
if (
execution.resultMessage &&
(execution.resultReason === "RESULT_REASON_ERROR" ||
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import type { CanvasesCanvasNodeExecution } from "@/api-client";
import type React from "react";
import CircleCILogo from "@/assets/icons/integrations/circleci.svg";
import type {
Expand Down Expand Up @@ -47,7 +46,7 @@ export const RUN_PIPELINE_STATE_MAP: EventStateMap = {
},
};

export const runPipelineStateFunction: StateFunction = (execution: CanvasesCanvasNodeExecution): EventState => {
export const runPipelineStateFunction: StateFunction = (execution: ExecutionInfo): EventState => {
if (!execution) return "neutral";

if (
Expand Down
4 changes: 2 additions & 2 deletions web_src/src/pages/workflowv2/mappers/gitlab/run_pipeline.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import type React from "react";
import type { CanvasesCanvasNodeExecution } from "@/api-client";
import type { ComponentBaseProps, ComponentBaseSpec, EventState, EventStateMap } from "@/ui/componentBase";
import { DEFAULT_EVENT_STATE_MAP } from "@/ui/componentBase";
import type {
ComponentBaseContext,
ComponentBaseMapper,
EventStateRegistry,
ExecutionDetailsContext,
ExecutionInfo,
OutputPayload,
StateFunction,
SubtitleContext,
Expand Down Expand Up @@ -54,7 +54,7 @@ export const RUN_PIPELINE_STATE_MAP: EventStateMap = {
},
};

export const runPipelineStateFunction: StateFunction = (execution: CanvasesCanvasNodeExecution): EventState => {
export const runPipelineStateFunction: StateFunction = (execution: ExecutionInfo): EventState => {
if (!execution) return "neutral";

if (
Expand Down
3 changes: 1 addition & 2 deletions web_src/src/pages/workflowv2/mappers/harness/run_pipeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import type { MetadataItem } from "@/ui/metadataList";
import HarnessIcon from "@/assets/icons/integrations/harness.svg";
import { renderTimeAgo } from "@/components/TimeAgo";
import { getTriggerRenderer } from "..";
import type { CanvasesCanvasNodeExecution } from "@/api-client";

export const RUN_PIPELINE_STATE_MAP: EventStateMap = {
...DEFAULT_EVENT_STATE_MAP,
Expand All @@ -47,7 +46,7 @@ export const RUN_PIPELINE_STATE_MAP: EventStateMap = {
},
};

export const runPipelineStateFunction: StateFunction = (execution: CanvasesCanvasNodeExecution): EventState => {
export const runPipelineStateFunction: StateFunction = (execution: ExecutionInfo): EventState => {
if (!execution) return "neutral";

if (
Expand Down
7 changes: 3 additions & 4 deletions web_src/src/pages/workflowv2/mappers/pagerduty/base.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import type { CanvasesCanvasNodeExecution } from "@/api-client";
import type { OutputPayload } from "../types";
import type { ExecutionInfo, OutputPayload } from "../types";
import type { Incident, ResourceRef } from "./types";

/**
* Extracts an incident from execution outputs with proper null checks.
* Returns null if outputs are missing or empty (e.g., when execution failed with an error).
*/
export function getIncidentFromExecution(execution: CanvasesCanvasNodeExecution): Incident | null {
export function getIncidentFromExecution(execution: ExecutionInfo): Incident | null {
const outputs = execution.outputs as { default?: OutputPayload[] } | undefined;

if (!outputs || !outputs.default || outputs.default.length === 0) {
Expand Down Expand Up @@ -69,7 +68,7 @@ export function getDetailsForIncident(incident: Incident | undefined, agent?: Re
* Includes incident details if available, and adds error in the proper format if execution failed.
* This ensures errors are displayed as key/value pairs, not raw text.
*/
export function buildIncidentExecutionDetails(execution: CanvasesCanvasNodeExecution): Record<string, any> {
export function buildIncidentExecutionDetails(execution: ExecutionInfo): Record<string, any> {
const details: Record<string, any> = {};

// Add execution timestamp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import type { MetadataItem } from "@/ui/metadataList";
import { getTriggerRenderer } from "..";
import SemaphoreLogo from "@/assets/semaphore-logo-sign-black.svg";
import { renderTimeAgo } from "@/components/TimeAgo";
import type { CanvasesCanvasNodeExecution } from "@/api-client";
import { formatTimestampInUserTimezone } from "@/lib/timezone";
import { stringOrDash } from "../utils";

Expand Down Expand Up @@ -162,7 +161,7 @@ export const RUN_WORKFLOW_STATE_MAP: EventStateMap = {
/**
* Semaphore-specific state logic function
*/
export const runWorkflowStateFunction: StateFunction = (execution: CanvasesCanvasNodeExecution): EventState => {
export const runWorkflowStateFunction: StateFunction = (execution: ExecutionInfo): EventState => {
if (!execution) return "neutral";

if (
Expand Down
8 changes: 2 additions & 6 deletions web_src/src/pages/workflowv2/mappers/servicenow/base.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import type { EventSection } from "@/ui/componentBase";
import { getState, getTriggerRenderer } from "..";
import type { ExecutionInfo, NodeInfo, OutputPayload } from "../types";
import type { CanvasesCanvasNodeExecution } from "@/api-client";
import { renderTimeAgo } from "@/components/TimeAgo";
import type { IncidentRecord } from "./types";
import { STATE_LABELS, URGENCY_LABELS, IMPACT_LABELS } from "./types";

export function getIncidentFromExecution(execution: CanvasesCanvasNodeExecution): IncidentRecord | null {
export function getIncidentFromExecution(execution: ExecutionInfo): IncidentRecord | null {
const outputs = execution.outputs as { default?: OutputPayload[] } | undefined;
if (!outputs || !outputs.default || outputs.default.length === 0) {
return null;
Expand All @@ -29,10 +28,7 @@ export function baseEventSections(nodes: NodeInfo[], execution: ExecutionInfo, c
];
}

export function buildIncidentExecutionDetails(
execution: CanvasesCanvasNodeExecution,
instanceUrl?: string,
): Record<string, any> {
export function buildIncidentExecutionDetails(execution: ExecutionInfo, instanceUrl?: string): Record<string, any> {
const details: Record<string, any> = {};
if (execution.createdAt) {
details["Executed at"] = new Date(execution.createdAt).toLocaleString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import { getTriggerRenderer } from "..";
import type { MetadataItem } from "@/ui/metadataList";
import slackIcon from "@/assets/icons/integrations/slack.svg";
import { renderTimeAgo } from "@/components/TimeAgo";
import type { CanvasesCanvasNodeExecution } from "@/api-client";

interface WaitForButtonClickConfiguration {
channel?: string;
Expand Down Expand Up @@ -69,7 +68,7 @@ const WAIT_FOR_BUTTON_CLICK_STATE_MAP: EventStateMap = {
};

// State function to determine the state of an execution
const waitForButtonClickStateFunction: StateFunction = (execution: CanvasesCanvasNodeExecution): EventState => {
const waitForButtonClickStateFunction: StateFunction = (execution: ExecutionInfo): EventState => {
if (execution.result === "RESULT_CANCELLED") {
return "cancelled";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import { getTriggerRenderer } from "..";
import type { MetadataItem } from "@/ui/metadataList";
import telegramIcon from "@/assets/icons/integrations/telegram.svg";
import { renderTimeAgo } from "@/components/TimeAgo";
import type { CanvasesCanvasNodeExecution } from "@/api-client";

interface WaitForButtonClickConfiguration {
chatId?: string;
Expand Down Expand Up @@ -67,7 +66,7 @@ const WAIT_FOR_BUTTON_CLICK_STATE_MAP: EventStateMap = {
},
};

const waitForButtonClickStateFunction: StateFunction = (execution: CanvasesCanvasNodeExecution): EventState => {
const waitForButtonClickStateFunction: StateFunction = (execution: ExecutionInfo): EventState => {
if (execution.result === "RESULT_CANCELLED") {
return "cancelled";
}
Expand Down
28 changes: 19 additions & 9 deletions web_src/src/pages/workflowv2/mappers/timegate.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React from "react";
import type { CanvasesCanvasNodeExecution } from "@/api-client";
import type {
ComponentBaseContext,
ComponentBaseMapper,
Expand All @@ -23,6 +22,17 @@ import { getTriggerRenderer, getState, getStateMap } from ".";
import { calcRelativeTimeFromDiff } from "@/lib/utils";
import { renderTimeAgo } from "@/components/TimeAgo";

interface Configuration {
days?: string[];
excludeDates?: string[];
timeRange?: string;
timezone?: string;
}

interface Metadata {
nextValidTime?: string;
}

export const timeGateMapper: ComponentBaseMapper = {
props(context: ComponentBaseContext): ComponentBaseProps {
const componentName = context.componentDefinition.name || "timegate";
Expand Down Expand Up @@ -171,12 +181,12 @@ const daysOfWeekLabels = {
const monthLabels = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];

function getTimeGateSpecs(node: NodeInfo): ComponentBaseSpec[] {
const configuration = node.configuration as Record<string, unknown>;
const days = (configuration?.days as string[]) || [];
const excludeDates = (configuration?.excludeDates as string[]) || [];
const timeRange = (configuration?.timeRange as string) || "00:00-23:59";
const configuration = node.configuration as Configuration;
const days = configuration?.days || [];
const excludeDates = configuration?.excludeDates || [];
const timeRange = configuration?.timeRange || "00:00-23:59";
const timeRangeLabel = formatTimeRangeLabel(timeRange);
const timezoneLabel = getTimezoneDisplay((configuration?.timezone as string) || "0");
const timezoneLabel = getTimezoneDisplay(configuration?.timezone || "0");

const formattedExcludeDates = excludeDates
.map((date) => formatDayInYearLabel(date))
Expand Down Expand Up @@ -250,7 +260,7 @@ function getTimeGateEventSubtitle(execution: ExecutionInfo, componentName: strin
: "";

if (executionState === "waiting") {
const executionMetadata = execution.metadata as { nextValidTime?: string };
const executionMetadata = execution.metadata as Metadata;
if (executionMetadata?.nextValidTime) {
return <TimeGateCountdown nextValidTime={executionMetadata.nextValidTime} timeAgo={timeAgo} />;
}
Expand Down Expand Up @@ -300,12 +310,12 @@ const TimeGateCountdown: React.FC<{ nextValidTime: string; timeAgo?: string | Re
);
};

function isTimeGatePushedThrough(execution: CanvasesCanvasNodeExecution): boolean {
function isTimeGatePushedThrough(execution: ExecutionInfo): boolean {
if (!execution.updatedAt) {
return false;
}

const metadata = execution.metadata as { nextValidTime?: string } | undefined;
const metadata = execution.metadata as Metadata | undefined;
if (!metadata?.nextValidTime) {
return false;
}
Expand Down
4 changes: 2 additions & 2 deletions web_src/src/pages/workflowv2/mappers/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ export type ExecutionInfo = {
result: CanvasNodeExecutionResult;
resultReason: CanvasNodeExecutionResultReason;
resultMessage: string;
metadata: any;
configuration: any;
metadata: unknown;
configuration: unknown;
rootEvent: EventInfo;
outputs?: {
[key: string]: unknown;
Expand Down
Loading