Skip to content

Commit 11b5a75

Browse files
spadgettf0x11
authored andcommitted
Avoid runtime error when sample pipeline template unset
1 parent a76a03f commit 11b5a75

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

app/scripts/controllers/pipelines.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,14 @@ angular.module('openshiftConsole')
109109
$scope.buildConfigs = _.pick(buildConfigData.by("metadata.name"), isPipeline);
110110
if (_.isEmpty($scope.buildConfigs) && !checkedForSampleTemplate) {
111111
checkedForSampleTemplate = true;
112-
var sampleName = Constants.SAMPLE_PIPELINE_TEMPLATE.name;
113-
var sampleNamespace = Constants.SAMPLE_PIPELINE_TEMPLATE.namespace;
114-
DataService.get("templates", sampleName, {namespace: sampleNamespace}, {errorNotification: false}).then(
115-
function(template) {
116-
$scope.createSampleURL = Navigate.createFromTemplateURL(template, $scope.projectName);
117-
});
112+
if (Constants.SAMPLE_PIPELINE_TEMPLATE) {
113+
var sampleName = Constants.SAMPLE_PIPELINE_TEMPLATE.name;
114+
var sampleNamespace = Constants.SAMPLE_PIPELINE_TEMPLATE.namespace;
115+
DataService.get("templates", sampleName, {namespace: sampleNamespace}, {errorNotification: false}).then(
116+
function(template) {
117+
$scope.createSampleURL = Navigate.createFromTemplateURL(template, $scope.projectName);
118+
});
119+
}
118120
}
119121
update();
120122
}));

dist/scripts/scripts.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5057,8 +5057,7 @@ c.buildsLoaded = !0, i = a.by("metadata.name"), p();
50575057
}));
50585058
var q = !1;
50595059
j.push(g.watch("buildconfigs", h, function(a) {
5060-
if (c.buildConfigsLoaded = !0, c.buildConfigs = _.pick(a.by("metadata.name"), m), _.isEmpty(c.buildConfigs) && !q) {
5061-
q = !0;
5060+
if (c.buildConfigsLoaded = !0, c.buildConfigs = _.pick(a.by("metadata.name"), m), _.isEmpty(c.buildConfigs) && !q && (q = !0, d.SAMPLE_PIPELINE_TEMPLATE)) {
50625061
var b = d.SAMPLE_PIPELINE_TEMPLATE.name, f = d.SAMPLE_PIPELINE_TEMPLATE.namespace;
50635062
g.get("templates", b, {
50645063
namespace:f

0 commit comments

Comments
 (0)