mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-14 20:30:25 +08:00
实现基本的区域监控终端管理功能
This commit is contained in:
@@ -300,8 +300,8 @@ func (this *RPCClient) IPListRPC() pb.IPListServiceClient {
|
||||
return pb.NewIPListServiceClient(this.pickConn())
|
||||
}
|
||||
|
||||
func (this *RPCClient) ReporterRPC() pb.ReporterServiceClient {
|
||||
return pb.NewReporterServiceClient(this.pickConn())
|
||||
func (this *RPCClient) ReportNodeRPC() pb.ReportNodeServiceClient {
|
||||
return pb.NewReportNodeServiceClient(this.pickConn())
|
||||
}
|
||||
|
||||
func (this *RPCClient) IPItemRPC() pb.IPItemServiceClient {
|
||||
|
||||
@@ -7,7 +7,6 @@ Vue.component("source-code-box", {
|
||||
if (typeof readOnly != "boolean") {
|
||||
readOnly = true
|
||||
}
|
||||
console.log("readonly:", readOnly) // TODO
|
||||
let box = document.getElementById("source-code-box-" + this.index)
|
||||
let valueBox = document.getElementById(this.valueBoxId)
|
||||
let value = ""
|
||||
|
||||
@@ -62,6 +62,9 @@
|
||||
<!-- 背景颜色 -->
|
||||
<a href="" class="item" title="点击切换界面风格" @click.prevent="changeTheme()"><i class="icon adjust"></i></a>
|
||||
|
||||
<!-- -->
|
||||
<a :href="'/settings/authority'" class="item" title="企业版" :v-if="teaIsPlus"><i class="icon gem outline yellow"></i></a>
|
||||
|
||||
<!-- 退出登录 -->
|
||||
<a :href="Tea.url('logout')" class="item" title="安全退出登录"><i class="icon sign out"></i>
|
||||
<span class="hover-span"><span class="disabled">退出登录</span></span>
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
</tr>
|
||||
<tbody v-show="moreOptionsVisible">
|
||||
<tr>
|
||||
<td>地域</td>
|
||||
<td>区域</td>
|
||||
<td>
|
||||
<input type="text" name="location" maxlength="50"/>
|
||||
<p class="comment">终端所在地域。</p>
|
||||
|
||||
@@ -4,3 +4,60 @@
|
||||
<second-menu>
|
||||
<menu-item @click.prevent="createReporter">[添加终端]</menu-item>
|
||||
</second-menu>
|
||||
|
||||
<form class="ui form" method="get" action="/clusters/monitors/reporters">
|
||||
<div class="ui fields inline">
|
||||
<div class="ui field">
|
||||
<input type="text" name="keyword" v-model="keyword" placeholder="名称、地域、IP..."/>
|
||||
</div>
|
||||
<div class="ui field">
|
||||
<button class="ui button" type="submit">搜索</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
|
||||
<p class="comment" v-if="reporters.length == 0">暂时还没有终端。</p>
|
||||
|
||||
<table class="ui table selectable celled" v-if="reporters.length > 0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>终端名称</th>
|
||||
<th>区域</th>
|
||||
<th>网络提供商</th>
|
||||
<th>当前IP</th>
|
||||
<th class="one wide">状态</th>
|
||||
<th class="two op">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tr v-for="reporter in reporters">
|
||||
<td>
|
||||
<a :href="Tea.url('.reporter', {reporterId: reporter.id})"><keyword :v-word="keyword">{{reporter.name}}</keyword></a>
|
||||
</td>
|
||||
<td>
|
||||
<span v-if="reporter.location.length > 0"><keyword :v-word="keyword">{{reporter.location}}</keyword></span>
|
||||
<span v-else-if="reporter.status.location.length > 0" class="grey"><keyword :v-word="keyword">{{reporter.status.location}}</keyword></span>
|
||||
<span v-else class="disabled">-</span>
|
||||
</td>
|
||||
<td>
|
||||
<span v-if="reporter.isp.length > 0"><keyword :v-word="keyword">{{reporter.isp}}</keyword></span>
|
||||
<span v-else-if="reporter.status.isp.length > 0" class="grey"><keyword :v-word="keyword">{{reporter.status.isp}}</keyword></span>
|
||||
<span v-else class="disabled">-</span>
|
||||
</td>
|
||||
<td>
|
||||
<span v-if="reporter.status.ip.length > 0"><keyword :v-word="keyword">{{reporter.status.ip}}</keyword></span>
|
||||
<span v-else class="disabled">-</span>
|
||||
</td>
|
||||
<td>
|
||||
<span v-if="!reporter.isOn" class="red">禁用</span>
|
||||
<span v-else-if="!reporter.isActive" class="red">离线</span>
|
||||
<span v-else class="green">在线</span>
|
||||
</td>
|
||||
<td>
|
||||
<a :href="Tea.url('.reporter', {reporterId: reporter.id})">详情</a>
|
||||
<a href="" @click.prevent="deleteReporter(reporter.id)">删除</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<div class="page" v-html="page"></div>
|
||||
@@ -1,9 +1,25 @@
|
||||
Tea.context(function () {
|
||||
this.createReporter = function () {
|
||||
teaweb.popup(".createPopup", function () {
|
||||
teaweb.popup(".createPopup", {
|
||||
callback: function () {
|
||||
teaweb.success("保存成功", function () {
|
||||
teaweb.reload()
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
this.deleteReporter = function (reporterId) {
|
||||
teaweb.confirm("确定要删除此终端吗?", function () {
|
||||
this.$post(".reporter.delete")
|
||||
.params({
|
||||
reporterId: reporterId
|
||||
})
|
||||
.success(function () {
|
||||
teaweb.success("删除成功", function () {
|
||||
teaweb.reload()
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
@@ -0,0 +1,7 @@
|
||||
<first-menu>
|
||||
<menu-item href="/clusters/monitors/reporters">所有终端</menu-item>
|
||||
<span class="disabled item">|</span>
|
||||
<menu-item :href="'/clusters/monitors/reporters/reporter?reporterId=' + reporter.id" code="reporter">"{{reporter.name}}"详情</menu-item>
|
||||
<menu-item :href="'/clusters/monitors/reporters/reporter/logs?reporterId=' + reporter.id" code="log">运行日志</menu-item>
|
||||
<menu-item :href="'/clusters/monitors/reporters/reporter/update?reporterId=' + reporter.id" code="update">修改</menu-item>
|
||||
</first-menu>
|
||||
@@ -0,0 +1,73 @@
|
||||
{$layout}
|
||||
{$template "/code_editor"}
|
||||
{$template "reporter_menu"}
|
||||
|
||||
<table class="ui table definition selectable">
|
||||
<tr>
|
||||
<td class="title">名称</td>
|
||||
<td>
|
||||
{{reporter.name}}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>状态</td>
|
||||
<td>
|
||||
<span v-if="!reporter.isOn" class="red">禁用</span>
|
||||
<span v-else-if="!reporter.isActive" class="red">离线</span>
|
||||
<span v-else class="green">在线</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>区域</td>
|
||||
<td>
|
||||
<span v-if="reporter.location.length > 0">{{reporter.location}}</span>
|
||||
<span v-else-if="reporter.status.location.length > 0" class="grey">{{reporter.status.location}}</span>
|
||||
<span v-else class="disabled">没有设置</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>网络提供商</td>
|
||||
<td>
|
||||
<span v-if="reporter.isp.length > 0">{{reporter.isp}}</span>
|
||||
<span v-else-if="reporter.status.isp.length > 0" class="grey">{{reporter.status.isp}}</span>
|
||||
<span v-else class="disabled">没有设置</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>允许的终端IP</td>
|
||||
<td>
|
||||
<div v-if="reporter.allowIPs != null && reporter.allowIPs.length > 0">
|
||||
<span v-for="ip in reporter.allowIPs" class="ui label tiny basic">{{ip}}</span>
|
||||
</div>
|
||||
<span v-else class="disabled">没有设置</span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<h4>安装信息</h4>
|
||||
<table class="ui table definition selectable">
|
||||
<tr>
|
||||
<td class="title">节点ID</td>
|
||||
<td>{{reporter.uniqueId}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>节点Secret</td>
|
||||
<td>{{reporter.secret}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>命令行</td>
|
||||
<td>
|
||||
<more-options-indicator>查看命令行</more-options-indicator>
|
||||
<div :style="{visibility: moreOptionsVisible ? 'visible' : 'hidden', height: moreOptionsVisible ? 'auto': '0em'}">
|
||||
<div class="ui divider"></div>
|
||||
<h4>Linux、Mac OS X:</h4>
|
||||
<source-code-box type="application/x-sh">edge-reporter run -api=[API HOST] -node-id={{reporter.uniqueId}} -secret={{reporter.secret}}</source-code-box>
|
||||
|
||||
<h4>Windows:</h4>
|
||||
<source-code-box type="application/x-sh">edge-reporter.exe run -api=[API HOST] -node-id={{reporter.uniqueId}} -secret={{reporter.secret}}</source-code-box>
|
||||
|
||||
<p class="comment">把上面命令行中的<code-label>[API_HOST]</code-label>换成你的API节点地址,包括协议、主机名端口。</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -0,0 +1,3 @@
|
||||
{$layout}
|
||||
{$template "reporter_menu"}
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
{$layout}
|
||||
{$template "reporter_menu"}
|
||||
|
||||
<form class="ui form" data-tea-success="success" data-tea-action="$">
|
||||
<csrf-token></csrf-token>
|
||||
<input type="hidden" name="reporterId" :value="reporter.id"/>
|
||||
<table class="ui table definition selectable">
|
||||
<tr>
|
||||
<td class="title">名称 *</td>
|
||||
<td>
|
||||
<input type="text" name="name" maxlength="50" ref="focus" v-model="reporter.name"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2"><more-options-indicator></more-options-indicator></td>
|
||||
</tr>
|
||||
<tbody v-show="moreOptionsVisible">
|
||||
<tr>
|
||||
<td>区域</td>
|
||||
<td>
|
||||
<input type="text" name="location" maxlength="50" v-model="reporter.location"/>
|
||||
<p class="comment">终端所在地域。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>网络提供商</td>
|
||||
<td>
|
||||
<input type="text" name="isp" maxlength="50" v-model="reporter.isp"/>
|
||||
<p class="comment">终端所属网络供应商。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>允许的终端IP</td>
|
||||
<td>
|
||||
<values-box name="allowIPs" :values="reporter.allowIPs"></values-box>
|
||||
<p class="comment">如果不为空,则只有这些IP才能连接API。支持单个IP、CIDR格式的IP段和IP1-IP2这样的IP段。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>是否启用</td>
|
||||
<td>
|
||||
<checkbox name="isOn" v-model="reporter.isOn"></checkbox>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<submit-btn></submit-btn>
|
||||
</form>
|
||||
@@ -0,0 +1,3 @@
|
||||
Tea.context(function () {
|
||||
this.success = NotifySuccess("保存成功", Tea.url(".", {reporterId: this.reporter.id}))
|
||||
})
|
||||
4
web/views/@default/settings/authority/index.css
Normal file
4
web/views/@default/settings/authority/index.css
Normal file
@@ -0,0 +1,4 @@
|
||||
.message .icon.gem {
|
||||
font-size: 1.2em!important;
|
||||
}
|
||||
/*# sourceMappingURL=index.css.map */
|
||||
1
web/views/@default/settings/authority/index.css.map
Normal file
1
web/views/@default/settings/authority/index.css.map
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["index.less"],"names":[],"mappings":"AAAA,QAAS,MAAK;EACb,0BAAA","file":"index.css"}
|
||||
@@ -4,6 +4,15 @@
|
||||
<warning-message v-if="key == null">认证之后,可以使用企业版功能,当前你还没有认证,<a href="http://edge.teaos.cn/docs/Plus/Authority/Index.md" target="_blank">[在这里看认证方法]</a>。</warning-message>
|
||||
|
||||
<div v-if="key != null">
|
||||
<div class="margin"></div>
|
||||
|
||||
<div class="ui message green icon">
|
||||
<i class="icon gem outline small yellow"></i>
|
||||
<div class="content">
|
||||
恭喜您已经成为尊贵的企业版用户。
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="margin"></div>
|
||||
<table class="ui table definition selectable">
|
||||
<tr>
|
||||
|
||||
3
web/views/@default/settings/authority/index.less
Normal file
3
web/views/@default/settings/authority/index.less
Normal file
@@ -0,0 +1,3 @@
|
||||
.message .icon.gem {
|
||||
font-size: 1.2em!important;
|
||||
}
|
||||
Reference in New Issue
Block a user