blob: f4a0d5ebbdbf0484dd6ced5af083628a3c32e683 [file] [log] [blame]
<!--
Copyright 2020 The Go Authors. All rights reserved.
Use of this source code is governed by a BSD-style
license that can be found in the LICENSE file.
-->
{{template "layout" .}}
{{define "content"}}
{{- /* gotype: golang.org/x/build/internal/relui.homeResponse */ -}}
<section class="Workflows">
<div class="Workflows-header">
<h2>
{{if ne .SiteHeader.NameParam "all"}}
{{.SiteHeader.NameParam}}
{{else}}
Workflows
{{end}}
</h2>
<a href="{{baseLink (printf "/new_workflow?workflow.name=%s" .SiteHeader.NameParam)}}" class="Button">New</a>
</div>
<h2>Active Workflows</h2>
{{template "workflow_list" .ActiveWorkflows}}
<h2>Scheduled Workflows</h2>
<table class="WorkflowList">
<thead>
<tr class="WorkflowList-itemHeader">
<th class="WorkflowList-itemHeaderCol WorkflowList-itemStateHeader">State</th>
<th class="WorkflowList-itemHeaderCol WorkflowList-itemName">Name</th>
<th class="WorkflowList-itemHeaderCol WorkflowList-itemCreated">Next Run</th>
<th class="WorkflowList-itemHeaderCol WorkflowList-itemUpdated">Last Run</th>
<th class="WorkflowList-itemHeaderCol WorkflowList-itemActions">Actions</th>
</tr>
</thead>
<tbody>
{{- /* gotype: golang.org/x/build/internal/relui.ScheduleEntry */ -}}
{{range .Schedules}}
<tr class="WorkflowList-item">
<td class="WorkflowList-itemState">
{{if ne .LastRun.WorkflowError.String ""}}
<img class="WorkflowList-itemStateIcon"
alt="{{.LastRun.WorkflowError.String}}"
src="{{baseLink "/static/images/error_red_24dp.svg"}}" />
{{else if .LastRun.WorkflowFinished.Bool}}
<img class="WorkflowList-itemStateIcon"
alt="finished"
src="{{baseLink "/static/images/check_circle_green_24dp.svg"}}" />
{{else if not .LastRun.WorkflowCreatedAt.Time.IsZero }}
<img class="WorkflowList-itemStateIcon"
alt="started"
src="{{baseLink "/static/images/pending_yellow_24dp.svg"}}" />
{{else}}
<img class="WorkflowList-itemStateIcon"
alt="pending"
src="{{baseLink "/static/images/pending_grey_24dp.svg"}}" />
{{end}}
</td>
<td class="WorkflowList-itemName">
<span title="{{.WorkflowJob.ParamDesc}}">{{.WorkflowJob.Schedule.WorkflowName}}</span>
</td>
<td class="WorkflowList-itemCreated">
<span title="{{.WorkflowJob.ScheduleDesc}}">
{{if not .Next.IsZero}}
{{.Next.UTC.Format "Mon, 02 Jan 2006 15:04:05 MST"}}
{{else}}
N/A
{{end}}
</span>
</td>
<td class="WorkflowList-itemUpdated">
{{if not .LastRun.WorkflowCreatedAt.Time.IsZero }}
<a href="{{baseLink "/workflows/" .LastRun.WorkflowID.String}}">
{{.LastRun.WorkflowCreatedAt.Time.UTC.Format "Mon, 02 Jan 2006 15:04:05 MST"}}
</a>
{{else if not .Prev.IsZero}}
{{.Prev.UTC.Format "Mon, 02 Jan 2006 15:04:05 MST"}}
{{else}}
N/A
{{end}}
</td>
<td class="WorkflowList-itemAction">
<div class="WorkflowList-deleteSchedule">
<form action="{{baseLink (printf "/schedules/%d/delete" .WorkflowJob.Schedule.ID)}}" method="post">
<input type="hidden" name="schedule.id" value="{{.WorkflowJob.Schedule.ID}}" />
<input class="Button Button--small"
name="schedule.delete"
type="submit"
value="Delete"
onclick="return this.form.reportValidity() && confirm('This will cancel and permanently delete the schedule.\n\nReady to proceed?')" />
</form>
</div>
</td>
</tr>
{{else}}
<tr>
<td>None</td>
</tr>
{{end}}
</tbody>
</table>
{{with .FailedToSchedule}}
<h2>Failed to Schedule Workflows</h2>
<table class="WorkflowList">
<thead>
<tr class="WorkflowList-itemHeader">
<th class="WorkflowList-itemHeaderCol WorkflowList-itemStateHeader">State</th>
<th class="WorkflowList-itemHeaderCol WorkflowList-itemName">Name</th>
<th class="WorkflowList-itemHeaderCol WorkflowList-itemCreated">Next Run</th>
<th class="WorkflowList-itemHeaderCol WorkflowList-itemUpdated">Last Run</th>
<th class="WorkflowList-itemHeaderCol WorkflowList-itemActions">Actions</th>
</tr>
</thead>
<tbody>
{{- /* gotype: golang.org/x/build/internal/relui.FailedToScheduleEntry */ -}}
{{range .}}
<tr class="WorkflowList-item">
<td class="WorkflowList-itemState">
<img class="WorkflowList-itemStateIcon"
alt="error"
src="{{baseLink "/static/images/error_red_24dp.svg"}}" />
</td>
<td class="WorkflowList-itemName">
<span title="{{.ParamDesc}}">{{.Schedule.WorkflowName}}</span>
</td>
<td class="WorkflowList-itemCreated">
<span title="{{.ScheduleDesc}}">
{{if not .Next.IsZero}}
{{.Next.UTC.Format "Mon, 02 Jan 2006 15:04:05 MST"}}
{{else}}
N/A
{{end}}
</span>
</td>
<td class="WorkflowList-itemUpdated">
{{if not .LastRun.WorkflowCreatedAt.Time.IsZero }}
<a href="{{baseLink "/workflows/" .LastRun.WorkflowID.String}}">
{{.LastRun.WorkflowCreatedAt.Time.UTC.Format "Mon, 02 Jan 2006 15:04:05 MST"}}
</a>
{{else}}
N/A
{{end}}
</td>
<td class="WorkflowList-itemAction">
<div class="WorkflowList-deleteSchedule">
<form action="{{baseLink (printf "/schedules/%d/delete" .Schedule.ID)}}" method="post">
<input type="hidden" name="schedule.id" value="{{.Schedule.ID}}" />
<input class="Button Button--small"
name="schedule.delete"
type="submit"
value="Delete"
onclick="return this.form.reportValidity() && confirm('This will permanently delete the schedule.\n\nReady to proceed?')" />
</form>
</div>
</td>
</tr>
{{else}}
<tr>
<td>None</td>
</tr>
{{end}}
</tbody>
</table>
{{end}}
<h2>Completed Workflows</h2>
{{template "workflow_list" .InactiveWorkflows}}
</section>
{{end}}
{{- /* gotype: []golang.org/x/build/internal/relui/db.Workflow */ -}}
{{define "workflow_list"}}
<table class="WorkflowList">
<thead>
<tr class="WorkflowList-itemHeader">
<th class="WorkflowList-itemHeaderCol WorkflowList-itemStateHeader">State</th>
<th class="WorkflowList-itemHeaderCol WorkflowList-itemName">Name</th>
<th class="WorkflowList-itemHeaderCol WorkflowList-itemCreated">Created</th>
<th class="WorkflowList-itemHeaderCol WorkflowList-itemUpdated">Updated</th>
</tr>
</thead>
<tbody>
{{- /* gotype: golang.org/x/build/internal/relui/db.Workflow */ -}}
{{range .}}
<tr class="WorkflowList-item">
<td class="WorkflowList-itemState">
{{if .Error}}
<img
class="WorkflowList-itemStateIcon"
alt="error"
src="{{baseLink "/static/images/error_red_24dp.svg"}}" />
{{else if .Finished}}
<img
class="WorkflowList-itemStateIcon"
alt="finished"
src="{{baseLink "/static/images/check_circle_green_24dp.svg"}}" />
{{else}}
<img
class="WorkflowList-itemStateIcon"
alt="started"
src="{{baseLink "/static/images/pending_yellow_24dp.svg"}}" />
{{end}}
</td>
<td class="WorkflowList-itemName">
<a href="{{baseLink "/workflows/" .ID.String}}">{{.Name.String}}</a>
</td>
<td class="WorkflowList-itemCreated">
{{.CreatedAt.UTC.Format "Mon, 02 Jan 2006 15:04:05 MST"}}
</td>
<td class="WorkflowList-itemUpdated">
{{.UpdatedAt.UTC.Format "Mon, 02 Jan 2006 15:04:05 MST"}}
</td>
</tr>
{{else}}
<tr>
<td>None</td>
</tr>
{{end}}
</tbody>
</table>
{{end}}