fix: address PR review feedback on mock services
- Restore `await Promise.resolve()` in all async mock methods to satisfy require-await lint rule (download, calendar, media-releases, media-server, network-controller-summary) - Fix Docker mock container ports to include required `IP` field and use proper `Port` type from dockerode - Add app widgets for bookmarked apps to the demo dashboard - Reposition bookmarks widget (6 wide, after Proxmox) and allow edit mode with discard-on-exit in demo mode
This commit is contained in:
9 files changed
+413
-83
No files matched your search
@@ -27,7 +27,15 @@ const eventTemplates: EventTemplate[] = [
|
||||
badge: { content: "S4/E3", color: "red" },
|
||||
},
|
||||
indicatorColor: "blue",
|
||||
links: [{ href: "https://www.imdb.com/title/tt8111088/", name: "IMDb", color: "#f5c518", isDark: false, logo: "/images/apps/imdb.svg" }],
|
||||
links: [
|
||||
{
|
||||
href: "https://www.imdb.com/title/tt8111088/",
|
||||
name: "IMDb",
|
||||
color: "#f5c518",
|
||||
isDark: false,
|
||||
logo: "/images/apps/imdb.svg",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
title: "Silo",
|
||||
@@ -41,7 +49,15 @@ const eventTemplates: EventTemplate[] = [
|
||||
badge: { content: "S2/E8", color: "teal" },
|
||||
},
|
||||
indicatorColor: "teal",
|
||||
links: [{ href: "https://www.imdb.com/title/tt14688458/", name: "IMDb", color: "#f5c518", isDark: false, logo: "/images/apps/imdb.svg" }],
|
||||
links: [
|
||||
{
|
||||
href: "https://www.imdb.com/title/tt14688458/",
|
||||
name: "IMDb",
|
||||
color: "#f5c518",
|
||||
isDark: false,
|
||||
logo: "/images/apps/imdb.svg",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
title: "Dune: Part Two",
|
||||
@@ -55,7 +71,15 @@ const eventTemplates: EventTemplate[] = [
|
||||
},
|
||||
metadata: { type: "radarr", releaseType: "digitalRelease" },
|
||||
indicatorColor: "cyan",
|
||||
links: [{ href: "https://www.imdb.com/title/tt15239678/", name: "IMDb", color: "#f5c518", isDark: false, logo: "/images/apps/imdb.svg" }],
|
||||
links: [
|
||||
{
|
||||
href: "https://www.imdb.com/title/tt15239678/",
|
||||
name: "IMDb",
|
||||
color: "#f5c518",
|
||||
isDark: false,
|
||||
logo: "/images/apps/imdb.svg",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
title: "Severance",
|
||||
@@ -83,7 +107,15 @@ const eventTemplates: EventTemplate[] = [
|
||||
},
|
||||
metadata: { type: "radarr", releaseType: "physicalRelease" },
|
||||
indicatorColor: "orange",
|
||||
links: [{ href: "https://www.imdb.com/title/tt15398776/", name: "IMDb", color: "#f5c518", isDark: false, logo: "/images/apps/imdb.svg" }],
|
||||
links: [
|
||||
{
|
||||
href: "https://www.imdb.com/title/tt15398776/",
|
||||
name: "IMDb",
|
||||
color: "#f5c518",
|
||||
isDark: false,
|
||||
logo: "/images/apps/imdb.svg",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
title: "Homarr Meetup",
|
||||
@@ -94,7 +126,15 @@ const eventTemplates: EventTemplate[] = [
|
||||
location: "Mountains",
|
||||
image: null,
|
||||
indicatorColor: "#fa5252",
|
||||
links: [{ href: "https://homarr.dev", name: "Homarr", logo: "https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/svg/homarr.svg", color: "#000000", isDark: true }],
|
||||
links: [
|
||||
{
|
||||
href: "https://homarr.dev",
|
||||
name: "Homarr",
|
||||
logo: "https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/svg/homarr.svg",
|
||||
color: "#000000",
|
||||
isDark: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
title: "The Bear",
|
||||
@@ -144,28 +184,30 @@ const buildEventsForRange = (start: Date, end: Date): CalendarEvent[] => {
|
||||
const rangeStart = new Date(start);
|
||||
rangeStart.setDate(rangeStart.getDate() - 3);
|
||||
|
||||
return eventTemplates.map((tpl) => {
|
||||
const startDate = new Date(rangeStart);
|
||||
startDate.setDate(startDate.getDate() + tpl.dayOffset);
|
||||
startDate.setHours(tpl.hours, 0, 0, 0);
|
||||
return eventTemplates
|
||||
.map((tpl) => {
|
||||
const startDate = new Date(rangeStart);
|
||||
startDate.setDate(startDate.getDate() + tpl.dayOffset);
|
||||
startDate.setHours(tpl.hours, 0, 0, 0);
|
||||
|
||||
return {
|
||||
title: tpl.title,
|
||||
subTitle: tpl.subTitle,
|
||||
description: tpl.description,
|
||||
startDate,
|
||||
endDate: tpl.location ? new Date(startDate.getTime() + 2 * 60 * 60 * 1000) : null,
|
||||
image: tpl.image,
|
||||
location: tpl.location ?? null,
|
||||
indicatorColor: tpl.indicatorColor,
|
||||
links: tpl.links,
|
||||
...(tpl.metadata ? { metadata: tpl.metadata } : {}),
|
||||
};
|
||||
}).filter((event) => event.startDate >= start && event.startDate <= end);
|
||||
return {
|
||||
title: tpl.title,
|
||||
subTitle: tpl.subTitle,
|
||||
description: tpl.description,
|
||||
startDate,
|
||||
endDate: tpl.location ? new Date(startDate.getTime() + 2 * 60 * 60 * 1000) : null,
|
||||
image: tpl.image,
|
||||
location: tpl.location ?? null,
|
||||
indicatorColor: tpl.indicatorColor,
|
||||
links: tpl.links,
|
||||
...(tpl.metadata ? { metadata: tpl.metadata } : {}),
|
||||
};
|
||||
})
|
||||
.filter((event) => event.startDate >= start && event.startDate <= end);
|
||||
};
|
||||
|
||||
export class CalendarMockService implements ICalendarIntegration {
|
||||
public async getCalendarEventsAsync(start: Date, end: Date, _includeUnmonitored: boolean): Promise<CalendarEvent[]> {
|
||||
return buildEventsForRange(start, end);
|
||||
return await Promise.resolve(buildEventsForRange(start, end));
|
||||
}
|
||||
}
|
||||
@@ -125,30 +125,40 @@ const mockItems: Omit<DownloadClientItem, "id" | "index">[] = [
|
||||
|
||||
export class DownloadClientMockService implements IDownloadClientIntegration {
|
||||
public async getClientJobsAndStatusAsync(input: { limit: number }): Promise<DownloadClientJobsAndStatus> {
|
||||
return {
|
||||
return await Promise.resolve({
|
||||
status: {
|
||||
paused: false,
|
||||
rates: {
|
||||
down: 121_100_000,
|
||||
up: 9_340_000,
|
||||
},
|
||||
types: ["torrent", "usenet"],
|
||||
types: ["torrent", "usenet"] as const,
|
||||
},
|
||||
items: mockItems.slice(0, input.limit).map((item, index) => ({
|
||||
...item,
|
||||
id: `mock-${index}`,
|
||||
index,
|
||||
})),
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
public async pauseQueueAsync(): Promise<void> {}
|
||||
public async pauseQueueAsync(): Promise<void> {
|
||||
await Promise.resolve();
|
||||
}
|
||||
|
||||
public async pauseItemAsync(_item: DownloadClientItem): Promise<void> {}
|
||||
public async pauseItemAsync(_item: DownloadClientItem): Promise<void> {
|
||||
await Promise.resolve();
|
||||
}
|
||||
|
||||
public async resumeQueueAsync(): Promise<void> {}
|
||||
public async resumeQueueAsync(): Promise<void> {
|
||||
await Promise.resolve();
|
||||
}
|
||||
|
||||
public async resumeItemAsync(_item: DownloadClientItem): Promise<void> {}
|
||||
public async resumeItemAsync(_item: DownloadClientItem): Promise<void> {
|
||||
await Promise.resolve();
|
||||
}
|
||||
|
||||
public async deleteItemAsync(_item: DownloadClientItem, _fromDisk: boolean): Promise<void> {}
|
||||
public async deleteItemAsync(_item: DownloadClientItem, _fromDisk: boolean): Promise<void> {
|
||||
await Promise.resolve();
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@ import type { IMediaReleasesIntegration, MediaRelease } from "../../interfaces/m
|
||||
|
||||
export class MediaReleasesMockService implements IMediaReleasesIntegration {
|
||||
public async getMediaReleasesAsync(): Promise<MediaRelease[]> {
|
||||
return mockMediaReleases;
|
||||
return await Promise.resolve(mockMediaReleases);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,8 @@ export const mockMediaReleases: MediaRelease[] = [
|
||||
type: "movie",
|
||||
title: "Inception",
|
||||
subtitle: "A mind-bending thriller",
|
||||
description: "A thief who steals corporate secrets through dream-sharing technology is given the task of planting an idea into the mind of a CEO.",
|
||||
description:
|
||||
"A thief who steals corporate secrets through dream-sharing technology is given the task of planting an idea into the mind of a CEO.",
|
||||
releaseDate: new Date("2010-07-16"),
|
||||
imageUrls: {
|
||||
poster: "https://image.tmdb.org/t/p/w300/ljsZTbVsrQSqZgWeep2B1QiDKuh.jpg",
|
||||
@@ -63,7 +64,8 @@ export const mockMediaReleases: MediaRelease[] = [
|
||||
type: "movie",
|
||||
title: "The Dark Knight",
|
||||
subtitle: "Theatrical Release",
|
||||
description: "Batman raises the stakes in his war on crime. With the help of Lt. Gordon and DA Harvey Dent, Batman sets out to dismantle organized crime.",
|
||||
description:
|
||||
"Batman raises the stakes in his war on crime. With the help of Lt. Gordon and DA Harvey Dent, Batman sets out to dismantle organized crime.",
|
||||
releaseDate: new Date("2008-07-18"),
|
||||
imageUrls: {
|
||||
poster: "https://image.tmdb.org/t/p/w300/qJ2tW6WMUDux911BTUgMe1nV8Is.jpg",
|
||||
@@ -99,7 +101,8 @@ export const mockMediaReleases: MediaRelease[] = [
|
||||
type: "tv",
|
||||
title: "Severance",
|
||||
subtitle: "S2E1 - Premiere",
|
||||
description: "Mark leads a team of office workers whose memories are surgically divided between work and personal lives.",
|
||||
description:
|
||||
"Mark leads a team of office workers whose memories are surgically divided between work and personal lives.",
|
||||
releaseDate: new Date("2025-01-17"),
|
||||
imageUrls: {
|
||||
poster: "https://image.tmdb.org/t/p/w300/pJAtR4gMFnalHCmT9cByPFgkZ6B.jpg",
|
||||
@@ -115,7 +118,8 @@ export const mockMediaReleases: MediaRelease[] = [
|
||||
type: "movie",
|
||||
title: "Dune: Part Two",
|
||||
subtitle: "Theatrical Release",
|
||||
description: "Paul Atreides unites with the Fremen to seek revenge against the conspirators who destroyed his family.",
|
||||
description:
|
||||
"Paul Atreides unites with the Fremen to seek revenge against the conspirators who destroyed his family.",
|
||||
releaseDate: new Date("2024-03-01"),
|
||||
imageUrls: {
|
||||
poster: "https://image.tmdb.org/t/p/w300/8b8R8l88Qje9dn9OE8PY05Nez7.jpg",
|
||||
|
||||
@@ -2,16 +2,94 @@ import type { IMediaServerIntegration } from "../../interfaces/media-server/medi
|
||||
import type { CurrentSessionsInput, StreamSession } from "../../interfaces/media-server/media-server-types";
|
||||
|
||||
const sessions: StreamSession[] = [
|
||||
{ sessionId: "s-0", sessionName: "Living Room TV", user: { userId: "u-0", username: "thomas", profilePictureUrl: null }, currentlyPlaying: { type: "movie", name: "Interstellar", seasonName: undefined, episodeName: null, albumName: null, episodeCount: null, metadata: null } },
|
||||
{ sessionId: "s-1", sessionName: "Bedroom Chromecast", user: { userId: "u-1", username: "sarah", profilePictureUrl: null }, currentlyPlaying: { type: "video", name: "Breaking Bad", seasonName: "Season 5", episodeName: "Ozymandias", albumName: null, episodeCount: null, metadata: null } },
|
||||
{ sessionId: "s-2", sessionName: "Office Desktop", user: { userId: "u-2", username: "mike", profilePictureUrl: null }, currentlyPlaying: { type: "movie", name: "The Dark Knight", seasonName: undefined, episodeName: null, albumName: null, episodeCount: null, metadata: null } },
|
||||
{ sessionId: "s-3", sessionName: "iPad", user: { userId: "u-3", username: "emily", profilePictureUrl: null }, currentlyPlaying: { type: "video", name: "Severance", seasonName: "Season 2", episodeName: "The We We Are", albumName: null, episodeCount: null, metadata: null } },
|
||||
{ sessionId: "s-4", sessionName: "Mobile", user: { userId: "u-4", username: "alex", profilePictureUrl: null }, currentlyPlaying: { type: "audio", name: "Daft Punk", seasonName: undefined, episodeName: null, albumName: "Random Access Memories", episodeCount: null, metadata: null } },
|
||||
{ sessionId: "s-5", sessionName: "Guest Room", user: { userId: "u-5", username: "guest", profilePictureUrl: null }, currentlyPlaying: { type: "movie", name: "Oppenheimer", seasonName: undefined, episodeName: null, albumName: null, episodeCount: null, metadata: null } },
|
||||
{
|
||||
sessionId: "s-0",
|
||||
sessionName: "Living Room TV",
|
||||
user: { userId: "u-0", username: "thomas", profilePictureUrl: null },
|
||||
currentlyPlaying: {
|
||||
type: "movie",
|
||||
name: "Interstellar",
|
||||
seasonName: undefined,
|
||||
episodeName: null,
|
||||
albumName: null,
|
||||
episodeCount: null,
|
||||
metadata: null,
|
||||
},
|
||||
},
|
||||
{
|
||||
sessionId: "s-1",
|
||||
sessionName: "Bedroom Chromecast",
|
||||
user: { userId: "u-1", username: "sarah", profilePictureUrl: null },
|
||||
currentlyPlaying: {
|
||||
type: "video",
|
||||
name: "Breaking Bad",
|
||||
seasonName: "Season 5",
|
||||
episodeName: "Ozymandias",
|
||||
albumName: null,
|
||||
episodeCount: null,
|
||||
metadata: null,
|
||||
},
|
||||
},
|
||||
{
|
||||
sessionId: "s-2",
|
||||
sessionName: "Office Desktop",
|
||||
user: { userId: "u-2", username: "mike", profilePictureUrl: null },
|
||||
currentlyPlaying: {
|
||||
type: "movie",
|
||||
name: "The Dark Knight",
|
||||
seasonName: undefined,
|
||||
episodeName: null,
|
||||
albumName: null,
|
||||
episodeCount: null,
|
||||
metadata: null,
|
||||
},
|
||||
},
|
||||
{
|
||||
sessionId: "s-3",
|
||||
sessionName: "iPad",
|
||||
user: { userId: "u-3", username: "emily", profilePictureUrl: null },
|
||||
currentlyPlaying: {
|
||||
type: "video",
|
||||
name: "Severance",
|
||||
seasonName: "Season 2",
|
||||
episodeName: "The We We Are",
|
||||
albumName: null,
|
||||
episodeCount: null,
|
||||
metadata: null,
|
||||
},
|
||||
},
|
||||
{
|
||||
sessionId: "s-4",
|
||||
sessionName: "Mobile",
|
||||
user: { userId: "u-4", username: "alex", profilePictureUrl: null },
|
||||
currentlyPlaying: {
|
||||
type: "audio",
|
||||
name: "Daft Punk",
|
||||
seasonName: undefined,
|
||||
episodeName: null,
|
||||
albumName: "Random Access Memories",
|
||||
episodeCount: null,
|
||||
metadata: null,
|
||||
},
|
||||
},
|
||||
{
|
||||
sessionId: "s-5",
|
||||
sessionName: "Guest Room",
|
||||
user: { userId: "u-5", username: "guest", profilePictureUrl: null },
|
||||
currentlyPlaying: {
|
||||
type: "movie",
|
||||
name: "Oppenheimer",
|
||||
seasonName: undefined,
|
||||
episodeName: null,
|
||||
albumName: null,
|
||||
episodeCount: null,
|
||||
metadata: null,
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
export class MediaServerMockService implements IMediaServerIntegration {
|
||||
public async getCurrentSessionsAsync(_options: CurrentSessionsInput): Promise<StreamSession[]> {
|
||||
return sessions;
|
||||
return await Promise.resolve(sessions);
|
||||
}
|
||||
}
|
||||
@@ -3,12 +3,12 @@ import type { NetworkControllerSummary } from "../../types";
|
||||
|
||||
export class NetworkControllerSummaryMockService implements NetworkControllerSummaryIntegration {
|
||||
public async getNetworkSummaryAsync(): Promise<NetworkControllerSummary> {
|
||||
return {
|
||||
return await Promise.resolve({
|
||||
lan: { guests: 5, users: 18, status: "enabled" },
|
||||
vpn: { users: 3, status: "enabled" },
|
||||
wanStatus: "enabled",
|
||||
wifi: { status: "enabled", guests: 2, users: 12 },
|
||||
www: { latency: 22, status: "enabled", ping: 14, uptime: 864000 },
|
||||
};
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user