Skip to content

Commit 52fb11c

Browse files
author
OpenShift Bot
committed
Merge pull request #2313 from spadgett/undefined-undefined
Merged by openshift-bot
2 parents 86a8d89 + 492f648 commit 52fb11c

File tree

2 files changed

+29
-16
lines changed

2 files changed

+29
-16
lines changed

Diff for: assets/app/scripts/controllers/newfromtemplate.js

+14-6
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,7 @@ angular.module('openshiftConsole')
110110
if (result.failure.length > 0) {
111111
result.failure.forEach(
112112
function(failure) {
113-
var objectName = "";
114-
if (failure.data && failure.data.details) {
115-
objectName = failure.data.details.kind + " " + failure.data.details.id;
116-
} else {
117-
objectName = "object";
118-
}
113+
var objectName = getFailureObjectName(failure) || "object";
119114
alerts.push({
120115
type: "error",
121116
message: "Cannot create " + objectName + ". ",
@@ -181,4 +176,17 @@ angular.module('openshiftConsole')
181176
Navigate.toErrorPage("Cannot create from template: the specified template could not be retrieved.");
182177
}
183178
);
179+
180+
function getFailureObjectName(failure) {
181+
if (!failure.data || !failure.data.details) {
182+
return null;
183+
}
184+
185+
var details = failure.data.details;
186+
if (details.kind) {
187+
return (details.id) ? details.kind + " " + details.id : details.kind;
188+
}
189+
190+
return details.id;
191+
}
184192
});

Diff for: pkg/assets/bindata.go

+15-10
Original file line numberDiff line numberDiff line change
@@ -21699,7 +21699,7 @@ null !== a && (b.debug("Generated resource definition:", a), d.push(a));
2169921699
};
2170021700
} ]), angular.module("openshiftConsole").controller("NewFromTemplateController", [ "$scope", "$http", "$routeParams", "DataService", "$q", "$location", "TaskList", "$parse", "Navigate", function(a, b, c, d, e, f, g, h, i) {
2170121701
function j(a) {
21702-
var b = [], c = m(a);
21702+
var b = [], c = n(a);
2170321703
return c && c.forEach(function(a) {
2170421704
b.push(a.image);
2170521705
}), b;
@@ -21708,11 +21708,11 @@ function k(a) {
2170821708
var b = [], c = [], d = {};
2170921709
return a.items.forEach(function(a) {
2171021710
if ("BuildConfig" === a.kind) {
21711-
var e = n(a);
21711+
var e = o(a);
2171221712
e && b.push({
2171321713
name:e
2171421714
});
21715-
var f = o(a);
21715+
var f = p(a);
2171621716
f && (d[f] = !0);
2171721717
}
2171821718
"DeploymentConfig" === a.kind && (c = c.concat(j(a)));
@@ -21730,7 +21730,12 @@ g ? (f = d[g[1]] || {}, f.title = a.annotations[e], d[g[1]] = f) :(g = e.match(c
2173021730
}
2173121731
return d;
2173221732
}
21733-
var m = h("template.controllerTemplate.podTemplate.desiredState.manifest.containers"), n = h("parameters.strategy.stiStrategy.image"), o = h("parameters.output.to.name || parameters.output.DockerImageReference");
21733+
function m(a) {
21734+
if (!a.data || !a.data.details) return null;
21735+
var b = a.data.details;
21736+
return b.kind ? b.id ? b.kind + " " + b.id :b.kind :b.id;
21737+
}
21738+
var n = h("template.controllerTemplate.podTemplate.desiredState.manifest.containers"), o = h("parameters.strategy.stiStrategy.image"), p = h("parameters.output.to.name || parameters.output.DockerImageReference");
2173421739
a.projectDisplayName = function() {
2173521740
return this.project && this.project.displayName || this.projectName;
2173621741
}, a.templateDisplayName = function() {
@@ -21747,8 +21752,8 @@ var c = e.defer();
2174721752
return d.createList(b.items, a).then(function(b) {
2174821753
var d = [], e = !1;
2174921754
b.failure.length > 0 ? b.failure.forEach(function(a) {
21750-
var b = "";
21751-
b = a.data && a.data.details ? a.data.details.kind + " " + a.data.details.id :"object", d.push({
21755+
var b = m(a) || "object";
21756+
d.push({
2175221757
type:"error",
2175321758
message:"Cannot create " + b + ". ",
2175421759
details:a.data.message
@@ -21772,11 +21777,11 @@ details:"Status: " + b.status + ". " + b.data
2177221777
}, a.toggleOptionsExpanded = function() {
2177321778
a.optionsExpanded = !a.optionsExpanded;
2177421779
};
21775-
var p = c.name, q = c.namespace;
21776-
return p ? (a.emptyMessage = "Loading...", a.alerts = [], a.projectName = c.project, a.projectPromise = $.Deferred(), d.get("projects", a.projectName, a).then(function(b) {
21780+
var q = c.name, r = c.namespace;
21781+
return q ? (a.emptyMessage = "Loading...", a.alerts = [], a.projectName = c.project, a.projectPromise = $.Deferred(), d.get("projects", a.projectName, a).then(function(b) {
2177721782
a.project = b, a.projectPromise.resolve(b);
21778-
}), void d.get("templates", p, a, {
21779-
namespace:q
21783+
}), void d.get("templates", q, a, {
21784+
namespace:r
2178021785
}).then(function(b) {
2178121786
a.template = b, a.templateImages = k(b), a.hasParameters = a.template.parameters && a.template.parameters.length > 0, a.optionsExpanded = !1, a.templateUrl = b.metadata.selfLink, b.labels = b.labels || {};
2178221787
}, function() {

0 commit comments

Comments
 (0)