feat: add search and external integration contracts
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { useRef, useState, useEffect } from "react";
|
||||
import { Bell, Check, LogOut, Settings, UserCircle } from "lucide-react";
|
||||
import type { ApiSettings, AuthInfo, AuthTenantMembership, AuthUpdate, LoginResponse, ViewsRuntimeUiCapability } from "../types";
|
||||
import type { ApiSettings, AuthInfo, AuthTenantMembership, AuthUpdate, LoginResponse, SearchRuntimeUiCapability, ViewsRuntimeUiCapability } from "../types";
|
||||
import HelpMenu from "./HelpMenu";
|
||||
import LanguageMenu from "./LanguageMenu";
|
||||
import LoginModal from "../features/auth/LoginModal";
|
||||
@@ -37,6 +37,8 @@ export default function Titlebar({ settings, auth, onAuthChange, maintenanceMode
|
||||
const projection = useEffectiveView();
|
||||
const viewsRuntime = usePlatformUiCapability<ViewsRuntimeUiCapability>("views.runtime");
|
||||
const ViewSelector = viewsRuntime?.Selector ?? null;
|
||||
const searchRuntime = usePlatformUiCapability<SearchRuntimeUiCapability>("search.runtime");
|
||||
const GlobalSearch = searchRuntime?.GlobalSearch ?? null;
|
||||
|
||||
const activeTenant = auth?.active_tenant ?? auth?.tenant ?? null;
|
||||
const tenants = auth?.tenants ?? (activeTenant ? [activeTenant] : []);
|
||||
@@ -200,6 +202,10 @@ export default function Titlebar({ settings, auth, onAuthChange, maintenanceMode
|
||||
|
||||
<div className="titlebar-spacer" />
|
||||
|
||||
{auth && GlobalSearch &&
|
||||
<GlobalSearch settings={settings} auth={auth} />
|
||||
}
|
||||
|
||||
<LanguageMenu />
|
||||
<HelpMenu auth={auth} />
|
||||
|
||||
|
||||
@@ -406,6 +406,30 @@ export type ViewsRuntimeUiCapability = {
|
||||
Selector?: ComponentType<ViewSelectorProps>;
|
||||
};
|
||||
|
||||
export type SearchContextContribution = {
|
||||
id: string;
|
||||
moduleId: string;
|
||||
label: string;
|
||||
pathPrefixes: string[];
|
||||
resourceTypes?: string[];
|
||||
placeholder?: string;
|
||||
surfaceId?: string;
|
||||
order?: number;
|
||||
};
|
||||
|
||||
export type SearchContextsUiCapability = {
|
||||
contexts: SearchContextContribution[];
|
||||
};
|
||||
|
||||
export type GlobalSearchProps = {
|
||||
settings: ApiSettings;
|
||||
auth: AuthInfo;
|
||||
};
|
||||
|
||||
export type SearchRuntimeUiCapability = {
|
||||
GlobalSearch: ComponentType<GlobalSearchProps>;
|
||||
};
|
||||
|
||||
export type DashboardWidgetSize = "small" | "medium" | "wide" | "full";
|
||||
|
||||
export type DashboardWidgetTone = "neutral" | "good" | "warning" | "danger" | "info";
|
||||
|
||||
Reference in New Issue
Block a user