Commit 397fb4d3 authored by lauraMon's avatar lauraMon

Refacotred vars to allow internationalization

parent b1527121
...@@ -20,14 +20,13 @@ import TimeAgo from '~/vue_shared/components/time_ago_tooltip.vue'; ...@@ -20,14 +20,13 @@ import TimeAgo from '~/vue_shared/components/time_ago_tooltip.vue';
import getAlerts from '../graphql/queries/get_alerts.query.graphql'; import getAlerts from '../graphql/queries/get_alerts.query.graphql';
import getAlertsCountByStatus from '../graphql/queries/get_count_by_status.query.graphql'; import getAlertsCountByStatus from '../graphql/queries/get_count_by_status.query.graphql';
import { import {
ALERTS_STATUS,
ALERTS_STATUS_TABS, ALERTS_STATUS_TABS,
ALERTS_SEVERITY_LABELS, ALERTS_SEVERITY_LABELS,
trackAlertListViewsOptions, trackAlertListViewsOptions,
trackAlertStatusUpdateOptions, trackAlertStatusUpdateOptions,
} from '../constants'; } from '../constants';
import updateAlertStatus from '../graphql/mutations/update_alert_status.graphql'; import updateAlertStatus from '../graphql/mutations/update_alert_status.graphql';
import { capitalizeFirstCharacter, convertToSnakeCase } from '~/lib/utils/text_utility'; import { convertToSnakeCase } from '~/lib/utils/text_utility';
import Tracking from '~/tracking'; import Tracking from '~/tracking';
const tdClass = 'table-col d-flex d-md-table-cell align-items-center'; const tdClass = 'table-col d-flex d-md-table-cell align-items-center';
...@@ -87,9 +86,9 @@ export default { ...@@ -87,9 +86,9 @@ export default {
}, },
], ],
statuses: { statuses: {
[ALERTS_STATUS.TRIGGERED]: s__('AlertManagement|Triggered'), TRIGGERED: s__('AlertManagement|Triggered'),
[ALERTS_STATUS.ACKNOWLEDGED]: s__('AlertManagement|Acknowledged'), ACKNOWLEDGED: s__('AlertManagement|Acknowledged'),
[ALERTS_STATUS.RESOLVED]: s__('AlertManagement|Resolved'), RESOLVED: s__('AlertManagement|Resolved'),
}, },
severityLabels: ALERTS_SEVERITY_LABELS, severityLabels: ALERTS_SEVERITY_LABELS,
statusTabs: ALERTS_STATUS_TABS, statusTabs: ALERTS_STATUS_TABS,
...@@ -204,7 +203,6 @@ export default { ...@@ -204,7 +203,6 @@ export default {
} }
this.sort = `${sortColumn}_${sortDirection}`; this.sort = `${sortColumn}_${sortDirection}`;
}, },
capitalizeFirstCharacter,
updateAlertStatus(status, iid) { updateAlertStatus(status, iid) {
this.$apollo this.$apollo
.mutate({ .mutate({
...@@ -311,11 +309,7 @@ export default { ...@@ -311,11 +309,7 @@ export default {
</template> </template>
<template #cell(status)="{ item }"> <template #cell(status)="{ item }">
<gl-dropdown <gl-dropdown :text="$options.statuses[item.status]" class="w-100" right>
:text="capitalizeFirstCharacter(item.status.toLowerCase())"
class="w-100"
right
>
<gl-dropdown-item <gl-dropdown-item
v-for="(label, field) in $options.statuses" v-for="(label, field) in $options.statuses"
:key="field" :key="field"
......
...@@ -9,39 +9,31 @@ export const ALERTS_SEVERITY_LABELS = { ...@@ -9,39 +9,31 @@ export const ALERTS_SEVERITY_LABELS = {
UNKNOWN: s__('AlertManagement|Unknown'), UNKNOWN: s__('AlertManagement|Unknown'),
}; };
export const ALERTS_STATUS = {
OPEN: 'OPEN',
TRIGGERED: 'TRIGGERED',
ACKNOWLEDGED: 'ACKNOWLEDGED',
RESOLVED: 'RESOLVED',
ALL: 'ALL',
};
export const ALERTS_STATUS_TABS = [ export const ALERTS_STATUS_TABS = [
{ {
title: s__('AlertManagement|Open'), title: s__('AlertManagement|Open'),
status: ALERTS_STATUS.OPEN, status: 'OPEN',
filters: [ALERTS_STATUS.TRIGGERED, ALERTS_STATUS.ACKNOWLEDGED], filters: ['TRIGGERED', 'ACKNOWLEDGED'],
}, },
{ {
title: s__('AlertManagement|Triggered'), title: s__('AlertManagement|Triggered'),
status: ALERTS_STATUS.TRIGGERED, status: 'TRIGGERED',
filters: [ALERTS_STATUS.TRIGGERED], filters: 'TRIGGERED',
}, },
{ {
title: s__('AlertManagement|Acknowledged'), title: s__('AlertManagement|Acknowledged'),
status: ALERTS_STATUS.ACKNOWLEDGED, status: 'ACKNOWLEDGED',
filters: [ALERTS_STATUS.ACKNOWLEDGED], filters: 'ACKNOWLEDGED',
}, },
{ {
title: s__('AlertManagement|Resolved'), title: s__('AlertManagement|Resolved'),
status: ALERTS_STATUS.RESOLVED, status: 'RESOLVED',
filters: [ALERTS_STATUS.RESOLVED], filters: 'RESOLVED',
}, },
{ {
title: s__('AlertManagement|All alerts'), title: s__('AlertManagement|All alerts'),
status: ALERTS_STATUS.ALL, status: 'ALL',
filters: [ALERTS_STATUS.TRIGGERED, ALERTS_STATUS.ACKNOWLEDGED, ALERTS_STATUS.RESOLVED], filters: ['TRIGGERED', 'ACKNOWLEDGED', 'RESOLVED'],
}, },
]; ];
......
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