@@ -10991,22 +10991,40 @@ templateUrl: "views/directives/action-chip.html"
10991
10991
}), function() {
10992
10992
angular.module("openshiftConsole").component("addConfigToApplication", {
10993
10993
controller: [ "$filter", "$scope", "APIService", "ApplicationsService", "DataService", "Navigate", "NotificationsService", "StorageService", function(e, t, n, a, r, o, i, s) {
10994
- var c = this, l = e("humanizeKind"), u = function() {
10994
+ var c = this, l = e("humanizeKind"), u = function(e) {
10995
+ var t = c.apiObject.metadata.name;
10996
+ return "ConfigMap" === c.apiObject.kind ? _.find(e.envFrom, {
10997
+ configMapRef: {
10998
+ name: t
10999
+ }
11000
+ }) : _.find(e.envFrom, {
11001
+ secretRef: {
11002
+ name: t
11003
+ }
11004
+ });
11005
+ }, d = function(e) {
11006
+ var t = [];
11007
+ return _.each(e, function(e) {
11008
+ _.each(_.get(e, "spec.template.spec.containers"), function(n) {
11009
+ if (!u(n)) return t.push(e), !1;
11010
+ });
11011
+ }), t;
11012
+ }, m = function() {
10995
11013
var e = {
10996
11014
namespace: c.project.metadata.name
10997
11015
};
10998
11016
a.getApplications(e).then(function(e) {
10999
- c.applications = e , c.updating = !1;
11017
+ c.applications = d(e) , c.updating = !1;
11000
11018
});
11001
11019
};
11002
11020
c.$onInit = function() {
11003
- c.addType = "env", c.disableInputs = !1, u ();
11021
+ c.addType = "env", c.disableInputs = !1, m ();
11004
11022
var e = new RegExp("^[A-Za-z_][A-Za-z0-9_]*$");
11005
11023
c.hasInvalidEnvVars = _.some(c.apiObject.data, function(t, n) {
11006
11024
return !e.test(n);
11007
11025
});
11008
11026
};
11009
- var d = function(e) {
11027
+ var p = function(e) {
11010
11028
return c.attachAllContainers || c.attachContainers[e.name];
11011
11029
};
11012
11030
c.$postLink = function() {
@@ -11035,16 +11053,16 @@ name: c.apiObject.metadata.name
11035
11053
};
11036
11054
}
11037
11055
_.each(a.spec.containers, function(e) {
11038
- d (e) && (e.envFrom = e.envFrom || [], e.envFrom.push(s));
11056
+ p(e) && !u (e) && (e.envFrom = e.envFrom || [], e.envFrom.push(s));
11039
11057
});
11040
11058
} else {
11041
- var l = e("generateName")(c.apiObject.metadata.name + "-"), u = {
11059
+ var l = e("generateName")(c.apiObject.metadata.name + "-"), d = {
11042
11060
name: l,
11043
11061
mountPath: c.mountVolume,
11044
11062
readOnly: !0
11045
11063
};
11046
11064
_.each(a.spec.containers, function(e) {
11047
- d (e) && (e.volumeMounts = e.volumeMounts || [], e.volumeMounts.push(u ));
11065
+ p (e) && (e.volumeMounts = e.volumeMounts || [], e.volumeMounts.push(d ));
11048
11066
});
11049
11067
var m = {
11050
11068
name: l
@@ -11063,23 +11081,23 @@ name: c.apiObject.metadata.name
11063
11081
}
11064
11082
a.spec.volumes = a.spec.volumes || [], a.spec.volumes.push(m);
11065
11083
}
11066
- var p = e("humanizeKind"), f = p (c.apiObject.kind), g = p (t.kind), v = {
11084
+ var f = e("humanizeKind"), g = f (c.apiObject.kind), v = f (t.kind), h = {
11067
11085
namespace: c.project.metadata.name
11068
11086
};
11069
- r.update(n.kindToResource(t.kind), t.metadata.name, t, v ).then(function() {
11087
+ r.update(n.kindToResource(t.kind), t.metadata.name, t, h ).then(function() {
11070
11088
i.addNotification({
11071
11089
type: "success",
11072
- message: "Successfully added " + f + " " + c.apiObject.metadata.name + " to " + g + " " + t.metadata.name + ".",
11090
+ message: "Successfully added " + g + " " + c.apiObject.metadata.name + " to " + v + " " + t.metadata.name + ".",
11073
11091
links: [ {
11074
11092
href: o.resourceURL(t),
11075
- label: "View " + p (t.kind, !0)
11093
+ label: "View " + f (t.kind, !0)
11076
11094
} ]
11077
11095
}), angular.isFunction(c.onComplete) && c.onComplete();
11078
11096
}, function(n) {
11079
11097
var a = e("getErrorDetails");
11080
11098
i.addNotification({
11081
11099
type: "error",
11082
- message: "An error occurred adding " + f + " " + c.apiObject.metadata.name + " to " + g + " " + t.metadata.name + ". " + a(n)
11100
+ message: "An error occurred adding " + g + " " + c.apiObject.metadata.name + " to " + v + " " + t.metadata.name + ". " + a(n)
11083
11101
});
11084
11102
}).finally(function() {
11085
11103
c.disableInputs = !1;
0 commit comments