Commit 1d76f9dc authored by samdbeckham's avatar samdbeckham

Allows severity values to be translated

Pulls the severity values into a constants file, translates them, and
distributes them into wherever they were used.
parent d9bc0870
......@@ -2,9 +2,11 @@
import dateFormat from 'dateformat';
import { mapState, mapGetters, mapActions } from 'vuex';
import { GlChart } from '@gitlab/ui/dist/charts';
import { __ } from '~/locale';
import ChartTooltip from './vulnerability_chart_tooltip.vue';
import ChartButtons from './vulnerability_chart_buttons.vue';
import { DAY_IN_MS, DAYS } from '../store/modules/vulnerabilities/constants';
import { SEVERITY_LEVELS } from '../store/constants';
export default {
name: 'VulnerabilityChart',
......@@ -19,23 +21,23 @@ export default {
tooltipEntries: [],
lines: [
{
name: 'Critical',
name: SEVERITY_LEVELS.critical,
color: '#C0341D',
},
{
name: 'High',
name: SEVERITY_LEVELS.high,
color: '#DE7E00',
},
{
name: 'Medium',
name: SEVERITY_LEVELS.medium,
color: '#6E49CB',
},
{
name: 'Low',
name: SEVERITY_LEVELS.low,
color: '#4F4F4F',
},
{
name: 'Total',
name: __('Total'),
color: '#1F78D1',
},
],
......
<script>
import { SEVERITY_LEVELS } from '../store/constants';
export default {
name: 'VulnerabilityCount',
props: {
......@@ -20,13 +22,16 @@ export default {
className() {
return `vulnerability-count-${this.severity}`;
},
severityTitle() {
return SEVERITY_LEVELS[this.severity] || '';
},
},
};
</script>
<template>
<div class="vulnerability-count" :class="className">
<div class="vulnerability-count-header">{{ severity }}</div>
<div class="vulnerability-count-header">{{ severityTitle }}</div>
<div class="vulnerability-count-body">
<span v-if="isLoading">&mdash;</span> <span v-else>{{ count }}</span>
</div>
......
import { s__ } from '~/locale';
export const SEVERITY_LEVELS = {
critical: s__('severity|Critical'),
high: s__('severity|High'),
medium: s__('severity|Medium'),
low: s__('severity|Low'),
unknown: s__('severity|Unknown'),
info: s__('severity|Info'),
undefined: s__('severity|Undefined'),
};
export const CONFIDENCE_LEVELS = {
confirmed: s__('confidence|Confirmed'),
high: s__('confidence|High'),
medium: s__('confidence|Medium'),
low: s__('confidence|Low'),
unknown: s__('confidence|Unknown'),
ignore: s__('confidence|Ignore'),
experimental: s__('confidence|Experimental'),
undefined: s__('confidence|Undefined'),
};
export const REPORT_TYPES = {
container_scanning: s__('ciReport|Container Scanning'),
dast: s__('ciReport|DAST'),
dependency_scanning: s__('ciReport|Dependency Scanning'),
sast: s__('ciReport|SAST'),
};
......@@ -16,6 +16,7 @@ export default {
</script>
<template>
<!-- TODO: How on earth do I get this translated in a DRY manner? -->
<div class="severity-badge" :class="className">{{ severity }}</div>
</template>
......
......@@ -11180,6 +11180,9 @@ msgstr ""
msgid "Too many changes to show."
msgstr ""
msgid "Total"
msgstr ""
msgid "Total Contributions"
msgstr ""
......@@ -12602,6 +12605,30 @@ msgstr ""
msgid "commented on %{link_to_project}"
msgstr ""
msgid "confidence|Confirmed"
msgstr ""
msgid "confidence|Experimental"
msgstr ""
msgid "confidence|High"
msgstr ""
msgid "confidence|Ignore"
msgstr ""
msgid "confidence|Low"
msgstr ""
msgid "confidence|Medium"
msgstr ""
msgid "confidence|Undefined"
msgstr ""
msgid "confidence|Unknown"
msgstr ""
msgid "confidentiality|You are going to turn off the confidentiality. This means <strong>everyone</strong> will be able to see and leave a comment on this issue."
msgstr ""
......@@ -13110,6 +13137,27 @@ msgstr ""
msgid "security Reports|There was an error creating the merge request"
msgstr ""
msgid "severity|Critical"
msgstr ""
msgid "severity|High"
msgstr ""
msgid "severity|Info"
msgstr ""
msgid "severity|Low"
msgstr ""
msgid "severity|Medium"
msgstr ""
msgid "severity|Undefined"
msgstr ""
msgid "severity|Unknown"
msgstr ""
msgid "should be higher than %{access} inherited membership from group %{group_name}"
msgstr ""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment