diff --git a/openc3-cosmos-init/plugins/packages/openc3-vue-common/src/tools/admin/tabs/PackagesTab.vue b/openc3-cosmos-init/plugins/packages/openc3-vue-common/src/tools/admin/tabs/PackagesTab.vue index f2b4916a53..895f2442b2 100644 --- a/openc3-cosmos-init/plugins/packages/openc3-vue-common/src/tools/admin/tabs/PackagesTab.vue +++ b/openc3-cosmos-init/plugins/packages/openc3-vue-common/src/tools/admin/tabs/PackagesTab.vue @@ -13,7 +13,7 @@ # GNU Affero General Public License for more details. # Modified by OpenC3, Inc. -# All changes Copyright 2024, OpenC3, Inc. +# All changes Copyright 2025, OpenC3, Inc. # All Rights Reserved # # This file may also be used under the terms of a commercial license @@ -36,9 +36,6 @@ - {{ - alert - }} { this.processes = response.data if (Object.keys(this.processes).length > 0) { + // process_manager.rb script operates on a 5 second cycle setTimeout(() => { this.updateProcesses() this.update() - }, 10000) + }, 2500) } }, ) @@ -212,42 +207,45 @@ export default { }) Promise.all(promises) .then((responses) => { - this.progress = 100 - this.alert = `Uploaded ${responses.length} package${ - responses.length > 1 ? 's' : '' - }` - this.alertType = 'success' - this.showAlert = true + this.$notify.normal({ + body: `Uploaded ${responses.length} package${ + responses.length > 1 ? 's' : '' + }`, + }) this.loadingPackage = false this.files = [] setTimeout(() => { - this.showAlert = false this.updateProcesses() - }, 5000) - this.update() + }, 2500) }) .catch((error) => { this.loadingPackage = false }) } }, - deletePackage: function (pkg) { + deletePackage(pkg) { this.$dialog .confirm(`Are you sure you want to remove: ${pkg}`, { okText: 'Delete', cancelText: 'Cancel', }) - .then(function (dialog) { + .then((dialog) => { return Api.delete(`/openc3-api/packages/${pkg}`) }) .then((response) => { - this.alert = `Removed package ${pkg}` - this.alertType = 'success' - this.showAlert = true + this.$notify.normal({ + body: `Removed package ${pkg}`, + }) setTimeout(() => { - this.showAlert = false - }, 5000) - this.update() + this.updateProcesses() + }, 2500) + }) + // Error will probably never happen because we spawn the package removal + // and then wait for the response which happens in the background + .catch((error) => { + this.$notify.serious({ + body: `Failed to remove package ${pkg}`, + }) }) }, }, diff --git a/openc3/bin/pipinstall b/openc3/bin/pipinstall index bd91fb22a0..01c6260f9c 100755 --- a/openc3/bin/pipinstall +++ b/openc3/bin/pipinstall @@ -9,6 +9,6 @@ else echo "Command failed - retrying with --no-index" pip3 install --no-index "$@" if [ $? -eq 0 ]; then - echo "ERROR: pip install failed" + echo "ERROR: pip3 install failed" fi fi diff --git a/openc3/bin/pipuninstall b/openc3/bin/pipuninstall new file mode 100644 index 0000000000..512b2671bc --- /dev/null +++ b/openc3/bin/pipuninstall @@ -0,0 +1,10 @@ +#!/bin/sh +python3 -m venv $PYTHONUSERBASE +source $PYTHONUSERBASE/bin/activate +echo "pip3 uninstall $@" +pip3 uninstall "$@" +if [ $? -eq 0 ]; then + echo "Command succeeded" +else + echo "ERROR: pip3 uninstall failed" +fi diff --git a/openc3/lib/openc3/models/python_package_model.rb b/openc3/lib/openc3/models/python_package_model.rb index b7a8448465..a4037f49d0 100644 --- a/openc3/lib/openc3/models/python_package_model.rb +++ b/openc3/lib/openc3/models/python_package_model.rb @@ -104,7 +104,8 @@ def self.install(name_or_path, scope:) def self.destroy(name, scope:) package_name, version = self.extract_name_and_version(name) Logger.info "Uninstalling package: #{name}" - result = OpenC3::ProcessManager.instance.spawn(["pip", "uninstall", package_name, "-y"], "package_uninstall", name, Time.now + 3600.0, scope: scope) + pip_args = ["-y", package_name] + result = OpenC3::ProcessManager.instance.spawn(["/openc3/bin/pipuninstall"] + pip_args, "package_uninstall", name, Time.now + 3600.0, scope: scope) return result.name end