diff --git a/app/scripts/directives/addSecretToApplication.js b/app/scripts/directives/addSecretToApplication.js index c2681b2a9e..57b0d6fb6d 100644 --- a/app/scripts/directives/addSecretToApplication.js +++ b/app/scripts/directives/addSecretToApplication.js @@ -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() { diff --git a/app/styles/_secrets.less b/app/styles/_secrets.less index b3b45581a1..a8db01980f 100644 --- a/app/styles/_secrets.less +++ b/app/styles/_secrets.less @@ -37,6 +37,10 @@ } } + .env-warning { + margin-left: 20px; + } + .updating { background-color: @color-pf-white; bottom: 55px; diff --git a/app/views/directives/add-secret-to-application.html b/app/views/directives/add-secret-to-application.html index 7e88b520c0..86471fb899 100644 --- a/app/views/directives/add-secret-to-application.html +++ b/app/views/directives/add-secret-to-application.html @@ -26,18 +26,24 @@

Add to Application

Add secret as:
- +
+ +
+ + Some of the keys for secret {{ctrl.secret.metadata.name}} are not valid environment variable names and will not be added. +
+
-
-
+
Add to Application 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.
- - The mount path is already used. Please choose another mount path. - + + The mount path is already used. Please choose another mount path. +
diff --git a/dist/scripts/scripts.js b/dist/scripts/scripts.js index c836dd4ae5..e6ba464c5d 100644 --- a/dist/scripts/scripts.js +++ b/dist/scripts/scripts.js @@ -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; diff --git a/dist/scripts/templates.js b/dist/scripts/templates.js index c5f78e530d..bd7c24f38b 100644 --- a/dist/scripts/templates.js +++ b/dist/scripts/templates.js @@ -5567,18 +5567,24 @@ angular.module('openshiftConsoleTemplates', []).run(['$templateCache', function( "Add secret as:\n" + "
\n" + "
\n" + - "