Files
P42_UI/app/views/sims/CreateSimView.js
T
2026-06-05 20:27:57 +00:00

35 lines
1.1 KiB
JavaScript

class CreateSimView extends WindozDomContent {
constructor() {
super()
Object.assign(this, app.helpers.activeAttributes, app.helpers.basicDialogs)
}
async DOMContentLoaded(options) {
this.models = options.models
const components = ui.eicfy(this.el)
this.setupTriggers(components)
this.setupRefs(components)
this.models.keyframes.list('', null).then(data => data.payload).then(kflist => {
this.outputs.keyframesSelector.fillOptions(kflist.map(item => {
return({
markup: item.ekf_name,
value: item.ekf_uuid
})
}))
})
}
onCreateSim(comp, event) {
if(!this.outputs.keyframesSelector.value) return
if(!this.outputs.simName.value) return
this.models.sims.create({
kfId: this.outputs.keyframesSelector.value,
simName: this.outputs.simName.value
}).then(data => ui.growl.append('Simulation created!','success',3000))
this.unload()
}
}
app.registerClass('CreateSimView', CreateSimView)