aboutsummaryrefslogtreecommitdiff
path: root/src-vue/src/views
diff options
context:
space:
mode:
authorGeckoEidechse <40122905+GeckoEidechse@users.noreply.github.com>2023-02-25 16:59:08 +0100
committerGitHub <noreply@github.com>2023-02-25 15:59:08 +0000
commit17c4f45a69a418bfb02134fb568caf7c9f4f20e3 (patch)
tree9037521793d1e721a35a5556aec0ff590a0f8532 /src-vue/src/views
parent7cdabec63c8689c02a9c559665152400d6c86391 (diff)
downloadFlightCore-17c4f45a69a418bfb02134fb568caf7c9f4f20e3.tar.gz
FlightCore-17c4f45a69a418bfb02134fb568caf7c9f4f20e3.zip
feat: Add button to force reinstall Northstar (#154)
* feat: Add button to force reinstall Northstar Useful for reinstalling Northstar after installing a developer version. * fix: Remove leftover `console.log()` * fix: Properly update which NS is installed * feat: Show notification when done Sends a notification to indicate that reinstall process has started and sends a second one once the process has finished/failed while also clearing the old notification.
Diffstat (limited to 'src-vue/src/views')
-rw-r--r--src-vue/src/views/DeveloperView.vue48
1 files changed, 47 insertions, 1 deletions
diff --git a/src-vue/src/views/DeveloperView.vue b/src-vue/src/views/DeveloperView.vue
index 6770caaa..b51e1bf1 100644
--- a/src-vue/src/views/DeveloperView.vue
+++ b/src-vue/src/views/DeveloperView.vue
@@ -40,6 +40,10 @@
Disable all but core mods
</el-button>
+ <el-button type="primary" @click="forceInstallNorthstar">
+ Force reinstall Northstar
+ </el-button>
+
<el-button type="primary" @click="getInstalledMods">
Get installed mods
</el-button>
@@ -61,6 +65,7 @@ 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";
const persistentStore = new Store('flight-core-settings.json');
export default defineComponent({
@@ -207,7 +212,48 @@ export default defineComponent({
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();
+ });
+ },
}
});
</script>