From c42dea047e40a5dea48f5c3fbdca7ddd4f4276f4 Mon Sep 17 00:00:00 2001 From: Dayanand Sagar Date: Tue, 22 Oct 2024 09:13:48 -0700 Subject: [PATCH 1/2] feat(3211): Build detail view - Hide steps and logs for virtual builds --- app/build/model.js | 1 + app/pipeline/build/controller.js | 50 ++++++++++++++++++++++++++++++++ app/pipeline/build/template.hbs | 6 ++-- package-lock.json | 14 ++++----- package.json | 2 +- 5 files changed, 62 insertions(+), 11 deletions(-) diff --git a/app/build/model.js b/app/build/model.js index dd0b6082b..8cdece23c 100644 --- a/app/build/model.js +++ b/app/build/model.js @@ -65,6 +65,7 @@ export default Model.extend({ status: attr('string'), stats: attr(), statusMessage: attr('string', { defaultValue: null }), + statusMessageType: attr('string', { defaultValue: null }), steps: attr(), templateId: attr('number'), startTimeWords: computed('startTime', { diff --git a/app/pipeline/build/controller.js b/app/pipeline/build/controller.js index 2ba5ecd1b..6e520a587 100644 --- a/app/pipeline/build/controller.js +++ b/app/pipeline/build/controller.js @@ -44,6 +44,56 @@ export default Controller.extend({ } ), + statusMessageAlertType: computed('model.build.statusMessageType', { + get() { + const statusMessageType = this.get('model.build.statusMessageType'); + + switch (statusMessageType) { + case 'ERROR': + return 'danger'; + case 'INFO': + return 'info'; + case 'WARN': + default: + return 'warning'; + } + } + }), + + statusMessageAlertIcon: computed('model.build.statusMessageType', { + get() { + const statusMessageType = this.get('model.build.statusMessageType'); + + switch (statusMessageType) { + case 'INFO': + return 'info-circle'; + case 'ERROR': + case 'WARN': + default: + return 'exclamation-triangle'; + } + } + }), + + isVirtualBuild: computed( + 'model.build.jobId', + 'model.event.workflowGraph.nodes', + { + get() { + const jobId = parseInt(this.get('model.build.jobId'), 10); + const nodes = this.get('model.event.workflowGraph.nodes'); + + return nodes.find(node => node.id === jobId).virtual; + } + } + ), + + showStepCollection: computed('isVirtualBuild', 'stepList', { + get() { + return !this.get('isVirtualBuild') && this.get('stepList'); + } + }), + prEvents: computed( 'job.id', 'model.event.pr.url', diff --git a/app/pipeline/build/template.hbs b/app/pipeline/build/template.hbs index fb318d0b0..4d0d05aff 100644 --- a/app/pipeline/build/template.hbs +++ b/app/pipeline/build/template.hbs @@ -50,8 +50,8 @@ {{#if this.build.statusMessage}} {{/if}} {{#if this.build.meta.build.warning}} @@ -66,7 +66,7 @@ -{{#if this.stepList}} +{{#if this.showStepCollection}} Date: Wed, 23 Oct 2024 11:18:29 -0700 Subject: [PATCH 2/2] feat(3211): Fix tests --- tests/acceptance/pipeline-builds-test.js | 1 + tests/mock/workflow-graph.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/acceptance/pipeline-builds-test.js b/tests/acceptance/pipeline-builds-test.js index e6f439e2b..f1574ecde 100644 --- a/tests/acceptance/pipeline-builds-test.js +++ b/tests/acceptance/pipeline-builds-test.js @@ -106,6 +106,7 @@ module('Acceptance | pipeline build', function (hooks) { const build = makeBuilds(1000000)[0]; build.id = 1000000; + build.jobId = 12345; build.status = 'FAILURE'; return [ diff --git a/tests/mock/workflow-graph.js b/tests/mock/workflow-graph.js index b0d244aec..97b91c688 100644 --- a/tests/mock/workflow-graph.js +++ b/tests/mock/workflow-graph.js @@ -7,7 +7,7 @@ export default () => { name: '~pr' }, { name: '~commit' }, { id: 12345, name: 'main' }, - { is: 123456, name: 'publish' } + { id: 123456, name: 'publish' } ], edges: [ { src: '~pr', dest: 'main' },