fix(webui): open ready apps by default (#6685)
* fix(webui): open ready apps by default * test(webui): select apps when checking catalog cache
This commit is contained in:
1 parent
7782095a85
commit
e767174450
7 files changed
+130
-14
No files matched your search
@@ -35,7 +35,7 @@ import {
|
||||
SettingsSectionTitle,
|
||||
RestartRequiredNotice,
|
||||
} from "@/components/settings/shared/SettingsControls";
|
||||
import { AppsCatalogSettings } from "@/components/settings/system/AppsSettings";
|
||||
import { AppsCatalogPage } from "@/components/settings/system/AppsSettings";
|
||||
import {
|
||||
AutomationDeleteDialog,
|
||||
AutomationEditDialog,
|
||||
@@ -497,7 +497,6 @@ export function SettingsPage({
|
||||
onBeforeCloseChange={registerChannelCompletion}
|
||||
onConfigureMcp={(name) => {
|
||||
setMcpSetupName(name);
|
||||
systemState.setAppsKindFilter("mcp");
|
||||
systemState.setAppsQuery(name);
|
||||
selectSection("apps");
|
||||
}}
|
||||
@@ -521,7 +520,7 @@ export function SettingsPage({
|
||||
case "apps":
|
||||
return (
|
||||
<div className="settings-stack">
|
||||
<AppsCatalogSettings
|
||||
<AppsCatalogPage
|
||||
onConfigureProxy={configureProxy}
|
||||
setupName={mcpSetupName}
|
||||
onSetupOpened={() => setMcpSetupName(null)}
|
||||
@@ -530,7 +529,6 @@ export function SettingsPage({
|
||||
cliAppsLoading={systemState.cliAppsLoading}
|
||||
mcpPresetsLoading={systemState.mcpPresetsLoading}
|
||||
query={systemState.appsQuery}
|
||||
filter={systemState.appsKindFilter}
|
||||
cliActionKey={systemState.cliAppsAction}
|
||||
mcpActionKey={systemState.mcpPresetAction}
|
||||
mcpOAuthFlow={systemState.mcpOAuthFlow}
|
||||
@@ -549,7 +547,6 @@ export function SettingsPage({
|
||||
showBrandLogos={localPrefs.brandLogos}
|
||||
requiresRestartPending={pendingRestartSections.runtime}
|
||||
onQueryChange={systemState.setAppsQuery}
|
||||
onFilterChange={systemState.setAppsKindFilter}
|
||||
onCliAction={systemActions.handleCliAppAction}
|
||||
onMcpAction={systemActions.handleMcpPresetAction}
|
||||
onMcpOAuthConnect={systemActions.handleMcpOAuthConnect}
|
||||
|
||||
@@ -10,6 +10,7 @@ import {
|
||||
useId,
|
||||
useMemo,
|
||||
useState,
|
||||
type ComponentProps,
|
||||
type ComponentPropsWithoutRef,
|
||||
type Dispatch,
|
||||
type ReactNode,
|
||||
@@ -101,6 +102,23 @@ export const DEFAULT_CUSTOM_MCP_FORM: CustomMcpForm = {
|
||||
useProxy: false,
|
||||
};
|
||||
|
||||
export function AppsCatalogPage(props: Omit<ComponentProps<typeof AppsCatalogSettings>, "filter" | "onFilterChange">) {
|
||||
const [selection, setSelection] = useState<AppsKindFilter | null>(() => props.setupName ? "mcp" : null);
|
||||
const hasReady = Boolean(
|
||||
props.cliApps?.apps.some((app) => app.installed) || props.mcpPresets?.presets.some(mcpPresetReady),
|
||||
);
|
||||
const waiting = (props.cliAppsLoading && !props.cliApps) || (props.mcpPresetsLoading && !props.mcpPresets);
|
||||
const filter = selection ?? (hasReady || waiting ? "ready" : "cli");
|
||||
|
||||
useEffect(() => {
|
||||
if (selection === null && (hasReady || (props.cliApps && props.mcpPresets))) {
|
||||
setSelection(hasReady ? "ready" : "cli");
|
||||
}
|
||||
}, [selection, hasReady, props.cliApps, props.mcpPresets]);
|
||||
|
||||
return <AppsCatalogSettings {...props} filter={filter} onFilterChange={setSelection} />;
|
||||
}
|
||||
|
||||
export function AppsCatalogSettings({
|
||||
setupName,
|
||||
onSetupOpened,
|
||||
@@ -962,12 +980,13 @@ function appsTitle(item: AppsCatalogItem): string {
|
||||
return item.kind === "cli" ? item.app.display_name : item.preset.display_name;
|
||||
}
|
||||
|
||||
function mcpPresetReady(preset: McpPresetInfo): boolean {
|
||||
if (preset.enabled !== undefined) return preset.enabled;
|
||||
return preset.installed && preset.configured && preset.runtime_status === "connected";
|
||||
}
|
||||
|
||||
function appsReady(item: AppsCatalogItem): boolean {
|
||||
if (item.kind === "cli") return item.app.installed;
|
||||
if (item.preset.enabled !== undefined) return item.preset.enabled;
|
||||
return item.preset.installed &&
|
||||
item.preset.configured &&
|
||||
item.preset.runtime_status === "connected";
|
||||
return item.kind === "cli" ? item.app.installed : mcpPresetReady(item.preset);
|
||||
}
|
||||
|
||||
function appsSearchText(item: AppsCatalogItem): string {
|
||||
|
||||
@@ -5,7 +5,6 @@ import type { ToolsCatalog } from "@/lib/tools-catalog-cache";
|
||||
import type { AutomationFilter } from "@/components/settings/system/AutomationsSettings";
|
||||
import {
|
||||
DEFAULT_CUSTOM_MCP_FORM,
|
||||
type AppsKindFilter,
|
||||
type CustomMcpForm,
|
||||
} from "@/components/settings/system/AppsSettings";
|
||||
import type {
|
||||
@@ -50,7 +49,6 @@ export function useSystemSettingsState(toolsCatalog: ToolsCatalog) {
|
||||
const [cliAppsError, setCliAppsError] = useState<string | null>(null);
|
||||
const [nanobotFeaturesError, setNanobotFeaturesError] = useState<string | null>(null);
|
||||
const [cliAppsFocusName, setCliAppsFocusName] = useState<string | null>(null);
|
||||
const [appsKindFilter, setAppsKindFilter] = useState<AppsKindFilter>("cli");
|
||||
const [mcpMessage, setMcpMessage] = useState<string | null>(null);
|
||||
const [mcpError, setMcpError] = useState<string | null>(null);
|
||||
const [automationsError, setAutomationsError] = useState<string | null>(null);
|
||||
@@ -66,7 +64,6 @@ export function useSystemSettingsState(toolsCatalog: ToolsCatalog) {
|
||||
return {
|
||||
toolsCatalog,
|
||||
toolsCatalogInvalidation,
|
||||
appsKindFilter,
|
||||
appsQuery,
|
||||
automationAction,
|
||||
automationPendingDelete,
|
||||
@@ -103,7 +100,6 @@ export function useSystemSettingsState(toolsCatalog: ToolsCatalog) {
|
||||
nanobotFeatures,
|
||||
nanobotFeaturesError,
|
||||
nanobotFeaturesLoading,
|
||||
setAppsKindFilter,
|
||||
setAppsQuery,
|
||||
setAutomationAction,
|
||||
setAutomationPendingDelete,
|
||||
|
||||
Reference in new issue
Block a user