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

integration_view.vue « components « preferences « profile « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 9924f248b891ab892e51d009e28c544bdc3622d3 (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
<script>
import { GlIcon, GlLink, GlFormGroup, GlFormCheckbox } from '@gitlab/ui';
import IntegrationHelpText from '~/vue_shared/components/integrations_help_text.vue';

export default {
  name: 'IntegrationView',
  components: {
    GlIcon,
    GlLink,
    GlFormGroup,
    GlFormCheckbox,
    IntegrationHelpText,
  },
  inject: ['userFields'],
  props: {
    helpLink: {
      type: String,
      required: true,
    },
    message: {
      type: String,
      required: true,
    },
    messageUrl: {
      type: String,
      required: true,
    },
    config: {
      type: Object,
      required: true,
    },
  },
  data() {
    return {
      isEnabled: this.userFields[this.config.formName] ? '1' : '0',
    };
  },
  computed: {
    formName() {
      return `user[${this.config.formName}]`;
    },
    formId() {
      return `user_${this.config.formName}`;
    },
  },
};
</script>

<template>
  <gl-form-group>
    <template #label>
      {{ config.title }}
      <gl-link class="has-tooltip" title="More information" :href="helpLink">
        <gl-icon name="question-o" class="vertical-align-middle" />
      </gl-link>
    </template>
    <!-- Necessary for Rails to receive the value when not checked -->
    <input
      :name="formName"
      type="hidden"
      value="0"
      data-testid="profile-preferences-integration-hidden-field"
    />
    <gl-form-checkbox :id="formId" :checked="isEnabled" :name="formName" value="1"
      >{{ config.label }}
      <template #help>
        <integration-help-text :message="message" :message-url="messageUrl" />
      </template>
    </gl-form-checkbox>
  </gl-form-group>
</template>