From 3988422f3d94311ad97bdc614fb8ba625213f6f3 Mon Sep 17 00:00:00 2001 From: Ryan Melton Date: Wed, 10 Aug 2022 22:12:11 -0600 Subject: [PATCH 1/2] Scope updates --- .../app/controllers/scopes_controller.rb | 10 +++++ .../src/tools/admin/tabs/PluginsTab.vue | 2 + .../tools/base/components/ScopeSelector.vue | 5 +-- .../src/tools/base/util/scopes.js | 24 ------------ openc3/bin/openc3cli | 4 ++ openc3/lib/openc3/models/scope_model.rb | 37 +++++++++++++++++++ 6 files changed, 54 insertions(+), 28 deletions(-) delete mode 100644 openc3-init/plugins/packages/openc3-tool-common/src/tools/base/util/scopes.js diff --git a/openc3-cmd-tlm-api/app/controllers/scopes_controller.rb b/openc3-cmd-tlm-api/app/controllers/scopes_controller.rb index c245153bd2..f9045baa62 100644 --- a/openc3-cmd-tlm-api/app/controllers/scopes_controller.rb +++ b/openc3-cmd-tlm-api/app/controllers/scopes_controller.rb @@ -23,4 +23,14 @@ class ScopesController < ModelController def initialize @model_class = OpenC3::ScopeModel end + + def destroy + return unless authorization('admin') + begin + result = OpenC3::ProcessManager.instance.spawn(["ruby", "/openc3/bin/openc3cli", "destroyscope", params[:id]], "scope_uninstall", params[:id], Time.now + 2.hours, scope: 'DEFAULT') + render :json => result + rescue Exception => e + render(:json => { :status => 'error', :message => e.message }, :status => 500) and return + end + end end diff --git a/openc3-init/plugins/packages/openc3-tool-common/src/tools/admin/tabs/PluginsTab.vue b/openc3-init/plugins/packages/openc3-tool-common/src/tools/admin/tabs/PluginsTab.vue index 99c8845085..bbf41ec960 100644 --- a/openc3-init/plugins/packages/openc3-tool-common/src/tools/admin/tabs/PluginsTab.vue +++ b/openc3-init/plugins/packages/openc3-tool-common/src/tools/admin/tabs/PluginsTab.vue @@ -255,6 +255,8 @@ export default { 'openc3-tool-tablemanager', 'openc3-tool-tlmgrapher', 'openc3-tool-tlmviewer', + 'openc3-enterprise-tool-base', + 'openc3-enterprise-tool-admin', ], } }, diff --git a/openc3-init/plugins/packages/openc3-tool-common/src/tools/base/components/ScopeSelector.vue b/openc3-init/plugins/packages/openc3-tool-common/src/tools/base/components/ScopeSelector.vue index 6a8671568b..5d25baed34 100644 --- a/openc3-init/plugins/packages/openc3-tool-common/src/tools/base/components/ScopeSelector.vue +++ b/openc3-init/plugins/packages/openc3-tool-common/src/tools/base/components/ScopeSelector.vue @@ -29,13 +29,10 @@