Skip to content

Commit

Permalink
Add latest changes from gitlab-org/gitlab@master
Browse files Browse the repository at this point in the history
  • Loading branch information
GitLab Bot committed Nov 27, 2020
1 parent 4c39dd1 commit 28f1931
Show file tree
Hide file tree
Showing 65 changed files with 1,010 additions and 313 deletions.
10 changes: 10 additions & 0 deletions app/assets/javascripts/pipelines/components/graph/accessors.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { REST, GRAPHQL } from './constants';

export const accessors = {
[REST]: {
groupId: 'id',
},
[GRAPHQL]: {
groupId: 'name',
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export default {
:title="tooltipText"
:class="cssClass"
:disabled="isDisabled"
class="js-ci-action ci-action-icon-container ci-action-icon-wrapper gl-display-flex gl-align-items-center gl-justify-content-center"
class="js-ci-action gl-ci-action-icon-container ci-action-icon-container ci-action-icon-wrapper gl-display-flex gl-align-items-center gl-justify-content-center"
@click.stop="onClickAction"
>
<gl-loading-icon v-if="isLoading" class="js-action-icon-loading" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
export const DOWNSTREAM = 'downstream';
export const MAIN = 'main';
export const UPSTREAM = 'upstream';

export const REST = 'rest';
export const GRAPHQL = 'graphql';
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
<script>
import { escape, capitalize } from 'lodash';
import StageColumnComponent from './stage_column_component.vue';
import GraphBundleMixin from '../../mixins/graph_pipeline_bundle_mixin';
import { MAIN } from './constants';
export default {
name: 'PipelineGraph',
components: {
StageColumnComponent,
},
mixins: [GraphBundleMixin],
props: {
isLinkedPipeline: {
type: Boolean,
Expand All @@ -31,96 +28,21 @@ export default {
return this.pipeline.stages;
},
},
methods: {
capitalizeStageName(name) {
const escapedName = escape(name);
return capitalize(escapedName);
},
isFirstColumn(index) {
return index === 0;
},
stageConnectorClass(index, stage) {
let className;
// If it's the first stage column and only has one job
if (this.isFirstColumn(index) && stage.groups.length === 1) {
className = 'no-margin';
} else if (index > 0) {
// If it is not the first column
className = 'left-margin';
}
return className;
},
refreshPipelineGraph() {
this.$emit('refreshPipelineGraph');
},
/**
* CSS class is applied:
* - if pipeline graph contains only one stage column component
*
* @param {number} index
* @returns {boolean}
*/
shouldAddRightMargin(index) {
return !(index === this.graph.length - 1);
},
handleClickedDownstream(pipeline, clickedIndex, downstreamNode) {
/**
* Calculates the margin top of the clicked downstream pipeline by
* subtracting the clicked downstream pipelines offsetTop by it's parent's
* offsetTop and then subtracting 15
*/
this.downstreamMarginTop = this.calculateMarginTop(downstreamNode, 15);
/**
* If the expanded trigger is defined and the id is different than the
* pipeline we clicked, then it means we clicked on a sibling downstream link
* and we want to reset the pipeline store. Triggering the reset without
* this condition would mean not allowing downstreams of downstreams to expand
*/
if (this.expandedDownstream?.id !== pipeline.id) {
this.$emit('onResetDownstream', this.pipeline, pipeline);
}
this.$emit('onClickDownstreamPipeline', pipeline);
},
calculateMarginTop(downstreamNode, pixelDiff) {
return `${downstreamNode.offsetTop - downstreamNode.offsetParent.offsetTop - pixelDiff}px`;
},
hasOnlyOneJob(stage) {
return stage.groups.length === 1;
},
hasUpstreamColumn(index) {
return index === 0 && this.hasUpstream;
},
},
};
</script>
<template>
<div class="build-content middle-block js-pipeline-graph">
<div class="js-pipeline-graph">
<div
class="pipeline-visualization pipeline-graph"
:class="{ 'pipeline-tab-content': !isLinkedPipeline }"
class="gl-pipeline-min-h gl-display-flex gl-position-relative gl-overflow-auto gl-bg-gray-10 gl-white-space-nowrap"
:class="{ 'gl-py-5': !isLinkedPipeline }"
>
<div>
<ul class="stage-column-list align-top">
<stage-column-component
v-for="(stage, index) in graph"
:key="stage.name"
:class="{
'has-only-one-job': hasOnlyOneJob(stage),
'gl-mr-26': shouldAddRightMargin(index),
}"
:title="capitalizeStageName(stage.name)"
:groups="stage.groups"
:stage-connector-class="stageConnectorClass(index, stage)"
:is-first-column="isFirstColumn(index)"
:action="stage.status.action"
@refreshPipelineGraph="refreshPipelineGraph"
/>
</ul>
</div>
<stage-column-component
v-for="stage in graph"
:key="stage.name"
:title="stage.name"
:groups="stage.groups"
:action="stage.status.action"
/>
</div>
</div>
</template>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script>
import { escape, capitalize } from 'lodash';
import { GlLoadingIcon } from '@gitlab/ui';
import StageColumnComponent from './stage_column_component.vue';
import StageColumnComponentLegacy from './stage_column_component_legacy.vue';
import GraphWidthMixin from '../../mixins/graph_width_mixin';
import LinkedPipelinesColumn from './linked_pipelines_column.vue';
import GraphBundleMixin from '../../mixins/graph_pipeline_bundle_mixin';
Expand All @@ -10,7 +10,7 @@ import { UPSTREAM, DOWNSTREAM, MAIN } from './constants';
export default {
name: 'PipelineGraphLegacy',
components: {
StageColumnComponent,
StageColumnComponentLegacy,
GlLoadingIcon,
LinkedPipelinesColumn,
},
Expand Down Expand Up @@ -220,7 +220,7 @@ export default {
}"
class="stage-column-list align-top"
>
<stage-column-component
<stage-column-component-legacy
v-for="(stage, index) in graph"
:key="stage.name"
:class="{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,19 @@ export default {
type="button"
data-toggle="dropdown"
data-display="static"
class="dropdown-menu-toggle build-content"
class="dropdown-menu-toggle build-content gl-build-content"
>
<ci-icon :status="group.status" />
<div class="gl-display-flex gl-align-items-center gl-justify-content-space-between">
<span class="gl-display-flex gl-align-items-center">
<ci-icon :status="group.status" :size="24" />

<span
class="gl-text-truncate mw-70p gl-pl-2 gl-display-inline-block gl-vertical-align-bottom"
>
{{ group.name }}
</span>
<span class="gl-text-truncate mw-70p gl-pl-3 gl-display-inline-block">
{{ group.name }}
</span>
</span>

<span class="dropdown-counter-badge"> {{ group.size }} </span>
<span class="gl-font-weight-100 gl-font-size-lg gl-pr-2"> {{ group.size }} </span>
</div>
</button>

<ul class="dropdown-menu big-pipeline-graph-dropdown-menu js-grouped-pipeline-dropdown">
Expand Down
12 changes: 8 additions & 4 deletions app/assets/javascripts/pipelines/components/graph/job_item.vue
Original file line number Diff line number Diff line change
Expand Up @@ -129,19 +129,23 @@ export default {
};
</script>
<template>
<div class="ci-job-component" data-qa-selector="job_item_container">
<div
class="ci-job-component gl-display-flex gl-align-items-center gl-justify-content-space-between"
data-qa-selector="job_item_container"
>
<gl-link
v-if="status.has_details"
v-gl-tooltip="{ boundary, placement: 'bottom', customClass: 'gl-pointer-events-none' }"
:href="status.details_path"
:title="tooltipText"
:class="jobClasses"
class="js-pipeline-graph-job-link qa-job-link menu-item"
class="js-pipeline-graph-job-link qa-job-link menu-item gl-text-gray-900 gl-active-text-decoration-none
gl-focus-text-decoration-none"
data-testid="job-with-link"
@click.stop="hideTooltips"
@mouseout="hideTooltips"
>
<job-name-component :name="job.name" :status="job.status" />
<job-name-component :name="job.name" :status="job.status" :icon-size="24" />
</gl-link>

<div
Expand All @@ -153,7 +157,7 @@ export default {
data-testid="job-without-link"
@mouseout="hideTooltips"
>
<job-name-component :name="job.name" :status="job.status" />
<job-name-component :name="job.name" :status="job.status" :icon-size="24" />
</div>

<action-component
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,22 @@ export default {
type: String,
required: true,
},
status: {
type: Object,
required: true,
},
iconSize: {
type: Number,
required: false,
default: 16,
},
},
};
</script>
<template>
<span class="ci-job-name-component mw-100">
<ci-icon :status="status" />
<span class="gl-text-truncate mw-70p gl-pl-2 gl-display-inline-block gl-vertical-align-bottom">
<span class="ci-job-name-component mw-100 gl-display-flex gl-align-items-center">
<ci-icon :size="iconSize" :status="status" />
<span class="gl-text-truncate mw-70p gl-pl-3 gl-display-inline-block">
{{ name }}
</span>
</span>
Expand Down
Loading

0 comments on commit 28f1931

Please sign in to comment.