245b5a8e6a
Branch Policy Check / Verify merge target (pull_request) Failing after 4s
Universal: PR Check / Branch Policy (pull_request) Failing after 4s
Generic: Repo Health / Site Health (pull_request) Has been skipped
Universal: PR Check / Validate PR (pull_request) Failing after 15s
Generic: Repo Health / Access control (pull_request) Successful in 5s
Generic: Project CI / Lint & Validate (pull_request) Successful in 1m0s
Generic: Repo Health / Site Health (push) Has been skipped
Generic: Repo Health / Access control (push) Successful in 3s
Branch Cleanup / Delete merged branch (pull_request) Has been skipped
RC Revert / Rename rc/ back to dev/ (pull_request) Has been skipped
PR RC Release / Build RC Release (pull_request) Failing after 1m30s
Universal: Auto Version Bump / Version Bump (push) Successful in 11s
Universal: Build & Release / Promote to RC (pull_request) Has been skipped
Universal: Build & Release / Build & Release Pipeline (pull_request) Has been skipped
Universal: Secret Scanning / Gitleaks Secret Scan (pull_request) Successful in 2m37s
Generic: Project CI / Tests (pull_request) Has been cancelled
Universal: PR Check / Build RC Package (pull_request) Has been cancelled
Universal: PR Check / Report Issues (pull_request) Has been cancelled
Generic: Repo Health / Scripts governance (pull_request) Has been cancelled
Generic: Repo Health / Repository health (pull_request) Has been cancelled
Generic: Repo Health / Report Issues (pull_request) Has been cancelled
Generic: Repo Health / Scripts governance (push) Has been cancelled
Generic: Repo Health / Repository health (push) Has been cancelled
Generic: Repo Health / Report Issues (push) Has been cancelled
- Add required checkbox to org custom field settings form - Show red asterisk (*) indicator on required fields in the list - Validate required custom fields on API issue create (return 422) - Add locale strings for required field UI The Required column already exists in the DB (migration v343) and is already validated in the web form. This adds the missing org settings UI checkbox and API-side validation. Co-Authored-By: Moko Consulting <hello@mokoconsulting.tech>
93 lines
3.7 KiB
Handlebars
93 lines
3.7 KiB
Handlebars
{{template "org/settings/layout_head" (dict "ctxData" . "pageClass" "organization settings custom-fields")}}
|
|
<h4 class="ui top attached header">
|
|
{{ctx.Locale.Tr "org.settings.custom_fields"}}
|
|
</h4>
|
|
<div class="ui attached segment">
|
|
<p class="text grey">{{ctx.Locale.Tr "org.settings.custom_fields_desc"}}</p>
|
|
|
|
{{if .CustomFields}}
|
|
<table class="ui compact table">
|
|
<thead>
|
|
<tr>
|
|
<th>{{ctx.Locale.Tr "org.settings.custom_field_name"}}</th>
|
|
<th>{{ctx.Locale.Tr "org.settings.custom_field_scope"}}</th>
|
|
<th>{{ctx.Locale.Tr "org.settings.custom_field_type"}}</th>
|
|
<th>{{ctx.Locale.Tr "org.settings.custom_field_options"}}</th>
|
|
<th></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{{range .CustomFields}}
|
|
<tr>
|
|
<td><strong>{{.Name}}</strong>{{if .Required}} <span class="tw-text-red" data-tooltip-content="Required">*</span>{{end}}{{if .Description}}<br><small class="text grey">{{.Description}}</small>{{end}}</td>
|
|
<td>{{if eq .Scope "issue"}}{{svg "octicon-issue-opened" 14}} Issue{{else}}{{svg "octicon-repo" 14}} Repo{{end}}</td>
|
|
<td><code>{{.FieldType}}</code></td>
|
|
<td>{{if .Options}}<code class="tw-text-xs">{{.Options}}</code>{{else}}<span class="text grey">-</span>{{end}}</td>
|
|
<td class="tw-text-right">
|
|
<form method="post" action="{{$.OrgLink}}/settings/custom-fields/{{.ID}}/delete" class="tw-inline">
|
|
{{$.CsrfTokenHtml}}
|
|
<button class="ui tiny red icon button" type="submit" title="{{ctx.Locale.Tr "remove"}}">{{svg "octicon-trash" 14}}</button>
|
|
</form>
|
|
</td>
|
|
</tr>
|
|
{{end}}
|
|
</tbody>
|
|
</table>
|
|
{{else}}
|
|
<div class="empty-placeholder">
|
|
<p>{{ctx.Locale.Tr "org.settings.custom_fields_empty"}}</p>
|
|
</div>
|
|
{{end}}
|
|
|
|
<div class="divider"></div>
|
|
|
|
<h5>{{ctx.Locale.Tr "org.settings.custom_field_add"}}</h5>
|
|
<form class="ui form" method="post" action="{{.OrgLink}}/settings/custom-fields">
|
|
{{.CsrfTokenHtml}}
|
|
<div class="three fields">
|
|
<div class="required field">
|
|
<label>{{ctx.Locale.Tr "org.settings.custom_field_name"}}</label>
|
|
<input name="name" required placeholder="e.g. Status, Platform, Priority">
|
|
</div>
|
|
<div class="field">
|
|
<label>{{ctx.Locale.Tr "org.settings.custom_field_scope"}}</label>
|
|
<select name="scope" class="ui dropdown">
|
|
<option value="issue">{{svg "octicon-issue-opened" 14}} Issue (sidebar)</option>
|
|
<option value="repo">{{svg "octicon-repo" 14}} Repo (metadata)</option>
|
|
</select>
|
|
</div>
|
|
<div class="field">
|
|
<label>{{ctx.Locale.Tr "org.settings.custom_field_type"}}</label>
|
|
<select name="field_type" class="ui dropdown">
|
|
<option value="dropdown">Dropdown</option>
|
|
<option value="text">Text</option>
|
|
<option value="number">Number</option>
|
|
<option value="date">Date</option>
|
|
<option value="checkbox">Checkbox</option>
|
|
<option value="url">URL</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="two fields">
|
|
<div class="field">
|
|
<label>{{ctx.Locale.Tr "org.settings.custom_field_options"}}</label>
|
|
<input name="options" placeholder='["Option 1","Option 2","Option 3"]'>
|
|
<p class="help">{{ctx.Locale.Tr "org.settings.custom_field_options_help"}}</p>
|
|
</div>
|
|
<div class="field">
|
|
<label>{{ctx.Locale.Tr "org.settings.custom_field_description"}}</label>
|
|
<input name="description" placeholder="Help text shown to users">
|
|
</div>
|
|
</div>
|
|
<div class="field">
|
|
<div class="ui checkbox">
|
|
<input type="checkbox" name="required">
|
|
<label>{{ctx.Locale.Tr "org.settings.custom_field_required"}}</label>
|
|
</div>
|
|
<p class="help">{{ctx.Locale.Tr "org.settings.custom_field_required_help"}}</p>
|
|
</div>
|
|
<button class="ui primary button" type="submit">{{ctx.Locale.Tr "org.settings.custom_field_add"}}</button>
|
|
</form>
|
|
</div>
|
|
{{template "org/settings/layout_footer" .}}
|