aboutsummaryrefslogtreecommitdiff
path: root/src-vue/src/views/RepairView.vue
diff options
context:
space:
mode:
authorGeckoEidechse <40122905+GeckoEidechse@users.noreply.github.com>2023-03-12 18:06:57 +0100
committerGitHub <noreply@github.com>2023-03-12 17:06:57 +0000
commite04dcba35faaae09886d60f685ec13359a057890 (patch)
tree80cf9de3d7a04b16636e42dc6d16bf67f0520d67 /src-vue/src/views/RepairView.vue
parent82739f56b198054acbde53527e9eb39fa14f2602 (diff)
downloadFlightCore-e04dcba35faaae09886d60f685ec13359a057890.tar.gz
FlightCore-e04dcba35faaae09886d60f685ec13359a057890.zip
refactor: Move buttons to repair window (#207)
Diffstat (limited to 'src-vue/src/views/RepairView.vue')
-rw-r--r--src-vue/src/views/RepairView.vue86
1 files changed, 86 insertions, 0 deletions
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>