locales:update alert breadcrumbs

This commit is contained in:
shiyang 2021-09-05 14:28:03 +08:00
parent b1e1a47cc3
commit 0ee5b1918b
4 changed files with 26 additions and 13 deletions

View File

@ -1,8 +1,14 @@
export default {
'alert.button.acknowledge': 'Acknowledge',
'alert.button.create-monitor': 'Create monitor',
'alert.button.update-monitor': 'Update monitor',
'alert.button.create-trigger': 'Create trigger',
'alert.button.update-trigger': 'Update trigger',
'alert.button.add-destination': 'Add destination',
'alert.button.create-destination': 'Create destination',
'alert.button.update-destination': 'Update destination',
'alert.alerting': 'Alerting',
'alert.dashboard': 'Dashboard',
'alert.dashboard.alerts': 'Alerts',

View File

@ -1,8 +1,14 @@
export default {
'alert.button.acknowledge': '确认',
'alert.button.create-monitor': '创建监控项',
'alert.button.update-monitor': '更新监控项',
'alert.button.create-trigger': '创建触发器',
'alert.button.update-trigger': '更新触发器',
'alert.button.add-destination': '添加渠道',
'alert.button.create-destination': '创建渠道',
'alert.button.update-destination': '更新渠道',
'alert.alerting': '告警管理',
'alert.dashboard': '告警概览',
'alert.dashboard.alerts': '告警管理',

View File

@ -24,6 +24,7 @@ import {
MONITOR_ACTIONS,
TRIGGER_ACTIONS,
} from '../../utils/constants';
import { formatMessage } from 'umi/locale';
const propTypes = {
history: PropTypes.object.isRequired,
@ -122,7 +123,7 @@ export async function getBreadcrumb(route, routeState, httpClient) {
const destinationName = _.get(routeState, 'destinationToEdit.name', base);
const destinationBreadcrumbs = [{ text: destinationName, href: `/destinations/${base}` }];
if (action === DESTINATION_ACTIONS.UPDATE_DESTINATION) {
destinationBreadcrumbs.push({ text: 'Update destination', href: '/' });
destinationBreadcrumbs.push({ text: formatMessage({ id: 'alert.button.update-destination' }), href: '/' });
}
return destinationBreadcrumbs;
default:
@ -138,27 +139,27 @@ export async function getBreadcrumb(route, routeState, httpClient) {
}
const breadcrumbs = [{ text: monitorName, href: `/monitors/${base}` }];
if (action === MONITOR_ACTIONS.UPDATE_MONITOR)
breadcrumbs.push({ text: 'Update monitor', href: '/' });
breadcrumbs.push({ text: formatMessage({ id: 'alert.button.update-monitor' }), href: '/' });
if (action === TRIGGER_ACTIONS.CREATE_TRIGGER)
breadcrumbs.push({ text: 'Create trigger', href: '/' });
breadcrumbs.push({ text: formatMessage({ id: 'alert.button.create-trigger' }), href: '/' });
if (action === TRIGGER_ACTIONS.UPDATE_TRIGGER)
breadcrumbs.push({ text: 'Update trigger', href: '/' });
breadcrumbs.push({ text: formatMessage({ id: 'alert.button.update-trigger' }), href: '/' });
return breadcrumbs;
}
}
return {
'#': { text: 'Alerting', href: '/' },
monitors: { text: 'Monitors', href: '/monitors' },
dashboard: { text: 'Dashboard', href: '/dashboard' },
destinations: { text: 'Destinations', href: '/destinations' },
'#': { text: formatMessage({ id: 'alert.alerting' }), href: '/' },
monitors: { text: formatMessage({ id: 'alert.monitor' }), href: '/monitors' },
dashboard: { text: formatMessage({ id: 'alert.dashboard' }), href: '/dashboard' },
destinations: { text: formatMessage({ id: 'alert.destination' }), href: '/destinations' },
'create-monitor': [
{ text: 'Monitors', href: '/monitors' },
{ text: 'Create monitor', href: APP_PATH.CREATE_MONITOR },
{ text: formatMessage({ id: 'alert.monitor' }), href: '/monitors' },
{ text: formatMessage({ id: 'alert.button.create-monitor' }), href: APP_PATH.CREATE_MONITOR },
],
'create-destination': [
{ text: 'Destinations', href: '/destinations' },
{ text: 'Create destination', href: APP_PATH.CREATE_DESTINATION },
{ text: formatMessage({ id: 'alert.destination' }), href: '/destinations' },
{ text: formatMessage({ id: 'alert.button.create-destination' }), href: APP_PATH.CREATE_DESTINATION },
],
}[base];
}

View File

@ -22,7 +22,7 @@ import { formatMessage } from 'umi/locale';
const filterText = formatMessage({ id: 'alert.monitor.filter-text' });
const emptyMonitorText = formatMessage({ id: 'alert.monitor.empty-monitor-text' });
const loadingText = formatMessage({ id: 'loading-monitors' });
const loadingText = formatMessage({ id: 'alert.monitor.loading-monitors' });
const createMonitorButton = (
<EuiButton fill href={`#/${PLUGIN_NAME}${APP_PATH.CREATE_MONITOR}`}>
{formatMessage({ id: 'alert.button.create-monitor' })}