Skip to content

Commit 60ada33

Browse files
authored
feat: status-server主题增加agent账单信息展示 (#424)
1. 首页通过在后台配置PublicNote字段,实现agent账单信息展示 2. 优化顶部导航,增加当前位置标识 3. 优化network页移动端样式 4. 优化后台server页展示,隐藏掉一些不重要的信息 5. 一些其他小优化 使用说明:#424 (comment)
1 parent 7940e01 commit 60ada33

File tree

14 files changed

+517
-34
lines changed

14 files changed

+517
-34
lines changed

resource/l10n/en-US.toml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -690,3 +690,18 @@ other = "Cancel"
690690

691691
[FMError]
692692
other = "Agent returned an error, please view the console for details. To open a new connection, reopen the FM again."
693+
694+
[Remaining]
695+
other = "Remaining"
696+
697+
[Lifetime]
698+
other = "Lifetime"
699+
700+
[Price]
701+
other = "Price"
702+
703+
[Expired]
704+
other = "Expired"
705+
706+
[Days]
707+
other = "d"

resource/l10n/es-ES.toml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -690,3 +690,18 @@ other = "Cancelar"
690690

691691
[FMError]
692692
other = "Agent devolvió un error, consulte la consola para obtener más detalles. Para abrir una nueva conexión, vuelva a abrir el FM."
693+
694+
[Remaining]
695+
other = "Remaining"
696+
697+
[Lifetime]
698+
other = "Lifetime"
699+
700+
[Price]
701+
other = "Price"
702+
703+
[Expired]
704+
other = "Expired"
705+
706+
[Days]
707+
other = "d"

resource/l10n/zh-CN.toml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -690,3 +690,18 @@ other = "取消"
690690

691691
[FMError]
692692
other = "Agent 返回了错误,请查看控制台获取详细信息。要建立新连接,请重新打开 FM。"
693+
694+
[Remaining]
695+
other = "剩余"
696+
697+
[Lifetime]
698+
other = "永续"
699+
700+
[Price]
701+
other = "价格"
702+
703+
[Expired]
704+
other = "已到期"
705+
706+
[Days]
707+
other = ""

resource/l10n/zh-TW.toml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -690,3 +690,18 @@ other = "取消"
690690

691691
[FMError]
692692
other = "Agent 回傳了錯誤,請查看主控台獲取詳細資訊。要建立新連線,請重新開啟 FM。"
693+
694+
[Remaining]
695+
other = "剩餘"
696+
697+
[Lifetime]
698+
other = "永續"
699+
700+
[Price]
701+
other = "價格"
702+
703+
[Expired]
704+
other = "已到期"
705+
706+
[Days]
707+
other = ""

resource/static/theme-server-status/css/dark.css

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ body[theme="dark"] .navbar .navbar-brand {
88
color: #ffffff;
99
}
1010

11+
body[theme="dark"] .navbar .navbar-nav li.pc-active a,
12+
body[theme="dark"] .navbar .navbar-nav li.m-active a{
13+
color: rgba(73, 146, 255, 1);
14+
}
15+
1116
body[theme="dark"] .navbar .dropdown-menu {
1217
background-color: rgba(23, 26, 30, 1);
1318
border-color: rgba(49, 54, 59, 1);
@@ -88,8 +93,8 @@ body[theme="dark"] .table > tbody > tr.expandRow.even > td:before{
8893
/* expandRow展开部分样式结束 */
8994

9095
body[theme="dark"] .progress {
91-
background-image: linear-gradient(#2c2c2c 0,rgba(28, 29, 38, 1) 100%);
92-
background-color: rgba(28, 29, 38, 1);
96+
background-image: none;
97+
background-color: rgba(255, 255, 255, 0.075);
9398
}
9499

95100
body[theme="dark"] .progress-bar {
@@ -174,5 +179,5 @@ body[theme="dark"] .toolbox i{
174179
}
175180

176181
body[theme="dark"] .network-box .network-box-header{
177-
border-bottom: 1px solid rgba(110, 112, 121, 0.25);
182+
border-bottom-color: rgba(110, 112, 121, 0.25);
178183
}

resource/static/theme-server-status/css/light.css

Lines changed: 7 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

resource/static/theme-server-status/css/main.css

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,8 +237,8 @@ tr.accordion-toggle{
237237
}
238238

239239
.node-cell.network {
240-
min-width: 100px;
241-
max-width: 100px;
240+
min-width: 110px;
241+
max-width: 110px;
242242
}
243243

244244
.node-cell.traffic {
@@ -250,6 +250,24 @@ tr.accordion-toggle{
250250
max-width: 50px;
251251
}
252252

253+
.node-cell.remaining {
254+
min-width: 65px;
255+
max-width: 65px;
256+
}
257+
258+
.node-cell.remaining .additional {
259+
position: absolute;
260+
left: 0;
261+
font-size: 12px;
262+
text-align: center;
263+
width: 100%;
264+
}
265+
266+
.node-cell.remaining .additional small{
267+
white-space: nowrap;
268+
font-size: 80%;
269+
}
270+
253271
.temp-detail {
254272
cursor: pointer;
255273
}
@@ -331,6 +349,8 @@ td.ping-network-quality {
331349
padding: 5px 0px 15px 5px;
332350
cursor: pointer;
333351
width: 100%;
352+
border-bottom-width: 1px;
353+
border-bottom-style: solid;
334354
}
335355

336356
.network-box .network-box-header .dropdown-menu {
@@ -529,6 +549,10 @@ footer p{
529549
display: none;
530550
visibility: hidden;
531551
}
552+
.node-cell.remaining {
553+
min-width: 75px;
554+
max-width: 75px;
555+
}
532556
.accordian-body{
533557
margin: 5px 0px 5px 10px;
534558
}
@@ -572,6 +596,7 @@ footer p{
572596
.network-box .network-box-header {
573597
margin: 8px 0px 0px 8px;
574598
font-size: 16px;
599+
border-bottom: none;
575600
}
576601
.network-box .chartTitle {
577602
font-size: 16px;

resource/static/theme-server-status/js/mixin.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,11 @@ const mixinsVue = {
155155
checkIsMobile() { // 检测设备类型,页面宽度小于768px认为是移动设备
156156
return window.innerWidth <= 768;
157157
},
158+
isMenuActive(page){
159+
if(page == this.$root.page) {
160+
return this.isMobile ? 'm-active' : 'pc-active';
161+
}
162+
},
158163
setBenchmarkHeight() {
159164
let vh = window.innerHeight * 0.01;
160165
document.documentElement.style.setProperty('--vh', `${vh}px`);

resource/template/dashboard-default/server.html

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,6 @@
3030
<th>{{tr "VersionNumber"}}</th>
3131
<th>{{tr "HideForGuest"}}</th>
3232
<th>{{tr "EnableDDNS"}}</th>
33-
<th>{{tr "EnableIPv4"}}</th>
34-
<th>{{tr "EnableIpv6"}}</th>
35-
<th>{{tr "DDNSDomain"}}</th>
3633
<th>{{tr "Secret"}}</th>
3734
<th>{{tr "OneKeyInstall"}}</th>
3835
<th>{{tr "Note"}}</th>
@@ -51,9 +48,6 @@
5148
<td>{{$server.Host.Version}}</td>
5249
<td>{{$server.HideForGuest}}</td>
5350
<td>{{$server.EnableDDNS}}</td>
54-
<td>{{$server.EnableIPv4}}</td>
55-
<td>{{$server.EnableIpv6}}</td>
56-
<td>{{$server.DDNSDomain}}</td>
5751
<td>
5852
<button class="ui icon green mini button" data-clipboard-text="{{$server.Secret}}" data-tooltip="{{tr "ClickToCopy"}}">
5953
<i class="copy icon"></i>
@@ -76,8 +70,16 @@
7670
<i class="apple icon"></i>
7771
</button>
7872
</td>
79-
<td style="word-break: break-word;white-space: pre-wrap;">{{$server.Note}}</td>
80-
<td style="word-break: break-word;white-space: pre-wrap;">{{$server.PublicNote}}</td>
73+
<td>
74+
{{if $server.Note}}
75+
<button class="ui icon green mini button" title="{{ $server.Note }}" onclick="addOrEditServer({{$server.MarshalForDashboard}})"><i class="sticky note icon"></i></button>
76+
{{end}}
77+
</td>
78+
<td>
79+
{{if $server.PublicNote}}
80+
<button class="ui icon green mini button" title="{{$server.PublicNote}}" onclick="addOrEditServer({{$server.MarshalForDashboard}})"><i class="sticky clipboard icon"></i></button>
81+
{{end}}
82+
</td>
8183
<td>
8284
<div class="ui mini icon buttons">
8385
<button class="ui button" onclick="connectToServer({{$server.ID}})">

resource/template/theme-server-status/header.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@
2626
<script src="https://unpkg.com/bootstrap@3.4.1/dist/js/bootstrap.min.js"></script>
2727
<script src="https://unpkg.com/vue@2.6.14/dist/vue.min.js"></script>
2828
<script src="https://unpkg.com/echarts@5.5.0/dist/echarts.min.js"></script>
29-
<link rel="stylesheet" href="/static/theme-server-status/css/main.css?v20240909">
30-
<link rel="stylesheet" href="/static/theme-server-status/css/dark.css?v202408011">
31-
<link rel="stylesheet" href="/static/theme-server-status/css/light.css?v20240811">
32-
<script src="/static/theme-server-status/js/mixin.js?v20240907"></script>
29+
<link rel="stylesheet" href="/static/theme-server-status/css/main.css?v20240929">
30+
<link rel="stylesheet" href="/static/theme-server-status/css/dark.css?v202409029">
31+
<link rel="stylesheet" href="/static/theme-server-status/css/light.css?v20240916">
32+
<script src="/static/theme-server-status/js/mixin.js?v20240915"></script>
3333
</head>
3434
<body>
3535
<div id="app">

resource/template/theme-server-status/home-group-false.html

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@
66
<th class="node-cell name center">{{tr "Name"}}</th>
77
<th class="node-cell os center">{{tr "Platform"}}</th>
88
<th class="node-cell location center">{{tr "Location"}}</th>
9+
<th v-if="additional && Object.values(additional).filter(item => item.price).length > 0" class="node-cell price center">{{tr "Price"}}</th>
910
<th class="node-cell uptime center">{{tr "Uptime"}}</th>
1011
<th class="node-cell load center">{{tr "Load"}}</th>
1112
<th class="node-cell network center">{{tr "NetSpeed"}}↓|↑</th>
1213
<th class="node-cell traffic center">{{tr "NetTransfer"}}↓|↑</th>
1314
<th class="node-cell cpu center">{{tr "CpuUsed"}}</th>
1415
<th class="node-cell memory center">{{tr "MemUsed"}}</th>
1516
<th class="node-cell hdd center">{{tr "DiskUsed"}}</th>
17+
<th v-if="additional && Object.values(additional).filter(item => item.remaining).length > 0" class="node-cell remaining center">{{tr "Remaining"}}</th>
1618
</tr>
1719
</thead>
1820
<tbody id="servers">
@@ -36,6 +38,12 @@
3638
<i :class="'fi fi-' + node.location"></i>
3739
<span class="node-cell-location-text text-uppercase">@#node.location#@</span>
3840
</td>
41+
<td v-if="additional && Object.values(additional).filter(item => item.price).length > 0" class="node-cell price center">
42+
<template v-if="additional[node.ID] && additional[node.ID].price">
43+
<span v-if="additional[node.ID].price.amount == 0" class="node-cell-price-text">Free</span>
44+
<span v-else class="node-cell-price-text">@#additional[node.ID].price.amount#@@#(additional[node.ID].price.cycle ? '/' + additional[node.ID].price.cycle : '')#@</span>
45+
</template>
46+
</td>
3947
<td style="text-align: center;" class="node-cell uptime">@#node.uptime#@</td>
4048
<td style="text-align: center;" class="node-cell load">@#node.load#@</td>
4149
<td style="text-align: center;" class="node-cell network">@#node.network#@</td>
@@ -59,6 +67,21 @@
5967
</div>
6068
</div>
6169
</td>
70+
<td v-if="additional && Object.values(additional).filter(item => item.remaining).length > 0" class="node-cell remaining">
71+
<div :class="['progress', node.online ? 'progress-online' : 'progress-offline']">
72+
<template v-if="additional[node.ID] && additional[node.ID].remaining.format">
73+
<div :style="additional[node.ID].remaining.format.style" :class="additional[node.ID].remaining.days == 'lifetime' ? '' : additional[node.ID].remaining.format.class"></div>
74+
<div class="additional">
75+
<small v-if="additional[node.ID].remaining.days == 'lifetime'">{{tr "Lifetime"}}</small>
76+
<small v-else-if="additional[node.ID].remaining.days < 0">{{tr "Expired"}}</small>
77+
<small v-else>
78+
<span class="node-cell-remaining-days">@#additional[node.ID].remaining.days#@{{tr "Days"}}</span>
79+
<span class="node-cell-remaining-percent">@#additional[node.ID].remaining.percent#@%</span>
80+
</small>
81+
</div>
82+
</template>
83+
</div>
84+
</td>
6285
</tr>
6386
<tr class="expandRow" :class="index % 2 === 0 ? 'odd': 'even'">
6487
<td colspan="16">

resource/template/theme-server-status/home-group-true.html

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,15 @@
99
<th class="node-cell name center">{{tr "Name"}}</th>
1010
<th class="node-cell os center">{{tr "Platform"}}</th>
1111
<th class="node-cell location center">{{tr "Location"}}</th>
12+
<th v-if="additional && Object.values(additional).filter(item => item.price).length > 0" class="node-cell price center">{{tr "Price"}}</th>
1213
<th class="node-cell uptime center">{{tr "Uptime"}}</th>
1314
<th class="node-cell load center">{{tr "Load"}}</th>
1415
<th class="node-cell network center">{{tr "NetSpeed"}}↓|↑</th>
1516
<th class="node-cell traffic center">{{tr "NetTransfer"}}↓|↑</th>
1617
<th class="node-cell cpu center">{{tr "CpuUsed"}}</th>
1718
<th class="node-cell memory center">{{tr "MemUsed"}}</th>
1819
<th class="node-cell hdd center">{{tr "DiskUsed"}}</th>
20+
<th v-if="additional && Object.values(additional).filter(item => item.remaining).length > 0" class="node-cell remaining center">{{tr "Remaining"}}</th>
1921
</tr>
2022
</thead>
2123
<tbody id="servers">
@@ -39,6 +41,12 @@
3941
<i :class="'fi fi-' + node.location"></i>
4042
<span class="node-cell-location-text text-uppercase">&nbsp;@#node.location#@</span>
4143
</td>
44+
<td v-if="additional && Object.values(additional).filter(item => item.price).length > 0" class="node-cell price center">
45+
<template v-if="additional[node.ID] && additional[node.ID].price">
46+
<span v-if="additional[node.ID].price.amount == 0" class="node-cell-price-text">Free</span>
47+
<span v-else class="node-cell-price-text">@#additional[node.ID].price.amount#@@#(additional[node.ID].price.cycle ? '/' + additional[node.ID].price.cycle : '')#@</span>
48+
</template>
49+
</td>
4250
<td style="text-align: center;" class="node-cell uptime">@#node.uptime#@</td>
4351
<td style="text-align: center;" class="node-cell load">@#node.load#@</td>
4452
<td style="text-align: center;" class="node-cell network">@#node.network#@</td>
@@ -62,6 +70,21 @@
6270
</div>
6371
</div>
6472
</td>
73+
<td v-if="additional && Object.values(additional).filter(item => item.remaining).length > 0" class="node-cell remaining">
74+
<div :class="['progress', node.online ? 'progress-online' : 'progress-offline']">
75+
<template v-if="additional[node.ID] && additional[node.ID].remaining.format">
76+
<div :style="additional[node.ID].remaining.format.style" :class="additional[node.ID].remaining.days == 'lifetime' ? '' : additional[node.ID].remaining.format.class"></div>
77+
<div class="additional">
78+
<small v-if="additional[node.ID].remaining.days == 'lifetime'">{{tr "Lifetime"}}</small>
79+
<small v-else-if="additional[node.ID].remaining.days < 0">{{tr "Expired"}}</small>
80+
<small v-else>
81+
<span class="node-cell-remaining-days">@#additional[node.ID].remaining.days#@{{tr "Days"}}</span>
82+
<span class="node-cell-remaining-percent">@#additional[node.ID].remaining.percent#@%</span>
83+
</small>
84+
</div>
85+
</template>
86+
</div>
87+
</td>
6588
</tr>
6689
<tr class="expandRow" :class="index % 2 === 0 ? 'odd': 'even'">
6790
<td colspan="16">

0 commit comments

Comments
 (0)