From ec82cde8e4dc193f7c98c036e598152aad86fcfc Mon Sep 17 00:00:00 2001 From: asylves1 Date: Fri, 20 Sep 2024 13:36:06 -0400 Subject: [PATCH 1/5] UX changes to create intervention policy --- .../intervention-policy-operation.ts | 5 ++- .../tera-intervention-card.vue | 19 ++++++++-- .../tera-intervention-policy-drilldown.vue | 37 ++++++++++++++++++- 3 files changed, 55 insertions(+), 6 deletions(-) diff --git a/packages/client/hmi-client/src/components/workflow/ops/intervention-policy/intervention-policy-operation.ts b/packages/client/hmi-client/src/components/workflow/ops/intervention-policy/intervention-policy-operation.ts index 038f4b9f9e..6a48a1c576 100644 --- a/packages/client/hmi-client/src/components/workflow/ops/intervention-policy/intervention-policy-operation.ts +++ b/packages/client/hmi-client/src/components/workflow/ops/intervention-policy/intervention-policy-operation.ts @@ -12,7 +12,10 @@ export const InterventionPolicyOperation: Operation = { description: 'Create intervention policy', displayName: 'Create intervention policy', isRunnable: true, - inputs: [{ type: 'modelId', label: 'Model' }], + inputs: [ + { type: 'modelId', label: 'Model' }, + { type: 'documentId', label: 'Document', isOptional: true } + ], outputs: [{ type: 'policyInterventionId', label: 'Intervention Policy' }], action: () => {}, diff --git a/packages/client/hmi-client/src/components/workflow/ops/intervention-policy/tera-intervention-card.vue b/packages/client/hmi-client/src/components/workflow/ops/intervention-policy/tera-intervention-card.vue index e91609d077..bc8d5bbaf8 100644 --- a/packages/client/hmi-client/src/components/workflow/ops/intervention-policy/tera-intervention-card.vue +++ b/packages/client/hmi-client/src/components/workflow/ops/intervention-policy/tera-intervention-card.vue @@ -118,7 +118,7 @@ @update:model-value="(val) => onUpdateThreshold(val, 0)" placeholder="threshold" /> - . + {{ dynamicInterventionUnits }}. @@ -149,8 +149,8 @@ import Divider from 'primevue/divider'; const emit = defineEmits(['update', 'delete', 'add']); const props = defineProps<{ intervention: Intervention; - parameterOptions: { label: string; value: string }[]; - stateOptions: { label: string; value: string }[]; + parameterOptions: { label: string; value: string; units?: string }[]; + stateOptions: { label: string; value: string; units?: string }[]; }>(); const interventionSemanticOptions = [ @@ -175,6 +175,19 @@ const interventionType = computed(() => { return 'static'; }); +const dynamicInterventionUnits = computed(() => { + let units = ''; + const type = props.intervention.type; + const appliedTo = props.intervention.appliedTo; + + if (type === InterventionSemanticType.Parameter) { + units = props.parameterOptions.find((parameter) => parameter.label === appliedTo)?.units ?? ''; + } else { + units = props.stateOptions.find((state) => state.label === appliedTo)?.units ?? ''; + } + return units; +}); + const comparisonOperations = [ { label: 'increases to above', value: true }, { label: 'decreases to below', value: false } diff --git a/packages/client/hmi-client/src/components/workflow/ops/intervention-policy/tera-intervention-policy-drilldown.vue b/packages/client/hmi-client/src/components/workflow/ops/intervention-policy/tera-intervention-policy-drilldown.vue index c646a4ea1c..2c3b0f67b0 100644 --- a/packages/client/hmi-client/src/components/workflow/ops/intervention-policy/tera-intervention-policy-drilldown.vue +++ b/packages/client/hmi-client/src/components/workflow/ops/intervention-policy/tera-intervention-policy-drilldown.vue @@ -15,6 +15,16 @@ >