mirror of
https://github.com/Buriburizaem0n/nezha_domains.git
synced 2026-02-04 20:50:06 +00:00
🔊 v0.3.0 计划任务(定期备份等场景)
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
<script src="https://cdn.jsdelivr.net/npm/semantic-ui@2.4.1/dist/semantic.min.js"></script>
|
||||
<script src="/static/semantic-ui-alerts.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/vue@2.6.12/dist/vue.min.js"></script>
|
||||
<script src="/static/main.js?v202101132218"></script>
|
||||
<script src="/static/main.js?v202101190958"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
{{if .IsAdminPage}}
|
||||
<a class="item{{if eq .MatchedPath " /server"}} active{{end}}" href="/server">服务器</a>
|
||||
<a class="item{{if eq .MatchedPath " /monitor"}} active{{end}}" href="/monitor">服务监控</a>
|
||||
<a class="item{{if eq .MatchedPath " /cron"}} active{{end}}" href="/cron">计划任务</a>
|
||||
<a class="item{{if eq .MatchedPath " /notification"}} active{{end}}" href="/notification">通知</a>
|
||||
<a class="item{{if eq .MatchedPath " /setting"}} active{{end}}" href="/setting">设置</a>
|
||||
{{else}}
|
||||
|
||||
45
resource/template/component/cron.html
Normal file
45
resource/template/component/cron.html
Normal file
@@ -0,0 +1,45 @@
|
||||
{{define "component/cron"}}
|
||||
<div class="ui tiny cron modal transition hidden">
|
||||
<div class="header">添加计划任务</div>
|
||||
<div class="content">
|
||||
<form id="cronForm" class="ui form">
|
||||
<input type="hidden" name="ID">
|
||||
<div class="field">
|
||||
<label>备注</label>
|
||||
<input type="text" name="Name" placeholder="备份">
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>计划</label>
|
||||
<input type="text" name="Scheduler" placeholder="* * 3 * *(每天3点)">
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>命令</label>
|
||||
<textarea name="Command"></textarea>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>执行服务器ID列表</label>
|
||||
<input type="text" name="ServersRaw" placeholder="[10,7,19]">
|
||||
</div>
|
||||
<div class="field">
|
||||
<div class="ui push-successful checkbox">
|
||||
<input name="PushSuccessful" type="checkbox" tabindex="0" class="hidden">
|
||||
<label>推送成功的消息</label>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<div class="ui warning message">
|
||||
<p>
|
||||
计划的格式为:<code>* * * * *</code> 分 时 天 月 星期,详情见 <a
|
||||
href="https://pkg.go.dev/github.com/robfig/cron/v3#hdr-CRON_Expression_Format" target="_blank">计划表达式格式</a><br>
|
||||
命令:Shell 命令,就像写脚本一样就可以,如果遇到 xxx 命令找不到,可能是 <code>PATH</code> 环境变量的问题,<code>source ~/.bashrc</code>
|
||||
或者使用绝对路径执行。
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class=" actions">
|
||||
<div class="ui negative button">取消</div>
|
||||
<button class="ui positive right labeled icon button">确认<i class="checkmark icon"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
57
resource/template/dashboard/cron.html
Normal file
57
resource/template/dashboard/cron.html
Normal file
@@ -0,0 +1,57 @@
|
||||
{{define "dashboard/cron"}}
|
||||
{{template "common/header" .}}
|
||||
{{template "common/menu" .}}
|
||||
<div class="nb-container">
|
||||
<div class="ui container">
|
||||
<div class="ui grid">
|
||||
<div class="right floated right aligned twelve wide column">
|
||||
<button class="ui right labeled positive icon button" onclick="addOrEditCron()"><i class="add icon"></i>
|
||||
添加计划任务
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<table class="ui very basic table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>备注</th>
|
||||
<th>计划</th>
|
||||
<th>命令</th>
|
||||
<th>成功推送</th>
|
||||
<th>执行者</th>
|
||||
<th>最后执行</th>
|
||||
<th>最后结果</th>
|
||||
<th>管理</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{range $cron := .Crons}}
|
||||
<tr>
|
||||
<td>{{$cron.ID}}</td>
|
||||
<td>{{$cron.Name}}</td>
|
||||
<td>{{$cron.Scheduler}}</td>
|
||||
<td>{{$cron.Command}}</td>
|
||||
<td>{{$cron.PushSuccessful}}</td>
|
||||
<td>{{$cron.ServersRaw}}</td>
|
||||
<td>{{$cron.LastExecutedAt|tf}}</td>
|
||||
<td>{{$cron.LastResult}}</td>
|
||||
<td>
|
||||
<div class="ui mini icon buttons">
|
||||
<button class="ui button" onclick="addOrEditCron({{$cron}})">
|
||||
<i class="edit icon"></i>
|
||||
</button>
|
||||
<button class="ui button"
|
||||
onclick="showConfirm('删除计划任务','确认删除此计划任务?',deleteRequest,'/api/cron/'+{{$cron.ID}})">
|
||||
<i class="delete icon"></i>
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{{end}}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
{{template "component/cron"}}
|
||||
{{template "common/footer" .}}
|
||||
{{end}}
|
||||
Reference in New Issue
Block a user