perf: add all-time stats #351

This commit is contained in:
Daan Wijns 2022-04-17 16:33:40 +02:00
parent 2d5ad9d442
commit a268e774de
7 changed files with 66 additions and 15 deletions

View file

@ -10,7 +10,7 @@
{{ label }}
</div>
</v-flex>
<v-flex md5 class="ml-4">
<v-flex md6>
<span data-testid="StorageCard-Wrapper" :class="color + '--text title'">
<span data-testid="StorageCard-value"> {{ value | getDataValue(2) }} </span>
<span data-testid="StorageCard-unit" class="caption">

View file

@ -43,6 +43,19 @@
</v-col>
</v-row>
</v-list-item>
<v-list-item>
<v-row dense>
<v-col>
<v-switch
v-model="showAlltimeStat"
class="v-input--reverse pa-0 ma-0"
hide-details
inset
label="Show All-Time Stats"
/>
</v-col>
</v-row>
</v-list-item>
<v-list-item>
<v-row dense>
<v-col>
@ -228,6 +241,14 @@ export default {
this.webuiSettings.showSessionStat = val
}
},
showAlltimeStat: {
get() {
return this.webuiSettings.showAlltimeStat
},
set(val) {
this.webuiSettings.showAlltimeStat = val
}
},
showTrackerFilter: {
get() {
return this.webuiSettings.showTrackerFilter

View file

@ -49,8 +49,15 @@
<SpeedGraph v-if="webuiSettings.showSpeedGraph" />
<SessionStats
<TranserStats
v-if="webuiSettings.showAlltimeStat"
:session="false"
:status="status"
/>
<TranserStats
v-if="webuiSettings.showSessionStat"
:session="true"
:status="status"
/>
@ -83,7 +90,7 @@ import {
TopMenu,
SpeedGraph,
FreeSpace,
SessionStats,
TranserStats,
CurrentSpeed,
FilterSelect
} from './index'
@ -95,7 +102,7 @@ export default {
BottomActions,
TopMenu,
SpeedGraph,
SessionStats,
TranserStats,
CurrentSpeed,
FilterSelect
},

View file

@ -1,9 +1,9 @@
<template>
<div v-if="status" class="mt-3 mb-3">
<label class="text-uppercase white--text caption font-weight-medium ml-4">
Session Stats
{{ getTitle }}
</label>
<v-tooltip bottom>
<v-tooltip v-if="isSession" bottom>
<template #activator="{ on }">
<v-icon
color="white"
@ -20,9 +20,9 @@
class="mb-4 mt-4"
label="Downloaded"
color="download"
:value="status.downloaded"
:value="getDownload"
/>
<StorageCard label="Uploaded" color="upload" :value="status.uploaded" />
<StorageCard label="Uploaded" color="upload" :value="getUpload" />
</div>
</template>
@ -30,10 +30,28 @@
import { mdiInformationOutline } from '@mdi/js'
import StorageCard from '@/components/Core/StorageCard'
export default {
name: 'SessionStats',
name: 'TransferStats',
components: { StorageCard },
props: ['status'],
data: () => ({ mdiInformationOutline })
props: ['status', 'session'],
data: () => ({
mdiInformationOutline,
sessionTitle: 'session stats',
alltimeTitle: 'all-time stats'
}),
computed: {
isSession() {
return this.session
},
getTitle() {
return this.isSession ? this.sessionTitle : this.alltimeTitle
},
getDownload() {
return this.isSession ? this.status.sessionDownloaded : this.status.alltimeDownloaded
},
getUpload() {
return this.isSession ? this.status.sessionUploaded : this.status.alltimeUploaded
}
}
}
</script>

View file

@ -3,7 +3,7 @@ import BottomActions from './NavbarActions.vue'
import TopActions from './TopActions.vue'
import SpeedGraph from './SpeedGraph.vue'
import FreeSpace from './FreeSpace.vue'
import SessionStats from './SessionStats.vue'
import TranserStats from './TransferStats.vue'
import CurrentSpeed from './CurrentSpeed.vue'
import FilterSelect from './FilterSelect.vue'
import TopMenu from './TopMenu.vue'
@ -14,7 +14,7 @@ export {
TopActions,
SpeedGraph,
FreeSpace,
SessionStats,
TranserStats,
CurrentSpeed,
FilterSelect,
TopMenu

View file

@ -5,6 +5,8 @@ export default class Status {
connection_status,
dl_info_data,
up_info_data,
alltime_dl,
alltime_ul,
dl_info_speed,
up_info_speed,
free_space_on_disk,
@ -14,8 +16,10 @@ export default class Status {
const previous = store.state.status
this.status = connection_status || previous.status
this.downloaded = dl_info_data || previous.downloaded
this.uploaded = up_info_data || previous.uploaded
this.sessionDownloaded = dl_info_data || previous.sessionDownloaded
this.sessionUploaded = up_info_data || previous.sessionUploaded
this.alltimeDownloaded = alltime_dl || previous.alltimeDownloaded
this.alltimeUploaded = alltime_ul || previous.alltimeUploaded
this.dlspeed = dl_info_speed || 0
this.upspeed = up_info_speed || 0
this.freeDiskSpace = free_space_on_disk || previous.freeDiskSpace

View file

@ -55,6 +55,7 @@ export default new Vuex.Store({
showFreeSpace: true,
showSpeedGraph: true,
showSessionStat: true,
showAlltimeStat: true,
showCurrentSpeed: true,
showTrackerFilter: false,
showSpeedInTitle: false,