mirror of
https://github.com/ngoduykhanh/wireguard-ui.git
synced 2025-06-07 00:46:58 +03:00
Wake On Lan Used Time Feature Improvements
This commit is contained in:
parent
cc70b68cf8
commit
154127e631
2 changed files with 13 additions and 3 deletions
|
@ -54,7 +54,10 @@ jQuery(function ($) {
|
||||||
|
|
||||||
jQuery(function ($) {
|
jQuery(function ($) {
|
||||||
$('.btn-outline-success').click(function () {
|
$('.btn-outline-success').click(function () {
|
||||||
$.put('/wake_on_lan_host/' + $(this).data('mac-address'));
|
const $this = $(this);
|
||||||
|
$.put('/wake_on_lan_host/' + $this.data('mac-address'), function (result) {
|
||||||
|
$this.parents('.info-box').find('.latest-used').text(prettyDateTime(result));
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -80,6 +83,13 @@ jQuery(function ($) {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
jQuery(function ($) {
|
||||||
|
$('.latest-used').each(function () {
|
||||||
|
const $this = $(this);
|
||||||
|
$this.text(prettyDateTime($this.text().trim()));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
jQuery(function ($) {
|
jQuery(function ($) {
|
||||||
let $modal_wake_on_lan_host = $("#modal_wake_on_lan_host");
|
let $modal_wake_on_lan_host = $("#modal_wake_on_lan_host");
|
||||||
let $name = $('#frm_wake_on_lan_host_name');
|
let $name = $('#frm_wake_on_lan_host_name');
|
||||||
|
|
|
@ -124,7 +124,7 @@ func WakeOnHost(db store.IStore) echo.HandlerFunc {
|
||||||
macAddress := c.Param("mac_address")
|
macAddress := c.Param("mac_address")
|
||||||
host, err := db.GetWakeOnLanHost(macAddress)
|
host, err := db.GetWakeOnLanHost(macAddress)
|
||||||
|
|
||||||
now := time.Now()
|
now := time.Now().UTC()
|
||||||
host.LatestUsed = &now
|
host.LatestUsed = &now
|
||||||
err = db.SaveWakeOnLanHost(*host)
|
err = db.SaveWakeOnLanHost(*host)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -166,6 +166,6 @@ func WakeOnHost(db store.IStore) echo.HandlerFunc {
|
||||||
return createError(c, err, fmt.Sprintf("Network Send Error: %s", macAddress))
|
return createError(c, err, fmt.Sprintf("Network Send Error: %s", macAddress))
|
||||||
}
|
}
|
||||||
|
|
||||||
return c.JSON(http.StatusOK, nil)
|
return c.JSON(http.StatusOK, host.LatestUsed)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue