From b9dac479531a3a22ec79ef57af39b40e8554dafd Mon Sep 17 00:00:00 2001 From: Helltab Date: Tue, 12 Dec 2023 02:56:27 +0800 Subject: [PATCH] feat(echarts): Build homepage dashboard using ECharts. --- ui/package.json | 2 +- ui/src/components/Home.vue | 101 +++++++++-------- ui/src/components/dashboard/homeEcharts.vue | 117 ++++++++++++++++++++ ui/src/components/public/Drawer.vue | 2 +- ui/src/mock/mockCluster.js | 19 ++-- 5 files changed, 178 insertions(+), 63 deletions(-) create mode 100644 ui/src/components/dashboard/homeEcharts.vue diff --git a/ui/package.json b/ui/package.json index 3ddf3d691..c81915c42 100644 --- a/ui/package.json +++ b/ui/package.json @@ -15,7 +15,7 @@ "axios": "^0.18.1", "brace": "^0.11.1", "core-js": "^3.33.3", - "echarts": "^4.2.1", + "echarts": "^5.4.3", "http-status": "^1.2.0", "js-yaml": "^3.12.0", "jsoneditor": "^9.1.5", diff --git a/ui/src/components/Home.vue b/ui/src/components/Home.vue index 06bcf7c7f..b5b2698d3 100644 --- a/ui/src/components/Home.vue +++ b/ui/src/components/Home.vue @@ -15,60 +15,59 @@ ~ limitations under the License. --> diff --git a/ui/src/components/dashboard/homeEcharts.vue b/ui/src/components/dashboard/homeEcharts.vue new file mode 100644 index 000000000..fb500976c --- /dev/null +++ b/ui/src/components/dashboard/homeEcharts.vue @@ -0,0 +1,117 @@ + + + + + + diff --git a/ui/src/components/public/Drawer.vue b/ui/src/components/public/Drawer.vue index cd91935b7..abfdcee16 100644 --- a/ui/src/components/public/Drawer.vue +++ b/ui/src/components/public/Drawer.vue @@ -85,7 +85,7 @@ export default { window.getApp.$on('DRAWER_TOGGLED', () => { this.drawer = (!this.drawer) }) - axios.get('/dubbo-admin-info.json').then(response => { + axios.get('/admin/dubbo-admin-info.json').then(response => { this.config = response.data }) }, diff --git a/ui/src/mock/mockCluster.js b/ui/src/mock/mockCluster.js index e4dd07a80..41a03e6a0 100644 --- a/ui/src/mock/mockCluster.js +++ b/ui/src/mock/mockCluster.js @@ -1,4 +1,3 @@ - /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -25,13 +24,13 @@ console.log(random) // 简单使用就不操作了,需要操作的可以去看 // 3、基本用法 Mock.mock(url, type, data) // 参数文档 https://github.com/nuysoft/Mock/wiki Mock.mock('/mock/metrics/cluster', 'get', { - code: 200, - message: '成功', - data: { - all:0, - application:0, - consumers:0, - providers:0, - services:0 - } + code: 200, + message: '成功', + data: { + all: Mock.mock('@integer(100, 500)'), + application: Mock.mock('@integer(20, 39)'), + consumers: Mock.mock('@integer(20, 39)'), + providers: Mock.mock('@integer(20, 39)'), + services: Mock.mock('@integer(20, 39)'), + } })