summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/projects/settings/branch_rules/components/rule_edit.vue
blob: ad3eb7d2899f284b9b141ee53181aedf43d56a72 (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
<script>
import { GlFormGroup } from '@gitlab/ui';
import { s__ } from '~/locale';
import { getParameterByName } from '~/lib/utils/url_utility';
import BranchDropdown from './branch_dropdown.vue';
import Protections from './protections/index.vue';

export default {
  name: 'RuleEdit',
  i18n: { branch: s__('BranchRules|Branch') },
  components: {
    BranchDropdown,
    GlFormGroup,
    Protections,
  },
  props: {
    projectPath: {
      type: String,
      required: true,
    },
  },
  data() {
    return {
      branch: getParameterByName('branch'),
      protections: {
        membersAllowedToPush: [],
        allowForcePush: false,
        membersAllowedToMerge: [],
        requireCodeOwnersApproval: false,
      },
    };
  },
};
</script>

<template>
  <div>
    <gl-form-group :label="$options.i18n.branch">
      <branch-dropdown
        id="branches"
        v-model="branch"
        class="gl-w-half"
        :project-path="projectPath"
        @createWildcard="branch = $event"
      />
    </gl-form-group>

    <protections
      :protections="protections"
      @change-allowed-to-push-members="protections.membersAllowedToPush = $event"
      @change-allow-force-push="protections.allowForcePush = $event"
      @change-allowed-to-merge-members="protections.membersAllowedToMerge = $event"
      @change-require-code-owners-approval="protections.requireCodeOwnersApproval = $event"
    />
  </div>
</template>