@@ -1277,6 +1277,10 @@ AVAILABLE_KINDS_BLACKLIST:[ "Binding", "Ingress", "DeploymentConfigRollback" ],
1277
1277
ENABLE_TECH_PREVIEW_FEATURE:{
1278
1278
pipelines:!0
1279
1279
},
1280
+ SAMPLE_PIPELINE_TEMPLATE:{
1281
+ name:"jenkins-pipeline-example",
1282
+ namespace:"openshift"
1283
+ },
1280
1284
PROJECT_NAVIGATION:[ {
1281
1285
label:"Overview",
1282
1286
iconClass:"fa fa-dashboard",
@@ -6427,47 +6431,60 @@ b.buildConfigs = a.select(b.unfilteredBuildConfigs), j(), m();
6427
6431
d.unwatchAll(l);
6428
6432
});
6429
6433
}));
6430
- } ]), angular.module("openshiftConsole").controller("PipelinesController", [ "$filter", "$routeParams", "$scope", "AlertMessageService", "BuildsService", "DataService", "Logger", "ProjectsService", function(a, b, c, d, e, f, g, h) {
6431
- c.projectName = b.project, c.alerts = c.alerts || {}, c.buildConfigs = {}, d .getAlerts().forEach(function(a) {
6434
+ } ]), angular.module("openshiftConsole").controller("PipelinesController", [ "$filter", "$routeParams", "$scope", "Constants", "Navigate", " AlertMessageService", "BuildsService", "DataService", "Logger", "ProjectsService", function(a, b, c, d, e, f, g, h, i, j ) {
6435
+ c.projectName = b.project, c.alerts = c.alerts || {}, c.buildConfigs = {}, f .getAlerts().forEach(function(a) {
6432
6436
c.alerts[a.name] = a.data;
6433
- }), d .clearAlerts();
6434
- var i = [];
6435
- h .get(b.project).then(_.spread(function(b, d ) {
6437
+ }), f .clearAlerts();
6438
+ var k = [];
6439
+ j .get(b.project).then(_.spread(function(b, f ) {
6436
6440
c.project = b;
6437
- var g = {}, h = a("buildConfigForBuild"), j = a("isIncompleteBuild"), k = a("isJenkinsPipelineStrategy"), l = a("isNewerResource"), m = function(a, b) {
6438
- if (!j (b)) {
6441
+ var i = {}, j = a("buildConfigForBuild"), l = a("isIncompleteBuild"), m = a("isJenkinsPipelineStrategy"), n = a("isNewerResource"), o = function(a, b) {
6442
+ if (!l (b)) {
6439
6443
c.statsByConfig[a] || (c.statsByConfig[a] = {
6440
6444
count:0,
6441
6445
totalDuration:0
6442
6446
});
6443
6447
var d = c.statsByConfig[a];
6444
- d.count++, d.totalDuration += e .getDuration(b), d.avgDuration = _.round(d.totalDuration / d.count);
6448
+ d.count++, d.totalDuration += g .getDuration(b), d.avgDuration = _.round(d.totalDuration / d.count);
6445
6449
}
6446
- }, n = function() {
6450
+ }, p = function() {
6447
6451
var a = {}, b = {};
6448
- c.statsByConfig = {}, _.each(g , function(d) {
6449
- if (k (d)) {
6450
- var e = h (d) || "";
6451
- c.buildConfigs[e] || (c.buildConfigs[e] = null), j (d) ? _.set(a, [ e, d.metadata.name ], d) :l (d, b[e]) && (b[e] = d), m (e, d);
6452
+ c.statsByConfig = {}, _.each(i , function(d) {
6453
+ if (m (d)) {
6454
+ var e = j (d) || "";
6455
+ c.buildConfigs[e] || (c.buildConfigs[e] = null), l (d) ? _.set(a, [ e, d.metadata.name ], d) :n (d, b[e]) && (b[e] = d), o (e, d);
6452
6456
}
6453
6457
}), _.each(b, function(b, c) {
6454
6458
_.set(a, [ c, b.metadata.name ], b);
6455
6459
}), c.interestingBuildsByConfig = a;
6456
6460
};
6457
- i.push(f.watch("builds", d, function(a) {
6458
- c.buildsLoaded = !0, g = a.by("metadata.name"), n();
6459
- })), i.push(f.watch("buildconfigs", d, function(a) {
6460
- c.buildConfigsLoaded = !0, c.buildConfigs = _.pick(a.by("metadata.name"), k), n();
6461
+ k.push(h.watch("builds", f, function(a) {
6462
+ c.buildsLoaded = !0, i = a.by("metadata.name"), p();
6463
+ }));
6464
+ var q = !1;
6465
+ k.push(h.watch("buildconfigs", f, function(a) {
6466
+ if (c.buildConfigsLoaded = !0, c.buildConfigs = _.pick(a.by("metadata.name"), m), _.isEmpty(c.buildConfigs) && !q) {
6467
+ q = !0;
6468
+ var b = d.SAMPLE_PIPELINE_TEMPLATE.name, f = d.SAMPLE_PIPELINE_TEMPLATE.namespace;
6469
+ h.get("templates", b, {
6470
+ namespace:f
6471
+ }, {
6472
+ errorNotification:!1
6473
+ }).then(function() {
6474
+ c.createSampleURL = e.fromTemplateURL(c.projectName, b, f);
6475
+ });
6476
+ }
6477
+ p();
6461
6478
})), c.startBuild = function(b) {
6462
- e .startBuild(b, d ).then(_.noop, function(b) {
6479
+ g .startBuild(b, f ).then(_.noop, function(b) {
6463
6480
c.alerts["start-build"] = {
6464
6481
type:"error",
6465
6482
message:"An error occurred while starting the build.",
6466
6483
details:a("getErrorDetails")(b)
6467
6484
};
6468
6485
});
6469
6486
}, c.$on("$destroy", function() {
6470
- f .unwatchAll(i );
6487
+ h .unwatchAll(k );
6471
6488
});
6472
6489
}));
6473
6490
} ]), angular.module("openshiftConsole").controller("BuildConfigController", [ "$scope", "$filter", "$routeParams", "AlertMessageService", "APIService", "BuildsService", "ImagesService", "DataService", "LabelFilter", "ModalsService", "ProjectsService", "keyValueEditorUtils", function(a, b, c, d, e, f, g, h, i, j, k, l) {
@@ -26149,10 +26166,15 @@ var _scriptsTemplatesJs = []byte(`angular.module('openshiftConsoleTemplates', []
26149
26166
"<div ng-if=\"project.metadata.name | canIAddToProject\">\n" +
26150
26167
"<p>\n" +
26151
26168
"No pipelines have been added to project {{projectName}}.\n" +
26169
+ "<br>\n" +
26170
+ "Learn more about\n" +
26171
+ "<a ng-href=\"{{ 'pipeline-builds' | helpLink}}\" target=\"_blank\">Pipeline Builds</a>\n" +
26172
+ "and the\n" +
26173
+ "<a ng-href=\"{{ 'pipeline-plugin' | helpLink}}\" target=\"_blank\">OpenShift Pipeline Plugin</a>.\n" +
26152
26174
"</p>\n" +
26153
- "<p ng-if=\"project.metadata.name | canIAddToProject\">\n" +
26154
- "<a ng-href=\"project/{{projectName}}/create \" class=\"btn btn-lg btn-primary\">\n" +
26155
- "Add to Project \n" +
26175
+ "<p ng-if=\"( project.metadata.name | canIAddToProject) && createSampleURL \">\n" +
26176
+ "<a ng-href=\"{{createSampleURL}} \" class=\"btn btn-lg btn-primary\">\n" +
26177
+ "Create Sample Pipeline \n" +
26156
26178
"</a>\n" +
26157
26179
"</p>\n" +
26158
26180
"</div>\n" +
0 commit comments