diff --git a/src/lib/components/widget/integration/IntegrationWidget.svelte b/src/lib/components/widget/integration/IntegrationWidget.svelte index d9f2400..ac95074 100644 --- a/src/lib/components/widget/integration/IntegrationWidget.svelte +++ b/src/lib/components/widget/integration/IntegrationWidget.svelte @@ -5,7 +5,15 @@ import ProgressRenderer from './ProgressRenderer.svelte'; import AlertBannerRenderer from './AlertBannerRenderer.svelte'; import ChartRenderer from './ChartRenderer.svelte'; - import type { IntegrationData } from '$lib/server/integrations/types.js'; + import type { + IntegrationData, + StatCardData, + GaugeData, + ListData, + ProgressData, + AlertBannerData, + ChartData + } from '$lib/server/integrations/types.js'; interface Props { config: { @@ -61,17 +69,17 @@ {:else if integrationData} {#if integrationData.renderer === 'stat-card'} - + {:else if integrationData.renderer === 'gauge'} - + {:else if integrationData.renderer === 'list'} - + {:else if integrationData.renderer === 'progress'} - + {:else if integrationData.renderer === 'alert-banner'} - + {:else if integrationData.renderer === 'chart'} - + {:else}
Unknown renderer: {integrationData.renderer}
{/if} diff --git a/src/lib/server/services/appService.ts b/src/lib/server/services/appService.ts index 6defeeb..2269de5 100644 --- a/src/lib/server/services/appService.ts +++ b/src/lib/server/services/appService.ts @@ -2,10 +2,11 @@ import { prisma } from '../prisma.js'; import type { CreateAppInput, UpdateAppInput } from '$lib/types/app.js'; import { encrypt, tryDecrypt } from '../integrations/encryption.js'; -function decryptAppIntegration(app: T): T { +function decryptAppIntegration>(app: T): T { + if (!('integrationConfig' in app) || !app.integrationConfig) return app; return { ...app, - integrationConfig: tryDecrypt(app.integrationConfig) + integrationConfig: tryDecrypt(app.integrationConfig as string) }; } diff --git a/src/lib/types/app.ts b/src/lib/types/app.ts index b66c85e..b598e5f 100644 --- a/src/lib/types/app.ts +++ b/src/lib/types/app.ts @@ -35,8 +35,8 @@ export interface CreateAppInput { readonly healthcheckMethod?: HealthcheckMethod; readonly healthcheckExpectedStatus?: number; readonly healthcheckTimeout?: number; - readonly integrationType?: string; - readonly integrationConfig?: string; + readonly integrationType?: string | null; + readonly integrationConfig?: string | null; readonly integrationEnabled?: boolean; readonly createdById?: string; }