blob: 4810a8f2b4d76ad77fe944714428a4e832da88da [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.
-->
{{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 title="Increment the slice length." onclick="event.preventDefault(); addSliceRow(this.parentElement.parentElement, '{{$p.Name}}', '{{$p.HTMLElement}}', '{{$p.HTMLInputType}}', '{{$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}}