This is an automated email from the ASF dual-hosted git repository.
starsz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix-dashboard.git
The following commit(s) were added to refs/heads/master by this push:
new 2f5d27c feat: change the metrics to dashboard (#1641)
2f5d27c is described below
commit 2f5d27cfba3a6e925ca9265e38de25763321d2e6
Author: Cliff Su <[email protected]>
AuthorDate: Tue Mar 23 11:08:43 2021 +0800
feat: change the metrics to dashboard (#1641)
---
web/config/routes.ts | 6 +++---
.../dashboard-smoketest.spec.js} | 10 +++++-----
.../integration/settings/settings-smoketest.spec.js | 2 +-
web/src/helpers.tsx | 4 ++--
web/src/locales/en-US/menu.ts | 1 -
web/src/locales/zh-CN/menu.ts | 1 -
.../pages/{Metrics/Metrics.tsx => Dashboard/Dashboard.tsx} | 14 +++++++-------
web/src/pages/{Metrics => Dashboard}/index.ts | 2 +-
web/src/pages/{Metrics => Dashboard}/locales/en-US.ts | 6 +++---
web/src/pages/{Metrics => Dashboard}/locales/zh-CN.ts | 6 +++---
web/src/pages/{Metrics => Dashboard}/service.ts | 0
web/src/pages/Setting/Setting.tsx | 2 +-
12 files changed, 26 insertions(+), 28 deletions(-)
diff --git a/web/config/routes.ts b/web/config/routes.ts
index b47c7cd..7f01bc3 100644
--- a/web/config/routes.ts
+++ b/web/config/routes.ts
@@ -17,11 +17,11 @@
const routes = [
{
path: '/',
- component: './Metrics',
+ component: './Dashboard',
},
{
- path: '/metrics',
- component: './Metrics',
+ path: '/dashboard',
+ component: './Dashboard',
},
{
path: '/serverinfo',
diff --git a/web/cypress/integration/metrics/metrics-smoketest.spec.js
b/web/cypress/integration/dashboard/dashboard-smoketest.spec.js
similarity index 83%
rename from web/cypress/integration/metrics/metrics-smoketest.spec.js
rename to web/cypress/integration/dashboard/dashboard-smoketest.spec.js
index 2e8a43d..595aa4e 100644
--- a/web/cypress/integration/metrics/metrics-smoketest.spec.js
+++ b/web/cypress/integration/dashboard/dashboard-smoketest.spec.js
@@ -16,20 +16,20 @@
*/
/* eslint-disable no-undef */
-context('metrics page smoke test', () => {
+context('dashboard page smoke test', () => {
beforeEach(() => {
cy.login();
cy.fixture('selector.json').as('domSelector');
});
- it('should visit metrics page', function () {
+ it('should visit dashboard page', function () {
cy.visit('/');
- cy.contains('Metrics').click();
- cy.url().should('contains', '/metrics');
+ cy.contains('Dashboard').click();
+ cy.url().should('contains', '/dashboard');
cy.get(this.domSelector.pageContent)
.children()
- .should('contain', 'Metrics')
+ .should('contain', 'Dashboard')
.and('contain', 'You have not configured Grafana')
.and('contain', 'Configure');
});
diff --git a/web/cypress/integration/settings/settings-smoketest.spec.js
b/web/cypress/integration/settings/settings-smoketest.spec.js
index 64804d8..1c0b8ef 100644
--- a/web/cypress/integration/settings/settings-smoketest.spec.js
+++ b/web/cypress/integration/settings/settings-smoketest.spec.js
@@ -63,6 +63,6 @@ context('settings page smoke test', () => {
cy.get(this.domSelector.notificationMessage).should('contain',
this.data.updateSuccessfully);
cy.intercept(data.validURL).as(data.fetchURL);
cy.wait(data.fetch);
- cy.get(this.domSelector.pageContainer).children().should('contain',
'Metrics');
+ cy.get(this.domSelector.pageContainer).children().should('contain',
'Dashboard');
});
});
diff --git a/web/src/helpers.tsx b/web/src/helpers.tsx
index 44fb0d8..c5743d8 100644
--- a/web/src/helpers.tsx
+++ b/web/src/helpers.tsx
@@ -28,8 +28,8 @@ import IconFont from './components/IconFont';
export const getMenuData = (): MenuDataItem[] => {
return [
{
- name: 'metrics',
- path: '/metrics',
+ name: 'dashboard',
+ path: '/dashboard',
icon: <IconFont name="icondashboard" />,
},
{
diff --git a/web/src/locales/en-US/menu.ts b/web/src/locales/en-US/menu.ts
index e84a578..a577330 100644
--- a/web/src/locales/en-US/menu.ts
+++ b/web/src/locales/en-US/menu.ts
@@ -63,7 +63,6 @@ export default {
'menu.editor.flow': 'Flow Editor',
'menu.editor.mind': 'Mind Editor',
'menu.editor.koni': 'Koni Editor',
- 'menu.metrics': 'Metrics',
'menu.routes': 'Route',
'menu.pluginTemplate': 'Plugin Template',
'menu.ssl': 'SSL',
diff --git a/web/src/locales/zh-CN/menu.ts b/web/src/locales/zh-CN/menu.ts
index 19b4c6e..bb3b69c 100644
--- a/web/src/locales/zh-CN/menu.ts
+++ b/web/src/locales/zh-CN/menu.ts
@@ -60,7 +60,6 @@ export default {
'menu.editor.flow': '流程编辑器',
'menu.editor.mind': '脑图编辑器',
'menu.editor.koni': '拓扑编辑器',
- 'menu.metrics': '监控',
'menu.routes': '路由',
'menu.pluginTemplate': '插件模板',
'menu.ssl': '证书',
diff --git a/web/src/pages/Metrics/Metrics.tsx
b/web/src/pages/Dashboard/Dashboard.tsx
similarity index 81%
rename from web/src/pages/Metrics/Metrics.tsx
rename to web/src/pages/Dashboard/Dashboard.tsx
index 1680478..780dda8 100644
--- a/web/src/pages/Metrics/Metrics.tsx
+++ b/web/src/pages/Dashboard/Dashboard.tsx
@@ -22,7 +22,7 @@ import { history, useIntl } from 'umi';
import { getGrafanaURL } from './service';
import { QuestionCircleOutlined } from '@ant-design/icons';
-const Metrics: React.FC = () => {
+const Dashboard: React.FC = () => {
const [grafanaURL, setGrafanaURL] = useState<string | undefined>();
const { formatMessage } = useIntl();
@@ -36,8 +36,8 @@ const Metrics: React.FC = () => {
<PageHeaderWrapper
title={
<>
- {formatMessage({ id: 'menu.metrics' })}
- <Tooltip title={formatMessage({ id: 'page.metrics.tip' })}>
+ {formatMessage({ id: 'menu.dashboard' })}
+ <Tooltip title={formatMessage({ id: 'page.dashboard.tip' })}>
<QuestionCircleOutlined />
</Tooltip>
</>
@@ -52,7 +52,7 @@ const Metrics: React.FC = () => {
}}
description={
<span>
- {formatMessage({ id:
'page.metrics.empty.description.grafanaNotConfig' })}
+ {formatMessage({ id:
'page.dashboard.empty.description.grafanaNotConfig' })}
</span>
}
>
@@ -64,13 +64,13 @@ const Metrics: React.FC = () => {
});
}}
>
- {formatMessage({ id: 'page.metrics.button.grafanaConfig' })}
+ {formatMessage({ id: 'page.dashboard.button.grafanaConfig' })}
</Button>
</Empty>
)}
{grafanaURL && (
<div>
- <iframe title="metrics" src={grafanaURL} width="100%" height="860"
frameBorder="0" />
+ <iframe title="dashboard" src={grafanaURL} width="100%"
height="860" frameBorder="0" />
</div>
)}
</Card>
@@ -78,4 +78,4 @@ const Metrics: React.FC = () => {
);
};
-export default Metrics;
+export default Dashboard;
diff --git a/web/src/pages/Metrics/index.ts b/web/src/pages/Dashboard/index.ts
similarity index 95%
rename from web/src/pages/Metrics/index.ts
rename to web/src/pages/Dashboard/index.ts
index 5259cf2..be359a4 100644
--- a/web/src/pages/Metrics/index.ts
+++ b/web/src/pages/Dashboard/index.ts
@@ -14,4 +14,4 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-export { default } from './Metrics';
+export { default } from './Dashboard';
diff --git a/web/src/pages/Metrics/locales/en-US.ts
b/web/src/pages/Dashboard/locales/en-US.ts
similarity index 77%
rename from web/src/pages/Metrics/locales/en-US.ts
rename to web/src/pages/Dashboard/locales/en-US.ts
index 557a370..85457f3 100644
--- a/web/src/pages/Metrics/locales/en-US.ts
+++ b/web/src/pages/Dashboard/locales/en-US.ts
@@ -15,7 +15,7 @@
* limitations under the License.
*/
export default {
- 'page.metrics.empty.description.grafanaNotConfig': 'You have not configured
Grafana',
- 'page.metrics.button.grafanaConfig': 'Configure',
- 'page.metrics.tip': 'Use browser iframe to store monitor page URL, local
only.',
+ 'page.dashboard.empty.description.grafanaNotConfig': 'You have not
configured Grafana',
+ 'page.dashboard.button.grafanaConfig': 'Configure',
+ 'page.dashboard.tip': 'Use browser localStorage to store monitor page URL,
local only.',
};
diff --git a/web/src/pages/Metrics/locales/zh-CN.ts
b/web/src/pages/Dashboard/locales/zh-CN.ts
similarity index 76%
rename from web/src/pages/Metrics/locales/zh-CN.ts
rename to web/src/pages/Dashboard/locales/zh-CN.ts
index 5ab0397..807b4f4 100644
--- a/web/src/pages/Metrics/locales/zh-CN.ts
+++ b/web/src/pages/Dashboard/locales/zh-CN.ts
@@ -15,7 +15,7 @@
* limitations under the License.
*/
export default {
- 'page.metrics.empty.description.grafanaNotConfig': '您还未配置 Grafana',
- 'page.metrics.button.grafanaConfig': '现在配置',
- 'page.metrics.tip': '使用浏览器 iframe 存储监控页访问地址,仅作用于本地。',
+ 'page.dashboard.empty.description.grafanaNotConfig': '您还未配置 Grafana',
+ 'page.dashboard.button.grafanaConfig': '现在配置',
+ 'page.dashboard.tip': '使用浏览器 localStorage 存储监控页访问地址,仅作用于本地。',
};
diff --git a/web/src/pages/Metrics/service.ts
b/web/src/pages/Dashboard/service.ts
similarity index 100%
rename from web/src/pages/Metrics/service.ts
rename to web/src/pages/Dashboard/service.ts
diff --git a/web/src/pages/Setting/Setting.tsx
b/web/src/pages/Setting/Setting.tsx
index 94c7f2c..0b2febc 100644
--- a/web/src/pages/Setting/Setting.tsx
+++ b/web/src/pages/Setting/Setting.tsx
@@ -21,7 +21,7 @@ import { history, useIntl } from 'umi';
import { getUrlQuery } from '@/helpers';
import ActionBar from '@/components/ActionBar';
-import { getGrafanaURL } from '@/pages/Metrics/service';
+import { getGrafanaURL } from '@/pages/Dashboard/service';
import { updateMonitorURL } from './service';