Files
EdgeAdmin/web/views/@default/clusters/cluster/nodes.html

181 lines
9.7 KiB
HTML
Raw Normal View History

2020-09-06 16:19:34 +08:00
{$layout}
{$template "menu"}
2020-09-06 16:19:34 +08:00
<form class="ui form" action="/clusters/cluster/nodes" v-show="countAll > 0">
<input type="hidden" name="clusterId" :value="clusterId"/>
<div class="ui fields inline">
<div class="ui field" v-if="groups.length > 0">
<select class="ui dropdown" name="groupId" v-model="groupId">
2020-12-10 16:11:41 +08:00
<option value="0">[全部分组]</option>
<option v-for="group in groups" :value="group.id">{{group.name}}</option>
</select>
</div>
2022-04-02 16:28:22 +08:00
<div class="ui field" v-if="regions.length > 0">
<select class="ui dropdown" name="regionId" v-model="regionId">
<option value="0">[全部区域]</option>
<option v-for="region in regions" :value="region.id">{{region.name}}</option>
</select>
</div>
<div class="ui field">
<select class="ui dropdown" name="activeState" v-model="activeState">
<option value="0">[在线状态]</option>
<option value="1">在线</option>
<option value="2">不在线</option>
</select>
</div>
<div class="ui field">
<select class="ui dropdown" name="installedState" v-model="installState">
2020-12-10 16:11:41 +08:00
<option value="0">[安装状态]</option>
<option value="1">已安装</option>
<option value="2">未安装</option>
</select>
</div>
2022-04-04 12:08:18 +08:00
<div class="ui field" v-if="teaIsPlus && levels.length > 0">
<select class="ui dropdown" name="level" v-model="level">
<option value="0">[级别]</option>
<option v-for="levelInfo in levels" :value="levelInfo.code">{{levelInfo.name}}</option>
</select>
</div>
2020-10-28 18:21:11 +08:00
<div class="ui field">
<input type="text" name="keyword" placeholder="关键词" v-model="keyword" style="width:10em"/>
</div>
<div class="ui field">
<button class="ui button" type="submit">搜索</button> &nbsp;
2022-06-19 20:19:58 +08:00
<a :href="'/clusters/cluster/nodes?clusterId=' + clusterId" v-if="regionId > 0 || groupId > 0 || groupId < 0 || installState > 0 || activeState > 0 || keyword.length > 0 || level > 0">[清除条件]</a>
</div>
</div>
</form>
2020-09-06 16:19:34 +08:00
2021-04-18 15:17:49 +08:00
<div v-if="countAll == 0">
2021-06-10 19:19:43 +08:00
<not-found-box message="当前集群下还没有节点,至少添加一个节点后才能提供服务。">
<div style="margin-top: 0.5em">
<a :href="'/clusters/cluster/createNode?clusterId=' + clusterId">[创建节点]</a>
</div>
</not-found-box>
2021-04-18 15:17:49 +08:00
</div>
<div v-if="countAll > 0">
<p class="comment" v-if="nodes.length == 0">暂时还没有节点。</p>
</div>
2020-09-06 16:19:34 +08:00
2020-11-16 13:03:45 +08:00
<table class="ui table selectable celled" v-if="nodes.length > 0">
<thead>
<tr>
<th>节点名称</th>
2020-12-10 16:11:41 +08:00
<th>IP</th>
2020-11-16 15:26:27 +08:00
<th class="width10">DNS线路</th>
2023-03-16 09:48:45 +08:00
<th class="value-column center" v-if="windowWidth < miniWidth || windowWidth > columnWidth1">CPU<sort-arrow name="cpuOrder"></sort-arrow></th>
<th class="value-column center" v-if="windowWidth < miniWidth || windowWidth > columnWidth2">内存<sort-arrow name="memoryOrder"></sort-arrow></th>
<th class="value-column center" v-if="windowWidth < miniWidth || windowWidth > columnWidth3">下行带宽<sort-arrow name="trafficOutOrder"></sort-arrow></th>
<th class="value-column center" v-if="windowWidth < miniWidth || windowWidth > columnWidth4">连接数<sort-arrow name="connectionsOrder"></sort-arrow></th>
<th class="value-column center" v-if="windowWidth < miniWidth || windowWidth > columnWidth5">负载<sort-arrow name="loadOrder"></sort-arrow></th>
2023-03-23 15:47:11 +08:00
<th class="width6 center">状态</th>
<th class="three op">操作</th>
</tr>
</thead>
<tr v-for="(node, nodeIndex) in nodes">
<td class="node-name-td"><a :href="'/clusters/cluster/node?clusterId=' + clusterId + '&nodeId=' + node.id">{{node.name}}<sup v-if="node.level > 1"><span class="blue"> &nbsp;L{{node.level}}</span></sup></a>
<a :href="'/clusters/cluster/node/settings/schedule?clusterId=' + node.cluster.id + '&nodeId=' + node.id">
<sup v-if="node.isBackup"><span class="blue"> &nbsp;备用</span></sup>
<sup v-if="node.offlineDay != null && node.offlineDay.length > 0"><span class="blue"> &nbsp;到{{node.offlineDay.substring(0, 4)}}-{{node.offlineDay.substring(4, 6)}}-{{node.offlineDay.substring(6, 8)}}</span></sup>
</a>
<a :href="'/clusters/cluster/node/update?clusterId=' + clusterId + '&nodeId=' + node.id" title="设置"><i class="icon setting grey"></i></a>
2021-09-15 19:22:54 +08:00
<div v-if="node.region != null">
<grey-label>区域:{{node.region.name}}</grey-label>
</div>
2021-09-15 19:22:54 +08:00
<div v-if="node.group != null">
<grey-label>分组:{{node.group.name}}</grey-label>
2021-07-31 22:23:07 +08:00
</div>
2021-09-15 19:22:54 +08:00
<div v-if="node.secondaryClusters != null && node.secondaryClusters.length > 0">
2021-07-31 22:23:07 +08:00
<node-clusters-labels :v-primary-cluster="node.cluster" :v-secondary-clusters="node.secondaryClusters" size="tiny"></node-clusters-labels>
</div>
2020-12-10 16:11:41 +08:00
</td>
<td>
<span v-if="node.ipAddresses.length == 0" class="disabled">-</span>
<div v-else class="address-box">
<div v-for="(addr, index) in node.ipAddresses" v-if="node.ipAddresses.length < mostIPVisible || node.ipAddressesVisible || index < mostIPVisible" style="margin-bottom:0.3em">
2020-11-16 15:26:27 +08:00
<div class="ui label tiny basic">{{addr.ip}}
<span class="small" v-if="addr.name.length > 0">{{addr.name}}<span v-if="!addr.canAccess">,不可访问</span></span>
<span class="small" v-if="addr.name.length == 0 && !addr.canAccess">(不可访问)</span>
<!-- 专属集群 -->
2023-03-01 15:30:32 +08:00
<div v-if="addr.clusters != null && addr.clusters.length > 0" style="margin-top: 0.3em; font-weight: normal">
<span class="small grey">[</span><span v-for="(cluster, index) in addr.clusters" class="small grey">{{cluster.name}}<span v-if="index < addr.clusters.length - 1"></span></span><span class="small grey">]</span>
</div>
2020-09-26 08:07:18 +08:00
</div>
2020-09-06 16:19:34 +08:00
</div>
<a href="" @click.prevent="showMoreIP(nodeIndex, node)" v-show="node.ipAddresses.length > mostIPVisible">
<span class="small grey" v-if="!node.ipAddressesVisible">更多IP...</span>
<span class="small grey" v-if="node.ipAddressesVisible">...收起</span>
</a>
</div>
</td>
<td class="routes-box" :class="{'show-link': node.dnsRouteNames.length == 0 && hasClusterDNS}">
2020-11-16 13:03:45 +08:00
<div v-if="node.dnsRouteNames.length > 0">
2020-11-16 15:26:27 +08:00
<div v-for="routeName in node.dnsRouteNames">
<tiny-basic-label>{{routeName}}</tiny-basic-label>
</div>
<div>
<a href="" @click.prevent="updateNodeDNS(node.id)" class="small">[修改]</a>
</div>
2020-11-16 13:03:45 +08:00
</div>
<span v-else-if="hasClusterDNS">
<a href="" @click.prevent="updateNodeDNS(node.id)" class="small">[设置]</a>
</span>
2020-11-16 13:03:45 +08:00
<span v-else class="disabled">-</span>
</td>
2023-03-15 17:57:32 +08:00
<td class="center" v-if="windowWidth < miniWidth || windowWidth > columnWidth1">
2022-04-25 09:24:38 +08:00
<span v-if="node.status.isActive" :class="{red:node.status.cpuUsage > 0.50}">{{node.status.cpuUsageText}}</span>
<span v-else class="disabled">-</span>
</td>
2023-03-15 17:57:32 +08:00
<td class="center" v-if="windowWidth < miniWidth || windowWidth > columnWidth2">
2022-04-25 09:24:38 +08:00
<span v-if="node.status.isActive" :class="{red:node.status.memUsage > 0.80}">{{node.status.memUsageText}}</span>
<span v-else class="disabled">-</span>
</td>
2023-03-15 17:57:32 +08:00
<td class="center" v-if="windowWidth < miniWidth || windowWidth > columnWidth3">
<span v-if="node.status.isActive && node.status.trafficOutBytes > 0">{{teaweb.formatBits(node.status.trafficOutBytes * 8/60, 2)}}</span>
2022-04-07 18:31:21 +08:00
<span v-else class="disabled">-</span>
</td>
2023-03-15 17:57:32 +08:00
<td class="center" v-if="windowWidth < miniWidth || windowWidth > columnWidth4">
2023-03-17 15:25:07 +08:00
<span v-if="node.status.isActive && node.status.countConnections > 0">{{teaweb.formatCount(node.status.countConnections)}}</span>
2023-03-15 17:57:32 +08:00
<span v-else class="disabled">-</span>
</td>
<td class="center" v-if="windowWidth < miniWidth || windowWidth > columnWidth5">
<span v-if="node.status.isActive">{{node.status.load1m}}</span>
<span v-else class="disabled">-</span>
</td>
2020-11-16 13:03:45 +08:00
<td class="center">
<div v-if="!node.isUp">
<span class="red">健康问题下线</span>
<div>
<a href="" @click.prevent="upNode(node.id)">[上线]</a>
</div>
</div>
<div v-else-if="!node.isOn">
<label-on :v-is-on="node.isOn"></label-on>
</div>
<div v-else-if="node.isInstalled">
<div v-if="node.status.isActive">
<span v-if="!node.isSynced" class="red">同步中</span>
<span v-else class="green">运行中</span>
2020-09-13 20:37:07 +08:00
</div>
<span v-else-if="node.status.updatedAt > 0" class="red">已断开</span>
<span v-else-if="node.status.updatedAt == 0" class="red">未连接</span>
</div>
<div v-else>
<span v-if="node.installStatus.isRunning" class="red">安装中</span>
<a v-if="node.installStatus.isFinished && !node.installStatus.isOk" :href="'/clusters/cluster/node/install?clusterId=' + clusterId + '&nodeId=' + node.id" title="点击看安装错误"><span class="red">安装出错</span></a>
<a v-else class="red" :href="'/clusters/cluster/node/install?clusterId=' + clusterId + '&nodeId=' + node.id" title="点击进安装界面"><span class="red">未安装</span></a>
</div>
</td>
<td>
<a :href="'/clusters/cluster/node?clusterId=' + clusterId + '&nodeId=' + node.id">详情</a> &nbsp; <a href="" @click.prevent="updateNodeOn(node.id, !node.isOn)"><span v-if="node.isOn">停用</span><span v-else class="red">启用</span></a> &nbsp; <a href="" @click.prevent="deleteNode(node.id)">删除</a>
</td>
</tr>
</table>
2020-09-06 16:19:34 +08:00
<div class="page" v-html="page"></div>