|
|
@ -1,6 +1,7 @@ |
|
|
|
<div id="app"> |
|
|
|
<div v-for="message in messages" :class="{'error': !message.success}" class="messages">{{message.message}}</div> |
|
|
|
<p v-show="sending" style="position:absolute;top: 10px; right: 10px;">Parancs küldése, kérem várjon.</p> |
|
|
|
<p><?= date('Y.m.d H:i') ?></p> |
|
|
|
<p v-if="loading">No equipments, please add one.</p> |
|
|
|
<div class="buttons" v-else> |
|
|
|
<div class="button" v-for="item in items"> |
|
|
@ -8,8 +9,8 @@ |
|
|
|
<p>{{item.name}}</p> |
|
|
|
</div> |
|
|
|
<div> |
|
|
|
<a v-on:click="sendsignal(item, item.oncommand)" href="javascript:void(0)" class="addbtn darker"><i class="fa fa-play" aria-hidden="true"></i></a> |
|
|
|
<a v-on:click="sendsignal(item, item.offcommand)" href="javascript:void(0)" class="addbtn darker"><i class="fa fa-stop" aria-hidden="true"></i></a> |
|
|
|
<a v-on:click="sendsignal(item, item.oncommand, 'on')" href="javascript:void(0)" class="addbtn darker"><i class="fa fa-play" aria-hidden="true"></i></a> |
|
|
|
<a v-on:click="sendsignal(item, item.offcommand, 'off')" href="javascript:void(0)" class="addbtn darker"><i class="fa fa-stop" aria-hidden="true"></i></a> |
|
|
|
</div> |
|
|
|
<div v-show="admin"> |
|
|
|
<a v-on:click="delitem(item)" href="javascript:void(0)" class="addbtn darker"><i class="fa fa-trash" aria-hidden="true"></i></a> |
|
|
@ -30,7 +31,7 @@ |
|
|
|
Channel<br> |
|
|
|
<label>UDP<br><input type="radio" name="channel" value="udp" v-model="newitem.channel"></label> |
|
|
|
<label>TELNET<br><input type="radio" name="channel" value="telnet" v-model="newitem.channel"> </label> |
|
|
|
<label>WOL<br><input type="radio" name="channel" value="wol" v-model="newitem.channel"> </label> |
|
|
|
<label>ON/OFF<br><input type="radio" name="channel" value="wol" v-model="newitem.channel"> </label> |
|
|
|
</label> |
|
|
|
</div> |
|
|
|
<label for="name" v-show="newitem.channel != ''"> |
|
|
@ -41,7 +42,7 @@ |
|
|
|
What is the on command?<br> |
|
|
|
<input type="text" name="oncommand" v-model="newitem.oncommand"> <br> |
|
|
|
</label> |
|
|
|
<label for="ontime" v-show="newitem.channel != ''"> |
|
|
|
<label for="ontime" v-show="['udp', 'telnet', 'wol'].indexOf(newitem.channel) >= 0"> |
|
|
|
When to send the on command?<br> |
|
|
|
<input type="time" name="ontime" v-model="newitem.ontime"> <br> |
|
|
|
</label> |
|
|
@ -49,7 +50,7 @@ |
|
|
|
What is the off command?<br> |
|
|
|
<input type="text" name="offcommand" v-model="newitem.offcommand"> <br> |
|
|
|
</label> |
|
|
|
<label for="offtime" v-show="['udp', 'telnet'].indexOf(newitem.channel) >= 0"> |
|
|
|
<label for="offtime" v-show="['udp', 'telnet','shutdown', 'wol'].indexOf(newitem.channel) >= 0"> |
|
|
|
When to send the off command?<br> |
|
|
|
<input type="time" name="offtime" v-model="newitem.offtime"> <br> |
|
|
|
</label> |
|
|
@ -66,12 +67,14 @@ |
|
|
|
<label>sunday<br><input type="checkbox" v-model="newitem.days" value="Sunday"></label> |
|
|
|
</label> |
|
|
|
</div> |
|
|
|
<div v-show="['udp', 'telnet'].indexOf(newitem.channel) >= 0"> |
|
|
|
<div v-show="['udp', 'telnet','shutdown', 'wol'].indexOf(newitem.channel) >= 0"> |
|
|
|
<label for="ip"> |
|
|
|
What ip-s to send the signal to? (Each IP: new line!)<br> |
|
|
|
<small v-show="newitem.channel === 'wol'">Enter <strong>username:password@IP.AD.RESS</strong><br></small> |
|
|
|
<textarea name="ip" v-model="newitem.ip" rows="10"> |
|
|
|
|
|
|
|
</textarea> |
|
|
|
|
|
|
|
</label> |
|
|
|
<label for="port" v-show="newitem.channel != ''"> |
|
|
|
What is the network port?<br> |
|
|
@ -80,7 +83,7 @@ |
|
|
|
</div> |
|
|
|
<div v-show="newitem.channel === 'wol'"> |
|
|
|
<label for="macAdress"> |
|
|
|
What MAC Addresses to send the signal to? (Each MAC Address: new line!)<br> |
|
|
|
What MAC:Add:ress:es to send the signal to? (Each MAC Address: new line!)<br> |
|
|
|
<textarea name="macAdress" v-model="newitem.macAddress" rows="10"> |
|
|
|
|
|
|
|
</textarea> |
|
|
@ -145,13 +148,13 @@ var app = new Vue({ |
|
|
|
add: function() { |
|
|
|
this.adding = !this.adding |
|
|
|
}, |
|
|
|
sendsignal: function(item, action) { |
|
|
|
sendsignal: function(item, action, label) { |
|
|
|
if (this.sending) { return alert('Please wait, the signal is sending')} |
|
|
|
this.sending = true |
|
|
|
console.log(`sending signal ${action} to ${item.name}`) |
|
|
|
|
|
|
|
axios |
|
|
|
.post('sendsignal', {'item': item, 'action': action}).then(response => { |
|
|
|
.post('sendsignal', {'item': item, 'action': action, 'label': label}).then(response => { |
|
|
|
this.messages = response.data |
|
|
|
this.sending = false |
|
|
|
}, error => { |
|
|
@ -168,7 +171,9 @@ var app = new Vue({ |
|
|
|
} |
|
|
|
}, |
|
|
|
showinfo: function(item) { |
|
|
|
alert(this.dump(item,2)) |
|
|
|
this.newitem = item; |
|
|
|
this.adding = true; |
|
|
|
// alert(this.dump(item,2)) |
|
|
|
}, |
|
|
|
dump: function(arr,level) { |
|
|
|
var dumped_text = ""; |
|
|
|