mirror of
https://github.com/netbirdio/plugins.git
synced 2026-05-22 18:44:07 -07:00
fix: delete button, decription field not working; add ui response to clicking the clock
This commit is contained in:
committed by
Franco Fichtner
parent
a77e6ad333
commit
d988835e17
+1
-1
@@ -1,6 +1,6 @@
|
||||
PLUGIN_NAME= wol
|
||||
PLUGIN_VERSION= 2.0.d
|
||||
PLUGIN_REVISION= 1
|
||||
PLUGIN_REVISION= 2
|
||||
PLUGIN_DEPENDS= wol
|
||||
PLUGIN_COMMENT= Wake on LAN Service
|
||||
PLUGIN_MAINTAINER= franco@opnsense.org
|
||||
|
||||
@@ -63,7 +63,7 @@ class WolController extends ApiMutableModelControllerBase
|
||||
}
|
||||
|
||||
public function delHostAction($uuid) {
|
||||
$this->delBase('host', $uuid);
|
||||
$this->delBase('wolentry', $uuid);
|
||||
}
|
||||
public function searchHostAction()
|
||||
{
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<help>Enter a MAC address in the following format: xx:xx:xx:xx:xx:xx</help>
|
||||
</field>
|
||||
<field>
|
||||
<id>host.description</id>
|
||||
<id>host.descr</id>
|
||||
<label>Description</label>
|
||||
<type>text</type>
|
||||
<help>You may enter a description here for your reference (not parsed).</help>
|
||||
|
||||
@@ -1,16 +1,41 @@
|
||||
<script>
|
||||
|
||||
function show_wake_result(data) {
|
||||
BootstrapDialog.show({
|
||||
type: data.status == 'OK' ? BootstrapDialog.TYPE_SUCCESS : BootstrapDialog.TYPE_DANGER,
|
||||
title: "{{ lang._("Result") }}",
|
||||
message: (data.status == 'OK' ?
|
||||
'{{ lang._('Magic packet was sent successfully.') }}' :
|
||||
'{{ lang._('The packet was not sent due to an error. Please consult the logs.') }}<br />' +
|
||||
$('<pre>').text(data.error_msg).html()
|
||||
),
|
||||
buttons: [{
|
||||
label: '{{ lang._('Close') }}',
|
||||
action: function(dialog){
|
||||
dialog.close();
|
||||
}
|
||||
}]
|
||||
});
|
||||
}
|
||||
|
||||
$( document ).ready(function() {
|
||||
// delete host action
|
||||
$("#act_wake_all").click(function(event){
|
||||
event.preventDefault();
|
||||
$.post('/api/wol/wol/wakeall', {}, function(data) {
|
||||
BootstrapDialog.show({
|
||||
type:BootstrapDialog.TYPE_INFO,
|
||||
title: "{{ lang._("Result") }}",
|
||||
message: '<ul>' + (data['results'].map(function(element) {
|
||||
return `<li>${element.mac}: ${element.status}</li>`
|
||||
}).join('')) + '</ul>'
|
||||
})
|
||||
BootstrapDialog.show({
|
||||
type: BootstrapDialog.TYPE_INFO,
|
||||
title: "{{ lang._("Result") }}",
|
||||
message: '<ul>' + (data['results'].map(function(element) {
|
||||
return `<li>${element.mac}: ${element.status}</li>`
|
||||
}).join('')) + '</ul>',
|
||||
buttons: [{
|
||||
label: '{{ lang._('Close') }}',
|
||||
action: function(dialog){
|
||||
dialog.close();
|
||||
}
|
||||
}]
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -39,6 +64,7 @@ $( document ).ready(function() {
|
||||
grid.find('.command-wake').click(function(event) {
|
||||
event.preventDefault();
|
||||
$.post('/api/wol/wol/set', {'uuid': this.dataset['rowId']}, function(data) {
|
||||
show_wake_result(data);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -63,16 +89,7 @@ $( document ).ready(function() {
|
||||
// link save button to API set action
|
||||
$("#wakeAct").click(function(){
|
||||
ajaxCall(url="/api/wol/wol/set", data=getFormData('frm_wol_wake'),callback=function(data, status){
|
||||
BootstrapDialog.show({
|
||||
type: data.status == 'OK' ? BootstrapDialog.TYPE_SUCCESS : BootstrapDialog.TYPE_DANGER,
|
||||
title: "{{ lang._("Result") }}",
|
||||
message: (data.status == 'OK' ?
|
||||
'{{ lang._('Magic packet was sent successfully.') }}' :
|
||||
'{{ lang._('The packet was not sent due to an error. Please consult the logs.') }}<br />' +
|
||||
$('<pre>').text(data.error_msg).html()
|
||||
)
|
||||
});
|
||||
|
||||
show_wake_result(data);
|
||||
}, true);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user