[Extensions UI] Added notifications in case of install errors.

This commit is contained in:
Fabio Manganiello 2023-10-17 21:54:18 +02:00
parent 3107df5eba
commit 6383030e96
Signed by untrusted user: blacklight
GPG key ID: D90FBA7F76362774

View file

@ -70,6 +70,7 @@ export default {
installRunning: false, installRunning: false,
installOutput: null, installOutput: null,
pendingCommands: 0, pendingCommands: 0,
error: null,
} }
}, },
@ -105,9 +106,16 @@ export default {
ws.onerror = this.onError ws.onerror = this.onError
ws.onclose = this.onClose ws.onclose = this.onClose
} catch (err) { } 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) console.error(err)
return this.error = err
this.installRunning = false
} }
}, },
@ -121,14 +129,31 @@ export default {
onClose() { onClose() {
this.installRunning = false this.installRunning = false
this.$emit('install-end', this.extension) this.$emit('install-end', this.extension)
if (!this.error)
this.notify({
title: `Extension installed`,
html: `Extension <b>${this.extension.name}</b> installed successfully`,
image: {
iconClass: 'fas fa-check',
},
})
}, },
onError(error) { 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) console.error(error)
this.error = error
this.installRunning = false
}, },
installExtension() { installExtension() {
this.error = null
this.installRunning = true this.installRunning = true
this.installOutput = '' this.installOutput = ''
this.$emit('install-start', this.extension) this.$emit('install-start', this.extension)
@ -140,7 +165,9 @@ export default {
}).then((output) => { }).then((output) => {
this.wsProcess(output.ws_path) this.wsProcess(output.ws_path)
}).catch((err) => { }).catch((err) => {
console.error(err) // TODO notify this.error = err
this.installRunning = false
this.$emit('install-end', this.extension)
}) })
}, },
}, },