@igstack/app-catalog-frontend-core 0.6.4 → 0.7.0
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/replacementLink.integration.test.d.ts +0 -0
- package/dist/esm/__tests__/integration/serviceDesks.integration.test.d.ts +0 -0
- package/dist/esm/__tests__/integration/tools/AppDetailTools.d.ts +4 -0
- package/dist/esm/modules/appCatalog/context/AppCatalogContext.js +3 -3
- package/dist/esm/modules/appCatalog/ui/components/PersonBadge.js +3 -3
- package/dist/esm/modules/appCatalog/ui/components/SubResourcesSection.js +3 -3
- package/dist/esm/modules/appCatalog/ui/components/TierVariantsSection.js +3 -3
- package/dist/esm/modules/appCatalog/ui/components/ViewToggle.d.ts +6 -0
- package/dist/esm/modules/appCatalog/ui/components/ViewToggle.js +43 -0
- package/dist/esm/modules/appCatalog/ui/components/ViewToggle.js.map +1 -0
- package/dist/esm/modules/appCatalog/ui/grid/AppCatalogGrid.js +2 -1
- package/dist/esm/modules/appCatalog/ui/grid/AppCatalogGrid.js.map +1 -1
- package/dist/esm/modules/appCatalog/ui/layout/AppCatalogLayout.js +2 -1
- package/dist/esm/modules/appCatalog/ui/layout/AppCatalogLayout.js.map +1 -1
- package/dist/esm/modules/appCatalog/ui/pages/AppCatalogPage.js +1 -1
- package/dist/esm/modules/appCatalog/ui/pages/AppCatalogPage.js.map +1 -1
- package/dist/esm/modules/appCatalog/ui/pages/ServiceDesksPage.d.ts +6 -0
- package/dist/esm/modules/appCatalog/ui/pages/ServiceDesksPage.js +63 -0
- package/dist/esm/modules/appCatalog/ui/pages/ServiceDesksPage.js.map +1 -0
- package/dist/esm/routeTree.gen.d.ts +20 -3
- package/dist/esm/routeTree.gen.js +9 -2
- package/dist/esm/routeTree.gen.js.map +1 -1
- package/dist/esm/routes/_layout/service-desks.d.ts +6 -0
- package/dist/esm/routes/_layout/service-desks.js +25 -0
- package/dist/esm/routes/_layout/service-desks.js.map +1 -0
- package/package.json +4 -4
- package/src/__tests__/integration/mock-backend/magazines.ts +6 -0
- package/src/__tests__/integration/replacementLink.integration.test.ts +52 -0
- package/src/__tests__/integration/serviceDesks.integration.test.ts +85 -0
- package/src/__tests__/integration/tools/AppDetailTools.ts +12 -0
- package/src/modules/appCatalog/ui/components/ViewToggle.tsx +40 -0
- package/src/modules/appCatalog/ui/grid/AppCatalogGrid.tsx +8 -1
- package/src/modules/appCatalog/ui/layout/AppCatalogLayout.tsx +2 -1
- package/src/modules/appCatalog/ui/pages/AppCatalogPage.tsx +1 -1
- package/src/modules/appCatalog/ui/pages/ServiceDesksPage.tsx +91 -0
- package/src/routeTree.gen.ts +33 -2
- package/src/routes/_layout/service-desks.tsx +28 -0
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { ExternalLink } from "lucide-react";
|
|
3
|
+
import { useState, useMemo } from "react";
|
|
4
|
+
import { InputGroup, InputGroupInput } from "../../../../ui/input-group.js";
|
|
5
|
+
import { Table, TableHeader, TableRow, TableHead, TableBody, TableCell } from "../../../../ui/table.js";
|
|
6
|
+
import { useAppCatalogContext } from "../../context/AppCatalogContext.js";
|
|
7
|
+
function ServiceDesksPage() {
|
|
8
|
+
const { approvalMethods } = useAppCatalogContext();
|
|
9
|
+
const [search, setSearch] = useState("");
|
|
10
|
+
const desks = useMemo(() => {
|
|
11
|
+
const services = approvalMethods.filter((m) => m.type === "service");
|
|
12
|
+
const q = search.trim().toLowerCase();
|
|
13
|
+
const filtered = q ? services.filter((m) => m.displayName.toLowerCase().includes(q)) : services;
|
|
14
|
+
return [...filtered].sort(
|
|
15
|
+
(a, b) => a.displayName.localeCompare(b.displayName)
|
|
16
|
+
);
|
|
17
|
+
}, [approvalMethods, search]);
|
|
18
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col flex-1 min-h-0 gap-4", children: [
|
|
19
|
+
/* @__PURE__ */ jsx(InputGroup, { className: "max-w-sm", children: /* @__PURE__ */ jsx(
|
|
20
|
+
InputGroupInput,
|
|
21
|
+
{
|
|
22
|
+
value: search,
|
|
23
|
+
onChange: (e) => setSearch(e.target.value),
|
|
24
|
+
placeholder: "Search service desks by name…",
|
|
25
|
+
"aria-label": "Search service desks"
|
|
26
|
+
}
|
|
27
|
+
) }),
|
|
28
|
+
/* @__PURE__ */ jsx("div", { className: "flex-1 min-h-0 overflow-y-auto", children: desks.length === 0 ? /* @__PURE__ */ jsxs("p", { className: "text-sm text-muted-foreground", children: [
|
|
29
|
+
"No service desks found",
|
|
30
|
+
search && ` for "${search}"`,
|
|
31
|
+
"."
|
|
32
|
+
] }) : /* @__PURE__ */ jsxs(Table, { children: [
|
|
33
|
+
/* @__PURE__ */ jsx(TableHeader, { children: /* @__PURE__ */ jsxs(TableRow, { children: [
|
|
34
|
+
/* @__PURE__ */ jsx(TableHead, { children: "Service Desk" }),
|
|
35
|
+
/* @__PURE__ */ jsx(TableHead, { children: "Link" })
|
|
36
|
+
] }) }),
|
|
37
|
+
/* @__PURE__ */ jsx(TableBody, { children: desks.map((desk) => {
|
|
38
|
+
const url = desk.config.url;
|
|
39
|
+
return /* @__PURE__ */ jsxs(TableRow, { children: [
|
|
40
|
+
/* @__PURE__ */ jsx(TableCell, { className: "font-medium", children: desk.displayName }),
|
|
41
|
+
/* @__PURE__ */ jsx(TableCell, { children: url ? /* @__PURE__ */ jsxs(
|
|
42
|
+
"a",
|
|
43
|
+
{
|
|
44
|
+
href: url,
|
|
45
|
+
target: "_blank",
|
|
46
|
+
rel: "noopener noreferrer",
|
|
47
|
+
className: "inline-flex items-center gap-1 text-primary hover:underline",
|
|
48
|
+
title: url,
|
|
49
|
+
children: [
|
|
50
|
+
"Open",
|
|
51
|
+
/* @__PURE__ */ jsx(ExternalLink, { className: "size-3" })
|
|
52
|
+
]
|
|
53
|
+
}
|
|
54
|
+
) : /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "—" }) })
|
|
55
|
+
] }, desk.slug);
|
|
56
|
+
}) })
|
|
57
|
+
] }) })
|
|
58
|
+
] });
|
|
59
|
+
}
|
|
60
|
+
export {
|
|
61
|
+
ServiceDesksPage
|
|
62
|
+
};
|
|
63
|
+
//# sourceMappingURL=ServiceDesksPage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ServiceDesksPage.js","sources":["../../../../../../src/modules/appCatalog/ui/pages/ServiceDesksPage.tsx"],"sourcesContent":["import { ExternalLink } from 'lucide-react'\nimport { useMemo, useState } from 'react'\nimport { InputGroup, InputGroupInput } from '~/ui/input-group'\nimport {\n Table,\n TableBody,\n TableCell,\n TableHead,\n TableHeader,\n TableRow,\n} from '~/ui/table'\nimport { useAppCatalogContext } from '../../context/AppCatalogContext'\n\n/**\n * Service Desks view (#9): a searchable table of all service-desk approval\n * methods (type === 'service'), each with a link that opens its portal in a new\n * tab. Data rides in on the existing app-catalog query (context.approvalMethods).\n */\nexport function ServiceDesksPage() {\n const { approvalMethods } = useAppCatalogContext()\n const [search, setSearch] = useState('')\n\n const desks = useMemo(() => {\n const services = approvalMethods.filter((m) => m.type === 'service')\n const q = search.trim().toLowerCase()\n const filtered = q\n ? services.filter((m) => m.displayName.toLowerCase().includes(q))\n : services\n return [...filtered].sort((a, b) =>\n a.displayName.localeCompare(b.displayName),\n )\n }, [approvalMethods, search])\n\n return (\n <div className=\"flex flex-col flex-1 min-h-0 gap-4\">\n <InputGroup className=\"max-w-sm\">\n <InputGroupInput\n value={search}\n onChange={(e) => setSearch(e.target.value)}\n placeholder=\"Search service desks by name…\"\n aria-label=\"Search service desks\"\n />\n </InputGroup>\n\n <div className=\"flex-1 min-h-0 overflow-y-auto\">\n {desks.length === 0 ? (\n <p className=\"text-sm text-muted-foreground\">\n No service desks found{search && ` for \"${search}\"`}.\n </p>\n ) : (\n <Table>\n <TableHeader>\n <TableRow>\n <TableHead>Service Desk</TableHead>\n <TableHead>Link</TableHead>\n </TableRow>\n </TableHeader>\n <TableBody>\n {desks.map((desk) => {\n const url = desk.config.url\n return (\n <TableRow key={desk.slug}>\n <TableCell className=\"font-medium\">\n {desk.displayName}\n </TableCell>\n <TableCell>\n {url ? (\n <a\n href={url}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"inline-flex items-center gap-1 text-primary hover:underline\"\n title={url}\n >\n Open\n <ExternalLink className=\"size-3\" />\n </a>\n ) : (\n <span className=\"text-muted-foreground\">—</span>\n )}\n </TableCell>\n </TableRow>\n )\n })}\n </TableBody>\n </Table>\n )}\n </div>\n </div>\n )\n}\n"],"names":[],"mappings":";;;;;;AAkBO,SAAS,mBAAmB;AACjC,QAAM,EAAE,gBAAA,IAAoB,qBAAA;AAC5B,QAAM,CAAC,QAAQ,SAAS,IAAI,SAAS,EAAE;AAEvC,QAAM,QAAQ,QAAQ,MAAM;AAC1B,UAAM,WAAW,gBAAgB,OAAO,CAAC,MAAM,EAAE,SAAS,SAAS;AACnE,UAAM,IAAI,OAAO,KAAA,EAAO,YAAA;AACxB,UAAM,WAAW,IACb,SAAS,OAAO,CAAC,MAAM,EAAE,YAAY,YAAA,EAAc,SAAS,CAAC,CAAC,IAC9D;AACJ,WAAO,CAAC,GAAG,QAAQ,EAAE;AAAA,MAAK,CAAC,GAAG,MAC5B,EAAE,YAAY,cAAc,EAAE,WAAW;AAAA,IAAA;AAAA,EAE7C,GAAG,CAAC,iBAAiB,MAAM,CAAC;AAE5B,SACE,qBAAC,OAAA,EAAI,WAAU,sCACb,UAAA;AAAA,IAAA,oBAAC,YAAA,EAAW,WAAU,YACpB,UAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,OAAO;AAAA,QACP,UAAU,CAAC,MAAM,UAAU,EAAE,OAAO,KAAK;AAAA,QACzC,aAAY;AAAA,QACZ,cAAW;AAAA,MAAA;AAAA,IAAA,GAEf;AAAA,IAEA,oBAAC,OAAA,EAAI,WAAU,kCACZ,UAAA,MAAM,WAAW,IAChB,qBAAC,KAAA,EAAE,WAAU,iCAAgC,UAAA;AAAA,MAAA;AAAA,MACpB,UAAU,SAAS,MAAM;AAAA,MAAI;AAAA,IAAA,EAAA,CACtD,yBAEC,OAAA,EACC,UAAA;AAAA,MAAA,oBAAC,aAAA,EACC,+BAAC,UAAA,EACC,UAAA;AAAA,QAAA,oBAAC,aAAU,UAAA,eAAA,CAAY;AAAA,QACvB,oBAAC,aAAU,UAAA,OAAA,CAAI;AAAA,MAAA,EAAA,CACjB,EAAA,CACF;AAAA,MACA,oBAAC,WAAA,EACE,UAAA,MAAM,IAAI,CAAC,SAAS;AACnB,cAAM,MAAM,KAAK,OAAO;AACxB,oCACG,UAAA,EACC,UAAA;AAAA,UAAA,oBAAC,WAAA,EAAU,WAAU,eAClB,UAAA,KAAK,aACR;AAAA,UACA,oBAAC,aACE,UAAA,MACC;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,MAAM;AAAA,cACN,QAAO;AAAA,cACP,KAAI;AAAA,cACJ,WAAU;AAAA,cACV,OAAO;AAAA,cACR,UAAA;AAAA,gBAAA;AAAA,gBAEC,oBAAC,cAAA,EAAa,WAAU,SAAA,CAAS;AAAA,cAAA;AAAA,YAAA;AAAA,UAAA,IAGnC,oBAAC,QAAA,EAAK,WAAU,yBAAwB,eAAC,EAAA,CAE7C;AAAA,QAAA,EAAA,GAnBa,KAAK,IAoBpB;AAAA,MAEJ,CAAC,EAAA,CACH;AAAA,IAAA,EAAA,CACF,EAAA,CAEJ;AAAA,EAAA,GACF;AAEJ;"}
|
|
@@ -2,6 +2,7 @@ import { Route as rootRouteImport } from './routes/__root.js';
|
|
|
2
2
|
import { Route as LayoutRouteImport } from './routes/_layout.js';
|
|
3
3
|
import { Route as LayoutIndexRouteImport } from './routes/_layout/index.js';
|
|
4
4
|
import { Route as AuthCallbackRouteImport } from './routes/auth.callback';
|
|
5
|
+
import { Route as LayoutServiceDesksRouteImport } from './routes/_layout/service-desks.js';
|
|
5
6
|
import { Route as LayoutLoginRouteImport } from './routes/_layout/login.js';
|
|
6
7
|
import { Route as LayoutAppSlugRouteImport } from './routes/_layout/app.$slug';
|
|
7
8
|
import { Route as LayoutCatalogAppsIndexRouteImport } from './routes/_layout/catalog.apps.index';
|
|
@@ -16,6 +17,11 @@ declare const AuthCallbackRoute: import('@tanstack/router-core').Route<import('@
|
|
|
16
17
|
error: string | undefined;
|
|
17
18
|
code: string | undefined;
|
|
18
19
|
}, import('@tanstack/router-core').ResolveParams<"/auth/callback">, import('@tanstack/router-core').AnyContext, import('@tanstack/router-core').AnyContext, import('@tanstack/router-core').AnyContext, {}, undefined, unknown, unknown, unknown, unknown, undefined>;
|
|
20
|
+
declare const LayoutServiceDesksRoute: import('@tanstack/router-core').Route<import('@tanstack/react-router').Register, import('@tanstack/router-core').Route<import('@tanstack/react-router').Register, import('@tanstack/react-router').RootRoute<import('@tanstack/react-router').Register, undefined, import('./types/types.js').AcRouterContext, import('@tanstack/router-core').AnyContext, import('@tanstack/router-core').AnyContext, {}, undefined, unknown, unknown, unknown, unknown, undefined>, "", "/", "/_layout", "/_layout", undefined, import('@tanstack/router-core').ResolveParams<"">, import('@tanstack/router-core').AnyContext, import('@tanstack/router-core').AnyContext, import('@tanstack/router-core').AnyContext, {}, undefined, unknown, unknown, unknown, unknown, undefined>, "/service-desks", "/service-desks", "/_layout/service-desks", "/_layout/service-desks", import('zod').ZodObject<{
|
|
21
|
+
q: import('zod').ZodOptional<import('zod').ZodString>;
|
|
22
|
+
}, import('zod/v4/core').$strip>, import('@tanstack/router-core').ResolveParams<"/service-desks">, import('@tanstack/router-core').AnyContext, import('@tanstack/router-core').AnyContext, import('@tanstack/router-core').AnyContext, {}, () => Promise<{
|
|
23
|
+
appCatalogLoader: import('./modules/appCatalog/routeLoader.js').AppCatalogLoaderReturn;
|
|
24
|
+
}>, unknown, unknown, unknown, unknown, undefined>;
|
|
19
25
|
declare const LayoutLoginRoute: import('@tanstack/router-core').Route<import('@tanstack/react-router').Register, import('@tanstack/router-core').Route<import('@tanstack/react-router').Register, import('@tanstack/react-router').RootRoute<import('@tanstack/react-router').Register, undefined, import('./types/types.js').AcRouterContext, import('@tanstack/router-core').AnyContext, import('@tanstack/router-core').AnyContext, {}, undefined, unknown, unknown, unknown, unknown, undefined>, "", "/", "/_layout", "/_layout", undefined, import('@tanstack/router-core').ResolveParams<"">, import('@tanstack/router-core').AnyContext, import('@tanstack/router-core').AnyContext, import('@tanstack/router-core').AnyContext, {}, undefined, unknown, unknown, unknown, unknown, undefined>, "/login", "/login", "/_layout/login", "/_layout/login", undefined, import('@tanstack/router-core').ResolveParams<"/login">, import('@tanstack/router-core').AnyContext, import('@tanstack/router-core').AnyContext, import('@tanstack/router-core').AnyContext, {}, undefined, unknown, unknown, unknown, unknown, undefined>;
|
|
20
26
|
declare const LayoutAppSlugRoute: import('@tanstack/router-core').Route<import('@tanstack/react-router').Register, import('@tanstack/router-core').Route<import('@tanstack/react-router').Register, import('@tanstack/react-router').RootRoute<import('@tanstack/react-router').Register, undefined, import('./types/types.js').AcRouterContext, import('@tanstack/router-core').AnyContext, import('@tanstack/router-core').AnyContext, {}, undefined, unknown, unknown, unknown, unknown, undefined>, "", "/", "/_layout", "/_layout", undefined, import('@tanstack/router-core').ResolveParams<"">, import('@tanstack/router-core').AnyContext, import('@tanstack/router-core').AnyContext, import('@tanstack/router-core').AnyContext, {}, undefined, unknown, unknown, unknown, unknown, undefined>, "/app/$slug", "/app/$slug", "/_layout/app/$slug", "/_layout/app/$slug", import('zod').ZodObject<{
|
|
21
27
|
q: import('zod').ZodOptional<import('zod').ZodString>;
|
|
@@ -33,12 +39,14 @@ declare const LayoutCatalogAppsIndexRoute: import('@tanstack/router-core').Route
|
|
|
33
39
|
export interface FileRoutesByFullPath {
|
|
34
40
|
'/': typeof LayoutIndexRoute;
|
|
35
41
|
'/login': typeof LayoutLoginRoute;
|
|
42
|
+
'/service-desks': typeof LayoutServiceDesksRoute;
|
|
36
43
|
'/auth/callback': typeof AuthCallbackRoute;
|
|
37
44
|
'/app/$slug': typeof LayoutAppSlugRoute;
|
|
38
45
|
'/catalog/apps/': typeof LayoutCatalogAppsIndexRoute;
|
|
39
46
|
}
|
|
40
47
|
export interface FileRoutesByTo {
|
|
41
48
|
'/login': typeof LayoutLoginRoute;
|
|
49
|
+
'/service-desks': typeof LayoutServiceDesksRoute;
|
|
42
50
|
'/auth/callback': typeof AuthCallbackRoute;
|
|
43
51
|
'/': typeof LayoutIndexRoute;
|
|
44
52
|
'/app/$slug': typeof LayoutAppSlugRoute;
|
|
@@ -48,6 +56,7 @@ export interface FileRoutesById {
|
|
|
48
56
|
__root__: typeof rootRouteImport;
|
|
49
57
|
'/_layout': typeof LayoutRouteWithChildren;
|
|
50
58
|
'/_layout/login': typeof LayoutLoginRoute;
|
|
59
|
+
'/_layout/service-desks': typeof LayoutServiceDesksRoute;
|
|
51
60
|
'/auth/callback': typeof AuthCallbackRoute;
|
|
52
61
|
'/_layout/': typeof LayoutIndexRoute;
|
|
53
62
|
'/_layout/app/$slug': typeof LayoutAppSlugRoute;
|
|
@@ -55,10 +64,10 @@ export interface FileRoutesById {
|
|
|
55
64
|
}
|
|
56
65
|
export interface FileRouteTypes {
|
|
57
66
|
fileRoutesByFullPath: FileRoutesByFullPath;
|
|
58
|
-
fullPaths: '/' | '/login' | '/auth/callback' | '/app/$slug' | '/catalog/apps/';
|
|
67
|
+
fullPaths: '/' | '/login' | '/service-desks' | '/auth/callback' | '/app/$slug' | '/catalog/apps/';
|
|
59
68
|
fileRoutesByTo: FileRoutesByTo;
|
|
60
|
-
to: '/login' | '/auth/callback' | '/' | '/app/$slug' | '/catalog/apps';
|
|
61
|
-
id: '__root__' | '/_layout' | '/_layout/login' | '/auth/callback' | '/_layout/' | '/_layout/app/$slug' | '/_layout/catalog/apps/';
|
|
69
|
+
to: '/login' | '/service-desks' | '/auth/callback' | '/' | '/app/$slug' | '/catalog/apps';
|
|
70
|
+
id: '__root__' | '/_layout' | '/_layout/login' | '/_layout/service-desks' | '/auth/callback' | '/_layout/' | '/_layout/app/$slug' | '/_layout/catalog/apps/';
|
|
62
71
|
fileRoutesById: FileRoutesById;
|
|
63
72
|
}
|
|
64
73
|
export interface RootRouteChildren {
|
|
@@ -88,6 +97,13 @@ declare module '@tanstack/react-router' {
|
|
|
88
97
|
preLoaderRoute: typeof AuthCallbackRouteImport;
|
|
89
98
|
parentRoute: typeof rootRouteImport;
|
|
90
99
|
};
|
|
100
|
+
'/_layout/service-desks': {
|
|
101
|
+
id: '/_layout/service-desks';
|
|
102
|
+
path: '/service-desks';
|
|
103
|
+
fullPath: '/service-desks';
|
|
104
|
+
preLoaderRoute: typeof LayoutServiceDesksRouteImport;
|
|
105
|
+
parentRoute: typeof LayoutRoute;
|
|
106
|
+
};
|
|
91
107
|
'/_layout/login': {
|
|
92
108
|
id: '/_layout/login';
|
|
93
109
|
path: '/login';
|
|
@@ -113,6 +129,7 @@ declare module '@tanstack/react-router' {
|
|
|
113
129
|
}
|
|
114
130
|
interface LayoutRouteChildren {
|
|
115
131
|
LayoutLoginRoute: typeof LayoutLoginRoute;
|
|
132
|
+
LayoutServiceDesksRoute: typeof LayoutServiceDesksRoute;
|
|
116
133
|
LayoutIndexRoute: typeof LayoutIndexRoute;
|
|
117
134
|
LayoutAppSlugRoute: typeof LayoutAppSlugRoute;
|
|
118
135
|
LayoutCatalogAppsIndexRoute: typeof LayoutCatalogAppsIndexRoute;
|
|
@@ -2,7 +2,8 @@ import { Route } from "./routes/__root.js";
|
|
|
2
2
|
import { Route as Route$2 } from "./routes/_layout.js";
|
|
3
3
|
import { Route as Route$5 } from "./routes/_layout/index.js";
|
|
4
4
|
import { Route as Route$1 } from "./routes/auth.callback.js";
|
|
5
|
-
import { Route as Route$6 } from "./routes/_layout/
|
|
5
|
+
import { Route as Route$6 } from "./routes/_layout/service-desks.js";
|
|
6
|
+
import { Route as Route$7 } from "./routes/_layout/login.js";
|
|
6
7
|
import { Route as Route$4 } from "./routes/_layout/app._slug.js";
|
|
7
8
|
import { Route as Route$3 } from "./routes/_layout/catalog.apps.index.js";
|
|
8
9
|
const LayoutRoute = Route$2.update({
|
|
@@ -19,7 +20,12 @@ const AuthCallbackRoute = Route$1.update({
|
|
|
19
20
|
path: "/auth/callback",
|
|
20
21
|
getParentRoute: () => Route
|
|
21
22
|
});
|
|
22
|
-
const
|
|
23
|
+
const LayoutServiceDesksRoute = Route$6.update({
|
|
24
|
+
id: "/service-desks",
|
|
25
|
+
path: "/service-desks",
|
|
26
|
+
getParentRoute: () => LayoutRoute
|
|
27
|
+
});
|
|
28
|
+
const LayoutLoginRoute = Route$7.update({
|
|
23
29
|
id: "/login",
|
|
24
30
|
path: "/login",
|
|
25
31
|
getParentRoute: () => LayoutRoute
|
|
@@ -36,6 +42,7 @@ const LayoutCatalogAppsIndexRoute = Route$3.update({
|
|
|
36
42
|
});
|
|
37
43
|
const LayoutRouteChildren = {
|
|
38
44
|
LayoutLoginRoute,
|
|
45
|
+
LayoutServiceDesksRoute,
|
|
39
46
|
LayoutIndexRoute,
|
|
40
47
|
LayoutAppSlugRoute,
|
|
41
48
|
LayoutCatalogAppsIndexRoute
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routeTree.gen.js","sources":["../../src/routeTree.gen.ts"],"sourcesContent":["/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as LayoutRouteImport } from './routes/_layout'\nimport { Route as LayoutIndexRouteImport } from './routes/_layout/index'\nimport { Route as AuthCallbackRouteImport } from './routes/auth.callback'\nimport { Route as LayoutLoginRouteImport } from './routes/_layout/login'\nimport { Route as LayoutAppSlugRouteImport } from './routes/_layout/app.$slug'\nimport { Route as LayoutCatalogAppsIndexRouteImport } from './routes/_layout/catalog.apps.index'\n\nconst LayoutRoute = LayoutRouteImport.update({\n id: '/_layout',\n getParentRoute: () => rootRouteImport,\n} as any)\nconst LayoutIndexRoute = LayoutIndexRouteImport.update({\n id: '/',\n path: '/',\n getParentRoute: () => LayoutRoute,\n} as any)\nconst AuthCallbackRoute = AuthCallbackRouteImport.update({\n id: '/auth/callback',\n path: '/auth/callback',\n getParentRoute: () => rootRouteImport,\n} as any)\nconst LayoutLoginRoute = LayoutLoginRouteImport.update({\n id: '/login',\n path: '/login',\n getParentRoute: () => LayoutRoute,\n} as any)\nconst LayoutAppSlugRoute = LayoutAppSlugRouteImport.update({\n id: '/app/$slug',\n path: '/app/$slug',\n getParentRoute: () => LayoutRoute,\n} as any)\nconst LayoutCatalogAppsIndexRoute = LayoutCatalogAppsIndexRouteImport.update({\n id: '/catalog/apps/',\n path: '/catalog/apps/',\n getParentRoute: () => LayoutRoute,\n} as any)\n\nexport interface FileRoutesByFullPath {\n '/': typeof LayoutIndexRoute\n '/login': typeof LayoutLoginRoute\n '/auth/callback': typeof AuthCallbackRoute\n '/app/$slug': typeof LayoutAppSlugRoute\n '/catalog/apps/': typeof LayoutCatalogAppsIndexRoute\n}\nexport interface FileRoutesByTo {\n '/login': typeof LayoutLoginRoute\n '/auth/callback': typeof AuthCallbackRoute\n '/': typeof LayoutIndexRoute\n '/app/$slug': typeof LayoutAppSlugRoute\n '/catalog/apps': typeof LayoutCatalogAppsIndexRoute\n}\nexport interface FileRoutesById {\n __root__: typeof rootRouteImport\n '/_layout': typeof LayoutRouteWithChildren\n '/_layout/login': typeof LayoutLoginRoute\n '/auth/callback': typeof AuthCallbackRoute\n '/_layout/': typeof LayoutIndexRoute\n '/_layout/app/$slug': typeof LayoutAppSlugRoute\n '/_layout/catalog/apps/': typeof LayoutCatalogAppsIndexRoute\n}\nexport interface FileRouteTypes {\n fileRoutesByFullPath: FileRoutesByFullPath\n fullPaths
|
|
1
|
+
{"version":3,"file":"routeTree.gen.js","sources":["../../src/routeTree.gen.ts"],"sourcesContent":["/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as LayoutRouteImport } from './routes/_layout'\nimport { Route as LayoutIndexRouteImport } from './routes/_layout/index'\nimport { Route as AuthCallbackRouteImport } from './routes/auth.callback'\nimport { Route as LayoutServiceDesksRouteImport } from './routes/_layout/service-desks'\nimport { Route as LayoutLoginRouteImport } from './routes/_layout/login'\nimport { Route as LayoutAppSlugRouteImport } from './routes/_layout/app.$slug'\nimport { Route as LayoutCatalogAppsIndexRouteImport } from './routes/_layout/catalog.apps.index'\n\nconst LayoutRoute = LayoutRouteImport.update({\n id: '/_layout',\n getParentRoute: () => rootRouteImport,\n} as any)\nconst LayoutIndexRoute = LayoutIndexRouteImport.update({\n id: '/',\n path: '/',\n getParentRoute: () => LayoutRoute,\n} as any)\nconst AuthCallbackRoute = AuthCallbackRouteImport.update({\n id: '/auth/callback',\n path: '/auth/callback',\n getParentRoute: () => rootRouteImport,\n} as any)\nconst LayoutServiceDesksRoute = LayoutServiceDesksRouteImport.update({\n id: '/service-desks',\n path: '/service-desks',\n getParentRoute: () => LayoutRoute,\n} as any)\nconst LayoutLoginRoute = LayoutLoginRouteImport.update({\n id: '/login',\n path: '/login',\n getParentRoute: () => LayoutRoute,\n} as any)\nconst LayoutAppSlugRoute = LayoutAppSlugRouteImport.update({\n id: '/app/$slug',\n path: '/app/$slug',\n getParentRoute: () => LayoutRoute,\n} as any)\nconst LayoutCatalogAppsIndexRoute = LayoutCatalogAppsIndexRouteImport.update({\n id: '/catalog/apps/',\n path: '/catalog/apps/',\n getParentRoute: () => LayoutRoute,\n} as any)\n\nexport interface FileRoutesByFullPath {\n '/': typeof LayoutIndexRoute\n '/login': typeof LayoutLoginRoute\n '/service-desks': typeof LayoutServiceDesksRoute\n '/auth/callback': typeof AuthCallbackRoute\n '/app/$slug': typeof LayoutAppSlugRoute\n '/catalog/apps/': typeof LayoutCatalogAppsIndexRoute\n}\nexport interface FileRoutesByTo {\n '/login': typeof LayoutLoginRoute\n '/service-desks': typeof LayoutServiceDesksRoute\n '/auth/callback': typeof AuthCallbackRoute\n '/': typeof LayoutIndexRoute\n '/app/$slug': typeof LayoutAppSlugRoute\n '/catalog/apps': typeof LayoutCatalogAppsIndexRoute\n}\nexport interface FileRoutesById {\n __root__: typeof rootRouteImport\n '/_layout': typeof LayoutRouteWithChildren\n '/_layout/login': typeof LayoutLoginRoute\n '/_layout/service-desks': typeof LayoutServiceDesksRoute\n '/auth/callback': typeof AuthCallbackRoute\n '/_layout/': typeof LayoutIndexRoute\n '/_layout/app/$slug': typeof LayoutAppSlugRoute\n '/_layout/catalog/apps/': typeof LayoutCatalogAppsIndexRoute\n}\nexport interface FileRouteTypes {\n fileRoutesByFullPath: FileRoutesByFullPath\n fullPaths:\n | '/'\n | '/login'\n | '/service-desks'\n | '/auth/callback'\n | '/app/$slug'\n | '/catalog/apps/'\n fileRoutesByTo: FileRoutesByTo\n to:\n | '/login'\n | '/service-desks'\n | '/auth/callback'\n | '/'\n | '/app/$slug'\n | '/catalog/apps'\n id:\n | '__root__'\n | '/_layout'\n | '/_layout/login'\n | '/_layout/service-desks'\n | '/auth/callback'\n | '/_layout/'\n | '/_layout/app/$slug'\n | '/_layout/catalog/apps/'\n fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n LayoutRoute: typeof LayoutRouteWithChildren\n AuthCallbackRoute: typeof AuthCallbackRoute\n}\n\ndeclare module '@tanstack/react-router' {\n interface FileRoutesByPath {\n '/_layout': {\n id: '/_layout'\n path: ''\n fullPath: '/'\n preLoaderRoute: typeof LayoutRouteImport\n parentRoute: typeof rootRouteImport\n }\n '/_layout/': {\n id: '/_layout/'\n path: '/'\n fullPath: '/'\n preLoaderRoute: typeof LayoutIndexRouteImport\n parentRoute: typeof LayoutRoute\n }\n '/auth/callback': {\n id: '/auth/callback'\n path: '/auth/callback'\n fullPath: '/auth/callback'\n preLoaderRoute: typeof AuthCallbackRouteImport\n parentRoute: typeof rootRouteImport\n }\n '/_layout/service-desks': {\n id: '/_layout/service-desks'\n path: '/service-desks'\n fullPath: '/service-desks'\n preLoaderRoute: typeof LayoutServiceDesksRouteImport\n parentRoute: typeof LayoutRoute\n }\n '/_layout/login': {\n id: '/_layout/login'\n path: '/login'\n fullPath: '/login'\n preLoaderRoute: typeof LayoutLoginRouteImport\n parentRoute: typeof LayoutRoute\n }\n '/_layout/app/$slug': {\n id: '/_layout/app/$slug'\n path: '/app/$slug'\n fullPath: '/app/$slug'\n preLoaderRoute: typeof LayoutAppSlugRouteImport\n parentRoute: typeof LayoutRoute\n }\n '/_layout/catalog/apps/': {\n id: '/_layout/catalog/apps/'\n path: '/catalog/apps'\n fullPath: '/catalog/apps/'\n preLoaderRoute: typeof LayoutCatalogAppsIndexRouteImport\n parentRoute: typeof LayoutRoute\n }\n }\n}\n\ninterface LayoutRouteChildren {\n LayoutLoginRoute: typeof LayoutLoginRoute\n LayoutServiceDesksRoute: typeof LayoutServiceDesksRoute\n LayoutIndexRoute: typeof LayoutIndexRoute\n LayoutAppSlugRoute: typeof LayoutAppSlugRoute\n LayoutCatalogAppsIndexRoute: typeof LayoutCatalogAppsIndexRoute\n}\n\nconst LayoutRouteChildren: LayoutRouteChildren = {\n LayoutLoginRoute: LayoutLoginRoute,\n LayoutServiceDesksRoute: LayoutServiceDesksRoute,\n LayoutIndexRoute: LayoutIndexRoute,\n LayoutAppSlugRoute: LayoutAppSlugRoute,\n LayoutCatalogAppsIndexRoute: LayoutCatalogAppsIndexRoute,\n}\n\nconst LayoutRouteWithChildren =\n LayoutRoute._addFileChildren(LayoutRouteChildren)\n\nconst rootRouteChildren: RootRouteChildren = {\n LayoutRoute: LayoutRouteWithChildren,\n AuthCallbackRoute: AuthCallbackRoute,\n}\nexport const routeTree = rootRouteImport\n ._addFileChildren(rootRouteChildren)\n ._addFileTypes<FileRouteTypes>()\n"],"names":["LayoutRouteImport","rootRouteImport","LayoutIndexRouteImport","AuthCallbackRouteImport","LayoutServiceDesksRouteImport","LayoutLoginRouteImport","LayoutAppSlugRouteImport","LayoutCatalogAppsIndexRouteImport"],"mappings":";;;;;;;;AAmBA,MAAM,cAAcA,QAAkB,OAAO;AAAA,EAC3C,IAAI;AAAA,EACJ,gBAAgB,MAAMC;AACxB,CAAQ;AACR,MAAM,mBAAmBC,QAAuB,OAAO;AAAA,EACrD,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,gBAAgB,MAAM;AACxB,CAAQ;AACR,MAAM,oBAAoBC,QAAwB,OAAO;AAAA,EACvD,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,gBAAgB,MAAMF;AACxB,CAAQ;AACR,MAAM,0BAA0BG,QAA8B,OAAO;AAAA,EACnE,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,gBAAgB,MAAM;AACxB,CAAQ;AACR,MAAM,mBAAmBC,QAAuB,OAAO;AAAA,EACrD,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,gBAAgB,MAAM;AACxB,CAAQ;AACR,MAAM,qBAAqBC,QAAyB,OAAO;AAAA,EACzD,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,gBAAgB,MAAM;AACxB,CAAQ;AACR,MAAM,8BAA8BC,QAAkC,OAAO;AAAA,EAC3E,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,gBAAgB,MAAM;AACxB,CAAQ;AA2HR,MAAM,sBAA2C;AAAA,EAC/C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEA,MAAM,0BACJ,YAAY,iBAAiB,mBAAmB;AAElD,MAAM,oBAAuC;AAAA,EAC3C,aAAa;AAAA,EACb;AACF;AACO,MAAM,YAAYN,MACtB,iBAAiB,iBAAiB,EAClC,cAAA;"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const Route: import('@tanstack/router-core').Route<import('@tanstack/react-router').Register, import('@tanstack/router-core').Route<import('@tanstack/react-router').Register, import('@tanstack/react-router').RootRoute<import('@tanstack/react-router').Register, undefined, import('../../types/types.js').AcRouterContext, import('@tanstack/router-core').AnyContext, import('@tanstack/router-core').AnyContext, {}, undefined, unknown, unknown, unknown, unknown, undefined>, "", "/", "/_layout", "/_layout", undefined, import('@tanstack/router-core').ResolveParams<"">, import('@tanstack/router-core').AnyContext, import('@tanstack/router-core').AnyContext, import('@tanstack/router-core').AnyContext, {}, undefined, unknown, unknown, unknown, unknown, undefined>, "/service-desks", "/service-desks", "/_layout/service-desks", "/_layout/service-desks", z.ZodObject<{
|
|
3
|
+
q: z.ZodOptional<z.ZodString>;
|
|
4
|
+
}, z.core.$strip>, import('@tanstack/router-core').ResolveParams<"/service-desks">, import('@tanstack/router-core').AnyContext, import('@tanstack/router-core').AnyContext, import('@tanstack/router-core').AnyContext, {}, () => Promise<{
|
|
5
|
+
appCatalogLoader: import('~/modules/appCatalog/routeLoader').AppCatalogLoaderReturn;
|
|
6
|
+
}>, unknown, unknown, unknown, unknown, undefined>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createFileRoute } from "@tanstack/react-router";
|
|
3
|
+
import { appCatalogRouteLoader } from "../../modules/appCatalog/routeLoader.js";
|
|
4
|
+
import { AppCatalogLayout } from "../../modules/appCatalog/ui/layout/AppCatalogLayout.js";
|
|
5
|
+
import { ServiceDesksPage } from "../../modules/appCatalog/ui/pages/ServiceDesksPage.js";
|
|
6
|
+
import { object, string } from "../../node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/classic/schemas.js";
|
|
7
|
+
const searchSchema = object({
|
|
8
|
+
q: string().optional()
|
|
9
|
+
});
|
|
10
|
+
const Route = createFileRoute("/_layout/service-desks")({
|
|
11
|
+
component: RouteComponent,
|
|
12
|
+
validateSearch: searchSchema,
|
|
13
|
+
async loader() {
|
|
14
|
+
const appCatalogLoader = await appCatalogRouteLoader();
|
|
15
|
+
return { appCatalogLoader };
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
function RouteComponent() {
|
|
19
|
+
const { queryClient, trpcClient } = Route.useRouteContext();
|
|
20
|
+
return /* @__PURE__ */ jsx(AppCatalogLayout, { queryClient, trpcClient, children: /* @__PURE__ */ jsx(ServiceDesksPage, {}) });
|
|
21
|
+
}
|
|
22
|
+
export {
|
|
23
|
+
Route
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=service-desks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service-desks.js","sources":["../../../../src/routes/_layout/service-desks.tsx"],"sourcesContent":["import { createFileRoute } from '@tanstack/react-router'\nimport { z } from 'zod'\nimport { appCatalogRouteLoader } from '~/modules/appCatalog/routeLoader'\nimport { AppCatalogLayout } from '~/modules/appCatalog/ui/layout/AppCatalogLayout'\nimport { ServiceDesksPage } from '~/modules/appCatalog/ui/pages/ServiceDesksPage'\n\nconst searchSchema = z.object({\n q: z.string().optional(),\n})\n\nexport const Route = createFileRoute('/_layout/service-desks')({\n component: RouteComponent,\n validateSearch: searchSchema,\n async loader() {\n const appCatalogLoader = await appCatalogRouteLoader()\n return { appCatalogLoader }\n },\n})\n\nfunction RouteComponent() {\n const { queryClient, trpcClient } = Route.useRouteContext()\n\n return (\n <AppCatalogLayout queryClient={queryClient} trpcClient={trpcClient}>\n <ServiceDesksPage />\n </AppCatalogLayout>\n )\n}\n"],"names":["z.object","z.string"],"mappings":";;;;;;AAMA,MAAM,eAAeA,OAAS;AAAA,EAC5B,GAAGC,OAAE,EAAS,SAAA;AAChB,CAAC;AAEM,MAAM,QAAQ,gBAAgB,wBAAwB,EAAE;AAAA,EAC7D,WAAW;AAAA,EACX,gBAAgB;AAAA,EAChB,MAAM,SAAS;AACb,UAAM,mBAAmB,MAAM,sBAAA;AAC/B,WAAO,EAAE,iBAAA;AAAA,EACX;AACF,CAAC;AAED,SAAS,iBAAiB;AACxB,QAAM,EAAE,aAAa,eAAe,MAAM,gBAAA;AAE1C,6BACG,kBAAA,EAAiB,aAA0B,YAC1C,UAAA,oBAAC,oBAAiB,GACpB;AAEJ;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@igstack/app-catalog-frontend-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Frontend core library for App Catalog",
|
|
5
5
|
"homepage": "https://github.com/lislon/app-catalog",
|
|
6
6
|
"repository": {
|
|
@@ -134,8 +134,8 @@
|
|
|
134
134
|
"vite-plugin-static-copy": "^3.1.4",
|
|
135
135
|
"vite-plugin-svgr": "^4.2.0",
|
|
136
136
|
"vitest": "^4.1.2",
|
|
137
|
-
"@igstack/app-catalog-backend-core": "0.
|
|
138
|
-
"@igstack/app-catalog-shared-core": "0.
|
|
137
|
+
"@igstack/app-catalog-backend-core": "0.7.0",
|
|
138
|
+
"@igstack/app-catalog-shared-core": "0.7.0"
|
|
139
139
|
},
|
|
140
140
|
"peerDependencies": {
|
|
141
141
|
"react": "19.1.2",
|
|
@@ -144,7 +144,7 @@
|
|
|
144
144
|
"vite": "^6.3.5",
|
|
145
145
|
"vite-plugin-svgr": "^4.2.0"
|
|
146
146
|
},
|
|
147
|
-
"gitHead": "
|
|
147
|
+
"gitHead": "7d6ab9e5f8fed7691348bf08d4766e32f33582ad",
|
|
148
148
|
"scripts": {
|
|
149
149
|
"build": "vite build",
|
|
150
150
|
"build:lenient": "vite build --mode lenient",
|
|
@@ -38,6 +38,12 @@ function fullMagazine(
|
|
|
38
38
|
displayName: 'IT Help Desk',
|
|
39
39
|
config: { url: 'https://helpdesk.example.com' },
|
|
40
40
|
})
|
|
41
|
+
backendCfg.withApprovalMethod({
|
|
42
|
+
slug: 'ux-app-helpdesk',
|
|
43
|
+
type: 'service',
|
|
44
|
+
displayName: 'UX App Helpdesk',
|
|
45
|
+
config: { url: 'https://uxdesk.example.com' },
|
|
46
|
+
})
|
|
41
47
|
const managerApproval = backendCfg.withApprovalMethod({
|
|
42
48
|
slug: 'manager-approval',
|
|
43
49
|
type: 'custom',
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest'
|
|
2
|
+
import { waitFor } from '@testing-library/react'
|
|
3
|
+
import '@testing-library/jest-dom/vitest'
|
|
4
|
+
|
|
5
|
+
import { given } from './harness/given'
|
|
6
|
+
import { magazine } from './mock-backend/magazines'
|
|
7
|
+
|
|
8
|
+
// #12: a deprecated app's "View replacement" link must open the replacement
|
|
9
|
+
// app's detail — like typing its /app/<slug> URL — even when the replacement
|
|
10
|
+
// is not in the current filtered/search results. In magazine.full(),
|
|
11
|
+
// "Old Tool" is deprecated with replacementSlug 'new-tool' ("New Tool").
|
|
12
|
+
describe('Deprecated app "View replacement" link (#12)', () => {
|
|
13
|
+
it('opens the replacement app even when it is filtered out of search results', async () => {
|
|
14
|
+
// Deep-link straight onto the deprecated Old Tool with an active search of
|
|
15
|
+
// "old tool" — which does NOT match "New Tool", so the replacement is
|
|
16
|
+
// absent from the filtered list (the exact condition that broke the link).
|
|
17
|
+
const { ui, router } = await given(magazine.full(), {
|
|
18
|
+
initialRoute: '/app/old-tool?q=old%20tool',
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
await waitFor(() => {
|
|
22
|
+
expect(ui.catalog.isDetailPanelOpen()).toBe(true)
|
|
23
|
+
})
|
|
24
|
+
expect(ui.app.getOpenTitle()).toContain('Old Tool')
|
|
25
|
+
|
|
26
|
+
// Click "View replacement: New Tool".
|
|
27
|
+
await ui.app.clickViewReplacement()
|
|
28
|
+
|
|
29
|
+
// URL navigates to the replacement, and its detail panel actually renders
|
|
30
|
+
// (before the fix the panel went blank because it resolved the open app
|
|
31
|
+
// from the filtered list, which excluded New Tool).
|
|
32
|
+
await waitFor(() => {
|
|
33
|
+
expect(router.state.location.pathname).toBe('/app/new-tool')
|
|
34
|
+
})
|
|
35
|
+
await waitFor(() => {
|
|
36
|
+
expect(ui.app.getOpenTitle()).toContain('New Tool')
|
|
37
|
+
})
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
it('deep-links to an app that is filtered out by an active search', async () => {
|
|
41
|
+
// Hard navigation: /app/<slug> should render the app regardless of a
|
|
42
|
+
// non-matching active search (browser-URL-like behavior).
|
|
43
|
+
const { ui } = await given(magazine.full(), {
|
|
44
|
+
initialRoute: '/app/jira?q=zzz-no-match-zzz',
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
await waitFor(() => {
|
|
48
|
+
expect(ui.catalog.isDetailPanelOpen()).toBe(true)
|
|
49
|
+
})
|
|
50
|
+
expect(ui.app.getOpenTitle()).toContain('Jira')
|
|
51
|
+
})
|
|
52
|
+
})
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest'
|
|
2
|
+
import { screen, waitFor, within } from '@testing-library/react'
|
|
3
|
+
import userEvent from '@testing-library/user-event'
|
|
4
|
+
import '@testing-library/jest-dom/vitest'
|
|
5
|
+
|
|
6
|
+
import { given } from './harness/given'
|
|
7
|
+
import { magazine } from './mock-backend/magazines'
|
|
8
|
+
|
|
9
|
+
// #9: a header toggle (Apps | Service Desks) + a /service-desks route showing a
|
|
10
|
+
// searchable table of all type:'service' approval methods with open links.
|
|
11
|
+
// magazine.full() seeds two service desks (IT Help Desk, UX App Helpdesk) and
|
|
12
|
+
// two custom methods (Manager Approval, Self-Service) which must NOT appear.
|
|
13
|
+
|
|
14
|
+
function serviceDeskTable(): HTMLElement {
|
|
15
|
+
// The service-desks table (only table on that route).
|
|
16
|
+
return screen.getByRole('table')
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function deskNames(): string[] {
|
|
20
|
+
const rows = within(serviceDeskTable()).getAllByRole('row')
|
|
21
|
+
return rows
|
|
22
|
+
.map((r) => within(r).queryAllByRole('cell')[0]?.textContent.trim() ?? '')
|
|
23
|
+
.filter(Boolean)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
describe('Service Desks view (#9)', () => {
|
|
27
|
+
it('lists only service-type approval methods with open links', async () => {
|
|
28
|
+
await given(magazine.full(), {
|
|
29
|
+
initialRoute: '/service-desks',
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
await waitFor(() => {
|
|
33
|
+
expect(screen.getByLabelText('Search service desks')).toBeInTheDocument()
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
const names = deskNames()
|
|
37
|
+
expect(names).toContain('IT Help Desk')
|
|
38
|
+
expect(names).toContain('UX App Helpdesk')
|
|
39
|
+
// custom-type methods are not service desks
|
|
40
|
+
expect(names).not.toContain('Manager Approval')
|
|
41
|
+
expect(names).not.toContain('Self-Service')
|
|
42
|
+
|
|
43
|
+
// Each service desk row has a link to its portal opening in a new tab.
|
|
44
|
+
const itRow = within(serviceDeskTable())
|
|
45
|
+
.getAllByRole('row')
|
|
46
|
+
.find((r) => r.textContent.includes('IT Help Desk'))!
|
|
47
|
+
const link = within(itRow).getByRole('link')
|
|
48
|
+
expect(link).toHaveAttribute('href', 'https://helpdesk.example.com')
|
|
49
|
+
expect(link).toHaveAttribute('target', '_blank')
|
|
50
|
+
})
|
|
51
|
+
|
|
52
|
+
it('filters the desks by search', async () => {
|
|
53
|
+
const user = userEvent.setup()
|
|
54
|
+
await given(magazine.full(), {
|
|
55
|
+
initialRoute: '/service-desks',
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
await waitFor(() => expect(deskNames()).toContain('UX App Helpdesk'))
|
|
59
|
+
|
|
60
|
+
await user.type(screen.getByLabelText('Search service desks'), 'UX')
|
|
61
|
+
|
|
62
|
+
await waitFor(() => {
|
|
63
|
+
const names = deskNames()
|
|
64
|
+
expect(names).toContain('UX App Helpdesk')
|
|
65
|
+
expect(names).not.toContain('IT Help Desk')
|
|
66
|
+
})
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
it('toggles between Apps and Service Desks from the header', async () => {
|
|
70
|
+
const { router } = await given(magazine.full(), { initialRoute: '/' })
|
|
71
|
+
|
|
72
|
+
// Apps view first — the catalog search box is present.
|
|
73
|
+
await waitFor(() =>
|
|
74
|
+
expect(screen.getByLabelText('Search apps')).toBeInTheDocument(),
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
const user = userEvent.setup()
|
|
78
|
+
await user.click(screen.getByRole('link', { name: 'Service Desks' }))
|
|
79
|
+
|
|
80
|
+
await waitFor(() => {
|
|
81
|
+
expect(router.state.location.pathname).toBe('/service-desks')
|
|
82
|
+
})
|
|
83
|
+
expect(screen.getByLabelText('Search service desks')).toBeInTheDocument()
|
|
84
|
+
})
|
|
85
|
+
})
|
|
@@ -127,6 +127,18 @@ export class AppDetailTools {
|
|
|
127
127
|
},
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
+
/** Click the "View replacement: <App>" link in a deprecated app's panel. */
|
|
131
|
+
async clickViewReplacement(): Promise<void> {
|
|
132
|
+
const btn = screen.getByRole('button', { name: /View replacement:/i })
|
|
133
|
+
await this.user.click(btn)
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/** The title shown in the currently open detail panel (empty if none). */
|
|
137
|
+
getOpenTitle(): string {
|
|
138
|
+
const panel = this.getPanel()
|
|
139
|
+
return panel.querySelector('.text-2xl')?.textContent.trim() ?? ''
|
|
140
|
+
}
|
|
141
|
+
|
|
130
142
|
private getPanel(): HTMLElement {
|
|
131
143
|
const closeButton = screen.queryByLabelText('Close details panel')
|
|
132
144
|
if (!closeButton) {
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Link } from '@tanstack/react-router'
|
|
2
|
+
import { cn } from '~/lib/utils'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Compact segmented toggle for the header (Apps | Service Desks). Rendered in
|
|
6
|
+
* the header's `middle` slot so it adds no header height. Uses router Links so
|
|
7
|
+
* the active segment reflects the current route and each is deep-linkable.
|
|
8
|
+
*/
|
|
9
|
+
export function ViewToggle() {
|
|
10
|
+
const segment =
|
|
11
|
+
'inline-flex items-center rounded-md px-3 py-1 text-sm font-medium transition-colors'
|
|
12
|
+
const active = 'bg-background text-foreground shadow-sm'
|
|
13
|
+
const inactive = 'text-muted-foreground hover:text-foreground'
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<div
|
|
17
|
+
role="tablist"
|
|
18
|
+
aria-label="View"
|
|
19
|
+
className="inline-flex items-center gap-1 rounded-lg bg-muted p-[3px]"
|
|
20
|
+
>
|
|
21
|
+
<Link
|
|
22
|
+
to="/"
|
|
23
|
+
aria-label="Apps"
|
|
24
|
+
className={cn(segment, inactive)}
|
|
25
|
+
activeOptions={{ exact: true }}
|
|
26
|
+
activeProps={{ className: cn(segment, active) }}
|
|
27
|
+
>
|
|
28
|
+
Apps
|
|
29
|
+
</Link>
|
|
30
|
+
<Link
|
|
31
|
+
to="/service-desks"
|
|
32
|
+
aria-label="Service Desks"
|
|
33
|
+
className={cn(segment, inactive)}
|
|
34
|
+
activeProps={{ className: cn(segment, active) }}
|
|
35
|
+
>
|
|
36
|
+
Service Desks
|
|
37
|
+
</Link>
|
|
38
|
+
</div>
|
|
39
|
+
)
|
|
40
|
+
}
|
|
@@ -701,8 +701,15 @@ export function AppCatalogGrid({
|
|
|
701
701
|
onClearFilters,
|
|
702
702
|
onClosePanel,
|
|
703
703
|
}: AppCatalogGridProps) {
|
|
704
|
+
// Full, unfiltered resource set — the detail panel must resolve the open app
|
|
705
|
+
// from this, not only from the filtered `apps`. Navigating to /app/<slug>
|
|
706
|
+
// (e.g. a deprecated app's "View replacement" link, or any deep link) should
|
|
707
|
+
// render that app like typing the URL in the browser, regardless of the
|
|
708
|
+
// active search/filters (#12).
|
|
709
|
+
const { resources: allResourcesForDetail } = useAppCatalogContext()
|
|
704
710
|
const selectedApp = selectedAppSlug
|
|
705
|
-
? apps.find((a) => a.slug === selectedAppSlug)
|
|
711
|
+
? (apps.find((a) => a.slug === selectedAppSlug) ??
|
|
712
|
+
allResourcesForDetail.find((a) => a.slug === selectedAppSlug))
|
|
706
713
|
: null
|
|
707
714
|
|
|
708
715
|
const groupedApps = groupApps(apps, groupingDefinition, hasSearch)
|
|
@@ -4,6 +4,7 @@ import type { TRPCClient } from '@trpc/client'
|
|
|
4
4
|
import { useUiSettings } from '~/context/UiSettingsContext'
|
|
5
5
|
import { AppCatalogProvider } from '~/modules/appCatalog/context/AppCatalogContext'
|
|
6
6
|
import { AppCatalogFiltersProvider } from '~/modules/appCatalog/ui/context/AppCatalogFiltersContext'
|
|
7
|
+
import { ViewToggle } from '~/modules/appCatalog/ui/components/ViewToggle'
|
|
7
8
|
import { MainLayout } from '~/ui/layout/MainLayout'
|
|
8
9
|
import { TopLevelProviders } from '~/ui/layout/TopLevelProviders'
|
|
9
10
|
|
|
@@ -29,7 +30,7 @@ export function AppCatalogLayout({
|
|
|
29
30
|
<AppCatalogFiltersProvider
|
|
30
31
|
filterableTagPrefixes={filterableTagPrefixes}
|
|
31
32
|
>
|
|
32
|
-
<MainLayout headerMiddle={headerMiddle}>
|
|
33
|
+
<MainLayout headerMiddle={headerMiddle ?? <ViewToggle />}>
|
|
33
34
|
{/* <Breadcrumb className="pb-4">*/}
|
|
34
35
|
{/* <BreadcrumbList>*/}
|
|
35
36
|
{/* <BreadcrumbItem>*/}
|