From dde5721aff6f3a54346d5cd708448890072b9b88 Mon Sep 17 00:00:00 2001 From: Daniel Chang Date: Tue, 10 Sep 2024 13:38:54 -0400 Subject: [PATCH] Workflow minor cleanups (#4736) --- packages/client/hmi-client/src/services/workflow.ts | 12 +++--------- packages/client/hmi-client/src/types/workflow.ts | 8 ++------ 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/packages/client/hmi-client/src/services/workflow.ts b/packages/client/hmi-client/src/services/workflow.ts index 6b348a98b1..549e874e5a 100644 --- a/packages/client/hmi-client/src/services/workflow.ts +++ b/packages/client/hmi-client/src/services/workflow.ts @@ -84,7 +84,6 @@ export class WorkflowWrapper { if (!_.isEqual(nodes[i].state, updated.state)) { nodes[i].state = updated.state; } - // nodes[i] = Object.assign(nodes[i], updated); } updatedNodeMap.delete(nodeId); } @@ -138,9 +137,6 @@ export class WorkflowWrapper { if (node) { node.isDeleted = true; } - - // TODO: option Remove the node - // wf.nodes = wf.nodes.filter((node) => node.id !== id); } removeEdge(id: string) { @@ -169,9 +165,6 @@ export class WorkflowWrapper { edge.isDeleted = true; } - // TODO: option Edge re-assignment - // wf.edges = wf.edges.filter((edge) => edge.id !== id); - // If there are no more references reset the connected status of the source node if (_.isEmpty(this.getEdges().filter((e) => e.source === edgeToRemove.source))) { const sourceNode = this.wf.nodes.find((d) => d.id === edgeToRemove.source); @@ -194,6 +187,8 @@ export class WorkflowWrapper { imageUrl: op.imageUrl, x: pos.x, y: pos.y, + + active: null, state: options.state ?? {}, inputs: op.inputs.map((port) => ({ @@ -409,7 +404,7 @@ export class WorkflowWrapper { port.id = registry.get(port.id) as string; }); if (node.active) { - node.active = registry.get(node.active); + node.active = registry.get(node.active) || null; } }); @@ -577,7 +572,6 @@ export const iconToOperatorMap = new Map([ [WorkflowOperationTypes.CALIBRATE_ENSEMBLE_CIEMSS, 'pi pi-chart-line'], [WorkflowOperationTypes.DATASET_TRANSFORMER, 'pi pi-table'], [WorkflowOperationTypes.SUBSET_DATA, 'pi pi-table'], - [WorkflowOperationTypes.MODEL_TRANSFORMER, 'pi pi-share-alt'], [WorkflowOperationTypes.FUNMAN, 'pi pi-cog'], [WorkflowOperationTypes.CODE, 'pi pi-code'], [WorkflowOperationTypes.MODEL_COMPARISON, 'pi pi-share-alt'], diff --git a/packages/client/hmi-client/src/types/workflow.ts b/packages/client/hmi-client/src/types/workflow.ts index 76ec34e08d..059a282890 100644 --- a/packages/client/hmi-client/src/types/workflow.ts +++ b/packages/client/hmi-client/src/types/workflow.ts @@ -10,7 +10,6 @@ export const WorkflowOperationTypes = Object.freeze({ CALIBRATE_ENSEMBLE_CIEMSS: 'CalibrateEnsembleCiemms', DATASET_TRANSFORMER: 'DatasetTransformer', SUBSET_DATA: 'SubsetData', - MODEL_TRANSFORMER: 'ModelTransformer', FUNMAN: 'Funman', CODE: 'Code', MODEL_COMPARISON: 'ModelComparison', @@ -111,7 +110,7 @@ export interface WorkflowNode { // Current operator state state: S; // Internal state. For example chosen model, display color ... etc - active?: WorkflowOutput['id'] | null; + active: WorkflowOutput['id'] | null; // I/O inputs: WorkflowPort[]; @@ -166,10 +165,7 @@ export interface Size { } export interface WorkflowTransformations { - workflows: Transformations; -} -export interface Transformations { - [key: string]: Transform; + workflows: { [key: string]: Transform }; } export interface AssetBlock {