log-contents: Added remove log form.
This commit is contained in:
@@ -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>
|
||||
Reference in New Issue
Block a user