Skip to content

Commit

Permalink
Merge pull request #2039 from jeff-phillips-18/secrets
Browse files Browse the repository at this point in the history
Merged by openshift-bot
  • Loading branch information
OpenShift Bot committed Sep 12, 2017
2 parents ca54bec + 381269a commit 5647d19
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 16 deletions.
6 changes: 6 additions & 0 deletions app/scripts/directives/addSecretToApplication.js
Expand Up @@ -84,7 +84,13 @@
ctrl.$onInit = function() {
ctrl.addType = 'env';
ctrl.disableInputs = false;

getApplications();

var keyValidator = new RegExp("^[A-Za-z_]{1}[A-Za-z0-9_]*$");
ctrl.hasInvalidEnvVars = _.some(ctrl.secret.data, function(value, key) {
return !keyValidator.test(key);
});
};

ctrl.$postLink = function() {
Expand Down
4 changes: 4 additions & 0 deletions app/styles/_secrets.less
Expand Up @@ -37,6 +37,10 @@
}
}

.env-warning {
margin-left: 20px;
}

.updating {
background-color: @color-pf-white;
bottom: 55px;
Expand Down
26 changes: 16 additions & 10 deletions app/views/directives/add-secret-to-application.html
Expand Up @@ -26,18 +26,24 @@ <h3>Add to Application</h3>
<legend>Add secret as:</legend>
<div class="form-group">
<div class="radio">
<label class="add-choice" for="envFrom">
<input id="envFrom" type="radio" ng-model="ctrl.addType" value="env" ng-disabled="ctrl.disableInputs">
Environment variables
</label>
<div class="add-choice">
<label>
<input type="radio" ng-model="ctrl.addType" value="env" ng-disabled="ctrl.disableInputs">
Environment variables
</label>
<div class="alert alert-warning env-warning" ng-show="ctrl.hasInvalidEnvVars">
<span class="pficon pficon-warning-triangle-o" aria-hidden="true"></span>
<span>Some of the keys for secret <strong>{{ctrl.secret.metadata.name}}</strong> are not valid environment variable names and will not be added.</span>
</div>
</div>
<div>
<label class="add-choice" for="mountVolume">
<input type="radio" ng-model="ctrl.addType" value="volume" ng-disabled="ctrl.disableInputs">
<label class="add-choice" for="volume">
<input id="volume" type="radio" ng-model="ctrl.addType" value="volume" ng-disabled="ctrl.disableInputs">
Volume
</label>
</div>
<div class="volume-options">
<div ng-class="{'has-error': (addToApplicationForm.mountVolume.$error.pattern && addToApplicationForm.mountVolume.$touched)}">
<div ng-class="{'has-error': (addToApplicationForm.mountVolume.$error.oscUnique || (addToApplicationForm.mountVolume.$error.pattern && addToApplicationForm.mountVolume.$touched))}">
<input class="form-control"
name="mountVolume"
id="mountVolume"
Expand All @@ -57,9 +63,9 @@ <h3>Add to Application</h3>
Mount Path for the volume. A file will be created in this director for each key from the secret. The file contents will be the value of the key.
</div>
<div class="has-error" ng-show="addToApplicationForm.mountVolume.$error.oscUnique">
<span class="help-block">
The mount path is already used. Please choose another mount path.
</span>
<span class="help-block">
The mount path is already used. Please choose another mount path.
</span>
</div>
</div>
</div>
Expand Down
4 changes: 4 additions & 0 deletions dist/scripts/scripts.js
Expand Up @@ -10629,6 +10629,10 @@ d = _.toArray(e.by("metadata.name")), p();
};
m.$onInit = function() {
m.addType = "env", m.disableInputs = !1, f();
var e = new RegExp("^[A-Za-z_]{1}[A-Za-z0-9_]*$");
m.hasInvalidEnvVars = _.some(m.secret.data, function(t, n) {
return !e.test(n);
});
}, m.$postLink = function() {
t.$watch(function() {
return m.application;
Expand Down
16 changes: 11 additions & 5 deletions dist/scripts/templates.js
Expand Up @@ -5567,18 +5567,24 @@ angular.module('openshiftConsoleTemplates', []).run(['$templateCache', function(
"<legend>Add secret as:</legend>\n" +
"<div class=\"form-group\">\n" +
"<div class=\"radio\">\n" +
"<label class=\"add-choice\" for=\"envFrom\">\n" +
"<input id=\"envFrom\" type=\"radio\" ng-model=\"ctrl.addType\" value=\"env\" ng-disabled=\"ctrl.disableInputs\">\n" +
"<div class=\"add-choice\">\n" +
"<label>\n" +
"<input type=\"radio\" ng-model=\"ctrl.addType\" value=\"env\" ng-disabled=\"ctrl.disableInputs\">\n" +
"Environment variables\n" +
"</label>\n" +
"<div class=\"alert alert-warning env-warning\" ng-show=\"ctrl.hasInvalidEnvVars\">\n" +
"<span class=\"pficon pficon-warning-triangle-o\" aria-hidden=\"true\"></span>\n" +
"<span>Some of the keys for secret <strong>{{ctrl.secret.metadata.name}}</strong> are not valid environment variable names and will not be added.</span>\n" +
"</div>\n" +
"</div>\n" +
"<div>\n" +
"<label class=\"add-choice\" for=\"mountVolume\">\n" +
"<input type=\"radio\" ng-model=\"ctrl.addType\" value=\"volume\" ng-disabled=\"ctrl.disableInputs\">\n" +
"<label class=\"add-choice\" for=\"volume\">\n" +
"<input id=\"volume\" type=\"radio\" ng-model=\"ctrl.addType\" value=\"volume\" ng-disabled=\"ctrl.disableInputs\">\n" +
"Volume\n" +
"</label>\n" +
"</div>\n" +
"<div class=\"volume-options\">\n" +
"<div ng-class=\"{'has-error': (addToApplicationForm.mountVolume.$error.pattern && addToApplicationForm.mountVolume.$touched)}\">\n" +
"<div ng-class=\"{'has-error': (addToApplicationForm.mountVolume.$error.oscUnique || (addToApplicationForm.mountVolume.$error.pattern && addToApplicationForm.mountVolume.$touched))}\">\n" +
"<input class=\"form-control\" name=\"mountVolume\" id=\"mountVolume\" placeholder=\"Enter a mount path\" type=\"text\" required ng-pattern=\"/^\\/.*$/\" osc-unique=\"ctrl.existingMountPaths\" aria-describedby=\"mount-path-help\" ng-disabled=\"ctrl.addType !== 'volume' || ctrl.disableInputs\" ng-model=\"ctrl.mountVolume\" autocorrect=\"off\" autocapitalize=\"off\" spellcheck=\"false\">\n" +
"</div>\n" +
"<div class=\"help-block bind-description\">\n" +
Expand Down
2 changes: 1 addition & 1 deletion dist/styles/main.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 5647d19

Please sign in to comment.