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
|
<script>
import { GlButton, GlDisclosureDropdown, GlModalDirective } from '@gitlab/ui';
// eslint-disable-next-line no-restricted-imports
import { mapGetters } from 'vuex';
import { s__ } from '~/locale';
export default {
name: 'JobSidebarRetryButton',
i18n: {
retryJobLabel: s__('Job|Retry'),
runAgainJobButtonLabel: s__('Job|Run again'),
updateVariables: s__('Job|Update CI/CD variables'),
},
components: {
GlButton,
GlDisclosureDropdown,
},
directives: {
GlModal: GlModalDirective,
},
props: {
modalId: {
type: String,
required: true,
},
href: {
type: String,
required: true,
},
isManualJob: {
type: Boolean,
required: true,
},
},
computed: {
...mapGetters(['hasForwardDeploymentFailure']),
dropdownItems() {
return [
{
text: this.$options.i18n.runAgainJobButtonLabel,
href: this.href,
extraAttrs: {
'data-method': 'post',
},
},
{
text: this.$options.i18n.updateVariables,
action: () => this.$emit('updateVariablesClicked'),
},
];
},
},
};
</script>
<template>
<gl-button
v-if="hasForwardDeploymentFailure"
v-gl-modal="modalId"
:aria-label="$options.i18n.retryJobLabel"
category="primary"
variant="confirm"
icon="retry"
data-testid="retry-job-button"
/>
<gl-disclosure-dropdown
v-else-if="isManualJob"
icon="retry"
category="primary"
placement="right"
positioning-strategy="fixed"
variant="confirm"
:items="dropdownItems"
/>
<gl-button
v-else
:href="href"
:aria-label="$options.i18n.retryJobLabel"
category="primary"
variant="confirm"
icon="retry"
data-method="post"
data-testid="retry-job-link"
/>
</template>
|