diff --git a/src/App.vue b/src/App.vue index 9fd631e..7856645 100644 --- a/src/App.vue +++ b/src/App.vue @@ -9,7 +9,7 @@ diff --git a/src/components/Drawer.vue b/src/components/Drawer.vue index 3a0a4f4..79091f5 100644 --- a/src/components/Drawer.vue +++ b/src/components/Drawer.vue @@ -76,6 +76,7 @@ import FilterGroup from './drawer/FilterGroup.vue'; import { api } from '../Api'; import { mapState, mapMutations, mapGetters } from 'vuex'; import { formatSize } from '../filters'; +import { SiteNameMap } from '../consts'; export default { components: { @@ -138,10 +139,12 @@ export default { } const filterGroups = []; const categories: any[] = _.sortBy(Object.entries(this.torrentGroupByCategory).map(([key, value]) => { + const size = formatSize(_.sumBy(value, 'size')); const title = key ? key : 'Uncategorized'; - const append = `(${value.length})`; + const append = `(${value.length})[${size}]`; return { icon: 'mdi-folder-open', title, key, append}; - }), (o) => o.key); + }), 'key'); + const totalSize = formatSize(_.sumBy(this.allTorrents, 'size')); filterGroups.push({ 'icon': 'mdi-menu-up', 'icon-alt': 'mdi-menu-down', @@ -149,21 +152,17 @@ export default { 'model': false, 'select': 'category', 'children': [ - { icon: 'mdi-folder-open', title: 'All', key: null, append: `(${this.allTorrents.length})` }, + { icon: 'mdi-folder-open', title: 'All', key: null, append: `(${this.allTorrents.length})[${totalSize}]` }, ...categories, ], }); - const sites: any[] = _.sortBy(Object.entries(this.torrentGroupBySite).filter(([key, value]) => { - return key; - }).map(([key, value]) => { - const size = formatSize(value.reduce((acc, v) => { - return acc + v.size; - }, 0)); - const title = key; + const sites: any[] = _.sortBy(Object.entries(this.torrentGroupBySite).map(([key, value]) => { + const size = formatSize(_.sumBy(value, 'size')); + const title = key ? _.get(SiteNameMap, key, key) : 'Others'; const append = `(${value.length})[${size}]`; return { icon: 'mdi-server', title, key, append }; - }), (o) => o.title); + }), 'title'); filterGroups.push({ 'icon': 'mdi-menu-up', 'icon-alt': 'mdi-menu-down', @@ -201,4 +200,7 @@ export default { diff --git a/src/components/Footer.vue b/src/components/Footer.vue index 17b03ac..86e7158 100644 --- a/src/components/Footer.vue +++ b/src/components/Footer.vue @@ -9,12 +9,16 @@ API version: {{ app.apiVersion }} + + + Disk free: {{ info.free_space_on_disk | formatSize }} + - Disk free: {{ info.free_space_on_disk | formatSize }} + Torrents size: {{ allTorrents.length }} ({{ totalSize | formatSize }}) @@ -24,7 +28,7 @@ @@ -33,7 +37,7 @@ - mdi-download + mdi-download {{ info.dl_info_speed | formatSize }}/s ({{ info.dl_info_data | formatSize }}/{{ info.alltime_dl | formatSize }}) @@ -41,7 +45,7 @@ - mdi-upload + mdi-upload {{ info.up_info_speed | formatSize }}/s ({{ info.up_info_data | formatSize }}/{{ info.alltime_ul | formatSize }}) @@ -73,15 +77,29 @@ export default Vue.extend({ }; return statusMap[status]; }, + connectionIconColor(status: string) { + const statusMap: any = { + connected: 'success', + firewalled: 'info', + disconnected: 'warning', + }; + return statusMap[status]; + }, }, computed: { ...mapState({ - info: (state: any) => state.mainData ? state.mainData.server_state : null, + info(state: any) { + return this.isDataReady ? state.mainData.server_state : null; + }, }), ...mapGetters([ 'isDataReady', + 'allTorrents' ]), + totalSize() { + return _.sumBy(this.allTorrents, 'size'); + }, }, methods: { diff --git a/src/components/LogsDialog.vue b/src/components/LogsDialog.vue index 758db3b..d46ba06 100644 --- a/src/components/LogsDialog.vue +++ b/src/components/LogsDialog.vue @@ -1,5 +1,5 @@