mirror of
https://github.com/CzBiX/qb-web.git
synced 2026-12-01 00:06:36 +08:00
Add feature to shut down qBittorrent application.(ui, api, locale)
maybe a better ui?
This commit is contained in:
@@ -38,6 +38,10 @@ class Api {
|
||||
return this.axios.get('/app/preferences');
|
||||
}
|
||||
|
||||
public shutdownApplication() {
|
||||
return this.axios.get('/app/shutdown');
|
||||
}
|
||||
|
||||
public getMainData(rid?: number) {
|
||||
const params = {
|
||||
rid,
|
||||
|
||||
@@ -56,6 +56,13 @@
|
||||
>
|
||||
<v-icon v-text="darkModeIcon" />
|
||||
</v-btn>
|
||||
<v-btn
|
||||
icon
|
||||
@click="triggerApplicationShutdown"
|
||||
:title="$t('triggerApplicationShutdown')"
|
||||
>
|
||||
<v-icon> mdi-power-plug-off</v-icon>
|
||||
</v-btn>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -65,6 +72,7 @@ import Vue from 'vue'
|
||||
import Component from 'vue-class-component';
|
||||
import { mapMutations, mapActions } from 'vuex';
|
||||
import { Watch } from 'vue-property-decorator';
|
||||
import api from '../../Api';
|
||||
|
||||
import { tr, translations, defaultLocale, LocaleKey } from '@/locale';
|
||||
import { DialogType, DialogConfig, SnackBarConfig, ConfigPayload } from '@/store/types';
|
||||
@@ -161,6 +169,20 @@ export default class DrawerFooter extends Vue {
|
||||
});
|
||||
}
|
||||
|
||||
async triggerApplicationShutdown() {
|
||||
const v = await this.asyncShowDialog({
|
||||
title: tr('dialog.trigger_exit_qb.title'),
|
||||
text: tr('dialog.trigger_exit_qb.text'),
|
||||
type: DialogType.OkCancel,
|
||||
});
|
||||
|
||||
if (!v) {
|
||||
return;
|
||||
}
|
||||
await api.shutdownApplication();
|
||||
}
|
||||
|
||||
|
||||
@Watch('currentLocale')
|
||||
onCurrentLocaleChanged(v: AllLocaleKey) {
|
||||
this.switchLocale(v)
|
||||
@@ -177,4 +199,4 @@ export default class DrawerFooter extends Vue {
|
||||
.footer {
|
||||
padding: 1em;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
@@ -23,7 +23,7 @@ export default {
|
||||
refresh: 'Refresh',
|
||||
location: 'Location',
|
||||
rename: 'Rename',
|
||||
|
||||
triggerApplicationShutdown: 'Exit qBittorrent',
|
||||
reannounce: 'Reannounce',
|
||||
recheck: 'Recheck',
|
||||
|
||||
@@ -89,6 +89,10 @@ export default {
|
||||
},
|
||||
|
||||
dialog: {
|
||||
trigger_exit_qb: {
|
||||
title: 'Exit qBittorrent',
|
||||
text: 'Are you sure you want to exit qBittorrent?'
|
||||
},
|
||||
add_torrents: {
|
||||
placeholder: 'Upload torrents by drop them here,\nor click attachment button at right to select.',
|
||||
hint: 'One link per line',
|
||||
|
||||
@@ -23,7 +23,7 @@ export default {
|
||||
refresh: '刷新',
|
||||
location: '位置',
|
||||
rename: '重命名',
|
||||
|
||||
triggerApplicationShutdown: '退出qBittorrent',
|
||||
reannounce: '重新通告',
|
||||
recheck: '重新检查',
|
||||
|
||||
@@ -89,6 +89,10 @@ export default {
|
||||
},
|
||||
|
||||
dialog: {
|
||||
trigger_exit_qb: {
|
||||
title: '退出 qBittorrent',
|
||||
text: '您确定要退出qBittorrent吗?'
|
||||
},
|
||||
add_torrents: {
|
||||
placeholder: '将种子拖到这里上传,\n或者点击右边的附件图标来选择。',
|
||||
hint: '每行一个链接',
|
||||
|
||||
Reference in New Issue
Block a user