From 0c2a0a2c3394b5f289ed5f0520e074cced08fba3 Mon Sep 17 00:00:00 2001 From: jipengfei01 Date: Thu, 13 Jul 2023 20:24:44 +0800 Subject: [PATCH] feat: refactor routing and menu, as well as fix #6 --- package-lock.json | 158 ++++ package.json | 3 + src/App.vue | 6 + src/api/alert.ts | 21 +- .../CPUutilizationChart.vue | 94 --- .../DiskPerformanceBPSReadChart.vue | 117 --- .../DiskPerformanceBPSWriteChart.vue | 121 --- .../DiskPerformanceIOPSReadChart.vue | 115 --- .../DiskPerformanceIOPSWriteChart.vue | 110 --- .../MemoryUtilizationChart.vue | 94 --- .../NetworkTrafficReceiveChart.vue | 111 --- .../NetworkTrafficTransmitChart.vue | 115 --- src/components/TrendChartTimePicker/index.vue | 6 +- src/{constant.ts => constants/http.ts} | 0 src/constants/permission.ts | 5 + src/constants/site.ts | 12 + src/hooks/useTitle.ts | 24 + src/layout/components/Card.vue | 26 - src/layout/components/Header.vue | 78 +- src/layout/components/Menu.vue | 115 +++ src/layout/components/Nav.vue | 626 --------------- .../components/common/IntervalPicker.vue | 58 -- src/layout/components/common/TimeSelector.vue | 23 - src/layout/components/common/TopBar.vue | 137 ---- src/layout/constants.ts | 11 + src/layout/index.vue | 61 +- src/layout/index2.vue | 37 + src/model/alert.ts | 20 + src/router/index.ts | 302 ++++--- src/store/alertPage/alertMessage.ts | 44 +- src/store/blockStorageManagement/block.ts | 18 + src/store/eventBus.ts | 7 - src/store/user.ts | 27 +- src/utils/_fetch.ts | 7 +- src/utils/functions.ts | 33 +- src/utils/index.ts | 7 + src/utils/nProgress.ts | 18 + src/utils/router.ts | 19 + src/views/alertPage/alert-config.vue | 22 +- src/views/alertPage/edit-modal.vue | 271 ++++--- src/views/alertPage/index.vue | 6 +- src/views/alertPage/system-log.vue | 356 +++++---- src/views/clusterManagement/ServerDetail.vue | 32 +- .../clusterManagement/ServerManagement.vue | 92 +-- src/views/storageBlock/SnapshotManagement.vue | 324 ++++---- src/views/storageBlock/VolumeManagement.vue | 752 +++++++++++------- .../modals/CreateSnapshotModal.vue | 169 ++-- .../storageBlock/modals/VolumeCreateModal.vue | 706 ++++++++-------- .../modals/VolumeNamespaceModal.vue | 154 ++-- src/views/storagePool/index.vue | 3 +- src/views/users/ChangeEmail.vue | 350 ++++---- src/views/users/PersonalInfo.vue | 93 +-- types/index.d.ts | 5 + types/router.ts | 19 + 54 files changed, 2636 insertions(+), 3504 deletions(-) delete mode 100644 src/charts/cluster-management/CPUutilizationChart.vue delete mode 100644 src/charts/cluster-management/DiskPerformanceBPSReadChart.vue delete mode 100644 src/charts/cluster-management/DiskPerformanceBPSWriteChart.vue delete mode 100644 src/charts/cluster-management/DiskPerformanceIOPSReadChart.vue delete mode 100644 src/charts/cluster-management/DiskPerformanceIOPSWriteChart.vue delete mode 100644 src/charts/cluster-management/MemoryUtilizationChart.vue delete mode 100644 src/charts/cluster-management/NetworkTrafficReceiveChart.vue delete mode 100644 src/charts/cluster-management/NetworkTrafficTransmitChart.vue rename src/{constant.ts => constants/http.ts} (100%) create mode 100644 src/constants/permission.ts create mode 100644 src/constants/site.ts create mode 100644 src/hooks/useTitle.ts delete mode 100644 src/layout/components/Card.vue create mode 100644 src/layout/components/Menu.vue delete mode 100644 src/layout/components/Nav.vue delete mode 100644 src/layout/components/common/IntervalPicker.vue delete mode 100644 src/layout/components/common/TimeSelector.vue delete mode 100644 src/layout/components/common/TopBar.vue create mode 100644 src/layout/constants.ts create mode 100644 src/layout/index2.vue delete mode 100644 src/store/eventBus.ts create mode 100644 src/utils/nProgress.ts create mode 100644 src/utils/router.ts create mode 100644 types/router.ts diff --git a/package-lock.json b/package-lock.json index ce35810..4002a40 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,6 +9,7 @@ "version": "0.0.0", "dependencies": { "@types/diff": "^5.0.3", + "@vueuse/core": "^10.2.1", "axios": "^1.2.2", "dayjs": "^1.11.7", "diff": "^5.1.0", @@ -17,6 +18,7 @@ "less": "^4.1.3", "md5": "^2.3.0", "normalize.css": "^8.0.1", + "nprogress": "^0.2.0", "pinia": "^2.0.30", "postcss-preset-env": "^7.8.3", "qs": "^6.11.1", @@ -36,6 +38,7 @@ "@types/js-cookie": "^3.0.3", "@types/js-md5": "^0.7.0", "@types/node": "^18.11.18", + "@types/nprogress": "^0.2.0", "@types/qs": "^6.9.7", "@types/url-parse": "^1.4.8", "@typescript-eslint/eslint-plugin": "^5.60.1", @@ -2334,6 +2337,12 @@ "integrity": "sha512-Gj7cI7z+98M282Tqmp2K5EIsoouUEzbBJhQQzDE3jSIRk6r9gsz0oUokqIUR4u1R3dMHo0pDHM7sNOHyhulypw==", "dev": true }, + "node_modules/@types/nprogress": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/@types/nprogress/-/nprogress-0.2.0.tgz", + "integrity": "sha512-1cYJrqq9GezNFPsWTZpFut/d4CjpZqA0vhqDUPFWYKF1oIyBz5qnoYMzR+0C/T96t3ebLAC1SSnwrVOm5/j74A==", + "dev": true + }, "node_modules/@types/qs": { "version": "6.9.7", "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.7.tgz", @@ -2361,6 +2370,11 @@ "integrity": "sha512-zqqcGKyNWgTLFBxmaexGUKQyWqeG7HjXj20EuQJSJWwXe54BjX0ihIo5cJB9yAQzH8dNugJ9GvkBYMjPXs/PJw==", "dev": true }, + "node_modules/@types/web-bluetooth": { + "version": "0.0.17", + "resolved": "https://registry.npmjs.org/@types/web-bluetooth/-/web-bluetooth-0.0.17.tgz", + "integrity": "sha512-4p9vcSmxAayx72yn70joFoL44c9MO/0+iVEBIQXe3v2h2SiAsEIo/G5v6ObFWvNKRFjbrVadNf9LqEEZeQPzdA==" + }, "node_modules/@typescript-eslint/eslint-plugin": { "version": "5.60.1", "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.60.1.tgz", @@ -3052,6 +3066,89 @@ "@vue/language-core": "1.8.1" } }, + "node_modules/@vueuse/core": { + "version": "10.2.1", + "resolved": "https://registry.npmjs.org/@vueuse/core/-/core-10.2.1.tgz", + "integrity": "sha512-c441bfMbkAwTNwVRHQ0zdYZNETK//P84rC01aP2Uy/aRFCiie9NE/k9KdIXbno0eDYP5NPUuWv0aA/I4Unr/7w==", + "dependencies": { + "@types/web-bluetooth": "^0.0.17", + "@vueuse/metadata": "10.2.1", + "@vueuse/shared": "10.2.1", + "vue-demi": ">=0.14.5" + }, + "funding": { + "url": "https://github.com/sponsors/antfu" + } + }, + "node_modules/@vueuse/core/node_modules/vue-demi": { + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/vue-demi/-/vue-demi-0.14.5.tgz", + "integrity": "sha512-o9NUVpl/YlsGJ7t+xuqJKx8EBGf1quRhCiT6D/J0pfwmk9zUwYkC7yrF4SZCe6fETvSM3UNL2edcbYrSyc4QHA==", + "hasInstallScript": true, + "bin": { + "vue-demi-fix": "bin/vue-demi-fix.js", + "vue-demi-switch": "bin/vue-demi-switch.js" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/antfu" + }, + "peerDependencies": { + "@vue/composition-api": "^1.0.0-rc.1", + "vue": "^3.0.0-0 || ^2.6.0" + }, + "peerDependenciesMeta": { + "@vue/composition-api": { + "optional": true + } + } + }, + "node_modules/@vueuse/metadata": { + "version": "10.2.1", + "resolved": "https://registry.npmjs.org/@vueuse/metadata/-/metadata-10.2.1.tgz", + "integrity": "sha512-3Gt68mY/i6bQvFqx7cuGBzrCCQu17OBaGWS5JdwISpMsHnMKKjC2FeB5OAfMcCQ0oINfADP3i9A4PPRo0peHdQ==", + "funding": { + "url": "https://github.com/sponsors/antfu" + } + }, + "node_modules/@vueuse/shared": { + "version": "10.2.1", + "resolved": "https://registry.npmjs.org/@vueuse/shared/-/shared-10.2.1.tgz", + "integrity": "sha512-QWHq2bSuGptkcxx4f4M/fBYC3Y8d3M2UYyLsyzoPgEoVzJURQ0oJeWXu79OiLlBb8gTKkqe4mO85T/sf39mmiw==", + "dependencies": { + "vue-demi": ">=0.14.5" + }, + "funding": { + "url": "https://github.com/sponsors/antfu" + } + }, + "node_modules/@vueuse/shared/node_modules/vue-demi": { + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/vue-demi/-/vue-demi-0.14.5.tgz", + "integrity": "sha512-o9NUVpl/YlsGJ7t+xuqJKx8EBGf1quRhCiT6D/J0pfwmk9zUwYkC7yrF4SZCe6fETvSM3UNL2edcbYrSyc4QHA==", + "hasInstallScript": true, + "bin": { + "vue-demi-fix": "bin/vue-demi-fix.js", + "vue-demi-switch": "bin/vue-demi-switch.js" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/antfu" + }, + "peerDependencies": { + "@vue/composition-api": "^1.0.0-rc.1", + "vue": "^3.0.0-0 || ^2.6.0" + }, + "peerDependenciesMeta": { + "@vue/composition-api": { + "optional": true + } + } + }, "node_modules/acorn": { "version": "8.8.2", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz", @@ -7899,6 +7996,11 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/nprogress": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/nprogress/-/nprogress-0.2.0.tgz", + "integrity": "sha512-I19aIingLgR1fmhftnbWWO3dXc0hSxqHQHQb3H8m+K3TnEn/iSeTZZOyvKXWqQESMwuUVnatlCnZdLBZZt2VSA==" + }, "node_modules/nth-check": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-2.1.1.tgz", @@ -12998,6 +13100,12 @@ "integrity": "sha512-Gj7cI7z+98M282Tqmp2K5EIsoouUEzbBJhQQzDE3jSIRk6r9gsz0oUokqIUR4u1R3dMHo0pDHM7sNOHyhulypw==", "dev": true }, + "@types/nprogress": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/@types/nprogress/-/nprogress-0.2.0.tgz", + "integrity": "sha512-1cYJrqq9GezNFPsWTZpFut/d4CjpZqA0vhqDUPFWYKF1oIyBz5qnoYMzR+0C/T96t3ebLAC1SSnwrVOm5/j74A==", + "dev": true + }, "@types/qs": { "version": "6.9.7", "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.7.tgz", @@ -13025,6 +13133,11 @@ "integrity": "sha512-zqqcGKyNWgTLFBxmaexGUKQyWqeG7HjXj20EuQJSJWwXe54BjX0ihIo5cJB9yAQzH8dNugJ9GvkBYMjPXs/PJw==", "dev": true }, + "@types/web-bluetooth": { + "version": "0.0.17", + "resolved": "https://registry.npmjs.org/@types/web-bluetooth/-/web-bluetooth-0.0.17.tgz", + "integrity": "sha512-4p9vcSmxAayx72yn70joFoL44c9MO/0+iVEBIQXe3v2h2SiAsEIo/G5v6ObFWvNKRFjbrVadNf9LqEEZeQPzdA==" + }, "@typescript-eslint/eslint-plugin": { "version": "5.60.1", "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.60.1.tgz", @@ -13542,6 +13655,46 @@ "@vue/language-core": "1.8.1" } }, + "@vueuse/core": { + "version": "10.2.1", + "resolved": "https://registry.npmjs.org/@vueuse/core/-/core-10.2.1.tgz", + "integrity": "sha512-c441bfMbkAwTNwVRHQ0zdYZNETK//P84rC01aP2Uy/aRFCiie9NE/k9KdIXbno0eDYP5NPUuWv0aA/I4Unr/7w==", + "requires": { + "@types/web-bluetooth": "^0.0.17", + "@vueuse/metadata": "10.2.1", + "@vueuse/shared": "10.2.1", + "vue-demi": ">=0.14.5" + }, + "dependencies": { + "vue-demi": { + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/vue-demi/-/vue-demi-0.14.5.tgz", + "integrity": "sha512-o9NUVpl/YlsGJ7t+xuqJKx8EBGf1quRhCiT6D/J0pfwmk9zUwYkC7yrF4SZCe6fETvSM3UNL2edcbYrSyc4QHA==", + "requires": {} + } + } + }, + "@vueuse/metadata": { + "version": "10.2.1", + "resolved": "https://registry.npmjs.org/@vueuse/metadata/-/metadata-10.2.1.tgz", + "integrity": "sha512-3Gt68mY/i6bQvFqx7cuGBzrCCQu17OBaGWS5JdwISpMsHnMKKjC2FeB5OAfMcCQ0oINfADP3i9A4PPRo0peHdQ==" + }, + "@vueuse/shared": { + "version": "10.2.1", + "resolved": "https://registry.npmjs.org/@vueuse/shared/-/shared-10.2.1.tgz", + "integrity": "sha512-QWHq2bSuGptkcxx4f4M/fBYC3Y8d3M2UYyLsyzoPgEoVzJURQ0oJeWXu79OiLlBb8gTKkqe4mO85T/sf39mmiw==", + "requires": { + "vue-demi": ">=0.14.5" + }, + "dependencies": { + "vue-demi": { + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/vue-demi/-/vue-demi-0.14.5.tgz", + "integrity": "sha512-o9NUVpl/YlsGJ7t+xuqJKx8EBGf1quRhCiT6D/J0pfwmk9zUwYkC7yrF4SZCe6fETvSM3UNL2edcbYrSyc4QHA==", + "requires": {} + } + } + }, "acorn": { "version": "8.8.2", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz", @@ -17331,6 +17484,11 @@ } } }, + "nprogress": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/nprogress/-/nprogress-0.2.0.tgz", + "integrity": "sha512-I19aIingLgR1fmhftnbWWO3dXc0hSxqHQHQb3H8m+K3TnEn/iSeTZZOyvKXWqQESMwuUVnatlCnZdLBZZt2VSA==" + }, "nth-check": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-2.1.1.tgz", diff --git a/package.json b/package.json index d0190ce..6ba2f87 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,7 @@ }, "dependencies": { "@types/diff": "^5.0.3", + "@vueuse/core": "^10.2.1", "axios": "^1.2.2", "dayjs": "^1.11.7", "diff": "^5.1.0", @@ -27,6 +28,7 @@ "less": "^4.1.3", "md5": "^2.3.0", "normalize.css": "^8.0.1", + "nprogress": "^0.2.0", "pinia": "^2.0.30", "postcss-preset-env": "^7.8.3", "qs": "^6.11.1", @@ -46,6 +48,7 @@ "@types/js-cookie": "^3.0.3", "@types/js-md5": "^0.7.0", "@types/node": "^18.11.18", + "@types/nprogress": "^0.2.0", "@types/qs": "^6.9.7", "@types/url-parse": "^1.4.8", "@typescript-eslint/eslint-plugin": "^5.60.1", diff --git a/src/App.vue b/src/App.vue index f3627e8..1a86bd3 100644 --- a/src/App.vue +++ b/src/App.vue @@ -9,6 +9,12 @@ \ No newline at end of file diff --git a/src/charts/cluster-management/DiskPerformanceBPSReadChart.vue b/src/charts/cluster-management/DiskPerformanceBPSReadChart.vue deleted file mode 100644 index f548dcb..0000000 --- a/src/charts/cluster-management/DiskPerformanceBPSReadChart.vue +++ /dev/null @@ -1,117 +0,0 @@ - - - \ No newline at end of file diff --git a/src/charts/cluster-management/DiskPerformanceBPSWriteChart.vue b/src/charts/cluster-management/DiskPerformanceBPSWriteChart.vue deleted file mode 100644 index a97cce2..0000000 --- a/src/charts/cluster-management/DiskPerformanceBPSWriteChart.vue +++ /dev/null @@ -1,121 +0,0 @@ - - - \ No newline at end of file diff --git a/src/charts/cluster-management/DiskPerformanceIOPSReadChart.vue b/src/charts/cluster-management/DiskPerformanceIOPSReadChart.vue deleted file mode 100644 index eb97e76..0000000 --- a/src/charts/cluster-management/DiskPerformanceIOPSReadChart.vue +++ /dev/null @@ -1,115 +0,0 @@ - - - \ No newline at end of file diff --git a/src/charts/cluster-management/DiskPerformanceIOPSWriteChart.vue b/src/charts/cluster-management/DiskPerformanceIOPSWriteChart.vue deleted file mode 100644 index 0a74540..0000000 --- a/src/charts/cluster-management/DiskPerformanceIOPSWriteChart.vue +++ /dev/null @@ -1,110 +0,0 @@ - - - \ No newline at end of file diff --git a/src/charts/cluster-management/MemoryUtilizationChart.vue b/src/charts/cluster-management/MemoryUtilizationChart.vue deleted file mode 100644 index 524cf3b..0000000 --- a/src/charts/cluster-management/MemoryUtilizationChart.vue +++ /dev/null @@ -1,94 +0,0 @@ - - - \ No newline at end of file diff --git a/src/charts/cluster-management/NetworkTrafficReceiveChart.vue b/src/charts/cluster-management/NetworkTrafficReceiveChart.vue deleted file mode 100644 index 40433f9..0000000 --- a/src/charts/cluster-management/NetworkTrafficReceiveChart.vue +++ /dev/null @@ -1,111 +0,0 @@ - - - diff --git a/src/charts/cluster-management/NetworkTrafficTransmitChart.vue b/src/charts/cluster-management/NetworkTrafficTransmitChart.vue deleted file mode 100644 index e77c95e..0000000 --- a/src/charts/cluster-management/NetworkTrafficTransmitChart.vue +++ /dev/null @@ -1,115 +0,0 @@ - - - \ No newline at end of file diff --git a/src/components/TrendChartTimePicker/index.vue b/src/components/TrendChartTimePicker/index.vue index 7d54dd5..fc7149f 100644 --- a/src/components/TrendChartTimePicker/index.vue +++ b/src/components/TrendChartTimePicker/index.vue @@ -1,12 +1,12 @@