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

runner_type_alert.vue « components « runner « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 1400875a1d60499a5e28df6fa0a2a2ebb234d279 (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
<script>
import { GlAlert, GlLink } from '@gitlab/ui';
import { helpPagePath } from '~/helpers/help_page_helper';
import { s__ } from '~/locale';
import { INSTANCE_TYPE, GROUP_TYPE, PROJECT_TYPE } from '../constants';

const ALERT_DATA = {
  [INSTANCE_TYPE]: {
    message: s__(
      'Runners|This runner is available to all groups and projects in your GitLab instance.',
    ),
    anchor: 'shared-runners',
  },
  [GROUP_TYPE]: {
    message: s__('Runners|This runner is available to all projects and subgroups in a group.'),
    anchor: 'group-runners',
  },
  [PROJECT_TYPE]: {
    message: s__('Runners|This runner is associated with one or more projects.'),
    anchor: 'specific-runners',
  },
};

export default {
  components: {
    GlAlert,
    GlLink,
  },
  props: {
    type: {
      type: String,
      required: false,
      default: null,
      validator(type) {
        return Boolean(ALERT_DATA[type]);
      },
    },
  },
  computed: {
    alert() {
      return ALERT_DATA[this.type];
    },
    helpHref() {
      return helpPagePath('ci/runners/runners_scope', { anchor: this.alert.anchor });
    },
  },
};
</script>
<template>
  <gl-alert v-if="alert" variant="info" :dismissible="false">
    {{ alert.message }}
    <gl-link :href="helpHref">{{ __('Learn more.') }}</gl-link>
  </gl-alert>
</template>