diff --git a/app/components/pipeline/header/component.js b/app/components/pipeline/header/component.js index ac4da9262..e8fef6c0c 100644 --- a/app/components/pipeline/header/component.js +++ b/app/components/pipeline/header/component.js @@ -16,6 +16,10 @@ export default class PipelineHeaderComponent extends Component { sameRepoPipeline = []; + get pipelineDescription() { + return this.args.pipeline.annotations['screwdriver.cd/pipelineDescription']; + } + get sonarBadgeUri() { return ( this.args.pipeline.badges.sonar.uri || diff --git a/app/components/pipeline/header/styles.scss b/app/components/pipeline/header/styles.scss index 0b741d252..33cf0d115 100644 --- a/app/components/pipeline/header/styles.scss +++ b/app/components/pipeline/header/styles.scss @@ -5,80 +5,91 @@ @mixin styles { #pipeline-header { display: flex; + flex-direction: column; background-color: colors.$sd-flyout-bg; padding: 1rem; - a { - color: colors.$sd-black; - } - - .header-item { - margin-top: auto; - margin-bottom: auto; - padding-right: 0.5rem; + .header-main { + display: flex; - &.pipeline-name { - font-size: 24px; - font-weight: variables.$weight-bold; + a { + color: colors.$sd-black; } - .sonarqube { - height: 1rem; - width: 1rem; - } + .header-item { + margin-top: auto; + margin-bottom: auto; + padding-right: 0.5rem; - &.dropdown { - max-width: 20rem; + &.pipeline-name { + font-size: 24px; + font-weight: variables.$weight-bold; + } - .dropdown-toggle { - display: flex; - justify-content: space-between; + .sonarqube { + height: 1rem; + width: 1rem; + } - svg { - margin: auto 0.25rem; - } + &.dropdown { + max-width: 20rem; - &::after { - margin-top: auto; - margin-bottom: 0.75rem; - } + .dropdown-toggle { + display: flex; + justify-content: space-between; - .branch { - overflow: auto; - } - } + svg { + margin: auto 0.25rem; + } - .dropdown-menu { - display: flex; - flex-direction: column; - overflow-x: scroll; - max-height: 10rem; - width: 20rem; + &::after { + margin-top: auto; + margin-bottom: 0.75rem; + } - svg { - width: 10px; - height: 10px; + .branch { + overflow: auto; + } } - a { - padding: 0.25rem 0.75rem; + .dropdown-menu { + display: flex; + flex-direction: column; + overflow-x: scroll; + max-height: 10rem; + width: 20rem; - &:hover { - background-color: colors.$sd-highlight; + svg { + width: 10px; + height: 10px; + } + + a { + padding: 0.25rem 0.75rem; + + &:hover { + background-color: colors.$sd-highlight; + } } - } - span { - margin: auto; + span { + margin: auto; + } } } } - } - @include button.styles; + @include button.styles; + + #add-to-collection { + margin-left: auto; + } + } - #add-to-collection { - margin-left: auto; + .pipeline-description { + margin-top: 0.25rem; + height: 2.25rem; + overflow: auto; } } } diff --git a/app/components/pipeline/header/template.hbs b/app/components/pipeline/header/template.hbs index e23dc0ed2..48649c1e3 100644 --- a/app/components/pipeline/header/template.hbs +++ b/app/components/pipeline/header/template.hbs @@ -1,90 +1,98 @@
- - {{@pipeline.scmRepo.name}} - - - {{#if @pipeline.configPipelineId}} +
- - Parent Pipeline + {{@pipeline.scmRepo.name}} - {{/if}} - {{#if @pipeline.badges.sonar}} + {{#if @pipeline.configPipelineId}} + + + Parent Pipeline + + {{/if}} + + {{#if @pipeline.badges.sonar}} + + {{svg-jar "sonarqube" class="img sonarqube"}} + + {{/if}} + - {{svg-jar "sonarqube" class="img sonarqube"}} + + {{this.scmContext.scm}} - {{/if}} - - - - {{this.scmContext.scm}} - - - - - - {{@pipeline.scmRepo.branch}} - - - Switch to another Pipeline with the same repository - - - - {{#each (await this.sameRepoPipeline) as |pipe|}} - - - {{svg-jar "link" class="img"}} {{pipe.branchAndRootDir}} - - - {{else}} - + + + + + {{@pipeline.scmRepo.branch}} + + + Switch to another Pipeline with the same repository + + + + {{#each (await this.sameRepoPipeline) as |pipe|}} + + + {{svg-jar "link" class="img"}} {{pipe.branchAndRootDir}} + + + {{else}} + No other Pipelines with the same repository - {{/each}} - - + {{/each}} + + - + + {{#if this.addToCollectionModalOpen}} + + {{/if}} + +
- {{#if this.addToCollectionModalOpen}} - + {{#if this.pipelineDescription}} +
+ {{this.pipelineDescription}} +
{{/if}}
diff --git a/app/v2/pipeline/styles.scss b/app/v2/pipeline/styles.scss index d71be682d..9486268e0 100644 --- a/app/v2/pipeline/styles.scss +++ b/app/v2/pipeline/styles.scss @@ -7,15 +7,11 @@ height: 100%; $pipeline-nav-width: 4rem; - $pipeline-header-height: 4.5rem; grid-template-areas: 'pipeline-nav pipeline-header' 'pipeline-nav pipeline-main'; grid-template-columns: $pipeline-nav-width calc(100% - $pipeline-nav-width); - grid-template-rows: $pipeline-header-height calc( - 100% - $pipeline-header-height - ); #pipeline-nav { grid-area: pipeline-nav; diff --git a/tests/integration/components/pipeline/header/component-test.js b/tests/integration/components/pipeline/header/component-test.js index 1c5411fc1..225d5de75 100644 --- a/tests/integration/components/pipeline/header/component-test.js +++ b/tests/integration/components/pipeline/header/component-test.js @@ -12,7 +12,8 @@ module('Integration | Component | pipeline/header', function (hooks) { pipeline: { id: 123, scmContext: 'github:github.com', - scmRepo: { url: 'https://gihub.com/test' } + scmRepo: { url: 'https://gihub.com/test' }, + annotations: {} } }); @@ -35,7 +36,7 @@ module('Integration | Component | pipeline/header', function (hooks) { test('it renders link to parent pipeline', async function (assert) { this.setProperties({ - pipeline: { configPipelineId: 999 } + pipeline: { configPipelineId: 999, annotations: {} } }); await render(hbs` a').exists({ count: 2 }); }); + + test('it renders pipeline description', async function (assert) { + const pipelineDescription = 'This is a test pipeline'; + + this.setProperties({ + pipeline: { + id: 123, + scmContext: 'github:github.com', + scmRepo: { url: 'https://gihub.com/test' }, + annotations: { + 'screwdriver.cd/pipelineDescription': pipelineDescription + } + } + }); + + await render(hbs``); + + assert + .dom('#pipeline-header .pipeline-description') + .hasText(pipelineDescription); + }); });