Initial commit (code only without large binaries)

This commit is contained in:
robin
2026-02-15 18:58:44 +08:00
commit 35df75498f
9442 changed files with 1495866 additions and 0 deletions

View File

@@ -0,0 +1,9 @@
h3 span {
margin-left: 0.5em;
color: grey;
font-size: 0.6em !important;
}
table td {
word-break: break-all;
}
/*# sourceMappingURL=listPopup.css.map */

View File

@@ -0,0 +1 @@
{"version":3,"sources":["listPopup.less"],"names":[],"mappings":"AAAA,EAAG;EACF,kBAAA;EACA,WAAA;EACA,gBAAA;;AAID,KACC;EACC,qBAAA","file":"listPopup.css"}

View File

@@ -0,0 +1,50 @@
{$layout "layout_popup"}
<h3>正在同步的节点任务<span v-if="countTasks > 0">(共{{countTasks}}个)</span></h3>
<p class="comment" v-if="clusters.length == 0">暂时没有同步的任务。</p>
<div v-if="clusters.length > 0">
<button class="ui button basic tiny" @click.prevent="deleteAllTasks">清空所有任务</button> &nbsp;
<button class="ui button basic tiny" v-if="countCheckedTasks() > 0" @click.prevent="deleteBatch">批量删除{{countCheckedTasks()}}个任务</button>
<table class="ui table selectable celled">
<thead>
<tr>
<th style="width:3em"><checkbox @input="checkAll"></checkbox></th>
<th class="three wide">集群</th>
<th>节点</th>
<th>任务</th>
<th>状态</th>
<th>触发时间</th>
<th></th>
</tr>
</thead>
<tbody v-for="cluster in clusters">
<tr v-for="task in cluster.tasks">
<td>
<checkbox v-model="task.isChecked" @input="checkTask"></checkbox>
</td>
<td>{{cluster.name}}</td>
<td nowrap="">
{{task.node.name}} &nbsp; <a :href="'/clusters/cluster/node?clusterId=' + cluster.id + '&nodeId=' + task.node.id" target="_blank"><i class="icon linkify small grey"></i></a>
</td>
<td nowrap="">
<span v-if="task.type == 'configChanged' || task.type == 'globalServerConfigChanged'">同步配置</span>
<span v-if="task.type == 'ipItemChanged'">同步IP名单</span>
<span v-if="task.type == 'scriptsChanged'">同步脚本</span>
<span v-if="task.type == 'nodeLevelChanged'">同步L2节点</span>
<span v-if="task.type == 'ddosProtectionChanged'">DDoS配置</span>
<span v-if="task.type == 'userServersStateChanged'">用户网站状态</span>
<span v-if="task.type != null && task.type.startsWith('ipListDeleted')">删除IP名单</span>
</td>
<td>
<span v-if="task.isDone" class="red">{{task.error}}</span>
<span v-else>正在同步...</span>
</td>
<td nowrap="">{{task.updatedTime}}</td>
<td>
<a href="" title="删除" class="remove-btn" @click.prevent="deleteTask(task.id)"><i class="icon remove small grey"></i></a>
</td>
</tr>
</tbody>
</table>
</div>

View File

@@ -0,0 +1,98 @@
Tea.context(function () {
let checkedAll = false
this.$delay(function () {
this.reload()
})
this.checkAll = function (b) {
checkedAll = b
let that = this
this.clusters.forEach(function (cluster, index) {
cluster.tasks.forEach(function (task) {
task.isChecked = checkedAll
})
Vue.set(that.clusters, index, cluster)
})
}
this.checkTask = function (b) {
this.clusters.forEach(function (cluster, index) {
Vue.set(that.clusters, index, cluster)
})
}
let that = this
this.countCheckedTasks = function () {
let count = 0
that.clusters.forEach(function (cluster) {
cluster.tasks.forEach(function (task) {
if (task.isChecked) {
count++
}
})
})
return count
}
this.reload = function () {
this.$post("$")
.success(function (resp) {
this.countTasks = resp.data.countTasks
this.clusters = resp.data.clusters
})
.done(function () {
this.$delay(function () {
// 没有选中任务的时候才重新刷新
if (this.countCheckedTasks() == 0) {
this.reload()
}
}, 3000)
})
}
this.deleteTask = function (taskId) {
let that = this
teaweb.confirm("确定要删除这个任务吗?", function () {
that.$post(".delete")
.params({
taskId: taskId
})
.success(function () {
teaweb.reload()
})
})
}
this.deleteBatch = function () {
let taskIds = []
this.clusters.forEach(function (cluster) {
cluster.tasks.forEach(function (task) {
if (task.isChecked) {
taskIds.push(task.id)
}
})
})
let that = this
teaweb.confirm("确定要批量删除选中的任务吗?", function () {
that.$post(".deleteBatch")
.params({
taskIds: taskIds
})
.success(function () {
teaweb.reload()
})
})
}
this.deleteAllTasks = function () {
let that = this
teaweb.confirm("确定要清空所有的任务吗?", function () {
that.$post(".deleteAll")
.success(function () {
teaweb.reload()
})
})
}
})

View File

@@ -0,0 +1,12 @@
h3 span {
margin-left: 0.5em;
color: grey;
font-size: 0.6em !important;
}
table {
td {
word-break: break-all;
}
}