2017-09-14 10:16:22 +02:00
|
|
|
{{template "base/head" .}}
|
2023-02-01 23:56:10 +01:00
|
|
|
<div role="main" aria-label="{{.Title}}" class="page-content repository settings branches">
|
2017-09-14 10:16:22 +02:00
|
|
|
{{template "repo/header" .}}
|
|
|
|
{{template "repo/settings/navbar" .}}
|
|
|
|
<div class="ui container">
|
|
|
|
{{template "base/alert" .}}
|
2023-01-16 09:00:22 +01:00
|
|
|
<form class="ui form" action="{{.Link}}" method="post">
|
|
|
|
<h4 class="ui top attached header">
|
|
|
|
{{.locale.Tr "repo.settings.branch_protection" (.Rule.RuleName|Escape) | Str2html}}
|
|
|
|
</h4>
|
|
|
|
<div class="ui attached segment branch-protection">
|
|
|
|
<div class="field">
|
|
|
|
<label for="protected_file_patterns">{{.locale.Tr "repo.settings.protect_branch_name_pattern"}}</label>
|
|
|
|
<input name="rule_name" type="text" value="{{.Rule.RuleName}}">
|
|
|
|
<input name="rule_id" type="hidden" value="{{.Rule.ID}}">
|
2017-09-14 10:16:22 +02:00
|
|
|
</div>
|
2023-01-16 09:00:22 +01:00
|
|
|
|
|
|
|
<div class="ui divider"></div>
|
|
|
|
|
|
|
|
{{.CsrfTokenHtml}}
|
|
|
|
<div id="protection_box" class="fields">
|
2017-09-14 10:16:22 +02:00
|
|
|
<div class="field">
|
2019-12-04 02:08:56 +01:00
|
|
|
<div class="ui radio checkbox">
|
2023-01-16 09:00:22 +01:00
|
|
|
<input name="enable_push" type="radio" value="none" class="disable-whitelist" data-target="#whitelist_box" {{if not .Rule.CanPush}}checked{{end}}>
|
2022-06-27 22:58:46 +02:00
|
|
|
<label>{{.locale.Tr "repo.settings.protect_disable_push"}}</label>
|
|
|
|
<p class="help">{{.locale.Tr "repo.settings.protect_disable_push_desc"}}</p>
|
2019-12-04 02:08:56 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="field">
|
|
|
|
<div class="ui radio checkbox">
|
2023-01-16 09:00:22 +01:00
|
|
|
<input name="enable_push" type="radio" value="all" class="disable-whitelist" data-target="#whitelist_box" {{if and (.Rule.CanPush) (not .Rule.EnableWhitelist)}}checked{{end}}>
|
2022-06-27 22:58:46 +02:00
|
|
|
<label>{{.locale.Tr "repo.settings.protect_enable_push"}}</label>
|
|
|
|
<p class="help">{{.locale.Tr "repo.settings.protect_enable_push_desc"}}</p>
|
2019-12-04 02:08:56 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="field">
|
|
|
|
<div class="ui radio checkbox">
|
2023-01-16 09:00:22 +01:00
|
|
|
<input name="enable_push" type="radio" value="whitelist" class="enable-whitelist" data-target="#whitelist_box" {{if and (.Rule.CanPush) (.Rule.EnableWhitelist)}}checked{{end}}>
|
2022-06-27 22:58:46 +02:00
|
|
|
<label>{{.locale.Tr "repo.settings.protect_whitelist_committers"}}</label>
|
|
|
|
<p class="help">{{.locale.Tr "repo.settings.protect_whitelist_committers_desc"}}</p>
|
2017-09-14 10:16:22 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
2023-01-16 09:00:22 +01:00
|
|
|
<div id="whitelist_box" class="fields {{if not .Rule.EnableWhitelist}}disabled{{end}}">
|
2017-09-14 10:16:22 +02:00
|
|
|
<div class="whitelist field">
|
2022-06-27 22:58:46 +02:00
|
|
|
<label>{{.locale.Tr "repo.settings.protect_whitelist_users"}}</label>
|
2017-09-14 10:16:22 +02:00
|
|
|
<div class="ui multiple search selection dropdown">
|
|
|
|
<input type="hidden" name="whitelist_users" value="{{.whitelist_users}}">
|
2022-06-27 22:58:46 +02:00
|
|
|
<div class="default text">{{.locale.Tr "repo.settings.protect_whitelist_search_users"}}</div>
|
2017-09-14 10:16:22 +02:00
|
|
|
<div class="menu">
|
|
|
|
{{range .Users}}
|
|
|
|
<div class="item" data-value="{{.ID}}">
|
2023-03-16 17:32:25 +01:00
|
|
|
{{avatar $.Context . 28 "mini"}}{{template "repo/search_name" .}}
|
2017-09-14 10:16:22 +02:00
|
|
|
</div>
|
|
|
|
{{end}}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{{if .Owner.IsOrganization}}
|
|
|
|
<br>
|
|
|
|
<div class="whitelist field">
|
2022-06-27 22:58:46 +02:00
|
|
|
<label>{{.locale.Tr "repo.settings.protect_whitelist_teams"}}</label>
|
2017-09-14 10:16:22 +02:00
|
|
|
<div class="ui multiple search selection dropdown">
|
|
|
|
<input type="hidden" name="whitelist_teams" value="{{.whitelist_teams}}">
|
2022-06-27 22:58:46 +02:00
|
|
|
<div class="default text">{{.locale.Tr "repo.settings.protect_whitelist_search_teams"}}</div>
|
2017-09-14 10:16:22 +02:00
|
|
|
<div class="menu">
|
|
|
|
{{range .Teams}}
|
|
|
|
<div class="item" data-value="{{.ID}}">
|
2020-09-11 22:19:00 +02:00
|
|
|
{{svg "octicon-people"}}
|
2017-09-14 10:16:22 +02:00
|
|
|
{{.Name}}
|
|
|
|
</div>
|
|
|
|
{{end}}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{{end}}
|
2019-10-21 10:21:45 +02:00
|
|
|
<br>
|
|
|
|
<div class="whitelist field">
|
|
|
|
<div class="ui checkbox">
|
2023-01-16 09:00:22 +01:00
|
|
|
<input type="checkbox" name="whitelist_deploy_keys" {{if .Rule.WhitelistDeployKeys}}checked{{end}}>
|
2022-06-27 22:58:46 +02:00
|
|
|
<label for="whitelist_deploy_keys">{{.locale.Tr "repo.settings.protect_whitelist_deploy_keys"}}</label>
|
2019-10-21 10:21:45 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
2017-09-14 10:16:22 +02:00
|
|
|
</div>
|
2018-03-25 12:01:32 +02:00
|
|
|
|
2023-01-16 09:00:22 +01:00
|
|
|
<div class="ui divider"></div>
|
|
|
|
|
2018-03-25 12:01:32 +02:00
|
|
|
<div class="field">
|
|
|
|
<div class="ui checkbox">
|
2023-01-16 09:00:22 +01:00
|
|
|
<input class="enable-whitelist" name="enable_merge_whitelist" type="checkbox" data-target="#merge_whitelist_box" {{if .Rule.EnableMergeWhitelist}}checked{{end}}>
|
2022-06-27 22:58:46 +02:00
|
|
|
<label>{{.locale.Tr "repo.settings.protect_merge_whitelist_committers"}}</label>
|
|
|
|
<p class="help">{{.locale.Tr "repo.settings.protect_merge_whitelist_committers_desc"}}</p>
|
2018-03-25 12:01:32 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
2023-01-16 09:00:22 +01:00
|
|
|
<div id="merge_whitelist_box" class="fields {{if not .Rule.EnableMergeWhitelist}}disabled{{end}}">
|
2018-03-25 12:01:32 +02:00
|
|
|
<div class="whitelist field">
|
2022-06-27 22:58:46 +02:00
|
|
|
<label>{{.locale.Tr "repo.settings.protect_merge_whitelist_users"}}</label>
|
2018-03-25 12:01:32 +02:00
|
|
|
<div class="ui multiple search selection dropdown">
|
|
|
|
<input type="hidden" name="merge_whitelist_users" value="{{.merge_whitelist_users}}">
|
2022-06-27 22:58:46 +02:00
|
|
|
<div class="default text">{{.locale.Tr "repo.settings.protect_whitelist_search_users"}}</div>
|
2018-03-25 12:01:32 +02:00
|
|
|
<div class="menu">
|
|
|
|
{{range .Users}}
|
|
|
|
<div class="item" data-value="{{.ID}}">
|
2023-03-16 17:32:25 +01:00
|
|
|
{{avatar $.Context . 28 "mini"}}{{template "repo/search_name" .}}
|
2018-03-25 12:01:32 +02:00
|
|
|
</div>
|
|
|
|
{{end}}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{{if .Owner.IsOrganization}}
|
|
|
|
<br>
|
|
|
|
<div class="whitelist field">
|
2022-06-27 22:58:46 +02:00
|
|
|
<label>{{.locale.Tr "repo.settings.protect_merge_whitelist_teams"}}</label>
|
2018-03-25 12:01:32 +02:00
|
|
|
<div class="ui multiple search selection dropdown">
|
|
|
|
<input type="hidden" name="merge_whitelist_teams" value="{{.merge_whitelist_teams}}">
|
2022-06-27 22:58:46 +02:00
|
|
|
<div class="default text">{{.locale.Tr "repo.settings.protect_whitelist_search_teams"}}</div>
|
2018-03-25 12:01:32 +02:00
|
|
|
<div class="menu">
|
|
|
|
{{range .Teams}}
|
|
|
|
<div class="item" data-value="{{.ID}}">
|
2020-09-11 22:19:00 +02:00
|
|
|
{{svg "octicon-people"}}
|
2018-03-25 12:01:32 +02:00
|
|
|
{{.Name}}
|
|
|
|
</div>
|
|
|
|
{{end}}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{{end}}
|
|
|
|
</div>
|
2018-12-11 12:28:37 +01:00
|
|
|
|
2019-09-18 07:39:45 +02:00
|
|
|
<div class="field">
|
|
|
|
<div class="ui checkbox">
|
2023-01-16 09:00:22 +01:00
|
|
|
<input class="enable-statuscheck" name="enable_status_check" type="checkbox" data-target="#statuscheck_contexts_box" {{if eq (len .branch_status_check_contexts) 0}}disabled{{end}} {{if .Rule.EnableStatusCheck}}checked{{end}}>
|
2022-06-27 22:58:46 +02:00
|
|
|
<label>{{.locale.Tr "repo.settings.protect_check_status_contexts"}}</label>
|
|
|
|
<p class="help">{{.locale.Tr "repo.settings.protect_check_status_contexts_desc"}}</p>
|
2019-09-18 07:39:45 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2023-01-16 09:00:22 +01:00
|
|
|
<div id="statuscheck_contexts_box" class="fields {{if not .Rule.EnableStatusCheck}}disabled{{end}}">
|
2019-09-18 07:39:45 +02:00
|
|
|
<div class="field">
|
|
|
|
<table class="ui celled table six column">
|
|
|
|
<thead>
|
|
|
|
<tr><th>
|
2022-06-27 22:58:46 +02:00
|
|
|
{{.locale.Tr "repo.settings.protect_check_status_contexts_list"}}
|
2019-09-18 07:39:45 +02:00
|
|
|
</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
{{range $.branch_status_check_contexts}}
|
|
|
|
<tr><td>
|
|
|
|
<span class="ui checkbox">
|
2019-11-03 01:54:39 +01:00
|
|
|
<input class="enable-whitelist" name="status_check_contexts" value="{{.}}" type="checkbox" {{if $.is_context_required}}{{if call $.is_context_required .}}checked{{end}}{{end}}>
|
2019-09-18 07:39:45 +02:00
|
|
|
</span>
|
|
|
|
{{.}}
|
|
|
|
{{if $.is_context_required}}{{if call $.is_context_required .}}<div class="ui label right">Required</div>{{end}}{{end}}
|
|
|
|
</td></tr>
|
|
|
|
{{end}}
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2018-12-11 12:28:37 +01:00
|
|
|
<div class="field">
|
2022-06-27 22:58:46 +02:00
|
|
|
<label for="required-approvals">{{.locale.Tr "repo.settings.protect_required_approvals"}}</label>
|
2023-01-16 09:00:22 +01:00
|
|
|
<input name="required_approvals" id="required-approvals" type="number" value="{{.Rule.RequiredApprovals}}">
|
2022-06-27 22:58:46 +02:00
|
|
|
<p class="help">{{.locale.Tr "repo.settings.protect_required_approvals_desc"}}</p>
|
2018-12-11 12:28:37 +01:00
|
|
|
</div>
|
2019-12-04 02:08:56 +01:00
|
|
|
<div class="field">
|
|
|
|
<div class="ui checkbox">
|
2023-01-16 09:00:22 +01:00
|
|
|
<input class="enable-whitelist" name="enable_approvals_whitelist" type="checkbox" data-target="#approvals_whitelist_box" {{if .Rule.EnableApprovalsWhitelist}}checked{{end}}>
|
2022-06-27 22:58:46 +02:00
|
|
|
<label>{{.locale.Tr "repo.settings.protect_approvals_whitelist_enabled"}}</label>
|
|
|
|
<p class="help">{{.locale.Tr "repo.settings.protect_approvals_whitelist_enabled_desc"}}</p>
|
2019-12-04 02:08:56 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
2023-01-16 09:00:22 +01:00
|
|
|
<div id="approvals_whitelist_box" class="fields {{if not .Rule.EnableApprovalsWhitelist}}disabled{{end}}">
|
2018-12-11 12:28:37 +01:00
|
|
|
<div class="whitelist field">
|
2022-06-27 22:58:46 +02:00
|
|
|
<label>{{.locale.Tr "repo.settings.protect_approvals_whitelist_users"}}</label>
|
2018-12-11 12:28:37 +01:00
|
|
|
<div class="ui multiple search selection dropdown">
|
|
|
|
<input type="hidden" name="approvals_whitelist_users" value="{{.approvals_whitelist_users}}">
|
2022-06-27 22:58:46 +02:00
|
|
|
<div class="default text">{{.locale.Tr "repo.settings.protect_whitelist_search_users"}}</div>
|
2018-12-11 12:28:37 +01:00
|
|
|
<div class="menu">
|
|
|
|
{{range .Users}}
|
|
|
|
<div class="item" data-value="{{.ID}}">
|
2023-03-16 17:32:25 +01:00
|
|
|
{{avatar $.Context . 28 "mini"}}{{template "repo/search_name" .}}
|
2018-12-11 12:28:37 +01:00
|
|
|
</div>
|
|
|
|
{{end}}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2019-12-04 02:08:56 +01:00
|
|
|
{{if .Owner.IsOrganization}}
|
|
|
|
<br>
|
|
|
|
<div class="whitelist field">
|
2022-06-27 22:58:46 +02:00
|
|
|
<label>{{.locale.Tr "repo.settings.protect_approvals_whitelist_teams"}}</label>
|
2019-12-04 02:08:56 +01:00
|
|
|
<div class="ui multiple search selection dropdown">
|
|
|
|
<input type="hidden" name="approvals_whitelist_teams" value="{{.approvals_whitelist_teams}}">
|
2022-06-27 22:58:46 +02:00
|
|
|
<div class="default text">{{.locale.Tr "repo.settings.protect_whitelist_search_teams"}}</div>
|
2019-12-04 02:08:56 +01:00
|
|
|
<div class="menu">
|
|
|
|
{{range .Teams}}
|
|
|
|
<div class="item" data-value="{{.ID}}">
|
2020-09-11 22:19:00 +02:00
|
|
|
{{svg "octicon-people"}}
|
2019-12-04 02:08:56 +01:00
|
|
|
{{.Name}}
|
|
|
|
</div>
|
|
|
|
{{end}}
|
2018-12-11 12:28:37 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2019-12-04 02:08:56 +01:00
|
|
|
{{end}}
|
2018-12-11 12:28:37 +01:00
|
|
|
</div>
|
2020-01-03 18:47:10 +01:00
|
|
|
<div class="field">
|
|
|
|
<div class="ui checkbox">
|
2023-01-16 09:00:22 +01:00
|
|
|
<input name="block_on_rejected_reviews" type="checkbox" {{if .Rule.BlockOnRejectedReviews}}checked{{end}}>
|
2022-06-27 22:58:46 +02:00
|
|
|
<label for="block_on_rejected_reviews">{{.locale.Tr "repo.settings.block_rejected_reviews"}}</label>
|
|
|
|
<p class="help">{{.locale.Tr "repo.settings.block_rejected_reviews_desc"}}</p>
|
2020-01-03 18:47:10 +01:00
|
|
|
</div>
|
2020-01-15 09:32:57 +01:00
|
|
|
</div>
|
2020-11-28 20:30:46 +01:00
|
|
|
<div class="field">
|
|
|
|
<div class="ui checkbox">
|
2023-01-16 09:00:22 +01:00
|
|
|
<input name="block_on_official_review_requests" type="checkbox" {{if .Rule.BlockOnOfficialReviewRequests}}checked{{end}}>
|
2022-06-27 22:58:46 +02:00
|
|
|
<label for="block_on_official_review_requests">{{.locale.Tr "repo.settings.block_on_official_review_requests"}}</label>
|
|
|
|
<p class="help">{{.locale.Tr "repo.settings.block_on_official_review_requests_desc"}}</p>
|
2020-11-28 20:30:46 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
2020-01-09 02:47:45 +01:00
|
|
|
<div class="field">
|
|
|
|
<div class="ui checkbox">
|
2023-01-16 09:00:22 +01:00
|
|
|
<input name="dismiss_stale_approvals" type="checkbox" {{if .Rule.DismissStaleApprovals}}checked{{end}}>
|
2022-06-27 22:58:46 +02:00
|
|
|
<label for="dismiss_stale_approvals">{{.locale.Tr "repo.settings.dismiss_stale_approvals"}}</label>
|
|
|
|
<p class="help">{{.locale.Tr "repo.settings.dismiss_stale_approvals_desc"}}</p>
|
2020-01-09 02:47:45 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
2020-01-15 09:32:57 +01:00
|
|
|
<div class="field">
|
|
|
|
<div class="ui checkbox">
|
2023-01-16 09:00:22 +01:00
|
|
|
<input name="require_signed_commits" type="checkbox" {{if .Rule.RequireSignedCommits}}checked{{end}}>
|
2022-06-27 22:58:46 +02:00
|
|
|
<label for="require_signed_commits">{{.locale.Tr "repo.settings.require_signed_commits"}}</label>
|
|
|
|
<p class="help">{{.locale.Tr "repo.settings.require_signed_commits_desc"}}</p>
|
2020-01-15 09:32:57 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
2020-04-17 03:00:36 +02:00
|
|
|
<div class="field">
|
|
|
|
<div class="ui checkbox">
|
2023-01-16 09:00:22 +01:00
|
|
|
<input name="block_on_outdated_branch" type="checkbox" {{if .Rule.BlockOnOutdatedBranch}}checked{{end}}>
|
2022-06-27 22:58:46 +02:00
|
|
|
<label for="block_on_outdated_branch">{{.locale.Tr "repo.settings.block_outdated_branch"}}</label>
|
|
|
|
<p class="help">{{.locale.Tr "repo.settings.block_outdated_branch_desc"}}</p>
|
2020-04-17 03:00:36 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
2020-03-26 23:26:34 +01:00
|
|
|
<div class="field">
|
2022-06-27 22:58:46 +02:00
|
|
|
<label for="protected_file_patterns">{{.locale.Tr "repo.settings.protect_protected_file_patterns"}}</label>
|
2023-01-16 09:00:22 +01:00
|
|
|
<input name="protected_file_patterns" id="protected_file_patterns" type="text" value="{{.Rule.ProtectedFilePatterns}}">
|
2022-06-27 22:58:46 +02:00
|
|
|
<p class="help">{{.locale.Tr "repo.settings.protect_protected_file_patterns_desc" | Safe}}</p>
|
2020-03-26 23:26:34 +01:00
|
|
|
</div>
|
2021-09-11 16:21:17 +02:00
|
|
|
<div class="field">
|
2022-06-27 22:58:46 +02:00
|
|
|
<label for="unprotected_file_patterns">{{.locale.Tr "repo.settings.protect_unprotected_file_patterns"}}</label>
|
2023-01-16 09:00:22 +01:00
|
|
|
<input name="unprotected_file_patterns" id="unprotected_file_patterns" type="text" value="{{.Rule.UnprotectedFilePatterns}}">
|
2022-06-27 22:58:46 +02:00
|
|
|
<p class="help">{{.locale.Tr "repo.settings.protect_unprotected_file_patterns_desc" | Safe}}</p>
|
2021-09-11 16:21:17 +02:00
|
|
|
</div>
|
2017-09-14 10:16:22 +02:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="ui divider"></div>
|
|
|
|
|
|
|
|
<div class="field">
|
2023-01-16 09:00:22 +01:00
|
|
|
<button class="ui green button">{{$.locale.Tr "repo.settings.protected_branch.save_rule"}}</button>
|
|
|
|
<button class="ui gray button">{{$.locale.Tr "cancel"}}</button>
|
2017-09-14 10:16:22 +02:00
|
|
|
</div>
|
2023-01-16 09:00:22 +01:00
|
|
|
</div>
|
|
|
|
</form>
|
2017-09-14 10:16:22 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
2018-12-11 12:28:37 +01:00
|
|
|
{{template "base/footer" .}}
|