aboutsummaryrefslogtreecommitdiff
path: root/src-vue/src/views
diff options
context:
space:
mode:
authorGeckoEidechse <40122905+GeckoEidechse@users.noreply.github.com>2023-05-10 13:23:57 +0200
committerGitHub <noreply@github.com>2023-05-10 13:23:57 +0200
commitcd07d7d48b2b3d98c3d14967c3eea52aaa8f3a11 (patch)
tree80156d89ad2bce4d2e811df51581e9d77e381347 /src-vue/src/views
parent4bc48e645ce39f7cbf621c27f6a096bbef33cb45 (diff)
downloadFlightCore-cd07d7d48b2b3d98c3d14967c3eea52aaa8f3a11.tar.gz
FlightCore-cd07d7d48b2b3d98c3d14967c3eea52aaa8f3a11.zip
feat: Add button to install older Northstar version in DevView (#325)
Adds a button to DevView that allows installing older Northstar versions from Thunderstore
Diffstat (limited to 'src-vue/src/views')
-rw-r--r--src-vue/src/views/DeveloperView.vue64
1 files changed, 64 insertions, 0 deletions
diff --git a/src-vue/src/views/DeveloperView.vue b/src-vue/src/views/DeveloperView.vue
index ab3d2ba6..59c7927f 100644
--- a/src-vue/src/views/DeveloperView.vue
+++ b/src-vue/src/views/DeveloperView.vue
@@ -31,6 +31,26 @@
Launch Northstar via Steam
</el-button>
+ <br />
+ <br />
+
+ <el-button type="primary" @click="getAvailableNorthstarVersions">
+ Get available versions
+ </el-button>
+
+ <el-select v-model="selected_ns_version" class="m-2" placeholder="Versions">
+ <el-option
+ v-for="item in ns_versions"
+ :key="item.value"
+ :label="item.label"
+ :value="item"
+ />
+ </el-select>
+
+ <el-button type="primary" @click="installNorthstarVersion">
+ Install
+ </el-button>
+
<h3>Repair:</h3>
@@ -98,6 +118,7 @@ import { defineComponent } from "vue";
import { invoke } from "@tauri-apps/api";
import { GameInstall } from "../utils/GameInstall";
import { TagWrapper } from "../../../src-tauri/bindings/TagWrapper";
+import { NorthstarThunderstoreReleaseWrapper } from "../../../src-tauri/bindings/NorthstarThunderstoreReleaseWrapper";
import PullRequestsSelector from "../components/PullRequestsSelector.vue";
import { showErrorNotification, showNotification } from "../utils/ui";
import { Project } from "../../../src-tauri/bindings/Project"
@@ -114,6 +135,8 @@ export default defineComponent({
first_tag: { label: '', value: { name: '' } },
second_tag: { label: '', value: { name: '' } },
ns_release_tags: [] as TagWrapper[],
+ ns_versions: [] as NorthstarThunderstoreReleaseWrapper[],
+ selected_ns_version: { label: '', value: { package: '', version: '' } } as NorthstarThunderstoreReleaseWrapper,
selected_project: "FlightCore",
project: [
{
@@ -220,6 +243,47 @@ export default defineComponent({
showErrorNotification(error);
});
},
+ async getAvailableNorthstarVersions() {
+ await invoke<NorthstarThunderstoreReleaseWrapper[]>("get_available_northstar_versions")
+ .then((message) => {
+ this.ns_versions = message;
+ showNotification("Done", "Fetched all available Northstar versions");
+ })
+ .catch((error) => {
+ showErrorNotification(error);
+ });
+ },
+ async installNorthstarVersion() {
+ 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 = showNotification(
+ `Installing Northstar version v${this.selected_ns_version.value.version}`,
+ "Please wait",
+ 'info',
+ 0
+ );
+
+ let install_northstar_result = invoke("install_northstar_caller", { gamePath: game_install.game_path, northstarPackageName: this.selected_ns_version.value.package, versionNumber: this.selected_ns_version.value.version });
+
+ await install_northstar_result
+ .then((message) => {
+ // Send notification
+ showNotification(this.$t('generic.done'), this.$t('settings.repair.window.reinstall_success'));
+ this.$store.commit('checkNorthstarUpdates');
+ })
+ .catch((error) => {
+ showErrorNotification(error);
+ console.error(error);
+ })
+ .finally(() => {
+ // Clear old notification
+ notification.close();
+ });
+ },
}
});
</script>