diff --git a/src/api/services/configs.ts b/src/api/services/configs.ts index 38f0825e8..d05c499a5 100644 --- a/src/api/services/configs.ts +++ b/src/api/services/configs.ts @@ -11,6 +11,7 @@ import { ConfigChange, ConfigHealthCheckView, ConfigItem, + ConfigItemDetails, ConfigSummary, ConfigTypeRelationships } from "../types/configs"; @@ -138,7 +139,7 @@ export const getAllChanges = ( }; export const getConfig = (id: string) => - resolvePostGrestRequestWithPagination( + resolvePostGrestRequestWithPagination( ConfigDB.get(`/config_detail?id=eq.${id}&select=*,config_scrapers(id,name)`) ); diff --git a/src/api/types/configs.ts b/src/api/types/configs.ts index 9ecfda145..571420874 100644 --- a/src/api/types/configs.ts +++ b/src/api/types/configs.ts @@ -1,5 +1,6 @@ import { Agent, Avatar, CreatedAt, Timestamped } from "../traits"; import { HealthCheckSummary } from "./health"; +import { Topology } from "./topology"; export interface ConfigChange extends CreatedAt { id: string; @@ -69,13 +70,6 @@ export interface ConfigItem extends Timestamped, Avatar, Agent, Costs { id: string; name: string; }; - summary?: { - relationships?: number; - analysis?: number; - changes?: number; - playbook_runs?: number; - checks?: number; - }; properties?: { icon: string; name: string; @@ -87,6 +81,17 @@ export interface ConfigItem extends Timestamped, Avatar, Agent, Costs { last_scraped_time?: string; } +export interface ConfigItemDetails extends ConfigItem { + summary?: { + relationships?: number; + analysis?: number; + changes?: number; + playbook_runs?: number; + checks?: number; + }; + components?: Topology[]; +} + export interface ConfigItemGraphData extends ConfigItem { expanded?: boolean; expandable?: boolean; diff --git a/src/components/Configs/ConfigDetailsTabs.tsx b/src/components/Configs/ConfigDetailsTabs.tsx index a91d715be..6188f9f61 100644 --- a/src/components/Configs/ConfigDetailsTabs.tsx +++ b/src/components/Configs/ConfigDetailsTabs.tsx @@ -1,4 +1,5 @@ import { SearchLayout } from "@flanksource-ui/ui/Layout/SearchLayout"; +import IncidentDetailsPageSkeletonLoader from "@flanksource-ui/ui/SkeletonLoader/IncidentDetailsPageSkeletonLoader"; import clsx from "clsx"; import { useAtom } from "jotai"; import { ReactNode } from "react"; @@ -9,6 +10,7 @@ import { Head } from "../../ui/Head"; import { refreshButtonClickedTrigger } from "../../ui/SlidingSideBar/SlidingSideBar"; import TabbedLinks from "../../ui/Tabs/TabbedLinks"; import { ErrorBoundary } from "../ErrorBoundary"; +import { TopologyCard } from "../Topology/TopologyCard"; import { useConfigDetailsTabs } from "./ConfigTabsLinks"; import ConfigSidebar from "./Sidebar/ConfigSidebar"; @@ -69,21 +71,31 @@ export function ConfigDetailsTabs({ loading={isLoading} contentClass="p-0 h-full overflow-y-hidden" > -
-
- + ) : ( +
+
+ {configItem?.components && configItem.components.length === 1 && ( +
+ +
)} - > - {children} - + + + {children} + +
+
- -
+ )} ); diff --git a/src/components/Configs/ConfigTabsLinks.tsx b/src/components/Configs/ConfigTabsLinks.tsx index 293b40798..b3b9e75ad 100644 --- a/src/components/Configs/ConfigTabsLinks.tsx +++ b/src/components/Configs/ConfigTabsLinks.tsx @@ -1,8 +1,10 @@ import { Badge } from "@flanksource-ui/ui/Badge/Badge"; import { useParams } from "react-router-dom"; -import { ConfigItem } from "../../api/types/configs"; +import { ConfigItemDetails } from "../../api/types/configs"; -export function useConfigDetailsTabs(countSummary?: ConfigItem["summary"]) { +export function useConfigDetailsTabs( + countSummary?: ConfigItemDetails["summary"] +) { const { id } = useParams<{ id: string }>(); return [ diff --git a/src/components/Topology/TopologyCard/index.tsx b/src/components/Topology/TopologyCard/index.tsx index aa7a654fd..b85e2228b 100644 --- a/src/components/Topology/TopologyCard/index.tsx +++ b/src/components/Topology/TopologyCard/index.tsx @@ -37,7 +37,20 @@ export const StatusStyles: Record = { interface IProps { size?: Size | string; topologyId?: string; - topology?: Topology; + topology?: Pick< + Topology, + | "summary" + | "is_leaf" + | "id" + | "properties" + | "components" + | "agent_id" + | "status" + | "status_reason" + | "text" + | "name" + | "icon" + >; selectionMode?: boolean; hideMenu?: boolean; // where to open new links