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 {
GlTooltipDirective,
GlFormRadio,
GlFormRadioGroup,
GlFormGroup,
GlFormInput,
} from '@gitlab/ui';
import { mapActions, mapState, mapGetters } from 'vuex';
export default {
components: {
GlFormRadio,
GlFormRadioGroup,
GlFormGroup,
GlFormInput,
},
directives: {
GlTooltip: GlTooltipDirective,
},
props: {
value: {
type: String,
required: true,
},
label: {
type: String,
required: false,
default: null,
},
checked: {
type: Boolean,
required: false,
default: false,
},
showInput: {
type: Boolean,
required: false,
default: false,
},
disabled: {
type: Boolean,
required: false,
default: false,
},
title: {
type: String,
required: false,
default: '',
},
},
computed: {
...mapState('commit', ['commitAction', 'newBranchName']),
...mapGetters('commit', ['placeholderBranchName']),
tooltipTitle() {
return this.disabled ? this.title : '';
},
},
methods: {
...mapActions('commit', ['updateCommitAction', 'updateBranchName']),
},
};
</script>
<template>
<fieldset class="gl-mb-2">
<gl-form-radio-group
v-gl-tooltip="tooltipTitle"
:checked="commitAction"
:class="{
'is-disabled': disabled,
}"
>
<gl-form-radio
:value="value"
:disabled="disabled"
name="commit-action"
data-qa-selector="commit_type_radio"
@change="updateCommitAction(value)"
>
<span v-if="label" class="ide-option-label">
{{ label }}
</span>
<slot v-else></slot>
</gl-form-radio>
</gl-form-radio-group>
<gl-form-group
v-if="commitAction === value && showInput"
:label="placeholderBranchName"
:label-sr-only="true"
class="gl-ml-6 gl-mb-0"
>
<gl-form-input
:placeholder="placeholderBranchName"
:value="newBranchName"
:disabled="disabled"
data-testid="ide-new-branch-name"
class="gl-font-monospace"
@input="updateBranchName($event)"
/>
</gl-form-group>
</fieldset>
</template>
|