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

version_select_form.vue « sign_in_gitlab_multiversion « sign_in « pages « subscriptions « jira_connect « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 0fa745ed7e3c3e426bf40f07ed3f23a6c1d84318 (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
80
81
82
83
84
85
86
87
88
<script>
import {
  GlForm,
  GlFormGroup,
  GlFormRadioGroup,
  GlFormInput,
  GlFormRadio,
  GlButton,
} from '@gitlab/ui';
import { __, s__ } from '~/locale';

const RADIO_OPTIONS = {
  saas: 'saas',
  selfManaged: 'selfManaged',
};

const DEFAULT_RADIO_OPTION = RADIO_OPTIONS.saas;
const GITLAB_COM_BASE_PATH = 'https://gitlab.com';

export default {
  name: 'VersionSelectForm',
  components: {
    GlForm,
    GlFormGroup,
    GlFormRadioGroup,
    GlFormInput,
    GlFormRadio,
    GlButton,
  },
  data() {
    return {
      selected: DEFAULT_RADIO_OPTION,
      selfManagedBasePathInput: '',
    };
  },
  computed: {
    isSelfManagedSelected() {
      return this.selected === RADIO_OPTIONS.selfManaged;
    },
  },
  methods: {
    onSubmit() {
      const gitlabBasePath =
        this.selected === RADIO_OPTIONS.saas ? GITLAB_COM_BASE_PATH : this.selfManagedBasePathInput;
      this.$emit('submit', gitlabBasePath);
    },
  },
  radioOptions: RADIO_OPTIONS,
  i18n: {
    title: s__('JiraService|Welcome to GitLab for Jira'),
    saasRadioLabel: __('GitLab.com (SaaS)'),
    saasRadioHelp: __('Most common'),
    selfManagedRadioLabel: __('GitLab (self-managed)'),
    instanceURLInputLabel: s__('JiraService|GitLab instance URL'),
    instanceURLInputDescription: s__('JiraService|For example: https://gitlab.example.com'),
  },
};
</script>

<template>
  <gl-form class="gl-max-w-62 gl-mx-auto" @submit.prevent="onSubmit">
    <gl-form-radio-group v-model="selected" class="gl-mb-3" name="gitlab_version">
      <gl-form-radio :value="$options.radioOptions.saas">
        {{ $options.i18n.saasRadioLabel }}
        <template #help>
          {{ $options.i18n.saasRadioHelp }}
        </template>
      </gl-form-radio>
      <gl-form-radio :value="$options.radioOptions.selfManaged">
        {{ $options.i18n.selfManagedRadioLabel }}
      </gl-form-radio>
    </gl-form-radio-group>

    <gl-form-group
      v-if="isSelfManagedSelected"
      class="gl-ml-6"
      :label="$options.i18n.instanceURLInputLabel"
      :description="$options.i18n.instanceURLInputDescription"
      label-for="self-managed-instance-input"
    >
      <gl-form-input id="self-managed-instance-input" v-model="selfManagedBasePathInput" required />
    </gl-form-group>

    <div class="gl-display-flex gl-justify-content-end">
      <gl-button variant="confirm" type="submit">{{ __('Save') }}</gl-button>
    </div>
  </gl-form>
</template>