From 91a5a0bffd819dbd6aae2ca7bf72a33e24011cde Mon Sep 17 00:00:00 2001 From: FoxxMD Date: Thu, 20 Aug 2026 00:40:05 +0000 Subject: [PATCH] more ignore behavior fixes --- .../scrobblers/AbstractScrobbleClient.ts | 8 +++---- src/backend/server/api.ts | 10 ++++++++- src/backend/sources/AbstractSource.ts | 7 ++++-- src/client/components/ActivityTimeline.tsx | 2 +- src/client/components/Badges.tsx | 10 ++++----- .../msComponent/MSComponentDetailed.tsx | 22 +++++++++---------- src/core/Api.ts | 4 ++-- 7 files changed, 36 insertions(+), 27 deletions(-) diff --git a/src/backend/scrobblers/AbstractScrobbleClient.ts b/src/backend/scrobblers/AbstractScrobbleClient.ts index b813671d..e4b48a42 100644 --- a/src/backend/scrobblers/AbstractScrobbleClient.ts +++ b/src/backend/scrobblers/AbstractScrobbleClient.ts @@ -467,12 +467,12 @@ export default abstract class AbstractScrobbleClient extends AbstractComponent i } public getRunningState(): ComponentState { - if(this.scrobbling) { - return COMPONENT_STATE.RUNNING; - } - if(this.scheduler.getAllJobs().length > 0) { + if(this.scrobbleQueuePromise === undefined) { return COMPONENT_STATE.IDLE; } + if(this.scrobbling && !this.isMonitoring()) { + return COMPONENT_STATE.IGNORED; + } return COMPONENT_STATE.RUNNING; } diff --git a/src/backend/server/api.ts b/src/backend/server/api.ts index 0dcc8e1f..a30b715f 100644 --- a/src/backend/server/api.ts +++ b/src/backend/server/api.ts @@ -354,8 +354,16 @@ export const setupApi = (app: Express, router: ReturnType, collap {text} - {reason !== undefined && reason !== null ? {reason} : null} + {reason !== undefined && reason !== null ? {reason} : null} ); } diff --git a/src/client/components/Badges.tsx b/src/client/components/Badges.tsx index f6e489de..30141d24 100644 --- a/src/client/components/Badges.tsx +++ b/src/client/components/Badges.tsx @@ -28,10 +28,8 @@ export const PlayStateBadge = (props: PropsWithChildren & { badgeColor = 'red'; break; case COMPONENT_STATE.IDLE: - badgeColor = 'orange'; + badgeColor = 'yellow'; break; - case COMPONENT_STATE.MUTED: - badgeColor = 'yellow'; + case COMPONENT_STATE.IGNORED: + badgeColor = 'orange'; break; } diff --git a/src/client/components/msComponent/MSComponentDetailed.tsx b/src/client/components/msComponent/MSComponentDetailed.tsx index 05050e92..8af9783c 100644 --- a/src/client/components/msComponent/MSComponentDetailed.tsx +++ b/src/client/components/msComponent/MSComponentDetailed.tsx @@ -162,16 +162,16 @@ const dialog = createOverlay((props) => { ) }) -const stateIsStarted = (state: ComponentState): boolean => state <= COMPONENT_STATE.MUTED; +const stateIsStarted = (state: ComponentState): boolean => state <= COMPONENT_STATE.IGNORED; const componentStateMenuItem = (Icon: IconType, value: string, name?: string) => (props: Pick = {}) => { return ({name ?? capitalize(value)}); } -const MenuItemRestart = componentStateMenuItem(RetryIcon, 'restart'); -const MenuItemStop = componentStateMenuItem(PowerOffIcon, 'stop'); -const MenuItemStart = componentStateMenuItem(PowerIcon, 'start'); -const MenuItemMute = componentStateMenuItem(EyeClosedIcon, 'mute', 'Ignore') -const MenuItemUnmute = componentStateMenuItem(EyeIcon, 'unmute', 'Monitor'); +const MenuItemRestart = componentStateMenuItem(RetryIcon, 'Restart'); +const MenuItemStop = componentStateMenuItem(PowerOffIcon, 'Stop'); +const MenuItemStart = componentStateMenuItem(PowerIcon, 'Start'); +const MenuItemIgnore = componentStateMenuItem(EyeClosedIcon, 'ignore', 'Ignore') +const MenuItemMonitor = componentStateMenuItem(EyeIcon, 'monitor', 'Monitor'); const MenuItemAuth = componentStateMenuItem(UnlockIconRaw, 'auth', 'Auth'); const primaryActionProps: ComponentProps = { @@ -212,15 +212,15 @@ export const ComponentStateBadgeActionable = (props: Omit mutate('restart')} disabled={isPending} {...primaryActionProps}/> - menuItems = [,]; + menuItems = [,]; break; case COMPONENT_STATE.IDLE: primaryAction = mutate('start')} disabled={isPending} {...primaryActionProps}/> - menuItems = [,,]; + menuItems = [,,]; break; - case COMPONENT_STATE.MUTED: - primaryAction = ; - menuItems = [,,]; + case COMPONENT_STATE.IGNORED: + primaryAction = mutate('monitor')} disabled={isPending} {...primaryActionProps}/>; + menuItems = [,,]; break; case COMPONENT_STATE.STOPPED: primaryAction = mutate('start')} disabled={isPending} {...primaryActionProps}/> diff --git a/src/core/Api.ts b/src/core/Api.ts index 2bab8d94..f9df5fc9 100644 --- a/src/core/Api.ts +++ b/src/core/Api.ts @@ -48,7 +48,7 @@ export interface PlayApiCommonDetailed extends PlayApiCommon { export type ComponentState = 1 | 2 | 3 | 4 | 5 | 6 | 7; export const COMPONENT_STATE = { RUNNING: 1, - MUTED: 2, + IGNORED: 2, IDLE: 3, STOPPED: 4, INITIALIZING: 5, @@ -216,7 +216,7 @@ export type CompareDateSingle = { export type CacheClearType = 'external-api' | 'transforms'; export const componentStateBodySchema = z.object({ - state: z.enum(["stop","start","restart","mute","unmute"]), + state: z.enum(["stop","start","restart","ignore","monitor"]), reason: z.string().optional() }); -- 2.51.2