From 6383030e96cd39a2d1ca55a7d25549b0d7f61e3a Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Tue, 17 Oct 2023 21:54:18 +0200 Subject: [PATCH] [Extensions UI] Added notifications in case of install errors. --- .../components/panels/Extensions/Install.vue | 35 ++++++++++++++++--- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/platypush/backend/http/webapp/src/components/panels/Extensions/Install.vue b/platypush/backend/http/webapp/src/components/panels/Extensions/Install.vue index 63d8415a8..bc664b618 100644 --- a/platypush/backend/http/webapp/src/components/panels/Extensions/Install.vue +++ b/platypush/backend/http/webapp/src/components/panels/Extensions/Install.vue @@ -70,6 +70,7 @@ export default { installRunning: false, installOutput: null, pendingCommands: 0, + error: null, } }, @@ -105,9 +106,16 @@ export default { ws.onerror = this.onError ws.onclose = this.onClose } catch (err) { - console.error('Websocket initialization error') // TODO notify + this.notify({ + error: true, + title: `Websocket initialization error`, + text: err.toString(), + }) + + console.error('Websocket initialization error') console.error(err) - return + this.error = err + this.installRunning = false } }, @@ -121,14 +129,31 @@ export default { onClose() { this.installRunning = false this.$emit('install-end', this.extension) + if (!this.error) + this.notify({ + title: `Extension installed`, + html: `Extension ${this.extension.name} installed successfully`, + image: { + iconClass: 'fas fa-check', + }, + }) }, onError(error) { - console.error('Websocket error') // TODO notify + this.notify({ + error: true, + title: `Websocket error`, + text: error.toString(), + }) + + console.error('Websocket error') console.error(error) + this.error = error + this.installRunning = false }, installExtension() { + this.error = null this.installRunning = true this.installOutput = '' this.$emit('install-start', this.extension) @@ -140,7 +165,9 @@ export default { }).then((output) => { this.wsProcess(output.ws_path) }).catch((err) => { - console.error(err) // TODO notify + this.error = err + this.installRunning = false + this.$emit('install-end', this.extension) }) }, },