Переглянути джерело

fix: Some jobs available to run in admin area werent configured as long jobs

Owen Diffey 1 рік тому
батько
коміт
47aeda3ba2

+ 38 - 2
backend/logic/actions/soundcloud.js

@@ -17,14 +17,32 @@ export default {
 	 * @returns {{status: string, data: object}}
 	 */
 	fetchNewApiKey: useHasPermission("soundcloud.fetchNewApiKey", function fetchNewApiKey(session, cb) {
+		this.keepLongJob();
+		this.publishProgress({
+			status: "started",
+			title: "Fetch new SoundCloud API key",
+			message: "Fetching new SoundCloud API key.",
+			id: this.toString()
+		});
 		SoundcloudModule.runJob("GENERATE_SOUNDCLOUD_API_KEY", {}, this)
 			.then(response => {
 				this.log("SUCCESS", "SOUNDCLOUD_FETCH_NEW_API_KEY", `Fetching new API key was successful.`);
-				return cb({ status: "success", data: { status: response.status } });
+				this.publishProgress({
+					status: "success",
+					message: "Successfully fetched new SoundCloud API key."
+				});
+				return cb({
+					status: "success",
+					data: { response }
+				});
 			})
 			.catch(async err => {
 				err = await UtilsModule.runJob("GET_ERROR", { error: err }, this);
 				this.log("ERROR", "SOUNDCLOUD_FETCH_NEW_API_KEY", `Fetching new API key failed. "${err}"`);
+				this.publishProgress({
+					status: "error",
+					message: err
+				});
 				return cb({ status: "error", message: err });
 			});
 	}),
@@ -35,6 +53,13 @@ export default {
 	 * @returns {{status: string, data: object}}
 	 */
 	testApiKey: useHasPermission("soundcloud.testApiKey", function testApiKey(session, cb) {
+		this.keepLongJob();
+		this.publishProgress({
+			status: "started",
+			title: "Test SoundCloud API key",
+			message: "Testing SoundCloud API key.",
+			id: this.toString()
+		});
 		SoundcloudModule.runJob("TEST_SOUNDCLOUD_API_KEY", {}, this)
 			.then(response => {
 				this.log(
@@ -42,11 +67,22 @@ export default {
 					"SOUNDCLOUD_TEST_API_KEY",
 					`Testing API key was successful. Response: ${response}.`
 				);
-				return cb({ status: "success", data: { status: response.status } });
+				this.publishProgress({
+					status: "success",
+					message: "Successfully tested SoundCloud API key."
+				});
+				return cb({
+					status: "success",
+					data: { status: response.status }
+				});
 			})
 			.catch(async err => {
 				err = await UtilsModule.runJob("GET_ERROR", { error: err }, this);
 				this.log("ERROR", "SOUNDCLOUD_TEST_API_KEY", `Testing API key failed. "${err}"`);
+				this.publishProgress({
+					status: "error",
+					message: err
+				});
 				return cb({ status: "error", message: err });
 			});
 	}),

+ 30 - 2
backend/logic/actions/youtube.js

@@ -525,15 +525,29 @@ export default {
 	 * @returns {{status: string, data: object}}
 	 */
 	getMissingVideos: useHasPermission("youtube.getMissingVideos", function getMissingVideos(session, cb) {
+		this.keepLongJob();
+		this.publishProgress({
+			status: "started",
+			title: "Get missing YouTube videos",
+			message: "Fetching missing YouTube videos.",
+			id: this.toString()
+		});
 		return YouTubeModule.runJob("GET_MISSING_VIDEOS", {}, this)
 			.then(response => {
 				this.log("SUCCESS", "YOUTUBE_GET_MISSING_VIDEOS", `Getting missing videos was successful.`);
-				console.log("KRIS", response);
+				this.publishProgress({
+					status: "success",
+					message: "Successfully fetched missing YouTube videos."
+				});
 				return cb({ status: "success", data: { ...response } });
 			})
 			.catch(async err => {
 				err = await UtilsModule.runJob("GET_ERROR", { error: err }, this);
 				this.log("ERROR", "YOUTUBE_GET_MISSING_VIDEOS", `Getting missing videos failed. "${err}"`);
+				this.publishProgress({
+					status: "error",
+					message: err
+				});
 				return cb({ status: "error", message: err });
 			});
 	}),
@@ -544,15 +558,29 @@ export default {
 	 * @returns {{status: string, data: object}}
 	 */
 	updateVideosV1ToV2: useHasPermission("youtube.updateVideosV1ToV2", function updateVideosV1ToV2(session, cb) {
+		this.keepLongJob();
+		this.publishProgress({
+			status: "started",
+			title: "Update YouTube videos to v2",
+			message: "Updating YouTube videos from v1 to v2.",
+			id: this.toString()
+		});
 		return YouTubeModule.runJob("UPDATE_VIDEOS_V1_TO_V2", {}, this)
 			.then(response => {
 				this.log("SUCCESS", "YOUTUBE_UPDATE_VIDEOS_V1_TO_V2", `Updating v1 videos to v2 was successful.`);
-				console.log("KRIS", response);
+				this.publishProgress({
+					status: "success",
+					message: "Successfully updated YouTube videos from v1 to v2."
+				});
 				return cb({ status: "success", data: { ...response } });
 			})
 			.catch(async err => {
 				err = await UtilsModule.runJob("GET_ERROR", { error: err }, this);
 				this.log("ERROR", "YOUTUBE_UPDATE_VIDEOS_V1_TO_V2", `Updating v1 videos to v2 failed. "${err}"`);
+				this.publishProgress({
+					status: "error",
+					message: err
+				});
 				return cb({ status: "error", message: err });
 			});
 	}),

+ 1 - 1
backend/package-lock.json

@@ -6,7 +6,7 @@
   "packages": {
     "": {
       "name": "musare-backend",
-      "version": "3.10.0-dev",
+      "version": "3.10.0-rc1",
       "license": "GPL-3.0",
       "dependencies": {
         "async": "^3.2.4",

+ 1 - 1
frontend/src/components/modals/EditPlaylist/index.vue

@@ -452,7 +452,7 @@ onBeforeUnmount(() => {
 								>
 									<template #tippyActions>
 										<i
-											class="material-icons add-to-queue-icon kris111"
+											class="material-icons add-to-queue-icon"
 											v-if="
 												station &&
 												station.requests &&