diff --git a/i18n.config.js b/i18n.config.js new file mode 100644 index 0000000..3f72991 --- /dev/null +++ b/i18n.config.js @@ -0,0 +1,12 @@ +'use strict'; + +const path = require('path'); + +module.exports = { + srcDirs: [ + 'view/src/**/*{.js,.jsx,.ts,.tsx}', + ], + distDir: path.resolve(__dirname, 'view/src/locale'), + tokenName: '__i18n', + debug: true, +}; diff --git a/package.json b/package.json index 38c904b..2554b99 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,7 @@ "autod-egg": "^1.0.0", "concurrently": "4.0.1", "debug": "^3.1.0", + "easy-i18n-cli": "1", "egg-bin": "^4.3.5", "egg-mock": "^3.14.0", "eslint": "^4.11.0", @@ -45,6 +46,7 @@ "cov": "npm run db:prepare:test && egg-bin cov", "lint": "eslint . --fix", "autod": "autod", + "translate": "easy-i18n-cli -c ./i18n.config.js", "build:docker": "docker build --no-cache --pull -t macacajs/reliable-web .", "db:prepare:test": "NODE_ENV=test npm run db:migrate:undo:all && NODE_ENV=test npm run db:migrate", "db:status": "sequelize db:migrate:status", diff --git a/view/.eslintignore b/view/.eslintignore index 5c4927e..13f2496 100644 --- a/view/.eslintignore +++ b/view/.eslintignore @@ -3,3 +3,4 @@ **/assets **/coverage **/reports +view/src/locale/en-US.js diff --git a/view/package.json b/view/package.json index 0cbcaf8..bd0565a 100644 --- a/view/package.json +++ b/view/package.json @@ -55,7 +55,6 @@ "react-dom": "^16.6.0", "react-ga": "^2.7.0", "react-github-button": "0.1.11", - "react-intl": "^2.4.0", "react-load-script": "^0.0.6", "react-router-dom": "^4.2.2", "style-loader": "^0.21.0", diff --git a/view/src/.eslintrc.js b/view/src/.eslintrc.js index a83697b..de00fa1 100644 --- a/view/src/.eslintrc.js +++ b/view/src/.eslintrc.js @@ -18,6 +18,9 @@ module.exports = { }, }, plugins: ['babel', 'react'], + globals: { + __i18n: true, + }, rules: { camelcase: 0, 'no-restricted-syntax': 0, diff --git a/view/src/components/BuildsTable.js b/view/src/components/BuildsTable.js index 45eb695..ed897ac 100644 --- a/view/src/components/BuildsTable.js +++ b/view/src/components/BuildsTable.js @@ -8,7 +8,6 @@ import { SettingOutlined, RightCircleOutlined, } from '@ant-design/icons'; -import { FormattedMessage } from 'react-intl'; import { getUuid, @@ -26,7 +25,7 @@ export default class BuildsTable extends React.Component { } columns = [{ - title: , + title: __i18n('项目名'), dataIndex: 'jobName', render: (text, record) => { return ( @@ -36,7 +35,7 @@ export default class BuildsTable extends React.Component { ); }, }, { - title: , + title: __i18n('运行日志'), width: 100, render: (text, record) => { return (record.buildLogUrl @@ -45,17 +44,17 @@ export default class BuildsTable extends React.Component { href={record.buildLogUrl} target="_blank" > - + {__i18n('运行日志')} ) : ( - + {__i18n('运行日志')} )); }, }, { - title: , + title: __i18n('构建号'), dataIndex: 'buildNumber', width: 200, render: (value, record) => { @@ -80,10 +79,10 @@ export default class BuildsTable extends React.Component { ); }, }, { - title: , + title: __i18n('平台'), dataIndex: 'platform', }, { - title: , + title: __i18n('完成时间'), dataIndex: 'buildEndTime', render: (text, record) => { return ( @@ -93,7 +92,7 @@ export default class BuildsTable extends React.Component { ); }, }, { - title: , + title: __i18n('代码分支'), dataIndex: 'gitBranch', width: 240, render: (text, record) => { @@ -104,7 +103,7 @@ export default class BuildsTable extends React.Component { ); }, }, { - title: , + title: __i18n('提交人'), dataIndex: 'committer', width: 120, render: (text, record) => { @@ -115,7 +114,7 @@ export default class BuildsTable extends React.Component { ); }, }, { - title: , + title: __i18n('详情'), align: 'center', width: 80, render: (value, record) => { diff --git a/view/src/components/BuildsTabs.js b/view/src/components/BuildsTabs.js index a35e41d..3b1b1fd 100644 --- a/view/src/components/BuildsTabs.js +++ b/view/src/components/BuildsTabs.js @@ -1,7 +1,7 @@ import React from 'react'; import { Tabs } from 'antd'; import { withRouter } from 'react-router-dom'; -import { FormattedMessage } from 'react-intl'; + import safeGet from 'lodash/get'; import request from '../util/request'; @@ -144,7 +144,7 @@ class BuildsTabs extends React.Component { onTabClick={this.handleTabClick} style={{ height: 'auto' }} > - ({allJobName.length})} key=""> + {__i18n('所有构建')} ({allJobName.length})} key=""> { listItems } diff --git a/view/src/components/DingdingSetting.js b/view/src/components/DingdingSetting.js index 2399536..03cc87f 100644 --- a/view/src/components/DingdingSetting.js +++ b/view/src/components/DingdingSetting.js @@ -1,7 +1,7 @@ import React, { useEffect, useState } from 'react'; import safeGet from 'lodash/get'; import { uniqBy } from 'lodash'; -import { FormattedMessage } from 'react-intl'; + import { Form, Spin, @@ -112,7 +112,7 @@ function DingdingSetting() { noStyle > )} @@ -141,7 +141,7 @@ function DingdingSetting() { block icon={} > - + {__i18n('添加通知')} @@ -154,7 +154,7 @@ function DingdingSetting() { type="primary" style={{ width: '100%' }} > - + {__i18n('更新设置')} diff --git a/view/src/components/ExtraTable.js b/view/src/components/ExtraTable.js index 4041dbf..a172d25 100644 --- a/view/src/components/ExtraTable.js +++ b/view/src/components/ExtraTable.js @@ -1,16 +1,15 @@ import React from 'react'; import { Table } from 'antd'; -import { FormattedMessage } from 'react-intl'; import { getUuid } from '../util/index'; const columns = [{ - title: , + title: __i18n('项'), dataIndex: 'extraName', width: 200, render: value => { return {value}; }, }, { - title: , + title: __i18n('内容'), dataIndex: 'extraContent', render: value => { return
{JSON.stringify(value, null, 2)}
; }, }]; diff --git a/view/src/components/Header.js b/view/src/components/Header.js index 7cc4061..d3da9c0 100644 --- a/view/src/components/Header.js +++ b/view/src/components/Header.js @@ -16,7 +16,7 @@ import { LogoutOutlined, } from '@ant-design/icons'; import safeGet from 'lodash/get'; -import { FormattedMessage } from 'react-intl'; + import GitHubButton from 'react-github-button'; import 'react-github-button/assets/style.css'; @@ -82,7 +82,7 @@ function ContentHeader(props) { repo="reliable" /> - }> + - }> + - } key="pkginfo"> + - } key="test"> + - } key="extrainfo"> + - } key="fileinfo"> + diff --git a/view/src/components/PkgTable.js b/view/src/components/PkgTable.js index 9e00b46..0a05cc0 100644 --- a/view/src/components/PkgTable.js +++ b/view/src/components/PkgTable.js @@ -1,6 +1,5 @@ import React from 'react'; import QRCode from 'qrcode-react'; -import { FormattedMessage } from 'react-intl'; import { Table, @@ -32,16 +31,16 @@ export default class PkgTable extends React.Component { getColumns = () => { let columns = [{ - title: , + title: __i18n('版本号'), dataIndex: 'version', width: 100, }, { - title: , + title: __i18n('类型'), dataIndex: 'type', width: 160, }]; columns = columns.concat([{ - title: , + title: __i18n('下载'), dataIndex: 'download', width: 160, render: (value, record) => { @@ -52,14 +51,14 @@ export default class PkgTable extends React.Component { onClick={this.showQrCodeModal.bind(this, record)} /> - + {__i18n('下载')} ); }, }]); columns = columns.concat([{ - title: , + title: __i18n('代码分支'), dataIndex: 'gitBranch', width: 300, render: (value, record) => { @@ -68,7 +67,7 @@ export default class PkgTable extends React.Component { ); }, }, { - title: , + title: __i18n('提交信息'), width: 240, dataIndex: 'gitCommit', render: (value, record) => { diff --git a/view/src/components/SiderBar.js b/view/src/components/SiderBar.js index a7f5cc0..506ad8e 100644 --- a/view/src/components/SiderBar.js +++ b/view/src/components/SiderBar.js @@ -9,7 +9,6 @@ import { LineChartOutlined, SettingOutlined, } from '@ant-design/icons'; -import { FormattedMessage } from 'react-intl'; const { Sider } = Layout; @@ -46,7 +45,7 @@ export default class SiderBar extends React.Component { - + {__i18n('构建信息')} @@ -54,7 +53,7 @@ export default class SiderBar extends React.Component { - + {__i18n('洞察')} @@ -63,7 +62,7 @@ export default class SiderBar extends React.Component { - + {__i18n('设置')} diff --git a/view/src/components/SiteSetting.js b/view/src/components/SiteSetting.js index 1811b51..e2cab6c 100644 --- a/view/src/components/SiteSetting.js +++ b/view/src/components/SiteSetting.js @@ -1,6 +1,6 @@ import React, { useEffect, useState } from 'react'; import safeGet from 'lodash/get'; -import { FormattedMessage } from 'react-intl'; + import { Form, Spin, @@ -83,7 +83,7 @@ function SiteSetting() { htmlType="submit" onClick={updateSite} > - + {__i18n('更新设置')} diff --git a/view/src/components/TestTable.js b/view/src/components/TestTable.js index 3dd4417..9236b6d 100644 --- a/view/src/components/TestTable.js +++ b/view/src/components/TestTable.js @@ -1,16 +1,15 @@ import React from 'react'; import { Table } from 'antd'; -import { FormattedMessage } from 'react-intl'; import { getUuid } from '../util/index'; const columns = [{ - title: , + title: __i18n('行覆盖率'), dataIndex: 'lineCoverage', render: value => { return {value ? `${value}%` : ''}; }, width: 100, }, { - title: , + title: __i18n('通过率'), dataIndex: 'passingRate', render: (text, record) => { return ( @@ -32,19 +31,19 @@ const columns = [{ }, width: 140, }, { - title: , + title: __i18n('测试报告'), dataIndex: 'testReporter', - render: value => { return (value ? : ''); }, + render: value => { return (value ? {__i18n('查看')} : ''); }, }, { - title: , + title: __i18n('覆盖率报告'), dataIndex: 'coverageReporter', - render: value => { return (value ? : ''); }, + render: value => { return (value ? {__i18n('查看')} : ''); }, }, { - title: , + title: __i18n('代码分支'), dataIndex: 'gitBranch', width: 240, }, { - title: , + title: __i18n('提交链接'), dataIndex: 'gitCommit', render: (value, record) => { return ( @@ -54,10 +53,10 @@ const columns = [{ ); }, }, { - title: , + title: __i18n('提交人'), dataIndex: 'committer', }, { - title: , + title: __i18n('提交时间'), dataIndex: 'commitTime', }]; diff --git a/view/src/i18n/en_US.js b/view/src/i18n/en_US.js deleted file mode 100644 index 20a721e..0000000 --- a/view/src/i18n/en_US.js +++ /dev/null @@ -1,72 +0,0 @@ -export default { - 'common.comfirm': 'Confirm', - 'common.cancel': 'Cancel', - 'common.comfirmDelete': 'Confirm Delete?', - 'common.input.invalid': 'Please correct the input', - - 'header.issues': 'issues', - 'header.document': 'document', - - 'sidebar.homepage': 'Home Page', - 'sidebar.allbuilds': 'All Builds', - 'sidebar.buildinfo': 'Build Info', - 'sidebar.insight': 'Insight', - 'sidebar.setting': 'Setting', - - 'setting.dingMessage': 'DingTalk Setting', - 'setting.addDingMessage': 'Add DingTalk Webhook', - 'setting.submit': 'Update', - 'setting.versioning': 'Version Info', - 'setting.notification.build': 'Build', - 'setting.site': 'Site Config', - - 'builds.buildNumber': 'Build Number', - 'builds.buildLog': 'Build Log', - 'builds.jobName': 'Job Name', - 'builds.platform': 'Platform', - 'builds.buildEndTime': 'Build End Time', - 'builds.detailInfo': 'Detail', - 'builds.rank': 'Rank', - - 'buildinfo.pkgTab': 'Package', - 'buildinfo.testTab': 'Test Result', - 'buildinfo.extraTab': 'Extra Info', - 'buildinfo.filesTab': 'Build Product', - - 'buildinfo.pkg.version': 'Version', - 'buildinfo.pkg.type': 'Type', - 'buildinfo.pkg.download': 'Download', - 'buildinfo.pkg.gitBranch': 'Current Branch', - 'buildinfo.pkg.gitCommit': 'Commit Url', - 'buildinfo.pkg.gitInfo': 'Commit Info', - 'buildinfo.pkg.committer': 'Commiter', - 'buildinfo.pkg.commitTime': 'Commit Time', - 'buildinfo.state': 'Build State', - - 'buildinfo.test.lineCoverage': 'Coverage Percent', - 'buildinfo.test.passPercent': 'Pass Percent', - 'buildinfo.test.testReporter': 'Tests Reporter', - 'buildinfo.test.coverageReporter': 'Coverage Reporter', - 'buildinfo.test.reporter': 'reporter', - - 'buildinfo.extra.extraName': 'Name', - 'buildinfo.extra.extraContent': 'Content', - - 'buildinfo.files.fileName': 'File Name', - 'buildinfo.files.fileAddress': 'Download', - - 'insight.builds.number': 'Total Job Number', - 'insight.builds.trend': 'Total Builds Number', - 'insight.builds.top': 'Top', - 'insight.test.lineCoverage': 'Coverage Percent avg', - 'insight.test.lineCoverage.tip': 'Average test coverage over this period of time', - 'insight.test.lineCoverage.history': 'Coverage History', - 'insight.test.lineCoverage.latest': 'Coverage', - 'insight.test.passPercent': 'Pass Percent', - 'insight.test.passPercent.tip': 'CI 100% pass rate', - 'insight.test.passPercent.history': 'PassPercent History', - 'insight.test.duration': 'Duration avg', - 'insight.test.duration.history': 'Duration History', - 'insight.committer': 'Last Commit', - 'insight.dateRange.tip': 'Please select range or query entire data', -}; diff --git a/view/src/i18n/zh_CN.js b/view/src/i18n/zh_CN.js deleted file mode 100644 index 13c567f..0000000 --- a/view/src/i18n/zh_CN.js +++ /dev/null @@ -1,73 +0,0 @@ -export default { - 'common.comfirm': '确认', - 'common.cancel': '取消', - 'common.comfirmDelete': '确定删除?', - 'common.input.invalid': '请修改输入的内容', - - 'header.issues': '问题反馈', - 'header.document': '文档', - - 'sidebar.homepage': '主页', - 'sidebar.allbuilds': '所有构建', - 'sidebar.buildinfo': '构建信息', - 'sidebar.insight': '洞察', - 'sidebar.setting': '设置', - - 'setting.dingMessage': '钉钉消息设置', - 'setting.addDingMessage': '添加通知', - 'setting.submit': '更新设置', - 'setting.versioning': '版本信息', - 'setting.notification.build': '构建', - 'setting.site': '站点设置', - - 'builds.buildNumber': '构建号', - 'builds.buildLog': '运行日志', - 'builds.jobName': '项目名', - 'builds.platform': '平台', - 'builds.buildEndTime': '完成时间', - 'builds.detailInfo': '详情', - 'builds.rank': '排行', - - 'buildinfo.pkgTab': '包信息', - 'buildinfo.testTab': '测试结果', - 'buildinfo.extraTab': '扩展信息', - 'buildinfo.filesTab': '产物', - - 'buildinfo.pkg.version': '版本号', - 'buildinfo.pkg.type': '类型', - 'buildinfo.pkg.download': '下载', - 'buildinfo.pkg.gitBranch': '代码分支', - 'buildinfo.pkg.gitCommit': '提交链接', - 'buildinfo.pkg.gitInfo': '提交信息', - 'buildinfo.pkg.committer': '提交人', - 'buildinfo.pkg.commitTime': '提交时间', - 'buildinfo.state': '状态', - - 'buildinfo.test.lineCoverage': '行覆盖率', - 'buildinfo.test.passPercent': '通过率', - 'buildinfo.test.testReporter': '测试报告', - 'buildinfo.test.coverageReporter': '覆盖率报告', - 'buildinfo.test.reporter': '查看', - - 'buildinfo.extra.extraName': '项', - 'buildinfo.extra.extraContent': '内容', - - 'buildinfo.files.fileName': '文件名称', - 'buildinfo.files.fileAddress': '下载地址', - - 'insight.builds.number': '应用总数', - 'insight.builds.trend': '构建总数', - 'insight.builds.top': '榜单', - 'insight.test.lineCoverage': '平均行覆盖率', - 'insight.test.lineCoverage.tip': '测试覆盖率的平均值', - 'insight.test.lineCoverage.history': '测试覆盖率历史记录', - 'insight.test.lineCoverage.latest': '行覆盖率', - 'insight.test.passPercent': '通过率', - 'insight.test.passPercent.tip': 'CI 100% 成功次数 / CI 执行次数', - 'insight.test.passPercent.history': '通过率历史记录', - 'insight.test.duration': '平均时长', - 'insight.test.duration.history': '时长历史记录', - 'insight.committer': '最后提交', - 'insight.dateRange.tip': '请选择时间范围,不选择将会统计全部数据', - -}; diff --git a/view/src/index.js b/view/src/index.js index 867ced2..4ce8e9f 100644 --- a/view/src/index.js +++ b/view/src/index.js @@ -2,13 +2,7 @@ import React from 'react'; import ReactGA from 'react-ga'; import ReactDOM from 'react-dom'; import { Route, BrowserRouter } from 'react-router-dom'; -import { addLocaleData, IntlProvider } from 'react-intl'; - -import zh from 'react-intl/locale-data/zh'; -import en from 'react-intl/locale-data/en'; -import zhCN from './i18n/zh_CN'; -import enUS from './i18n/en_US'; - +import './locale'; import Builds from './page/Builds'; import Setting from './page/Setting'; import Insight from './page/Insight'; @@ -18,57 +12,26 @@ import SnsAuthorize from './page/SnsAuthorize'; import './index.less'; -addLocaleData([ - ...en, - ...zh, -]); - -const chooseLocale = () => { - const language = window.localStorage.RELIABLE_LANGUAGE || window.navigator.language; - switch (language) { - case 'zh-CN': - case 'zh-HK': - case 'zh-TW': - case 'zh': - return { - locale: 'zh-CN', - messages: zhCN, - }; - default: - return { - locale: 'en-US', - messages: enUS, - }; - } -}; - const importAll = (r) => { return r.keys().forEach(r); }; importAll(require.context('./assets', false, /\.svg$/)); -const lang = chooseLocale(); - window.addEventListener('load', () => { ReactGA.initialize('UA-49226133-2'); ReactGA.pageview(window.location.pathname + window.location.search); }); ReactDOM.render( - - -
- - - - - - -
-
-
, + +
+ + + + + + +
+
, document.querySelector('#app') ); diff --git a/view/src/locale/en-US.js b/view/src/locale/en-US.js new file mode 100644 index 0000000..670123c --- /dev/null +++ b/view/src/locale/en-US.js @@ -0,0 +1,51 @@ +module.exports = { + 'CI 100% 成功次数 / CI 执行次数': 'CI 100% pass rate', + 下载: 'Download', + 主页: 'Home Page', + 产物: 'Build Product', + 代码分支: 'Current Branch', + 内容: 'Content', + 包信息: 'Package', + 完成时间: 'Build End Time', + 平台: 'Platform', + 平均行覆盖率: 'Coverage Percent avg', + 应用总数: 'Total Job Number', + 所有构建: 'All Builds', + 扩展信息: 'Extra Info', + 排行: 'Rank', + 提交人: 'Commiter', + 提交信息: 'Commit Info', + 提交时间: 'Commit Time', + 提交链接: 'Commit Url', + 文档: 'document', + 更新设置: 'Update', + 最后提交: 'Last Commit', + 构建: 'Build', + 构建信息: 'Build Info', + 构建号: 'Build Number', + 构建总数: 'Total Builds Number', + 查看: 'reporter', + 榜单: 'Top', + 洞察: 'Insight', + 测试报告: 'Tests Reporter', + 测试结果: 'Test Result', + 测试覆盖率历史记录: 'Coverage History', + 测试覆盖率的平均值: 'Average test coverage over this period of time', + 添加通知: 'Add DingTalk Webhook', + 版本信息: 'Version Info', + 版本号: 'Version', + 站点设置: 'Site Config', + 类型: 'Type', + 行覆盖率: 'Coverage', + 覆盖率报告: 'Coverage Reporter', + 设置: 'Setting', + 详情: 'Detail', + '请选择时间范围,不选择将会统计全部数据': 'Please select range or query entire data', + 运行日志: 'Build Log', + 通过率: 'Pass Percent', + 通过率历史记录: 'PassPercent History', + 钉钉消息设置: 'DingTalk Setting', + 问题反馈: 'issues', + 项: 'Name', + 项目名: 'Job Name', +}; diff --git a/view/src/locale/index.js b/view/src/locale/index.js new file mode 100644 index 0000000..5b51522 --- /dev/null +++ b/view/src/locale/index.js @@ -0,0 +1,9 @@ +import en from './en-US'; + +const language = window.localStorage.RELIABLE_LANGUAGE || window.navigator.language; +window.__i18n = window.__i18n || function (key) { + if (language.startsWith('zh')) { + return key; + } + return en[key]; +}; diff --git a/view/src/page/Blank.js b/view/src/page/Blank.js index 9f5818e..5a03d91 100644 --- a/view/src/page/Blank.js +++ b/view/src/page/Blank.js @@ -1,6 +1,6 @@ import React from 'react'; import { Link } from 'react-router-dom'; -import { FormattedMessage } from 'react-intl'; + import { Alert, Breadcrumb } from 'antd'; import ReliableLayout from '../components/ReliableLayout'; @@ -11,7 +11,7 @@ export default class Setting extends React.Component { - + {__i18n('主页')} diff --git a/view/src/page/BuildLog.js b/view/src/page/BuildLog.js index c6f5e53..8ede0bf 100644 --- a/view/src/page/BuildLog.js +++ b/view/src/page/BuildLog.js @@ -3,7 +3,6 @@ import { Breadcrumb, } from 'antd'; import { Link } from 'react-router-dom'; -import { FormattedMessage } from 'react-intl'; import { queryParse } from '../util/index'; import ReliableLayout from '../components/ReliableLayout'; @@ -16,10 +15,10 @@ export default class BuildLog extends React.Component { - + {__i18n('主页')} - + {__i18n('所有构建')} {`${jobName} / ${buildNumber}`} diff --git a/view/src/page/Builds.js b/view/src/page/Builds.js index 02e4053..19f9475 100644 --- a/view/src/page/Builds.js +++ b/view/src/page/Builds.js @@ -1,7 +1,6 @@ import React from 'react'; import { Link } from 'react-router-dom'; import { Breadcrumb } from 'antd'; -import { FormattedMessage } from 'react-intl'; import { queryParse } from '../util/index'; import BuildsTabs from '../components/BuildsTabs'; @@ -14,10 +13,10 @@ export default class Builds extends React.Component { - + {__i18n('主页')} - + {__i18n('所有构建')} { jobName ? {jobName} : '' } diff --git a/view/src/page/Insight.js b/view/src/page/Insight.js index 618d508..6f1967b 100644 --- a/view/src/page/Insight.js +++ b/view/src/page/Insight.js @@ -17,7 +17,6 @@ import React from 'react'; import safeGet from 'lodash/get'; import { Link } from 'react-router-dom'; -import { FormattedMessage } from 'react-intl'; import request from '../util/request'; import ChartCard from '../components/ChartCard'; @@ -104,13 +103,13 @@ export default class Builds extends React.Component { getColumns = () => { return [{ - title: , + title: __i18n('排行'), key: 'rank', render: (text, record, index) => { return {++index}; }, align: 'center', width: 80, }, { - title: , + title: __i18n('项目名'), dataIndex: 'jobName', render: (text, record) => { return ( @@ -120,7 +119,7 @@ export default class Builds extends React.Component { ); }, }, { - title: , + title: __i18n('行覆盖率'), dataIndex: 'linePercentList[0].linePercent', key: 'latestLinePercent', render: (text, record) => { @@ -138,8 +137,8 @@ export default class Builds extends React.Component { }, { title: ( - - }> + {__i18n('平均行覆盖率')} + @@ -150,7 +149,7 @@ export default class Builds extends React.Component { ? ( } + title={__i18n('测试覆盖率历史记录')} content={( - - }> + {__i18n('通过率')} + @@ -205,7 +204,7 @@ export default class Builds extends React.Component { ? ( } + title={__i18n('通过率历史记录')} content={(
, + title: __i18n('最后提交'), dataIndex: 'committer', render: (text, record) => { return ( @@ -311,30 +310,30 @@ export default class Builds extends React.Component { }} > - + {__i18n('主页')} - + {__i18n('洞察')} } + title={__i18n('应用总数')} loading={this.state.loading1} content={this.state.data.length} /> } + title={__i18n('构建总数')} loading={this.state.loading2} content={this.state.total} /> } + title={__i18n('榜单')} loading={this.state.loading3} content={this.getTopCard()} /> @@ -349,7 +348,7 @@ export default class Builds extends React.Component { return ( - + {__i18n('请选择时间范围,不选择将会统计全部数据')} ); }} diff --git a/view/src/page/OneBuild.js b/view/src/page/OneBuild.js index 5c3d866..369e963 100644 --- a/view/src/page/OneBuild.js +++ b/view/src/page/OneBuild.js @@ -1,7 +1,6 @@ import React from 'react'; import { Breadcrumb } from 'antd'; import { Link } from 'react-router-dom'; -import { FormattedMessage } from 'react-intl'; import request from '../util/request'; import { logger, queryParse } from '../util/index'; @@ -51,10 +50,10 @@ export default class Builds extends React.Component { - + {__i18n('主页')} - + {__i18n('所有构建')} {jobName} diff --git a/view/src/page/Setting.js b/view/src/page/Setting.js index f7cdc8f..555ca48 100644 --- a/view/src/page/Setting.js +++ b/view/src/page/Setting.js @@ -1,6 +1,6 @@ import React from 'react'; import { Link } from 'react-router-dom'; -import { FormattedMessage } from 'react-intl'; + import { Card, Breadcrumb, @@ -19,22 +19,22 @@ export default class Setting extends React.Component { - + {__i18n('主页')} - + {__i18n('设置')} - }> +
- }> + - }> + reliable-web: { window.pageConfig.version }