debian-mirror-gitlab/app/assets/javascripts/reports/components/modal.vue

64 lines
1.7 KiB
Vue
Raw Normal View History

2018-11-18 11:00:15 +05:30
<script>
2019-10-12 21:52:04 +05:30
// import { sprintf, __ } from '~/locale';
2018-12-13 13:39:08 +05:30
import Modal from '~/vue_shared/components/gl_modal.vue';
import LoadingButton from '~/vue_shared/components/loading_button.vue';
import CodeBlock from '~/vue_shared/components/code_block.vue';
import { fieldTypes } from '../constants';
2018-11-18 11:00:15 +05:30
2018-12-13 13:39:08 +05:30
export default {
components: {
Modal,
LoadingButton,
CodeBlock,
},
props: {
title: {
type: String,
required: true,
2018-11-18 11:00:15 +05:30
},
2018-12-13 13:39:08 +05:30
modalData: {
type: Object,
required: true,
2018-11-18 11:00:15 +05:30
},
2018-12-13 13:39:08 +05:30
},
fieldTypes,
};
2018-11-18 11:00:15 +05:30
</script>
<template>
<modal
id="modal-mrwidget-reports"
:header-title-text="title"
class="modal-security-report-dast modal-hide-footer"
>
<slot>
<div
v-for="(field, key, index) in modalData"
v-if="field.value"
:key="index"
class="row prepend-top-10 append-bottom-10"
>
2019-02-15 15:39:39 +05:30
<strong class="col-sm-3 text-right"> {{ field.text }}: </strong>
2018-11-18 11:00:15 +05:30
<div class="col-sm-9 text-secondary">
2019-02-15 15:39:39 +05:30
<code-block v-if="field.type === $options.fieldTypes.codeBock" :code="field.value" />
2018-11-18 11:00:15 +05:30
<template v-else-if="field.type === $options.fieldTypes.link">
2019-02-15 15:39:39 +05:30
<a :href="field.value" target="_blank" rel="noopener noreferrer" class="js-modal-link">
2018-11-18 11:00:15 +05:30
{{ field.value }}
</a>
</template>
2019-10-12 21:52:04 +05:30
<template v-else-if="field.type === $options.fieldTypes.miliseconds">{{
sprintf(__('%{value} ms'), { value: field.value })
}}</template>
2018-11-18 11:00:15 +05:30
<template v-else-if="field.type === $options.fieldTypes.text">
{{ field.value }}
</template>
</div>
</div>
</slot>
2019-02-15 15:39:39 +05:30
<div slot="footer"></div>
2018-11-18 11:00:15 +05:30
</modal>
</template>