From 0b408de1ef1272361278894dd47f12a34a140d2f Mon Sep 17 00:00:00 2001 From: Yurii Nazarenko Date: Thu, 14 Mar 2024 11:05:01 +0100 Subject: [PATCH] Moving messages to the localization files. Improve the checking of the tasks --- Makefile | 2 +- src/app/rr-manager.js | 18 +++++++++--------- src/app/texts/enu/strings | 9 +++++++-- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index 410cd8f..fbaa654 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ SPK_NAME = rr-manager SPK_VERS = 1.0 -SPK_REV = 20 +SPK_REV = 21 SPK_ICON = src/rr-manager.png DSM_UI_DIR = app diff --git a/src/app/rr-manager.js b/src/app/rr-manager.js index 455bf72..d2e94f4 100644 --- a/src/app/rr-manager.js +++ b/src/app/rr-manager.js @@ -597,7 +597,8 @@ Ext.define('SYNOCOMMUNITY.RRManager.AppWindow', { notify_mail: "", notify_if_error: false, operation_type: "script", - operation: that['rrManagerConfig'][`${task_name}_TASK`] }; + operation: that['rrManagerConfig'][`${task_name}_TASK`] + }; if (token != "") { params.SynoConfirmPWToken = token @@ -718,7 +719,7 @@ Ext.define('SYNOCOMMUNITY.RRManager.AppWindow', { window.open(); }, updateFileRealPath: function () { - return `${this?.rrManagerConfig?.UPLOAD_DIR_PATH}/${this?.rrManagerConfig?.RR_TMP_DIR}/${this.opts.params.filename}`; + return `${this?.rrManagerConfig?.UPLOAD_DIR_PATH}${this?.rrManagerConfig?.RR_TMP_DIR}/${this.opts.params.filename}`; }, onRunRrUpdateManuallyClick: function () { that = this; @@ -1118,14 +1119,12 @@ Ext.define('SYNOCOMMUNITY.RRManager.AppWindow', { var sharesList = x.data.shares; var downloadsShareMetadata = sharesList.find(x => x.path.toLowerCase() == shareName); if (!downloadsShareMetadata) { - var msg = `❗❗❗Attention! The "${that['rrManagerConfig']['SHARE_NAME']}" share not found. Please create the share and restart the app.`; + var msg = formatString(_V('ui', 'share_notfound_msg'), that['rrManagerConfig']['SHARE_NAME']); var tabs = Ext.getCmp('tabsControl'); tabs.getEl().mask(msg, "x-mask-loading"); this.showMsg('error', msg); return; } - //TODO: populate from the config.txt - that.downloadFolderRealPath = downloadsShareMetadata?.additional?.real_path; if (callback) callback(); }); }, @@ -1148,8 +1147,9 @@ Ext.define('SYNOCOMMUNITY.RRManager.AppWindow', { var tasksToCreate = requiredTasks.filter(task => !tasks.find(x => x.name === task.name)); if (tasksToCreate.length > 0) { + that?.getEl().mask(formatString(_V('ui', 'required_components_missing_spinner_msg'), tasksToCreate), "x-mask-loading"); let tasksNames = tasksToCreate.map(task => task.name).join(', '); - that.showPrompt(formatString(_V('ui', 'required_tasks_is_missing'), tasksNames), "Required components missing", + that.showPrompt(formatString(_V('ui', 'required_tasks_is_missing'), tasksNames), _V('ui', 'required_components_missing'), async function (a) { for (let task of tasksToCreate) { if (task.createTaskCallback) { @@ -1159,6 +1159,7 @@ Ext.define('SYNOCOMMUNITY.RRManager.AppWindow', { } // After all tasks have been created, you might want to notify the user. that.showMsg('title', _V('ui', 'tasks_created_msg')); + that?.getEl()?.unmask(); }); } } catch (error) { @@ -1248,8 +1249,7 @@ Ext.define('SYNOCOMMUNITY.RRManager.AppWindow', { uploadData: n, success: (x) => { that?.getEl()?.unmask(); - this.showPrompt(`File has been successfully uploaded to the downloads folder. - Would you like to run update procedure?`, "Confirm update", x => this.onRunRrUpdateManuallyClick()); + this.showPrompt(_V('ui', 'file_uploading_succesfull_msg'), _V('ui', 'update_confirm_title'), x => this.onRunRrUpdateManuallyClick()); }, failure: (x) => { that?.getEl()?.unmask(); @@ -1263,7 +1263,7 @@ Ext.define('SYNOCOMMUNITY.RRManager.AppWindow', { MAX_POST_FILESIZE: Ext.isWebKit ? -1 : window.console && window.console.firebug ? 20971521 : 4294963200, onUploadFile: function (e, that) { //create rr tmp folder - SYNO.API.currentManager.requestAPI("SYNO.FileStation.CreateFolder", "create", "2", { + SYNO.API.currentManager.requestAPI('SYNO.FileStation.CreateFolder', "create", "2", { folder_path: `/${that['rrManagerConfig']['SHARE_NAME']}`, name: that['rrManagerConfig']['RR_TMP_DIR'], force_parent: false diff --git a/src/app/texts/enu/strings b/src/app/texts/enu/strings index 84d5ada..22571e9 100644 --- a/src/app/texts/enu/strings +++ b/src/app/texts/enu/strings @@ -19,15 +19,20 @@ update_rr_confirmation_title = "Confirm update" confirm_system_clean_up_msg = "Would you like to run clean up sustem partition script?" confirm_system_clean_up_title = "Confirm system cleanup" -unable_update_rr_msg= "Unable to update RR: {0}. Please upload the file and try againe." +unable_update_rr_msg = "Unable to update RR: {0}. Please upload the file and try againe." upload_file_dialog_title = "Upload File" select_file = "Select File" loading_text = "Loading..." -system_info= "🖥️System Info:" +system_info = "🖥️System Info:" rr_actions = "RR Loader Actions" required_tasks_is_missing = "❗❗❗The following required tasks {0} are missing in the system. It will require entering your password. Do you want to create them?" tasks_created_msg = "The tasks have been successfully created. Please restart the RR Manager app." +share_notfound_msg = "❗❗❗Attention! The {0} folder not found. Please create the share/folder and restart the app." +required_components_missing-title = "Required components missing" +required_components_missing_spinner_msg = "It seems like some of the tasks are missing in the system: {0}. Please complete the onboarding process before start using RR Manager." +file_uploading_succesfull_msg = "File has been successfully uploaded. Would you like to run update procedure?" +update_confirm_title = "Confirm update" save_addons_changes = "Save addons changes" \ No newline at end of file