Skip to content

Commit 83bacdc

Browse files
committed
Avoid runtime error when sample pipeline template unset
1 parent d4e91d8 commit 83bacdc

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

app/scripts/controllers/pipelines.js

+8-6
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

+1-2
Original file line numberDiff line numberDiff line change
@@ -4958,8 +4958,7 @@ c.buildsLoaded = !0, i = a.by("metadata.name"), p();
49584958
}));
49594959
var q = !1;
49604960
j.push(g.watch("buildconfigs", h, function(a) {
4961-
if (c.buildConfigsLoaded = !0, c.buildConfigs = _.pick(a.by("metadata.name"), m), _.isEmpty(c.buildConfigs) && !q) {
4962-
q = !0;
4961+
if (c.buildConfigsLoaded = !0, c.buildConfigs = _.pick(a.by("metadata.name"), m), _.isEmpty(c.buildConfigs) && !q && (q = !0, d.SAMPLE_PIPELINE_TEMPLATE)) {
49634962
var b = d.SAMPLE_PIPELINE_TEMPLATE.name, f = d.SAMPLE_PIPELINE_TEMPLATE.namespace;
49644963
g.get("templates", b, {
49654964
namespace:f

0 commit comments

Comments
 (0)