gitea/templates/repo/actions/workflow_dispatch.tmpl
2024-03-01 19:40:56 +08:00

77 lines
2.7 KiB
Handlebars

<script type="module">
$('#runWorkflowDispatchForm').form({
fields: {
required_input : 'empty'
}
});
</script>
<div class="ui ignored info message">
This workflow has a workflow_dispatch event trigger.
<button class="ui right floated mini button" onclick="$('#runWorkflowDispatchModal').modal('show');">{{ctx.Locale.Tr "actions.workflow.run"}}{{svg "octicon-triangle-down" 14 "dropdown icon"}}</button>
</div>
<div id="runWorkflowDispatchModal" class="ui mini modal">
<div class="content">
<form id="runWorkflowDispatchForm" class="ui form" action="{{$.Link}}/run?workflow={{$.CurWorkflow}}&actor={{$.CurActor}}&status={{.Status}}" method="post">
{{.CsrfTokenHtml}}
<div class="ui inline field required">
<label>{{ctx.Locale.Tr "actions.workflow.from_ref"}} :</label>
<div class="ui floating dropdown icon button">
<input type="hidden" name="ref" value="refs/heads/{{index .Branches 0}}">
<i>{{svg "octicon-git-branch"}}</i>
<span class="text">{{index .Branches 0}}</span>
<div class="menu">
<div class="ui icon search input">
<i class="search icon"></i>
<input type="text" placeholder="{{ctx.Locale.Tr "repo.filter_branch_and_tag"}}">
</div>
<div class="scrolling menu">
<div class="header">
{{svg "octicon-git-branch"}}
Branches
</div>
{{range $key, $item := .Branches}}
<div class="item {{if eq $key 0}}active selected{{end}}" data-value="refs/heads/{{.}}">{{.}}</div>
{{end}}
<div class="divider"></div>
<div class="header">
{{svg "octicon-tag"}}
Tags
</div>
{{range $key, $item := .Tags}}
<div class="item" data-value="refs/tags/{{.}}">{{.}}</div>
{{end}}
</div>
</div>
</div>
</div>
<div class="divider"></div>
{{if .WorkflowDispatchConfig}}
{{range $key, $item := .WorkflowDispatchConfig.Inputs}}
<div class="ui field {{if .Required}}required{{end}}">
<label>{{$key}} :</label>
{{if eq .Type "choice"}}
<select class="ui fluid dropdown" name="{{$key}}">
{{range .Options}}
<option value="{{.}}" {{if eq $item.Default .}}selected{{end}} >{{.}}</option>
{{end}}
</select>
<span class="help">{{.Description}}</span>
{{else if eq .Type "boolean"}}
<div class="ui toggle checkbox">
<input type="checkbox" name="{{$key}}" {{if eq .Default "true"}}checked{{end}}>
<label class="help">{{.Description}}</label>
</div>
{{else}}
<input name="{{$key}}" value="{{.Default}}" {{if .Required}}data-validate="required_input"{{end}}>
<span class="help">{{.Description}}</span>
{{end}}
</div>
{{end}}
{{end}}
<button class="ui tiny blue button" type="submit">Submit</button>
</form>
</div>
</div>