feat(runner): add runner page in repo and org settings

This commit is contained in:
fuxiaohei
2022-10-19 21:19:29 +08:00
committed by Jason Song
parent c3530bf47c
commit 38b36edc5c
11 changed files with 85 additions and 97 deletions

View File

@@ -1,85 +0,0 @@
{{template "base/head" .}}
<div class="page-content admin runners">
{{template "admin/navbar" .}}
<div class="ui container">
{{template "base/alert" .}}
<h4 class="ui top attached header">
{{.locale.Tr "admin.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">
<label>{{.locale.Tr "admin.runners.status"}}</label>
<span class="runner-status-{{.Runner.StatusType}}">{{.Runner.StatusType}}</span>
</div>
<div class="field dib">
<label>{{.locale.Tr "admin.runners.latest_online"}}</label>
<span>{{TimeSinceUnix .Runner.LastOnline $.locale}}</span>
</div>
<div class="field dib">
<label>{{.locale.Tr "admin.runners.agent_labels"}}</label>
<span>
{{range .Runner.AgentLabels}}
<span>{{.}}</span>
{{end}}
</span>
</div>
<div class="field dib">
<label>{{.locale.Tr "admin.runners.owner_type"}}</label>
<span>{{.Runner.OwnType}}</span>
</div>
</div>
<div class="ui divider"></div>
<div class="field">
<label for="description">{{.locale.Tr "admin.runners.description"}}</label>
<input id="description" name="description" value="{{.Runner.Description}}">
</div>
<div class="field">
<label for="custom_labels">{{.locale.Tr "admin.runners.custom_labels"}}</label>
<input id="custom_labels" name="custom_labels" value="{{Join .Runner.CustomLabels `,`}}">
<p class="help">{{.locale.Tr "admin.runners.custom_labels_helper"}}</p>
</div>
<div class="ui divider"></div>
<div class="field">
<button type="submit" class="ui green button">{{.locale.Tr "admin.runners.update_runner"}}</button>
<button type="button" class="ui red button delete-button show-modal" data-modal="#runner-delete-modal">
{{.locale.Tr "admin.runners.delete_runner"}}</button>
</div>
</form>
</div>
<h4 class="ui top attached header">
{{.locale.Tr "admin.runners.task_list"}}
</h4>
<div class="ui attached segment">
Comming soon
</div>
</div>
</div>
<div class="ui small modal" id="runner-delete-modal">
<div class="header">
{{.locale.Tr "admin.runners.delete_runner_header"}}
</div>
<div class="content">
<div class="ui warning message text left">
{{.locale.Tr "admin.runners.delete_runner_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 "admin.runners.delete_runner_confirm"}}</button>
</div>
</form>
</div>
</div>
{{template "base/footer" .}}

View File

@@ -1,92 +0,0 @@
{{template "base/head" .}}
<div class="page-content admin runners">
{{template "admin/navbar" .}}
<div class="ui container">
{{template "base/alert" .}}
<h4 class="ui top attached header">
{{.locale.Tr "admin.runners.runner_manage_panel"}} ({{.locale.Tr "admin.total" .Total}})
<div class="ui right">
<!--<a class="ui primary tiny button" href="{{AppSubUrl}}/admin/runners/new">{{.locale.Tr "admin.runners.new"}}</a>-->
<div class="ui top right pointing dropdown">
<button class="ui button primary">
{{.locale.Tr "admin.runners.new"}}
<i class="dropdown icon"></i>
</button>
<div class="menu">
<div class="item">
<a href="#">{{.locale.Tr "admin.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 "admin.runners.status"}}</th>
<th data-sortt-asc="alphabetically">
{{.locale.Tr "admin.runners.id"}}
</th>
<th>{{.locale.Tr "admin.runners.owner_type"}}</th>
<th>{{.locale.Tr "admin.runners.labels"}}</th>
<th>{{.locale.Tr "admin.runners.latest_online"}}</th>
<th></th>
</tr>
</thead>
<tbody>
{{range .Runners}}
<tr>
<td><span class="runner-status-{{.StatusType}}">{{.StatusType}}</span></td>
<td>
<a href="{{$.Link}}/{{.ID}}" class="tooltip" data-content="{{.Description}}">
<span class="runner-id">#{{.ID}}</span>
<span class="runner-name">{{.Name}}</span>
</a>
</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">
<a href="{{$.Link}}/{{.ID}}">{{svg "octicon-pencil"}}</a>
<!--<a class="runner-ops-delete show-modal" data-modal="#runner-delete-modal">{{svg "octicon-x-circle"}}</a>-->
</td>
</tr>
{{end}}
</tbody>
</table>
</div>
{{template "base/paginate" .}}
</div>
</div>
{{template "base/footer" .}}

View File

@@ -1,94 +0,0 @@
{{template "base/head" .}}
<div class="page-content admin new user">
{{template "admin/navbar" .}}
<div class="ui container">
{{template "base/alert" .}}
<h4 class="ui top attached header">
{{.locale.Tr "admin.users.new_account"}}
</h4>
<div class="ui attached segment">
<form class="ui form" action="{{.Link}}" method="post">
{{template "base/disable_form_autofill"}}
{{.CsrfTokenHtml}}
<!-- Types and name -->
<div class="inline required field {{if .Err_LoginType}}error{{end}}">
<label>{{.locale.Tr "admin.users.auth_source"}}</label>
<div class="ui selection type dropdown">
<input type="hidden" id="login_type" name="login_type" value="{{.login_type}}" data-password="required" required>
<div class="text">{{.locale.Tr "admin.users.local"}}</div>
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
<div class="menu">
<div class="item" data-value="0-0">{{.locale.Tr "admin.users.local"}}</div>
{{range .Sources}}
<div class="item" data-value="{{.Type.Int}}-{{.ID}}">{{.Name}}</div>
{{end}}
</div>
</div>
</div>
<div class="inline field {{if .Err_Visibility}}error{{end}}">
<span class="inline required field"><label for="visibility">{{.locale.Tr "settings.visibility"}}</label></span>
<div class="ui selection type dropdown">
<input type="hidden" id="visibility" name="visibility" value="{{if .visibility}}{{.visibility}}{{else}}{{printf "%d" .DefaultUserVisibilityMode}}{{end}}">
<div class="text">
{{if .DefaultUserVisibilityMode.IsPublic}}{{.locale.Tr "settings.visibility.public"}}{{end}}
{{if .DefaultUserVisibilityMode.IsLimited}}{{.locale.Tr "settings.visibility.limited"}}{{end}}
{{if .DefaultUserVisibilityMode.IsPrivate}}{{.locale.Tr "settings.visibility.private"}}{{end}}
</div>
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
<div class="menu">
{{range $mode := .AllowedUserVisibilityModes}}
{{if $mode.IsPublic}}
<div class="item tooltip" data-content="{{$.locale.Tr "settings.visibility.public_tooltip"}}" data-value="0">{{$.locale.Tr "settings.visibility.public"}}</div>
{{else if $mode.IsLimited}}
<div class="item tooltip" data-content="{{$.locale.Tr "settings.visibility.limited_tooltip"}}" data-value="1">{{$.locale.Tr "settings.visibility.limited"}}</div>
{{else if $mode.IsPrivate}}
<div class="item tooltip" data-content="{{$.locale.Tr "settings.visibility.private_tooltip"}}" data-value="2">{{$.locale.Tr "settings.visibility.private"}}</div>
{{end}}
{{end}}
</div>
</div>
</div>
<div class="required non-local field {{if .Err_LoginName}}error{{end}} {{if eq .login_type "0-0"}}hide{{end}}">
<label for="login_name">{{.locale.Tr "admin.users.auth_login_name"}}</label>
<input id="login_name" name="login_name" value="{{.login_name}}">
</div>
<div class="required field {{if .Err_UserName}}error{{end}}">
<label for="user_name">{{.locale.Tr "username"}}</label>
<input id="user_name" type="text" name="user_name" value="{{.user_name}}" autofocus required>
</div>
<div class="required field {{if .Err_Email}}error{{end}}">
<label for="email">{{.locale.Tr "email"}}</label>
<input id="email" name="email" type="email" value="{{.email}}" required>
</div>
<div class="required local field {{if .Err_Password}}error{{end}} {{if not (eq .login_type "0-0")}}hide{{end}}">
<label for="password">{{.locale.Tr "password"}}</label>
<input id="password" name="password" type="password" autocomplete="new-password" value="{{.password}}" {{if eq .login_type "0-0"}}required{{end}}>
</div>
<div class="inline field local{{if ne .login_type "0-0"}} hide{{end}}">
<div class="ui checkbox">
<label><strong>{{.locale.Tr "auth.allow_password_change" }}</strong></label>
<input name="must_change_password" type="checkbox" checked>
</div>
</div>
<!-- Send register notify e-mail -->
{{if .CanSendEmail}}
<div class="inline field">
<div class="ui checkbox">
<label><strong>{{.locale.Tr "admin.users.send_register_notify"}}</strong></label>
<input name="send_notify" type="checkbox" {{if .send_notify}}checked{{end}}>
</div>
</div>
{{end}}
<div class="field">
<button class="ui green button">{{.locale.Tr "admin.users.new_account"}}</button>
</div>
</form>
</div>
</div>
</div>
{{template "base/footer" .}}