mirror of
https://github.com/VueTorrent/VueTorrent.git
synced 2024-11-29 05:28:53 +03:00
perf : Add shutdown confirmation modal + moved to NavbarActions (#655) @Larsluph
This commit is contained in:
parent
22f539b3fb
commit
2e3a0048e4
5 changed files with 91 additions and 27 deletions
59
src/components/Modals/ConfirmShutdownModal.vue
Normal file
59
src/components/Modals/ConfirmShutdownModal.vue
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
<template>
|
||||||
|
<v-dialog v-model="dialog" scrollable max-width="750px" :content-class="isPhone ? 'rounded-0' : 'rounded-form'" :fullscreen="isPhone">
|
||||||
|
<v-card>
|
||||||
|
<v-card-title class="pa-0">
|
||||||
|
<v-toolbar-title class="ma-4 primarytext--text">
|
||||||
|
<h3>{{ $t('modals.shutdown.title') }}</h3>
|
||||||
|
</v-toolbar-title>
|
||||||
|
</v-card-title>
|
||||||
|
<v-card-text>
|
||||||
|
<v-container>
|
||||||
|
<v-row>
|
||||||
|
<v-col>
|
||||||
|
<span>{{ $t('modals.shutdown.content') }}</span>
|
||||||
|
</v-col>
|
||||||
|
</v-row>
|
||||||
|
</v-container>
|
||||||
|
</v-card-text>
|
||||||
|
<v-divider />
|
||||||
|
<v-card-actions class="justify-end">
|
||||||
|
<v-spacer />
|
||||||
|
<v-btn class="accent white--text elevation-0 px-4" @click="shutdownApplication">
|
||||||
|
{{ $t('yes') }}
|
||||||
|
</v-btn>
|
||||||
|
<v-btn class="error white--text elevation-0 px-4" @click="close">
|
||||||
|
{{ $t('no') }}
|
||||||
|
</v-btn>
|
||||||
|
</v-card-actions>
|
||||||
|
</v-card>
|
||||||
|
</v-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
import {defineComponent} from 'vue'
|
||||||
|
import Modal from "../../mixins/Modal";
|
||||||
|
import {FullScreenModal} from "@/mixins";
|
||||||
|
import qbit from "@/services/qbit";
|
||||||
|
|
||||||
|
export default defineComponent({
|
||||||
|
name: 'ConfirmShutdownModal',
|
||||||
|
mixins: [Modal, FullScreenModal],
|
||||||
|
methods: {
|
||||||
|
close() {
|
||||||
|
this.dialog = false
|
||||||
|
},
|
||||||
|
async shutdownApplication() {
|
||||||
|
if (!await qbit.shutdownApp()) {
|
||||||
|
this.$toast.error(this.$t('toast.shutdownError').toString())
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.$store.state.authenticated = false
|
||||||
|
await this.$router.push({name: 'login'})
|
||||||
|
this.$toast.success(this.$t("toast.shutdownSuccess").toString())
|
||||||
|
}
|
||||||
|
|
||||||
|
this.close()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
|
@ -39,25 +39,40 @@
|
||||||
<span>{{ theme }}</span>
|
<span>{{ theme }}</span>
|
||||||
</v-tooltip>
|
</v-tooltip>
|
||||||
</v-col>
|
</v-col>
|
||||||
|
<v-col>
|
||||||
|
<v-tooltip top>
|
||||||
|
<template #activator="{ on }">
|
||||||
|
<v-btn text tile block v-on="on" @click="createModal('ConfirmShutdownModal')">
|
||||||
|
<v-icon :class="commonStyle">
|
||||||
|
{{ mdiPower }}
|
||||||
|
</v-icon>
|
||||||
|
</v-btn>
|
||||||
|
</template>
|
||||||
|
<span>{{ $t('shutdownApp') }}</span>
|
||||||
|
</v-tooltip>
|
||||||
|
</v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import qbit from '@/services/qbit'
|
import qbit from '@/services/qbit'
|
||||||
import { mapGetters, mapState } from 'vuex'
|
import { mapGetters, mapState } from 'vuex'
|
||||||
import { mdiBrightness4, mdiSpeedometerSlow, mdiBrightness7, mdiSpeedometer, mdiExitToApp, mdiBell, mdiBellOff } from '@mdi/js'
|
import { mdiBrightness4, mdiSpeedometerSlow, mdiBrightness7, mdiSpeedometer, mdiPower, mdiExitToApp, mdiBell, mdiBellOff } from '@mdi/js'
|
||||||
import ConnectionStatus from './ConnectionStatus.vue'
|
import ConnectionStatus from './ConnectionStatus.vue'
|
||||||
|
import {General} from "@/mixins"
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'BottomActions',
|
name: 'BottomActions',
|
||||||
components: {
|
components: {
|
||||||
ConnectionStatus
|
ConnectionStatus
|
||||||
},
|
},
|
||||||
|
mixins: [General],
|
||||||
data: () => ({
|
data: () => ({
|
||||||
commonStyle: 'white--text',
|
commonStyle: 'white--text',
|
||||||
mdiBrightness4,
|
mdiBrightness4,
|
||||||
mdiBrightness7,
|
mdiBrightness7,
|
||||||
mdiSpeedometer,
|
mdiSpeedometer,
|
||||||
|
mdiPower,
|
||||||
mdiExitToApp,
|
mdiExitToApp,
|
||||||
mdiSpeedometerSlow,
|
mdiSpeedometerSlow,
|
||||||
mdiBell,
|
mdiBell,
|
||||||
|
@ -65,16 +80,13 @@ export default {
|
||||||
}),
|
}),
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(['webuiSettings']),
|
...mapState(['webuiSettings']),
|
||||||
...mapGetters(['isDarkMode', 'getWebuiSettings', 'getStatus', 'getAlarm']),
|
...mapGetters(['isDarkMode', 'getWebuiSettings', 'getStatus']),
|
||||||
webuiSettings() {
|
webuiSettings() {
|
||||||
return this.getWebuiSettings()
|
return this.getWebuiSettings()
|
||||||
},
|
},
|
||||||
theme() {
|
theme() {
|
||||||
return this.isDarkMode() ? this.$t('navbar.action.dark') : this.$t('navbar.action.light')
|
return this.isDarkMode() ? this.$t('navbar.action.dark') : this.$t('navbar.action.light')
|
||||||
},
|
},
|
||||||
alarm() {
|
|
||||||
return this.getAlarm()
|
|
||||||
},
|
|
||||||
status() {
|
status() {
|
||||||
return this.getStatus()
|
return this.getStatus()
|
||||||
},
|
},
|
||||||
|
|
|
@ -70,16 +70,6 @@
|
||||||
</template>
|
</template>
|
||||||
<span>{{ $t('navbar.topActions.openSettings') }}</span>
|
<span>{{ $t('navbar.topActions.openSettings') }}</span>
|
||||||
</v-tooltip>
|
</v-tooltip>
|
||||||
<v-tooltip bottom open-delay="400">
|
|
||||||
<template #activator="{ on }">
|
|
||||||
<v-btn :text="!mobile" small fab color="grey--text" class="mr-0 ml-0" :aria-label="$t('navbar.topActions.shutdownApp')" v-on="on" @click="shutdownApplication">
|
|
||||||
<v-icon color="grey">
|
|
||||||
{{ mdiPower }}
|
|
||||||
</v-icon>
|
|
||||||
</v-btn>
|
|
||||||
</template>
|
|
||||||
<span>{{ $t('navbar.topActions.shutdownApp') }}</span>
|
|
||||||
</v-tooltip>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -132,16 +122,6 @@ export default {
|
||||||
},
|
},
|
||||||
goToSettings() {
|
goToSettings() {
|
||||||
if (this.$route.name !== 'settings') this.$router.push({ name: 'settings' })
|
if (this.$route.name !== 'settings') this.$router.push({ name: 'settings' })
|
||||||
},
|
|
||||||
async shutdownApplication() {
|
|
||||||
if (!await qbit.shutdownApp()) {
|
|
||||||
this.$toast.error(this.$t('toast.shutdownError').toString())
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
this.$store.state.authenticated = false
|
|
||||||
await this.$router.push({name: 'login'})
|
|
||||||
this.$toast.success(this.$t("toast.shutdownSuccess").toString())
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
"errored": "Errored",
|
"errored": "Errored",
|
||||||
"login": "Login in",
|
"login": "Login in",
|
||||||
"logout": "Log out",
|
"logout": "Log out",
|
||||||
|
"shutdownApp": "Shutdown Application",
|
||||||
"download": "Download",
|
"download": "Download",
|
||||||
"downloaded": "Downloaded",
|
"downloaded": "Downloaded",
|
||||||
"upload": "Upload",
|
"upload": "Upload",
|
||||||
|
@ -46,6 +47,8 @@
|
||||||
"rule": "Rule",
|
"rule": "Rule",
|
||||||
"then": "Then",
|
"then": "Then",
|
||||||
"of": "of",
|
"of": "of",
|
||||||
|
"yes": "yes",
|
||||||
|
"no": "no",
|
||||||
"dashboard": {
|
"dashboard": {
|
||||||
"tooltips": {
|
"tooltips": {
|
||||||
"toggleSearch": "Toggle Search Filter",
|
"toggleSearch": "Toggle Search Filter",
|
||||||
|
@ -87,8 +90,7 @@
|
||||||
"removeSelected": "Remove selected torrents",
|
"removeSelected": "Remove selected torrents",
|
||||||
"openSettings": "Open settings",
|
"openSettings": "Open settings",
|
||||||
"searchNew": "Search new torrent",
|
"searchNew": "Search new torrent",
|
||||||
"rssArticles": "View RSS feed articles",
|
"rssArticles": "View RSS feed articles"
|
||||||
"shutdownApp": "Shutdown Application"
|
|
||||||
},
|
},
|
||||||
"sessionStats": {
|
"sessionStats": {
|
||||||
"tooltip": "Since the last time qBittorrent was restarted"
|
"tooltip": "Since the last time qBittorrent was restarted"
|
||||||
|
@ -467,6 +469,10 @@
|
||||||
},
|
},
|
||||||
"delete": {
|
"delete": {
|
||||||
"check": "Also delete files from storage"
|
"check": "Also delete files from storage"
|
||||||
|
},
|
||||||
|
"shutdown": {
|
||||||
|
"title": "Shutdown qBittorrent",
|
||||||
|
"content": "Do you really want to shutdown qBittorrent?"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"toast": {
|
"toast": {
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
"errored": "Erreur",
|
"errored": "Erreur",
|
||||||
"login": "Se Connecter",
|
"login": "Se Connecter",
|
||||||
"logout": "Se Déconnecter",
|
"logout": "Se Déconnecter",
|
||||||
|
"shutdownApp": "Eteindre l'Appli",
|
||||||
"download": "Téléchargement",
|
"download": "Téléchargement",
|
||||||
"downloaded": "Téléchargé",
|
"downloaded": "Téléchargé",
|
||||||
"upload": "Téléversement",
|
"upload": "Téléversement",
|
||||||
|
@ -43,6 +44,8 @@
|
||||||
"feed": "Flux",
|
"feed": "Flux",
|
||||||
"rule": "Règles",
|
"rule": "Règles",
|
||||||
"then": "Alors",
|
"then": "Alors",
|
||||||
|
"yes": "oui",
|
||||||
|
"no": "non",
|
||||||
"dashboard": {
|
"dashboard": {
|
||||||
"tooltips": {
|
"tooltips": {
|
||||||
"toggleSearch": "Rechercher un torrent",
|
"toggleSearch": "Rechercher un torrent",
|
||||||
|
@ -455,6 +458,10 @@
|
||||||
},
|
},
|
||||||
"delete": {
|
"delete": {
|
||||||
"check": "Supprimer également les fichiers du disque"
|
"check": "Supprimer également les fichiers du disque"
|
||||||
|
},
|
||||||
|
"shutdown": {
|
||||||
|
"title": "Eteindre qBittorrent",
|
||||||
|
"content": "Voulez-vous vraiment éteindre qBittorrent ?"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"toast": {
|
"toast": {
|
||||||
|
|
Loading…
Reference in a new issue