summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/google_cloud/components/service_accounts_form.vue
blob: faec94e735be500e5a9fe5461f6a806dae7b47d6 (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
<script>
import { GlButton, GlFormCheckbox, GlFormGroup, GlFormSelect } from '@gitlab/ui';
import { s__ } from '~/locale';

export default {
  ALL_REFS: '*',
  components: { GlButton, GlFormGroup, GlFormSelect, GlFormCheckbox },
  props: {
    gcpProjects: { required: true, type: Array },
    refs: { required: true, type: Array },
    cancelPath: { required: true, type: String },
  },
  i18n: {
    title: s__('GoogleCloud|Create service account'),
    gcpProjectLabel: s__('GoogleCloud|Google Cloud project'),
    gcpProjectDescription: s__(
      'GoogleCloud|New service account is generated for the selected Google Cloud project',
    ),
    refsLabel: s__('GoogleCloud|Refs'),
    refsDescription: s__(
      'GoogleCloud|Generated service account is linked to the selected branch or tag',
    ),
    submitLabel: s__('GoogleCloud|Create service account'),
    cancelLabel: s__('GoogleCloud|Cancel'),
    checkboxLabel: s__(
      'GoogleCloud|I understand the responsibilities involved with managing service account keys',
    ),
  },
};
</script>

<template>
  <div>
    <header class="gl-my-5 gl-border-b-1 gl-border-b-gray-100 gl-border-b-solid">
      <h2 class="gl-font-size-h1">{{ $options.i18n.title }}</h2>
    </header>
    <gl-form-group
      label-for="gcp_project"
      :label="$options.i18n.gcpProjectLabel"
      :description="$options.i18n.gcpProjectDescription"
    >
      <gl-form-select id="gcp_project" name="gcp_project" required>
        <option
          v-for="gcpProject in gcpProjects"
          :key="gcpProject.project_id"
          :value="gcpProject.project_id"
        >
          {{ gcpProject.name }}
        </option>
      </gl-form-select>
    </gl-form-group>
    <gl-form-group
      label-for="ref"
      :label="$options.i18n.refsLabel"
      :description="$options.i18n.refsDescription"
    >
      <gl-form-select id="ref" name="ref" required>
        <option :value="$options.ALL_REFS">{{ __('All') }}</option>
        <option v-for="ref in refs" :key="ref" :value="ref">
          {{ ref }}
        </option>
      </gl-form-select>
    </gl-form-group>
    <gl-form-group>
      <gl-form-checkbox name="confirmation" required>
        {{ $options.i18n.checkboxLabel }}
      </gl-form-checkbox>
    </gl-form-group>

    <div class="form-actions row">
      <gl-button type="submit" category="primary" variant="confirm">
        {{ $options.i18n.submitLabel }}
      </gl-button>
      <gl-button class="gl-ml-1" :href="cancelPath">{{ $options.i18n.cancelLabel }}</gl-button>
    </div>
  </div>
</template>