2021-01-29 00:20:46 +05:30
|
|
|
<script>
|
2022-06-21 17:19:12 +05:30
|
|
|
import { GlIcon, GlLink, GlFormGroup, GlFormCheckbox } from '@gitlab/ui';
|
2021-01-29 00:20:46 +05:30
|
|
|
import IntegrationHelpText from '~/vue_shared/components/integrations_help_text.vue';
|
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'IntegrationView',
|
|
|
|
components: {
|
|
|
|
GlIcon,
|
|
|
|
GlLink,
|
2022-06-21 17:19:12 +05:30
|
|
|
GlFormGroup,
|
|
|
|
GlFormCheckbox,
|
2021-01-29 00:20:46 +05:30
|
|
|
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 {
|
2022-06-21 17:19:12 +05:30
|
|
|
isEnabled: this.userFields[this.config.formName] ? '1' : '0',
|
2021-01-29 00:20:46 +05:30
|
|
|
};
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
formName() {
|
|
|
|
return `user[${this.config.formName}]`;
|
|
|
|
},
|
|
|
|
formId() {
|
|
|
|
return `user_${this.config.formName}`;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
2022-06-21 17:19:12 +05:30
|
|
|
<gl-form-group>
|
|
|
|
<template #label>
|
2021-01-29 00:20:46 +05:30
|
|
|
{{ config.title }}
|
2022-06-21 17:19:12 +05:30
|
|
|
<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>
|
2021-01-29 00:20:46 +05:30
|
|
|
<integration-help-text :message="message" :message-url="messageUrl" />
|
2022-06-21 17:19:12 +05:30
|
|
|
</template>
|
|
|
|
</gl-form-checkbox>
|
|
|
|
</gl-form-group>
|
2021-01-29 00:20:46 +05:30
|
|
|
</template>
|