blob: 799960ed1c550f6389c97befe725d8237d446058 [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>
</tbody>
{{- /* gotype: golang.org/x/build/internal/relui.ScheduleEntry */ -}}
{{range $schedule := .Schedules}}
<tr class="WorkflowList-item">
<td class="WorkflowList-itemState">
{{if ne $schedule.LastRun.WorkflowError.String ""}}
<img
class="WorkflowList-itemStateIcon"
alt="{{$schedule.LastRun.WorkflowError.String}}"
src="{{baseLink "/static/images/error_red_24dp.svg"}}" />
{{else if $schedule.LastRun.WorkflowFinished.Bool}}
<img
class="WorkflowList-itemStateIcon"
alt="finished"
src="{{baseLink "/static/images/check_circle_green_24dp.svg"}}" />
{{else if not $schedule.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">
{{with $schedule.WorkflowJob}}
{{.Schedule.WorkflowName}}
{{end}}
</td>
<td class="WorkflowList-itemCreated">
{{if not $schedule.Next.IsZero}}
{{$schedule.Next.UTC.Format "Mon, 02 Jan 2006 15:04:05 MST"}}
{{end}}
</td>
<td class="WorkflowList-itemUpdated">
{{if not $schedule.LastRun.WorkflowCreatedAt.Time.IsZero }}
<a href="{{baseLink "/workflows/" $schedule.LastRun.WorkflowID.String}}">
{{$schedule.LastRun.WorkflowCreatedAt.Time.UTC.Format "Mon, 02 Jan 2006 15:04:05 MST"}}
</a>
{{else if not $schedule.Prev.IsZero}}
{{$schedule.Prev.UTC.Format "Mon, 02 Jan 2006 15:04:05 MST"}}
{{end}}
</td>
<td class="WorkflowList-itemAction">
<div class="WorkflowList-deleteSchedule">
<form action="{{baseLink (printf "/schedules/%d/delete" $schedule.WorkflowJob.Schedule.ID)}}" method="post">
<input type="hidden" name="schedule.id" value="{{$schedule.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}}
</table>
<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}}