Skip to content

Commit 5647d19

Browse files
author
OpenShift Bot
authored
Merge pull request #2039 from jeff-phillips-18/secrets
Merged by openshift-bot
2 parents ca54bec + 381269a commit 5647d19

File tree

6 files changed

+42
-16
lines changed

6 files changed

+42
-16
lines changed

app/scripts/directives/addSecretToApplication.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,13 @@
8484
ctrl.$onInit = function() {
8585
ctrl.addType = 'env';
8686
ctrl.disableInputs = false;
87+
8788
getApplications();
89+
90+
var keyValidator = new RegExp("^[A-Za-z_]{1}[A-Za-z0-9_]*$");
91+
ctrl.hasInvalidEnvVars = _.some(ctrl.secret.data, function(value, key) {
92+
return !keyValidator.test(key);
93+
});
8894
};
8995

9096
ctrl.$postLink = function() {

app/styles/_secrets.less

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@
3737
}
3838
}
3939

40+
.env-warning {
41+
margin-left: 20px;
42+
}
43+
4044
.updating {
4145
background-color: @color-pf-white;
4246
bottom: 55px;

app/views/directives/add-secret-to-application.html

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,24 @@ <h3>Add to Application</h3>
2626
<legend>Add secret as:</legend>
2727
<div class="form-group">
2828
<div class="radio">
29-
<label class="add-choice" for="envFrom">
30-
<input id="envFrom" type="radio" ng-model="ctrl.addType" value="env" ng-disabled="ctrl.disableInputs">
31-
Environment variables
32-
</label>
29+
<div class="add-choice">
30+
<label>
31+
<input type="radio" ng-model="ctrl.addType" value="env" ng-disabled="ctrl.disableInputs">
32+
Environment variables
33+
</label>
34+
<div class="alert alert-warning env-warning" ng-show="ctrl.hasInvalidEnvVars">
35+
<span class="pficon pficon-warning-triangle-o" aria-hidden="true"></span>
36+
<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>
37+
</div>
38+
</div>
3339
<div>
34-
<label class="add-choice" for="mountVolume">
35-
<input type="radio" ng-model="ctrl.addType" value="volume" ng-disabled="ctrl.disableInputs">
40+
<label class="add-choice" for="volume">
41+
<input id="volume" type="radio" ng-model="ctrl.addType" value="volume" ng-disabled="ctrl.disableInputs">
3642
Volume
3743
</label>
3844
</div>
3945
<div class="volume-options">
40-
<div ng-class="{'has-error': (addToApplicationForm.mountVolume.$error.pattern && addToApplicationForm.mountVolume.$touched)}">
46+
<div ng-class="{'has-error': (addToApplicationForm.mountVolume.$error.oscUnique || (addToApplicationForm.mountVolume.$error.pattern && addToApplicationForm.mountVolume.$touched))}">
4147
<input class="form-control"
4248
name="mountVolume"
4349
id="mountVolume"
@@ -57,9 +63,9 @@ <h3>Add to Application</h3>
5763
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.
5864
</div>
5965
<div class="has-error" ng-show="addToApplicationForm.mountVolume.$error.oscUnique">
60-
<span class="help-block">
61-
The mount path is already used. Please choose another mount path.
62-
</span>
66+
<span class="help-block">
67+
The mount path is already used. Please choose another mount path.
68+
</span>
6369
</div>
6470
</div>
6571
</div>

dist/scripts/scripts.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10629,6 +10629,10 @@ d = _.toArray(e.by("metadata.name")), p();
1062910629
};
1063010630
m.$onInit = function() {
1063110631
m.addType = "env", m.disableInputs = !1, f();
10632+
var e = new RegExp("^[A-Za-z_]{1}[A-Za-z0-9_]*$");
10633+
m.hasInvalidEnvVars = _.some(m.secret.data, function(t, n) {
10634+
return !e.test(n);
10635+
});
1063210636
}, m.$postLink = function() {
1063310637
t.$watch(function() {
1063410638
return m.application;

dist/scripts/templates.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5567,18 +5567,24 @@ angular.module('openshiftConsoleTemplates', []).run(['$templateCache', function(
55675567
"<legend>Add secret as:</legend>\n" +
55685568
"<div class=\"form-group\">\n" +
55695569
"<div class=\"radio\">\n" +
5570-
"<label class=\"add-choice\" for=\"envFrom\">\n" +
5571-
"<input id=\"envFrom\" type=\"radio\" ng-model=\"ctrl.addType\" value=\"env\" ng-disabled=\"ctrl.disableInputs\">\n" +
5570+
"<div class=\"add-choice\">\n" +
5571+
"<label>\n" +
5572+
"<input type=\"radio\" ng-model=\"ctrl.addType\" value=\"env\" ng-disabled=\"ctrl.disableInputs\">\n" +
55725573
"Environment variables\n" +
55735574
"</label>\n" +
5575+
"<div class=\"alert alert-warning env-warning\" ng-show=\"ctrl.hasInvalidEnvVars\">\n" +
5576+
"<span class=\"pficon pficon-warning-triangle-o\" aria-hidden=\"true\"></span>\n" +
5577+
"<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" +
5578+
"</div>\n" +
5579+
"</div>\n" +
55745580
"<div>\n" +
5575-
"<label class=\"add-choice\" for=\"mountVolume\">\n" +
5576-
"<input type=\"radio\" ng-model=\"ctrl.addType\" value=\"volume\" ng-disabled=\"ctrl.disableInputs\">\n" +
5581+
"<label class=\"add-choice\" for=\"volume\">\n" +
5582+
"<input id=\"volume\" type=\"radio\" ng-model=\"ctrl.addType\" value=\"volume\" ng-disabled=\"ctrl.disableInputs\">\n" +
55775583
"Volume\n" +
55785584
"</label>\n" +
55795585
"</div>\n" +
55805586
"<div class=\"volume-options\">\n" +
5581-
"<div ng-class=\"{'has-error': (addToApplicationForm.mountVolume.$error.pattern && addToApplicationForm.mountVolume.$touched)}\">\n" +
5587+
"<div ng-class=\"{'has-error': (addToApplicationForm.mountVolume.$error.oscUnique || (addToApplicationForm.mountVolume.$error.pattern && addToApplicationForm.mountVolume.$touched))}\">\n" +
55825588
"<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" +
55835589
"</div>\n" +
55845590
"<div class=\"help-block bind-description\">\n" +

dist/styles/main.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)