debian-mirror-gitlab/app/assets/javascripts/jobs/bridge/components/sidebar.vue

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

106 lines
2.9 KiB
Vue
Raw Normal View History

2022-01-26 12:08:38 +05:30
<script>
import { GlButton, GlDropdown, GlDropdownItem } from '@gitlab/ui';
import { __ } from '~/locale';
2022-03-02 08:16:31 +05:30
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
2022-01-26 12:08:38 +05:30
import TooltipOnTruncate from '~/vue_shared/components/tooltip_on_truncate/tooltip_on_truncate.vue';
import { JOB_SIDEBAR } from '../../constants';
2022-03-02 08:16:31 +05:30
import CommitBlock from '../../components/commit_block.vue';
2022-01-26 12:08:38 +05:30
export default {
styles: {
width: '290px',
},
name: 'BridgeSidebar',
i18n: {
...JOB_SIDEBAR,
retryButton: __('Retry'),
retryTriggerJob: __('Retry the trigger job'),
retryDownstreamPipeline: __('Retry the downstream pipeline'),
},
2022-03-02 08:16:31 +05:30
sectionClass: ['gl-border-t-solid', 'gl-border-t-1', 'gl-border-t-gray-100', 'gl-py-5'],
2022-01-26 12:08:38 +05:30
components: {
2022-03-02 08:16:31 +05:30
CommitBlock,
2022-01-26 12:08:38 +05:30
GlButton,
GlDropdown,
GlDropdownItem,
TooltipOnTruncate,
},
2022-03-02 08:16:31 +05:30
mixins: [glFeatureFlagsMixin()],
props: {
bridgeJob: {
type: Object,
required: true,
},
commit: {
type: Object,
required: true,
2022-01-26 12:08:38 +05:30
},
},
data() {
return {
2022-03-02 08:16:31 +05:30
topPosition: 0,
2022-01-26 12:08:38 +05:30
};
},
2022-03-02 08:16:31 +05:30
computed: {
rootStyle() {
return { ...this.$options.styles, top: `${this.topPosition}px` };
},
2022-01-26 12:08:38 +05:30
},
mounted() {
2022-03-02 08:16:31 +05:30
this.setTopPosition();
2022-01-26 12:08:38 +05:30
},
methods: {
2022-03-02 08:16:31 +05:30
onSidebarButtonClick() {
this.$emit('toggleSidebar');
2022-01-26 12:08:38 +05:30
},
2022-03-02 08:16:31 +05:30
setTopPosition() {
const navbarEl = document.querySelector('.js-navbar');
if (navbarEl) {
this.topPosition = navbarEl.getBoundingClientRect().bottom;
2022-01-26 12:08:38 +05:30
}
},
},
};
</script>
<template>
<aside
class="gl-fixed gl-right-0 gl-px-5 gl-bg-gray-10 gl-h-full gl-border-l-solid gl-border-1 gl-border-gray-100 gl-z-index-200 gl-overflow-hidden"
2022-03-02 08:16:31 +05:30
:style="rootStyle"
2022-01-26 12:08:38 +05:30
>
<div class="gl-py-5 gl-display-flex gl-align-items-center">
2022-03-02 08:16:31 +05:30
<tooltip-on-truncate :title="bridgeJob.name" truncate-target="child"
2022-01-26 12:08:38 +05:30
><h4 class="gl-mb-0 gl-mr-2 gl-text-truncate">
2022-03-02 08:16:31 +05:30
{{ bridgeJob.name }}
2022-01-26 12:08:38 +05:30
</h4>
</tooltip-on-truncate>
<!-- TODO: implement retry actions -->
2022-03-02 08:16:31 +05:30
<div
v-if="glFeatures.triggerJobRetryAction"
class="gl-flex-grow-1 gl-flex-shrink-0 gl-text-right"
>
2022-01-26 12:08:38 +05:30
<gl-dropdown
:text="$options.i18n.retryButton"
category="primary"
variant="confirm"
right
size="medium"
>
<gl-dropdown-item>{{ $options.i18n.retryTriggerJob }}</gl-dropdown-item>
<gl-dropdown-item>{{ $options.i18n.retryDownstreamPipeline }}</gl-dropdown-item>
</gl-dropdown>
</div>
<gl-button
:aria-label="$options.i18n.toggleSidebar"
data-testid="sidebar-expansion-toggle"
category="tertiary"
class="gl-md-display-none gl-ml-2"
icon="chevron-double-lg-right"
2022-03-02 08:16:31 +05:30
@click="onSidebarButtonClick"
2022-01-26 12:08:38 +05:30
/>
</div>
2022-03-02 08:16:31 +05:30
<commit-block :commit="commit" :class="$options.sectionClass" />
<!-- TODO: show stage dropdown, jobs list -->
2022-01-26 12:08:38 +05:30
</aside>
</template>