From 94d715376be1d2602b377d44b69e32e3b177d7a2 Mon Sep 17 00:00:00 2001 From: CzBiX Date: Fri, 3 May 2019 18:16:02 +0800 Subject: [PATCH] Add info dialog --- src/Api.ts | 21 +++ src/App.vue | 8 +- src/components/Torrents.vue | 22 ++- .../dialogs/ConfirmDeleteDialog.vue | 29 +++- src/components/dialogs/InfoDialog.vue | 149 ++++++++++++++++++ src/components/{ => dialogs}/LogsDialog.vue | 21 ++- src/components/dialogs/Panel.vue | 41 +++++ src/components/dialogs/Peers.vue | 133 ++++++++++++++++ src/components/dialogs/Trackers.vue | 94 +++++++++++ src/filters.ts | 9 +- src/mixins/taskable.ts | 22 +++ src/utils.ts | 17 ++ 12 files changed, 538 insertions(+), 28 deletions(-) create mode 100644 src/components/dialogs/InfoDialog.vue rename src/components/{ => dialogs}/LogsDialog.vue (85%) create mode 100644 src/components/dialogs/Panel.vue create mode 100644 src/components/dialogs/Peers.vue create mode 100644 src/components/dialogs/Trackers.vue create mode 100644 src/mixins/taskable.ts diff --git a/src/Api.ts b/src/Api.ts index 442ae28..95ac455 100644 --- a/src/Api.ts +++ b/src/Api.ts @@ -93,6 +93,27 @@ class Api { return this.actionTorrents('setCategory', hashes, {category}); } + public getTorrentTracker(hash: string) { + const params = { + hash, + }; + + return this.axios.get('/torrents/trackers', { + params, + }).then(this.handleResponse); + } + + public getTorrentPeers(hash: string, rid?: number) { + const params = { + hash, + rid, + }; + + return this.axios.get('/sync/torrentPeers', { + params, + }).then(this.handleResponse); + } + private actionTorrents(action: string, hashes: string[], extra?: any) { const params: any = { hashes: hashes.join('|'), diff --git a/src/App.vue b/src/App.vue index a98af63..1f05499 100644 --- a/src/App.vue +++ b/src/App.vue @@ -55,7 +55,7 @@ import LoginForm from './components/LoginForm.vue'; import MainToolbar from './components/MainToolbar.vue'; import Torrents from './components/Torrents.vue'; import AppFooter from './components/Footer.vue'; -import LogsDialog from './components/LogsDialog.vue'; +import LogsDialog from './components/dialogs/LogsDialog.vue'; import { api } from './Api'; import { mapActions, mapGetters, mapState, mapMutations } from 'vuex'; import Axios, { AxiosError } from 'axios'; @@ -76,7 +76,6 @@ export default Vue.extend({ return { needAuth: false, drawer: true, - phoneLayout: false, drawerOptions: { showLogs: false, }, @@ -84,8 +83,6 @@ export default Vue.extend({ }; }, async created() { - this.phoneLayout = this.$vuetify.breakpoint.xsOnly; - await this.getInitData(); }, beforeDestroy() { @@ -100,6 +97,9 @@ export default Vue.extend({ 'preferences', ]), ...mapGetters(['config']), + phoneLayout() { + return this.$vuetify.breakpoint.xsOnly; + }, }, methods: { ...mapMutations([ diff --git a/src/components/Torrents.vue b/src/components/Torrents.vue index f2ea7b5..cc7faec 100644 --- a/src/components/Torrents.vue +++ b/src/components/Torrents.vue @@ -29,6 +29,9 @@ mdi-pause + + mdi-alert-circle + + + diff --git a/src/components/LogsDialog.vue b/src/components/dialogs/LogsDialog.vue similarity index 85% rename from src/components/LogsDialog.vue rename to src/components/dialogs/LogsDialog.vue index 5ee2311..2fc92d4 100644 --- a/src/components/LogsDialog.vue +++ b/src/components/dialogs/LogsDialog.vue @@ -1,5 +1,5 @@