summaryrefslogtreecommitdiffstats
path: root/templates/repo/actions
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--templates/repo/actions/dispatch.tmpl101
-rw-r--r--templates/repo/actions/list.tmpl92
-rw-r--r--templates/repo/actions/no_workflows.tmpl8
-rw-r--r--templates/repo/actions/runs_list.tmpl43
-rw-r--r--templates/repo/actions/status.tmpl29
-rw-r--r--templates/repo/actions/view.tmpl33
6 files changed, 306 insertions, 0 deletions
diff --git a/templates/repo/actions/dispatch.tmpl b/templates/repo/actions/dispatch.tmpl
new file mode 100644
index 0000000..48c2aa5
--- /dev/null
+++ b/templates/repo/actions/dispatch.tmpl
@@ -0,0 +1,101 @@
+<div class="ui info message tw-flex tw-items-center">
+ <span>
+ {{ctx.Locale.Tr "actions.workflow.dispatch.trigger_found"}}
+ </span>
+ <div class="ui dropdown custom tw-ml-4" id="workflow_dispatch_dropdown">
+ <button class="ui compact small basic button tw-flex">
+ <span class="text">{{ctx.Locale.Tr "actions.workflow.dispatch.run"}}</span>
+ {{svg "octicon-triangle-down" 14 "dropdown icon"}}
+ </button>
+ <div class="menu">
+ <div class="message ui form">
+ <div class="field">
+ <label>{{ctx.Locale.Tr "actions.workflow.dispatch.use_from"}}</label>
+ {{template "repo/branch_dropdown" dict
+ "root" (dict
+ "IsViewBranch" true
+ "BranchName" .Repo.BranchName
+ "CommitID" .Repo.CommitID
+ "RepoLink" .Repo.RepoLink
+ "Repository" .Repo.Repository
+ )
+ "disableCreateBranch" true
+ "branchForm" "branch-dropdown-form"
+ "setAction" false
+ "submitForm" false
+ }}
+ </div>
+
+ <form method="post" action="{{.Repo.RepoLink}}/actions/manual" id="branch-dropdown-form">
+ {{range $i, $key := .CurWorkflowDispatchInputKeys}}
+ {{$val := index $.CurWorkflowDispatch.Inputs $key}}
+ <div class="{{if $val.Required}}required {{end}}field">
+ {{if eq $val.Type "boolean"}}
+ <div class="ui checkbox">
+ <label><strong>{{if $val.Description}}{{$val.Description}}{{else}}{{$key}}{{end}}</strong></label>
+ {{/* These two inputs need to stay in exactly this order (checkbox first, hidden second) or boolean fields wont work correctly! */}}
+ <input type="checkbox" name="inputs[{{$key}}]" value="on" {{if eq $val.Default "true"}}checked{{end}}>
+ <input type="hidden" name="inputs[{{$key}}]" value="off" autocomplete="off">
+ </div>
+ {{else}}
+ <label>{{if $val.Description}}{{$val.Description}}{{else}}{{$key}}{{end}}</label>
+ {{if eq $val.Type "number"}}
+ <input {{if $val.Required}}required{{end}} type="number" name="inputs[{{$key}}]" {{if $val.Default}}value="{{$val.Default}}"{{end}}>
+ {{else if eq $val.Type "string"}}
+ <input {{if $val.Required}}required{{end}} type="text" name="inputs[{{$key}}]" {{if $val.Default}}value="{{$val.Default}}"{{end}}>
+ {{else if eq $val.Type "choice"}}
+ <div class="ui selection dropdown">
+ <input name="inputs[{{$key}}]" type="hidden" value="{{$val.Default}}">
+ {{svg "octicon-triangle-down" 14 "dropdown icon"}}
+ <div class="text"></div>
+ <div class="menu">
+ {{range $opt := $val.Options}}
+ <div data-value="{{$opt}}" class="{{if eq $val.Default $opt}}active selected {{end}}item">{{$opt}}</div>
+ {{end}}
+ </div>
+ </div>
+ {{else}}
+ <strong>{{ctx.Locale.Tr "actions.workflow.dispatch.invalid_input_type" $val.Type}}</strong>
+ {{end}}
+ {{end}}
+ </div>
+ {{end}}
+
+ {{if .WarnDispatchInputsLimit}}
+ <div class="text yellow tw-mb-4">
+ {{svg "octicon-alert"}} {{ctx.Locale.Tr "actions.workflow.dispatch.warn_input_limit" .DispatchInputsLimit}}
+ </div>
+ {{end}}
+
+ {{.CsrfTokenHtml}}
+ <input type="hidden" name="ref" value="{{if $.Repo.BranchName}}{{$.Repo.BranchName}}{{else}}{{$.Repo.Repository.DefaultBranch}}{{end}}">
+ <input type="hidden" name="workflow" value="{{$.CurWorkflow}}">
+ <input type="hidden" name="actor" value="{{$.CurActor}}">
+ <input type="hidden" name="status" value="{{$.CurStatus}}">
+ <button type="submit" id="workflow-dispatch-submit" class="ui primary small compact button">{{ctx.Locale.Tr "actions.workflow.dispatch.run"}}</button>
+ </form>
+ </div>
+ </div>
+ </div>
+ <script>
+ window.addEventListener('load', () => {
+ const dropdown = $('#workflow_dispatch_dropdown');
+ const menu = dropdown.find('> .menu');
+ $(document.body).on('click', (ev) => {
+ if (!dropdown[0].contains(ev.target) && menu.hasClass('visible')) {
+ menu.transition({ animation: 'slide down out', duration: 200, queue: false });
+ }
+ });
+ dropdown.on('click', (ev) => {
+ const inMenu = $(ev.target).closest(menu).length !== 0;
+ if (inMenu) return;
+ ev.stopPropagation();
+ if (menu.hasClass('visible')) {
+ menu.transition({ animation: 'slide down out', duration: 200, queue: false });
+ } else {
+ menu.transition({ animation: 'slide down in', duration: 200, queue: true });
+ }
+ });
+ });
+ </script>
+</div>
diff --git a/templates/repo/actions/list.tmpl b/templates/repo/actions/list.tmpl
new file mode 100644
index 0000000..263530f
--- /dev/null
+++ b/templates/repo/actions/list.tmpl
@@ -0,0 +1,92 @@
+{{template "base/head" .}}
+<div class="page-content repository actions">
+ {{template "repo/header" .}}
+ <div class="ui container">
+ {{template "base/alert" .}}
+
+ {{if .HasWorkflowsOrRuns}}
+ <div class="ui stackable grid">
+ <div class="four wide column">
+ <div class="ui fluid vertical menu">
+ <a class="item{{if not $.CurWorkflow}} active{{end}}" href="?actor={{$.CurActor}}&status={{$.CurStatus}}">{{ctx.Locale.Tr "actions.runs.all_workflows"}}</a>
+ {{range .workflows}}
+ <a class="item{{if eq .Entry.Name $.CurWorkflow}} active{{end}}" href="?workflow={{.Entry.Name}}&actor={{$.CurActor}}&status={{$.CurStatus}}">{{.Entry.Name}}
+ {{if .ErrMsg}}
+ <span data-tooltip-content="{{.ErrMsg}}">
+ {{svg "octicon-alert" 16 "text red"}}
+ </span>
+ {{end}}
+
+ {{if $.ActionsConfig.IsWorkflowDisabled .Entry.Name}}
+ <div class="ui red label">{{ctx.Locale.Tr "disabled"}}</div>
+ {{end}}
+ </a>
+ {{end}}
+ </div>
+ </div>
+ <div class="twelve wide column content">
+ <div class="ui secondary filter menu tw-justify-end tw-flex tw-items-center">
+ <!-- Actor -->
+ <div class="ui{{if not .Actors}} disabled{{end}} dropdown jump item">
+ <span class="text">{{ctx.Locale.Tr "actions.runs.actor"}}</span>
+ {{svg "octicon-triangle-down" 14 "dropdown icon"}}
+ <div class="menu">
+ <div class="ui icon search input">
+ <i class="icon">{{svg "octicon-search"}}</i>
+ <input type="text" placeholder="{{ctx.Locale.Tr "actions.runs.actor"}}">
+ </div>
+ <a class="item{{if not $.CurActor}} active{{end}}" href="?workflow={{$.CurWorkflow}}&status={{$.CurStatus}}&actor=0">
+ {{ctx.Locale.Tr "actions.runs.actors_no_select"}}
+ </a>
+ {{range .Actors}}
+ <a class="item{{if eq .ID $.CurActor}} active{{end}}" href="?workflow={{$.CurWorkflow}}&actor={{.ID}}&status={{$.CurStatus}}">
+ {{ctx.AvatarUtils.Avatar . 20}} {{.GetDisplayName}}
+ </a>
+ {{end}}
+ </div>
+ </div>
+ <!-- Status -->
+ <div class="ui dropdown jump item">
+ <span class="text">{{ctx.Locale.Tr "actions.runs.status"}}</span>
+ {{svg "octicon-triangle-down" 14 "dropdown icon"}}
+ <div class="menu">
+ <div class="ui icon search input">
+ <i class="icon">{{svg "octicon-search"}}</i>
+ <input type="text" placeholder="{{ctx.Locale.Tr "actions.runs.status"}}">
+ </div>
+ <a class="item{{if not $.CurStatus}} active{{end}}" href="?workflow={{$.CurWorkflow}}&actor={{$.CurActor}}&status=0">
+ {{ctx.Locale.Tr "actions.runs.status_no_select"}}
+ </a>
+ {{range .StatusInfoList}}
+ <a class="item{{if eq .Status $.CurStatus}} active{{end}}" href="?workflow={{$.CurWorkflow}}&actor={{$.CurActor}}&status={{.Status}}">
+ {{.DisplayedStatus}}
+ </a>
+ {{end}}
+ </div>
+ </div>
+
+ {{if .AllowDisableOrEnableWorkflow}}
+ <button class="ui jump dropdown btn interact-bg tw-p-2">
+ {{svg "octicon-kebab-horizontal"}}
+ <div class="menu">
+ <a class="item link-action" data-url="{{$.Link}}/{{if .CurWorkflowDisabled}}enable{{else}}disable{{end}}?workflow={{$.CurWorkflow}}&actor={{.CurActor}}&status={{$.CurStatus}}">
+ {{if .CurWorkflowDisabled}}{{ctx.Locale.Tr "actions.workflow.enable"}}{{else}}{{ctx.Locale.Tr "actions.workflow.disable"}}{{end}}
+ </a>
+ </div>
+ </button>
+ {{end}}
+ </div>
+
+ {{if $.CurWorkflowDispatch}}
+ {{template "repo/actions/dispatch" .}}
+ {{end}}
+
+ {{template "repo/actions/runs_list" .}}
+ </div>
+ </div>
+ {{else}}
+ {{template "repo/actions/no_workflows" .}}
+ {{end}}
+ </div>
+</div>
+{{template "base/footer" .}}
diff --git a/templates/repo/actions/no_workflows.tmpl b/templates/repo/actions/no_workflows.tmpl
new file mode 100644
index 0000000..88d6e51
--- /dev/null
+++ b/templates/repo/actions/no_workflows.tmpl
@@ -0,0 +1,8 @@
+<div class="empty-placeholder">
+ {{svg "octicon-no-entry" 48}}
+ <h2>{{ctx.Locale.Tr "actions.runs.no_workflows"}}</h2>
+ {{if and .CanWriteCode .CanWriteActions}}
+ <p>{{ctx.Locale.Tr "actions.runs.no_workflows.quick_start" "https://forgejo.org/docs/latest/admin/actions/"}}</p>
+ {{end}}
+ <p>{{ctx.Locale.Tr "actions.runs.no_workflows.documentation" "https://forgejo.org/docs/latest/admin/actions/"}}</p>
+</div>
diff --git a/templates/repo/actions/runs_list.tmpl b/templates/repo/actions/runs_list.tmpl
new file mode 100644
index 0000000..7bab492
--- /dev/null
+++ b/templates/repo/actions/runs_list.tmpl
@@ -0,0 +1,43 @@
+<div class="flex-list run-list">
+ {{if not .Runs}}
+ <div class="empty-placeholder">
+ {{svg "octicon-no-entry" 48}}
+ <h2>{{if $.IsFiltered}}{{ctx.Locale.Tr "actions.runs.no_results"}}{{else}}{{ctx.Locale.Tr "actions.runs.no_runs"}}{{end}}</h2>
+ </div>
+ {{end}}
+ {{range .Runs}}
+ <div class="flex-item tw-items-center">
+ <div class="flex-item-leading">
+ {{template "repo/actions/status" (dict "status" .Status.String)}}
+ </div>
+ <div class="flex-item-main">
+ <a class="flex-item-title" title="{{.Title}}" href="{{if .Link}}{{.Link}}{{else}}{{$.Link}}/{{.Index}}{{end}}">
+ {{if .Title}}{{.Title}}{{else}}{{ctx.Locale.Tr "actions.runs.empty_commit_message"}}{{end}}
+ </a>
+ <div class="flex-item-body">
+ <b>{{if not $.CurWorkflow}}{{.WorkflowID}} {{end}}#{{.Index}}</b> -
+ {{- if .ScheduleID -}}
+ {{ctx.Locale.Tr "actions.runs.scheduled"}}
+ {{- else -}}
+ {{ctx.Locale.Tr "actions.runs.commit"}}
+ <a href="{{$.RepoLink}}/commit/{{.CommitSHA}}">{{ShortSha .CommitSHA}}</a>
+ {{ctx.Locale.Tr "actions.runs.pushed_by"}}
+ <a href="{{.TriggerUser.HomeLink}}">{{.TriggerUser.GetDisplayName}}</a>
+ {{- end -}}
+ </div>
+ </div>
+ <div class="flex-item-trailing">
+ {{if .RefLink}}
+ <a class="ui label run-list-ref gt-ellipsis" href="{{.RefLink}}">{{.PrettyRef}}</a>
+ {{else}}
+ <span class="ui label run-list-ref gt-ellipsis">{{.PrettyRef}}</span>
+ {{end}}
+ <div class="run-list-item-right">
+ <div class="run-list-meta">{{svg "octicon-calendar" 16}}{{TimeSinceUnix .Updated ctx.Locale}}</div>
+ <div class="run-list-meta">{{svg "octicon-stopwatch" 16}}{{.Duration}}</div>
+ </div>
+ </div>
+ </div>
+ {{end}}
+</div>
+{{template "base/paginate" .}}
diff --git a/templates/repo/actions/status.tmpl b/templates/repo/actions/status.tmpl
new file mode 100644
index 0000000..a0e02cf
--- /dev/null
+++ b/templates/repo/actions/status.tmpl
@@ -0,0 +1,29 @@
+<!-- This template should be kept the same as web_src/js/components/ActionRunStatus.vue
+ Please also update the vue file above if this template is modified.
+ action status accepted: success, skipped, waiting, blocked, running, failure, cancelled, unknown
+-->
+{{- $size := 16 -}}
+{{- if .size -}}
+{{- $size = .size -}}
+{{- end -}}
+
+{{- $className := "" -}}
+{{- if .className -}}
+{{- $className = .className -}}
+{{- end -}}
+
+<span class="tw-flex tw-items-center" data-tooltip-content="{{ctx.Locale.Tr (printf "actions.status.%s" .status)}}">
+{{if eq .status "success"}}
+ {{svg "octicon-check-circle-fill" $size (printf "text green %s" $className)}}
+{{else if eq .status "skipped"}}
+ {{svg "octicon-skip" $size (printf "text grey %s" $className)}}
+{{else if eq .status "waiting"}}
+ {{svg "octicon-clock" $size (printf "text yellow %s" $className)}}
+{{else if eq .status "blocked"}}
+ {{svg "octicon-blocked" $size (printf "text yellow %s" $className)}}
+{{else if eq .status "running"}}
+ {{svg "octicon-meter" $size (printf "text yellow job-status-rotate %s" $className)}}
+{{else if or (eq .status "failure") or (eq .status "cancelled") or (eq .status "unknown")}}
+ {{svg "octicon-x-circle-fill" $size (printf "text red %s" $className)}}
+{{end}}
+</span>
diff --git a/templates/repo/actions/view.tmpl b/templates/repo/actions/view.tmpl
new file mode 100644
index 0000000..b787762
--- /dev/null
+++ b/templates/repo/actions/view.tmpl
@@ -0,0 +1,33 @@
+{{template "base/head" .}}
+
+<div class="page-content repository">
+ {{template "repo/header" .}}
+ <div id="repo-action-view"
+ data-run-index="{{.RunIndex}}"
+ data-job-index="{{.JobIndex}}"
+ data-actions-url="{{.ActionsURL}}"
+ data-workflow-name="{{.WorkflowName}}"
+ data-workflow-url="{{.WorkflowURL}}"
+ data-locale-approve="{{ctx.Locale.Tr "repo.diff.review.approve"}}"
+ data-locale-cancel="{{ctx.Locale.Tr "cancel"}}"
+ data-locale-rerun="{{ctx.Locale.Tr "rerun"}}"
+ data-locale-rerun-all="{{ctx.Locale.Tr "rerun_all"}}"
+ data-locale-status-unknown="{{ctx.Locale.Tr "actions.status.unknown"}}"
+ data-locale-status-waiting="{{ctx.Locale.Tr "actions.status.waiting"}}"
+ data-locale-status-running="{{ctx.Locale.Tr "actions.status.running"}}"
+ data-locale-status-success="{{ctx.Locale.Tr "actions.status.success"}}"
+ data-locale-status-failure="{{ctx.Locale.Tr "actions.status.failure"}}"
+ data-locale-status-cancelled="{{ctx.Locale.Tr "actions.status.cancelled"}}"
+ data-locale-status-skipped="{{ctx.Locale.Tr "actions.status.skipped"}}"
+ data-locale-status-blocked="{{ctx.Locale.Tr "actions.status.blocked"}}"
+ data-locale-artifacts-title="{{ctx.Locale.Tr "artifacts"}}"
+ data-locale-confirm-delete-artifact="{{ctx.Locale.Tr "confirm_delete_artifact"}}"
+ data-locale-show-timestamps="{{ctx.Locale.Tr "show_timestamps"}}"
+ data-locale-show-log-seconds="{{ctx.Locale.Tr "show_log_seconds"}}"
+ data-locale-show-full-screen="{{ctx.Locale.Tr "show_full_screen"}}"
+ data-locale-download-logs="{{ctx.Locale.Tr "download_logs"}}"
+ >
+ </div>
+</div>
+
+{{template "base/footer" .}}