From b80d735750c3c6bd613e64d6ebcf7faa1e8f5852 Mon Sep 17 00:00:00 2001 From: advplyr Date: Wed, 29 Dec 2021 15:53:19 -0600 Subject: [PATCH] Add:User listening stats page and new library stats --- client/components/app/Appbar.vue | 2 +- client/components/app/ConfigSideNav.vue | 78 +++++++---- .../components/stats/DailyListeningChart.vue | 2 +- client/components/stats/PreviewIcons.vue | 59 ++++---- client/components/tables/UsersTable.vue | 2 +- client/pages/config.vue | 11 +- client/pages/config/library-stats.vue | 127 ++++++++++++++++++ client/pages/config/stats.vue | 121 ++++++++++------- client/store/libraries.js | 5 + server/ApiController.js | 18 ++- server/controllers/LibraryController.js | 5 +- server/objects/UserListeningSession.js | 4 + server/utils/libraryHelpers.js | 12 +- 13 files changed, 326 insertions(+), 120 deletions(-) create mode 100644 client/pages/config/library-stats.vue diff --git a/client/components/app/Appbar.vue b/client/components/app/Appbar.vue index 711ea2ae..8b64fa5d 100644 --- a/client/components/app/Appbar.vue +++ b/client/components/app/Appbar.vue @@ -15,7 +15,7 @@ logo_dev - + equalizer diff --git a/client/components/app/ConfigSideNav.vue b/client/components/app/ConfigSideNav.vue index b0370bc9..f84906c1 100644 --- a/client/components/app/ConfigSideNav.vue +++ b/client/components/app/ConfigSideNav.vue @@ -3,29 +3,10 @@
arrow_back
- -

Settings

-
- - -

Libraries

-
- - -

Users

-
- - -

Backups

-
- - -

Log

-
- - -

Stats

-
+ + +

{{ route.title }}

+
@@ -47,6 +28,57 @@ export default { } }, computed: { + userIsRoot() { + return this.$store.getters['user/getIsRoot'] + }, + configRoutes() { + if (!this.userIsRoot) { + return [ + { + id: 'config-stats', + title: 'Your Stats', + path: '/config/stats' + } + ] + } + return [ + { + id: 'config', + title: 'Settings', + path: '/config' + }, + { + id: 'config-libraries', + title: 'Libraries', + path: '/config/libraries' + }, + { + id: 'config-users', + title: 'Users', + path: '/config/users' + }, + { + id: 'config-backups', + title: 'Backups', + path: '/config/backups' + }, + { + id: 'config-log', + title: 'Log', + path: '/config/log' + }, + { + id: 'config-library-stats', + title: 'Library Stats', + path: '/config/library-stats' + }, + { + id: 'config-stats', + title: 'Your Stats', + path: '/config/stats' + } + ] + }, wrapperClass() { var classes = [] if (this.drawerOpen) classes.push('translate-x-0') diff --git a/client/components/stats/DailyListeningChart.vue b/client/components/stats/DailyListeningChart.vue index 43d15fd0..6fe62308 100644 --- a/client/components/stats/DailyListeningChart.vue +++ b/client/components/stats/DailyListeningChart.vue @@ -1,6 +1,6 @@