The frontend/UI server, written in JS using the MarkoJS library
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
const moment = require("moment")
const {logsApi} = require("../../../../../rpdata/api/Log")
module.exports = class { onCreate(input) { this.state = { error: null, loading: false, values: { title: "", event: "", description: "", open: false, }, }
this.first = false }
onInput(input) { if (input.log && !this.first) { this.state.values = { title: input.log.title, event: input.log.eventName, description: input.log.description, open: input.log.open, }
this.first = true } }
change(key, ev) { this.state.values[key] = ev.target.value this.state.values = Object.assign({}, this.state.values) }
open() { this.state.loading = false }
close() { this.first = false this.emit("close") }
save() { if (this.state.loading) { return }
const input = Object.assign({id: this.input.log.id}, this.state.values) console.log(input)
this.state.loading = true logsApi.edit(input).then(data => { this.emit("edited", data) this.emit("close") }).catch(errs => { console.warn("Failed to edit:", errs)
this.state.error = "Failed to edit: " + errs[0].message }).then(() => { this.state.loading = false }) } }
|