mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-12 11:20:27 +08:00
实现缓存策略部分管理功能
This commit is contained in:
74
web/views/@default/servers/components/cache/createPopup.html
vendored
Normal file
74
web/views/@default/servers/components/cache/createPopup.html
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
{$layout "layout_popup"}
|
||||
|
||||
<h3>创建缓存策略</h3>
|
||||
|
||||
<form class="ui form" data-tea-action="$" data-tea-success="success">
|
||||
<table class="ui table definition selectable">
|
||||
<tr>
|
||||
<td class="title">策略名称 *</td>
|
||||
<td><input type="text" name="name" maxlength="100" ref="focus"/> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>缓存类型 *</td>
|
||||
<td>
|
||||
<select class="ui dropdown auto-width" name="type" v-model="policyType">
|
||||
<option v-for="type in types" :value="type.type">{{type.name}}</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<!-- 文件缓存选项 -->
|
||||
<tbody v-if="policyType == 'file'">
|
||||
<tr>
|
||||
<td>缓存目录 *</td>
|
||||
<td>
|
||||
<input type="text" name="fileDir" maxlength="500"/>
|
||||
<p class="comment">存放文件缓存的目录,通常填写绝对路径。</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
||||
|
||||
<tr>
|
||||
<td>缓存最大容量</td>
|
||||
<td>
|
||||
<size-capacity-box :v-name="'capacityJSON'" :v-count="0" :v-unit="'gb'"></size-capacity-box>
|
||||
<p class="comment">允许缓存的最大内容长度,如果为0表示没有限制。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2"><more-options-indicator></more-options-indicator></td>
|
||||
</tr>
|
||||
<tbody v-show="moreOptionsVisible">
|
||||
<tr>
|
||||
<td>最大内容长度</td>
|
||||
<td>
|
||||
<size-capacity-box :v-name="'maxSizeJSON'" :v-count="32" :v-unit="'mb'"></size-capacity-box>
|
||||
<p class="comment">允许缓存的最大内容长度,如果为0表示没有限制。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>容纳Key数量</td>
|
||||
<td>
|
||||
<input type="text" name="maxKeys" maxlength="10" style="width:10em"/>
|
||||
<p class="comment">可以容纳多少数量的Key,0表示不限制。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>描述</td>
|
||||
<td>
|
||||
<textarea maxlength="200" name="description" rows="3"></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>是否启用</td>
|
||||
<td>
|
||||
<div class="ui checkbox">
|
||||
<input type="checkbox" name="isOn" value="1" checked="checked"/>
|
||||
<label></label>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<submit-btn></submit-btn>
|
||||
</form>
|
||||
5
web/views/@default/servers/components/cache/createPopup.js
vendored
Normal file
5
web/views/@default/servers/components/cache/createPopup.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
Tea.context(function () {
|
||||
this.success = NotifyPopup
|
||||
|
||||
this.policyType = this.types[0].type
|
||||
})
|
||||
@@ -2,5 +2,38 @@
|
||||
{$template "/left_menu"}
|
||||
|
||||
<div class="right-box">
|
||||
<p class="ui message">此功能暂未开放敬请期待。</p>
|
||||
<second-menu>
|
||||
<menu-item href="/servers/components/cache" code="index">列表</menu-item>
|
||||
<span class="item">|</span>
|
||||
<a href="" class="item" @click.prevent="createPolicy()">[创建]</a>
|
||||
</second-menu>
|
||||
|
||||
<p class="comment" v-if="cachePolicies.length == 0">暂时还没有缓存策略。</p>
|
||||
<table class="ui table selectable" v-if="cachePolicies.length > 0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>策略名称</th>
|
||||
<th>策略类型</th>
|
||||
<th>容量</th>
|
||||
<th>引用服务</th>
|
||||
<th>状态</th>
|
||||
<th class="three op">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tr v-for="(policy, index) in cachePolicies">
|
||||
<td>{{policy.name}}</td>
|
||||
<td>{{infos[index].typeName}} <span class="small">({{policy.type}})</span></td>
|
||||
<td>
|
||||
<span v-if="policy.capacity != null && policy.capacity.count > 0">{{policy.capacity.count}}{{policy.capacity.unit.toUpperCase()}}</span>
|
||||
<span v-else class="disabled">不限</span>
|
||||
</td>
|
||||
<td>{{infos[index].countServers}}</td>
|
||||
<td><label-on :v-is-on="policy.isOn"></label-on></td>
|
||||
<td>
|
||||
<a :href="'/servers/components/cache/policy?cachePolicyId=' + policy.id">详情</a> <a href="" @click.prevent="updatePolicy(policy.id)">修改</a> <a href="" @click.prevent="deletePolicy(policy.id)">删除</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<div class="page" v-html="page"></div>
|
||||
</div>
|
||||
37
web/views/@default/servers/components/cache/index.js
vendored
Normal file
37
web/views/@default/servers/components/cache/index.js
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
Tea.context(function () {
|
||||
// 创建策略
|
||||
this.createPolicy = function () {
|
||||
teaweb.popup("/servers/components/cache/createPopup", {
|
||||
height: "27em",
|
||||
callback: function () {
|
||||
teaweb.success("保存成功", function () {
|
||||
window.location.reload()
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 修改策略
|
||||
this.updatePolicy = function (policyId) {
|
||||
teaweb.popup("/servers/components/cache/updatePopup?cachePolicyId=" + policyId, {
|
||||
height: "27em",
|
||||
callback: function () {
|
||||
teaweb.success("保存成功", function () {
|
||||
window.location.reload()
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 删除策略
|
||||
this.deletePolicy = function (policyId) {
|
||||
let that = this
|
||||
teaweb.confirm("确定要删除此缓存策略吗?", function () {
|
||||
that.$post("/servers/components/cache/delete")
|
||||
.params({
|
||||
cachePolicyId: policyId
|
||||
})
|
||||
.refresh()
|
||||
})
|
||||
}
|
||||
})
|
||||
76
web/views/@default/servers/components/cache/updatePopup.html
vendored
Normal file
76
web/views/@default/servers/components/cache/updatePopup.html
vendored
Normal file
@@ -0,0 +1,76 @@
|
||||
{$layout "layout_popup"}
|
||||
|
||||
<h3>修改缓存策略</h3>
|
||||
|
||||
<form class="ui form" data-tea-action="$" data-tea-success="success">
|
||||
<input type="hidden" name="cachePolicyId" :value="cachePolicy.id"/>
|
||||
<table class="ui table definition selectable">
|
||||
<tr>
|
||||
<td class="title">策略名称 *</td>
|
||||
<td><input type="text" name="name" maxlength="100" ref="focus" v-model="cachePolicy.name"/> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>缓存类型 *</td>
|
||||
<td>
|
||||
<select class="ui dropdown auto-width" name="type" v-model="policyType">
|
||||
<option v-for="type in types" :value="type.type">{{type.name}}</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<!-- 文件缓存选项 -->
|
||||
<tbody v-if="policyType == 'file'">
|
||||
<tr>
|
||||
<td>缓存目录 *</td>
|
||||
<td>
|
||||
<input type="text" name="fileDir" maxlength="500" v-model="cachePolicy.options.dir"/>
|
||||
<p class="comment">存放文件缓存的目录,通常填写绝对路径。</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
||||
|
||||
<tr>
|
||||
<td>缓存最大容量</td>
|
||||
<td>
|
||||
<size-capacity-box :v-name="'capacityJSON'" :v-value="cachePolicy.capacity" :v-count="0" :v-unit="'gb'"></size-capacity-box>
|
||||
<p class="comment">允许缓存的最大内容长度,如果为0表示没有限制。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2"><more-options-indicator></more-options-indicator></td>
|
||||
</tr>
|
||||
<tbody v-show="moreOptionsVisible">
|
||||
<tr>
|
||||
<td>最大内容长度</td>
|
||||
<td>
|
||||
<size-capacity-box :v-value="cachePolicy.maxSize" :v-name="'maxSizeJSON'" :v-count="32" :v-unit="'mb'"></size-capacity-box>
|
||||
<p class="comment">允许缓存的最大内容长度,如果为0表示没有限制。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>容纳Key数量</td>
|
||||
<td>
|
||||
<input type="text" name="maxKeys" maxlength="10" style="width:10em" v-model="cachePolicy.maxKeys"/>
|
||||
<p class="comment">可以容纳多少数量的Key,0表示不限制。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>描述</td>
|
||||
<td>
|
||||
<textarea maxlength="200" name="description" rows="3" v-model="cachePolicy.description"></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>是否启用</td>
|
||||
<td>
|
||||
<div class="ui checkbox">
|
||||
<input type="checkbox" name="isOn" value="1" v-model="cachePolicy.isOn"/>
|
||||
<label></label>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<submit-btn></submit-btn>
|
||||
</form>
|
||||
5
web/views/@default/servers/components/cache/updatePopup.js
vendored
Normal file
5
web/views/@default/servers/components/cache/updatePopup.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
Tea.context(function () {
|
||||
this.success = NotifyPopup
|
||||
|
||||
this.policyType = this.cachePolicy.type
|
||||
})
|
||||
Reference in New Issue
Block a user