Commit 02b350f7 authored by Bryce Johnson's avatar Bryce Johnson

TMP apply new stuf... squash/rename me.

parent ee367580
<script> <script>
import linkedPipelinesColumn from './linked_pipelines_column.vue';
import stageColumnComponent from './stage_column_component.vue'; import stageColumnComponent from './stage_column_component.vue';
import loadingIcon from '../../../vue_shared/components/loading_icon.vue'; import loadingIcon from '../../../vue_shared/components/loading_icon.vue';
import '../../../flash';
export default { export default {
components: {
linkedPipelinesColumn,
stageColumnComponent,
loadingIcon,
},
props: { props: {
isLoading: { isLoading: {
type: Boolean, type: Boolean,
...@@ -14,38 +19,55 @@ ...@@ -14,38 +19,55 @@
required: true, required: true,
}, },
}, },
components: {
stageColumnComponent,
loadingIcon,
},
computed: { computed: {
graph() { graph() {
return this.pipeline.details && this.pipeline.details.stages; return this.pipeline.details && this.pipeline.details.stages;
}, },
hasTriggered() {
return !!this.pipeline.triggered.length;
},
hasTriggeredBy() {
return !!this.pipeline.triggered_by.length;
},
linkedPipelinesClass() {
return this.hasTriggered || this.hasTriggeredBy ? 'has-linked-pipelines' : '';
},
}, },
methods: { methods: {
capitalizeStageName(name) { capitalizeStageName(name) {
return name.charAt(0).toUpperCase() + name.slice(1); return name.charAt(0).toUpperCase() + name.slice(1);
}, },
isFirstColumn(index) { isFirstColumn(index) {
return index === 0; return index === 0;
}, },
stageConnectorClass(index, stage) { stageConnectorClass(index, stage) {
let className; let className;
// If it's the first stage column and only has one job // If it's the first stage column and only has one job
if (index === 0 && stage.groups.length === 1) { if (index === 0 && stage.groups.length === 1) {
className = 'no-margin'; if (!this.hasTriggeredBy) {
className = 'no-margin';
} else {
className = 'left-margin';
}
} else if (index > 0) { } else if (index > 0) {
// If it is not the first column // If it is not the first column
className = 'left-margin'; className = 'left-margin';
} }
return className;
},
linkedPipelineClass(index) {
let className = '';
const isFirstStage = index === 0;
const isLastStage = index === this.graph.length - 1;
if (isFirstStage && this.hasTriggeredBy) {
className += 'has-upstream';
} else if (isLastStage && this.hasTriggered) {
className += 'has-downstream';
}
return className; return className;
}, },
}, },
...@@ -61,17 +83,35 @@ ...@@ -61,17 +83,35 @@
/> />
</div> </div>
<linked-pipelines-column
v-if="hasTriggeredBy"
:linked-pipelines="pipeline.triggered_by"
column-title="Upstream"
graph-position="left"
/>
<ul <ul
v-if="!isLoading" v-if="!isLoading"
class="stage-column-list"> class="stage-column-list"
:class="linkedPipelinesClass">
<stage-column-component <stage-column-component
v-for="(stage, index) in graph" v-for="(stage, index) in graph"
:class="linkedPipelineClass(index)"
:title="capitalizeStageName(stage.name)" :title="capitalizeStageName(stage.name)"
:jobs="stage.groups" :jobs="stage.groups"
:key="stage.name" :key="stage.name"
:stage-connector-class="stageConnectorClass(index, stage)" :stage-connector-class="stageConnectorClass(index, stage)"
:is-first-column="isFirstColumn(index)"/> :is-first-column="isFirstColumn(index)"
:has-triggered-by="hasTriggeredBy"
/>
</ul> </ul>
<linked-pipelines-column
v-if="hasTriggered"
:linked-pipelines="pipeline.triggered"
column-title="Downstream"
graph-position="right"
/>
</div> </div>
</div> </div>
</template> </template>
const mockTriggerers = [
{ id: 111, path: 'hello/world/tho', project: { name: 'GitLab Shell' }, details: { status: { icon: 'icon_status_pending', group: 'pending' } } },
];
const mockTriggereds = [
{ id: 111, path: 'hello/world/tho', project: { name: 'GitLab EE' }, details: { status: { icon: 'icon_status_failed', group: 'failed' } } },
{ id: 111, path: 'hello/world/tho', project: { name: 'Gitaly' }, details: { status: { icon: 'icon_status_pending', group: 'pending' } } },
{ id: 111, path: 'hello/world/tho', project: { name: 'GitHub' }, details: { status: { icon: 'icon_status_success', group: 'success' } } },
];
export default class PipelineStore { export default class PipelineStore {
constructor() { constructor() {
this.state = {}; this.state = {};
this.state.pipeline = {}; this.state.pipeline = [];
this.state.triggered = [];
this.state.triggered_by = [];
} }
storePipeline(pipeline = {}) { storePipeline(pipeline = {}) {
// single job in first stage
// graph[0].groups = [graph[0].groups[0]];
// multiple jobs in last stage
// graph[3].groups.push(graph[0].groups[0]);
this.state.pipeline = pipeline; this.state.pipeline = pipeline;
this.state.triggered_by = mockTriggerers;
// single triggered
// this.state.triggered = [mockTriggereds[0]];
this.state.triggered = mockTriggereds;
} }
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment