mirror of
https://github.com/VueTorrent/VueTorrent.git
synced 2025-03-29 21:11:51 +03:00
feat: Add shutdown button in TopActions (#633) @Larsluph
This commit is contained in:
parent
5aeb65352f
commit
ab75f32c5f
3 changed files with 42 additions and 12 deletions
|
@ -70,6 +70,16 @@
|
||||||
</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>
|
||||||
|
|
||||||
|
@ -77,7 +87,7 @@
|
||||||
import { General } from '@/mixins'
|
import { General } from '@/mixins'
|
||||||
import { mapState } from 'vuex'
|
import { mapState } from 'vuex'
|
||||||
import qbit from '@/services/qbit'
|
import qbit from '@/services/qbit'
|
||||||
import { mdiSort, mdiCog, mdiCheckboxBlankOutline, mdiCheckboxMarked, mdiSearchWeb, mdiDelete, mdiPlus, mdiPlay, mdiPause, mdiRss } from '@mdi/js'
|
import { mdiSort, mdiCog, mdiCheckboxBlankOutline, mdiCheckboxMarked, mdiSearchWeb, mdiDelete, mdiPlus, mdiPlay, mdiPause, mdiRss, mdiPower } from '@mdi/js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'TopActions',
|
name: 'TopActions',
|
||||||
|
@ -86,16 +96,17 @@ export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
fab: false,
|
fab: false,
|
||||||
mdiSort,
|
mdiCheckboxBlankOutline,
|
||||||
mdiPlus,
|
|
||||||
mdiSearchWeb,
|
|
||||||
mdiRss,
|
|
||||||
mdiPlay,
|
|
||||||
mdiPause,
|
|
||||||
mdiDelete,
|
|
||||||
mdiCog,
|
|
||||||
mdiCheckboxMarked,
|
mdiCheckboxMarked,
|
||||||
mdiCheckboxBlankOutline
|
mdiCog,
|
||||||
|
mdiDelete,
|
||||||
|
mdiPause,
|
||||||
|
mdiPlay,
|
||||||
|
mdiPlus,
|
||||||
|
mdiPower,
|
||||||
|
mdiRss,
|
||||||
|
mdiSearchWeb,
|
||||||
|
mdiSort
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
@ -121,6 +132,16 @@ 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())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,7 +87,8 @@
|
||||||
"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"
|
||||||
|
@ -480,7 +481,9 @@
|
||||||
"copySuccess": "Text copied!",
|
"copySuccess": "Text copied!",
|
||||||
"copyNotSupported": "Unable to copy, clipboard API unavailable on this browser",
|
"copyNotSupported": "Unable to copy, clipboard API unavailable on this browser",
|
||||||
"pasteSuccess": "Text pasted!",
|
"pasteSuccess": "Text pasted!",
|
||||||
"pasteNotSupported": "Unable to paste, clipboard API unavailable on this browser"
|
"pasteNotSupported": "Unable to paste, clipboard API unavailable on this browser",
|
||||||
|
"shutdownSuccess": "qBittorrent was shutdown successfully!",
|
||||||
|
"shutdownError": "Unable to shutdown app. Make sure qBittorrent is running!"
|
||||||
},
|
},
|
||||||
"rightClick": {
|
"rightClick": {
|
||||||
"resume": "resume",
|
"resume": "resume",
|
||||||
|
|
|
@ -498,6 +498,12 @@ export class QBitApi {
|
||||||
offset
|
offset
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async shutdownApp(): Promise<boolean> {
|
||||||
|
return this.axios.post("/app/shutdown")
|
||||||
|
.then(() => true)
|
||||||
|
.catch(() => false)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const Qbit = new QBitApi()
|
export const Qbit = new QBitApi()
|
||||||
|
|
Loading…
Add table
Reference in a new issue