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

94 lines
2.2 KiB
Vue
Raw Normal View History

2018-11-18 11:00:15 +05:30
<script>
2020-01-01 13:55:28 +05:30
import { GlLoadingIcon } from '@gitlab/ui';
2018-11-18 11:00:15 +05:30
import CiIcon from '~/vue_shared/components/ci_icon.vue';
2018-11-20 20:47:30 +05:30
import Popover from '~/vue_shared/components/help_popover.vue';
2021-04-17 20:07:23 +05:30
import { ICON_WARNING } from '../constants';
2018-11-18 11:00:15 +05:30
/**
* Renders the summary row for each report
*
* Used both in MR widget and Pipeline's view for:
* - Unit tests reports
* - Security reports
*/
export default {
name: 'ReportSummaryRow',
components: {
CiIcon,
Popover,
2018-12-13 13:39:08 +05:30
GlLoadingIcon,
2018-11-18 11:00:15 +05:30
},
props: {
2021-04-17 20:07:23 +05:30
nestedSummary: {
type: Boolean,
required: false,
default: false,
},
2018-11-18 11:00:15 +05:30
summary: {
type: String,
2020-07-28 23:09:34 +05:30
required: false,
default: '',
2018-11-18 11:00:15 +05:30
},
statusIcon: {
type: String,
required: true,
},
popoverOptions: {
type: Object,
required: false,
default: null,
},
},
computed: {
iconStatus() {
return {
group: this.statusIcon,
icon: `status_${this.statusIcon}`,
};
},
2021-04-17 20:07:23 +05:30
rowClasses() {
if (!this.nestedSummary) {
return ['gl-px-5'];
}
2021-04-29 21:17:54 +05:30
return ['gl-pl-9', 'gl-pr-5', { 'gl-bg-gray-10': this.statusIcon === ICON_WARNING }];
2021-04-17 20:07:23 +05:30
},
statusIconSize() {
if (!this.nestedSummary) {
return 24;
}
return 16;
},
2018-11-18 11:00:15 +05:30
},
};
</script>
<template>
2021-04-17 20:07:23 +05:30
<div
class="gl-border-t-solid gl-border-t-gray-100 gl-border-t-1 gl-py-3 gl-display-flex gl-align-items-center"
:class="rowClasses"
>
<div class="gl-mr-3">
2019-09-30 21:07:59 +05:30
<gl-loading-icon
v-if="statusIcon === 'loading'"
css-class="report-block-list-loading-icon"
size="md"
/>
2021-04-17 20:07:23 +05:30
<ci-icon v-else :status="iconStatus" :size="statusIconSize" data-testid="summary-row-icon" />
2018-11-18 11:00:15 +05:30
</div>
<div class="report-block-list-issue-description">
2021-04-17 20:07:23 +05:30
<div class="report-block-list-issue-description-text" data-testid="summary-row-description">
2020-07-28 23:09:34 +05:30
<slot name="summary">{{ summary }}</slot
><span v-if="popoverOptions" class="text-nowrap"
2020-04-22 19:07:51 +05:30
>&nbsp;<popover v-if="popoverOptions" :options="popoverOptions" class="align-top" />
</span>
</div>
</div>
<div
v-if="$slots.default"
class="text-right flex-fill d-flex justify-content-end flex-column flex-sm-row"
>
<slot></slot>
2018-11-18 11:00:15 +05:30
</div>
</div>
</template>