blob: 06543fc6fd38bac44d349544302c06726d60f8bc [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"}}
<section class="NewWorkflow">
<h2>New Go Release</h2>
<form class="NewWorkflow-workflowSelect" action="{{baseLink "/workflows/new"}}" method="get">
<label for="workflow.name">Workflow:</label>
<select id="workflow.name" name="workflow.name" onchange="this.form.submit()">
<option value="">Select Workflow</option>
{{range $name, $definition := .Definitions}}
<option value="{{$name}}" {{if eq $name $.Name}}selected="selected"{{end}}>
{{$name}}
</option>
{{end}}
</select>
<noscript>
<input name="workflow.new" type="submit" value="New" />
</noscript>
</form>
{{if .Selected}}
<form action="{{baseLink "/workflows"}}" method="post">
<input type="hidden" id="workflow.name" name="workflow.name" value="{{$.Name}}" />
{{range $_, $p := .Selected.Parameters}}
{{if eq $p.Type.String "string"}}
<div class="NewWorkflow-parameter NewWorkflow-parameter--string">
<label for="workflow.params.{{$p.Name}}" title="{{$p.Doc}}">{{$p.Name}}</label>
<input id="workflow.params.{{$p.Name}}" name="workflow.params.{{$p.Name}}"
{{- with $p.HTMLInputType}} type="{{.}}"{{end}}
{{- if $p.RequireNonZero}} required{{end}} placeholder="{{$p.Example}}" />
</div>
{{else if eq $p.Type.String "[]string"}}
<div class="NewWorkflow-parameter NewWorkflow-parameter--slice">
<div class="NewWorkflow-parameterRow">
<label title="{{$p.Doc}}">{{$p.Name}}</label>
<button class="NewWorkflow-addSliceRowButton" title="Increment the slice length."
type="button"
data-ParamName="{{$p.Name}}"
data-Element="{{$p.HTMLElement}}"
data-InputType="{{$p.HTMLInputType}}"
data-ParamExample="{{$p.Example}}">+</button>
</div>
</div>
{{else}}
<div class="NewWorkflow-parameter">
<label title="{{$p.Doc}}">{{$p.Name}}</label>
<span>unsupported parameter type "{{$p.ParameterType}}"</span>
</div>
{{end}}
{{end}}
<div class="NewWorkflow-workflowCreate">
<input name="workflow.create" type="submit" value="Create" onclick="return this.form.reportValidity() && confirm('This will create and immediately run this workflow.\n\nReady to proceed?')" />
</div>
</form>
{{end}}
</section>
{{end}}