mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-09 16:50:26 +08:00
实现缓存策略若干功能
This commit is contained in:
34
web/views/@default/servers/components/cache/clean.html
vendored
Normal file
34
web/views/@default/servers/components/cache/clean.html
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
{$layout}
|
||||
{$template "/left_menu"}
|
||||
|
||||
<div class="right-box">
|
||||
{$template "policy_menu"}
|
||||
|
||||
<h3>选择集群</h3>
|
||||
<select class="ui dropdown auto-width" v-model="clusterId">
|
||||
<option v-for="cluster in clusters" :value="cluster.id">{{cluster.name}}</option>
|
||||
</select>
|
||||
<div class="ui divider"></div>
|
||||
|
||||
|
||||
<h3>清理</h3>
|
||||
<p class=""><span class="red">严重注意:该操作将清理集群所有节点上的所有对应缓存。</span></p>
|
||||
<form data-tea-action="$" data-tea-before="before" data-tea-success="success" data-tea-fail="fail" data-tea-done="done">
|
||||
<input type="hidden" name="cachePolicyId" :value="cachePolicyId"/>
|
||||
<input type="hidden" name="clusterId" :value="clusterId"/>
|
||||
<table class="ui table definition selectable">
|
||||
<tr>
|
||||
<td class="title">操作结果</td>
|
||||
<td>
|
||||
<div v-if="isRequesting">数据发送中...</div>
|
||||
<span class="red" v-if="!isRequesting && !isOk && message.length > 0">失败:{{message}}</span>
|
||||
<div v-if="!isRequesting && isOk">
|
||||
<span v-if="results.length == 0" class="red">此集群下没有任何可用的节点。</span>
|
||||
<div class="ui label tiny" v-for="one in results" :class="{green:one.isOk, red:!one.isOk}" style="margin-bottom: 0.5em">{{one.nodeName}}:{{one.message}}</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<submit-btn v-if="!isRequesting">提交</submit-btn>
|
||||
</form>
|
||||
</div>
|
||||
34
web/views/@default/servers/components/cache/clean.js
vendored
Normal file
34
web/views/@default/servers/components/cache/clean.js
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
Tea.context(function () {
|
||||
if (this.clusterId == null) {
|
||||
if (this.clusters.length > 0) {
|
||||
this.clusterId = this.clusters[0].id
|
||||
} else {
|
||||
this.clusterId = 0
|
||||
}
|
||||
}
|
||||
|
||||
this.isRequesting = false
|
||||
this.isOk = false
|
||||
this.message = ""
|
||||
this.results = []
|
||||
|
||||
this.before = function () {
|
||||
this.isRequesting = true
|
||||
this.isOk = false
|
||||
this.message = ""
|
||||
this.results = []
|
||||
}
|
||||
|
||||
this.success = function (resp) {
|
||||
this.isOk = true
|
||||
this.results = resp.data.results
|
||||
}
|
||||
|
||||
this.fail = function (resp) {
|
||||
this.message = resp.message
|
||||
}
|
||||
|
||||
this.done = function () {
|
||||
this.isRequesting = false
|
||||
}
|
||||
});
|
||||
38
web/views/@default/servers/components/cache/preheat.html
vendored
Normal file
38
web/views/@default/servers/components/cache/preheat.html
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
{$layout}
|
||||
{$template "/left_menu"}
|
||||
|
||||
<div class="right-box">
|
||||
{$template "policy_menu"}
|
||||
|
||||
<h3>选择集群</h3>
|
||||
<select class="ui dropdown auto-width" v-model="clusterId">
|
||||
<option v-for="cluster in clusters" :value="cluster.id">{{cluster.name}}</option>
|
||||
</select>
|
||||
<div class="ui divider"></div>
|
||||
|
||||
<form class="ui form" data-tea-action="$" data-tea-before="before" data-tea-success="success" data-tea-fail="fail" data-tea-done="done" data-tea-timeout="3600">
|
||||
<input type="hidden" name="cachePolicyId" :value="cachePolicyId"/>
|
||||
<input type="hidden" name="clusterId" :value="clusterId"/>
|
||||
<table class="ui table definition selectable">
|
||||
<tr>
|
||||
<td>Key列表</td>
|
||||
<td>
|
||||
<textarea name="keys" rows="10" ref="focus"></textarea>
|
||||
<p class="comment">每行一个Key。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="title">操作结果</td>
|
||||
<td>
|
||||
<div v-if="isRequesting">数据发送中...</div>
|
||||
<span class="red" v-if="!isRequesting && !isOk && message.length > 0">失败:{{message}}</span>
|
||||
<div v-if="!isRequesting && isOk">
|
||||
<span v-if="results.length == 0" class="red">此集群下没有任何可用的节点。</span>
|
||||
<div class="ui label tiny" v-for="one in results" :class="{green:one.isOk, red:!one.isOk}" style="margin-bottom: 0.5em">{{one.nodeName}}:{{one.message}}</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<submit-btn v-if="!isRequesting">提交</submit-btn>
|
||||
</form>
|
||||
</div>
|
||||
34
web/views/@default/servers/components/cache/preheat.js
vendored
Normal file
34
web/views/@default/servers/components/cache/preheat.js
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
Tea.context(function () {
|
||||
if (this.clusterId == null) {
|
||||
if (this.clusters.length > 0) {
|
||||
this.clusterId = this.clusters[0].id
|
||||
} else {
|
||||
this.clusterId = 0
|
||||
}
|
||||
}
|
||||
|
||||
this.isRequesting = false
|
||||
this.isOk = false
|
||||
this.message = ""
|
||||
this.results = []
|
||||
|
||||
this.before = function () {
|
||||
this.isRequesting = true
|
||||
this.isOk = false
|
||||
this.message = ""
|
||||
this.results = []
|
||||
}
|
||||
|
||||
this.success = function (resp) {
|
||||
this.isOk = true
|
||||
this.results = resp.data.results
|
||||
}
|
||||
|
||||
this.fail = function (resp) {
|
||||
this.message = resp.message
|
||||
}
|
||||
|
||||
this.done = function () {
|
||||
this.isRequesting = false
|
||||
}
|
||||
});
|
||||
40
web/views/@default/servers/components/cache/purge.html
vendored
Normal file
40
web/views/@default/servers/components/cache/purge.html
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
{$layout}
|
||||
{$template "/left_menu"}
|
||||
|
||||
<div class="right-box">
|
||||
{$template "policy_menu"}
|
||||
|
||||
<h3>选择集群</h3>
|
||||
<select class="ui dropdown auto-width" v-model="clusterId">
|
||||
<option v-for="cluster in clusters" :value="cluster.id">{{cluster.name}}</option>
|
||||
</select>
|
||||
<div class="ui divider"></div>
|
||||
|
||||
<h3>批量删除</h3>
|
||||
<p class="comment">可以批量删除一组Key。</p>
|
||||
<form class="ui form" data-tea-action="$" data-tea-before="before" data-tea-success="success" data-tea-fail="fail" data-tea-done="done">
|
||||
<input type="hidden" name="cachePolicyId" :value="cachePolicyId"/>
|
||||
<input type="hidden" name="clusterId" :value="clusterId"/>
|
||||
<table class="ui table definition selectable">
|
||||
<tr>
|
||||
<td>Key列表</td>
|
||||
<td>
|
||||
<textarea name="keys" rows="10" ref="focus"></textarea>
|
||||
<p class="comment">每行一个Key。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="title">操作结果</td>
|
||||
<td>
|
||||
<div v-if="isRequesting">数据发送中...</div>
|
||||
<span class="red" v-if="!isRequesting && !isOk && message.length > 0">失败:{{message}}</span>
|
||||
<div v-if="!isRequesting && isOk">
|
||||
<span v-if="results.length == 0" class="red">此集群下没有任何可用的节点。</span>
|
||||
<div class="ui label tiny" v-for="one in results" :class="{green:one.isOk, red:!one.isOk}" style="margin-bottom: 0.5em">{{one.nodeName}}:{{one.message}}</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<submit-btn v-if="!isRequesting">提交</submit-btn>
|
||||
</form>
|
||||
</div>
|
||||
34
web/views/@default/servers/components/cache/purge.js
vendored
Normal file
34
web/views/@default/servers/components/cache/purge.js
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
Tea.context(function () {
|
||||
if (this.clusterId == null) {
|
||||
if (this.clusters.length > 0) {
|
||||
this.clusterId = this.clusters[0].id
|
||||
} else {
|
||||
this.clusterId = 0
|
||||
}
|
||||
}
|
||||
|
||||
this.isRequesting = false
|
||||
this.isOk = false
|
||||
this.message = ""
|
||||
this.results = []
|
||||
|
||||
this.before = function () {
|
||||
this.isRequesting = true
|
||||
this.isOk = false
|
||||
this.message = ""
|
||||
this.results = []
|
||||
}
|
||||
|
||||
this.success = function (resp) {
|
||||
this.isOk = true
|
||||
this.results = resp.data.results
|
||||
}
|
||||
|
||||
this.fail = function (resp) {
|
||||
this.message = resp.message
|
||||
}
|
||||
|
||||
this.done = function () {
|
||||
this.isRequesting = false
|
||||
}
|
||||
});
|
||||
34
web/views/@default/servers/components/cache/stat.html
vendored
Normal file
34
web/views/@default/servers/components/cache/stat.html
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
{$layout}
|
||||
{$template "/left_menu"}
|
||||
|
||||
<div class="right-box">
|
||||
{$template "policy_menu"}
|
||||
|
||||
<h3>选择集群</h3>
|
||||
<select class="ui dropdown auto-width" v-model="clusterId">
|
||||
<option v-for="cluster in clusters" :value="cluster.id">{{cluster.name}}</option>
|
||||
</select>
|
||||
|
||||
<div class="ui divider"></div>
|
||||
|
||||
<h3>统计</h3>
|
||||
<form data-tea-action="$" data-tea-before="before" data-tea-success="success" data-tea-fail="fail" data-tea-done="done">
|
||||
<input type="hidden" name="cachePolicyId" :value="cachePolicyId"/>
|
||||
<input type="hidden" name="clusterId" :value="clusterId"/>
|
||||
|
||||
<table class="ui table definition selectable">
|
||||
<tr>
|
||||
<td class="title">操作结果</td>
|
||||
<td>
|
||||
<div v-if="isRequesting">数据发送中...</div>
|
||||
<span class="red" v-if="!isRequesting && !isOk && message.length > 0">失败:{{message}}</span>
|
||||
<div v-if="!isRequesting && isOk">
|
||||
<span v-if="results.length == 0" class="red">此集群下没有任何可用的节点。</span>
|
||||
<div class="ui label tiny" v-for="one in results" :class="{green:one.isOk, red:!one.isOk}" style="margin-bottom: 0.5em">{{one.nodeName}}:{{one.message}}</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<submit-btn v-if="!isRequesting">提交</submit-btn>
|
||||
</form>
|
||||
</div>
|
||||
34
web/views/@default/servers/components/cache/stat.js
vendored
Normal file
34
web/views/@default/servers/components/cache/stat.js
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
Tea.context(function () {
|
||||
if (this.clusterId == null) {
|
||||
if (this.clusters.length > 0) {
|
||||
this.clusterId = this.clusters[0].id
|
||||
} else {
|
||||
this.clusterId = 0
|
||||
}
|
||||
}
|
||||
|
||||
this.isRequesting = false
|
||||
this.isOk = false
|
||||
this.message = ""
|
||||
this.results = []
|
||||
|
||||
this.before = function () {
|
||||
this.isRequesting = true
|
||||
this.isOk = false
|
||||
this.message = ""
|
||||
this.results = []
|
||||
}
|
||||
|
||||
this.success = function (resp) {
|
||||
this.isOk = true
|
||||
this.results = resp.data.results
|
||||
}
|
||||
|
||||
this.fail = function (resp) {
|
||||
this.message = resp.message
|
||||
}
|
||||
|
||||
this.done = function () {
|
||||
this.isRequesting = false
|
||||
}
|
||||
});
|
||||
@@ -1,8 +1,10 @@
|
||||
Tea.context(function () {
|
||||
if (this.clusters.length > 0) {
|
||||
this.clusterId = this.clusters[0].id
|
||||
} else {
|
||||
this.clusterId = 0
|
||||
if (this.clusterId == null) {
|
||||
if (this.clusters.length > 0) {
|
||||
this.clusterId = this.clusters[0].id
|
||||
} else {
|
||||
this.clusterId = 0
|
||||
}
|
||||
}
|
||||
|
||||
this.isRequestingWrite = false
|
||||
|
||||
Reference in New Issue
Block a user