From e04dcba35faaae09886d60f685ec13359a057890 Mon Sep 17 00:00:00 2001 From: GeckoEidechse <40122905+GeckoEidechse@users.noreply.github.com> Date: Sun, 12 Mar 2023 18:06:57 +0100 Subject: refactor: Move buttons to repair window (#207) --- src-vue/src/views/DeveloperView.vue | 84 ------------------------------------ src-vue/src/views/RepairView.vue | 86 +++++++++++++++++++++++++++++++++++++ 2 files changed, 86 insertions(+), 84 deletions(-) (limited to 'src-vue') diff --git a/src-vue/src/views/DeveloperView.vue b/src-vue/src/views/DeveloperView.vue index 665e2e55..b8c8c242 100644 --- a/src-vue/src/views/DeveloperView.vue +++ b/src-vue/src/views/DeveloperView.vue @@ -41,22 +41,10 @@ Open Repair window - - Force reinstall Northstar - - Get installed mods - - Force delete temp download folder - - - - Delete FlightCore persistent store - -

Testing

@@ -68,10 +56,7 @@ import { defineComponent } from "vue"; import { invoke } from "@tauri-apps/api"; import { ElNotification } from "element-plus"; import { GameInstall } from "../utils/GameInstall"; -import { Store } from 'tauri-plugin-store-api'; -import { ReleaseCanal } from "../utils/ReleaseCanal"; import PullRequestsSelector from "../components/PullRequestsSelector.vue"; -const persistentStore = new Store('flight-core-settings.json'); export default defineComponent({ name: "DeveloperView", @@ -170,76 +155,7 @@ export default defineComponent({ }); }); }, - async cleanUpDownloadFolder() { - let game_install = { - game_path: this.$store.state.game_path, - install_type: this.$store.state.install_type - } as GameInstall; - await invoke("clean_up_download_folder_caller", { gameInstall: game_install, force: true }).then((message) => { - // Show user notification if task completed. - ElNotification({ - title: `Done`, - message: `Done`, - type: 'success', - position: 'bottom-right' - }); - }) - .catch((error) => { - ElNotification({ - title: 'Error', - message: error, - type: 'error', - position: 'bottom-right' - }); - }); - }, - async clearFlightCorePersistentStore() { - // Clear store... - await persistentStore.clear(); - // ...and save - await persistentStore.save(); - }, - async forceInstallNorthstar() { - let game_install = { - game_path: this.$store.state.game_path, - install_type: this.$store.state.install_type - } as GameInstall; - - // Send notification telling the user to wait for the process to finish - const notification = ElNotification({ - title: 'Force reinstalling Northstar', - message: 'Please wait', - duration: 0, - type: 'info', - position: 'bottom-right' - }); - let install_northstar_result = invoke("install_northstar_caller", { gamePath: game_install.game_path, northstarPackageName: ReleaseCanal.RELEASE }); - await install_northstar_result - .then((message) => { - // Send notification - ElNotification({ - title: `Done`, - message: `Successfully reinstalled Northstar`, - type: 'success', - position: 'bottom-right' - }); - this.$store.commit('checkNorthstarUpdates'); - }) - .catch((error) => { - ElNotification({ - title: 'Error', - message: error, - type: 'error', - position: 'bottom-right' - }); - console.error(error); - }) - .finally(() => { - // Clear old notification - notification.close(); - }); - }, async createNewWindow() { await invoke("open_repair_window") .then((message) => { }) diff --git a/src-vue/src/views/RepairView.vue b/src-vue/src/views/RepairView.vue index cf19e3e6..e7cd479a 100644 --- a/src-vue/src/views/RepairView.vue +++ b/src-vue/src/views/RepairView.vue @@ -13,6 +13,19 @@ Disable all but core mods + + Force reinstall Northstar + + +

FlightCore

+ + + Force delete temp download folder + + + + Delete FlightCore persistent store + @@ -22,6 +35,9 @@ import { defineComponent } from "vue"; import { ElNotification } from "element-plus"; import { GameInstall } from "../utils/GameInstall"; import { invoke } from "@tauri-apps/api"; +import { ReleaseCanal } from "../utils/ReleaseCanal"; +import { Store } from 'tauri-plugin-store-api'; +const persistentStore = new Store('flight-core-settings.json'); export default defineComponent({ name: "RepairView", @@ -49,6 +65,76 @@ export default defineComponent({ }); }); }, + async forceInstallNorthstar() { + let game_install = { + game_path: this.$store.state.game_path, + install_type: this.$store.state.install_type + } as GameInstall; + + // Send notification telling the user to wait for the process to finish + const notification = ElNotification({ + title: 'Force reinstalling Northstar', + message: 'Please wait', + duration: 0, + type: 'info', + position: 'bottom-right' + }); + + let install_northstar_result = invoke("install_northstar_caller", { gamePath: game_install.game_path, northstarPackageName: ReleaseCanal.RELEASE }); + await install_northstar_result + .then((message) => { + // Send notification + ElNotification({ + title: `Done`, + message: `Successfully reinstalled Northstar`, + type: 'success', + position: 'bottom-right' + }); + this.$store.commit('checkNorthstarUpdates'); + }) + .catch((error) => { + ElNotification({ + title: 'Error', + message: error, + type: 'error', + position: 'bottom-right' + }); + console.error(error); + }) + .finally(() => { + // Clear old notification + notification.close(); + }); + }, + async cleanUpDownloadFolder() { + let game_install = { + game_path: this.$store.state.game_path, + install_type: this.$store.state.install_type + } as GameInstall; + await invoke("clean_up_download_folder_caller", { gameInstall: game_install, force: true }).then((message) => { + // Show user notification if task completed. + ElNotification({ + title: `Done`, + message: `Done`, + type: 'success', + position: 'bottom-right' + }); + }) + .catch((error) => { + ElNotification({ + title: 'Error', + message: error, + type: 'error', + position: 'bottom-right' + }); + }); + }, + async clearFlightCorePersistentStore() { + // Clear store... + await persistentStore.clear(); + // ...and save + await persistentStore.save(); + }, } }); -- cgit v1.2.3