aboutsummaryrefslogtreecommitdiff
path: root/src-vue/src/views/RepairView.vue
diff options
context:
space:
mode:
authorRémy Raes <contact@remyraes.com>2023-04-10 14:25:32 +0200
committerGitHub <noreply@github.com>2023-04-10 14:25:32 +0200
commit6d58e6793d40df4fec518f37351868803a02a033 (patch)
tree8ba8b1fdf503579314e9475bee409e0ba549e7ad /src-vue/src/views/RepairView.vue
parent0d4744ad1f05ea6410b4cbe4e1e0270e67055ce6 (diff)
downloadFlightCore-6d58e6793d40df4fec518f37351868803a02a033.tar.gz
FlightCore-6d58e6793d40df4fec518f37351868803a02a033.zip
refactor: Notifications (#259)
* feat: wrap ElNotification class in a showNotification method * refactor: replace notification invocations in mod views * feat: add 'info' type to showNotification method * refactor: replace notification invocations in repair view * refactor: replace notification invocations in settings view * refactor: replace notification invocations in developer view * feat: showNotification method now returns a NotificationHandle * feat: showNotification has a duration argument * refactor: replace notification invocations in pull requests module * refactor: replace notification invocation in repair view * refactor: replace notification invocations in UI store * refactor: remove unused import from play view * refactor: use showErrorNotification method to wrap up error display * fix: add missing showErrorNotification imports * style: format code * style: format ThunderstoreModCard.vue * style: format pull_requests.ts * style: format SettingsView.vue * style: format RepairView.vue * style: format DeveloperView.vue * refactor: remove useless import * refactor: add missing showErrorNotification invocation * feat: showErrorNotification has an optional title argument * style: format LocalModsView.vue
Diffstat (limited to 'src-vue/src/views/RepairView.vue')
-rw-r--r--src-vue/src/views/RepairView.vue57
1 files changed, 13 insertions, 44 deletions
diff --git a/src-vue/src/views/RepairView.vue b/src-vue/src/views/RepairView.vue
index 12224524..9de9a7f3 100644
--- a/src-vue/src/views/RepairView.vue
+++ b/src-vue/src/views/RepairView.vue
@@ -32,11 +32,11 @@
<script lang="ts">
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';
+import { showErrorNotification, showNotification } from "../utils/ui";
import { appWindow } from "@tauri-apps/api/window";
const persistentStore = new Store('flight-core-settings.json');
@@ -55,20 +55,10 @@ export default defineComponent({
} as GameInstall;
await invoke("disable_all_but_core", { gameInstall: game_install })
.then((message) => {
- ElNotification({
- title: 'Success',
- message: "Disabled all mods but core",
- type: 'success',
- position: 'bottom-right'
- });
+ showNotification('Success', "Disabled all mods but core");
})
.catch((error) => {
- ElNotification({
- title: 'Error',
- message: error,
- type: 'error',
- position: 'bottom-right'
- });
+ showErrorNotification(error);
});
},
async forceInstallNorthstar() {
@@ -78,33 +68,22 @@ export default defineComponent({
} 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'
- });
+ const notification = showNotification(
+ 'Force reinstalling Northstar',
+ 'Please wait',
+ 'info',
+ 0
+ );
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'
- });
+ showNotification('Done', `Successfully reinstalled Northstar`);
this.$store.commit('checkNorthstarUpdates');
})
.catch((error) => {
- ElNotification({
- title: 'Error',
- message: error,
- type: 'error',
- position: 'bottom-right'
- });
+ showErrorNotification(error);
console.error(error);
})
.finally(() => {
@@ -119,20 +98,10 @@ export default defineComponent({
} 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'
- });
+ showNotification('Done', 'Done');
})
.catch((error) => {
- ElNotification({
- title: 'Error',
- message: error,
- type: 'error',
- position: 'bottom-right'
- });
+ showErrorNotification(error);
});
},
async clearFlightCorePersistentStore() {