mirror of
https://github.com/nezhahq/nezha.git
synced 2025-02-08 12:38:13 -05:00
ServerStatus主题优化 (#386)
* ServerStatus主题优化 1.更新世界地图基础geo文件,中国部分包含南海10段线,藏南部分划线更准 geo在大佬仓库https://github.com/Surbowl/world-geo-json-zh的基础上加工 2.世界地图可以在后台设置自定义代码切换是否包含南极洲,中国港澳台是否单独统计vps数 ```<script> localStorage.setItem('countryMapGeoFile', 'nezha.world.geo.json'); //默认 // localStorage.setItem('countryMapGeoFile', 'nezha.world.plus.geo.json'); //单独绘制香港,澳门,台湾 // localStorage.setItem('countryMapGeoFile', 'nezha.world.antarctica.geo.json'); //有南极洲 // localStorage.setItem('countryMapGeoFile', 'nezha.world.plus.antarctica.geo.json'); //有南极洲,单独绘制香港,澳门,台湾 </script> ``` 3. mixin.js文件删除冗余代码 4. 首页agent下拉详情,控制网络折线图tooltip数字最多显示小数点后两位 * 修正geo文件路径 * 修复世界地图中国港澳台单独绘制时,vps数量计算逻辑 * 删除header中的无用的地图基础数据引用 * 增加温度控制cpu型号识别
This commit is contained in:
parent
4df60c6955
commit
f4c6f4c57d
83
resource/static/theme-server-status/js/mixin.js
vendored
83
resource/static/theme-server-status/js/mixin.js
vendored
@ -7,6 +7,7 @@ const mixinsVue = {
|
|||||||
showGoTop: false,
|
showGoTop: false,
|
||||||
preferredTemplate: null,
|
preferredTemplate: null,
|
||||||
isMobile: false,
|
isMobile: false,
|
||||||
|
staticUrl: '/static/theme-server-status',
|
||||||
adaptedTemplates: [
|
adaptedTemplates: [
|
||||||
{ key: 'default', name: 'Default', icon: 'th large' },
|
{ key: 'default', name: 'Default', icon: 'th large' },
|
||||||
{ key: 'angel-kanade', name: 'AngelKanade', icon: 'square' },
|
{ key: 'angel-kanade', name: 'AngelKanade', icon: 'square' },
|
||||||
@ -15,8 +16,8 @@ const mixinsVue = {
|
|||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.isMobile = this.checkIsMobile();
|
this.isMobile = this.checkIsMobile();
|
||||||
this.initTheme();
|
this.theme = this.initTheme();
|
||||||
this.storedShowGroup();
|
this.showGroup = this.initShowGroup();
|
||||||
this.preferredTemplate = this.getCookie('preferred_theme') ? this.getCookie('preferred_theme') : this.$root.defaultTemplate;
|
this.preferredTemplate = this.getCookie('preferred_theme') ? this.getCookie('preferred_theme') : this.$root.defaultTemplate;
|
||||||
window.addEventListener('scroll', this.handleScroll);
|
window.addEventListener('scroll', this.handleScroll);
|
||||||
},
|
},
|
||||||
@ -24,25 +25,36 @@ const mixinsVue = {
|
|||||||
window.removeEventListener('scroll', this.handleScroll);
|
window.removeEventListener('scroll', this.handleScroll);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
toggleView() {
|
initTheme() {
|
||||||
this.showGroup = !this.showGroup;
|
const storedTheme = localStorage.getItem("theme");
|
||||||
localStorage.setItem("showGroup", JSON.stringify(this.showGroup));
|
const theme = (storedTheme === 'dark' || storedTheme === 'light') ? storedTheme : (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light');
|
||||||
if(this.$root.page == 'service') {
|
this.setTheme(theme);
|
||||||
this.$root.initTooltip();
|
return theme;
|
||||||
|
},
|
||||||
|
setTheme(theme) {
|
||||||
|
document.body.setAttribute("theme", theme);
|
||||||
|
this.theme = theme;
|
||||||
|
localStorage.setItem("theme", theme);
|
||||||
|
// 重新赋值全局调色
|
||||||
|
this.colors = this.theme == "dark" ? this.colorsDark : this.colorsLight;
|
||||||
|
|
||||||
|
if(this.$root.page == 'index') {
|
||||||
|
this.reloadCharts(); // 重新载入echarts图表
|
||||||
}
|
}
|
||||||
return this.showGroup;
|
|
||||||
},
|
},
|
||||||
storedShowGroup() {
|
initShowGroup() {
|
||||||
const storedShowGroup = localStorage.getItem("showGroup");
|
const storedShowGroup = localStorage.getItem("showGroup");
|
||||||
if (storedShowGroup !== null) {
|
const showGroup = storedShowGroup !== null ? JSON.parse(storedShowGroup) : false;
|
||||||
this.showGroup = JSON.parse(storedShowGroup);
|
if (storedShowGroup === null) {
|
||||||
}
|
localStorage.setItem("showGroup", showGroup);
|
||||||
|
}
|
||||||
|
return showGroup;
|
||||||
},
|
},
|
||||||
toggleTemplate(template) {
|
toggleShowGroup() {
|
||||||
if( template != this.preferredTemplate){
|
this.showGroup = !this.showGroup;
|
||||||
this.preferredTemplate = template;
|
localStorage.setItem("showGroup", this.showGroup);
|
||||||
this.updateCookie("preferred_theme", template);
|
if (this.$root.page == 'service') {
|
||||||
window.location.reload();
|
this.$root.initTooltip();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
updateCookie(name, value) {
|
updateCookie(name, value) {
|
||||||
@ -60,43 +72,6 @@ const mixinsVue = {
|
|||||||
}
|
}
|
||||||
return cookieValue;
|
return cookieValue;
|
||||||
},
|
},
|
||||||
setTheme(title, store = false) {
|
|
||||||
this.theme = title;
|
|
||||||
document.body.setAttribute("theme", title);
|
|
||||||
if (store) {
|
|
||||||
localStorage.setItem("theme", title);
|
|
||||||
this.isSystemTheme = false;
|
|
||||||
if(this.$root.page == 'index') {
|
|
||||||
this.$root.reloadCharts(); //重新载入echarts图表
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
setSystemTheme() {
|
|
||||||
localStorage.removeItem("theme");
|
|
||||||
this.initTheme();
|
|
||||||
this.isSystemTheme = true;
|
|
||||||
},
|
|
||||||
initTheme() {
|
|
||||||
const storeTheme = localStorage.getItem("theme");
|
|
||||||
if (storeTheme === 'dark' || storeTheme === 'light') {
|
|
||||||
this.setTheme(storeTheme, true);
|
|
||||||
} else {
|
|
||||||
this.isSystemTheme = true
|
|
||||||
const handleChange = (mediaQueryListEvent) => {
|
|
||||||
if (localStorage.getItem("theme")) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (mediaQueryListEvent.matches) {
|
|
||||||
this.setTheme('dark');
|
|
||||||
} else {
|
|
||||||
this.setTheme('light');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const mediaQueryListDark = window.matchMedia('(prefers-color-scheme: dark)');
|
|
||||||
this.setTheme(mediaQueryListDark.matches ? 'dark' : 'light');
|
|
||||||
mediaQueryListDark.addEventListener("change", handleChange);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
toFixed2(f) {
|
toFixed2(f) {
|
||||||
return f.toFixed(2)
|
return f.toFixed(2)
|
||||||
},
|
},
|
||||||
|
1277
resource/static/theme-server-status/maps/nezha.countrymap.json
vendored
Executable file
1277
resource/static/theme-server-status/maps/nezha.countrymap.json
vendored
Executable file
File diff suppressed because it is too large
Load Diff
243
resource/static/theme-server-status/maps/nezha.world.antarctica.geo.json
vendored
Executable file
243
resource/static/theme-server-status/maps/nezha.world.antarctica.geo.json
vendored
Executable file
File diff suppressed because one or more lines are too long
242
resource/static/theme-server-status/maps/nezha.world.geo.json
vendored
Executable file
242
resource/static/theme-server-status/maps/nezha.world.geo.json
vendored
Executable file
File diff suppressed because one or more lines are too long
245
resource/static/theme-server-status/maps/nezha.world.plus.antarctica.geo.json
vendored
Executable file
245
resource/static/theme-server-status/maps/nezha.world.plus.antarctica.geo.json
vendored
Executable file
File diff suppressed because one or more lines are too long
244
resource/static/theme-server-status/maps/nezha.world.plus.geo.json
vendored
Executable file
244
resource/static/theme-server-status/maps/nezha.world.plus.geo.json
vendored
Executable file
File diff suppressed because one or more lines are too long
1
resource/template/theme-default/home.html
vendored
1
resource/template/theme-default/home.html
vendored
@ -180,6 +180,7 @@
|
|||||||
'TC0H', //CPU Heatsink 温度,代表 CPU 散热器的温度
|
'TC0H', //CPU Heatsink 温度,代表 CPU 散热器的温度
|
||||||
'TC0P', //CPU Proximity 温度,代表 CPU 附近的温度
|
'TC0P', //CPU Proximity 温度,代表 CPU 附近的温度
|
||||||
'k10temp', //AMD K10(Phenom、Athlon、Sempron 等)系列处理器的温度监测
|
'k10temp', //AMD K10(Phenom、Athlon、Sempron 等)系列处理器的温度监测
|
||||||
|
'k10temp_tctl', //AMD K10 (Athlon II、Phenom II 等)系列处理器的温度监测
|
||||||
'coretemp_package_id_0', //整个封装处理器温度
|
'coretemp_package_id_0', //整个封装处理器温度
|
||||||
'cpu_thermal_zone', //全志
|
'cpu_thermal_zone', //全志
|
||||||
'cpu-thermal', //树莓派(博通)
|
'cpu-thermal', //树莓派(博通)
|
||||||
|
@ -9,12 +9,12 @@
|
|||||||
<i @click="showMapChart" data-toggle="modal" data-target="#mapChartBox" class="bi bi-geo-alt"></i>
|
<i @click="showMapChart" data-toggle="modal" data-target="#mapChartBox" class="bi bi-geo-alt"></i>
|
||||||
</span>
|
</span>
|
||||||
<span class="toggleView">
|
<span class="toggleView">
|
||||||
<i v-if="showGroup" @click="toggleView" class="show-nogroup bi bi-justify"></i>
|
<i v-if="showGroup" @click="toggleShowGroup" class="show-nogroup bi bi-justify"></i>
|
||||||
<i v-else @click="toggleView" class="show-group bi bi-view-stacked"></i>
|
<i v-else @click="toggleShowGroup" class="show-group bi bi-view-stacked"></i>
|
||||||
</span>
|
</span>
|
||||||
<span class="setTheme">
|
<span class="setTheme">
|
||||||
<i v-if="theme === 'light'" @click="setTheme('dark', true)" class="setTheme-dark bi bi-moon-fill"></i>
|
<i v-if="theme === 'light'" @click="setTheme('dark')" class="setTheme-dark bi bi-moon-fill"></i>
|
||||||
<i v-else @click="setTheme('light', true)" class="setTheme-light bi bi-brightness-high-fill"></i>
|
<i v-else @click="setTheme('light')" class="setTheme-light bi bi-brightness-high-fill"></i>
|
||||||
</span>
|
</span>
|
||||||
<span v-if="showGoTop" class="showGoTop">
|
<span v-if="showGoTop" class="showGoTop">
|
||||||
<i @click="goTop" class="goTop bi bi-arrow-up"></i>
|
<i @click="goTop" class="goTop bi bi-arrow-up"></i>
|
||||||
|
@ -20,8 +20,7 @@
|
|||||||
<script src="https://unpkg.com/bootstrap@3.4.1/dist/js/bootstrap.min.js"></script>
|
<script src="https://unpkg.com/bootstrap@3.4.1/dist/js/bootstrap.min.js"></script>
|
||||||
<script src="https://unpkg.com/vue@2.6.14/dist/vue.min.js"></script>
|
<script src="https://unpkg.com/vue@2.6.14/dist/vue.min.js"></script>
|
||||||
<script src="https://unpkg.com/echarts@5.5.0/dist/echarts.min.js"></script>
|
<script src="https://unpkg.com/echarts@5.5.0/dist/echarts.min.js"></script>
|
||||||
<script src="https://unpkg.com/echarts@4.9.0/map/js/world.js"></script>
|
<script src="/static/theme-server-status/js/mixin.js?v20240707"></script>
|
||||||
<script src="/static/theme-server-status/js/mixin.js?v20240630"></script>
|
|
||||||
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
|
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
|
||||||
<!--[if lt IE 9]>
|
<!--[if lt IE 9]>
|
||||||
<script src="/static/theme-server-status/js/html5shiv.js"></script>
|
<script src="/static/theme-server-status/js/html5shiv.js"></script>
|
||||||
|
129
resource/template/theme-server-status/home.html
vendored
129
resource/template/theme-server-status/home.html
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user