@@ -7222,7 +7222,9 @@ link:"project/" + c.projectName + "/browse/secrets"
7222
7222
title:"Create Secret"
7223
7223
} ], i.get(b.project).then(_.spread(function(b, d) {
7224
7224
c.project = b, c.context = d, c.breadcrumbs[0].title = a("displayName")(b), c.postCreateAction = function(a, b) {
7225
- e.addAlert(b), h.toResourceList("secrets", c.projectName);
7225
+ _.each(b, function(a) {
7226
+ e.addAlert(a);
7227
+ }), h.toResourceList("secrets", c.projectName);
7226
7228
}, c.cancel = function() {
7227
7229
h.toResourceList("secrets", c.projectName);
7228
7230
};
@@ -9077,7 +9079,9 @@ n("An error occurred attaching the persistent volume claim to the " + a("humaniz
9077
9079
}));
9078
9080
} ]), angular.module("openshiftConsole").controller("CreateSecretModalController", [ "$scope", "$uibModalInstance", function(a, b) {
9079
9081
a.postCreateAction = function(c, d) {
9080
- b.close(c), a.alerts[d.name] = d.data;
9082
+ b.close(c), _.each(d, function(b) {
9083
+ a.alerts[b.name] = b.data;
9084
+ });
9081
9085
}, a.cancel = function() {
9082
9086
b.dismiss("cancel");
9083
9087
};
@@ -9213,7 +9217,7 @@ a.hideBuild = c(b);
9213
9217
},
9214
9218
templateUrl:"views/directives/_build-close.html"
9215
9219
};
9216
- } ]), angular.module("openshiftConsole").directive("createSecret", [ "DataService", "AuthorizationService", function(a, b) {
9220
+ } ]), angular.module("openshiftConsole").directive("createSecret", [ "DataService", "AuthorizationService", "$filter", function(a, b, c ) {
9217
9221
return {
9218
9222
restrict:"E",
9219
9223
scope:{
@@ -9224,8 +9228,8 @@ postCreateAction:"&",
9224
9228
cancel:"&"
9225
9229
},
9226
9230
templateUrl:"views/directives/create-secret.html",
9227
- link:function(c, d) {
9228
- c .alerts = {}, c .secretAuthTypeMap = {
9231
+ link:function(d) {
9232
+ d .alerts = {}, d .secretAuthTypeMap = {
9229
9233
image:{
9230
9234
label:"Image Secret",
9231
9235
authTypes:[ {
@@ -9246,50 +9250,50 @@ id:"kubernetes.io/ssh-auth",
9246
9250
label:"SSH Key"
9247
9251
} ]
9248
9252
}
9249
- }, c .secretTypes = _.keys(c .secretAuthTypeMap), c .type ? c .newSecret = {
9250
- type:c .type,
9251
- authType:c .secretAuthTypeMap[c .type].authTypes[0].id,
9253
+ }, d .secretTypes = _.keys(d .secretAuthTypeMap), d .type ? d .newSecret = {
9254
+ type:d .type,
9255
+ authType:d .secretAuthTypeMap[d .type].authTypes[0].id,
9252
9256
data:{},
9253
- linkSecret:!_.isEmpty(c .serviceAccountToLink),
9254
- pickedServiceAccountToLink:c .serviceAccountToLink || ""
9255
- } :c .newSecret = {
9257
+ linkSecret:!_.isEmpty(d .serviceAccountToLink),
9258
+ pickedServiceAccountToLink:d .serviceAccountToLink || ""
9259
+ } :d .newSecret = {
9256
9260
type:"source",
9257
9261
authType:"kubernetes.io/basic-auth",
9258
9262
data:{},
9259
9263
linkSecret:!1,
9260
9264
pickedServiceAccountToLink:""
9261
- }, c .add = {
9265
+ }, d .add = {
9262
9266
gitconfig:!1,
9263
9267
cacert:!1
9264
- }, !c.serviceAccountToLink && b.canI("serviceaccounts", "list") && b.canI("serviceaccounts", "update") && a.list("serviceaccounts", c , function(a) {
9265
- c .serviceAccounts = a.by("metadata.name"), c .serviceAccountsNames = _.keys(c .serviceAccounts);
9268
+ }, b.canI("serviceaccounts", "list") && b.canI("serviceaccounts", "update") && a.list("serviceaccounts", d , function(a) {
9269
+ d .serviceAccounts = a.by("metadata.name"), d .serviceAccountsNames = _.keys(d .serviceAccounts);
9266
9270
});
9267
9271
var e = function(a, b) {
9268
- var d = {
9272
+ var c = {
9269
9273
apiVersion:"v1",
9270
9274
kind:"Secret",
9271
9275
metadata:{
9272
- name:c .newSecret.data.secretName
9276
+ name:d .newSecret.data.secretName
9273
9277
},
9274
9278
type:b,
9275
9279
data:{}
9276
9280
};
9277
9281
switch (b) {
9278
9282
case "kubernetes.io/basic-auth":
9279
- a.passwordToken ? d .data = {
9283
+ a.passwordToken ? c .data = {
9280
9284
password:window.btoa(a.passwordToken)
9281
- } :d .type = "Opaque", a.username && (d .data.username = window.btoa(a.username)), a.gitconfig && (d .data[".gitconfig"] = window.btoa(a.gitconfig)), a.cacert && (d .data["ca.crt"] = window.btoa(a.cacert));
9285
+ } :c .type = "Opaque", a.username && (c .data.username = window.btoa(a.username)), a.gitconfig && (c .data[".gitconfig"] = window.btoa(a.gitconfig)), a.cacert && (c .data["ca.crt"] = window.btoa(a.cacert));
9282
9286
break;
9283
9287
9284
9288
case "kubernetes.io/ssh-auth":
9285
- d .data = {
9289
+ c .data = {
9286
9290
"ssh-privatekey":window.btoa(a.privateKey)
9287
- }, a.gitconfig && (d .data[".gitconfig"] = window.btoa(a.gitconfig));
9291
+ }, a.gitconfig && (c .data[".gitconfig"] = window.btoa(a.gitconfig));
9288
9292
break;
9289
9293
9290
9294
case "kubernetes.io/dockerconfigjson":
9291
9295
var e = window.btoa(a.dockerConfig);
9292
- JSON.parse(a.dockerConfig).auths ? d .data[".dockerconfigjson"] = e :(d .type = "kubernetes.io/dockercfg", d .data[".dockercfg"] = e);
9296
+ JSON.parse(a.dockerConfig).auths ? c .data[".dockerconfigjson"] = e :(c .type = "kubernetes.io/dockercfg", c .data[".dockercfg"] = e);
9293
9297
break;
9294
9298
9295
9299
case "kubernetes.io/dockercfg":
@@ -9299,80 +9303,80 @@ username:a.dockerUsername,
9299
9303
password:a.dockerPassword,
9300
9304
email:a.dockerMail,
9301
9305
auth:f
9302
- }, d .data[".dockercfg"] = window.btoa(JSON.stringify(g));
9306
+ }, c .data[".dockercfg"] = window.btoa(JSON.stringify(g));
9303
9307
}
9304
- return d ;
9305
- }, f = function(b) {
9306
- var e = angular.copy(c .serviceAccounts[c .newSecret.pickedServiceAccountToLink]);
9307
- switch (c .newSecret.type) {
9308
+ return c ;
9309
+ }, f = function(b, e ) {
9310
+ var f = angular.copy(d .serviceAccounts[d .newSecret.pickedServiceAccountToLink]);
9311
+ switch (d .newSecret.type) {
9308
9312
case "source":
9309
- e .secrets.push({
9313
+ f .secrets.push({
9310
9314
name:b.metadata.name
9311
9315
});
9312
9316
break;
9313
9317
9314
9318
case "image":
9315
- e .imagePullSecrets.push({
9319
+ f .imagePullSecrets.push({
9316
9320
name:b.metadata.name
9317
9321
});
9318
9322
}
9319
- var f = c .serviceAccountToLink ? {
9323
+ var g = d .serviceAccountToLink ? {
9320
9324
errorNotification:!1
9321
9325
} :{};
9322
- a.update("serviceaccounts", c .newSecret.pickedServiceAccountToLink, e, c, f ).then(function(a) {
9323
- var d = {
9324
- name:"createAndLink ",
9326
+ a.update("serviceaccounts", d .newSecret.pickedServiceAccountToLink, f, d, g ).then(function(a) {
9327
+ e.push( {
9328
+ name:"create ",
9325
9329
data:{
9326
9330
type:"success",
9327
9331
message:"Secret " + b.metadata.name + " was created and linked with service account " + a.metadata.name + "."
9328
9332
}
9329
- };
9330
- c.postCreateAction({
9333
+ }), d.postCreateAction({
9331
9334
newSecret:b,
9332
- creationAlert:d
9335
+ creationAlert:e
9333
9336
});
9334
9337
}, function(a) {
9335
- c.alerts = {
9338
+ e.push( {
9336
9339
name:"createAndLink",
9337
9340
data:{
9338
9341
type:"error",
9339
- message:"An error occurred while linking the secret with service account.",
9340
- details:d ("getErrorDetails")(a)
9342
+ message:"An error occurred while linking the secret with service account " + d.newSecret.pickedServiceAccountToLink + " .",
9343
+ details:c ("getErrorDetails")(a)
9341
9344
}
9342
- };
9345
+ }), d.postCreateAction({
9346
+ newSecret:b,
9347
+ creationAlert:e
9348
+ });
9343
9349
});
9344
9350
}, g = _.debounce(function() {
9345
9351
try {
9346
- JSON.parse(c .newSecret.data.dockerConfig), c .invalidConfigFormat = !1;
9352
+ JSON.parse(d .newSecret.data.dockerConfig), d .invalidConfigFormat = !1;
9347
9353
} catch (a) {
9348
- c .invalidConfigFormat = !0;
9354
+ d .invalidConfigFormat = !0;
9349
9355
}
9350
9356
}, 300, {
9351
9357
leading:!0
9352
9358
});
9353
- c.aceChanged = g, c.create = function() {
9354
- c.alerts = {};
9355
- var g = e(c.newSecret.data, c.newSecret.authType);
9356
- a.create("secrets", null, g, c).then(function(a) {
9357
- if (c.newSecret.linkSecret && c.newSecret.pickedServiceAccountToLink && b.canI("serviceaccounts", "update")) f(a); else {
9358
- var d = {
9359
+ d.aceChanged = g, d.create = function() {
9360
+ d.alerts = {};
9361
+ var g = e(d.newSecret.data, d.newSecret.authType);
9362
+ a.create("secrets", null, g, d).then(function(a) {
9363
+ var c = [ {
9359
9364
name:"create",
9360
9365
data:{
9361
9366
type:"success",
9362
9367
message:"Secret " + g.metadata.name + " was created."
9363
9368
}
9364
- };
9365
- c .postCreateAction({
9369
+ } ] ;
9370
+ d.newSecret.linkSecret && d.serviceAccountsNames.contains(d.newSecret.pickedServiceAccountToLink) && b.canI("serviceaccounts", "update") ? f(a, c) :d .postCreateAction({
9366
9371
newSecret:a,
9367
- creationAlert:d
9372
+ creationAlert:c
9368
9373
});
9369
- }
9370
9374
}, function(a) {
9371
9375
var b = a.data || {};
9372
- return "AlreadyExists" === b.reason ? void (c .nameTaken = !0) :void (c .alerts.create = {
9376
+ return "AlreadyExists" === b.reason ? void (d .nameTaken = !0) :void (d .alerts.create = {
9373
9377
type:"error",
9374
9378
message:"An error occurred while creating the secret.",
9375
- details:d ("getErrorDetails")(a)
9379
+ details:c ("getErrorDetails")(a)
9376
9380
});
9377
9381
});
9378
9382
};
0 commit comments