Skip to content

Commit

Permalink
Workflow minor cleanups (#4736)
Browse files Browse the repository at this point in the history
  • Loading branch information
mwdchang authored Sep 10, 2024
1 parent 543d359 commit dde5721
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 15 deletions.
12 changes: 3 additions & 9 deletions packages/client/hmi-client/src/services/workflow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
Expand All @@ -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) => ({
Expand Down Expand Up @@ -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;
}
});

Expand Down Expand Up @@ -577,7 +572,6 @@ export const iconToOperatorMap = new Map<string, string>([
[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'],
Expand Down
8 changes: 2 additions & 6 deletions packages/client/hmi-client/src/types/workflow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -111,7 +110,7 @@ export interface WorkflowNode<S> {

// Current operator state
state: S; // Internal state. For example chosen model, display color ... etc
active?: WorkflowOutput<S>['id'] | null;
active: WorkflowOutput<S>['id'] | null;

// I/O
inputs: WorkflowPort[];
Expand Down Expand Up @@ -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<T> {
Expand Down

0 comments on commit dde5721

Please sign in to comment.