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
|
<script>
import { __, s__ } from '~/locale';
import ConfirmDanger from '~/vue_shared/components/confirm_danger/confirm_danger.vue';
import TransferLocations from '~/groups_projects/components/transfer_locations.vue';
import { getGroupTransferLocations } from '~/api/groups_api';
export const i18n = {
confirmationMessage: __(
'You are going to transfer %{group_name} to another namespace. Are you ABSOLUTELY sure?',
),
emptyNamespaceTitle: __('No parent group'),
dropdownLabel: s__('GroupSettings|Select parent group'),
};
export default {
name: 'TransferGroupForm',
components: {
ConfirmDanger,
TransferLocations,
},
props: {
isPaidGroup: {
type: Boolean,
required: true,
},
confirmationPhrase: {
type: String,
required: true,
},
confirmButtonText: {
type: String,
required: true,
},
},
data() {
return {
selectedTransferLocation: null,
};
},
computed: {
disableSubmitButton() {
return this.isPaidGroup || !this.selectedTransferLocation;
},
selectedTransferLocationId() {
return this.selectedTransferLocation?.id;
},
},
methods: {
getGroupTransferLocations,
},
i18n,
additionalDropdownItems: [
{
id: -1,
humanName: i18n.emptyNamespaceTitle,
},
],
};
</script>
<template>
<div>
<input type="hidden" name="new_parent_group_id" :value="selectedTransferLocationId" />
<transfer-locations
v-if="!isPaidGroup"
v-model="selectedTransferLocation"
:show-user-transfer-locations="false"
data-testid="transfer-group-namespace"
:group-transfer-locations-api-method="getGroupTransferLocations"
:additional-dropdown-items="$options.additionalDropdownItems"
:label="$options.i18n.dropdownLabel"
/>
<confirm-danger
:disabled="disableSubmitButton"
:phrase="confirmationPhrase"
:button-text="confirmButtonText"
button-qa-selector="transfer_group_button"
@confirm="$emit('confirm')"
/>
</div>
</template>
|