任务列表改为table布局显示

pull/21/merge
ouqiang 2017-05-18 12:00:55 +08:00
parent 8779b3ad8b
commit 5e8f2da70e
1 changed files with 45 additions and 38 deletions

View File

@ -41,7 +41,7 @@
<div class="field">
<select name="status">
<option value="0"></option>
<option value="1" {{{if eq .Params.Status 0}}}selected{{{end}}} ></option>
<option value="1" {{{if eq .Params.Status 0}}}selected{{{end}}} ></option>
<option value="2" {{{if eq .Params.Status 1}}}selected{{{end}}}></option>
</select>
</div>
@ -50,43 +50,50 @@
</div>
</div>
</form>
<div class="task-list">
{{{range $i, $v := .Tasks}}}
<div class="ui device two column middle aligned vertical grid segment">
<div class="column verborder">
<div class="ui info segment">
<h5 class="ui header">{{{.Task.Name}}} {{{if eq .Status 1}}}<i class="large checkmark blue icon"></i> {{{else}}} <i class="large red minus icon"></i> {{{end}}}
</h5>
<p>ID <span class="stress">{{{.Id}}}</span></p>
<p> <span class="stress">{{{if eq .Status 1}}}{{{else}}}{{{end}}}</span></p>
<p>cron {{{.Spec}}}</p>
<p>: {{{if eq .Protocol 1}}} HTTP {{{else if eq .Protocol 2}}} SSH {{{else if eq .Protocol 3}}}{{{end}}}</p>
<p class="sensorStatus">{{{.Command}}}</p>
<p class="sensorStatus">{{{if eq .Timeout -1}}}{{{else if gt .Timeout 0}}}{{{.Timeout}}}{{{else}}}{{{end}}}</p>
<p>: {{{.RetryTimes}}}</p>
<p class="sensorStatus">{{{if gt .Multi 0}}}{{{else}}}{{{end}}}</p>
{{{if eq .Protocol 2}}}
<p>: {{{.Alias}}}-{{{.Name}}}</p>
{{{end}}}
<p>: {{{.Remark}}}</p>
</div>
</div>
<div class="center aligned column">
<div class="ui buttons operation">
<a class="ui purple button" href="/task/edit/{{{.Id}}}"></a>
{{{if eq .Status 1}}}
<button class="ui primary button" @click="changeStatus({{{.Id}}},{{{.Status}}})"></button>
{{{else}}}
<button class="ui blue button" @click="changeStatus({{{.Id}}},{{{.Status}}})"> </button>
{{{end}}}
<button class="ui positive button" @click="remove({{{.Id}}})"></button> <br>
<button class="ui twitter button" @click="run({{{.Id}}})"></button>
<a class="ui instagram button" href="/task/log?task_id={{{.Id}}}"></a>
</div>
</div>
</div>
{{{end}}}
</div>
<table class="ui pink table task-list">
<thead>
<tr>
<th>ID</th>
<th></th>
<th>cron</th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
{{{range $i, $v := .Tasks}}}
<tr>
<td>{{{.Id}}}</td>
<td>{{{.Task.Name}}}</td>
<td>{{{.Spec}}}</td>
<td>{{{if eq .Protocol 1}}} HTTP {{{else if eq .Protocol 2}}} SSH {{{else if eq .Protocol 3}}}{{{end}}}</td>
<td>{{{if eq .Timeout -1}}}{{{else if gt .Timeout 0}}}{{{.Timeout}}}{{{else}}}{{{end}}}</td>
<td>{{{.RetryTimes}}}</td>
<td>{{{if gt .Multi 0}}}{{{else}}}{{{end}}}</td>
<td>{{{.Alias}}}-{{{.Name}}}</td>
<td>{{{if eq .Status 1}}}<span style="color: green;"></span>{{{else}}}<span style="color: red;"><span>{{{end}}}</td>
<td>
<div class="ui buttons operation">
<a class="ui purple button" href="/task/edit/{{{.Id}}}"></a>
{{{if eq .Status 1}}}
<button class="ui primary button" @click="changeStatus({{{.Id}}},{{{.Status}}})"></button>
{{{else}}}
<button class="ui blue button" @click="changeStatus({{{.Id}}},{{{.Status}}})"> </button>
{{{end}}}
<button class="ui positive button" @click="remove({{{.Id}}})"></button> <br>
<button class="ui twitter button" @click="run({{{.Id}}})"></button>
<a class="ui instagram button" href="/task/log?task_id={{{.Id}}}"></a>
</div>
</td>
</tr>
{{{end}}}
</tbody>
</table>
{{{ template "common/pagination" .}}}
</div>
</div>