From 37d7c0efbf603f5add6cd3ece054fe8f99d959ca Mon Sep 17 00:00:00 2001 From: Vitalii Date: Tue, 14 Mar 2023 16:36:19 +0200 Subject: [PATCH] web/satellite: migrate VChart component to use SFC composition API Upgraded chart.js dependency to V4. Removed vue-chart and types/chart.js dependencies. Refactored VChart component to rely only on chart.js dep without any additional wrappers. Refactored VChart component to use SFC composition API. Change-Id: Ic5e0131bff413f3205d4449db930644d113fe36d --- web/satellite/package-lock.json | 129 ++------ web/satellite/package.json | 4 +- .../components/account/NewSettingsArea.vue | 6 +- .../src/components/common/VChart.vue | 308 +++++++++--------- .../project/dashboard/BandwidthChart.vue | 54 ++- .../project/dashboard/StorageChart.vue | 33 +- web/satellite/src/types/chart.ts | 173 +--------- 7 files changed, 238 insertions(+), 469 deletions(-) diff --git a/web/satellite/package-lock.json b/web/satellite/package-lock.json index 52a7c7e9b..d6390bed0 100644 --- a/web/satellite/package-lock.json +++ b/web/satellite/package-lock.json @@ -12,7 +12,7 @@ "@hcaptcha/vue-hcaptcha": "0.3.2", "aws-sdk": "2.1128.0", "bip39": "3.0.4", - "chart.js": "2.9.4", + "chart.js": "4.2.1", "core-js": "3.22.4", "graphql": "15.3.0", "load-script": "1.0.0", @@ -24,7 +24,6 @@ "stripe": "8.215.0", "util": "0.12.4", "vue": "2.7.10", - "vue-chartjs": "3.5.1", "vue-class-component": "7.2.6", "vue-clipboard2": "0.3.3", "vue-fragment": "1.6.0", @@ -35,7 +34,6 @@ "vuex": "3.6.2" }, "devDependencies": { - "@types/chart.js": "2.9.36", "@types/filesystem": "0.0.32", "@types/jest": "27.5.0", "@types/node": "16.18.14", @@ -2705,6 +2703,11 @@ "@jridgewell/sourcemap-codec": "^1.4.10" } }, + "node_modules/@kurkle/color": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/@kurkle/color/-/color-0.3.2.tgz", + "integrity": "sha512-fuscdXJ9G1qb7W8VdHi+IwRqij3lBkosAm4ydQtEmbY58OzHXqQhvlxqEkoz0yssNVn38bcpRWgA9PP+OGoisw==" + }, "node_modules/@leichtgewicht/ip-codec": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/@leichtgewicht/ip-codec/-/ip-codec-2.0.4.tgz", @@ -2972,14 +2975,6 @@ "@types/node": "*" } }, - "node_modules/@types/chart.js": { - "version": "2.9.36", - "resolved": "https://registry.npmjs.org/@types/chart.js/-/chart.js-2.9.36.tgz", - "integrity": "sha512-lkG9C6O5TqKyW3JDWMfCedVUATH4AeQCo8Q/vflT/0VDj6KMcba+jr1wLe+IXQ+F9mVWn80DVsDnt6cPuGutIg==", - "dependencies": { - "moment": "^2.10.2" - } - }, "node_modules/@types/connect": { "version": "3.4.35", "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.35.tgz", @@ -5605,29 +5600,14 @@ } }, "node_modules/chart.js": { - "version": "2.9.4", - "resolved": "https://registry.npmjs.org/chart.js/-/chart.js-2.9.4.tgz", - "integrity": "sha512-B07aAzxcrikjAPyV+01j7BmOpxtQETxTSlQ26BEYJ+3iUkbNKaOJ/nDbT6JjyqYxseM0ON12COHYdU2cTIjC7A==", + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/chart.js/-/chart.js-4.2.1.tgz", + "integrity": "sha512-6YbpQ0nt3NovAgOzbkSSeeAQu/3za1319dPUQTXn9WcOpywM8rGKxJHrhS8V8xEkAlk8YhEfjbuAPfUyp6jIsw==", "dependencies": { - "chartjs-color": "^2.1.0", - "moment": "^2.10.2" - } - }, - "node_modules/chartjs-color": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/chartjs-color/-/chartjs-color-2.4.1.tgz", - "integrity": "sha512-haqOg1+Yebys/Ts/9bLo/BqUcONQOdr/hoEr2LLTRl6C5LXctUdHxsCYfvQVg5JIxITrfCNUDr4ntqmQk9+/0w==", - "dependencies": { - "chartjs-color-string": "^0.6.0", - "color-convert": "^1.9.3" - } - }, - "node_modules/chartjs-color-string": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/chartjs-color-string/-/chartjs-color-string-0.6.0.tgz", - "integrity": "sha512-TIB5OKn1hPJvO7JcteW4WY/63v6KwEdt6udfnDE9iCAZgy+V4SrbSxoIbTw/xkUIapjEI4ExGtD0+6D3KyFd7A==", - "dependencies": { - "color-name": "^1.0.0" + "@kurkle/color": "^0.3.0" + }, + "engines": { + "pnpm": "^7.0.0" } }, "node_modules/chokidar": { @@ -5945,6 +5925,7 @@ "version": "1.9.3", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, "dependencies": { "color-name": "1.1.3" } @@ -5952,7 +5933,8 @@ "node_modules/color-convert/node_modules/color-name": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==" + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", + "dev": true }, "node_modules/color-name": { "version": "1.1.4", @@ -13417,14 +13399,6 @@ "integrity": "sha512-A/78XjoX2EmNvppVWEhM2oGk3x4lLxnkEA4jTbaK97QKSDjkIoOsKQlfylt/d3kKKi596Qy3NP5XrXJ6fZIC9Q==", "dev": true }, - "node_modules/moment": { - "version": "2.29.4", - "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.4.tgz", - "integrity": "sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w==", - "engines": { - "node": "*" - } - }, "node_modules/mrmime": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/mrmime/-/mrmime-1.0.1.tgz", @@ -17784,21 +17758,6 @@ "csstype": "^3.1.0" } }, - "node_modules/vue-chartjs": { - "version": "3.5.1", - "resolved": "https://registry.npmjs.org/vue-chartjs/-/vue-chartjs-3.5.1.tgz", - "integrity": "sha512-foocQbJ7FtveICxb4EV5QuVpo6d8CmZFmAopBppDIGKY+esJV8IJgwmEW0RexQhxqXaL/E1xNURsgFFYyKzS/g==", - "dependencies": { - "@types/chart.js": "^2.7.55" - }, - "engines": { - "node": ">=6.9.0", - "npm": ">= 3.0.0" - }, - "peerDependencies": { - "chart.js": ">= 2.5" - } - }, "node_modules/vue-class-component": { "version": "7.2.6", "resolved": "https://registry.npmjs.org/vue-class-component/-/vue-class-component-7.2.6.tgz", @@ -21016,6 +20975,11 @@ "@jridgewell/sourcemap-codec": "^1.4.10" } }, + "@kurkle/color": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/@kurkle/color/-/color-0.3.2.tgz", + "integrity": "sha512-fuscdXJ9G1qb7W8VdHi+IwRqij3lBkosAm4ydQtEmbY58OzHXqQhvlxqEkoz0yssNVn38bcpRWgA9PP+OGoisw==" + }, "@leichtgewicht/ip-codec": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/@leichtgewicht/ip-codec/-/ip-codec-2.0.4.tgz", @@ -21243,14 +21207,6 @@ "@types/node": "*" } }, - "@types/chart.js": { - "version": "2.9.36", - "resolved": "https://registry.npmjs.org/@types/chart.js/-/chart.js-2.9.36.tgz", - "integrity": "sha512-lkG9C6O5TqKyW3JDWMfCedVUATH4AeQCo8Q/vflT/0VDj6KMcba+jr1wLe+IXQ+F9mVWn80DVsDnt6cPuGutIg==", - "requires": { - "moment": "^2.10.2" - } - }, "@types/connect": { "version": "3.4.35", "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.35.tgz", @@ -23258,29 +23214,11 @@ "dev": true }, "chart.js": { - "version": "2.9.4", - "resolved": "https://registry.npmjs.org/chart.js/-/chart.js-2.9.4.tgz", - "integrity": "sha512-B07aAzxcrikjAPyV+01j7BmOpxtQETxTSlQ26BEYJ+3iUkbNKaOJ/nDbT6JjyqYxseM0ON12COHYdU2cTIjC7A==", + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/chart.js/-/chart.js-4.2.1.tgz", + "integrity": "sha512-6YbpQ0nt3NovAgOzbkSSeeAQu/3za1319dPUQTXn9WcOpywM8rGKxJHrhS8V8xEkAlk8YhEfjbuAPfUyp6jIsw==", "requires": { - "chartjs-color": "^2.1.0", - "moment": "^2.10.2" - } - }, - "chartjs-color": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/chartjs-color/-/chartjs-color-2.4.1.tgz", - "integrity": "sha512-haqOg1+Yebys/Ts/9bLo/BqUcONQOdr/hoEr2LLTRl6C5LXctUdHxsCYfvQVg5JIxITrfCNUDr4ntqmQk9+/0w==", - "requires": { - "chartjs-color-string": "^0.6.0", - "color-convert": "^1.9.3" - } - }, - "chartjs-color-string": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/chartjs-color-string/-/chartjs-color-string-0.6.0.tgz", - "integrity": "sha512-TIB5OKn1hPJvO7JcteW4WY/63v6KwEdt6udfnDE9iCAZgy+V4SrbSxoIbTw/xkUIapjEI4ExGtD0+6D3KyFd7A==", - "requires": { - "color-name": "^1.0.0" + "@kurkle/color": "^0.3.0" } }, "chokidar": { @@ -23522,6 +23460,7 @@ "version": "1.9.3", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, "requires": { "color-name": "1.1.3" }, @@ -23529,7 +23468,8 @@ "color-name": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==" + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", + "dev": true } } }, @@ -29128,11 +29068,6 @@ "integrity": "sha512-A/78XjoX2EmNvppVWEhM2oGk3x4lLxnkEA4jTbaK97QKSDjkIoOsKQlfylt/d3kKKi596Qy3NP5XrXJ6fZIC9Q==", "dev": true }, - "moment": { - "version": "2.29.4", - "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.4.tgz", - "integrity": "sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w==" - }, "mrmime": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/mrmime/-/mrmime-1.0.1.tgz", @@ -32329,14 +32264,6 @@ "csstype": "^3.1.0" } }, - "vue-chartjs": { - "version": "3.5.1", - "resolved": "https://registry.npmjs.org/vue-chartjs/-/vue-chartjs-3.5.1.tgz", - "integrity": "sha512-foocQbJ7FtveICxb4EV5QuVpo6d8CmZFmAopBppDIGKY+esJV8IJgwmEW0RexQhxqXaL/E1xNURsgFFYyKzS/g==", - "requires": { - "@types/chart.js": "^2.7.55" - } - }, "vue-class-component": { "version": "7.2.6", "resolved": "https://registry.npmjs.org/vue-class-component/-/vue-class-component-7.2.6.tgz", diff --git a/web/satellite/package.json b/web/satellite/package.json index a3264bd4e..ce9eb5ab2 100644 --- a/web/satellite/package.json +++ b/web/satellite/package.json @@ -17,7 +17,7 @@ "@hcaptcha/vue-hcaptcha": "0.3.2", "aws-sdk": "2.1128.0", "bip39": "3.0.4", - "chart.js": "2.9.4", + "chart.js": "4.2.1", "core-js": "3.22.4", "graphql": "15.3.0", "load-script": "1.0.0", @@ -29,7 +29,6 @@ "stripe": "8.215.0", "util": "0.12.4", "vue": "2.7.10", - "vue-chartjs": "3.5.1", "vue-class-component": "7.2.6", "vue-clipboard2": "0.3.3", "vue-fragment": "1.6.0", @@ -40,7 +39,6 @@ "vuex": "3.6.2" }, "devDependencies": { - "@types/chart.js": "2.9.36", "@types/filesystem": "0.0.32", "@types/jest": "27.5.0", "@types/node": "16.18.14", diff --git a/web/satellite/src/components/account/NewSettingsArea.vue b/web/satellite/src/components/account/NewSettingsArea.vue index ad4df2bfa..3ae1afe2c 100644 --- a/web/satellite/src/components/account/NewSettingsArea.vue +++ b/web/satellite/src/components/account/NewSettingsArea.vue @@ -222,7 +222,7 @@ onMounted(() => { @media screen and (max-width: 500px) { display: flex; flex-direction: column; - align-items: start; + align-items: flex-start; justify-content: center; gap: 10px; } @@ -243,12 +243,12 @@ onMounted(() => { &__actions { display: flex; align-items: center; - justify-content: end; + justify-content: flex-end; gap: 5px; @media screen and (max-width: 500px) { width: 100%; - justify-content: start; + justify-content: flex-start; } } } diff --git a/web/satellite/src/components/common/VChart.vue b/web/satellite/src/components/common/VChart.vue index ebf666040..1243896a7 100644 --- a/web/satellite/src/components/common/VChart.vue +++ b/web/satellite/src/components/common/VChart.vue @@ -1,192 +1,174 @@ -// Copyright (C) 2021 Storj Labs, Inc. +// Copyright (C) 2023 Storj Labs, Inc. // See LICENSE for copying information. - diff --git a/web/satellite/src/components/project/dashboard/BandwidthChart.vue b/web/satellite/src/components/project/dashboard/BandwidthChart.vue index 15dd2df6c..2d02f5dad 100644 --- a/web/satellite/src/components/project/dashboard/BandwidthChart.vue +++ b/web/satellite/src/components/project/dashboard/BandwidthChart.vue @@ -3,8 +3,8 @@