summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2018-08-17 10:58:06 +0000
committerPhil Hughes <me@iamphill.com>2018-08-17 10:58:06 +0000
commitb399a274fbe350e0df8e75a7eaef313f01da5bb6 (patch)
tree8a217497e7eaf0208d9c90cfd201ea6512718d93 /app
parent10cf9383f67864b39727b6f641a92d5a78ec5b77 (diff)
parentda9b3b3d0f5923b6036b71c187db26c30e367a50 (diff)
downloadgitlab-ce-b399a274fbe350e0df8e75a7eaef313f01da5bb6.tar.gz
Merge branch '50101-builds-dropdown' into 'master'
Creates vue components for stage dropdowns and job list container for job log view See merge request gitlab-org/gitlab-ce!21255
Diffstat (limited to 'app')
-rw-r--r--app/assets/javascripts/jobs/components/jobs_container.vue60
-rw-r--r--app/assets/javascripts/jobs/components/stages_dropdown.vue97
2 files changed, 157 insertions, 0 deletions
diff --git a/app/assets/javascripts/jobs/components/jobs_container.vue b/app/assets/javascripts/jobs/components/jobs_container.vue
new file mode 100644
index 00000000000..b81109bdd06
--- /dev/null
+++ b/app/assets/javascripts/jobs/components/jobs_container.vue
@@ -0,0 +1,60 @@
+<script>
+ import CiIcon from '~/vue_shared/components/ci_icon.vue';
+ import Icon from '~/vue_shared/components/icon.vue';
+ import tooltip from '~/vue_shared/directives/tooltip';
+
+ export default {
+ components: {
+ CiIcon,
+ Icon,
+ },
+ directives: {
+ tooltip,
+ },
+ props: {
+ jobs: {
+ type: Array,
+ required: true,
+ },
+ },
+ };
+</script>
+<template>
+ <div class="builds-container">
+ <div
+ class="build-job"
+ >
+ <a
+ v-tooltip
+ v-for="job in jobs"
+ :key="job.id"
+ :href="job.path"
+ :title="job.tooltip"
+ :class="{ active: job.active, retried: job.retried }"
+ >
+ <icon
+ v-if="job.active"
+ name="arrow-right"
+ class="js-arrow-right"
+ />
+
+ <ci-icon :status="job.status" />
+
+ <span>
+ <template v-if="job.name">
+ {{ job.name }}
+ </template>
+ <template v-else>
+ {{ job.id }}
+ </template>
+ </span>
+
+ <icon
+ v-if="job.retried"
+ name="retry"
+ class="js-retry-icon"
+ />
+ </a>
+ </div>
+ </div>
+</template>
diff --git a/app/assets/javascripts/jobs/components/stages_dropdown.vue b/app/assets/javascripts/jobs/components/stages_dropdown.vue
new file mode 100644
index 00000000000..d6d64fa32f7
--- /dev/null
+++ b/app/assets/javascripts/jobs/components/stages_dropdown.vue
@@ -0,0 +1,97 @@
+<script>
+ import CiIcon from '~/vue_shared/components/ci_icon.vue';
+ import Icon from '~/vue_shared/components/icon.vue';
+
+ import { sprintf, __ } from '~/locale';
+
+ export default {
+ components: {
+ CiIcon,
+ Icon,
+ },
+ props: {
+ pipelineId: {
+ type: Number,
+ required: true,
+ },
+ pipelinePath: {
+ type: String,
+ required: true,
+ },
+ pipelineRef: {
+ type: String,
+ required: true,
+ },
+ pipelineRefPath: {
+ type: String,
+ required: true,
+ },
+ stages: {
+ type: Array,
+ required: true,
+ },
+ pipelineStatus: {
+ type: Object,
+ required: true,
+ },
+ },
+ data() {
+ return {
+ selectedStage: this.stages.length > 0 ? this.stages[0].name : __('More'),
+ };
+ },
+ computed: {
+ pipelineLink() {
+ return sprintf(__('Pipeline %{pipelineLinkStart} #%{pipelineId} %{pipelineLinkEnd} from %{pipelineLinkRefStart} %{pipelineRef} %{pipelineLinkRefEnd}'), {
+ pipelineLinkStart: `<a href=${this.pipelinePath} class="js-pipeline-path link-commit">`,
+ pipelineId: this.pipelineId,
+ pipelineLinkEnd: '</a>',
+ pipelineLinkRefStart: `<a href=${this.pipelineRefPath} class="link-commit ref-name">`,
+ pipelineRef: this.pipelineRef,
+ pipelineLinkRefEnd: '</a>',
+ }, false);
+ },
+ },
+ methods: {
+ onStageClick(stage) {
+ // todo: consider moving into store
+ this.selectedStage = stage.name;
+
+ // update dropdown with jobs
+ // jobs container is a new component.
+ this.$emit('requestSidebarStageDropdown', stage);
+ },
+ },
+ };
+</script>
+<template>
+ <div class="block-last">
+ <ci-icon :status="pipelineStatus" />
+
+ <p v-html="pipelineLink"></p>
+
+ <div class="dropdown">
+ <button
+ type="button"
+ data-toggle="dropdown"
+ >
+ {{ selectedStage }}
+ <icon name="chevron-down" />
+ </button>
+ <ul class="dropdown-menu">
+ <li
+ v-for="(stage, index) in stages"
+ :key="index"
+ >
+ <button
+ type="button"
+ class="stage-item"
+ @click="onStageClick(stage)"
+ >
+ {{ stage.name }}
+ </button>
+ </li>
+ </ul>
+ </div>
+ </div>
+</template>