From 193455c675d148d51035cb42c4b998281cb461fc Mon Sep 17 00:00:00 2001 From: nap0o <144927971+nap0o@users.noreply.github.com> Date: Sun, 3 Mar 2024 20:36:17 -0500 Subject: [PATCH] =?UTF-8?q?=E4=B8=BB=E9=A2=98=E5=88=87=E6=8D=A2=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E4=BC=98=E5=8C=96=20(#331)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * angel-kanade模版增加主题切换功能 * Add files via upload * 调整legend图例间距 * 渲染方式调整会canvas * Update home.html * Add files via upload * Add files via upload * Update footer.html * Add files via upload * Add files via upload * 消除echarts折线上无效的0值 * 消除echarts折线的0值,替换为平均值 * 消除echarts折线图上的0值 * 修复MaxTCPPingValue取值错误 --- resource/static/theme-default/js/mixin.js | 7 +++++- .../static/theme-server-status/js/mixin.js | 7 +++++- .../template/theme-angel-kanade/footer.html | 2 +- .../template/theme-angel-kanade/menu.html | 17 +++++++------ resource/template/theme-daynight/network.html | 2 +- resource/template/theme-default/footer.html | 1 + resource/template/theme-default/header.html | 2 +- resource/template/theme-default/home.html | 13 ++++++---- resource/template/theme-default/menu.html | 17 +++++++------ resource/template/theme-default/network.html | 2 +- resource/template/theme-mdui/network.html | 2 +- .../theme-server-status/content-nav.html | 24 ++++++++++--------- .../template/theme-server-status/header.html | 2 +- .../template/theme-server-status/home.html | 13 ++++++---- .../template/theme-server-status/network.html | 2 +- 15 files changed, 69 insertions(+), 44 deletions(-) diff --git a/resource/static/theme-default/js/mixin.js b/resource/static/theme-default/js/mixin.js index 54646c2438..454f4d32d6 100644 --- a/resource/static/theme-default/js/mixin.js +++ b/resource/static/theme-default/js/mixin.js @@ -2,7 +2,12 @@ const mixinsVue = { delimiters: ['@#', '#@'], data: { preferredTemplate: null, - isMobile: false + isMobile: false, + adaptedTemplates: [ + { key: 'default', name: 'Default', icon: 'th large' }, + { key: 'angel-kanade', name: 'AngelKanade', icon: 'square' }, + { key: 'server-status', name: 'SeverStatus', icon: 'list' } + ] }, created() { this.isMobile = this.checkIsMobile(); diff --git a/resource/static/theme-server-status/js/mixin.js b/resource/static/theme-server-status/js/mixin.js index cdf6c42403..c601febda8 100644 --- a/resource/static/theme-server-status/js/mixin.js +++ b/resource/static/theme-server-status/js/mixin.js @@ -6,7 +6,12 @@ const mixinsVue = { showGroup: false, showGoTop: false, preferredTemplate: null, - isMobile: false + isMobile: false, + adaptedTemplates: [ + { key: 'default', name: 'Default', icon: 'th large' }, + { key: 'angel-kanade', name: 'AngelKanade', icon: 'square' }, + { key: 'server-status', name: 'SeverStatus', icon: 'list' } + ] }, created() { this.isMobile = this.checkIsMobile(); diff --git a/resource/template/theme-angel-kanade/footer.html b/resource/template/theme-angel-kanade/footer.html index 2884f19932..76c6e51cb6 100644 --- a/resource/template/theme-angel-kanade/footer.html +++ b/resource/template/theme-angel-kanade/footer.html @@ -14,7 +14,7 @@ - + diff --git a/resource/template/theme-default/header.html b/resource/template/theme-default/header.html index 4baa373370..41b6030919 100644 --- a/resource/template/theme-default/header.html +++ b/resource/template/theme-default/header.html @@ -19,7 +19,7 @@ - +
{{end}} \ No newline at end of file diff --git a/resource/template/theme-default/home.html b/resource/template/theme-default/home.html index 509937ff78..34a4def530 100644 --- a/resource/template/theme-default/home.html +++ b/resource/template/theme-default/home.html @@ -185,7 +185,7 @@ }, renderCharts(id) { if (!this.chartDataList[id - 1]) return; - const MaxTCPPingValue = {{.MaxTCPPingValue}} ? {{.MaxTCPPingValue}} : 300; + const MaxTCPPingValue = {{.Conf.MaxTCPPingValue}} ? {{.Conf.MaxTCPPingValue}} : 300; const isMobile = this.checkIsMobile(); const fontSize = isMobile ? 10 : 9; const itemGap = isMobile ? 6 : 6; @@ -207,11 +207,13 @@ const xAxisData = chartData[0].created_at.map(time => new Date(time).toLocaleString()); const seriesData = chartData.map(item => { let loss = 0; - const data = item.avg_delay.map((avgDelay, index) => { - if (avgDelay > 0.9 * MaxTCPPingValue) { + const data = item.avg_delay.map((avgDelay, index) => { + if(avgDelay > 0 && avgDelay < MaxTCPPingValue){ + loss += avgDelay > 0.9 * MaxTCPPingValue ? 1 : 0; + return [item.created_at[index], avgDelay]; + }else{ loss += 1; } - return [item.created_at[index], avgDelay]; }); const lossRate = ((loss / item.created_at.length) * 100).toFixed(1); item.monitor_name = item.monitor_name.includes("%") ? item.monitor_name : `${item.monitor_name} ${lossRate}%`; @@ -220,7 +222,8 @@ type: 'line', smooth: true, symbol: 'none', - data: data + data: data, + connectNulls: true }; }); const option = { diff --git a/resource/template/theme-default/menu.html b/resource/template/theme-default/menu.html index 9c4d5cd93a..cd0d16b093 100644 --- a/resource/template/theme-default/menu.html +++ b/resource/template/theme-default/menu.html @@ -19,14 +19,17 @@ {{tr "Services" }} {{tr "NetworkSpiter"}} -