mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-10 17:30:29 +08:00
自动更新缓存任务执行状况/优化缓存相关文字提示
This commit is contained in:
@@ -16,7 +16,7 @@ func init() {
|
|||||||
GetPost("", new(IndexAction)).
|
GetPost("", new(IndexAction)).
|
||||||
GetPost("/fetch", new(FetchAction)).
|
GetPost("/fetch", new(FetchAction)).
|
||||||
Get("/tasks", new(TasksAction)).
|
Get("/tasks", new(TasksAction)).
|
||||||
Get("/task", new(TaskAction)).
|
GetPost("/task", new(TaskAction)).
|
||||||
Post("/deleteTask", new(DeleteTaskAction)).
|
Post("/deleteTask", new(DeleteTaskAction)).
|
||||||
Post("/resetTask", new(ResetTaskAction)).
|
Post("/resetTask", new(ResetTaskAction)).
|
||||||
EndAll()
|
EndAll()
|
||||||
|
|||||||
@@ -29,14 +29,32 @@ func (this *TaskAction) RunGet(params struct {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
taskResp, err := this.RPC().HTTPCacheTaskRPC().FindEnabledHTTPCacheTask(this.AdminContext(), &pb.FindEnabledHTTPCacheTaskRequest{HttpCacheTaskId: params.TaskId})
|
if !this.readTask(params.TaskId) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
this.Show()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *TaskAction) RunPost(params struct {
|
||||||
|
TaskId int64
|
||||||
|
}) {
|
||||||
|
if !this.readTask(params.TaskId) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.Success()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 读取任务信息
|
||||||
|
func (this *TaskAction) readTask(taskId int64) (ok bool) {
|
||||||
|
taskResp, err := this.RPC().HTTPCacheTaskRPC().FindEnabledHTTPCacheTask(this.AdminContext(), &pb.FindEnabledHTTPCacheTaskRequest{HttpCacheTaskId: taskId})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
this.ErrorPage(err)
|
this.ErrorPage(err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
var task = taskResp.HttpCacheTask
|
var task = taskResp.HttpCacheTask
|
||||||
if task == nil {
|
if task == nil {
|
||||||
this.NotFound("HTTPCacheTask", params.TaskId)
|
this.NotFound("HTTPCacheTask", taskId)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -101,5 +119,6 @@ func (this *TaskAction) RunGet(params struct {
|
|||||||
"user": userMap,
|
"user": userMap,
|
||||||
}
|
}
|
||||||
|
|
||||||
this.Show()
|
ok = true
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,10 +5,10 @@
|
|||||||
<csrf-token></csrf-token>
|
<csrf-token></csrf-token>
|
||||||
<table class="ui table definition selectable">
|
<table class="ui table definition selectable">
|
||||||
<tr>
|
<tr>
|
||||||
<td>要预热的Key列表</td>
|
<td>要预热的URL列表</td>
|
||||||
<td>
|
<td>
|
||||||
<textarea name="keys" rows="10" ref="focus"></textarea>
|
<textarea name="keys" rows="10" ref="focus"></textarea>
|
||||||
<p class="comment">每行一个Key。</p>
|
<p class="comment">每行一个URL。</p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
|||||||
@@ -7,21 +7,21 @@
|
|||||||
<csrf-token></csrf-token>
|
<csrf-token></csrf-token>
|
||||||
<table class="ui table definition selectable">
|
<table class="ui table definition selectable">
|
||||||
<tr>
|
<tr>
|
||||||
<td class="title">缓存Key类型</td>
|
<td class="title">URL类型</td>
|
||||||
<td>
|
<td>
|
||||||
<radio name="keyType" :v-value="'key'" v-model="keyType">根据Key</radio>
|
<radio name="keyType" :v-value="'key'" v-model="keyType">URL</radio>
|
||||||
<radio name="keyType" :v-value="'prefix'" v-model="keyType">根据前缀</radio>
|
<radio name="keyType" :v-value="'prefix'" v-model="keyType">目录</radio>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<span v-if="keyType == 'key'">要刷新的Key列表</span>
|
<span v-if="keyType == 'key'">要刷新的URL列表</span>
|
||||||
<span v-if="keyType == 'prefix'">要刷新的Key前缀列表</span>
|
<span v-if="keyType == 'prefix'">要刷新的URL目录列表</span>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<textarea name="keys" rows="10" ref="keysBox"></textarea>
|
<textarea name="keys" rows="10" ref="keysBox"></textarea>
|
||||||
<p class="comment" v-if="keyType == 'key'">每行一个Key,比如是一个完整的URL<code-label>https://example.com/hello/world.html</code-label>。</p>
|
<p class="comment" v-if="keyType == 'key'">每行一个URL,比如<code-label>https://example.com/hello/world.html</code-label>。</p>
|
||||||
<p class="comment" v-if="keyType == 'prefix'">每行一个Key前缀,比如是一个URL前缀<code-label>https://example.com/hello/</code-label>。</p>
|
<p class="comment" v-if="keyType == 'prefix'">每行一个URL目录,比如<code-label>https://example.com/hello/</code-label>。</p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
|||||||
@@ -20,10 +20,10 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Key类型</td>
|
<td>缓存URL类型</td>
|
||||||
<td>
|
<td>
|
||||||
<span v-if="task.keyType == 'key'">URL</span>
|
<span v-if="task.keyType == 'key'">URL</span>
|
||||||
<span v-if="task.keyType == 'prefix'">前缀</span>
|
<span v-if="task.keyType == 'prefix'">目录</span>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
|||||||
@@ -1,4 +1,8 @@
|
|||||||
Tea.context(function () {
|
Tea.context(function () {
|
||||||
|
this.$delay(function () {
|
||||||
|
this.reload()
|
||||||
|
})
|
||||||
|
|
||||||
this.deleteTask = function (taskId) {
|
this.deleteTask = function (taskId) {
|
||||||
teaweb.confirm("确定要删除此任务吗?", function () {
|
teaweb.confirm("确定要删除此任务吗?", function () {
|
||||||
this.$post(".deleteTask")
|
this.$post(".deleteTask")
|
||||||
@@ -20,4 +24,19 @@ Tea.context(function () {
|
|||||||
.refresh()
|
.refresh()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.reload = function () {
|
||||||
|
this.$post("$")
|
||||||
|
.params({
|
||||||
|
taskId: this.task.id
|
||||||
|
})
|
||||||
|
.success(function (resp) {
|
||||||
|
this.task = resp.data.task
|
||||||
|
})
|
||||||
|
.done(function () {
|
||||||
|
this.$delay(function () {
|
||||||
|
this.reload()
|
||||||
|
}, 10000)
|
||||||
|
})
|
||||||
|
}
|
||||||
})
|
})
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th style="width: 7em">任务编号</th>
|
<th style="width: 7em">任务编号</th>
|
||||||
<th>任务类型</th>
|
<th>任务类型</th>
|
||||||
<th>Key类型</th>
|
<th>URL类型</th>
|
||||||
<th>创建时间</th>
|
<th>创建时间</th>
|
||||||
<th class="four wide">所属用户</th>
|
<th class="four wide">所属用户</th>
|
||||||
<th class="two wide">任务状态</th>
|
<th class="two wide">任务状态</th>
|
||||||
|
|||||||
@@ -5,10 +5,10 @@
|
|||||||
<input type="hidden" name="cachePolicyId" :value="cachePolicyId"/>
|
<input type="hidden" name="cachePolicyId" :value="cachePolicyId"/>
|
||||||
<table class="ui table definition selectable">
|
<table class="ui table definition selectable">
|
||||||
<tr>
|
<tr>
|
||||||
<td>Key列表</td>
|
<td>URL列表</td>
|
||||||
<td>
|
<td>
|
||||||
<textarea name="keys" rows="10" ref="focus"></textarea>
|
<textarea name="keys" rows="10" ref="focus"></textarea>
|
||||||
<p class="comment">每行一个Key。</p>
|
<p class="comment">每行一个URL。</p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
|||||||
@@ -1,26 +1,26 @@
|
|||||||
{$layout}
|
{$layout}
|
||||||
{$template "policy_menu"}
|
{$template "policy_menu"}
|
||||||
|
|
||||||
<p class="comment">可以在这里批量删除一组Key。</p>
|
<p class="comment">可以在这里批量刷新一组URL。</p>
|
||||||
<form method="post" 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="300">
|
<form method="post" 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="300">
|
||||||
<input type="hidden" name="cachePolicyId" :value="cachePolicyId"/>
|
<input type="hidden" name="cachePolicyId" :value="cachePolicyId"/>
|
||||||
<table class="ui table definition selectable">
|
<table class="ui table definition selectable">
|
||||||
<tr>
|
<tr>
|
||||||
<td class="title">操作类型</td>
|
<td class="title">URL类型</td>
|
||||||
<td>
|
<td>
|
||||||
<radio name="keyType" :v-value="'key'" v-model="keyType">根据Key</radio>
|
<radio name="keyType" :v-value="'key'" v-model="keyType">URL</radio>
|
||||||
<radio name="keyType" :v-value="'prefix'" v-model="keyType">根据前缀</radio>
|
<radio name="keyType" :v-value="'prefix'" v-model="keyType">目录</radio>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<span v-if="keyType == 'key'">Key列表</span>
|
<span v-if="keyType == 'key'">URL</span>
|
||||||
<span v-if="keyType == 'prefix'">Key前缀列表</span>
|
<span v-if="keyType == 'prefix'">目录</span>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<textarea name="keys" rows="10" ref="keysBox"></textarea>
|
<textarea name="keys" rows="10" ref="keysBox"></textarea>
|
||||||
<p class="comment" v-if="keyType == 'key'">每行一个Key,比如是一个完整的URL<code-label>https://example.com/hello/world.html</code-label>。</p>
|
<p class="comment" v-if="keyType == 'key'">每行一个URL,比如<code-label>https://example.com/hello/world.html</code-label>。</p>
|
||||||
<p class="comment" v-if="keyType == 'prefix'">每行一个Key前缀,比如是一个URL前缀<code-label>https://example.com/hello/</code-label>。</p>
|
<p class="comment" v-if="keyType == 'prefix'">每行一个URL目录,比如<code-label>https://example.com/hello/</code-label>。</p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
|||||||
@@ -9,16 +9,16 @@
|
|||||||
<p class="comment">没有开启缓存,不需要清理。</p>
|
<p class="comment">没有开启缓存,不需要清理。</p>
|
||||||
</div>
|
</div>
|
||||||
<div v-show="webConfig.cache != null && webConfig.cache.isOn">
|
<div v-show="webConfig.cache != null && webConfig.cache.isOn">
|
||||||
<p class="comment">可以在这里批量预热一组Key。</p>
|
<p class="comment">可以在这里批量预热一组缓存URL。</p>
|
||||||
<form method="post" 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">
|
<form method="post" 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="serverId" :value="serverId"/>
|
<input type="hidden" name="serverId" :value="serverId"/>
|
||||||
<input type="hidden" name="webId" :value="webId"/>
|
<input type="hidden" name="webId" :value="webId"/>
|
||||||
<table class="ui table definition selectable">
|
<table class="ui table definition selectable">
|
||||||
<tr>
|
<tr>
|
||||||
<td>Key列表</td>
|
<td>URL列表</td>
|
||||||
<td>
|
<td>
|
||||||
<textarea name="keys" rows="10" ref="focus"></textarea>
|
<textarea name="keys" rows="10" ref="focus"></textarea>
|
||||||
<p class="comment">每行一个Key。</p>
|
<p class="comment">每行一个URL。</p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
|||||||
@@ -18,19 +18,19 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td class="title">操作类型</td>
|
<td class="title">操作类型</td>
|
||||||
<td>
|
<td>
|
||||||
<radio name="keyType" :v-value="'key'" v-model="keyType">根据Key</radio>
|
<radio name="keyType" :v-value="'key'" v-model="keyType">URL</radio>
|
||||||
<radio name="keyType" :v-value="'prefix'" v-model="keyType">根据前缀</radio>
|
<radio name="keyType" :v-value="'prefix'" v-model="keyType">目录</radio>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<span v-if="keyType == 'key'">Key列表</span>
|
<span v-if="keyType == 'key'">URL</span>
|
||||||
<span v-if="keyType == 'prefix'">Key前缀列表</span>
|
<span v-if="keyType == 'prefix'">目录</span>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<textarea name="keys" rows="10" ref="keysBox"></textarea>
|
<textarea name="keys" rows="10" ref="keysBox"></textarea>
|
||||||
<p class="comment" v-if="keyType == 'key'">每行一个Key,比如是一个完整的URL<code-label>https://example.com/hello/world.html</code-label>。</p>
|
<p class="comment" v-if="keyType == 'key'">每行一个URL,比如<code-label>https://example.com/hello/world.html</code-label>。</p>
|
||||||
<p class="comment" v-if="keyType == 'prefix'">每行一个Key前缀,比如是一个URL前缀<code-label>https://example.com/hello/</code-label>。</p>
|
<p class="comment" v-if="keyType == 'prefix'">每行一个URL目录,比如<code-label>https://example.com/hello/</code-label>。</p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
|||||||
@@ -10,16 +10,16 @@
|
|||||||
<p class="comment">没有开启缓存,暂时无法预热缓存。</p>
|
<p class="comment">没有开启缓存,暂时无法预热缓存。</p>
|
||||||
</div>
|
</div>
|
||||||
<div v-show="webConfig.cache != null && webConfig.cache.isOn">
|
<div v-show="webConfig.cache != null && webConfig.cache.isOn">
|
||||||
<p class="comment">可以在这里批量预热一组Key。</p>
|
<p class="comment">可以在这里批量预热一组URL。</p>
|
||||||
<form method="post" 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">
|
<form method="post" 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="serverId" :value="serverId"/>
|
<input type="hidden" name="serverId" :value="serverId"/>
|
||||||
<input type="hidden" name="webId" :value="webId"/>
|
<input type="hidden" name="webId" :value="webId"/>
|
||||||
<table class="ui table definition selectable">
|
<table class="ui table definition selectable">
|
||||||
<tr>
|
<tr>
|
||||||
<td>Key列表</td>
|
<td>URL列表</td>
|
||||||
<td>
|
<td>
|
||||||
<textarea name="keys" rows="10" ref="focus"></textarea>
|
<textarea name="keys" rows="10" ref="focus"></textarea>
|
||||||
<p class="comment">每行一个Key。</p>
|
<p class="comment">每行一个URL。</p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
|||||||
@@ -7,31 +7,31 @@
|
|||||||
|
|
||||||
<div class="margin"></div>
|
<div class="margin"></div>
|
||||||
<div v-show="webConfig.cache == null || !webConfig.cache.isOn">
|
<div v-show="webConfig.cache == null || !webConfig.cache.isOn">
|
||||||
<p class="comment">没有开启缓存,不需要清理。</p>
|
<p class="comment">没有开启缓存,不需要刷新。</p>
|
||||||
</div>
|
</div>
|
||||||
<div v-show="webConfig.cache != null && webConfig.cache.isOn">
|
<div v-show="webConfig.cache != null && webConfig.cache.isOn">
|
||||||
<p class="comment">可以在这里批量删除一组Key。</p>
|
<p class="comment">可以在这里批量刷新一组URL缓存。</p>
|
||||||
|
|
||||||
<form method="post" 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="300">
|
<form method="post" 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="300">
|
||||||
<input type="hidden" name="serverId" :value="serverId"/>
|
<input type="hidden" name="serverId" :value="serverId"/>
|
||||||
<input type="hidden" name="webId" :value="webId"/>
|
<input type="hidden" name="webId" :value="webId"/>
|
||||||
<table class="ui table definition selectable">
|
<table class="ui table definition selectable">
|
||||||
<tr>
|
<tr>
|
||||||
<td class="title">操作类型</td>
|
<td class="title">URL类型</td>
|
||||||
<td>
|
<td>
|
||||||
<radio name="keyType" :v-value="'key'" v-model="keyType">根据Key</radio>
|
<radio name="keyType" :v-value="'key'" v-model="keyType">URL</radio>
|
||||||
<radio name="keyType" :v-value="'prefix'" v-model="keyType">根据前缀</radio>
|
<radio name="keyType" :v-value="'prefix'" v-model="keyType">目录</radio>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<span v-if="keyType == 'key'">Key列表</span>
|
<span v-if="keyType == 'key'">URL</span>
|
||||||
<span v-if="keyType == 'prefix'">Key前缀列表</span>
|
<span v-if="keyType == 'prefix'">目录</span>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<textarea name="keys" rows="10" ref="keysBox"></textarea>
|
<textarea name="keys" rows="10" ref="keysBox"></textarea>
|
||||||
<p class="comment" v-if="keyType == 'key'">每行一个Key,比如是一个完整的URL<code-label>https://example.com/hello/world.html</code-label>。</p>
|
<p class="comment" v-if="keyType == 'key'">每行一个URL,比如<code-label>https://example.com/hello/world.html</code-label>。</p>
|
||||||
<p class="comment" v-if="keyType == 'prefix'">每行一个Key前缀,比如是一个URL前缀<code-label>https://example.com/hello/</code-label>。</p>
|
<p class="comment" v-if="keyType == 'prefix'">每行一个URL目录,比如<code-label>https://example.com/hello/</code-label>。</p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
|||||||
Reference in New Issue
Block a user