@igstack/app-catalog-frontend-core 0.4.0-alpha-20260811152919 → 0.4.0-alpha-20260811181653
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/__tests__/integration/tools/AppDetailTools.d.ts +11 -0
- package/dist/esm/__tests__/integration/tools/CatalogTools.d.ts +12 -0
- package/dist/esm/modules/appCatalog/ui/components/SubResourceDetailPanel.d.ts +9 -0
- package/dist/esm/modules/appCatalog/ui/components/SubResourceDetailPanel.js +90 -0
- package/dist/esm/modules/appCatalog/ui/components/SubResourceDetailPanel.js.map +1 -0
- package/dist/esm/modules/appCatalog/ui/grid/AppCatalogGrid.d.ts +7 -1
- package/dist/esm/modules/appCatalog/ui/grid/AppCatalogGrid.js +108 -31
- package/dist/esm/modules/appCatalog/ui/grid/AppCatalogGrid.js.map +1 -1
- package/dist/esm/modules/appCatalog/ui/pages/AppCatalogPage.js +31 -4
- package/dist/esm/modules/appCatalog/ui/pages/AppCatalogPage.js.map +1 -1
- package/dist/esm/routeTree.gen.d.ts +2 -0
- package/dist/esm/routes/_layout/app.$slug.d.ts +1 -0
- package/dist/esm/routes/_layout/app._slug.js +2 -1
- package/dist/esm/routes/_layout/app._slug.js.map +1 -1
- package/dist/esm/routes/_layout/catalog.apps.index.d.ts +1 -0
- package/dist/esm/routes/_layout/catalog.apps.index.js +2 -1
- package/dist/esm/routes/_layout/catalog.apps.index.js.map +1 -1
- package/package.json +4 -4
- package/src/__tests__/integration/appCatalog.integration.test.ts +134 -0
- package/src/__tests__/integration/mock-backend/MockBackendConfigurer.ts +2 -0
- package/src/__tests__/integration/tools/AppDetailTools.ts +46 -0
- package/src/__tests__/integration/tools/CatalogTools.ts +77 -4
- package/src/modules/appCatalog/ui/components/SubResourceDetailPanel.tsx +124 -0
- package/src/modules/appCatalog/ui/grid/AppCatalogGrid.tsx +128 -34
- package/src/modules/appCatalog/ui/pages/AppCatalogPage.tsx +49 -8
- package/src/routes/_layout/app.$slug.tsx +1 -0
- package/src/routes/_layout/catalog.apps.index.tsx +1 -0
|
@@ -46,6 +46,17 @@ export declare class AppDetailTools {
|
|
|
46
46
|
* Returns the anchor element when the app has an appUrl, null otherwise.
|
|
47
47
|
*/
|
|
48
48
|
getOpenButton(): HTMLAnchorElement | null;
|
|
49
|
+
/**
|
|
50
|
+
* Get sub-resource detail panel data when a sub-resource is selected.
|
|
51
|
+
* Returns null if the sub-resource detail panel is not shown.
|
|
52
|
+
*/
|
|
53
|
+
getSubResourceDetail(): {
|
|
54
|
+
subResourceName: string;
|
|
55
|
+
hasStep1: boolean;
|
|
56
|
+
hasStep2: boolean;
|
|
57
|
+
backButtonLabel: string | null;
|
|
58
|
+
} | null;
|
|
59
|
+
clickBackToParent(): Promise<void>;
|
|
49
60
|
private getPanel;
|
|
50
61
|
private findHeading;
|
|
51
62
|
private getNextSiblingText;
|
|
@@ -48,6 +48,18 @@ export declare class CatalogTools {
|
|
|
48
48
|
* "Your apps" and "Browse all").
|
|
49
49
|
*/
|
|
50
50
|
private getLauncherRows;
|
|
51
|
+
/**
|
|
52
|
+
* Get expandable subresource rows shown under parents in search results.
|
|
53
|
+
* Returns null if no sub-rows are visible.
|
|
54
|
+
*/
|
|
55
|
+
getSubResourceRows(): {
|
|
56
|
+
visible: number;
|
|
57
|
+
total: number;
|
|
58
|
+
hasExpandRow: boolean;
|
|
59
|
+
names: string[];
|
|
60
|
+
} | null;
|
|
61
|
+
clickSubResource(displayName: string): Promise<void>;
|
|
62
|
+
expandSubResources(): Promise<void>;
|
|
51
63
|
/**
|
|
52
64
|
* Get the main catalog table (first table on page, skipping sub-resource tables in detail panel).
|
|
53
65
|
*/
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { AppApprovalMethod, Resource } from '@igstack/app-catalog-backend-core';
|
|
2
|
+
interface SubResourceDetailPanelProps {
|
|
3
|
+
subResource: Resource;
|
|
4
|
+
parent: Resource;
|
|
5
|
+
approvalMethods: AppApprovalMethod[];
|
|
6
|
+
onBack: () => void;
|
|
7
|
+
}
|
|
8
|
+
export declare function SubResourceDetailPanel({ subResource, parent, approvalMethods, onBack, }: SubResourceDetailPanelProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { ArrowLeft } from "lucide-react";
|
|
3
|
+
import { Button } from "../../../../ui/button.js";
|
|
4
|
+
import { Badge } from "../../../../ui/badge.js";
|
|
5
|
+
import { AccessRequestSection } from "./AccessRequestSection.js";
|
|
6
|
+
function StepBadge({ step }) {
|
|
7
|
+
return /* @__PURE__ */ jsx("span", { className: "inline-flex items-center justify-center size-6 rounded-full bg-primary text-primary-foreground text-xs font-semibold shrink-0", children: step });
|
|
8
|
+
}
|
|
9
|
+
function SubResourceDetailPanel({
|
|
10
|
+
subResource,
|
|
11
|
+
parent,
|
|
12
|
+
approvalMethods,
|
|
13
|
+
onBack
|
|
14
|
+
}) {
|
|
15
|
+
const hasParentAccess = !!parent.accessRequest;
|
|
16
|
+
const hasSubAccess = !!subResource.accessRequest;
|
|
17
|
+
const hasTwoStepAccess = hasParentAccess && hasSubAccess;
|
|
18
|
+
const hasAnyAccess = hasParentAccess || hasSubAccess;
|
|
19
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex h-full flex-col p-6", children: [
|
|
20
|
+
/* @__PURE__ */ jsx("div", { className: "mb-4", children: /* @__PURE__ */ jsxs(
|
|
21
|
+
Button,
|
|
22
|
+
{
|
|
23
|
+
variant: "ghost",
|
|
24
|
+
size: "sm",
|
|
25
|
+
onClick: onBack,
|
|
26
|
+
className: "gap-1.5 text-muted-foreground hover:text-foreground -ml-2",
|
|
27
|
+
"aria-label": `Back to ${parent.displayName}`,
|
|
28
|
+
children: [
|
|
29
|
+
/* @__PURE__ */ jsx(ArrowLeft, { className: "size-4" }),
|
|
30
|
+
/* @__PURE__ */ jsx("span", { children: parent.displayName })
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
) }),
|
|
34
|
+
/* @__PURE__ */ jsxs("div", { className: "border-b pb-4", children: [
|
|
35
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 flex-wrap", children: [
|
|
36
|
+
/* @__PURE__ */ jsx("h2", { className: "text-xl font-semibold", children: subResource.displayName }),
|
|
37
|
+
subResource.tier && /* @__PURE__ */ jsx(Badge, { variant: "outline", className: "text-xs", children: subResource.tier })
|
|
38
|
+
] }),
|
|
39
|
+
subResource.description && /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground mt-1", children: subResource.description }),
|
|
40
|
+
(subResource.aliases ?? []).length > 0 && /* @__PURE__ */ jsxs("p", { className: "text-xs text-muted-foreground mt-1", children: [
|
|
41
|
+
"Also known as: ",
|
|
42
|
+
(subResource.aliases ?? []).join(", ")
|
|
43
|
+
] })
|
|
44
|
+
] }),
|
|
45
|
+
hasAnyAccess && /* @__PURE__ */ jsxs("div", { className: "mt-6 space-y-6", children: [
|
|
46
|
+
/* @__PURE__ */ jsx("h3", { className: "text-sm font-medium", children: "How to get access" }),
|
|
47
|
+
hasTwoStepAccess ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
48
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
49
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
50
|
+
/* @__PURE__ */ jsx(StepBadge, { step: 1 }),
|
|
51
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm font-medium text-muted-foreground", children: parent.displayName })
|
|
52
|
+
] }),
|
|
53
|
+
/* @__PURE__ */ jsx("div", { className: "pl-8", children: /* @__PURE__ */ jsx(
|
|
54
|
+
AccessRequestSection,
|
|
55
|
+
{
|
|
56
|
+
app: parent,
|
|
57
|
+
approvalMethods
|
|
58
|
+
}
|
|
59
|
+
) })
|
|
60
|
+
] }),
|
|
61
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
62
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
63
|
+
/* @__PURE__ */ jsx(StepBadge, { step: 2 }),
|
|
64
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm font-medium text-muted-foreground", children: subResource.displayName })
|
|
65
|
+
] }),
|
|
66
|
+
/* @__PURE__ */ jsx("div", { className: "pl-8", children: /* @__PURE__ */ jsx(
|
|
67
|
+
AccessRequestSection,
|
|
68
|
+
{
|
|
69
|
+
app: subResource,
|
|
70
|
+
approvalMethods
|
|
71
|
+
}
|
|
72
|
+
) })
|
|
73
|
+
] })
|
|
74
|
+
] }) : (
|
|
75
|
+
/* Single-step: only one of them has access info */
|
|
76
|
+
/* @__PURE__ */ jsx(
|
|
77
|
+
AccessRequestSection,
|
|
78
|
+
{
|
|
79
|
+
app: hasParentAccess ? parent : subResource,
|
|
80
|
+
approvalMethods
|
|
81
|
+
}
|
|
82
|
+
)
|
|
83
|
+
)
|
|
84
|
+
] })
|
|
85
|
+
] });
|
|
86
|
+
}
|
|
87
|
+
export {
|
|
88
|
+
SubResourceDetailPanel
|
|
89
|
+
};
|
|
90
|
+
//# sourceMappingURL=SubResourceDetailPanel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SubResourceDetailPanel.js","sources":["../../../../../../src/modules/appCatalog/ui/components/SubResourceDetailPanel.tsx"],"sourcesContent":["import type {\n AppApprovalMethod,\n Resource,\n} from '@igstack/app-catalog-backend-core'\nimport { ArrowLeft } from 'lucide-react'\nimport { Button } from '~/ui/button'\nimport { Badge } from '~/ui/badge'\nimport { AccessRequestSection } from './AccessRequestSection'\n\ninterface SubResourceDetailPanelProps {\n subResource: Resource\n parent: Resource\n approvalMethods: AppApprovalMethod[]\n onBack: () => void\n}\n\nfunction StepBadge({ step }: { step: number }) {\n return (\n <span className=\"inline-flex items-center justify-center size-6 rounded-full bg-primary text-primary-foreground text-xs font-semibold shrink-0\">\n {step}\n </span>\n )\n}\n\nexport function SubResourceDetailPanel({\n subResource,\n parent,\n approvalMethods,\n onBack,\n}: SubResourceDetailPanelProps) {\n const hasParentAccess = !!parent.accessRequest\n const hasSubAccess = !!subResource.accessRequest\n const hasTwoStepAccess = hasParentAccess && hasSubAccess\n const hasAnyAccess = hasParentAccess || hasSubAccess\n\n return (\n <div className=\"flex h-full flex-col p-6\">\n {/* Back navigation */}\n <div className=\"mb-4\">\n <Button\n variant=\"ghost\"\n size=\"sm\"\n onClick={onBack}\n className=\"gap-1.5 text-muted-foreground hover:text-foreground -ml-2\"\n aria-label={`Back to ${parent.displayName}`}\n >\n <ArrowLeft className=\"size-4\" />\n <span>{parent.displayName}</span>\n </Button>\n </div>\n\n {/* Sub-resource title */}\n <div className=\"border-b pb-4\">\n <div className=\"flex items-center gap-2 flex-wrap\">\n <h2 className=\"text-xl font-semibold\">{subResource.displayName}</h2>\n {subResource.tier && (\n <Badge variant=\"outline\" className=\"text-xs\">\n {subResource.tier}\n </Badge>\n )}\n </div>\n {subResource.description && (\n <p className=\"text-sm text-muted-foreground mt-1\">\n {subResource.description}\n </p>\n )}\n {(subResource.aliases ?? []).length > 0 && (\n <p className=\"text-xs text-muted-foreground mt-1\">\n Also known as: {(subResource.aliases ?? []).join(', ')}\n </p>\n )}\n </div>\n\n {/* Two-step access section */}\n {hasAnyAccess && (\n <div className=\"mt-6 space-y-6\">\n <h3 className=\"text-sm font-medium\">How to get access</h3>\n\n {hasTwoStepAccess ? (\n <>\n {/* Step 1: Parent access */}\n <div className=\"space-y-2\">\n <div className=\"flex items-center gap-2\">\n <StepBadge step={1} />\n <span className=\"text-sm font-medium text-muted-foreground\">\n {parent.displayName}\n </span>\n </div>\n <div className=\"pl-8\">\n <AccessRequestSection\n app={parent}\n approvalMethods={approvalMethods}\n />\n </div>\n </div>\n\n {/* Step 2: Sub-resource access */}\n <div className=\"space-y-2\">\n <div className=\"flex items-center gap-2\">\n <StepBadge step={2} />\n <span className=\"text-sm font-medium text-muted-foreground\">\n {subResource.displayName}\n </span>\n </div>\n <div className=\"pl-8\">\n <AccessRequestSection\n app={subResource}\n approvalMethods={approvalMethods}\n />\n </div>\n </div>\n </>\n ) : (\n /* Single-step: only one of them has access info */\n <AccessRequestSection\n app={hasParentAccess ? parent : subResource}\n approvalMethods={approvalMethods}\n />\n )}\n </div>\n )}\n </div>\n )\n}\n"],"names":[],"mappings":";;;;;AAgBA,SAAS,UAAU,EAAE,QAA0B;AAC7C,SACE,oBAAC,QAAA,EAAK,WAAU,iIACb,UAAA,MACH;AAEJ;AAEO,SAAS,uBAAuB;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAgC;AAC9B,QAAM,kBAAkB,CAAC,CAAC,OAAO;AACjC,QAAM,eAAe,CAAC,CAAC,YAAY;AACnC,QAAM,mBAAmB,mBAAmB;AAC5C,QAAM,eAAe,mBAAmB;AAExC,SACE,qBAAC,OAAA,EAAI,WAAU,4BAEb,UAAA;AAAA,IAAA,oBAAC,OAAA,EAAI,WAAU,QACb,UAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,SAAQ;AAAA,QACR,MAAK;AAAA,QACL,SAAS;AAAA,QACT,WAAU;AAAA,QACV,cAAY,WAAW,OAAO,WAAW;AAAA,QAEzC,UAAA;AAAA,UAAA,oBAAC,WAAA,EAAU,WAAU,SAAA,CAAS;AAAA,UAC9B,oBAAC,QAAA,EAAM,UAAA,OAAO,YAAA,CAAY;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA,GAE9B;AAAA,IAGA,qBAAC,OAAA,EAAI,WAAU,iBACb,UAAA;AAAA,MAAA,qBAAC,OAAA,EAAI,WAAU,qCACb,UAAA;AAAA,QAAA,oBAAC,MAAA,EAAG,WAAU,yBAAyB,UAAA,YAAY,aAAY;AAAA,QAC9D,YAAY,QACX,oBAAC,OAAA,EAAM,SAAQ,WAAU,WAAU,WAChC,UAAA,YAAY,KAAA,CACf;AAAA,MAAA,GAEJ;AAAA,MACC,YAAY,eACX,oBAAC,OAAE,WAAU,sCACV,sBAAY,aACf;AAAA,OAEA,YAAY,WAAW,CAAA,GAAI,SAAS,KACpC,qBAAC,KAAA,EAAE,WAAU,sCAAqC,UAAA;AAAA,QAAA;AAAA,SAC/B,YAAY,WAAW,CAAA,GAAI,KAAK,IAAI;AAAA,MAAA,EAAA,CACvD;AAAA,IAAA,GAEJ;AAAA,IAGC,gBACC,qBAAC,OAAA,EAAI,WAAU,kBACb,UAAA;AAAA,MAAA,oBAAC,MAAA,EAAG,WAAU,uBAAsB,UAAA,qBAAiB;AAAA,MAEpD,mBACC,qBAAA,UAAA,EAEE,UAAA;AAAA,QAAA,qBAAC,OAAA,EAAI,WAAU,aACb,UAAA;AAAA,UAAA,qBAAC,OAAA,EAAI,WAAU,2BACb,UAAA;AAAA,YAAA,oBAAC,WAAA,EAAU,MAAM,EAAA,CAAG;AAAA,YACpB,oBAAC,QAAA,EAAK,WAAU,6CACb,iBAAO,YAAA,CACV;AAAA,UAAA,GACF;AAAA,UACA,oBAAC,OAAA,EAAI,WAAU,QACb,UAAA;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,KAAK;AAAA,cACL;AAAA,YAAA;AAAA,UAAA,EACF,CACF;AAAA,QAAA,GACF;AAAA,QAGA,qBAAC,OAAA,EAAI,WAAU,aACb,UAAA;AAAA,UAAA,qBAAC,OAAA,EAAI,WAAU,2BACb,UAAA;AAAA,YAAA,oBAAC,WAAA,EAAU,MAAM,EAAA,CAAG;AAAA,YACpB,oBAAC,QAAA,EAAK,WAAU,6CACb,sBAAY,YAAA,CACf;AAAA,UAAA,GACF;AAAA,UACA,oBAAC,OAAA,EAAI,WAAU,QACb,UAAA;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,KAAK;AAAA,cACL;AAAA,YAAA;AAAA,UAAA,EACF,CACF;AAAA,QAAA,EAAA,CACF;AAAA,MAAA,GACF;AAAA;AAAA,QAGA;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,KAAK,kBAAkB,SAAS;AAAA,YAChC;AAAA,UAAA;AAAA,QAAA;AAAA;AAAA,IACF,EAAA,CAEJ;AAAA,EAAA,GAEJ;AAEJ;"}
|
|
@@ -14,10 +14,16 @@ export interface AppCatalogGridProps {
|
|
|
14
14
|
onClearFilters?: () => void;
|
|
15
15
|
/** Called when the user closes the detail panel (Esc or X) — e.g. to navigate back to the catalog URL */
|
|
16
16
|
onClosePanel?: () => void;
|
|
17
|
+
/** Currently selected subresource slug */
|
|
18
|
+
selectedSubSlug?: string;
|
|
19
|
+
/** Called when user clicks a sub-row */
|
|
20
|
+
onSubClick?: (parentSlug: string, subSlug: string) => void;
|
|
21
|
+
/** Called when user clicks Back in sub detail */
|
|
22
|
+
onBackToParent?: () => void;
|
|
17
23
|
}
|
|
18
24
|
export declare function AppDetails({ app, onAppClick, onClosePanel, }: {
|
|
19
25
|
app: Resource;
|
|
20
26
|
onAppClick?: (app: Resource) => void;
|
|
21
27
|
onClosePanel: () => void;
|
|
22
28
|
}): import("react/jsx-runtime").JSX.Element;
|
|
23
|
-
export declare function AppCatalogGrid({ apps, selectedAppSlug, groupingDefinition, onAppClick, hasSearch, searchQuery, totalAppsCount, onClearFilters, onClosePanel, }: AppCatalogGridProps): import("react/jsx-runtime").JSX.Element;
|
|
29
|
+
export declare function AppCatalogGrid({ apps, selectedAppSlug, groupingDefinition, onAppClick, hasSearch, searchQuery, totalAppsCount, onClearFilters, onClosePanel, selectedSubSlug, onSubClick, onBackToParent, }: AppCatalogGridProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -25,6 +25,7 @@ import { markdownToPlainText } from "../../utils/markdownToPlainText.js";
|
|
|
25
25
|
import { formatRelativeTime } from "../../utils/formatRelativeTime.js";
|
|
26
26
|
import { TierVariantsSection } from "../components/TierVariantsSection.js";
|
|
27
27
|
import { SubResourcesSection } from "../components/SubResourcesSection.js";
|
|
28
|
+
import { SubResourceDetailPanel } from "../components/SubResourceDetailPanel.js";
|
|
28
29
|
import { getChildResources } from "../../utils/resolveHelpers.js";
|
|
29
30
|
function getIconUrl(iconName) {
|
|
30
31
|
return `/api/icons/${iconName}`;
|
|
@@ -546,10 +547,13 @@ function AppCatalogGrid({
|
|
|
546
547
|
searchQuery,
|
|
547
548
|
totalAppsCount,
|
|
548
549
|
onClearFilters,
|
|
549
|
-
onClosePanel
|
|
550
|
+
onClosePanel,
|
|
551
|
+
selectedSubSlug,
|
|
552
|
+
onSubClick,
|
|
553
|
+
onBackToParent
|
|
550
554
|
}) {
|
|
551
|
-
const { resources:
|
|
552
|
-
const selectedApp = selectedAppSlug ? apps.find((a) => a.slug === selectedAppSlug) ??
|
|
555
|
+
const { resources: allResources2, approvalMethods } = useAppCatalogContext();
|
|
556
|
+
const selectedApp = selectedAppSlug ? apps.find((a) => a.slug === selectedAppSlug) ?? allResources2.find((a) => a.slug === selectedAppSlug && !a.parentSlug) ?? null : null;
|
|
553
557
|
const groupedApps = groupApps(apps, groupingDefinition, hasSearch);
|
|
554
558
|
const appsInDisplayOrder = React__default.useMemo(
|
|
555
559
|
() => groupedApps.flatMap((group) => group.apps),
|
|
@@ -561,26 +565,31 @@ function AppCatalogGrid({
|
|
|
561
565
|
onAppClick
|
|
562
566
|
});
|
|
563
567
|
const { recordClick: recordLaunch } = useAppClickHistory();
|
|
564
|
-
const
|
|
565
|
-
const matchedSubResourceMap = React__default.useMemo(() => {
|
|
568
|
+
const matchedSubResourcesMap = React__default.useMemo(() => {
|
|
566
569
|
const map = /* @__PURE__ */ new Map();
|
|
567
570
|
if (!(searchQuery == null ? void 0 : searchQuery.trim()) || allResources2.length === 0) return map;
|
|
568
571
|
const queryTerms = searchQuery.trim().toLowerCase().split(/\s+/).filter(Boolean);
|
|
569
572
|
const allTermsMatch = (text) => queryTerms.every((term) => text.includes(term));
|
|
570
573
|
for (const r of allResources2) {
|
|
571
574
|
if (!r.parentSlug) continue;
|
|
572
|
-
if (map.has(r.parentSlug)) continue;
|
|
573
575
|
const nameMatch = allTermsMatch(r.displayName.toLowerCase());
|
|
574
576
|
const aliasMatch = (r.aliases ?? []).some(
|
|
575
577
|
(a) => allTermsMatch(a.toLowerCase())
|
|
576
578
|
);
|
|
577
579
|
const descMatch = r.description ? allTermsMatch(r.description.toLowerCase()) : false;
|
|
578
580
|
if (nameMatch || aliasMatch || descMatch) {
|
|
579
|
-
map.
|
|
581
|
+
if (!map.has(r.parentSlug)) {
|
|
582
|
+
map.set(r.parentSlug, []);
|
|
583
|
+
}
|
|
584
|
+
map.get(r.parentSlug).push(r);
|
|
580
585
|
}
|
|
581
586
|
}
|
|
582
587
|
return map;
|
|
583
588
|
}, [searchQuery, allResources2]);
|
|
589
|
+
const [expandedParentSlugs, setExpandedParentSlugs] = React__default.useState(() => /* @__PURE__ */ new Set());
|
|
590
|
+
React__default.useEffect(() => {
|
|
591
|
+
setExpandedParentSlugs(/* @__PURE__ */ new Set());
|
|
592
|
+
}, [searchQuery]);
|
|
584
593
|
const columns = React__default.useMemo(
|
|
585
594
|
() => [
|
|
586
595
|
{
|
|
@@ -622,20 +631,63 @@ function AppCatalogGrid({
|
|
|
622
631
|
{
|
|
623
632
|
id: "description",
|
|
624
633
|
header: "Description",
|
|
625
|
-
cell: ({ row }) =>
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
{
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
634
|
+
cell: ({ row }) => {
|
|
635
|
+
var _a;
|
|
636
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
637
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm text-muted-foreground line-clamp-2", children: /* @__PURE__ */ jsx(
|
|
638
|
+
HighlightedText,
|
|
639
|
+
{
|
|
640
|
+
text: row.original.description ? markdownToPlainText(row.original.description) : "—",
|
|
641
|
+
searchQuery
|
|
642
|
+
}
|
|
643
|
+
) }),
|
|
644
|
+
(((_a = matchedSubResourcesMap.get(row.original.slug)) == null ? void 0 : _a.length) ?? 0) > 0 && (() => {
|
|
645
|
+
const matchedSubs = matchedSubResourcesMap.get(
|
|
646
|
+
row.original.slug
|
|
647
|
+
);
|
|
648
|
+
const COLLAPSED_LIMIT = 5;
|
|
649
|
+
const isExpanded = expandedParentSlugs.has(row.original.slug);
|
|
650
|
+
const visibleSubs = isExpanded ? matchedSubs : matchedSubs.slice(0, COLLAPSED_LIMIT);
|
|
651
|
+
const hiddenCount = matchedSubs.length - COLLAPSED_LIMIT;
|
|
652
|
+
return /* @__PURE__ */ jsxs("div", { className: "mt-1 space-y-0.5", children: [
|
|
653
|
+
visibleSubs.map((sub) => /* @__PURE__ */ jsx(
|
|
654
|
+
"button",
|
|
655
|
+
{
|
|
656
|
+
type: "button",
|
|
657
|
+
onClick: (e) => {
|
|
658
|
+
e.stopPropagation();
|
|
659
|
+
onSubClick == null ? void 0 : onSubClick(row.original.slug, sub.slug);
|
|
660
|
+
},
|
|
661
|
+
className: cn(
|
|
662
|
+
"flex items-center gap-1.5 text-xs pl-3 border-l-2 w-full text-left py-0.5 rounded-sm hover:bg-accent/50 transition-colors",
|
|
663
|
+
selectedSubSlug === sub.slug ? "border-primary text-primary font-medium" : "border-muted-foreground/30 text-muted-foreground hover:text-foreground"
|
|
664
|
+
),
|
|
665
|
+
children: /* @__PURE__ */ jsx("span", { children: sub.displayName })
|
|
666
|
+
},
|
|
667
|
+
sub.slug
|
|
668
|
+
)),
|
|
669
|
+
!isExpanded && hiddenCount > 0 && /* @__PURE__ */ jsxs(
|
|
670
|
+
"button",
|
|
671
|
+
{
|
|
672
|
+
type: "button",
|
|
673
|
+
onClick: (e) => {
|
|
674
|
+
e.stopPropagation();
|
|
675
|
+
setExpandedParentSlugs(
|
|
676
|
+
(prev) => /* @__PURE__ */ new Set([...prev, row.original.slug])
|
|
677
|
+
);
|
|
678
|
+
},
|
|
679
|
+
className: "text-xs pl-3 border-l-2 border-muted-foreground/30 text-muted-foreground hover:text-primary w-full text-left py-0.5",
|
|
680
|
+
children: [
|
|
681
|
+
"... ",
|
|
682
|
+
hiddenCount,
|
|
683
|
+
" more"
|
|
684
|
+
]
|
|
685
|
+
}
|
|
686
|
+
)
|
|
687
|
+
] });
|
|
688
|
+
})()
|
|
689
|
+
] });
|
|
690
|
+
}
|
|
639
691
|
},
|
|
640
692
|
{
|
|
641
693
|
// Secondary "launch" action (#31): the primary row click opens the
|
|
@@ -665,7 +717,15 @@ function AppCatalogGrid({
|
|
|
665
717
|
}
|
|
666
718
|
}
|
|
667
719
|
],
|
|
668
|
-
[
|
|
720
|
+
[
|
|
721
|
+
searchQuery,
|
|
722
|
+
matchedSubResourcesMap,
|
|
723
|
+
expandedParentSlugs,
|
|
724
|
+
selectedSubSlug,
|
|
725
|
+
onSubClick,
|
|
726
|
+
setExpandedParentSlugs,
|
|
727
|
+
recordLaunch
|
|
728
|
+
]
|
|
669
729
|
);
|
|
670
730
|
const table = useReactTable({
|
|
671
731
|
data: apps,
|
|
@@ -805,7 +865,7 @@ function AppCatalogGrid({
|
|
|
805
865
|
defaultSize: 40,
|
|
806
866
|
minSize: 25,
|
|
807
867
|
className: "overflow-hidden",
|
|
808
|
-
children: /* @__PURE__ */ jsx("div", { className: "h-full overflow-y-auto border-l bg-background pl-4", children:
|
|
868
|
+
children: /* @__PURE__ */ jsx("div", { className: "h-full overflow-y-auto border-l bg-background pl-4", children: /* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
809
869
|
/* @__PURE__ */ jsx(
|
|
810
870
|
Button,
|
|
811
871
|
{
|
|
@@ -817,15 +877,32 @@ function AppCatalogGrid({
|
|
|
817
877
|
children: /* @__PURE__ */ jsx(X, { className: "h-5 w-5" })
|
|
818
878
|
}
|
|
819
879
|
),
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
app
|
|
824
|
-
|
|
825
|
-
|
|
880
|
+
selectedApp && (() => {
|
|
881
|
+
const app = selectedApp;
|
|
882
|
+
const selectedSub = selectedSubSlug ? allResources2.find(
|
|
883
|
+
(r) => r.slug === selectedSubSlug && r.parentSlug === app.slug
|
|
884
|
+
) : null;
|
|
885
|
+
if (selectedSub != null) {
|
|
886
|
+
return /* @__PURE__ */ jsx(
|
|
887
|
+
SubResourceDetailPanel,
|
|
888
|
+
{
|
|
889
|
+
subResource: selectedSub,
|
|
890
|
+
parent: app,
|
|
891
|
+
approvalMethods,
|
|
892
|
+
onBack: onBackToParent ?? (() => void 0)
|
|
893
|
+
}
|
|
894
|
+
);
|
|
826
895
|
}
|
|
827
|
-
|
|
828
|
-
|
|
896
|
+
return /* @__PURE__ */ jsx(
|
|
897
|
+
AppDetails,
|
|
898
|
+
{
|
|
899
|
+
app: selectedApp,
|
|
900
|
+
onAppClick,
|
|
901
|
+
onClosePanel: handleClosePanel
|
|
902
|
+
}
|
|
903
|
+
);
|
|
904
|
+
})()
|
|
905
|
+
] }) })
|
|
829
906
|
}
|
|
830
907
|
)
|
|
831
908
|
] })
|