Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(i18n): metrics module #326

Merged
merged 2 commits into from
Jul 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/locales/zh-CN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { PluginFormZhCN } from '@/components/PluginForm';

import { ConsumerZhCN } from '@/pages/Consumer';
import { RouteZhCN } from '@/pages/Route';

import component from './zh-CN/component';
import globalHeader from './zh-CN/globalHeader';
import menu from './zh-CN/menu';
Expand Down
9 changes: 5 additions & 4 deletions src/pages/Metrics/Metrics.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import React, { useState, useEffect } from 'react';
import { PageHeaderWrapper } from '@ant-design/pro-layout';
import { Empty, Button, Card } from 'antd';
import { history } from 'umi';
import { history, useIntl } from 'umi';

import { getGrafanaURL } from './service';

const Metrics: React.FC = () => {
const [grafanaURL, setGrafanaURL] = useState<string | undefined>();
const { formatMessage } = useIntl();

useEffect(() => {
getGrafanaURL().then((url) => {
Expand All @@ -15,15 +16,15 @@ const Metrics: React.FC = () => {
}, []);

return (
<PageHeaderWrapper title="监控">
<PageHeaderWrapper title={formatMessage({ id: 'metrics.monitor' })}>
<Card>
{!grafanaURL && (
<Empty
image="https://gw.alipayobjects.com/zos/antfincdn/ZHrcdLPrvN/empty.svg"
imageStyle={{
height: 60,
}}
description={<span>您还未配置 Grafana</span>}
description={<span>{formatMessage({ id: 'metrics.grafana.not.config' })}</span>}
>
<Button
type="primary"
Expand All @@ -33,7 +34,7 @@ const Metrics: React.FC = () => {
});
}}
>
现在配置
{formatMessage({ id: 'metrics.grafana.config' })}
</Button>
</Empty>
)}
Expand Down
1 change: 1 addition & 0 deletions src/pages/Metrics/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export { default } from './Metrics';

5 changes: 5 additions & 0 deletions src/pages/Metrics/locales/en-US.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export default {
'metrics.monitor': 'Monitor',
'metrics.grafana.not.config': 'You have not configured Grafana',
'metrics.grafana.config': 'Configure Now',
};
5 changes: 5 additions & 0 deletions src/pages/Metrics/locales/zh-CN.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export default {
'metrics.monitor': '监控',
'metrics.grafana.not.config': '您还未配置 Grafana',
'metrics.grafana.config': '现在配置',
};