Fix checkboxes in setup tool to use a directive

Fixes #1481
This commit is contained in:
Joseph Schorr 2016-05-20 12:23:32 -05:00
parent 9d3542997e
commit f2b3c89ec9
4 changed files with 59 additions and 69 deletions

View file

@ -431,6 +431,11 @@ a:focus {
border-top: 1px solid #eee;
}
.config-bool-field-element input {
margin-right: 6px;
font-size: 24px;
}
.config-setup-tool-element .help-text {
margin-top: 6px;
color: #aaa;

View file

@ -1,5 +1,8 @@
<div class="config-bool-field-element">
<form name="fieldform" novalidate>
<input type="checkbox" ng-model="binding">
<label>
<input type="checkbox" ng-model="binding">
<span ng-transclude/>
</label>
</form>
</div>

View file

@ -36,9 +36,8 @@
<tr>
<td class="non-input">Anonymous Access:</td>
<td colspan="2">
<div class="co-checkbox">
<input id="ftaa" type="checkbox" ng-model="config.FEATURE_ANONYMOUS_ACCESS">
<label for="ftaa">Enable Anonymous Access</label>
<div class="config-bool-field" binding="config.FEATURE_ANONYMOUS_ACCESS">
Enable Anonymous Access
</div>
<div class="help-text">
If enabled, public repositories and search can be accessed by anyone that can
@ -50,9 +49,8 @@
<tr>
<td class="non-input">User Creation:</td>
<td colspan="2">
<div class="co-checkbox">
<input id="ftuc" type="checkbox" ng-model="config.FEATURE_USER_CREATION">
<label for="ftuc">Enable Open User Creation</label>
<div class="config-bool-field" binding="config.FEATURE_USER_CREATION">
Enable Open User Creation
</div>
<div class="help-text">
If enabled, user accounts can be created by anyone.
@ -63,9 +61,8 @@
<tr>
<td class="non-input">Encrypted Client Password:</td>
<td colspan="2">
<div class="co-checkbox">
<input id="ftet" type="checkbox" ng-model="config.FEATURE_REQUIRE_ENCRYPTED_BASIC_AUTH">
<label for="ftet">Require Encrypted Client Passwords</label>
<div class="config-bool-field" binding="config.FEATURE_REQUIRE_ENCRYPTED_BASIC_AUTH">
Require Encrypted Client Passwords
</div>
<div class="help-text">
If enabled, users will not be able to login from the Docker command
@ -103,11 +100,12 @@
<tr>
<td>SSL:</td>
<td>
<div class="co-checkbox">
<input id="enable-ssl" type="checkbox" ng-model="config.PREFERRED_URL_SCHEME"
<label class="config-bool-field-element">
<input type="checkbox" ng-model="config.PREFERRED_URL_SCHEME"
ng-true-value="'https'" ng-false-value="'http'">
<label for="enable-ssl">Enable SSL</label>
</div>
Enable SSL
</label>
<div class="help-text" style="margin-bottom: 10px">
A valid SSL certificate and private key files are required to use this option.
</div>
@ -194,11 +192,11 @@
<strong>A remote storage system is required for high-availability systems.</strong>
</p>
<div class="co-checkbox feature-storage-replication">
<input id="ftsr" type="checkbox" ng-model="config.FEATURE_STORAGE_REPLICATION">
<label for="ftsr">Enable Storage Replication</label>
<!-- TODO(josephschorr): add link to documentation -->
<div class="help-text">If enabled, replicates storage to other regions.</div>
<div class="config-bool-field feature-storage-replication" binding="config.FEATURE_STORAGE_REPLICATION">
Enable Storage Replication
<div class="help-text">
If enabled, replicates storage to other regions. See <a href="https://tectonic.com/quay-enterprise/docs/latest/geo-replication.html" ng-safenewtab>documentation</a> for more information.
</div>
</div>
<div class="storage-config" ng-class="$last ? 'last' : ''" ng-repeat="sc in storageConfig">
@ -220,9 +218,8 @@
<tr ng-if="config.FEATURE_STORAGE_REPLICATION">
<td class="non-input">Set Default:</td>
<td>
<div class="co-checkbox">
<input id="default-location-{{ $index }}" ng-model="sc.defaultLocation" type="checkbox">
<label for="default-location-{{ $index }}">Replicate to storage engine by default</label>
<div class="config-bool-field" binding="sc.defaultLocation">
Replicate to storage engine by default
</div>
</td>
</tr>
@ -257,11 +254,11 @@
placeholder="{{ field.placeholder }}"
ng-if="field.kind == 'text'"
is-optional="field.optional"></span>
<div class="co-checkbox" ng-if="field.kind == 'bool'">
<input id="dsc-{{ field.name }}" type="checkbox"
ng-model="sc.data[1][field.name]">
<label for="dsc-{{ field.name }}">{{ field.placeholder }}</label>
</div>
<span class="config-bool-field"
binding="sc.data[1][field.name]"
ng-if="field.kind == 'bool'">
{{ field.placeholder }}
</span>
<div ng-if="field.kind == 'option'">
<select ng-model="sc.data[1][field.name]">
<option ng-repeat="value in field.values" value="{{ value }}"
@ -298,11 +295,9 @@
</p>
</div>
<div class="co-checkbox">
<input id="ftsecurity" type="checkbox" ng-model="config.FEATURE_SECURITY_SCANNER">
<label for="ftsecurity">Enable Security Scanning</label>
<div class="config-bool-field" binding="config.FEATURE_SECURITY_SCANNER">
Enable Security Scanning
</div>
<div class="co-alert co-alert-info" ng-if="config.FEATURE_SECURITY_SCANNER" style="margin-top: 20px;">
A scanner compliant with the Quay Security Scanning API must be running to use this feature. Documentation on running <a href="https://github.com/coreos/clair" ng-safenewtab>Clair</a> can be found at <a href="https://tectonic.com/quay-enterprise/docs/latest/clair.html" ng-safenewtab>Running Clair Security Scanner</a>.
</div>
@ -343,9 +338,8 @@
<p>If enabled, all images in the registry can be fetched via <code>rkt fetch</code> or any other <a href="https://github.com/appc/spec/blob/master/spec/discovery.md" ng-safenewtab>AppC discovery</a>-compliant implementation.</p>
</div>
<div class="co-checkbox">
<input id="ftaci" type="checkbox" ng-model="config.FEATURE_ACI_CONVERSION">
<label for="ftaci">Enable ACI Conversion</label>
<div class="config-bool-field" binding="config.FEATURE_ACI_CONVERSION">
Enable ACI Conversion
</div>
<div class="co-alert co-alert-info" ng-if="config.FEATURE_ACI_CONVERSION" style="margin-top: 20px;">
@ -390,9 +384,8 @@
users to reset their passwords.</p>
</div>
<div class="co-checkbox">
<input id="ftmail" type="checkbox" ng-model="config.FEATURE_MAILING">
<label for="ftmail">Enable E-mails</label>
<div class="config-bool-field" binding="config.FEATURE_MAILING">
Enable E-mails
</div>
<table class="config-table" ng-if="config.FEATURE_MAILING">
@ -415,9 +408,8 @@
<tr>
<td>TLS:</td>
<td>
<div class="co-checkbox">
<input id="mut" type="checkbox" ng-model="config.MAIL_USE_TLS">
<label for="mut">Use TLS</label>
<div class="config-bool-field" binding="config.MAIL_USE_TLS">
Require TLS
</div>
</td>
</tr>
@ -435,9 +427,8 @@
<tr>
<td>Authentication:</td>
<td>
<div class="co-checkbox">
<input id="uma" type="checkbox" ng-model="config.MAIL_USE_AUTH">
<label for="uma">Requires Authentication</label>
<div class="config-bool-field" binding="config.MAIL_USE_AUTH">
Requires Authentication
</div>
<table class="config-table" ng-if="config.MAIL_USE_AUTH">
@ -684,9 +675,8 @@
<tr ng-if="config.LDAP_URI.indexOf('ldaps://') == 0">
<td class="non-input">Allow insecure:</td>
<td>
<div class="co-checkbox">
<input id="ldapfallbacktls" type="checkbox" ng-model="config.LDAP_ALLOW_INSECURE_FALLBACK.ORG_RESTRICT" class="ng-pristine ng-valid">
<label for="ldapfallbacktls">Allow fallback to non-TLS connections</label>
<div class="config-bool-field" binding="config.LDAP_ALLOW_INSECURE_FALLBACK">
Allow fallback to non-TLS connections
</div>
<div class="help-text">
If enabled, LDAP will fallback to <strong>insecure non-TLS connections</strong> if TLS does not succeed.
@ -716,9 +706,8 @@
</p>
</div>
<div class="co-checkbox">
<input id="ftghl" type="checkbox" ng-model="config.FEATURE_GITHUB_LOGIN">
<label for="ftghl">Enable GitHub Authentication</label>
<div class="config-bool-field" binding="config.FEATURE_GITHUB_LOGIN">
Enable GitHub Authentication
</div>
<table class="config-table" ng-if="config.FEATURE_GITHUB_LOGIN">
@ -761,10 +750,8 @@
<tr>
<td>Organization Filtering:</td>
<td>
<div class="co-checkbox">
<input id="ftghlof" type="checkbox"
ng-model="config.GITHUB_LOGIN_CONFIG.ORG_RESTRICT">
<label for="ftghlof">Restrict By Organization Membership</label>
<div class="config-bool-field" binding="config.GITHUB_LOGIN_CONFIG.ORG_RESTRICT">
Restrict By Organization Membership
</div>
<div class="help-text" style="margin-bottom: 20px;">
@ -804,9 +791,8 @@
</p>
</div>
<div class="co-checkbox">
<input id="ftgoa" type="checkbox" ng-model="config.FEATURE_GOOGLE_LOGIN">
<label for="ftgoa">Enable Google Authentication</label>
<div class="config-bool-field" binding="config.FEATURE_GOOGLE_LOGIN">
Enable Google Authentication
</div>
<table class="config-table" ng-if="config.FEATURE_GOOGLE_LOGIN">
@ -838,9 +824,8 @@
If enabled, users can submit Dockerfiles to be built and pushed by the Enterprise Registry.
</div>
<div class="co-checkbox">
<input id="ftbs" type="checkbox" ng-model="config.FEATURE_BUILD_SUPPORT">
<label for="ftbs">Enable Dockerfile Build</label>
<div class="config-bool-field" binding="config.FEATURE_BUILD_SUPPORT">
Enable Dockerfile Build
</div>
<div ng-if="config.FEATURE_BUILD_SUPPORT" style="margin-top: 10px">
@ -869,9 +854,8 @@
</p>
</div>
<div class="co-checkbox">
<input id="ftgb" type="checkbox" ng-model="config.FEATURE_GITHUB_BUILD">
<label for="ftgb">Enable GitHub Triggers</label>
<div class="config-bool-field" binding="config.FEATURE_GITHUB_BUILD">
Enable GitHub Triggers
</div>
<table class="config-table" ng-if="config.FEATURE_GITHUB_BUILD">
@ -934,9 +918,8 @@
</p>
</div>
<div class="co-checkbox">
<input id="ftbbb" type="checkbox" ng-model="config.FEATURE_BITBUCKET_BUILD">
<label for="ftbbb">Enable BitBucket Triggers</label>
<div class="config-bool-field" binding="config.FEATURE_BITBUCKET_BUILD">
Enable BitBucket Triggers
</div>
<table class="config-table" ng-if="config.FEATURE_BITBUCKET_BUILD">
@ -981,9 +964,8 @@
</p>
</div>
<div class="co-checkbox">
<input id="ftglb" type="checkbox" ng-model="config.FEATURE_GITLAB_BUILD">
<label for="ftglb">Enable GitLab Triggers</label>
<div class="config-bool-field" binding="config.FEATURE_GITLAB_BUILD">
Enable GitLab Triggers
</div>
<table class="config-table" ng-if="config.FEATURE_GITLAB_BUILD">

View file

@ -801,7 +801,7 @@ angular.module("core-config-setup", ['angularFileUpload'])
priority: 0,
templateUrl: '/static/directives/config/config-bool-field.html',
replace: false,
transclude: false,
transclude: true,
restrict: 'C',
scope: {
'binding': '=binding'