1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
|
<script>
import { GlButton, GlTooltipDirective } from '@gitlab/ui';
import { __ } from '~/locale';
import StatusIcon from './mr_widget_status_icon.vue';
import Actions from './action_buttons.vue';
export default {
components: {
GlButton,
StatusIcon,
Actions,
},
directives: {
GlTooltip: GlTooltipDirective,
},
props: {
mr: {
type: Object,
required: false,
default: null,
},
isLoading: {
type: Boolean,
required: false,
default: false,
},
status: {
type: String,
required: false,
default: '',
},
actions: {
type: Array,
required: false,
default: () => [],
},
},
i18n: {
expandDetailsTooltip: __('Expand merge details'),
collapseDetailsTooltip: __('Collapse merge details'),
},
computed: {
wrapperClasses() {
if (this.status === 'merged') return 'gl-bg-blue-50';
if (this.status === 'closed') return 'gl-bg-red-50';
return null;
},
},
};
</script>
<template>
<div class="mr-widget-body media" :class="wrapperClasses" v-on="$listeners">
<div v-if="isLoading" class="gl-w-full mr-conflict-loader">
<slot name="loading">
<div class="gl-display-flex">
<status-icon status="loading" />
<div class="media-body">
<slot></slot>
</div>
</div>
</slot>
</div>
<template v-else>
<slot name="icon">
<status-icon :status="status" />
</slot>
<div class="gl-display-flex gl-w-full">
<div
:class="{ 'gl-display-flex': actions.length, 'gl-md-display-flex': !actions.length }"
class="media-body"
>
<slot></slot>
<div
:class="{ 'gl-flex-direction-column-reverse': !actions.length }"
class="gl-display-flex gl-md-display-block gl-font-size-0 gl-ml-auto"
>
<slot name="actions">
<actions v-if="actions.length" :tertiary-buttons="actions" />
</slot>
</div>
</div>
<div
v-if="mr"
class="gl-md-display-none gl-border-l-1 gl-border-l-solid gl-border-gray-100 gl-ml-3 gl-pl-3 gl-h-6 gl-mt-1"
>
<gl-button
v-gl-tooltip
:title="
mr.mergeDetailsCollapsed
? $options.i18n.expandDetailsTooltip
: $options.i18n.collapseDetailsTooltip
"
:icon="mr.mergeDetailsCollapsed ? 'chevron-lg-down' : 'chevron-lg-up'"
category="tertiary"
size="small"
class="gl-vertical-align-top"
@click="() => mr.toggleMergeDetails()"
/>
</div>
</div>
</template>
</div>
</template>
|