Welcome to mirror list, hosted at ThFree Co, Russian Federation.

transfer_group_form.vue « components « groups « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 7e7282a27b06797580ab317578eb213d9db103ba (plain)
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
<script>
import { GlFormGroup } from '@gitlab/ui';
import { __, s__ } from '~/locale';
import ConfirmDanger from '~/vue_shared/components/confirm_danger/confirm_danger.vue';
import NamespaceSelect from '~/vue_shared/components/namespace_select/namespace_select.vue';

export const i18n = {
  confirmationMessage: __(
    'You are going to transfer %{group_name} to another namespace. Are you ABSOLUTELY sure?',
  ),
  emptyNamespaceTitle: __('No parent group'),
  dropdownTitle: s__('GroupSettings|Select parent group'),
};

export default {
  name: 'TransferGroupForm',
  components: {
    ConfirmDanger,
    GlFormGroup,
    NamespaceSelect,
  },
  props: {
    groupNamespaces: {
      type: Array,
      required: true,
    },
    isPaidGroup: {
      type: Boolean,
      required: true,
    },
    confirmationPhrase: {
      type: String,
      required: true,
    },
    confirmButtonText: {
      type: String,
      required: true,
    },
  },
  data() {
    return {
      selectedId: null,
    };
  },
  computed: {
    disableSubmitButton() {
      return this.isPaidGroup || !this.selectedId;
    },
  },
  methods: {
    handleSelected({ id }) {
      this.selectedId = id;
    },
  },
  i18n,
};
</script>
<template>
  <div>
    <gl-form-group v-if="!isPaidGroup">
      <namespace-select
        :default-text="$options.i18n.dropdownTitle"
        :group-namespaces="groupNamespaces"
        :empty-namespace-title="$options.i18n.emptyNamespaceTitle"
        :include-headers="false"
        include-empty-namespace
        data-testid="transfer-group-namespace-select"
        @select="handleSelected"
      />
      <input type="hidden" name="new_parent_group_id" :value="selectedId" />
    </gl-form-group>
    <confirm-danger
      :disabled="disableSubmitButton"
      :phrase="confirmationPhrase"
      :button-text="confirmButtonText"
      @confirm="$emit('confirm')"
    />
  </div>
</template>