diff options
Diffstat (limited to 'src-vue')
-rw-r--r-- | src-vue/package-lock.json | 66 | ||||
-rw-r--r-- | src-vue/package.json | 4 | ||||
-rw-r--r-- | src-vue/src/App.vue | 4 | ||||
-rw-r--r-- | src-vue/src/components/ThunderstoreModCard.vue | 2 | ||||
-rw-r--r-- | src-vue/src/i18n/lang/en.json | 6 | ||||
-rw-r--r-- | src-vue/src/plugins/store.ts | 21 | ||||
-rw-r--r-- | src-vue/src/style.css | 8 | ||||
-rw-r--r-- | src-vue/src/views/DeveloperView.vue | 4 | ||||
-rw-r--r-- | src-vue/src/views/RepairView.vue | 4 | ||||
-rw-r--r-- | src-vue/src/views/SettingsView.vue | 56 |
10 files changed, 121 insertions, 54 deletions
diff --git a/src-vue/package-lock.json b/src-vue/package-lock.json index ded2414b..efe0d2b0 100644 --- a/src-vue/package-lock.json +++ b/src-vue/package-lock.json @@ -10,7 +10,7 @@ "dependencies": { "@element-plus/icons-vue": "^2.0.9", "element-plus": "^2.3.14", - "marked": "^9.1.0", + "marked": "^9.1.1", "tauri-plugin-store-api": "github:tauri-apps/tauri-plugin-store#9bd993aa67766596638bbfd91e79a1bf8f632014", "vue": "^3.2.37", "vue-i18n": "^9.5.0", @@ -22,7 +22,7 @@ "@vitejs/plugin-vue": "^3.1.0", "typescript": "^5.2.2", "vite": "^3.1.0", - "vue-tsc": "^1.8.15" + "vue-tsc": "^1.8.19" } }, "node_modules/@babel/parser": { @@ -218,30 +218,30 @@ } }, "node_modules/@volar/language-core": { - "version": "1.10.1", - "resolved": "https://registry.npmjs.org/@volar/language-core/-/language-core-1.10.1.tgz", - "integrity": "sha512-JnsM1mIPdfGPxmoOcK1c7HYAsL6YOv0TCJ4aW3AXPZN/Jb4R77epDyMZIVudSGjWMbvv/JfUa+rQ+dGKTmgwBA==", + "version": "1.10.4", + "resolved": "https://registry.npmjs.org/@volar/language-core/-/language-core-1.10.4.tgz", + "integrity": "sha512-Na69qA6uwVIdA0rHuOc2W3pHtVQQO8hCNim7FOaKNpRJh0oAFnu5r9i7Oopo5C4cnELZkPNjTrbmpcCTiW+CMQ==", "dev": true, "dependencies": { - "@volar/source-map": "1.10.1" + "@volar/source-map": "1.10.4" } }, "node_modules/@volar/source-map": { - "version": "1.10.1", - "resolved": "https://registry.npmjs.org/@volar/source-map/-/source-map-1.10.1.tgz", - "integrity": "sha512-3/S6KQbqa7pGC8CxPrg69qHLpOvkiPHGJtWPkI/1AXCsktkJ6gIk/5z4hyuMp8Anvs6eS/Kvp/GZa3ut3votKA==", + "version": "1.10.4", + "resolved": "https://registry.npmjs.org/@volar/source-map/-/source-map-1.10.4.tgz", + "integrity": "sha512-RxZdUEL+pV8p+SMqnhVjzy5zpb1QRZTlcwSk4bdcBO7yOu4rtEWqDGahVCEj4CcXour+0yJUMrMczfSCpP9Uxg==", "dev": true, "dependencies": { "muggle-string": "^0.3.1" } }, "node_modules/@volar/typescript": { - "version": "1.10.1", - "resolved": "https://registry.npmjs.org/@volar/typescript/-/typescript-1.10.1.tgz", - "integrity": "sha512-+iiO9yUSRHIYjlteT+QcdRq8b44qH19/eiUZtjNtuh6D9ailYM7DVR0zO2sEgJlvCaunw/CF9Ov2KooQBpR4VQ==", + "version": "1.10.4", + "resolved": "https://registry.npmjs.org/@volar/typescript/-/typescript-1.10.4.tgz", + "integrity": "sha512-BCCUEBASBEMCrz7qmNSi2hBEWYsXD0doaktRKpmmhvb6XntM2sAWYu6gbyK/MluLDgluGLFiFRpWgobgzUqolg==", "dev": true, "dependencies": { - "@volar/language-core": "1.10.1" + "@volar/language-core": "1.10.4" } }, "node_modules/@vue/compiler-core": { @@ -296,17 +296,17 @@ "integrity": "sha512-o9KfBeaBmCKl10usN4crU53fYtC1r7jJwdGKjPT24t348rHxgfpZ0xL3Xm/gLUYnc0oTp8LAmrxOeLyu6tbk2Q==" }, "node_modules/@vue/language-core": { - "version": "1.8.15", - "resolved": "https://registry.npmjs.org/@vue/language-core/-/language-core-1.8.15.tgz", - "integrity": "sha512-zche5Aw8kkvp3YaghuLiOZyVIpoWHjSQ0EfjxGSsqHOPMamdCoa9x3HtbenpR38UMUoKJ88wiWuiOrV3B/Yq+A==", + "version": "1.8.19", + "resolved": "https://registry.npmjs.org/@vue/language-core/-/language-core-1.8.19.tgz", + "integrity": "sha512-nt3dodGs97UM6fnxeQBazO50yYCKBK53waFWB3qMbLmR6eL3aUryZgQtZoBe1pye17Wl8fs9HysV3si6xMgndQ==", "dev": true, "dependencies": { - "@volar/language-core": "~1.10.0", - "@volar/source-map": "~1.10.0", + "@volar/language-core": "~1.10.4", + "@volar/source-map": "~1.10.4", "@vue/compiler-dom": "^3.3.0", "@vue/reactivity": "^3.3.0", "@vue/shared": "^3.3.0", - "minimatch": "^9.0.0", + "minimatch": "^9.0.3", "muggle-string": "^0.3.1", "vue-template-compiler": "^2.7.14" }, @@ -376,13 +376,13 @@ "integrity": "sha512-7OjdcV8vQ74eiz1TZLzZP4JwqM5fA94K6yntPS5Z25r9HDuGNzaGdgvwKYq6S+MxwF0TFRwe50fIR/MYnakdkQ==" }, "node_modules/@vue/typescript": { - "version": "1.8.15", - "resolved": "https://registry.npmjs.org/@vue/typescript/-/typescript-1.8.15.tgz", - "integrity": "sha512-qWyanQKXOsK84S8rP7QBrqsvUdQ0nZABZmTjXMpb3ox4Bp5IbkscREA3OPUrkgl64mAxwwCzIWcOc3BPTCPjQw==", + "version": "1.8.19", + "resolved": "https://registry.npmjs.org/@vue/typescript/-/typescript-1.8.19.tgz", + "integrity": "sha512-k/SHeeQROUgqsxyHQ8Cs3Zz5TnX57p7BcBDVYR2E0c61QL2DJ2G8CsaBremmNGuGE6o1R5D50IHIxFmroMz8iw==", "dev": true, "dependencies": { - "@volar/typescript": "~1.10.0", - "@vue/language-core": "1.8.15" + "@volar/typescript": "~1.10.4", + "@vue/language-core": "1.8.19" } }, "node_modules/@vueuse/core": { @@ -993,9 +993,9 @@ } }, "node_modules/marked": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/marked/-/marked-9.1.0.tgz", - "integrity": "sha512-VZjm0PM5DMv7WodqOUps3g6Q7dmxs9YGiFUZ7a2majzQTTCgX+6S6NAJHPvOhgFBzYz8s4QZKWWMfZKFmsfOgA==", + "version": "9.1.1", + "resolved": "https://registry.npmjs.org/marked/-/marked-9.1.1.tgz", + "integrity": "sha512-ZmXkUGH54U4rEy3GL9vYj8+S1PHJx/zz5pc4Frn7UdGiNREKT12fWBJ5a5ffjFtghx9C9912vEg9Zra1Nf7CnA==", "bin": { "marked": "bin/marked.js" }, @@ -1289,14 +1289,14 @@ } }, "node_modules/vue-tsc": { - "version": "1.8.15", - "resolved": "https://registry.npmjs.org/vue-tsc/-/vue-tsc-1.8.15.tgz", - "integrity": "sha512-4DoB3LUj7IToLmggoCxRiFG+QU5lem0nv03m1ocqugXA9rSVoTOEoYYaP8vu8b99Eh+/cCVdYOeIAQ+RsgUYUw==", + "version": "1.8.19", + "resolved": "https://registry.npmjs.org/vue-tsc/-/vue-tsc-1.8.19.tgz", + "integrity": "sha512-tacMQLQ0CXAfbhRycCL5sWIy1qujXaIEtP1hIQpzHWOUuICbtTj9gJyFf91PvzG5KCNIkA5Eg7k2Fmgt28l5DQ==", "dev": true, "dependencies": { - "@vue/language-core": "1.8.15", - "@vue/typescript": "1.8.15", - "semver": "^7.3.8" + "@vue/language-core": "1.8.19", + "@vue/typescript": "1.8.19", + "semver": "^7.5.4" }, "bin": { "vue-tsc": "bin/vue-tsc.js" diff --git a/src-vue/package.json b/src-vue/package.json index e4c8c49f..5d7ede3c 100644 --- a/src-vue/package.json +++ b/src-vue/package.json @@ -11,7 +11,7 @@ "dependencies": { "@element-plus/icons-vue": "^2.0.9", "element-plus": "^2.3.14", - "marked": "^9.1.0", + "marked": "^9.1.1", "tauri-plugin-store-api": "github:tauri-apps/tauri-plugin-store#9bd993aa67766596638bbfd91e79a1bf8f632014", "vue": "^3.2.37", "vue-i18n": "^9.5.0", @@ -23,6 +23,6 @@ "@vitejs/plugin-vue": "^3.1.0", "typescript": "^5.2.2", "vite": "^3.1.0", - "vue-tsc": "^1.8.15" + "vue-tsc": "^1.8.19" } } diff --git a/src-vue/src/App.vue b/src-vue/src/App.vue index f80e000d..30e5e683 100644 --- a/src-vue/src/App.vue +++ b/src-vue/src/App.vue @@ -34,9 +34,6 @@ export default { this.$root!.$i18n.locale = lang; }, methods: { - async toggleMaximize() { - await appWindow.toggleMaximize(); - }, minimize() { appWindow.minimize() }, @@ -77,7 +74,6 @@ export default { <!-- Window controls --> <div id="fc_window__controls"> <el-button color="white" icon="SemiSelect" @click="minimize" circle /> - <el-button color="white" icon="FullScreen" @click="toggleMaximize" circle /> <el-button color="white" icon="CloseBold" @click="close" circle /> </div> </nav> diff --git a/src-vue/src/components/ThunderstoreModCard.vue b/src-vue/src/components/ThunderstoreModCard.vue index 54241e85..11be7545 100644 --- a/src-vue/src/components/ThunderstoreModCard.vue +++ b/src-vue/src/components/ThunderstoreModCard.vue @@ -243,7 +243,7 @@ export default defineComponent({ // Capture translation method in a context, so it can be used outside Vue component context. // (see https://github.com/R2NorthstarTools/FlightCore/issues/384) (async (translate: Function) => { - await invoke<string>("install_mod_caller", { gameInstall: this.$store.state.game_install, thunderstoreModString: this.latestVersion.full_name }).then((message) => { + await invoke<string>("install_mod_wrapper", { gameInstall: this.$store.state.game_install, thunderstoreModString: this.latestVersion.full_name }).then((message) => { showNotification(translate('mods.card.install_success', { modName: mod.name }), message); }) .catch((error) => { diff --git a/src-vue/src/i18n/lang/en.json b/src-vue/src/i18n/lang/en.json index 2b056655..2bf18c2e 100644 --- a/src-vue/src/i18n/lang/en.json +++ b/src-vue/src/i18n/lang/en.json @@ -11,6 +11,7 @@ "yes": "Yes", "no": "No", "error": "Error", + "confirm": "Confirm", "cancel": "Cancel", "informationShort": "Info", "downloading": "Downloading", @@ -115,7 +116,10 @@ "edit": "Edit Profiles", "dialog": { - "title": "Profiles" + "title": "Profiles", + "delete_confirm": "Are you sure to delete this profile?", + "delete": "Delete", + "clone": "Clone" } }, diff --git a/src-vue/src/plugins/store.ts b/src-vue/src/plugins/store.ts index b0eaaf65..2b9b03c8 100644 --- a/src-vue/src/plugins/store.ts +++ b/src-vue/src/plugins/store.ts @@ -62,7 +62,7 @@ export const store = createStore<FlightCoreStore>({ state(): FlightCoreStore { return { developer_mode: false, - game_install: {} as unknown as GameInstall, + game_install: {game_path: undefined, profile: undefined, install_type: "UNKNOWN"} as unknown as GameInstall, available_profiles: [], @@ -152,8 +152,15 @@ export const store = createStore<FlightCoreStore>({ await persistentStore.set('game-install', { value: state.game_install }); await persistentStore.save(); // explicit save to disk + // We can no longer be sure if our last profile is valid, lets reset to be sure + state.game_install.profile = "R2Northstar"; + // Check for Northstar install store.commit('checkNorthstarUpdates'); + + // Since we are in a new game directory, lets see if there are any profiles + store.commit('fetchProfiles'); + } else { // Not valid Titanfall2 install @@ -184,7 +191,7 @@ export const store = createStore<FlightCoreStore>({ switch (state.northstar_state) { // Install northstar if it wasn't detected. case NorthstarState.INSTALL: - let install_northstar_result = invoke("install_northstar_caller", { gameInstall: state.game_install, northstarPackageName: state.northstar_release_canal }); + let install_northstar_result = invoke("install_northstar_wrapper", { gameInstall: state.game_install, northstarPackageName: state.northstar_release_canal }); state.northstar_state = NorthstarState.INSTALLING; await install_northstar_result.then((message) => { @@ -201,7 +208,7 @@ export const store = createStore<FlightCoreStore>({ // Update northstar if it is outdated. case NorthstarState.MUST_UPDATE: // Updating is the same as installing, simply overwrites the existing files - let reinstall_northstar_result = invoke("install_northstar_caller", { gameInstall: state.game_install, northstarPackageName: state.northstar_release_canal }); + let reinstall_northstar_result = invoke("install_northstar_wrapper", { gameInstall: state.game_install, northstarPackageName: state.northstar_release_canal }); state.northstar_state = NorthstarState.UPDATING; await reinstall_northstar_result.then((message) => { @@ -324,6 +331,12 @@ export const store = createStore<FlightCoreStore>({ ); }, async fetchProfiles(state: FlightCoreStore) { + // To fetch profiles we need a valid game path + if (!state.game_install.game_path) { + return; + } + + await invoke("fetch_profiles", { gameInstall: state.game_install }) .then((message) => { state.available_profiles = message as string[]; @@ -435,8 +448,6 @@ async function _initializeApp(state: any) { await _get_northstar_version_number(state); } - store.commit('fetchProfiles'); - await invoke<[number, number]>("get_server_player_count") .then((message) => { state.player_count = message[0]; diff --git a/src-vue/src/style.css b/src-vue/src/style.css index c66a6248..dfe682bf 100644 --- a/src-vue/src/style.css +++ b/src-vue/src/style.css @@ -46,3 +46,11 @@ body { color: white; margin: 30px 15px; } + +.el-popper { + width: 200px !important; +} + +.el-popconfirm { + word-break: break-word; +} diff --git a/src-vue/src/views/DeveloperView.vue b/src-vue/src/views/DeveloperView.vue index 206d425b..1b455452 100644 --- a/src-vue/src/views/DeveloperView.vue +++ b/src-vue/src/views/DeveloperView.vue @@ -249,7 +249,7 @@ export default defineComponent({ }, async installMod() { let mod_to_install = this.mod_to_install_field_string; - await invoke<string>("install_mod_caller", { gameInstall: this.$store.state.game_install, thunderstoreModString: mod_to_install }).then((message) => { + await invoke<string>("install_mod_wrapper", { gameInstall: this.$store.state.game_install, thunderstoreModString: mod_to_install }).then((message) => { // Show user notification if mod install completed. showNotification(`Installed ${mod_to_install}`, message); }) @@ -317,7 +317,7 @@ export default defineComponent({ 0 ); - let install_northstar_result = invoke("install_northstar_caller", { gameInstall: this.$store.state.game_install, northstarPackageName: this.selected_ns_version.value.package, versionNumber: this.selected_ns_version.value.version }); + let install_northstar_result = invoke("install_northstar_wrapper", { gameInstall: this.$store.state.game_install, northstarPackageName: this.selected_ns_version.value.package, versionNumber: this.selected_ns_version.value.version }); await install_northstar_result .then((message) => { diff --git a/src-vue/src/views/RepairView.vue b/src-vue/src/views/RepairView.vue index ce7e154d..341dff2d 100644 --- a/src-vue/src/views/RepairView.vue +++ b/src-vue/src/views/RepairView.vue @@ -75,7 +75,7 @@ export default defineComponent({ 0 ); - let install_northstar_result = invoke("install_northstar_caller", { gameInstall: this.$store.state.game_install, northstarPackageName: ReleaseCanal.RELEASE }); + let install_northstar_result = invoke("install_northstar_wrapper", { gameInstall: this.$store.state.game_install, northstarPackageName: ReleaseCanal.RELEASE }); appWindow.listen<InstallProgress>( 'northstar-install-download-progress', @@ -102,7 +102,7 @@ export default defineComponent({ }); }, async cleanUpDownloadFolder() { - await invoke("clean_up_download_folder_caller", { gameInstall: this.$store.state.game_install, force: true }).then((message) => { + await invoke("clean_up_download_folder_wrapper", { gameInstall: this.$store.state.game_install, force: true }).then((message) => { // Show user notification if task completed. showNotification(this.$t('generic.done'), this.$t('generic.done')); }) diff --git a/src-vue/src/views/SettingsView.vue b/src-vue/src/views/SettingsView.vue index b1a62c56..70bffbc5 100644 --- a/src-vue/src/views/SettingsView.vue +++ b/src-vue/src/views/SettingsView.vue @@ -6,6 +6,23 @@ > <el-table :data="availableProfiles" > <el-table-column prop="name" label="Name" /> + <el-table-column align="right"> + <template #default="scope"> + <el-popconfirm + v-if="scope.row.name != 'R2Northstar'" + :title="$t('settings.profile.dialog.delete_confirm')" + :confirm-button-text="$t('generic.yes')" + :cancel-button-text="$t('generic.no')" + @confirm="deleteProfile(scope.row.name)" + > + <template #reference> + <el-button type="danger"> + {{ $t('settings.profile.dialog.delete') }} + </el-button> + </template> + </el-popconfirm> + </template> + </el-table-column> </el-table> </el-dialog> @@ -34,9 +51,9 @@ <!-- Northstar Active Profile --> <div class="fc_parameter__panel" v-if="$store.state.developer_mode"> <h3>{{ $t('settings.profile.active') }}</h3> - <el-dropdown trigger="click"> + <el-dropdown trigger="click" :disabled="!availableProfiles.length"> <el-button> - {{ $store.state.game_install.profile }} <el-icon class="el-icon--right"><arrow-down /></el-icon> + {{ activeProfile }} <el-icon class="el-icon--right" v-if="availableProfiles.length"><arrow-down /></el-icon> </el-button> <template #dropdown> <el-dropdown-menu> @@ -173,7 +190,10 @@ export default defineComponent({ await persistentStore.save(); // explicit save to disk } }, - availableProfiles(): Object { + activeProfile(): String { + return this.$store.state.game_install.profile || "None"; + }, + availableProfiles(): Object[] { let profiles = this.$store.state.available_profiles // convert string array to object array so we can fill a table @@ -209,6 +229,15 @@ export default defineComponent({ }); }, async openGameInstallFolder() { + // Verify the game path is actually set + if (!this.$store.state.game_install.game_path) { + showErrorNotification( + i18n.global.tc('notification.game_folder.not_found.text'), + i18n.global.tc('notification.game_folder.not_found.title') + ); + return; + } + // Opens the folder in default file explorer application await open(`${this.$store.state.game_install.game_path}`); }, @@ -244,10 +273,29 @@ export default defineComponent({ console.error(error); showErrorNotification(error); }); - } + }, + async deleteProfile(profile: string) { + let store = this.$store; + await invoke("delete_profile", { + gameInstall: store.state.game_install, + profile: profile, + }).then(async (message) => { + if (profile == store.state.game_install.profile) + { + // trying to delete the active profile, lets switch to the default profile + await this.switchProfile("R2Northstar"); + } + store.commit('fetchProfiles'); + showNotification('Success'); + }).catch((error) => { + console.error(error); + showErrorNotification(error); + }); + }, }, mounted() { document.querySelector('input')!.disabled = true; + this.$store.commit('fetchProfiles'); }, unmounted() { if (('' + this.modsPerPage) === '') { |