refactor: shard runner templates

This commit is contained in:
Jason Song
2023-01-05 16:40:20 +08:00
parent a4b2cf2426
commit b1013a4770
8 changed files with 6 additions and 6 deletions
+110
View File
@@ -0,0 +1,110 @@
<div class="runner-container">
{{template "base/alert" .}}
<h4 class="ui top attached header">
{{.locale.Tr "actions.runners.runner_title"}} #{{.Runner.ID}} {{.Runner.Name}}
</h4>
<div class="ui attached segment">
<form class="ui form" action="{{.Link}}" method="post">
{{template "base/disable_form_autofill"}}
{{.CsrfTokenHtml}}
<div class="runner-basic-info">
<div class="field dib disabled">
<label>{{.locale.Tr "actions.runners.status"}}</label>
<span class="runner-status-{{if .Runner.IsOnline}}online{{else}}offline{{end}}">{{.Runner.StatusName}}</span>
</div>
<div class="field dib disabled">
<label>{{.locale.Tr "actions.runners.latest_online"}}</label>
<span>{{TimeSinceUnix .Runner.LastOnline $.locale}}</span>
</div>
<div class="field dib disabled">
<label>{{.locale.Tr "actions.runners.agent_labels"}}</label>
<span>
{{range .Runner.AgentLabels}}
<span>{{.}}</span>
{{end}}
</span>
</div>
<div class="field dib disabled">
<label>{{.locale.Tr "actions.runners.owner_type"}}</label>
<span>{{.Runner.OwnType}}</span>
</div>
</div>
<div class="ui divider"></div>
<div class="field">
<label for="description">{{.locale.Tr "actions.runners.description"}}</label>
<input id="description" name="description" value="{{.Runner.Description}}">
</div>
<div class="field tooltip" data-content="Labels are comma-separated. Whitespace at the beginning, end, and around the commas are ignored.">
<label for="custom_labels">{{.locale.Tr "actions.runners.custom_labels"}}</label>
<input id="custom_labels" name="custom_labels" value="{{Join .Runner.CustomLabels `,`}}">
<p class="help">{{.locale.Tr "actions.runners.custom_labels_helper"}}</p>
</div>
<div class="ui divider"></div>
<div class="field">
<button type="submit" class="ui green button">{{.locale.Tr "actions.runners.update_runner"}}</button>
<button type="button" class="ui red button delete-button show-modal" data-modal="#runner-delete-modal">
{{.locale.Tr "actions.runners.delete_runner"}}</button>
</div>
</form>
</div>
<h4 class="ui top attached header">
{{.locale.Tr "actions.runners.task_list"}}
</h4>
<div class="ui attached segment">
<table class="ui very basic striped table unstackable">
<thead>
<tr>
<th>{{.locale.Tr "runners.task_list.job"}}</th>
<th>{{.locale.Tr "runners.task_list.status"}}</th>
<th>{{.locale.Tr "runners.task_list.repository"}}</th>
<th>{{.locale.Tr "runners.task_list.commit"}}</th>
<th>{{.locale.Tr "runners.task_list.finish_at"}}</th>
</tr>
</thead>
<tbody>
{{range .Tasks}}
<tr>
<td><a href="{{.GetBuildViewLink}}" target="_blank">#{{.ID}}</a></td>
<td><span class="ui label task-status-{{.Status.String}}">{{.Status.String}}</span></td>
<td>{{.GetRepoName}}</td>
<td><strong>
<a href="{{.GetCommitLink}}" target="_blank">{{.GetCommitSHAShort}}</a>
</strong> </td>
<td>{{if .IsStopped}}
<span>{{TimeSinceUnix .Stopped $.locale}}</span>
{{else}}-{{end}}</td>
</tr>
{{end}}
{{if not .Tasks}}
<tr>
<td colspan="5">{{.locale.Tr "runners.task_list.no_tasks"}}</td>
</tr>
{{end}}
</tbody>
</table>
{{template "base/paginate" .}}
</div>
<div class="ui small modal" id="runner-delete-modal">
<div class="header">
{{.locale.Tr "actions.runners.delete_header"}}
</div>
<div class="content">
<div class="ui warning message text left">
{{.locale.Tr "admin.runnners.delete_notice" | Safe}}
</div>
<form class="ui form" action="{{.Link}}/delete" method="post">
{{.CsrfTokenHtml}}
<input type="hidden" name="action" value="delete">
<div class="text right actions">
<div class="ui cancel button">{{.locale.Tr "settings.cancel"}}</div>
<button class="ui red button">{{.locale.Tr "actions.runners.delete_confirm"}}</button>
</div>
</form>
</div>
</div>
</div>
+95
View File
@@ -0,0 +1,95 @@
<div class="runner-container">
{{template "base/alert" .}}
<h4 class="ui top attached header">
{{.locale.Tr "actions.runners.runner_manage_panel"}} ({{.locale.Tr "admin.total" .Total}})
<div class="ui right">
<div class="ui top right pointing dropdown">
<button class="ui button primary">
{{.locale.Tr "actions.runners.new"}}
<i class="dropdown icon"></i>
</button>
<div class="menu">
<div class="item">
<a href="#">{{.locale.Tr "actions.runners.new_notice"}}</a>
</div>
<div class="divider"></div>
<div class="header">
Registration Token
</div>
<div class="ui input">
<input type="text" value="{{.RegistrationToken}}">
<div class="ui basic label button" data-clipboard-text="{{.RegistrationToken}}">
{{svg "octicon-copy" 14}}
</div>
</div>
<div class="divider"></div>
<div class="item">
<a href="{{$.Link}}/reset_registration_token">Reset registration token</a>
</div>
</div>
</div>
</div>
</h4>
<div class="ui attached segment">
<form class="ui form ignore-dirty" id="user-list-search-form" action="{{$.Link}}">
<!-- Search Text -->
<div class="ui fluid action input" style="max-width: 70%;">
<input name="q" value="{{.Keyword}}" placeholder="{{.locale.Tr "explore.search"}}..." autofocus>
<button class="ui primary button">{{.locale.Tr "explore.search"}}</button>
</div>
</form>
</div>
<div class="ui attached table segment">
<table class="ui very basic striped table unstackable">
<thead>
<tr>
<th data-sortt-asc="online" data-sortt-desc="offline">{{.locale.Tr "actions.runners.status"}}</th>
<th data-sortt-asc="alphabetically">{{.locale.Tr "actions.runners.id"}}</th>
<th>{{.locale.Tr "actions.runners.owner_type"}}</th>
<th>{{.locale.Tr "actions.runners.labels"}}</th>
<th>{{.locale.Tr "actions.runners.latest_online"}}</th>
<th></th>
</tr>
</thead>
<tbody>
{{range .Runners}}
<tr>
<td>
<span class="runner-status-{{if .IsOnline}}online{{else}}offline{{end}}">{{.StatusName}}</span>
</td>
<td>
{{if .Editable $.RunnerOnwerID $.RunnerRepoID}}
<a href="{{$.Link}}/{{.ID}}" class="tooltip" data-content="{{.Description}}">
<span class="runner-id">#{{.ID}}</span>
<span class="runner-name">{{.Name}}</span>
</a>
{{else}}
<p class="tooltip" data-content="{{.Description}}">
<span class="runner-id">#{{.ID}}</span>
<span class="runner-name">{{.Name}}</span>
</p>
{{end}}
</td>
<td>{{.OwnType}}</td>
<td class="runner-tags">
{{range .AllLabels}}
<span class="ui label">{{.}}</span>
{{end}}
</td>
<td>{{TimeSinceUnix .LastOnline $.locale}}</td>
<td class="runner-ops">
{{if .Editable $.RunnerOnwerID $.RunnerRepoID}}
<a href="{{$.Link}}/{{.ID}}">{{svg "octicon-pencil"}}</a>
{{end}}
</td>
</tr>
{{end}}
</tbody>
</table>
</div>
{{template "base/paginate" .}}
</div>