Explorar el Código

refactor: YouTube api chart tweaks

Owen Diffey hace 2 años
padre
commit
ba7d7c7df3
Se han modificado 2 ficheros con 26 adiciones y 24 borrados
  1. 26 5
      backend/logic/youtube.js
  2. 0 19
      frontend/src/components/modals/BulkActions.vue

+ 26 - 5
backend/logic/youtube.js

@@ -421,11 +421,32 @@ class _YouTubeModule extends CoreClass {
 							channels: "rgb(2, 242, 166)",
 							playlistItems: "rgb(242, 166, 2)"
 						};
-						chartData.datasets = datasetTypes.map(datasetType => ({
-							label: datasetType,
-							backgroundColor: colors[datasetType],
-							data: timeRanges.map(timeRange => timeRange.data[datasetType])
-						}));
+						chartData.datasets = datasetTypes.map(datasetType => {
+							let label;
+							switch (datasetType) {
+								case "total":
+									label = "Total";
+									break;
+								case "videos":
+									label = "Videos";
+									break;
+								case "search":
+									label = "Search";
+									break;
+								case "playlistItems":
+									label = "Playlist Items";
+									break;
+								default:
+									label = datasetType;
+							}
+							return {
+								label,
+								borderColor: colors[datasetType],
+								backgroundColor: colors[datasetType],
+								data: timeRanges.map(timeRange => timeRange.data[datasetType])
+							};
+						});
+
 						next(null, chartData);
 					}
 				],

+ 0 - 19
frontend/src/components/modals/BulkActions.vue

@@ -131,7 +131,6 @@ export default {
 			this.items.splice(index, 1);
 		},
 		applyChanges() {
-			let toast;
 			let id;
 			let title;
 
@@ -147,24 +146,6 @@ export default {
 						// 	this.closeCurrentModal();
 					},
 					onProgress: res => {
-						if (!toast) {
-							toast = new Toast({
-								content: res.message,
-								persistent: true,
-								interactable: false
-							});
-						} else {
-							toast.content = res.message;
-						}
-						if (
-							res.status === "success" ||
-							res.status === "error"
-						) {
-							setTimeout(() => {
-								toast.destroy();
-							}, 4000);
-						}
-
 						if (res.status === "started") {
 							id = res.id;
 							title = res.title;