diff --git a/keep-ui/app/dashboard/[id]/dashboard.tsx b/keep-ui/app/dashboard/[id]/dashboard.tsx index f97a38cfa..965f7f5fa 100644 --- a/keep-ui/app/dashboard/[id]/dashboard.tsx +++ b/keep-ui/app/dashboard/[id]/dashboard.tsx @@ -116,7 +116,6 @@ const DashboardPage = () => { const handleEditWidget = (id: string, update?: WidgetData) => { let itemToEdit = widgetData.find((d) => d.i === id) || null; - console.log(itemToEdit, update); if (itemToEdit && update) { setEditingItem({ ...itemToEdit, ...update }); } else { diff --git a/keep-ui/utils/hooks/useDashboardPresets.ts b/keep-ui/utils/hooks/useDashboardPresets.ts index b8c976c27..807fd7e1d 100644 --- a/keep-ui/utils/hooks/useDashboardPresets.ts +++ b/keep-ui/utils/hooks/useDashboardPresets.ts @@ -1,7 +1,7 @@ import { useHydratedSession as useSession } from "@/shared/lib/hooks/useHydratedSession"; import { usePresets } from "./usePresets"; import { Preset } from "app/alerts/models"; -import { useMemo } from "react"; +import { useCallback, useMemo } from "react"; import { useSearchParams } from "next/navigation"; export const useDashboardPreset = () => { @@ -22,12 +22,15 @@ export const useDashboardPreset = () => { }); const searchParams = useSearchParams(); - const checkValidPreset = (preset: Preset) => { - if (!preset.is_private) { - return true; - } - return preset && preset.created_by == session?.user?.email; - }; + const checkValidPreset = useCallback( + (preset: Preset) => { + if (!preset.is_private) { + return true; + } + return preset && preset.created_by == session?.user?.email; + }, + [session] + ); let allPreset = useMemo(() => { /*If any filters are applied on the dashboard, we will fetch live data; otherwise, @@ -40,7 +43,14 @@ export const useDashboardPreset = () => { checkValidPreset(preset) ); return combinedPresets; - }, [presets, fetchedPresets, searchParams, presets, fetchedPresets]); + }, [ + searchParams, + presets, + fetchedPresets, + presetsOrderFromLS, + staticPresetsOrderFromLS, + checkValidPreset, + ]); return allPreset; }; diff --git a/keep/api/models/db/migrations/versions/2024-11-08-20-58_895fe80117aa.py b/keep/api/models/db/migrations/versions/2024-11-08-20-58_895fe80117aa.py index 957c84b2a..d84f73803 100644 --- a/keep/api/models/db/migrations/versions/2024-11-08-20-58_895fe80117aa.py +++ b/keep/api/models/db/migrations/versions/2024-11-08-20-58_895fe80117aa.py @@ -6,6 +6,7 @@ """ +from datetime import datetime import sqlalchemy as sa from alembic import op @@ -23,8 +24,7 @@ def upgrade() -> None: sa.Column( "timestamp", sa.DateTime(), - nullable=False, - server_default=sa.text("CURRENT_TIMESTAMP"), + nullable=True, ), ) op.add_column(