-
Notifications
You must be signed in to change notification settings - Fork 0
/
commands.html
executable file
·56 lines (50 loc) · 1.59 KB
/
commands.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<commands-panel>
<pigod-panel>
<yield to="title">
Commands
</yield>
<yield to="body">
<riot-table stretchcol="command" rows={rows} context={model} defaultsort="name">
<riot-col key="name" header="Name" />
<riot-col key="command" header="Command" />
<riot-col key="exec" header="Exec" cls="text-center"
tpl={'<img src="images/play.png" width="16" height="16" class="button">'}
cellclick={parent.model.execClick}/>
</riot-table>
</yield>
</pigod-panel>
<style scoped>
.column-command {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.column-name {
font-weight: bold;
}
img.button {
cursor: pointer;
}
</style>
<script type="text/es6arrow">
start() {
opts.pubsub.subscribe('commands', this.handler = data => this.updateProc(data));
}
stop() {
opts.pubsub.unsubscribe('commands', this.handler);
}
updateProc(data) {
this.update({
rows: data
});
}
execClick(value, item) {
if (item && item.id) this.execCommand(item.id, item.name);
}
execCommand(id, name) {
if (confirm('Execute ' + name + ' ?')) {
opts.pubsub.publish('execCommand', { id: id });
}
}
</script>
</commands-panel>