All files / ee/app/assets/javascripts/approvals/components/license_compliance modal.vue

100% Statements 11/11
100% Branches 2/2
100% Functions 5/5
100% Lines 11/11

Press n or j to go to the next uncovered block, b, p or k for the previous block.

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  4x 4x 4x 4x 4x 4x                         24x   27x       27x         2x             298x                                                                  
<script>
import { GlButton, GlIcon, GlLink, GlSprintf } from '@gitlab/ui';
import { mapState } from 'vuex';
import { APPROVALS_MODAL } from 'ee/approvals/stores/modules/license_compliance';
import { __ } from '~/locale';
import GlModalVuex from '~/vue_shared/components/gl_modal_vuex.vue';
import RuleForm from '../rule_form.vue';
 
export default {
  components: {
    GlButton,
    GlIcon,
    GlLink,
    GlSprintf,
    GlModalVuex,
    RuleForm,
  },
  computed: {
    ...mapState({
      documentationPath: ({ settings }) => settings.approvalsDocumentationPath,
      licenseApprovalRule(state) {
        return state[APPROVALS_MODAL].data;
      },
    }),
    title() {
      return this.licenseApprovalRule ? __('Update approvers') : __('Add approvers');
    },
  },
  methods: {
    submit() {
      this.$refs.form.submit();
    },
  },
  modalModule: APPROVALS_MODAL,
};
</script>
 
<template>
  <gl-modal-vuex
    :modal-module="$options.modalModule"
    modal-id="licenseComplianceApproval"
    :title="title"
    size="sm"
    @ok="submit"
  >
    <rule-form ref="form" :init-rule="licenseApprovalRule" />
    <template #modal-footer="{ ok, cancel }">
      <section class="gl-display-flex gl-w-full">
        <p>
          <gl-icon name="question" :size="12" class="gl-text-blue-600" />
          <gl-sprintf
            :message="
              s__('LicenseCompliance|Learn more about %{linkStart}License Approvals%{linkEnd}')
            "
          >
            <template #link="{ content }">
              <gl-link :href="documentationPath" target="_blank">{{ content }}</gl-link>
            </template>
          </gl-sprintf>
        </p>
        <div class="gl-ml-auto">
          <gl-button name="cancel" @click="cancel">{{ __('Cancel') }}</gl-button>
          <gl-button name="ok" category="primary" variant="confirm" @click="ok">{{
            title
          }}</gl-button>
        </div>
      </section>
    </template>
  </gl-modal-vuex>
</template>