log-contents: Added remove log form.

This commit is contained in:
2018-10-01 21:25:05 +02:00
parent fee846a12d
commit 7323d41654
5 changed files with 55 additions and 1 deletions
@@ -0,0 +1,33 @@
const {logsApi} = require("../../../../../rpdata/api/Log")
module.exports = class {
onCreate(input) {
this.state = {
error: null,
loading: false,
}
}
open() {
}
close() {
this.emit("close")
}
doIt() {
this.state.loading = true
logsApi.remove({id: this.input.logId}).then(() => {
this.emit("removed")
this.emit("close")
}).catch(errs => {
console.warn("Failed to remove:", errs)
this.state.error = "Failed to remove: " + errs.message || errs[0].message
}).then(() => {
this.state.loading = false
})
}
}
@@ -0,0 +1,9 @@
<modal class="modal color-text nolabel" key="modal" enabled=(input.enabled) notification closable on-close("close") on-open("open") >
<h1>Remove Log</h1>
<p class="color-error">${state.error}</p>
<p class="color-danger">Removal is final!</p>
<button disabled=state.loading on-click("doIt")>I will destroy you!</button>
</modal>