From bd561194d591cc563d89e631b94ac3ad03202ac1 Mon Sep 17 00:00:00 2001 From: Michael Rogers Date: Wed, 31 May 2023 17:17:49 -0500 Subject: [PATCH] Added selection dialog to overlays and implemented for operator status --- src/api/overlays/OverlayAPI.js | 8 ++ src/api/overlays/Selection.js | 38 ++++++++++ .../components/SelectionComponent.vue | 45 +++++++++++ .../operatorStatus/OperatorStatus.vue | 74 ++++++++++++++++++- 4 files changed, 161 insertions(+), 4 deletions(-) create mode 100644 src/api/overlays/Selection.js create mode 100644 src/api/overlays/components/SelectionComponent.vue diff --git a/src/api/overlays/OverlayAPI.js b/src/api/overlays/OverlayAPI.js index 80c6238de2..98be08ec12 100644 --- a/src/api/overlays/OverlayAPI.js +++ b/src/api/overlays/OverlayAPI.js @@ -1,6 +1,7 @@ import Overlay from './Overlay'; import Dialog from './Dialog'; import ProgressDialog from './ProgressDialog'; +import Selection from './Selection'; /** * The OverlayAPI is responsible for pre-pending templates to @@ -132,6 +133,13 @@ class OverlayAPI { return progressDialog; } + selection(options) { + let selection = new Selection(options); + this.showOverlay(selection); + + return selection; + } + } export default OverlayAPI; diff --git a/src/api/overlays/Selection.js b/src/api/overlays/Selection.js new file mode 100644 index 0000000000..e920d00719 --- /dev/null +++ b/src/api/overlays/Selection.js @@ -0,0 +1,38 @@ +import SelectionComponent from './components/SelectionComponent.vue'; +import Overlay from './Overlay'; +import Vue from 'vue'; + +class Selection extends Overlay { + constructor({iconClass, title, message, selectionOptions, onChange, currentSelection, ...options}) { + + let component = new Vue({ + components: { + SelectionComponent: SelectionComponent + }, + provide: { + iconClass, + title, + message, + selectionOptions, + onChange, + currentSelection + }, + template: '' + }).$mount(); + + super({ + element: component.$el, + size: 'fit', + dismissable: false, + onChange, + currentSelection, + ...options + }); + + this.once('destroy', () => { + component.$destroy(); + }); + } +} + +export default Selection; diff --git a/src/api/overlays/components/SelectionComponent.vue b/src/api/overlays/components/SelectionComponent.vue new file mode 100644 index 0000000000..d1790de110 --- /dev/null +++ b/src/api/overlays/components/SelectionComponent.vue @@ -0,0 +1,45 @@ + + + diff --git a/src/plugins/operatorStatus/operatorStatus/OperatorStatus.vue b/src/plugins/operatorStatus/operatorStatus/OperatorStatus.vue index 394ebbcd76..d80c50d3ac 100644 --- a/src/plugins/operatorStatus/operatorStatus/OperatorStatus.vue +++ b/src/plugins/operatorStatus/operatorStatus/OperatorStatus.vue @@ -58,7 +58,7 @@