diff --git a/src/lib/client/notifications-client.ts b/src/lib/client/notifications-client.ts index f549eb36..b4a93178 100644 --- a/src/lib/client/notifications-client.ts +++ b/src/lib/client/notifications-client.ts @@ -1,6 +1,6 @@ import { resolve } from "$app/paths"; import clientResolver from "$lib/client/resolver.js"; -import type { NotificationEvent } from "$lib/server/controllers/dashboardController.js"; +import type { NotificationEvent } from "$lib/types/notifications.js"; interface NotificationsResponse { notifications?: NotificationEvent[]; diff --git a/src/lib/components/NotificationsList.svelte b/src/lib/components/NotificationsList.svelte index 9c4e9cdf..0eef328a 100644 --- a/src/lib/components/NotificationsList.svelte +++ b/src/lib/components/NotificationsList.svelte @@ -6,7 +6,7 @@ import { Button } from "$lib/components/ui/button/index.js"; import { formatDate, formatDuration } from "$lib/stores/datetime"; import { t } from "$lib/stores/i18n"; - import type { NotificationEvent } from "$lib/server/controllers/dashboardController.js"; + import type { NotificationEvent } from "$lib/types/notifications.js"; import Calendar from "@lucide/svelte/icons/calendar-1"; import { format } from "date-fns"; import { onMount } from "svelte"; @@ -78,7 +78,14 @@

{$t("Events")}

-
diff --git a/src/lib/components/NotificationsPopover.svelte b/src/lib/components/NotificationsPopover.svelte index 69eb43f1..c97725e1 100644 --- a/src/lib/components/NotificationsPopover.svelte +++ b/src/lib/components/NotificationsPopover.svelte @@ -6,7 +6,7 @@ import { requestNotifications } from "$lib/client/notifications-client.js"; import ICONS from "$lib/icons"; import { t } from "$lib/stores/i18n"; - import type { NotificationEvent } from "$lib/server/controllers/dashboardController.js"; + import type { NotificationEvent } from "$lib/types/notifications.js"; import { onMount } from "svelte"; interface Props { diff --git a/src/lib/locales/en.json b/src/lib/locales/en.json index 9bc3c930..ad44c3a4 100644 --- a/src/lib/locales/en.json +++ b/src/lib/locales/en.json @@ -87,6 +87,7 @@ "Notifications": "Notifications", "One-time": "One-time", "Ongoing": "Ongoing", + "Open events page": "Open events page", "Operational": "Operational", "Partial Degraded Performance": "Partial Degraded Performance", "Partial System Outage": "Partial System Outage", diff --git a/src/lib/server/controllers/dashboardController.ts b/src/lib/server/controllers/dashboardController.ts index f65c50cc..eb5e3edd 100644 --- a/src/lib/server/controllers/dashboardController.ts +++ b/src/lib/server/controllers/dashboardController.ts @@ -17,6 +17,9 @@ import type { import type { GroupMonitorTypeData } from "../types/monitor.js"; import GC from "../../global-constants.js"; import type { LayoutServerData } from "./layoutController.js"; +import type { NotificationEvent } from "../../types/notifications.js"; + +export type { NotificationEvent }; // Default page settings const defaultPageSettings: PageSettingsType = { @@ -27,16 +30,6 @@ const defaultPageSettings: PageSettingsType = { monitor_layout_style: GC.DEFAULT_MONITOR_LAYOUT_STYLE, }; -export interface NotificationEvent { - eventURL: string; - eventTitle: string; - eventDate: string; - eventType: string; - eventStartDateTime: number; - eventEndDateTime: number | null; - eventStatus: string; -} - export interface NotificationPayload { notifications: NotificationEvent[]; } diff --git a/src/lib/server/controllers/layoutController.ts b/src/lib/server/controllers/layoutController.ts index a663a9b3..83a65d8d 100644 --- a/src/lib/server/controllers/layoutController.ts +++ b/src/lib/server/controllers/layoutController.ts @@ -80,7 +80,8 @@ function NormalizeEventDisplaySettings(settings?: Partial) const defaults = structuredClone(seedSiteData.eventDisplaySettings); return { - showInlineEvents: Boolean(settings?.showInlineEvents ?? defaults.showInlineEvents), + showInlineEvents: + typeof settings?.showInlineEvents === "boolean" ? settings.showInlineEvents : defaults.showInlineEvents, incidents: { ...defaults.incidents, ...settings?.incidents, diff --git a/src/lib/types/notifications.ts b/src/lib/types/notifications.ts new file mode 100644 index 00000000..b13e8c21 --- /dev/null +++ b/src/lib/types/notifications.ts @@ -0,0 +1,9 @@ +export interface NotificationEvent { + eventURL: string; + eventTitle: string; + eventDate: string; + eventType: string; + eventStartDateTime: number; + eventEndDateTime: number | null; + eventStatus: string; +} diff --git a/src/routes/(kener)/+page.svelte b/src/routes/(kener)/+page.svelte index 59bdf030..41fce3a5 100644 --- a/src/routes/(kener)/+page.svelte +++ b/src/routes/(kener)/+page.svelte @@ -172,7 +172,7 @@
-
+
{#if !!data.monitorTags.length} {#if showInlineEvents && data.ongoingIncidents && data.ongoingIncidents.length > 0} diff --git a/src/routes/(kener)/[page_path]/+page.svelte b/src/routes/(kener)/[page_path]/+page.svelte index bc7f750a..95f60cf7 100644 --- a/src/routes/(kener)/[page_path]/+page.svelte +++ b/src/routes/(kener)/[page_path]/+page.svelte @@ -144,7 +144,7 @@
- +
{#if data.pageDetails?.page_logo}
- +
{#if data.monitorImage}