debian-mirror-gitlab/app/assets/javascripts/diffs/components/diff_code_quality.vue

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

68 lines
1.8 KiB
Vue
Raw Normal View History

2022-08-13 15:12:31 +05:30
<script>
import { GlButton, GlIcon } from '@gitlab/ui';
2023-03-04 22:38:38 +05:30
import { SEVERITY_CLASSES, SEVERITY_ICONS } from '~/ci/reports/codequality_report/constants';
import { NEW_CODE_QUALITY_FINDINGS } from '../i18n';
2022-08-13 15:12:31 +05:30
export default {
2023-03-04 22:38:38 +05:30
i18n: {
newFindings: NEW_CODE_QUALITY_FINDINGS,
},
2022-08-13 15:12:31 +05:30
components: { GlButton, GlIcon },
props: {
codeQuality: {
type: Array,
required: true,
},
},
methods: {
severityClass(severity) {
return SEVERITY_CLASSES[severity] || SEVERITY_CLASSES.unknown;
},
severityIcon(severity) {
return SEVERITY_ICONS[severity] || SEVERITY_ICONS.unknown;
},
},
};
</script>
<template>
2023-03-04 22:38:38 +05:30
<div
data-testid="diff-codequality"
class="gl-relative codequality-findings-list gl-border-top-1 gl-border-bottom-1 gl-bg-gray-10 gl-pl-5 gl-pt-4 gl-pb-4"
>
<h4
data-testid="diff-codequality-findings-heading"
class="gl-mt-0 gl-mb-0 gl-font-base gl-font-regular"
2022-08-13 15:12:31 +05:30
>
2023-03-04 22:38:38 +05:30
{{ $options.i18n.newFindings }}
</h4>
<ul class="gl-list-style-none gl-mb-0 gl-p-0">
2022-08-13 15:12:31 +05:30
<li
v-for="finding in codeQuality"
:key="finding.description"
2023-03-04 22:38:38 +05:30
class="gl-pt-1 gl-pb-1 gl-font-regular gl-display-flex"
2022-08-13 15:12:31 +05:30
>
2023-03-04 22:38:38 +05:30
<span class="gl-mr-3">
<gl-icon
:size="12"
:name="severityIcon(finding.severity)"
:class="severityClass(finding.severity)"
class="codequality-severity-icon"
/>
</span>
<span>
<span class="severity-copy">{{ finding.severity }}</span> - {{ finding.description }}
</span>
2022-08-13 15:12:31 +05:30
</li>
</ul>
<gl-button
data-testid="diff-codequality-close"
category="tertiary"
size="small"
icon="close"
class="gl-absolute gl-right-2 gl-top-2"
2022-10-11 01:57:18 +05:30
@click="$emit('hideCodeQualityFindings')"
2022-08-13 15:12:31 +05:30
/>
</div>
</template>