Added automatical hook scheduling

This commit is contained in:
Magnus Åhall 2025-08-11 20:54:36 +02:00
parent e0628bc480
commit 463d2805b3
6 changed files with 124 additions and 28 deletions

View file

@ -1464,6 +1464,7 @@ class ScriptHookDialog extends Component {
this.env = null
this.ssh = null
this.schedule_on_child_update = null
}// }}}
renderComponent() {// {{{
const div = document.createElement('div')
@ -1472,9 +1473,16 @@ class ScriptHookDialog extends Component {
<div class="header"></div>
<img src="/images/${_VERSION}/node_modules/@mdi/svg/svg/trash-can.svg">
</div>
<div class="label">SSH</div>
<div><input type="text" class="ssh" style="width: 100%" /></div>
<div class="label">Schedule automatically</div>
<div>
<input type="checkbox" class="schedule-on-child" id="schedule-on-child" />
<label for="schedule-on-child">on child update</label>
</div>
<div class="label">
Environment
</div>
@ -1499,6 +1507,9 @@ class ScriptHookDialog extends Component {
this.env = div.querySelector('.env')
this.env.value = JSON.stringify(this.hook.Env, null, " ")
this.schedule_on_child_update = div.querySelector('.schedule-on-child')
this.schedule_on_child_update.checked = this.hook.ScheduleOnChildUpdate
const button = div.querySelector('button')
this.env.addEventListener('keydown', event => {
if (event.ctrlKey && event.key == 's') {
@ -1527,6 +1538,7 @@ class ScriptHookDialog extends Component {
try {
this.hook.Env = JSON.parse(this.env.value)
this.hook.SSH = this.ssh.value.trim()
this.hook.ScheduleOnChildUpdate = this.schedule_on_child_update.checked
window._app.query('/hooks/update', this.hook)
.then(() => {
this.callback()
@ -1659,7 +1671,7 @@ class ScriptExecutionValueDialog extends Component {
this.value = null
}// }}}
getValue(execution) {
getValue(execution) {// {{{
switch (this.valueName) {
case 'Source':
return execution.Source
@ -1677,7 +1689,7 @@ class ScriptExecutionValueDialog extends Component {
case 'OutputStderr':
return execution[this.valueName]?.String
}
}
}// }}}
renderComponent() {// {{{
const div = document.createElement('div')
div.innerHTML = `
@ -1710,5 +1722,4 @@ class ScriptExecutionValueDialog extends Component {
}// }}}
}
// vim: foldmethod=marker