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

new_merge_request_option.vue « commit_sidebar « components « ide « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: cdf49866982ae80bb805250c9e30af92ad93cf3f (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
<script>
import { createNamespacedHelpers } from 'vuex';
import { GlTooltipDirective } from '@gitlab/ui';
import { s__ } from '~/locale';

const { mapActions: mapCommitActions, mapGetters: mapCommitGetters } = createNamespacedHelpers(
  'commit',
);

export default {
  directives: {
    GlTooltip: GlTooltipDirective,
  },
  computed: {
    ...mapCommitGetters(['shouldHideNewMrOption', 'shouldDisableNewMrOption', 'shouldCreateMR']),
    tooltipText() {
      if (this.shouldDisableNewMrOption) {
        return s__(
          'IDE|This option is disabled because you are not allowed to create merge requests in this project.',
        );
      }

      return '';
    },
  },
  methods: {
    ...mapCommitActions(['toggleShouldCreateMR']),
  },
};
</script>

<template>
  <fieldset v-if="!shouldHideNewMrOption">
    <hr class="my-2" />
    <label
      v-gl-tooltip="tooltipText"
      class="mb-0 js-ide-commit-new-mr"
      :class="{ 'is-disabled': shouldDisableNewMrOption }"
    >
      <input
        :disabled="shouldDisableNewMrOption"
        :checked="shouldCreateMR"
        type="checkbox"
        data-qa-selector="start_new_mr_checkbox"
        @change="toggleShouldCreateMR"
      />
      <span class="gl-ml-3 ide-option-label">
        {{ __('Start a new merge request') }}
      </span>
    </label>
  </fieldset>
</template>