{mainComponent}
@@ -913,17 +956,17 @@ export default purify(function CustomRoutePage(props: DuckCmpProps
)
-
+
diff --git a/web/src/polaris/administration/dynamicRoute/customRoute/operations/CreateDuck.ts b/web/src/polaris/administration/dynamicRoute/customRoute/operations/CreateDuck.ts
index d80c916a..27847c48 100644
--- a/web/src/polaris/administration/dynamicRoute/customRoute/operations/CreateDuck.ts
+++ b/web/src/polaris/administration/dynamicRoute/customRoute/operations/CreateDuck.ts
@@ -1,3 +1,4 @@
+import { t } from 'i18next'
import { createToPayload, reduceFromPayload } from 'saga-duck'
import DetailPage from '@src/polaris/common/ducks/DetailPage'
import Form from '@src/polaris/common/ducks/Form'
@@ -166,7 +167,9 @@ export default class CustomRouteCreatePageDuck extends DetailPage {
})),
}))
return {
- name: `规则${index}`,
+ name: t('规则{{attr0}}', {
+ attr0: index,
+ }),
sources: handledSources,
destinations: handledDestinations,
}
@@ -363,30 +366,30 @@ export interface Values {
const validator = Form.combineValidators({
name(v) {
if (!v) {
- return '请填写路由规则名称'
+ return t('请填写路由规则名称')
}
},
source: {
namespace(v) {
if (!v) {
- return '请选择命名空间'
+ return t('请选择命名空间')
}
},
service(v) {
if (!v) {
- return '请选择服务名'
+ return t('请选择服务名')
}
},
},
destination: {
namespace(v) {
if (!v) {
- return '请选择命名空间'
+ return t('请选择命名空间')
}
},
service(v) {
if (!v) {
- return '请选择服务名'
+ return t('请选择服务名')
}
},
},
@@ -398,15 +401,15 @@ const validator = Form.combineValidators({
{
key(v) {
if (!v) {
- return '请输入key值'
+ return t('请输入key值')
}
},
value(v, data) {
if (!v && data.type === RoutingArgumentsType.CALLER_IP) {
- return '请输入IP'
+ return t('请输入IP')
}
if (!v && data.type !== RoutingArgumentsType.CALLER_IP) {
- return '请输入value值'
+ return t('请输入value值')
}
},
},
@@ -417,7 +420,7 @@ const validator = Form.combineValidators({
{
labels(v) {
if (!v.length) {
- return '请输入标签分组'
+ return t('请输入标签分组')
}
},
},
@@ -449,7 +452,7 @@ export class RouteCreateDuck extends Form {
},
rules: [
{
- name: '规则1',
+ name: t('规则1'),
sources: [
{
service: '*',
diff --git a/web/src/polaris/administration/dynamicRoute/customRoute/types.ts b/web/src/polaris/administration/dynamicRoute/customRoute/types.ts
index 83ce495f..5b067aef 100644
--- a/web/src/polaris/administration/dynamicRoute/customRoute/types.ts
+++ b/web/src/polaris/administration/dynamicRoute/customRoute/types.ts
@@ -1,3 +1,4 @@
+import { t } from 'i18next'
// 接口类型
// 接口类型
export enum RouteLabelMatchType {
@@ -11,27 +12,27 @@ export enum RouteLabelMatchType {
export const RouteLabelMatchTypeOptions = [
{
value: RouteLabelMatchType.EXACT,
- text: '等于',
+ text: t('等于'),
},
{
value: RouteLabelMatchType.REGEX,
- text: '正则表达式匹配',
+ text: t('正则表达式匹配'),
},
{
value: RouteLabelMatchType.NOT_EQUALS,
- text: '不等于',
+ text: t('不等于'),
},
{
value: RouteLabelMatchType.IN,
- text: '包含',
+ text: t('包含'),
},
{
value: RouteLabelMatchType.NOT_IN,
- text: '不包含',
+ text: t('不包含'),
},
{
value: RouteLabelMatchType.RANGE,
- text: '范围表达式',
+ text: t('范围表达式'),
},
]
export const RouteLabelTextMap = RouteLabelMatchTypeOptions.reduce((map, curr) => {
@@ -55,12 +56,12 @@ export enum RoutingValueType {
PARAMETER = 'PARAMETER',
}
export const RoutingValueTextMap = {
- [RoutingValueType.TEXT]: '值',
- [RoutingValueType.PARAMETER]: '变量',
+ [RoutingValueType.TEXT]: t('值'),
+ [RoutingValueType.PARAMETER]: t('变量'),
}
export const RoutingValueTypeOptions = [
{
- text: '值',
+ text: t('值'),
value: RoutingValueType.TEXT,
},
// {
@@ -71,31 +72,31 @@ export const RoutingValueTypeOptions = [
export const RoutingArgumentsTypeOptions = [
{
value: RoutingArgumentsType.CUSTOM,
- text: '自定义',
+ text: t('自定义'),
},
{
value: RoutingArgumentsType.HEADER,
- text: '请求头(HEADER)',
+ text: t('请求头(HEADER)'),
},
{
value: RoutingArgumentsType.COOKIE,
- text: '请求Cookie(COOKIE)',
+ text: t('请求Cookie(COOKIE)'),
},
{
value: RoutingArgumentsType.QUERY,
- text: '请求参数(QUERY)',
+ text: t('请求参数(QUERY)'),
},
{
value: RoutingArgumentsType.METHOD,
- text: '方法(METHOD)',
+ text: t('方法(METHOD)'),
},
{
value: RoutingArgumentsType.CALLER_IP,
- text: '主调IP',
+ text: t('主调IP'),
},
{
value: RoutingArgumentsType.PATH,
- text: '路径',
+ text: t('路径'),
},
]
export const RouteArgumentTextMap = RoutingArgumentsTypeOptions.reduce((map, curr) => {
diff --git a/web/src/polaris/administration/dynamicRoute/graypublish/Page.tsx b/web/src/polaris/administration/dynamicRoute/graypublish/Page.tsx
index 810c35ff..4ff7300e 100644
--- a/web/src/polaris/administration/dynamicRoute/graypublish/Page.tsx
+++ b/web/src/polaris/administration/dynamicRoute/graypublish/Page.tsx
@@ -1,3 +1,5 @@
+import { t } from 'i18next'
+import { Trans } from 'react-i18next'
import React from 'react'
import { Layout, Card, Tabs, TabPanel, Text } from 'tea-component'
import insertCSS from '@src/polaris/common/helpers/insertCSS'
@@ -42,7 +44,7 @@ function TabContentComp(props: RouteTabContentInfo) {
target='_blank'
rel='noreferrer'
>
- 操作指引
+ 操作指引
))}
>
@@ -62,7 +64,7 @@ function TabContentComp(props: RouteTabContentInfo) {
target='_blank'
rel='noreferrer'
>
- 操作指引
+ 操作指引
))}
@@ -80,7 +82,7 @@ export default function TestEnvRoutePage() {
-
+
{tabs.map(tab => {
diff --git a/web/src/polaris/administration/dynamicRoute/graypublish/TabConfig.tsx b/web/src/polaris/administration/dynamicRoute/graypublish/TabConfig.tsx
index 40df4f3c..fd64dddd 100644
--- a/web/src/polaris/administration/dynamicRoute/graypublish/TabConfig.tsx
+++ b/web/src/polaris/administration/dynamicRoute/graypublish/TabConfig.tsx
@@ -1,3 +1,5 @@
+import { t } from 'i18next'
+import { Trans } from 'react-i18next'
import React from 'react'
import { List, Text } from 'tea-component'
@@ -24,15 +26,15 @@ export interface ImageLinks {
linkAddress: string
}
export const tabs = [
- { id: RouteTabId.BlueGreen, label: '蓝绿发布' },
- { id: RouteTabId.Canary, label: '金丝雀发布' },
- { id: RouteTabId.FullLinkGray, label: '全链路灰度发布' },
+ { id: RouteTabId.BlueGreen, label: t('蓝绿发布') },
+ { id: RouteTabId.Canary, label: t('金丝雀发布') },
+ { id: RouteTabId.FullLinkGray, label: t('全链路灰度发布') },
]
export const tabConfigs: RouteTabConfigInfo = {
[RouteTabId.BlueGreen]: {
imagePath: 'static/img/bluegreen-publish.png',
- alt: '蓝绿发布路由',
+ alt: t('蓝绿发布路由'),
title: '',
imageLinks: [
{
@@ -64,10 +66,11 @@ export const tabConfigs: RouteTabConfigInfo = {
},
[RouteTabId.Canary]: {
imagePath: 'static/img/canary-publish.png',
- alt: '金丝雀发布路由',
- title: '金丝雀发布',
- description:
+ alt: t('金丝雀发布路由'),
+ title: t('金丝雀发布'),
+ description: t(
'针对是单个服务的服务灰度验证,金丝雀发布允许引流一小部分流量到服务的新版本(比如按灰度用户引流),充分验证微服务新版本的稳定性,验证没问题后,再升级原来的稳定版本。',
+ ),
imageLinks: [
{
style: { top: '28.7%', left: '29.8%' },
@@ -95,7 +98,7 @@ export const tabConfigs: RouteTabConfigInfo = {
imagePath: [
{
path: 'static/img/full-link-gray-publish-scene1.png',
- title: '场景一',
+ title: t('场景一'),
imageLinks: [
{
style: { top: '27.2%', left: '29.8%' },
@@ -126,7 +129,7 @@ export const tabConfigs: RouteTabConfigInfo = {
},
{
path: 'static/img/full-link-gray-publish-scene2.png',
- title: '场景二',
+ title: t('场景二'),
imageLinks: [
{
style: { top: '30.9%', left: '29.8%' },
@@ -156,22 +159,28 @@ export const tabConfigs: RouteTabConfigInfo = {
],
},
],
- alt: '全链路灰度发布',
- title: '全链路灰度发布',
+ alt: t('全链路灰度发布'),
+ title: t('全链路灰度发布'),
description: (
<>
- 微服务架构下,有些开发需求,微服务调用链路上的多个微服务同时发生了改动,
- 通常每个微服务都会有灰度环境或分组来接收灰度流量。此时希望通过进入上游灰度环境的流量,
- 也能进入下游灰度的环境中,确保1个请求始终在灰度环境中传递,即使这个调用链路上有一些微服务没有灰度环境,
- 这些应用请求在下游的时候依然能够回到灰度环境中。
+
+ 微服务架构下,有些开发需求,微服务调用链路上的多个微服务同时发生了改动,
+ 通常每个微服务都会有灰度环境或分组来接收灰度流量。此时希望通过进入上游灰度环境的流量,
+ 也能进入下游灰度的环境中,确保1个请求始终在灰度环境中传递,即使这个调用链路上有一些微服务没有灰度环境,
+ 这些应用请求在下游的时候依然能够回到灰度环境中。
+
- 实现方案的两个场景:
+ 实现方案的两个场景:
- 应用场景一:金丝雀环境和稳定环境有独立的域名进行隔离,实现全链路灰度。
- 应用场景二:使用相同域名,基于请求标签实现全链路灰度。
+
+ 应用场景一:金丝雀环境和稳定环境有独立的域名进行隔离,实现全链路灰度。
+
+
+ 应用场景二:使用相同域名,基于请求标签实现全链路灰度。
+
>
),
diff --git a/web/src/polaris/administration/dynamicRoute/testEnvRoute/Page.tsx b/web/src/polaris/administration/dynamicRoute/testEnvRoute/Page.tsx
index 6a835865..1bfb8622 100644
--- a/web/src/polaris/administration/dynamicRoute/testEnvRoute/Page.tsx
+++ b/web/src/polaris/administration/dynamicRoute/testEnvRoute/Page.tsx
@@ -1,3 +1,5 @@
+import { t } from 'i18next'
+import { Trans } from 'react-i18next'
import React from 'react'
import { Layout, Card, Tabs, TabPanel } from 'tea-component'
import insertCSS from '@src/polaris/common/helpers/insertCSS'
@@ -64,7 +66,7 @@ export default function TestEnvRoutePage() {
-
+
{tabs.map(tab => {
diff --git a/web/src/polaris/administration/dynamicRoute/testEnvRoute/TabConfig.ts b/web/src/polaris/administration/dynamicRoute/testEnvRoute/TabConfig.ts
index e83e1aa4..8036b2a1 100644
--- a/web/src/polaris/administration/dynamicRoute/testEnvRoute/TabConfig.ts
+++ b/web/src/polaris/administration/dynamicRoute/testEnvRoute/TabConfig.ts
@@ -1,3 +1,4 @@
+import { t } from 'i18next'
enum TabId {
client = 'client',
dynamic = 'dynamic',
@@ -20,15 +21,15 @@ interface TabConfigInfo {
}
export const tabs = [
- { id: TabId.client, label: '客户端染色' },
- { id: TabId.dynamic, label: '网关动态染色' },
- { id: TabId.static, label: '网关静态染色' },
+ { id: TabId.client, label: t('客户端染色') },
+ { id: TabId.dynamic, label: t('网关动态染色') },
+ { id: TabId.static, label: t('网关静态染色') },
]
export const tabConfigs: TabConfigInfo = {
[TabId.client]: {
imagePath: 'static/img/testEnvRoute-client.png',
- alt: '客户端染色流程指引',
+ alt: t('客户端染色流程指引'),
imageLinks: [
{
style: { top: '18.9%', left: '29.8%' },
@@ -44,7 +45,7 @@ export const tabConfigs: TabConfigInfo = {
},
[TabId.dynamic]: {
imagePath: 'static/img/testEnvRoute-dynamic.png',
- alt: '网关动态染色流程指引',
+ alt: t('网关动态染色流程指引'),
imageLinks: [
{
style: { top: '18.9%', left: '29.8%' },
@@ -65,7 +66,7 @@ export const tabConfigs: TabConfigInfo = {
},
[TabId.static]: {
imagePath: 'static/img/testEnvRoute-static.png',
- alt: '网关静态染色流程指引',
+ alt: t('网关静态染色流程指引'),
imageLinks: [
{
style: { top: '18.9%', left: '29.8%' },
diff --git a/web/src/polaris/alert/Page.tsx b/web/src/polaris/alert/Page.tsx
index 3c922d61..95abeeae 100644
--- a/web/src/polaris/alert/Page.tsx
+++ b/web/src/polaris/alert/Page.tsx
@@ -1,3 +1,5 @@
+import { t } from 'i18next'
+import { Trans } from 'react-i18next'
import React from 'react'
import { DuckCmpProps } from 'saga-duck'
import NamespaceDuck from './PageDuck'
@@ -20,8 +22,8 @@ insertCSS(
export default function ServicePage(props: DuckCmpProps) {
const { duck, store, dispatch } = props
return (
- >}>
-
+ >}>
+
diff --git a/web/src/polaris/alert/PageDuck.ts b/web/src/polaris/alert/PageDuck.ts
index 51aa3369..5f2d4b71 100644
--- a/web/src/polaris/alert/PageDuck.ts
+++ b/web/src/polaris/alert/PageDuck.ts
@@ -1,3 +1,4 @@
+import { t } from 'i18next'
import { createToPayload, reduceFromPayload } from 'saga-duck'
import GridPageDuck, { Filter as BaseFilter } from '../common/ducks/GridPage'
import { AlertInfo } from './types'
diff --git a/web/src/polaris/alert/detail/Page.tsx b/web/src/polaris/alert/detail/Page.tsx
index 90bc9371..4768d5d6 100644
--- a/web/src/polaris/alert/detail/Page.tsx
+++ b/web/src/polaris/alert/detail/Page.tsx
@@ -1,3 +1,5 @@
+import { t } from 'i18next'
+import { Trans } from 'react-i18next'
import React from 'react'
import { DuckCmpProps, purify } from 'saga-duck'
import DetailPage from '@src/polaris/common/duckComponents/DetailPage'
@@ -27,23 +29,23 @@ export default purify(function CustomRoutePage(props: DuckCmpProps) {
diff --git a/web/src/polaris/alert/detail/PageDuck.ts b/web/src/polaris/alert/detail/PageDuck.ts
index 10c6a992..636ad800 100644
--- a/web/src/polaris/alert/detail/PageDuck.ts
+++ b/web/src/polaris/alert/detail/PageDuck.ts
@@ -1,3 +1,4 @@
+import { t } from 'i18next'
import DetailPage from '@src/polaris/common/ducks/DetailPage'
import { ClsInfo, describeAlertRules } from '../model'
import { AlertInfo } from '../types'
diff --git a/web/src/polaris/alert/getColumns.tsx b/web/src/polaris/alert/getColumns.tsx
index 90d0ad58..9c03c398 100644
--- a/web/src/polaris/alert/getColumns.tsx
+++ b/web/src/polaris/alert/getColumns.tsx
@@ -1,3 +1,5 @@
+import { t } from 'i18next'
+import { Trans } from 'react-i18next'
import * as React from 'react'
import { DuckCmpProps } from 'saga-duck'
import AlertPageDuck from './PageDuck'
@@ -12,8 +14,8 @@ export default ({ duck: { creators } }: DuckCmpProps): Column (
+ header: t('策略ID/名称'),
+ render: x => (
<>
{x.id}
@@ -24,20 +26,21 @@ export default ({ duck: { creators } }: DuckCmpProps): Column {MonitorTypeMap[x.monitor_type] || '-'},
+ header: t('监控类型'),
+ render: x => {MonitorTypeMap[x.monitor_type] || '-'},
},
{
key: 'rules',
- header: '触发条件',
- render: (x) => (
+ header: t('触发条件'),
+ render: x => (
<>
{MetricNameMap[x.alter_expr?.metrics_name]?.text} {AlterExprMap[x.alter_expr?.expr]} {x.alter_expr?.value}
{MetricNameMap[x.alter_expr?.metrics_name]?.unit}
- 持续{x.alter_expr.for}
+ 持续
+ {x.alter_expr.for}
{AlertTimeIntervalMap[x.alter_expr.for_unit]}
>
@@ -45,13 +48,19 @@ export default ({ duck: { creators } }: DuckCmpProps): Column 每隔{`${x.interval}${AlertTimeIntervalMap[x.interval_unit]}`}告警一次,
+ header: t('告警规则'),
+ render: x => (
+
+ 每隔
+ {`${x.interval}${AlertTimeIntervalMap[x.interval_unit]}`}
+ 告警一次
+
+ ),
},
{
key: 'ctime',
- header: '创建时间',
- render: (x) => (
+ header: t('创建时间'),
+ render: x => (
<>
{x.create_time}
{x.modify_time}
@@ -60,18 +69,18 @@ export default ({ duck: { creators } }: DuckCmpProps): Column {
+ header: t('操作'),
+ render: x => {
return (
- dispatch(creators.toggle(x))} tip={x.enable ? '禁用' : '启用'}>
- {x.enable ? '禁用' : '启用'}
+ dispatch(creators.toggle(x))} tip={x.enable ? t('禁用') : t('启用')}>
+ {x.enable ? t('禁用') : t('启用')}
- dispatch(creators.edit(x))} tip={'编辑'}>
- {'编辑'}
+ dispatch(creators.edit(x))} tip={t('编辑')}>
+ {t('编辑')}
- dispatch(creators.remove(x))} tip={'删除'}>
- {'删除'}
+ dispatch(creators.remove(x))} tip={t('删除')}>
+ {t('删除')}
)
diff --git a/web/src/polaris/alert/operation/Create.tsx b/web/src/polaris/alert/operation/Create.tsx
index 23ca0606..abfd2386 100644
--- a/web/src/polaris/alert/operation/Create.tsx
+++ b/web/src/polaris/alert/operation/Create.tsx
@@ -1,3 +1,5 @@
+import { t } from 'i18next'
+import { Trans } from 'react-i18next'
import React from 'react'
import { DuckCmpProps, purify } from 'saga-duck'
import Duck from './CreateDuck'
@@ -22,7 +24,13 @@ export default function Create(props: DuckCmpProps) {
}
const data = selectors.data(store)
return (
-