Skip to content

Commit

Permalink
Update server list
Browse files Browse the repository at this point in the history
  • Loading branch information
LittleJake committed Jan 18, 2024
1 parent bfd052b commit 0861ece
Show file tree
Hide file tree
Showing 3 changed files with 127 additions and 13 deletions.
11 changes: 10 additions & 1 deletion application/index/controller/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,16 @@ public function info($uuid = '')
public function list()
{
$uuids = SystemMonitor::getUUIDs();
//TODO
$hide = array_flip(SystemMonitor::getHide());
$online = SystemMonitor::sortByCountry(SystemMonitor::getOnline());
$offline = SystemMonitor::sortByCountry(SystemMonitor::getOffline());
$names = SystemMonitor::getDisplayName(array_keys($uuids));

$this->assign("names", $names);
$this->assign("online", $online);
$this->assign("offline", $offline);
$this->assign("hide", $hide);

if ($this->request->isAjax())
return $this->fetch("index/list_ajax");
return $this->fetch();
Expand Down
23 changes: 20 additions & 3 deletions application/index/view/index/info_template.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,23 @@
<style>
.line {margin: 20px;height: 8px;position: relative;}
.graph {overflow: visible;}
.line {
margin: 20px;
height: 8px;
position: relative;
}

.icon {
background-size: contain;
background-position: 50%;
background-repeat: no-repeat;
position: relative;
display: inline-block;
width: 1.33333333em;
line-height: 1em;
}

.graph {
overflow: visible;
}
</style>
<script>
function load_icon(name,url,color) {
Expand All @@ -11,7 +28,7 @@
success: function(res){
$(".icon-"+name).html(res);
$(".icon-"+name+">svg").css("fill", color);
$(".icon-"+name+">svg").addClass("mdui-list-item-icon");
$(".icon-"+name+">svg").addClass("icon");
}
});
}
Expand Down
106 changes: 97 additions & 9 deletions application/index/view/index/list_template.html
Original file line number Diff line number Diff line change
@@ -1,17 +1,34 @@
<style>
.line {margin: 20px;height: 8px;position: relative;}
.graph {overflow: visible;}
.line {
margin: 20px;
height: 8px;
position: relative;
}

.icon {
background-size: contain;
background-position: 50%;
background-repeat: no-repeat;
position: relative;
display: inline-block;
width: 1.33333333em;
line-height: 1em;
}

.graph {
overflow: visible;
}
</style>
<script>
function load_icon(name,url,color) {
function load_icon(name, url, color) {
$.ajax({
url: url,
type: "GET",
dataType: "text",
success: function(res){
$(".icon-"+name).html(res);
$(".icon-"+name+">svg").css("fill", color);
$(".icon-"+name+">svg").addClass("mdui-list-item-icon");
success: function (res) {
$(".icon-" + name).html(res);
$(".icon-" + name + ">svg").css("fill", color);
$(".icon-" + name + ">svg").addClass("icon");
}
});
}
Expand All @@ -24,9 +41,80 @@
<i class="mdui-panel-item-arrow mdui-icon material-icons">keyboard_arrow_down</i>
</div>
<div class="mdui-panel-item-body mdui-typo">

<div class="mdui-table-fluid">
<table class="mdui-table">
<thead>
<tr>
<th>{:lang("Status")}</th>
<th>{:lang("Country/Region")}</th>
<th>{:lang("Name")}</th>
<th>{:lang("OS")}</th>
<th>{:lang("Uptime")}</th>
<th>{:lang("Throughput")}</th>
</tr>
</thead>
<tbody>
{volist name="online" id="v"}
{if !isset($hide[$key])}
<tr>
<td>
<i class="mdui-icon material-icons mdui-text-color-green">&#xe2bf;</i>
</td>
<td>
<span
class="flag-icon flag-icon-{:empty($v['Country Code'])?'none':strtolower($v['Country Code'])}"></span>
{$v['Country Code']|default="Unknown"}
</td>
<td>
{:empty($names[$key])?$v['IPV4']:$names[$key]}
</td>
<td>
<?php $icon = getIcon($v['System Version']) ?>
<span class="icon-{$icon[0]}"></span>
<script>load_icon('{$icon[0]}', '{$icon[1]}', '{$icon[2]}')</script>
</td>
<td>
{$v['Uptime']|default="N/A"}
</td>
<td>
{$v['Throughput']|default="Undefined"}
</td>
</tr>
{/if}
{/volist}
{volist name="offline" id="v"}
{if !isset($hide[$key])}
<tr>
<td>
<i class="mdui-icon material-icons mdui-text-color-red">&#xe2c1;</i>
</td>
<td>
<span
class="flag-icon flag-icon-{:empty($v['Country Code'])?'none':strtolower($v['Country Code'])}"></span>
{$v['Country Code']|default="Unknown"}
</td>
<td>
{:empty($names[$key])?$v['IPV4']:$names[$key]}
</td>
<td>
<?php $icon = getIcon($v['System Version']) ?>
<span class="icon-{$icon[0]}"></span>
<script>load_icon('{$icon[0]}', '{$icon[1]}', '{$icon[2]}')</script>
</td>
<td>
{$v['Uptime']|default="N/A"}
</td>
<td>
{$v['Throughput']|default="Undefined"}
</td>
</tr>
{/if}
{/volist}
</tbody>
</table>
</div>
</div>
</div>
</div>
<script>
</script>
</script>

0 comments on commit 0861ece

Please sign in to comment.