diff --git a/components/dashboard/.vscode/settings.json b/components/dashboard/.vscode/settings.json new file mode 100644 index 00000000000000..dbcc89f9f09eed --- /dev/null +++ b/components/dashboard/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "typescript.preferences.autoImportFileExcludePatterns": [ + "@radix-ui/*" + ] +} diff --git a/components/dashboard/src/Insights.tsx b/components/dashboard/src/Insights.tsx index f86322e152a443..08b291341b629a 100644 --- a/components/dashboard/src/Insights.tsx +++ b/components/dashboard/src/Insights.tsx @@ -15,7 +15,6 @@ import { Item, ItemField, ItemsList } from "./components/ItemsList"; import { useWorkspaceSessions } from "./data/insights/list-workspace-sessions-query"; import { WorkspaceSessionGroup } from "./insights/WorkspaceSessionGroup"; import { gitpodHostUrl } from "./service/service"; -import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@podkit/select/Select"; import dayjs from "dayjs"; import { Timestamp } from "@bufbuild/protobuf"; import { LoadingButton } from "@podkit/buttons/LoadingButton"; @@ -26,16 +25,11 @@ import { useToast } from "./components/toasts/Toasts"; import { useTemporaryState } from "./hooks/use-temporary-value"; import { DownloadIcon } from "lucide-react"; import { Button } from "@podkit/buttons/Button"; +import { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem } from "@podkit/dropdown/DropDown"; +import { useInstallationConfiguration } from "./data/installation/default-workspace-image-query"; export const Insights = () => { - const [prebuildsFilter, setPrebuildsFilter] = useState<"week" | "month" | "year">("week"); - const [upperBound, lowerBound] = useMemo(() => { - const from = dayjs().subtract(1, prebuildsFilter).startOf("day"); - - const fromTimestamp = Timestamp.fromDate(from.toDate()); - const toTimestamp = Timestamp.fromDate(new Date()); - return [fromTimestamp, toTimestamp]; - }, [prebuildsFilter]); + const toDate = useMemo(() => Timestamp.fromDate(new Date()), []); const { data, error: errorMessage, @@ -44,9 +38,11 @@ export const Insights = () => { hasNextPage, fetchNextPage, } = useWorkspaceSessions({ - from: upperBound, - to: lowerBound, + from: Timestamp.fromDate(new Date(0)), + to: toDate, }); + const { data: installationConfig } = useInstallationConfiguration(); + const isDedicatedInstallation = !!installationConfig?.isDedicatedInstallation; const hasMoreThanOnePage = (data?.pages.length ?? 0) > 1; const sessions = useMemo(() => data?.pages.flatMap((p) => p) ?? [], [data]); @@ -59,21 +55,11 @@ export const Insights = () => {