summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/vue_shared/components/runner_aws_deployments/runner_aws_deployments_modal.vue
blob: f21dea468cbc9166057a99d00ddcbacd666844ef (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
89
90
91
92
93
94
95
96
97
<script>
import { GlModal, GlSprintf, GlLink } from '@gitlab/ui';
import ExperimentTracking from '~/experimentation/experiment_tracking';
import { getBaseURL, objectToQuery } from '~/lib/utils/url_utility';
import { __, s__ } from '~/locale';
import {
  EXPERIMENT_NAME,
  README_URL,
  CF_BASE_URL,
  TEMPLATES_BASE_URL,
  EASY_BUTTONS,
} from './constants';

export default {
  components: {
    GlModal,
    GlSprintf,
    GlLink,
  },
  props: {
    modalId: {
      type: String,
      required: true,
    },
  },
  methods: {
    easyButtonUrl(easyButton) {
      const params = {
        templateURL: TEMPLATES_BASE_URL + easyButton.templateName,
        stackName: easyButton.stackName,
        param_3GITLABRunnerInstanceURL: getBaseURL(),
      };
      return CF_BASE_URL + objectToQuery(params);
    },
    trackCiRunnerTemplatesClick(stackName) {
      const tracking = new ExperimentTracking(EXPERIMENT_NAME);
      tracking.event(`template_clicked_${stackName}`);
    },
  },
  i18n: {
    title: s__('Runners|Deploy GitLab Runner in AWS'),
    instructions: s__(
      'Runners|For each solution, you will choose a capacity. 1 enables warm HA through Auto Scaling group re-spawn. 2 enables hot HA because the service is available even when a node is lost. 3 or more enables hot HA and manual scaling of runner fleet.',
    ),
    dont_see_what_you_are_looking_for: s__(
      "Rnners|Don't see what you are looking for? See the full list of options, including a fully customizable option, %{linkStart}here%{linkEnd}.",
    ),
    note: s__(
      'Runners|If you do not select an AWS VPC, the runner will deploy to the Default VPC in the AWS Region you select. Please consult with your AWS administrator to understand if there are any security risks to deploying into the Default VPC in any given region in your AWS account.',
    ),
  },
  closeButton: {
    text: __('Cancel'),
    attributes: [{ variant: 'default' }],
  },
  readmeUrl: README_URL,
  easyButtons: EASY_BUTTONS,
};
</script>
<template>
  <gl-modal
    :modal-id="modalId"
    :title="$options.i18n.title"
    :action-secondary="$options.closeButton"
    size="sm"
  >
    <p>{{ $options.i18n.instructions }}</p>
    <ul class="gl-list-style-none gl-p-0 gl-mb-0">
      <li v-for="easyButton in $options.easyButtons" :key="easyButton.templateName">
        <gl-link
          :href="easyButtonUrl(easyButton)"
          target="_blank"
          class="gl-display-flex gl-font-weight-bold"
          @click="trackCiRunnerTemplatesClick(easyButton.stackName)"
        >
          <img
            :title="easyButton.stackName"
            :alt="easyButton.stackName"
            src="/assets/aws-cloud-formation.png"
            width="46"
            height="46"
            class="gl-mt-2 gl-mr-5 gl-mb-6"
          />
          {{ easyButton.description }}
        </gl-link>
      </li>
    </ul>
    <p>
      <gl-sprintf :message="$options.i18n.dont_see_what_you_are_looking_for">
        <template #link="{ content }">
          <gl-link :href="$options.readmeUrl" target="_blank">{{ content }}</gl-link>
        </template>
      </gl-sprintf>
    </p>
    <p class="gl-font-sm gl-mb-0">{{ $options.i18n.note }}</p>
  </gl-modal>
</template>