2018-12-05 23:21:45 +05:30
|
|
|
<script>
|
2022-10-11 01:57:18 +05:30
|
|
|
import { GlButton, GlIcon } from '@gitlab/ui';
|
2020-03-13 15:44:24 +05:30
|
|
|
import { isEmpty } from 'lodash';
|
2021-01-29 00:20:46 +05:30
|
|
|
import { mapActions, mapGetters, mapState } from 'vuex';
|
2022-10-11 01:57:18 +05:30
|
|
|
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
|
|
|
|
import { JOB_SIDEBAR_COPY, forwardDeploymentFailureModalId } from '~/jobs/constants';
|
2018-12-13 13:39:08 +05:30
|
|
|
import CommitBlock from './commit_block.vue';
|
|
|
|
import JobsContainer from './jobs_container.vue';
|
2022-10-11 01:57:18 +05:30
|
|
|
import JobRetryForwardDeploymentModal from './job_retry_forward_deployment_modal.vue';
|
2021-01-29 00:20:46 +05:30
|
|
|
import JobSidebarDetailsContainer from './sidebar_job_details_container.vue';
|
2022-10-11 01:57:18 +05:30
|
|
|
import ArtifactsBlock from './artifacts_block.vue';
|
|
|
|
import LegacySidebarHeader from './legacy_sidebar_header.vue';
|
|
|
|
import SidebarHeader from './sidebar_header.vue';
|
2021-03-11 19:13:27 +05:30
|
|
|
import StagesDropdown from './stages_dropdown.vue';
|
|
|
|
import TriggerBlock from './trigger_block.vue';
|
2021-01-29 00:20:46 +05:30
|
|
|
|
2018-12-13 13:39:08 +05:30
|
|
|
export default {
|
|
|
|
name: 'JobSidebar',
|
2021-01-29 00:20:46 +05:30
|
|
|
i18n: {
|
2022-10-11 01:57:18 +05:30
|
|
|
...JOB_SIDEBAR_COPY,
|
2021-01-29 00:20:46 +05:30
|
|
|
},
|
2021-04-17 20:07:23 +05:30
|
|
|
borderTopClass: ['gl-border-t-solid', 'gl-border-t-1', 'gl-border-t-gray-100'],
|
2021-01-29 00:20:46 +05:30
|
|
|
forwardDeploymentFailureModalId,
|
2018-12-13 13:39:08 +05:30
|
|
|
components: {
|
|
|
|
ArtifactsBlock,
|
|
|
|
CommitBlock,
|
2021-01-29 00:20:46 +05:30
|
|
|
GlButton,
|
2020-11-24 15:15:51 +05:30
|
|
|
GlIcon,
|
2018-12-13 13:39:08 +05:30
|
|
|
JobsContainer,
|
2021-01-29 00:20:46 +05:30
|
|
|
JobRetryForwardDeploymentModal,
|
|
|
|
JobSidebarDetailsContainer,
|
2022-10-11 01:57:18 +05:30
|
|
|
LegacySidebarHeader,
|
|
|
|
SidebarHeader,
|
2021-01-29 00:20:46 +05:30
|
|
|
StagesDropdown,
|
|
|
|
TriggerBlock,
|
2018-12-13 13:39:08 +05:30
|
|
|
},
|
2022-10-11 01:57:18 +05:30
|
|
|
mixins: [glFeatureFlagsMixin()],
|
2018-12-13 13:39:08 +05:30
|
|
|
props: {
|
2020-11-24 15:15:51 +05:30
|
|
|
artifactHelpUrl: {
|
|
|
|
type: String,
|
|
|
|
required: false,
|
|
|
|
default: '',
|
|
|
|
},
|
2022-05-07 20:08:51 +05:30
|
|
|
erasePath: {
|
|
|
|
type: String,
|
|
|
|
required: false,
|
|
|
|
default: null,
|
|
|
|
},
|
2018-12-13 13:39:08 +05:30
|
|
|
},
|
|
|
|
computed: {
|
2021-01-29 00:20:46 +05:30
|
|
|
...mapGetters(['hasForwardDeploymentFailure']),
|
2019-09-04 21:01:54 +05:30
|
|
|
...mapState(['job', 'stages', 'jobs', 'selectedStage']),
|
2018-12-13 13:39:08 +05:30
|
|
|
hasArtifact() {
|
2021-04-29 21:17:54 +05:30
|
|
|
// the artifact object will always have a locked property
|
|
|
|
return Object.keys(this.job.artifact).length > 1;
|
2018-12-05 23:21:45 +05:30
|
|
|
},
|
2018-12-13 13:39:08 +05:30
|
|
|
hasTriggers() {
|
2020-03-13 15:44:24 +05:30
|
|
|
return !isEmpty(this.job.trigger);
|
2018-12-05 23:21:45 +05:30
|
|
|
},
|
2022-10-11 01:57:18 +05:30
|
|
|
isGraphQL() {
|
|
|
|
return this.glFeatures?.graphqlJobApp;
|
2018-12-13 13:39:08 +05:30
|
|
|
},
|
|
|
|
commit() {
|
2021-01-29 00:20:46 +05:30
|
|
|
return this.job?.pipeline?.commit || {};
|
|
|
|
},
|
2023-01-13 00:05:48 +05:30
|
|
|
selectedStageData() {
|
|
|
|
return this.stages.find((val) => val.name === this.selectedStage);
|
|
|
|
},
|
2021-01-29 00:20:46 +05:30
|
|
|
shouldShowJobRetryForwardDeploymentModal() {
|
|
|
|
return this.job.retry_path && this.hasForwardDeploymentFailure;
|
2018-12-13 13:39:08 +05:30
|
|
|
},
|
|
|
|
},
|
2023-01-13 00:05:48 +05:30
|
|
|
watch: {
|
|
|
|
job(value, oldValue) {
|
|
|
|
const hasNewStatus = value.status.text !== oldValue.status.text;
|
|
|
|
const isCurrentStage = value?.stage === this.selectedStage;
|
|
|
|
|
|
|
|
if (hasNewStatus && isCurrentStage) {
|
|
|
|
this.fetchJobsForStage(this.selectedStageData);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
2018-12-13 13:39:08 +05:30
|
|
|
methods: {
|
2022-10-11 01:57:18 +05:30
|
|
|
...mapActions(['fetchJobsForStage']),
|
2018-12-13 13:39:08 +05:30
|
|
|
},
|
|
|
|
};
|
2018-12-05 23:21:45 +05:30
|
|
|
</script>
|
|
|
|
<template>
|
2019-02-15 15:39:39 +05:30
|
|
|
<aside class="right-sidebar build-sidebar" data-offset-top="101" data-spy="affix">
|
2018-12-05 23:21:45 +05:30
|
|
|
<div class="sidebar-container">
|
|
|
|
<div class="blocks-container">
|
2022-10-11 01:57:18 +05:30
|
|
|
<sidebar-header v-if="isGraphQL" :erase-path="erasePath" :job="job" />
|
|
|
|
<legacy-sidebar-header v-else :erase-path="erasePath" :job="job" />
|
2021-04-17 20:07:23 +05:30
|
|
|
<div
|
|
|
|
v-if="job.terminal_path || job.new_issue_path"
|
|
|
|
class="gl-py-5"
|
|
|
|
:class="$options.borderTopClass"
|
|
|
|
>
|
|
|
|
<gl-button
|
2018-12-13 13:39:08 +05:30
|
|
|
v-if="job.new_issue_path"
|
|
|
|
:href="job.new_issue_path"
|
2021-04-17 20:07:23 +05:30
|
|
|
category="secondary"
|
|
|
|
variant="confirm"
|
2020-10-24 23:57:45 +05:30
|
|
|
data-testid="job-new-issue"
|
2021-04-17 20:07:23 +05:30
|
|
|
>
|
|
|
|
{{ $options.i18n.newIssue }}
|
|
|
|
</gl-button>
|
|
|
|
<gl-button
|
2019-03-02 22:35:43 +05:30
|
|
|
v-if="job.terminal_path"
|
|
|
|
:href="job.terminal_path"
|
|
|
|
target="_blank"
|
2021-01-29 00:20:46 +05:30
|
|
|
data-testid="terminal-link"
|
2018-12-13 13:39:08 +05:30
|
|
|
>
|
2021-01-29 00:20:46 +05:30
|
|
|
{{ $options.i18n.debug }}
|
2021-04-17 20:07:23 +05:30
|
|
|
<gl-icon name="external-link" />
|
|
|
|
</gl-button>
|
2018-12-13 13:39:08 +05:30
|
|
|
</div>
|
2021-04-17 20:07:23 +05:30
|
|
|
|
|
|
|
<job-sidebar-details-container class="gl-py-5" :class="$options.borderTopClass" />
|
|
|
|
|
|
|
|
<artifacts-block
|
|
|
|
v-if="hasArtifact"
|
|
|
|
class="gl-py-5"
|
|
|
|
:class="$options.borderTopClass"
|
|
|
|
:artifact="job.artifact"
|
|
|
|
:help-url="artifactHelpUrl"
|
|
|
|
/>
|
|
|
|
|
|
|
|
<trigger-block
|
|
|
|
v-if="hasTriggers"
|
|
|
|
class="gl-py-5"
|
|
|
|
:class="$options.borderTopClass"
|
|
|
|
:trigger="job.trigger"
|
|
|
|
/>
|
|
|
|
|
2018-12-13 13:39:08 +05:30
|
|
|
<commit-block
|
|
|
|
:commit="commit"
|
2021-04-17 20:07:23 +05:30
|
|
|
class="gl-py-5"
|
|
|
|
:class="$options.borderTopClass"
|
2018-12-13 13:39:08 +05:30
|
|
|
:merge-request="job.merge_request"
|
|
|
|
/>
|
2018-12-05 23:21:45 +05:30
|
|
|
|
2018-12-13 13:39:08 +05:30
|
|
|
<stages-dropdown
|
2021-01-29 00:20:46 +05:30
|
|
|
v-if="job.pipeline"
|
2021-04-17 20:07:23 +05:30
|
|
|
class="gl-py-5"
|
|
|
|
:class="$options.borderTopClass"
|
2018-12-13 13:39:08 +05:30
|
|
|
:pipeline="job.pipeline"
|
|
|
|
:selected-stage="selectedStage"
|
2021-01-29 00:20:46 +05:30
|
|
|
:stages="stages"
|
2018-12-13 13:39:08 +05:30
|
|
|
@requestSidebarStageDropdown="fetchJobsForStage"
|
2018-12-05 23:21:45 +05:30
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
|
2021-01-29 00:20:46 +05:30
|
|
|
<jobs-container v-if="jobs.length" :job-id="job.id" :jobs="jobs" />
|
2018-12-05 23:21:45 +05:30
|
|
|
</div>
|
2021-01-29 00:20:46 +05:30
|
|
|
<job-retry-forward-deployment-modal
|
|
|
|
v-if="shouldShowJobRetryForwardDeploymentModal"
|
|
|
|
:modal-id="$options.forwardDeploymentFailureModalId"
|
|
|
|
:href="job.retry_path"
|
|
|
|
/>
|
2018-12-05 23:21:45 +05:30
|
|
|
</aside>
|
|
|
|
</template>
|