diff options
author | GeckoEidechse <40122905+GeckoEidechse@users.noreply.github.com> | 2023-03-12 18:06:57 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-12 17:06:57 +0000 |
commit | e04dcba35faaae09886d60f685ec13359a057890 (patch) | |
tree | 80cf9de3d7a04b16636e42dc6d16bf67f0520d67 | |
parent | 82739f56b198054acbde53527e9eb39fa14f2602 (diff) | |
download | FlightCore-e04dcba35faaae09886d60f685ec13359a057890.tar.gz FlightCore-e04dcba35faaae09886d60f685ec13359a057890.zip |
refactor: Move buttons to repair window (#207)
-rw-r--r-- | src-vue/src/views/DeveloperView.vue | 84 | ||||
-rw-r--r-- | src-vue/src/views/RepairView.vue | 86 |
2 files changed, 86 insertions, 84 deletions
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 </el-button> - <el-button type="primary" @click="forceInstallNorthstar"> - Force reinstall Northstar - </el-button> - <el-button type="primary" @click="getInstalledMods"> Get installed mods </el-button> - <el-button type="primary" @click="cleanUpDownloadFolder"> - Force delete temp download folder - </el-button> - - <el-button type="primary" @click="clearFlightCorePersistentStore"> - Delete FlightCore persistent store - </el-button> - <h3>Testing</h3> <pull-requests-selector /> </el-scrollbar> @@ -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 </el-button> + <el-button type="primary" @click="forceInstallNorthstar"> + Force reinstall Northstar + </el-button> + + <h2>FlightCore</h2> + + <el-button type="primary" @click="cleanUpDownloadFolder"> + Force delete temp download folder + </el-button> + + <el-button type="primary" @click="clearFlightCorePersistentStore"> + Delete FlightCore persistent store + </el-button> </el-scrollbar> </div> </template> @@ -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(); + }, } }); </script> |