Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { SearchBarTrigger } from "./components/SearchBarTrigger";
import { SidebarToggle } from "./components/SidebarToggle";
import { V2WorkspaceOpenInButton } from "./components/V2WorkspaceOpenInButton";
import { V2WorkspaceSearchBarTrigger } from "./components/V2WorkspaceSearchBarTrigger";
import { VersionToggle } from "./components/VersionToggle";
import { WindowControls } from "./components/WindowControls";

export function TopBar() {
Expand All @@ -31,7 +30,7 @@ export function TopBar() {
{ enabled: !!workspaceId && !isV2WorkspaceRoute },
);
const isOnline = useOnlineStatus();
const { isV2CloudEnabled, isRemoteV2Enabled } = useIsV2CloudEnabled();
const { isV2CloudEnabled } = useIsV2CloudEnabled();
// Default to Mac layout while loading to avoid overlap with traffic lights
const isMac = platform === undefined || platform === "darwin";

Expand All @@ -46,7 +45,6 @@ export function TopBar() {
<SidebarToggle />
<NavigationControls />
<ResourceConsumption />
{isRemoteV2Enabled && <VersionToggle />}
</div>

{isV2WorkspaceRoute ? (
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { cn } from "@superset/ui/utils";
import { Link, useMatchRoute } from "@tanstack/react-router";
import {
HiOutlineBeaker,
HiOutlineBell,
HiOutlineBuildingOffice2,
HiOutlineCommandLine,
Expand Down Expand Up @@ -35,6 +36,7 @@ type SettingsRoute =
| "/settings/terminal"
| "/settings/links"
| "/settings/models"
| "/settings/experimental"
| "/settings/integrations"
| "/settings/billing"
| "/settings/api-keys"
Expand Down Expand Up @@ -170,6 +172,12 @@ const SECTION_GROUPS: SectionGroup[] = [
icon: <HiOutlineShieldCheck className="h-4 w-4" />,
macOnly: true,
},
{
id: "/settings/experimental",
section: "experimental",
label: "Experimental",
icon: <HiOutlineBeaker className="h-4 w-4" />,
},
],
},
];
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import { Label } from "@superset/ui/label";
import { Switch } from "@superset/ui/switch";
import { useIsV2CloudEnabled } from "renderer/hooks/useIsV2CloudEnabled";
import { useV2LocalOverrideStore } from "renderer/stores/v2-local-override";
import {
isItemVisible,
SETTING_ITEM_ID,
type SettingItemId,
} from "../../../utils/settings-search";

interface ExperimentalSettingsProps {
visibleItems?: SettingItemId[] | null;
}

export function ExperimentalSettings({
visibleItems,
}: ExperimentalSettingsProps) {
const showSupersetV2 = isItemVisible(
SETTING_ITEM_ID.EXPERIMENTAL_SUPERSET_V2,
visibleItems,
);
const { isV2CloudEnabled, isRemoteV2Enabled } = useIsV2CloudEnabled();
const setForceV1 = useV2LocalOverrideStore((state) => state.setForceV1);

return (
<div className="p-6 max-w-4xl w-full">
<div className="mb-8">
<h2 className="text-xl font-semibold">Experimental</h2>
<p className="text-sm text-muted-foreground mt-1">
Try early access features and previews
</p>
</div>

<div className="space-y-6">
{showSupersetV2 && (
<div className="flex items-center justify-between">
<div className="space-y-0.5">
<Label htmlFor="superset-v2" className="text-sm font-medium">
Try Superset Version 2 (Early Access)
</Label>
<p className="text-xs text-muted-foreground">
Use the new workspace experience when early access is available
</p>
{!isRemoteV2Enabled && (
<p className="text-xs text-muted-foreground">
Early access is not enabled for this account.
</p>
)}
</div>
<Switch
id="superset-v2"
checked={isV2CloudEnabled}
onCheckedChange={(enabled) => setForceV1(!enabled)}
disabled={!isRemoteV2Enabled}
/>
</div>
)}
</div>
</div>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { ExperimentalSettings } from "./ExperimentalSettings";
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { createFileRoute } from "@tanstack/react-router";
import { useMemo } from "react";
import { useSettingsSearchQuery } from "renderer/stores/settings-state";
import { getMatchingItemsForSection } from "../utils/settings-search";
import { ExperimentalSettings } from "./components/ExperimentalSettings";

export const Route = createFileRoute("/_authenticated/settings/experimental/")({
component: ExperimentalSettingsPage,
});

function ExperimentalSettingsPage() {
const searchQuery = useSettingsSearchQuery();

const visibleItems = useMemo(() => {
if (!searchQuery) return null;
return getMatchingItemsForSection(searchQuery, "experimental").map(
(item) => item.id,
);
}, [searchQuery]);

return <ExperimentalSettings visibleItems={visibleItems} />;
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ const SECTION_ORDER: SettingsSection[] = [
"billing",
"apikeys",
"permissions",
"experimental",
];

function getSectionFromPath(pathname: string): SettingsSection | null {
Expand All @@ -52,6 +53,7 @@ function getSectionFromPath(pathname: string): SettingsSection | null {
if (pathname.includes("/settings/terminal")) return "terminal";
if (pathname.includes("/settings/links")) return "links";
if (pathname.includes("/settings/models")) return "models";
if (pathname.includes("/settings/experimental")) return "experimental";
if (pathname.includes("/settings/integrations")) return "integrations";
if (pathname.includes("/settings/permissions")) return "permissions";
if (pathname.includes("/settings/project")) return "project";
Expand Down Expand Up @@ -80,6 +82,8 @@ function getPathFromSection(section: SettingsSection): string {
return "/settings/links";
case "models":
return "/settings/models";
case "experimental":
return "/settings/experimental";
case "integrations":
return "/settings/integrations";
case "permissions":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ export const SETTING_ITEM_ID = {
MODELS_ANTHROPIC: "models-anthropic",
MODELS_OPENAI: "models-openai",

EXPERIMENTAL_SUPERSET_V2: "experimental-superset-v2",

INTEGRATIONS_LINEAR: "integrations-linear",
INTEGRATIONS_GITHUB: "integrations-github",
INTEGRATIONS_SLACK: "integrations-slack",
Expand Down Expand Up @@ -704,6 +706,26 @@ export const SETTINGS_ITEMS: SettingsItem[] = [
"auto name",
],
},
{
id: SETTING_ITEM_ID.EXPERIMENTAL_SUPERSET_V2,
section: "experimental",
title: "Try Superset Version 2 (Early Access)",
description: "Switch between Superset V1 and the new V2 experience",
keywords: [
"experimental",
"experiments",
"v2",
"v1",
"version",
"early access",
"beta",
"preview",
"workspace",
"workspaces",
"toggle",
"switch",
],
},
{
id: SETTING_ITEM_ID.INTEGRATIONS_LINEAR,
section: "integrations",
Expand Down
1 change: 1 addition & 0 deletions apps/desktop/src/renderer/stores/settings-state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export type SettingsSection =
| "terminal"
| "links"
| "models"
| "experimental"
| "integrations"
| "billing"
| "apikeys"
Expand Down
6 changes: 3 additions & 3 deletions apps/desktop/src/renderer/stores/v2-local-override.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ import { devtools, persist } from "zustand/middleware";
interface V2LocalOverrideState {
/** When true, forces v1 mode locally even though v2 is enabled remotely. */
forceV1: boolean;
toggle: () => void;
setForceV1: (forceV1: boolean) => void;
}
Comment on lines 4 to 8
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Unused toggle function is now dead code

The toggle() method was only called from the deleted VersionToggle.tsx component. Now that VersionToggle is removed and ExperimentalSettings uses setForceV1 directly, toggle has no remaining callers and can be removed from both the interface and the store implementation.

Suggested change
interface V2LocalOverrideState {
/** When true, forces v1 mode locally even though v2 is enabled remotely. */
forceV1: boolean;
setForceV1: (forceV1: boolean) => void;
toggle: () => void;
}
interface V2LocalOverrideState {
/** When true, forces v1 mode locally even though v2 is enabled remotely. */
forceV1: boolean;
setForceV1: (forceV1: boolean) => void;
}
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/desktop/src/renderer/stores/v2-local-override.ts
Line: 4-9

Comment:
**Unused `toggle` function is now dead code**

The `toggle()` method was only called from the deleted `VersionToggle.tsx` component. Now that `VersionToggle` is removed and `ExperimentalSettings` uses `setForceV1` directly, `toggle` has no remaining callers and can be removed from both the interface and the store implementation.

```suggestion
interface V2LocalOverrideState {
	/** When true, forces v1 mode locally even though v2 is enabled remotely. */
	forceV1: boolean;
	setForceV1: (forceV1: boolean) => void;
}
```

How can I resolve this? If you propose a fix, please make it concise.


export const useV2LocalOverrideStore = create<V2LocalOverrideState>()(
devtools(
persist(
(set, get) => ({
(set) => ({
forceV1: false,
toggle: () => set({ forceV1: !get().forceV1 }),
setForceV1: (forceV1) => set({ forceV1 }),
}),
{ name: "v2-local-override" },
),
Expand Down
Loading