diff --git a/resource/template/theme-mdui/footer.html b/resource/template/theme-mdui/footer.html new file mode 100644 index 0000000..6ce98eb --- /dev/null +++ b/resource/template/theme-mdui/footer.html @@ -0,0 +1,14 @@ +{{define "theme-mdui/footer"}} + + + +{{end}} diff --git a/resource/template/theme-mdui/home.html b/resource/template/theme-mdui/home.html index 8420eab..d2d29f1 100644 --- a/resource/template/theme-mdui/home.html +++ b/resource/template/theme-mdui/home.html @@ -24,32 +24,7 @@ - -
-
- {{if .IsAdminPage}} - computer主机 - accessibility服务 - access_time任务 - notifications报警 - settings设置 - {{else}} - home首页 - accessibility服务 - {{end}} -
- {{if .Admin}} - {{if .IsAdminPage}} - arrow_back返回前台 - {{else}} - arrow_forward管理后台 - {{end}} - directions_run注销登录 - {{else}} - person登录 - {{end}} -
-
+{{template "theme-mdui/menu" .}}
@@ -64,9 +39,10 @@
@#server.Name#@
-
- info_outline +
+ info_outline
+
Offline
  • @@ -80,7 +56,7 @@
-
  • +
  • straighten
    MEM @#parseInt(server.State?server.State.MemUsed/server.Host.MemTotal*100:0)#@% @@ -150,8 +126,8 @@ @#formatByteSize(server.State.NetOutTransfer)#@ @#formatByteSize(server.State.NetInTransfer)#@ -
    -
    +
    +
    @#server.live?parseInt(server.State.CPU):'NaN'#@%
    @@ -172,16 +148,7 @@
    - +{{template "theme-mdui/footer" .}} @@ -270,6 +237,7 @@ } }); } + var infoTooltip = {}, memTooltip = {}; ws.onmessage = function (evt) { const data = JSON.parse(evt.data) statusCards.servers = data.servers @@ -282,9 +250,30 @@ ns.live = false } else { ns.live = true + if (statusCards.showCard) { + var disk = statusCards.formatByteSize(ns.State.DiskUsed) + '/' + statusCards.formatByteSize(ns.Host.DiskTotal); + var upTime = statusCards.secondToDate(ns.State.Uptime); + var content = +`System: ${ns.Host.Platform}-${ns.Host.PlatformVersion}[${ns.Host.Arch}] +CPU: ${ns.Host.CPU} +Disk: ${disk} +Online: ${upTime} +Version: ${ns.Host.Version}`; + if (infoTooltip[ns.ID]) {infoTooltip[ns.ID].$element[0].innerText = content;} + else { + if (document.getElementById(`info-${ns.ID}`)) infoTooltip[ns.ID] = new mdui.Tooltip(`#info-${ns.ID}`, {}) + } + + var content = `${statusCards.formatByteSize(ns.State.MemUsed)}/${statusCards.formatByteSize(ns.Host.MemTotal)}`; + if (memTooltip[ns.ID]) {memTooltip[ns.ID].$element[0].innerText = content;} + else { + if (document.getElementById(`mem-${ns.ID}`)) memTooltip[ns.ID] = new mdui.Tooltip(`#mem-${ns.ID}`, {}); + } + } else {mdui.$('div').remove('.mdui-tooltip'); infoTooltip = {}; memTooltip = {};} } } } + mdui.mutation(); } ws.onclose = function () { mdui.snackbar({ diff --git a/resource/template/theme-mdui/menu.html b/resource/template/theme-mdui/menu.html new file mode 100644 index 0000000..7d0be88 --- /dev/null +++ b/resource/template/theme-mdui/menu.html @@ -0,0 +1,30 @@ +{{define "theme-mdui/menu"}} + + +
    +
    + {{if .IsAdminPage}} + computer主机 + accessibility服务 + access_time任务 + notifications报警 + settings设置 + {{else}} + home首页 + accessibility服务 + {{end}} +
    + {{if .Admin}} + {{if .IsAdminPage}} + arrow_back返回前台 + {{else}} + arrow_forward管理后台 + {{end}} + directions_run注销登录 + {{else}} + 登录 + {{end}} +
    +
    + +{{end}} diff --git a/resource/template/theme-mdui/service.html b/resource/template/theme-mdui/service.html index 03e66f0..3ace361 100644 --- a/resource/template/theme-mdui/service.html +++ b/resource/template/theme-mdui/service.html @@ -17,32 +17,8 @@ - -
    -
    - {{if .IsAdminPage}} - computer主机 - accessibility服务 - access_time任务 - notifications报警 - settings设置 - {{else}} - home首页 - accessibility服务 - {{end}} -
    - {{if .Admin}} - {{if .IsAdminPage}} - arrow_back返回前台 - {{else}} - arrow_forward管理后台 - {{end}} - directions_run注销登录 - {{else}} - 登录 - {{end}} -
    -
    + +{{template "theme-mdui/menu" .}}
    @@ -84,7 +60,7 @@

    {{statusName (divU64 $service.CurrentUp (addU64 $service.CurrentUp $service.CurrentDown))}}

    {{else if ge $percent 80.0}} - sentiment_dissatisfied + sentiment_dissatisfied

    {{statusName (divU64 $service.CurrentUp (addU64 $service.CurrentUp $service.CurrentDown))}}

    {{else}} sentiment_very_dissatisfied @@ -98,16 +74,7 @@
    - +{{template "theme-mdui/footer" .}} diff --git a/resource/template/theme-mdui/viewpassword.html b/resource/template/theme-mdui/viewpassword.html index f0d71de..3327da7 100644 --- a/resource/template/theme-mdui/viewpassword.html +++ b/resource/template/theme-mdui/viewpassword.html @@ -39,6 +39,7 @@ if (res.redirected) { window.location.href = res.url; } else { + window.location.reload(); mdui.snackbar({ message: '密码错误', position: 'top',