From e8ab3005166e30bbda62aaf9a5b1a164873150a0 Mon Sep 17 00:00:00 2001 From: whitesoup12 Date: Thu, 30 Nov 2023 23:42:24 -0600 Subject: [PATCH] Fixes for duplicate PSAs, back-to-back sequences, and Dashboard tooltip styling (#120) --- .../api/repository/FppScheduleRepository.java | 5 +- .../api/service/ControlPanelService.java | 10 +- .../api/service/ViewerPageService.java | 8 ++ .../controlPanel/dashboard/ApexBarChart.js | 1 + .../controlPanel/dashboard/ApexLineChart.js | 1 + .../controlPanel/dashboard/DashboardCharts.js | 16 +-- .../viewerSettings/InteractionSettings.js | 2 - .../src/views/pages/externalViewer/index.js | 130 +++++++++--------- 8 files changed, 91 insertions(+), 82 deletions(-) diff --git a/remote-falcon-api/src/main/java/com/remotefalcon/api/repository/FppScheduleRepository.java b/remote-falcon-api/src/main/java/com/remotefalcon/api/repository/FppScheduleRepository.java index 6db3b36..0d2bdea 100644 --- a/remote-falcon-api/src/main/java/com/remotefalcon/api/repository/FppScheduleRepository.java +++ b/remote-falcon-api/src/main/java/com/remotefalcon/api/repository/FppScheduleRepository.java @@ -1,12 +1,10 @@ package com.remotefalcon.api.repository; import com.remotefalcon.api.entity.FppSchedule; -import com.remotefalcon.api.entity.RemoteJuke; +import jakarta.transaction.Transactional; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; -import jakarta.transaction.Transactional; -import java.util.List; import java.util.Optional; @Repository @@ -16,4 +14,5 @@ public interface FppScheduleRepository extends JpaRepository findByRemoteToken(String remoteToken); + Optional findFirstByRemoteToken(String remoteToken); } diff --git a/remote-falcon-api/src/main/java/com/remotefalcon/api/service/ControlPanelService.java b/remote-falcon-api/src/main/java/com/remotefalcon/api/service/ControlPanelService.java index 73c77be..4d2b8b8 100644 --- a/remote-falcon-api/src/main/java/com/remotefalcon/api/service/ControlPanelService.java +++ b/remote-falcon-api/src/main/java/com/remotefalcon/api/service/ControlPanelService.java @@ -294,13 +294,11 @@ public ResponseEntity saveRemotePrefs(RemotePreference request) { request.setRemotePrefToken(remotePreference.getRemotePrefToken()); this.remotePreferenceRepository.save(request); - if(remotePreference.getPsaEnabled() && request.getPsaSequenceList() != null) { - for(PsaSequence psaSequence : request.getPsaSequenceList()) { - psaSequence.setRemoteToken(tokenDTO.getRemoteToken()); - psaSequence.setPsaSequenceLastPlayed(ZonedDateTime.now()); - } - this.psaSequenceRepository.saveAll(request.getPsaSequenceList()); + for(PsaSequence psaSequence : request.getPsaSequenceList()) { + psaSequence.setRemoteToken(tokenDTO.getRemoteToken()); + psaSequence.setPsaSequenceLastPlayed(ZonedDateTime.now()); } + this.psaSequenceRepository.saveAll(request.getPsaSequenceList()); List psaSequenceList = this.psaSequenceRepository.findAllByRemoteTokenOrderByPsaSequenceOrderAsc(tokenDTO.getRemoteToken()); if(!remotePreference.getPsaEnabled() && CollectionUtils.isNotEmpty(psaSequenceList)) { diff --git a/remote-falcon-api/src/main/java/com/remotefalcon/api/service/ViewerPageService.java b/remote-falcon-api/src/main/java/com/remotefalcon/api/service/ViewerPageService.java index 509a8ab..4233da0 100644 --- a/remote-falcon-api/src/main/java/com/remotefalcon/api/service/ViewerPageService.java +++ b/remote-falcon-api/src/main/java/com/remotefalcon/api/service/ViewerPageService.java @@ -398,6 +398,14 @@ public ResponseEntity addPlaylistToQueue(ViewerTokenDTO vie return ResponseEntity.status(202).body(AddSequenceResponse.builder().message("SONG_REQUESTED").build()); } + //Request Limit Check for Schedule + Optional fppSchedule = this.fppScheduleRepository.findFirstByRemoteToken(remoteToken); + if(fppSchedule.isPresent()) { + if(StringUtils.equalsIgnoreCase(request.getSequence(), fppSchedule.get().getNextScheduledSequence())) { + return ResponseEntity.status(202).body(AddSequenceResponse.builder().message("SONG_REQUESTED").build()); + } + } + //Checks Done //Add Request int futureRequestSequence = 1; diff --git a/remote-falcon-web/src/views/pages/controlPanel/dashboard/ApexBarChart.js b/remote-falcon-web/src/views/pages/controlPanel/dashboard/ApexBarChart.js index 67f402d..697a1ce 100644 --- a/remote-falcon-web/src/views/pages/controlPanel/dashboard/ApexBarChart.js +++ b/remote-falcon-web/src/views/pages/controlPanel/dashboard/ApexBarChart.js @@ -61,6 +61,7 @@ const ApexBarChart = ({ ...otherProps }) => { borderColor: grey200 }, tooltip: { + followCursor: true, theme: navType === 'dark' ? 'dark' : 'light', y: { formatter(value) { diff --git a/remote-falcon-web/src/views/pages/controlPanel/dashboard/ApexLineChart.js b/remote-falcon-web/src/views/pages/controlPanel/dashboard/ApexLineChart.js index 43d7584..f5b959b 100644 --- a/remote-falcon-web/src/views/pages/controlPanel/dashboard/ApexLineChart.js +++ b/remote-falcon-web/src/views/pages/controlPanel/dashboard/ApexLineChart.js @@ -76,6 +76,7 @@ const ApexLineChart = ({ ...otherProps }) => { borderColor: grey200 }, tooltip: { + followCursor: true, theme: navType === 'dark' ? 'dark' : 'light', y: { formatter(value) { diff --git a/remote-falcon-web/src/views/pages/controlPanel/dashboard/DashboardCharts.js b/remote-falcon-web/src/views/pages/controlPanel/dashboard/DashboardCharts.js index 3856d05..f7d0e59 100644 --- a/remote-falcon-web/src/views/pages/controlPanel/dashboard/DashboardCharts.js +++ b/remote-falcon-web/src/views/pages/controlPanel/dashboard/DashboardCharts.js @@ -128,7 +128,7 @@ const DashboardCharts = ({ ...otherProps }) => { ) : ( - + @@ -137,7 +137,7 @@ const DashboardCharts = ({ ...otherProps }) => { ) : ( - + @@ -147,7 +147,7 @@ const DashboardCharts = ({ ...otherProps }) => { ) : ( otherProps.viewerControlMode === 'jukebox' && ( - + @@ -158,7 +158,7 @@ const DashboardCharts = ({ ...otherProps }) => { ) : ( otherProps.viewerControlMode === 'jukebox' && ( - + @@ -169,7 +169,7 @@ const DashboardCharts = ({ ...otherProps }) => { ) : ( otherProps.viewerControlMode === 'voting' && ( - + @@ -180,7 +180,7 @@ const DashboardCharts = ({ ...otherProps }) => { ) : ( otherProps.viewerControlMode === 'voting' && ( - + @@ -191,7 +191,7 @@ const DashboardCharts = ({ ...otherProps }) => { ) : ( otherProps.viewerControlMode === 'voting' && ( - + @@ -202,7 +202,7 @@ const DashboardCharts = ({ ...otherProps }) => { ) : ( otherProps.viewerControlMode === 'voting' && ( - + diff --git a/remote-falcon-web/src/views/pages/controlPanel/viewerSettings/InteractionSettings.js b/remote-falcon-web/src/views/pages/controlPanel/viewerSettings/InteractionSettings.js index cf75b23..c9ddf49 100644 --- a/remote-falcon-web/src/views/pages/controlPanel/viewerSettings/InteractionSettings.js +++ b/remote-falcon-web/src/views/pages/controlPanel/viewerSettings/InteractionSettings.js @@ -6,8 +6,6 @@ import PropTypes from 'prop-types'; import MainCard from 'ui-component/cards/MainCard'; -import { saveGPSLocation } from './helpers'; - const viewerPresentModes = [ { label: 'GPS Location', id: 'gps' }, { label: 'Code', id: 'code' } diff --git a/remote-falcon-web/src/views/pages/externalViewer/index.js b/remote-falcon-web/src/views/pages/externalViewer/index.js index ed106fe..05cc4e1 100644 --- a/remote-falcon-web/src/views/pages/externalViewer/index.js +++ b/remote-falcon-web/src/views/pages/externalViewer/index.js @@ -291,40 +291,42 @@ const ExternalViewerPage = () => { const categorizedSequencesArray = []; const categorizedSequencesToIterate = _.cloneDeep(externalViewerPageDetails?.sequences); _.map(categorizedSequencesToIterate, (categorizedSequence) => { - if (categorizedSequence.sequenceCategory === sequence.sequenceCategory) { - sequenceImageElement = [<>]; - if ( - categorizedSequence && - categorizedSequence.sequenceImageUrl && - categorizedSequence.sequenceImageUrl.replace(/\s/g, '').length - ) { - const classname = `sequence-image sequence-image-${categorizedSequence.sequenceKey}`; - sequenceImageElement = ( - {categorizedSequence.sequenceName} + if (categorizedSequence.sequenceVisible) { + if (categorizedSequence.sequenceCategory === sequence.sequenceCategory) { + sequenceImageElement = [<>]; + if ( + categorizedSequence && + categorizedSequence.sequenceImageUrl && + categorizedSequence.sequenceImageUrl.replace(/\s/g, '').length + ) { + const classname = `sequence-image sequence-image-${categorizedSequence.sequenceKey}`; + sequenceImageElement = ( + {categorizedSequence.sequenceName} + ); + } + const categorizedVotingListClassname = `cell-vote-playlist cell-vote-playlist-${sequence.sequenceKey}`; + const categorizedVotingListArtistClassname = `cell-vote-playlist-artist cell-vote-playlist-artist-${sequence.sequenceKey}`; + const theElement = ( + <> +
voteForSequence(e)} + data-key={categorizedSequence.sequenceName} + > + {sequenceImageElement} + {categorizedSequence.sequenceDisplayName} +
{categorizedSequence.sequenceArtist}
+
+
{categorizedSequence.sequenceVotes}
+ ); + categorizedSequencesArray.push(theElement); } - const categorizedVotingListClassname = `cell-vote-playlist cell-vote-playlist-${sequence.sequenceKey}`; - const categorizedVotingListArtistClassname = `cell-vote-playlist-artist cell-vote-playlist-artist-${sequence.sequenceKey}`; - const theElement = ( - <> -
voteForSequence(e)} - data-key={categorizedSequence.sequenceName} - > - {sequenceImageElement} - {categorizedSequence.sequenceDisplayName} -
{categorizedSequence.sequenceArtist}
-
-
{categorizedSequence.sequenceVotes}
- - ); - categorizedSequencesArray.push(theElement); } }); @@ -356,39 +358,41 @@ const ExternalViewerPage = () => { const categorizedSequencesArray = []; const categorizedSequencesToIterate = _.cloneDeep(externalViewerPageDetails?.sequences); _.map(categorizedSequencesToIterate, (categorizedSequence) => { - if (categorizedSequence.sequenceCategory === sequence.sequenceCategory) { - sequenceImageElement = [<>]; - if ( - categorizedSequence && - categorizedSequence.sequenceImageUrl && - categorizedSequence.sequenceImageUrl.replace(/\s/g, '').length - ) { - const classname = `sequence-image sequence-image-${categorizedSequence.sequenceKey}`; - sequenceImageElement = ( - {categorizedSequence.sequenceName} + if (categorizedSequence.sequenceVisible) { + if (categorizedSequence.sequenceCategory === sequence.sequenceCategory) { + sequenceImageElement = [<>]; + if ( + categorizedSequence && + categorizedSequence.sequenceImageUrl && + categorizedSequence.sequenceImageUrl.replace(/\s/g, '').length + ) { + const classname = `sequence-image sequence-image-${categorizedSequence.sequenceKey}`; + sequenceImageElement = ( + {categorizedSequence.sequenceName} + ); + } + const categorizedJukeboxListClassname = `jukebox-list jukebox-list-${categorizedSequence.sequenceKey}`; + const categorizedJukeboxListArtistClassname = `jukebox-list-artist jukebox-list-artist-${categorizedSequence.sequenceKey}`; + const theElement = ( + <> +
addSequenceToQueue(e)} + data-key={categorizedSequence.sequenceName} + > + {sequenceImageElement} + {categorizedSequence.sequenceDisplayName} +
{categorizedSequence.sequenceArtist}
+
+ ); + categorizedSequencesArray.push(theElement); } - const categorizedJukeboxListClassname = `jukebox-list jukebox-list-${categorizedSequence.sequenceKey}`; - const categorizedJukeboxListArtistClassname = `jukebox-list-artist jukebox-list-artist-${categorizedSequence.sequenceKey}`; - const theElement = ( - <> -
addSequenceToQueue(e)} - data-key={categorizedSequence.sequenceName} - > - {sequenceImageElement} - {categorizedSequence.sequenceDisplayName} -
{categorizedSequence.sequenceArtist}
-
- - ); - categorizedSequencesArray.push(theElement); } });