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

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

94 lines
2.3 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';
2022-06-21 17:19:12 +05:30
import HelpPopover 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,
2022-06-21 17:19:12 +05:30
HelpPopover,
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"
2022-07-23 23:45:48 +05:30
size="lg"
2019-09-30 21:07:59 +05:30
/>
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"
2022-06-21 17:19:12 +05:30
>&nbsp;<help-popover v-if="popoverOptions" :options="popoverOptions" class="align-top" />
2020-04-22 19:07:51 +05:30
</span>
</div>
</div>
<div
2022-08-13 15:12:31 +05:30
v-if="$slots.default /* eslint-disable-line @gitlab/vue-prefer-dollar-scopedslots */"
2020-04-22 19:07:51 +05:30
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>