@@ -33,7 +33,10 @@
Add to Application
- Some of the keys for secret {{ctrl.secret.metadata.name}} are not valid environment variable names and will not be added.
+ Some of the keys for {{ctrl.apiObject.kind | humanizeKind}}
+ {{ctrl.apiObject.metadata.name}} are not
+ valid environment variable names and will not be
+ added.
@@ -60,7 +63,9 @@
Add to Application
spellcheck="false">
- 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.
+ Mount Path for the volume. A file will be created in this
+ directory for each key from the {{ctrl.apiObject.kind | humanizeKind}}.
+ The file contents will be the value of the key.
@@ -78,7 +83,7 @@ Add to Application
diff --git a/dist/scripts/scripts.js b/dist/scripts/scripts.js
index 731c808ed9..8e593eb1f5 100644
--- a/dist/scripts/scripts.js
+++ b/dist/scripts/scripts.js
@@ -6169,8 +6169,12 @@ type: "warning",
message: "This config map has been deleted."
});
};
-r.get(t.project).then(_.spread(function(n, r) {
-a.get("configmaps", t.configMap, r, {
+e.addToApplicationVisible = !1, e.addToApplication = function() {
+e.addToApplicationVisible = !0;
+}, e.closeAddToApplication = function() {
+e.addToApplicationVisible = !1;
+}, r.get(t.project).then(_.spread(function(n, r) {
+e.project = n, a.get("configmaps", t.configMap, r, {
errorNotification: !1
}).then(function(e) {
i(e), o.push(a.watchObject("configmaps", t.configMap, r, i));
@@ -10599,7 +10603,7 @@ showAction: "=?"
templateUrl: "views/directives/action-chip.html"
};
}), function() {
-angular.module("openshiftConsole").component("addSecretToApplication", {
+angular.module("openshiftConsole").component("addConfigToApplication", {
controller: [ "$filter", "$scope", "APIService", "ApplicationsService", "DataService", "Navigate", "NotificationsService", "StorageService", function(e, t, n, a, r, o, i, s) {
var c = this, l = function() {
var e = {
@@ -10611,8 +10615,8 @@ c.applications = e, c.updating = !1;
};
c.$onInit = function() {
c.addType = "env", c.disableInputs = !1, l();
-var e = new RegExp("^[A-Za-z_]{1}[A-Za-z0-9_]*$");
-c.hasInvalidEnvVars = _.some(c.secret.data, function(t, n) {
+var e = new RegExp("^[A-Za-z_][A-Za-z0-9_]*$");
+c.hasInvalidEnvVars = _.some(c.apiObject.data, function(t, n) {
return !e.test(n);
});
};
@@ -10629,16 +10633,24 @@ c.existingMountPaths = s.getMountPaths(e), c.attachAllContainers = !0;
}, c.addToApplication = function() {
var t = angular.copy(c.application), a = _.get(t, "spec.template");
if (c.disableInputs = !0, "env" === c.addType) {
-var s = {
-secretRef: {
-name: c.secret.metadata.name
-}
+var s = {};
+switch (c.apiObject.kind) {
+case "Secret":
+s.secretRef = {
+name: c.apiObject.metadata.name
};
+break;
+
+case "ConfigMap":
+s.configMapRef = {
+name: c.apiObject.metadata.name
+};
+}
_.each(a.spec.containers, function(e) {
u(e) && (e.envFrom = e.envFrom || [], e.envFrom.push(s));
});
} else {
-var l = e("generateName")(c.secret.metadata.name + "-"), d = {
+var l = e("generateName")(c.apiObject.metadata.name + "-"), d = {
name: l,
mountPath: c.mountVolume,
readOnly: !0
@@ -10647,20 +10659,29 @@ _.each(a.spec.containers, function(e) {
u(e) && (e.volumeMounts = e.volumeMounts || [], e.volumeMounts.push(d));
});
var m = {
-name: l,
-secret: {
-secretName: c.secret.metadata.name
-}
+name: l
+};
+switch (c.apiObject.kind) {
+case "Secret":
+m.secret = {
+secretName: c.apiObject.metadata.name
+};
+break;
+
+case "ConfigMap":
+m.configMap = {
+name: c.apiObject.metadata.name
};
+}
a.spec.volumes = a.spec.volumes || [], a.spec.volumes.push(m);
}
-var p = e("humanizeKind"), f = p(c.secret.kind), g = p(t.kind), h = {
+var p = e("humanizeKind"), f = p(c.apiObject.kind), g = p(t.kind), h = {
namespace: c.project.metadata.name
};
r.update(n.kindToResource(t.kind), t.metadata.name, t, h).then(function() {
i.addNotification({
type: "success",
-message: "Successfully added " + f + " " + c.secret.metadata.name + " to " + g + " " + t.metadata.name + ".",
+message: "Successfully added " + f + " " + c.apiObject.metadata.name + " to " + g + " " + t.metadata.name + ".",
links: [ {
href: o.resourceURL(t),
label: "View " + p(t.kind, !0)
@@ -10670,7 +10691,7 @@ label: "View " + p(t.kind, !0)
var a = e("getErrorDetails");
i.addNotification({
type: "error",
-message: "An error occurred adding " + f + " " + c.secret.metadata.name + " to " + g + " " + t.metadata.name + ". " + a(n)
+message: "An error occurred adding " + f + " " + c.apiObject.metadata.name + " to " + g + " " + t.metadata.name + ". " + a(n)
});
}).finally(function() {
c.disableInputs = !1;
@@ -10680,11 +10701,11 @@ c.disableInputs = !1;
controllerAs: "ctrl",
bindings: {
project: "<",
-secret: "<",
+apiObject: "<",
onComplete: "<",
onCancel: "<"
},
-templateUrl: "views/directives/add-secret-to-application.html"
+templateUrl: "views/directives/add-config-to-application.html"
});
}(), angular.module("openshiftConsole").directive("templateOptions", function() {
return {
diff --git a/dist/scripts/templates.js b/dist/scripts/templates.js
index edf5e2d277..356c0fb84c 100644
--- a/dist/scripts/templates.js
+++ b/dist/scripts/templates.js
@@ -2161,13 +2161,21 @@ angular.module('openshiftConsoleTemplates', []).run(['$templateCache', function(
"