增加置顶集群功能

This commit is contained in:
GoEdgeLab
2022-03-17 11:12:24 +08:00
parent a218417688
commit 48361fad32
8 changed files with 98 additions and 3 deletions

View File

@@ -0,0 +1,21 @@
.cluster-name-td {
position: relative;
}
.cluster-name-td .icon.pin {
display: none;
position: absolute;
right: 1em;
top: 50%;
margin-top: -0.7em;
opacity: 0.6;
}
.cluster-name-td .icon.visible {
display: inline;
}
.cluster-name-td .icon.opacity {
opacity: 0.3;
}
.cluster-name-td:hover .icon.pin {
display: inline;
}
/*# sourceMappingURL=index.css.map */

View File

@@ -1 +1 @@
undefined
{"version":3,"sources":["index.less"],"names":[],"mappings":"AAAA;EACC,kBAAA;;AADD,gBAGC,MAAK;EACJ,aAAA;EACA,kBAAA;EACA,UAAA;EACA,QAAA;EACA,kBAAA;EACA,YAAA;;AATF,gBAYC,MAAK;EACJ,eAAA;;AAbF,gBAgBC,MAAK;EACJ,YAAA;;AAIF,gBAAgB,MACf,MAAK;EACJ,eAAA","file":"index.css"}

View File

@@ -41,11 +41,14 @@
</tr>
</thead>
<tr v-for="cluster in clusters">
<td>
<td class="cluster-name-td">
<a :href="'/clusters/cluster?clusterId=' + cluster.id"><keyword :v-word="keyword">{{cluster.name}}</keyword></a>
<div v-if="cluster.timeZone != null && cluster.timeZone.length > 0">
<grey-label>时区:{{cluster.timeZone}}</grey-label>
</div>
<a href="" title="取消置顶" v-if="cluster.isPinned" @click.prevent="pin(cluster.id, false)"><i class="icon pin grey visible"></i></a>
<a href="" title="置顶" v-else @click.prevent="pin(cluster.id, true)"><i class="icon pin grey opacity"></i></a>
</td>
<td class="center">
<a :href="'/clusters/cluster/nodes?clusterId=' + cluster.id" v-if="cluster.countAllNodes > 0"><span :class="{red:cluster.countAllNodes > cluster.countActiveNodes}">{{cluster.countAllNodes}}</span></a>

View File

@@ -4,4 +4,15 @@ Tea.context(function () {
this.showLatest = function () {
this.latestVisible = !this.latestVisible
}
this.pin = function (clusterId, isPinned) {
this.$post(".pin")
.params({
clusterId: clusterId,
isPinned: isPinned
})
.success(function () {
teaweb.reload()
})
}
})

View File

@@ -1,2 +1,26 @@
table a span {
.cluster-name-td {
position: relative;
.icon.pin {
display: none;
position: absolute;
right: 1em;
top: 50%;
margin-top: -0.7em;
opacity: 0.6;
}
.icon.visible {
display: inline;
}
.icon.opacity {
opacity: 0.3;
}
}
.cluster-name-td:hover {
.icon.pin {
display: inline;
}
}