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

62 lines
1.6 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';
2019-12-21 20:55:43 +05:30
import DeprecatedModal2 from '~/vue_shared/components/deprecated_modal_2.vue';
2018-12-13 13:39:08 +05:30
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: {
2019-12-21 20:55:43 +05:30
Modal: DeprecatedModal2,
2018-12-13 13:39:08 +05:30
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>
2020-03-13 15:44:24 +05:30
<template v-else-if="field.type === $options.fieldTypes.seconds">{{
sprintf(__('%{value} s'), { value: field.value })
2019-10-12 21:52:04 +05:30
}}</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>