Schedule script run
This commit is contained in:
parent
fc992b8bdc
commit
6d05152ab2
6 changed files with 162 additions and 7 deletions
|
|
@ -260,7 +260,7 @@ select:focus {
|
|||
}
|
||||
#script-hooks .scripts-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, min-content);
|
||||
grid-template-columns: repeat(4, min-content);
|
||||
align-items: center;
|
||||
grid-gap: 2px 0px;
|
||||
}
|
||||
|
|
@ -276,9 +276,11 @@ select:focus {
|
|||
font-weight: bold;
|
||||
margin-top: 8px;
|
||||
}
|
||||
#script-hooks .scripts-grid .script-unhook img {
|
||||
#script-hooks .scripts-grid .script-unhook img,
|
||||
#script-hooks .scripts-grid .script-run img {
|
||||
display: block;
|
||||
height: 24px;
|
||||
cursor: pointer;
|
||||
}
|
||||
#script-hooks .scripts-grid .script-name,
|
||||
#script-hooks .scripts-grid .script-ssh {
|
||||
|
|
|
|||
|
|
@ -1067,7 +1067,7 @@ class ScriptHooks extends Component {
|
|||
NodeID: _app.currentNode.ID,
|
||||
ScriptID: script.ID,
|
||||
})
|
||||
.then(()=>mbus.dispatch('NODE_HOOKED', _app.currentNode.ID))
|
||||
.then(() => mbus.dispatch('NODE_HOOKED', _app.currentNode.ID))
|
||||
.catch(err => showError(err))
|
||||
}// }}}
|
||||
}
|
||||
|
|
@ -1085,12 +1085,14 @@ class ScriptHook extends Component {
|
|||
<div class="script-name">${this.hook.Script.Name}</div>
|
||||
<div class="script-ssh"></div>
|
||||
<div class="script-unhook"><img src="/images/${_VERSION}/node_modules/@mdi/svg/svg/trash-can.svg" /></div>
|
||||
<div class="script-run"><img src="/images/${_VERSION}/node_modules/@mdi/svg/svg/play-box.svg" /></div>
|
||||
`
|
||||
this.element_ssh = tmpl.content.querySelector('.script-ssh')
|
||||
this.element_ssh.innerText = this.hook.SSH
|
||||
|
||||
tmpl.content.querySelector('.script-ssh').addEventListener('click', () => this.update())
|
||||
tmpl.content.querySelector('.script-unhook').addEventListener('click', () => this.delete())
|
||||
tmpl.content.querySelector('.script-run').addEventListener('click', () => this.run())
|
||||
|
||||
return tmpl.content
|
||||
}// }}}
|
||||
|
|
@ -1138,6 +1140,10 @@ class ScriptHook extends Component {
|
|||
})
|
||||
.catch(err => showError(err))
|
||||
}// }}}
|
||||
run() {// {{{
|
||||
_app.query(`/hooks/schedule/${this.hook.ID}`)
|
||||
.catch(err => showError(err))
|
||||
}// }}}
|
||||
}
|
||||
|
||||
class ScriptsList extends Component {
|
||||
|
|
|
|||
|
|
@ -352,7 +352,7 @@ select:focus {
|
|||
}
|
||||
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, min-content);
|
||||
grid-template-columns: repeat(4, min-content);
|
||||
align-items: center;
|
||||
grid-gap: 2px 0px;
|
||||
|
||||
|
|
@ -366,10 +366,11 @@ select:focus {
|
|||
margin-top: 8px;
|
||||
}
|
||||
|
||||
.script-unhook {
|
||||
.script-unhook, .script-run {
|
||||
img {
|
||||
display: block;
|
||||
height: 24px;
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue