From b2aab06e0140fe472732e607ec9e0a6973116adf Mon Sep 17 00:00:00 2001 From: advplyr Date: Fri, 27 May 2022 17:39:24 -0500 Subject: [PATCH] Add:Listening session modal with all details --- .../modals/ListeningSessionModal.vue | 150 ++++++++++++++++++ client/pages/config/stats.vue | 6 +- client/pages/config/users/_id/index.vue | 2 +- client/pages/config/users/_id/sessions.vue | 31 ++-- server/objects/PlaybackSession.js | 9 +- 5 files changed, 179 insertions(+), 19 deletions(-) create mode 100644 client/components/modals/ListeningSessionModal.vue diff --git a/client/components/modals/ListeningSessionModal.vue b/client/components/modals/ListeningSessionModal.vue new file mode 100644 index 00000000..7c4166b6 --- /dev/null +++ b/client/components/modals/ListeningSessionModal.vue @@ -0,0 +1,150 @@ + + + \ No newline at end of file diff --git a/client/pages/config/stats.vue b/client/pages/config/stats.vue index ea8fa32e..9f37cfb5 100644 --- a/client/pages/config/stats.vue +++ b/client/pages/config/stats.vue @@ -37,7 +37,11 @@
-

Recent Listening Sessions

+
+

Recent Sessions

+
+ View All +

No Listening Sessions

@@ -77,6 +73,8 @@ export default { }, data() { return { + showSessionModal: false, + selectedSession: null, listeningSessions: [] } }, @@ -89,6 +87,10 @@ export default { } }, methods: { + showSession(session) { + this.selectedSession = session + this.showSessionModal = true + }, getDeviceInfoString(deviceInfo) { if (!deviceInfo) return '' var lines = [] @@ -127,12 +129,15 @@ export default { width: 100%; border: 1px solid #474747; } -.userSessionsTable tr:nth-child(even) { - background-color: #2e2e2e; +.userSessionsTable tr:first-child { + background-color: #272727; } .userSessionsTable tr:not(:first-child) { background-color: #373838; } +.userSessionsTable tr:not(:first-child):nth-child(odd) { + background-color: #2f2f2f; +} .userSessionsTable tr:hover:not(:first-child) { background-color: #474747; } diff --git a/server/objects/PlaybackSession.js b/server/objects/PlaybackSession.js index 9dd7f83f..5b69628a 100644 --- a/server/objects/PlaybackSession.js +++ b/server/objects/PlaybackSession.js @@ -9,6 +9,7 @@ class PlaybackSession { constructor(session) { this.id = null this.userId = null + this.libraryId = null this.libraryItemId = null this.episodeId = null @@ -47,8 +48,8 @@ class PlaybackSession { toJSON() { return { id: this.id, - sessionType: this.sessionType, userId: this.userId, + libraryId: this.libraryId, libraryItemId: this.libraryItemId, episodeId: this.episodeId, mediaType: this.mediaType, @@ -74,8 +75,8 @@ class PlaybackSession { toJSONForClient(libraryItem) { return { id: this.id, - sessionType: this.sessionType, userId: this.userId, + libraryId: this.libraryId, libraryItemId: this.libraryItemId, episodeId: this.episodeId, mediaType: this.mediaType, @@ -102,8 +103,8 @@ class PlaybackSession { construct(session) { this.id = session.id - this.sessionType = session.sessionType this.userId = session.userId + this.libraryId = session.libraryId || null this.libraryItemId = session.libraryItemId this.episodeId = session.episodeId this.mediaType = session.mediaType @@ -143,6 +144,7 @@ class PlaybackSession { setData(libraryItem, user, mediaPlayer, deviceInfo, startTime, episodeId = null) { this.id = getId('play') this.userId = user.id + this.libraryId = libraryItem.libraryId this.libraryItemId = libraryItem.id this.episodeId = episodeId this.mediaType = libraryItem.mediaType @@ -161,7 +163,6 @@ class PlaybackSession { this.mediaPlayer = mediaPlayer this.deviceInfo = deviceInfo || new DeviceInfo() - this.timeListening = 0 this.startTime = startTime this.currentTime = startTime