<div class="panel panel-default">
    <div class="panel-body">{{$taskLogs := .taskLogs}}{{$isReturn := .isReturn}}
        <div class="row">
			<div class="col-md-2">
				{{if eq $isReturn "1"}}
				<button class="btn btn-primary" onclick="javascript:history.go(-1);">
					<i class="glyphicon glyphicon-share-alt"></i> 返回
				</button>
				{{end}}
			</div>
			<div class="col-md-6">
				<div class="progress" style="margin-top: 10px; height: 14px">
					<div id="task_progress" class="progress-bar progress-bar-success progress-bar-striped active" role="progressbar"
						 aria-valuenow="0"
						 aria-valuemin="0"
						 aria-valuemax="100"
						 style="min-width: 2em; width: 0%">
						<div id="task_progress_content" style="font-size:10px;line-height:14px;"> 0%</div>
					</div>
				</div>
			</div>
        </div>
    </div>
    <div class="table-responsive">
        <table class="table table-bordered">
            <thead>
            <tr>
                <th class="w13p">节点</th>
				<th>commit_id</th>
				<th class="w10p">执行状态</th>
                <th class="w10p">发布状态</th>
				<th class="w15p">更新时间</th>
				<th class="w10p">执行结果</th>
            </tr>
            </thead>
            <tbody>
			{{range $taskLog := $taskLogs}}
			<tr data-row="{{$taskLog.task_log_id}}">
				<td class="center">{{$taskLog.node_address}}</td>
				<td class="center" data-name="commit_id"><strong class="text-primary">{{$taskLog.commit_id}}</strong></td>
				<td class="center" data-name="status" data-status="{{$taskLog.status}}">
					{{if eq $taskLog.status "0"}}
					<span class="label label-info">创建</span>
					{{else if eq $taskLog.status "1"}}
					<span class="label label-primary">开始</span>
					{{else if eq $taskLog.status "2"}}
					<span class="label label-success">完成</span>
					{{end}}
				</td>
				<td class="center" data-name="is_success" data-success="{{$taskLog.is_success}}">
					{{if eq $taskLog.status "2" }}
						{{if eq $taskLog.is_success "0"}}
						<span class="label label-danger end_failed">失败</span>
						{{else if eq $taskLog.is_success "1"}}
						<span class="label label-success">成功</span>
						{{end}}
					{{else}}
						<img src='/static/style/layui/layer/theme/default/loading-2.gif' style='max-width:17px;'>
					{{end}}
				</td>
				<td class="center" data-name="update_time">{{dateFormat $taskLog.update_time "Y-m-d H:i:s"}}</td>
				<td class="center">
					<a data-toggle="collapse" data-target="#result_{{$taskLog.task_log_id}}" class="">点击查看</a>
				</td>
			</tr>
			<tr class="collapse" id="result_{{$taskLog.task_log_id}}">
				<td colspan="6">
					<div class="well well-sm" style="margin-bottom:0">
						<strong>Result: </strong> <label>{{$taskLog.result}}</label>
					</div>
				</td>
			</tr>
			{{end}}
            </tbody>
        </table>
    </div>
	<div class="panel-footer">
	</div>
</div>
<script src="/static/style/module/task.js"></script>
<script type="text/javascript">
	$(function () {
		Task.updateProgress();
		setInterval('Task.loadTaskLogStatus()', 1500);
	})
</script>
