feat(beszel): add mock integration support for demo mode
Wire Beszel widgets into the mock integration pipeline so they work with UNSAFE_ENABLE_MOCK_INTEGRATION and DEMO_MODE for demos.
This commit is contained in:
9 files changed
+187
-13
No files matched your search
@@ -12,7 +12,7 @@ import { createManyIntegrationMiddleware } from "../../middlewares/integration";
|
||||
import { createTRPCRouter, publicProcedure } from "../../trpc";
|
||||
|
||||
export const beszelRouter = createTRPCRouter({
|
||||
getSystems: publicProcedure.concat(createManyIntegrationMiddleware("query", "beszel")).query(async ({ ctx }) => {
|
||||
getSystems: publicProcedure.concat(createManyIntegrationMiddleware("query", "beszel", "mock")).query(async ({ ctx }) => {
|
||||
const results = await Promise.all(
|
||||
ctx.integrations.map(async (integration) => {
|
||||
const innerHandler = beszelSystemsRequestHandler.handler(integration, {});
|
||||
@@ -30,7 +30,7 @@ export const beszelRouter = createTRPCRouter({
|
||||
}),
|
||||
|
||||
subscribeSystems: publicProcedure
|
||||
.concat(createManyIntegrationMiddleware("query", "beszel"))
|
||||
.concat(createManyIntegrationMiddleware("query", "beszel", "mock"))
|
||||
.subscription(({ ctx }) => {
|
||||
return observable<{ integrationId: string; systems: BeszelSystemRow[]; timestamp: Date }>((emit) => {
|
||||
const unsubscribes = ctx.integrations.map((integration) => {
|
||||
@@ -50,7 +50,7 @@ export const beszelRouter = createTRPCRouter({
|
||||
}),
|
||||
|
||||
getAlerts: publicProcedure
|
||||
.concat(createManyIntegrationMiddleware("query", "beszel"))
|
||||
.concat(createManyIntegrationMiddleware("query", "beszel", "mock"))
|
||||
.input(
|
||||
z.object({
|
||||
includeHistory: z.boolean().default(true),
|
||||
@@ -86,7 +86,7 @@ export const beszelRouter = createTRPCRouter({
|
||||
}),
|
||||
|
||||
subscribeAlerts: publicProcedure
|
||||
.concat(createManyIntegrationMiddleware("query", "beszel"))
|
||||
.concat(createManyIntegrationMiddleware("query", "beszel", "mock"))
|
||||
.input(
|
||||
z.object({
|
||||
includeHistory: z.boolean().default(true),
|
||||
@@ -111,7 +111,7 @@ export const beszelRouter = createTRPCRouter({
|
||||
}),
|
||||
|
||||
getSystemStats: publicProcedure
|
||||
.concat(createManyIntegrationMiddleware("query", "beszel"))
|
||||
.concat(createManyIntegrationMiddleware("query", "beszel", "mock"))
|
||||
.input(
|
||||
z.object({
|
||||
systemId: z.string(),
|
||||
|
||||
Reference in new issue
Block a user