@teambit/workspace 1.0.843 → 1.0.845
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/{preview-1765465587750.js → preview-1765561375887.js} +2 -2
- package/dist/ui/workspace/workspace-overview/filter-utils.d.ts +7 -0
- package/dist/ui/workspace/workspace-overview/filter-utils.js +24 -0
- package/dist/ui/workspace/workspace-overview/filter-utils.js.map +1 -0
- package/dist/ui/workspace/workspace-overview/namespace-sort.d.ts +8 -0
- package/dist/ui/workspace/workspace-overview/namespace-sort.js +44 -0
- package/dist/ui/workspace/workspace-overview/namespace-sort.js.map +1 -0
- package/dist/ui/workspace/workspace-overview/scope-sort.d.ts +1 -0
- package/dist/ui/workspace/workspace-overview/scope-sort.js +14 -0
- package/dist/ui/workspace/workspace-overview/scope-sort.js.map +1 -0
- package/dist/ui/workspace/workspace-overview/use-workspace-aggregation.d.ts +2 -0
- package/dist/ui/workspace/workspace-overview/use-workspace-aggregation.js +84 -0
- package/dist/ui/workspace/workspace-overview/use-workspace-aggregation.js.map +1 -0
- package/dist/ui/workspace/workspace-overview/workspace-filter-panel.d.ts +7 -0
- package/dist/ui/workspace/workspace-overview/workspace-filter-panel.js +113 -0
- package/dist/ui/workspace/workspace-overview/workspace-filter-panel.js.map +1 -0
- package/dist/ui/workspace/workspace-overview/workspace-overview.js +91 -49
- package/dist/ui/workspace/workspace-overview/workspace-overview.js.map +1 -1
- package/dist/ui/workspace/workspace-overview/workspace-overview.module.scss +166 -12
- package/dist/ui/workspace/workspace-overview/workspace-overview.sort.d.ts +1 -0
- package/dist/ui/workspace/workspace-overview/workspace-overview.sort.js +30 -0
- package/dist/ui/workspace/workspace-overview/workspace-overview.sort.js.map +1 -0
- package/dist/ui/workspace/workspace-overview/workspace-overview.types.d.ts +22 -0
- package/dist/ui/workspace/workspace-overview/workspace-overview.types.js +3 -0
- package/dist/ui/workspace/workspace-overview/workspace-overview.types.js.map +1 -0
- package/package.json +22 -19
- package/ui/workspace/workspace-overview/filter-utils.ts +25 -0
- package/ui/workspace/workspace-overview/namespace-sort.ts +41 -0
- package/ui/workspace/workspace-overview/scope-sort.ts +9 -0
- package/ui/workspace/workspace-overview/use-workspace-aggregation.ts +72 -0
- package/ui/workspace/workspace-overview/workspace-filter-panel.tsx +112 -0
- package/ui/workspace/workspace-overview/workspace-overview.module.scss +166 -12
- package/ui/workspace/workspace-overview/workspace-overview.sort.ts +29 -0
- package/ui/workspace/workspace-overview/workspace-overview.tsx +53 -32
- package/ui/workspace/workspace-overview/workspace-overview.types.ts +24 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.workspace_workspace@1.0.
|
|
2
|
-
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.workspace_workspace@1.0.
|
|
1
|
+
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.workspace_workspace@1.0.845/dist/workspace.composition.js';
|
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.workspace_workspace@1.0.845/dist/workspace.docs.mdx';
|
|
3
3
|
|
|
4
4
|
export const compositions = [compositions_0];
|
|
5
5
|
export const overview = [overview_0];
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { WorkspaceItem } from './workspace-overview.types';
|
|
2
|
+
export interface ActiveFilters {
|
|
3
|
+
namespaces: string[];
|
|
4
|
+
scopes: string[];
|
|
5
|
+
}
|
|
6
|
+
export declare function parseActiveFilters(search: URLSearchParams): ActiveFilters;
|
|
7
|
+
export declare function filterItems(items: WorkspaceItem[], filters: ActiveFilters): WorkspaceItem[];
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.filterItems = filterItems;
|
|
7
|
+
exports.parseActiveFilters = parseActiveFilters;
|
|
8
|
+
function parseActiveFilters(search) {
|
|
9
|
+
return {
|
|
10
|
+
namespaces: (search.get('ns') || '').split(',').filter(Boolean),
|
|
11
|
+
scopes: (search.get('scopes') || '').split(',').filter(Boolean)
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
function filterItems(items, filters) {
|
|
15
|
+
return items.filter(item => {
|
|
16
|
+
const ns = item.component.id.namespace || '/';
|
|
17
|
+
const sc = item.component.id.scope;
|
|
18
|
+
if (filters.namespaces.length && !filters.namespaces.includes(ns)) return false;
|
|
19
|
+
if (filters.scopes.length && !filters.scopes.includes(sc)) return false;
|
|
20
|
+
return true;
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
//# sourceMappingURL=filter-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["parseActiveFilters","search","namespaces","get","split","filter","Boolean","scopes","filterItems","items","filters","item","ns","component","id","namespace","sc","scope","length","includes"],"sources":["filter-utils.ts"],"sourcesContent":["import type { WorkspaceItem } from './workspace-overview.types';\n\nexport interface ActiveFilters {\n namespaces: string[];\n scopes: string[];\n}\n\nexport function parseActiveFilters(search: URLSearchParams): ActiveFilters {\n return {\n namespaces: (search.get('ns') || '').split(',').filter(Boolean),\n scopes: (search.get('scopes') || '').split(',').filter(Boolean),\n };\n}\n\nexport function filterItems(items: WorkspaceItem[], filters: ActiveFilters): WorkspaceItem[] {\n return items.filter((item) => {\n const ns = item.component.id.namespace || '/';\n const sc = item.component.id.scope;\n\n if (filters.namespaces.length && !filters.namespaces.includes(ns)) return false;\n if (filters.scopes.length && !filters.scopes.includes(sc)) return false;\n\n return true;\n });\n}\n"],"mappings":";;;;;;;AAOO,SAASA,kBAAkBA,CAACC,MAAuB,EAAiB;EACzE,OAAO;IACLC,UAAU,EAAE,CAACD,MAAM,CAACE,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,EAAEC,KAAK,CAAC,GAAG,CAAC,CAACC,MAAM,CAACC,OAAO,CAAC;IAC/DC,MAAM,EAAE,CAACN,MAAM,CAACE,GAAG,CAAC,QAAQ,CAAC,IAAI,EAAE,EAAEC,KAAK,CAAC,GAAG,CAAC,CAACC,MAAM,CAACC,OAAO;EAChE,CAAC;AACH;AAEO,SAASE,WAAWA,CAACC,KAAsB,EAAEC,OAAsB,EAAmB;EAC3F,OAAOD,KAAK,CAACJ,MAAM,CAAEM,IAAI,IAAK;IAC5B,MAAMC,EAAE,GAAGD,IAAI,CAACE,SAAS,CAACC,EAAE,CAACC,SAAS,IAAI,GAAG;IAC7C,MAAMC,EAAE,GAAGL,IAAI,CAACE,SAAS,CAACC,EAAE,CAACG,KAAK;IAElC,IAAIP,OAAO,CAACR,UAAU,CAACgB,MAAM,IAAI,CAACR,OAAO,CAACR,UAAU,CAACiB,QAAQ,CAACP,EAAE,CAAC,EAAE,OAAO,KAAK;IAC/E,IAAIF,OAAO,CAACH,MAAM,CAACW,MAAM,IAAI,CAACR,OAAO,CAACH,MAAM,CAACY,QAAQ,CAACH,EAAE,CAAC,EAAE,OAAO,KAAK;IAEvE,OAAO,IAAI;EACb,CAAC,CAAC;AACJ","ignoreList":[]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { WorkspaceItem } from './workspace-overview.types';
|
|
2
|
+
export declare const PRIORITY_HIGH: string[];
|
|
3
|
+
export declare const PRIORITY_MED: string[];
|
|
4
|
+
export declare const PRIORITY_LOW: string[];
|
|
5
|
+
export declare function getRootNamespace(ns: string): string;
|
|
6
|
+
export declare function namespacePriority(ns: string): number;
|
|
7
|
+
export declare function sortNamespacesAdvanced(list: string[]): string[];
|
|
8
|
+
export declare function sortItemsByNamespace(items: WorkspaceItem[]): WorkspaceItem[];
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.PRIORITY_MED = exports.PRIORITY_LOW = exports.PRIORITY_HIGH = void 0;
|
|
7
|
+
exports.getRootNamespace = getRootNamespace;
|
|
8
|
+
exports.namespacePriority = namespacePriority;
|
|
9
|
+
exports.sortItemsByNamespace = sortItemsByNamespace;
|
|
10
|
+
exports.sortNamespacesAdvanced = sortNamespacesAdvanced;
|
|
11
|
+
const PRIORITY_HIGH = exports.PRIORITY_HIGH = ['ui', 'pages'];
|
|
12
|
+
const PRIORITY_MED = exports.PRIORITY_MED = ['design'];
|
|
13
|
+
const PRIORITY_LOW = exports.PRIORITY_LOW = ['entities', 'provider', 'hooks', 'icons'];
|
|
14
|
+
function getRootNamespace(ns) {
|
|
15
|
+
if (!ns) return '';
|
|
16
|
+
return ns.split('/')[0];
|
|
17
|
+
}
|
|
18
|
+
function namespacePriority(ns) {
|
|
19
|
+
const root = getRootNamespace(ns);
|
|
20
|
+
if (PRIORITY_HIGH.includes(root)) return 0;
|
|
21
|
+
if (PRIORITY_MED.includes(root)) return 1;
|
|
22
|
+
if (PRIORITY_LOW.includes(root)) return 3;
|
|
23
|
+
return 2;
|
|
24
|
+
}
|
|
25
|
+
function sortNamespacesAdvanced(list) {
|
|
26
|
+
return [...list].sort((a, b) => {
|
|
27
|
+
const pa = namespacePriority(a);
|
|
28
|
+
const pb = namespacePriority(b);
|
|
29
|
+
if (pa !== pb) return pa - pb;
|
|
30
|
+
return a.localeCompare(b);
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
function sortItemsByNamespace(items) {
|
|
34
|
+
return [...items].sort((a, b) => {
|
|
35
|
+
const na = a.component.id.namespace || '/';
|
|
36
|
+
const nb = b.component.id.namespace || '/';
|
|
37
|
+
const pa = namespacePriority(na);
|
|
38
|
+
const pb = namespacePriority(nb);
|
|
39
|
+
if (pa !== pb) return pa - pb;
|
|
40
|
+
return a.component.id.name.localeCompare(b.component.id.name);
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
//# sourceMappingURL=namespace-sort.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["PRIORITY_HIGH","exports","PRIORITY_MED","PRIORITY_LOW","getRootNamespace","ns","split","namespacePriority","root","includes","sortNamespacesAdvanced","list","sort","a","b","pa","pb","localeCompare","sortItemsByNamespace","items","na","component","id","namespace","nb","name"],"sources":["namespace-sort.ts"],"sourcesContent":["import type { WorkspaceItem } from './workspace-overview.types';\n\nexport const PRIORITY_HIGH = ['ui', 'pages'] as string[];\nexport const PRIORITY_MED = ['design'] as string[];\nexport const PRIORITY_LOW = ['entities', 'provider', 'hooks', 'icons'] as string[];\n\nexport function getRootNamespace(ns: string): string {\n if (!ns) return '';\n return ns.split('/')[0]!;\n}\n\nexport function namespacePriority(ns: string): number {\n const root = getRootNamespace(ns);\n\n if (PRIORITY_HIGH.includes(root)) return 0;\n if (PRIORITY_MED.includes(root)) return 1;\n if (PRIORITY_LOW.includes(root)) return 3;\n return 2;\n}\n\nexport function sortNamespacesAdvanced(list: string[]): string[] {\n return [...list].sort((a, b) => {\n const pa = namespacePriority(a);\n const pb = namespacePriority(b);\n if (pa !== pb) return pa - pb;\n return a.localeCompare(b);\n });\n}\n\nexport function sortItemsByNamespace(items: WorkspaceItem[]): WorkspaceItem[] {\n return [...items].sort((a, b) => {\n const na = a.component.id.namespace || '/';\n const nb = b.component.id.namespace || '/';\n\n const pa = namespacePriority(na);\n const pb = namespacePriority(nb);\n if (pa !== pb) return pa - pb;\n\n return a.component.id.name.localeCompare(b.component.id.name);\n });\n}\n"],"mappings":";;;;;;;;;;AAEO,MAAMA,aAAa,GAAAC,OAAA,CAAAD,aAAA,GAAG,CAAC,IAAI,EAAE,OAAO,CAAa;AACjD,MAAME,YAAY,GAAAD,OAAA,CAAAC,YAAA,GAAG,CAAC,QAAQ,CAAa;AAC3C,MAAMC,YAAY,GAAAF,OAAA,CAAAE,YAAA,GAAG,CAAC,UAAU,EAAE,UAAU,EAAE,OAAO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,MAAMJ,EAAE,GAAGT,iBAAiB,CAACiB,EAAE,CAAC;IAChC,IAAIT,EAAE,KAAKC,EAAE,EAAE,OAAOD,EAAE,GAAGC,EAAE;IAE7B,OAAOH,CAAC,CAACQ,SAAS,CAACC,EAAE,CAACG,IAAI,CAACR,aAAa,CAACH,CAAC,CAACO,SAAS,CAACC,EAAE,CAACG,IAAI,CAAC;EAC/D,CAAC,CAAC;AACJ","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function sortScopes(scopes: string[]): string[];
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.sortScopes = sortScopes;
|
|
7
|
+
function sortScopes(scopes) {
|
|
8
|
+
const designPrefix = 'design';
|
|
9
|
+
const nonDesign = scopes.filter(s => !s.includes(designPrefix)).sort((a, b) => a.localeCompare(b));
|
|
10
|
+
const design = scopes.filter(s => s.includes(designPrefix)).sort((a, b) => a.localeCompare(b));
|
|
11
|
+
return [...nonDesign, ...design];
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
//# sourceMappingURL=scope-sort.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["sortScopes","scopes","designPrefix","nonDesign","filter","s","includes","sort","a","b","localeCompare","design"],"sources":["scope-sort.ts"],"sourcesContent":["export function sortScopes(scopes: string[]) {\n const designPrefix = 'design';\n\n const nonDesign = scopes.filter((s) => !s.includes(designPrefix)).sort((a, b) => a.localeCompare(b));\n\n const design = scopes.filter((s) => s.includes(designPrefix)).sort((a, b) => a.localeCompare(b));\n\n return [...nonDesign, ...design];\n}\n"],"mappings":";;;;;;AAAO,SAASA,UAAUA,CAACC,MAAgB,EAAE;EAC3C,MAAMC,YAAY,GAAG,QAAQ;EAE7B,MAAMC,SAAS,GAAGF,MAAM,CAACG,MAAM,CAAEC,CAAC,IAAK,CAACA,CAAC,CAACC,QAAQ,CAACJ,YAAY,CAAC,CAAC,CAACK,IAAI,CAAC,CAACC,CAAC,EAAEC,CAAC,KAAKD,CAAC,CAACE,aAAa,CAACD,CAAC,CAAC,CAAC;EAEpG,MAAME,MAAM,GAAGV,MAAM,CAACG,MAAM,CAAEC,CAAC,IAAKA,CAAC,CAACC,QAAQ,CAACJ,YAAY,CAAC,CAAC,CAACK,IAAI,CAAC,CAACC,CAAC,EAAEC,CAAC,KAAKD,CAAC,CAACE,aAAa,CAACD,CAAC,CAAC,CAAC;EAEhG,OAAO,CAAC,GAAGN,SAAS,EAAE,GAAGQ,MAAM,CAAC;AAClC","ignoreList":[]}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useWorkspaceAggregation = useWorkspaceAggregation;
|
|
7
|
+
function _react() {
|
|
8
|
+
const data = require("react");
|
|
9
|
+
_react = function () {
|
|
10
|
+
return data;
|
|
11
|
+
};
|
|
12
|
+
return data;
|
|
13
|
+
}
|
|
14
|
+
function _namespaceSort() {
|
|
15
|
+
const data = require("./namespace-sort");
|
|
16
|
+
_namespaceSort = function () {
|
|
17
|
+
return data;
|
|
18
|
+
};
|
|
19
|
+
return data;
|
|
20
|
+
}
|
|
21
|
+
function _filterUtils() {
|
|
22
|
+
const data = require("./filter-utils");
|
|
23
|
+
_filterUtils = function () {
|
|
24
|
+
return data;
|
|
25
|
+
};
|
|
26
|
+
return data;
|
|
27
|
+
}
|
|
28
|
+
function useWorkspaceAggregation(items, aggregation) {
|
|
29
|
+
const search = new URLSearchParams(window.location.search);
|
|
30
|
+
const filters = (0, _filterUtils().parseActiveFilters)(search);
|
|
31
|
+
const filtered = (0, _react().useMemo)(() => (0, _filterUtils().filterItems)(items, filters), [items, filters]);
|
|
32
|
+
if (aggregation === 'none') {
|
|
33
|
+
return {
|
|
34
|
+
groups: [{
|
|
35
|
+
name: 'all',
|
|
36
|
+
displayName: '',
|
|
37
|
+
items: (0, _namespaceSort().sortItemsByNamespace)(filtered)
|
|
38
|
+
}],
|
|
39
|
+
groupType: 'none',
|
|
40
|
+
availableAggregations: ['namespaces', 'scopes', 'none'],
|
|
41
|
+
filteredCount: filtered.length
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
if (aggregation === 'namespaces') {
|
|
45
|
+
const map = new Map();
|
|
46
|
+
for (const item of filtered) {
|
|
47
|
+
const ns = item.component.id.namespace || '/';
|
|
48
|
+
if (!map.has(ns)) map.set(ns, []);
|
|
49
|
+
map.get(ns).push(item);
|
|
50
|
+
}
|
|
51
|
+
const sortedKeys = (0, _namespaceSort().sortNamespacesAdvanced)([...map.keys()]);
|
|
52
|
+
const groups = sortedKeys.map(ns => ({
|
|
53
|
+
name: ns,
|
|
54
|
+
displayName: ns,
|
|
55
|
+
items: (0, _namespaceSort().sortItemsByNamespace)(map.get(ns))
|
|
56
|
+
}));
|
|
57
|
+
return {
|
|
58
|
+
groups,
|
|
59
|
+
groupType: 'namespaces',
|
|
60
|
+
availableAggregations: ['namespaces', 'scopes', 'none'],
|
|
61
|
+
filteredCount: filtered.length
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
const map = new Map();
|
|
65
|
+
for (const item of filtered) {
|
|
66
|
+
const scope = item.component.id.scope;
|
|
67
|
+
if (!map.has(scope)) map.set(scope, []);
|
|
68
|
+
map.get(scope).push(item);
|
|
69
|
+
}
|
|
70
|
+
const sortedScopes = [...map.keys()].sort();
|
|
71
|
+
const groups = sortedScopes.map(sc => ({
|
|
72
|
+
name: sc,
|
|
73
|
+
displayName: sc,
|
|
74
|
+
items: (0, _namespaceSort().sortItemsByNamespace)(map.get(sc))
|
|
75
|
+
}));
|
|
76
|
+
return {
|
|
77
|
+
groups,
|
|
78
|
+
groupType: 'scopes',
|
|
79
|
+
availableAggregations: ['namespaces', 'scopes', 'none'],
|
|
80
|
+
filteredCount: filtered.length
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
//# sourceMappingURL=use-workspace-aggregation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","data","require","_namespaceSort","_filterUtils","useWorkspaceAggregation","items","aggregation","search","URLSearchParams","window","location","filters","parseActiveFilters","filtered","useMemo","filterItems","groups","name","displayName","sortItemsByNamespace","groupType","availableAggregations","filteredCount","length","map","Map","item","ns","component","id","namespace","has","set","get","push","sortedKeys","sortNamespacesAdvanced","keys","scope","sortedScopes","sort","sc"],"sources":["use-workspace-aggregation.ts"],"sourcesContent":["import { useMemo } from 'react';\nimport { sortNamespacesAdvanced, sortItemsByNamespace } from './namespace-sort';\nimport { filterItems, parseActiveFilters } from './filter-utils';\nimport type { WorkspaceItem, AggregationType, AggregationGroup, AggregationResult } from './workspace-overview.types';\n\nexport function useWorkspaceAggregation(items: WorkspaceItem[], aggregation: AggregationType): AggregationResult {\n const search = new URLSearchParams(window.location.search);\n const filters = parseActiveFilters(search);\n\n const filtered = useMemo(() => filterItems(items, filters), [items, filters]);\n\n if (aggregation === 'none') {\n return {\n groups: [\n {\n name: 'all',\n displayName: '',\n items: sortItemsByNamespace(filtered),\n },\n ],\n groupType: 'none',\n availableAggregations: ['namespaces', 'scopes', 'none'],\n filteredCount: filtered.length,\n };\n }\n\n if (aggregation === 'namespaces') {\n const map = new Map<string, WorkspaceItem[]>();\n for (const item of filtered) {\n const ns = item.component.id.namespace || '/';\n if (!map.has(ns)) map.set(ns, []);\n map.get(ns)!.push(item);\n }\n\n const sortedKeys = sortNamespacesAdvanced([...map.keys()]);\n\n const groups: AggregationGroup[] = sortedKeys.map((ns) => ({\n name: ns,\n displayName: ns,\n items: sortItemsByNamespace(map.get(ns)!),\n }));\n\n return {\n groups,\n groupType: 'namespaces',\n availableAggregations: ['namespaces', 'scopes', 'none'],\n filteredCount: filtered.length,\n };\n }\n\n const map = new Map<string, WorkspaceItem[]>();\n for (const item of filtered) {\n const scope = item.component.id.scope;\n if (!map.has(scope)) map.set(scope, []);\n map.get(scope)!.push(item);\n }\n\n const sortedScopes = [...map.keys()].sort();\n\n const groups: AggregationGroup[] = sortedScopes.map((sc) => ({\n name: sc,\n displayName: sc,\n items: sortItemsByNamespace(map.get(sc)!),\n }));\n\n return {\n groups,\n groupType: 'scopes',\n availableAggregations: ['namespaces', 'scopes', 'none'],\n filteredCount: filtered.length,\n };\n}\n"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,eAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,cAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,aAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,YAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGO,SAASI,uBAAuBA,CAACC,KAAsB,EAAEC,WAA4B,EAAqB;EAC/G,MAAMC,MAAM,GAAG,IAAIC,eAAe,CAACC,MAAM,CAACC,QAAQ,CAACH,MAAM,CAAC;EAC1D,MAAMI,OAAO,GAAG,IAAAC,iCAAkB,EAACL,MAAM,CAAC;EAE1C,MAAMM,QAAQ,GAAG,IAAAC,gBAAO,EAAC,MAAM,IAAAC,0BAAW,EAACV,KAAK,EAAEM,OAAO,CAAC,EAAE,CAACN,KAAK,EAAEM,OAAO,CAAC,CAAC;EAE7E,IAAIL,WAAW,KAAK,MAAM,EAAE;IAC1B,OAAO;MACLU,MAAM,EAAE,CACN;QACEC,IAAI,EAAE,KAAK;QACXC,WAAW,EAAE,EAAE;QACfb,KAAK,EAAE,IAAAc,qCAAoB,EAACN,QAAQ;MACtC,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I,CAACd,GAAG,CAACO,GAAG,CAACO,KAAK,CAAC,EAAEd,GAAG,CAACQ,GAAG,CAACM,KAAK,EAAE,EAAE,CAAC;IACvCd,GAAG,CAACS,GAAG,CAACK,KAAK,CAAC,CAAEJ,IAAI,CAACR,IAAI,CAAC;EAC5B;EAEA,MAAMa,YAAY,GAAG,CAAC,GAAGf,GAAG,CAACa,IAAI,CAAC,CAAC,CAAC,CAACG,IAAI,CAAC,CAAC;EAE3C,MAAMxB,MAA0B,GAAGuB,YAAY,CAACf,GAAG,CAAEiB,EAAE,KAAM;IAC3DxB,IAAI,EAAEwB,EAAE;IACRvB,WAAW,EAAEuB,EAAE;IACfpC,KAAK,EAAE,IAAAc,qCAAoB,EAACK,GAAG,CAACS,GAAG,CAACQ,EAAE,CAAE;EAC1C,CAAC,CAAC,CAAC;EAEH,OAAO;IACLzB,MAAM;IACNI,SAAS,EAAE,QAAQ;IACnBC,qBAAqB,EAAE,CAAC,YAAY,EAAE,QAAQ,EAAE,MAAM,CAAC;IACvDC,aAAa,EAAET,QAAQ,CAACU;EAC1B,CAAC;AACH","ignoreList":[]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { WorkspaceItem, AggregationType } from './workspace-overview.types';
|
|
2
|
+
export interface WorkspaceFilterPanelProps {
|
|
3
|
+
aggregation: AggregationType;
|
|
4
|
+
availableAggregations: AggregationType[];
|
|
5
|
+
items: WorkspaceItem[];
|
|
6
|
+
}
|
|
7
|
+
export declare function WorkspaceFilterPanel({ aggregation, availableAggregations, items }: WorkspaceFilterPanelProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.WorkspaceFilterPanel = WorkspaceFilterPanel;
|
|
7
|
+
function _react() {
|
|
8
|
+
const data = _interopRequireWildcard(require("react"));
|
|
9
|
+
_react = function () {
|
|
10
|
+
return data;
|
|
11
|
+
};
|
|
12
|
+
return data;
|
|
13
|
+
}
|
|
14
|
+
function _reactRouterDom() {
|
|
15
|
+
const data = require("react-router-dom");
|
|
16
|
+
_reactRouterDom = function () {
|
|
17
|
+
return data;
|
|
18
|
+
};
|
|
19
|
+
return data;
|
|
20
|
+
}
|
|
21
|
+
function _designInputs() {
|
|
22
|
+
const data = require("@teambit/design.inputs.toggle-button");
|
|
23
|
+
_designInputs = function () {
|
|
24
|
+
return data;
|
|
25
|
+
};
|
|
26
|
+
return data;
|
|
27
|
+
}
|
|
28
|
+
function _componentFilters() {
|
|
29
|
+
const data = require("@teambit/component.filters.base-filter");
|
|
30
|
+
_componentFilters = function () {
|
|
31
|
+
return data;
|
|
32
|
+
};
|
|
33
|
+
return data;
|
|
34
|
+
}
|
|
35
|
+
function _workspaceOverviewModule() {
|
|
36
|
+
const data = _interopRequireDefault(require("./workspace-overview.module.scss"));
|
|
37
|
+
_workspaceOverviewModule = function () {
|
|
38
|
+
return data;
|
|
39
|
+
};
|
|
40
|
+
return data;
|
|
41
|
+
}
|
|
42
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
43
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
44
|
+
const LABELS = {
|
|
45
|
+
namespaces: 'Namespaces',
|
|
46
|
+
scopes: 'Scopes',
|
|
47
|
+
none: 'None'
|
|
48
|
+
};
|
|
49
|
+
function WorkspaceFilterPanel({
|
|
50
|
+
aggregation,
|
|
51
|
+
availableAggregations,
|
|
52
|
+
items
|
|
53
|
+
}) {
|
|
54
|
+
const [searchParams, setSearchParams] = (0, _reactRouterDom().useSearchParams)();
|
|
55
|
+
const namespaceOptions = (0, _react().useMemo)(() => [...new Set(items.map(i => i.component.id.namespace || '/'))].map(v => ({
|
|
56
|
+
value: v
|
|
57
|
+
})), [items]);
|
|
58
|
+
const scopeOptions = (0, _react().useMemo)(() => [...new Set(items.map(i => i.component.id.scope))].map(v => ({
|
|
59
|
+
value: v
|
|
60
|
+
})), [items]);
|
|
61
|
+
const activeNamespaces = (searchParams.get('ns') || '').split(',').filter(Boolean).map(v => ({
|
|
62
|
+
value: v
|
|
63
|
+
}));
|
|
64
|
+
const activeScopes = (searchParams.get('scopes') || '').split(',').filter(Boolean).map(v => ({
|
|
65
|
+
value: v
|
|
66
|
+
}));
|
|
67
|
+
const applyNs = opts => {
|
|
68
|
+
const list = opts.map(o => o.value).filter(v => typeof v === 'string');
|
|
69
|
+
if (list.length) searchParams.set('ns', list.join(','));else searchParams.delete('ns');
|
|
70
|
+
setSearchParams(searchParams);
|
|
71
|
+
};
|
|
72
|
+
const applyScopes = opts => {
|
|
73
|
+
const list = opts.map(o => o.value).filter(v => typeof v === 'string');
|
|
74
|
+
if (list.length) searchParams.set('scopes', list.join(','));else searchParams.delete('scopes');
|
|
75
|
+
setSearchParams(searchParams);
|
|
76
|
+
};
|
|
77
|
+
const currentIndex = Math.max(0, availableAggregations.findIndex(a => a === aggregation));
|
|
78
|
+
const applyAgg = i => {
|
|
79
|
+
const agg = availableAggregations[i];
|
|
80
|
+
searchParams.set('aggregation', agg);
|
|
81
|
+
setSearchParams(searchParams);
|
|
82
|
+
};
|
|
83
|
+
return /*#__PURE__*/_react().default.createElement("div", {
|
|
84
|
+
className: _workspaceOverviewModule().default.filterPanel
|
|
85
|
+
}, /*#__PURE__*/_react().default.createElement("div", {
|
|
86
|
+
className: _workspaceOverviewModule().default.leftFilters
|
|
87
|
+
}, /*#__PURE__*/_react().default.createElement(_componentFilters().BaseFilter, {
|
|
88
|
+
id: "namespaces",
|
|
89
|
+
placeholder: "Namespaces",
|
|
90
|
+
options: namespaceOptions,
|
|
91
|
+
activeOptions: activeNamespaces,
|
|
92
|
+
onChange: applyNs,
|
|
93
|
+
isSearchable: true
|
|
94
|
+
}), /*#__PURE__*/_react().default.createElement(_componentFilters().BaseFilter, {
|
|
95
|
+
id: "scopes",
|
|
96
|
+
placeholder: "Scopes",
|
|
97
|
+
options: scopeOptions,
|
|
98
|
+
activeOptions: activeScopes,
|
|
99
|
+
onChange: applyScopes,
|
|
100
|
+
isSearchable: true
|
|
101
|
+
})), /*#__PURE__*/_react().default.createElement("div", {
|
|
102
|
+
className: _workspaceOverviewModule().default.rightAggToggle
|
|
103
|
+
}, /*#__PURE__*/_react().default.createElement(_designInputs().ToggleButton, {
|
|
104
|
+
defaultIndex: currentIndex,
|
|
105
|
+
onOptionSelect: idx => applyAgg(idx),
|
|
106
|
+
options: availableAggregations.map(agg => ({
|
|
107
|
+
value: agg,
|
|
108
|
+
element: LABELS[agg]
|
|
109
|
+
}))
|
|
110
|
+
})));
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
//# sourceMappingURL=workspace-filter-panel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","data","_interopRequireWildcard","require","_reactRouterDom","_designInputs","_componentFilters","_workspaceOverviewModule","_interopRequireDefault","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","LABELS","namespaces","scopes","none","WorkspaceFilterPanel","aggregation","availableAggregations","items","searchParams","setSearchParams","useSearchParams","namespaceOptions","useMemo","Set","map","component","id","namespace","v","value","scopeOptions","scope","activeNamespaces","split","filter","Boolean","activeScopes","applyNs","opts","list","length","join","delete","applyScopes","currentIndex","Math","max","findIndex","a","applyAgg","agg","createElement","className","styles","filterPanel","leftFilters","BaseFilter","placeholder","options","activeOptions","onChange","isSearchable","rightAggToggle","ToggleButton","defaultIndex","onOptionSelect","idx","element"],"sources":["workspace-filter-panel.tsx"],"sourcesContent":["import React, { useMemo } from 'react';\nimport { useSearchParams } from 'react-router-dom';\nimport { ToggleButton } from '@teambit/design.inputs.toggle-button';\nimport { BaseFilter } from '@teambit/component.filters.base-filter';\nimport type { WorkspaceItem, AggregationType } from './workspace-overview.types';\nimport styles from './workspace-overview.module.scss';\n\nexport interface WorkspaceFilterPanelProps {\n aggregation: AggregationType;\n availableAggregations: AggregationType[];\n items: WorkspaceItem[];\n}\n\nconst LABELS: Record<AggregationType, string> = {\n namespaces: 'Namespaces',\n scopes: 'Scopes',\n none: 'None',\n};\n\nexport function WorkspaceFilterPanel({ aggregation, availableAggregations, items }: WorkspaceFilterPanelProps) {\n const [searchParams, setSearchParams] = useSearchParams();\n\n const namespaceOptions = useMemo(\n () =>\n [...new Set(items.map((i) => i.component.id.namespace || '/'))].map((v) => ({\n value: v,\n })),\n [items]\n );\n\n const scopeOptions = useMemo(\n () =>\n [...new Set(items.map((i) => i.component.id.scope))].map((v) => ({\n value: v,\n })),\n [items]\n );\n\n const activeNamespaces = (searchParams.get('ns') || '')\n .split(',')\n .filter(Boolean)\n .map((v) => ({ value: v }));\n\n const activeScopes = (searchParams.get('scopes') || '')\n .split(',')\n .filter(Boolean)\n .map((v) => ({ value: v }));\n\n const applyNs = (opts) => {\n const list = opts.map((o) => o.value).filter((v): v is string => typeof v === 'string');\n\n if (list.length) searchParams.set('ns', list.join(','));\n else searchParams.delete('ns');\n\n setSearchParams(searchParams);\n };\n\n const applyScopes = (opts) => {\n const list = opts.map((o) => o.value).filter((v): v is string => typeof v === 'string');\n\n if (list.length) searchParams.set('scopes', list.join(','));\n else searchParams.delete('scopes');\n\n setSearchParams(searchParams);\n };\n\n const currentIndex = Math.max(\n 0,\n availableAggregations.findIndex((a) => a === aggregation)\n );\n\n const applyAgg = (i: number) => {\n const agg = availableAggregations[i];\n searchParams.set('aggregation', agg);\n setSearchParams(searchParams);\n };\n\n return (\n <div className={styles.filterPanel}>\n <div className={styles.leftFilters}>\n <BaseFilter\n id=\"namespaces\"\n placeholder=\"Namespaces\"\n options={namespaceOptions}\n activeOptions={activeNamespaces}\n onChange={applyNs}\n isSearchable\n />\n\n <BaseFilter\n id=\"scopes\"\n placeholder=\"Scopes\"\n options={scopeOptions}\n activeOptions={activeScopes}\n onChange={applyScopes}\n isSearchable\n />\n </div>\n\n <div className={styles.rightAggToggle}>\n <ToggleButton\n defaultIndex={currentIndex}\n onOptionSelect={(idx) => applyAgg(idx)}\n options={availableAggregations.map((agg) => ({\n value: agg,\n element: LABELS[agg],\n }))}\n />\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,uBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,gBAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,eAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,cAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,aAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,kBAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,iBAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAM,yBAAA;EAAA,MAAAN,IAAA,GAAAO,sBAAA,CAAAL,OAAA;EAAAI,wBAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAsD,SAAAO,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UA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iBAAA,GAAAoE,UAAU;IACT9B,EAAE,EAAC,YAAY;IACf+B,WAAW,EAAC,YAAY;IACxBC,OAAO,EAAErC,gBAAiB;IAC1BsC,aAAa,EAAE3B,gBAAiB;IAChC4B,QAAQ,EAAEvB,OAAQ;IAClBwB,YAAY;EAAA,CACb,CAAC,eAEF/E,MAAA,GAAAW,OAAA,CAAA0D,aAAA,CAAC/D,iBAAA,GAAAoE,UAAU;IACT9B,EAAE,EAAC,QAAQ;IACX+B,WAAW,EAAC,QAAQ;IACpBC,OAAO,EAAE5B,YAAa;IACtB6B,aAAa,EAAEvB,YAAa;IAC5BwB,QAAQ,EAAEjB,WAAY;IACtBkB,YAAY;EAAA,CACb,CACE,CAAC,eAEN/E,MAAA,GAAAW,OAAA,CAAA0D,aAAA;IAAKC,SAAS,EAAEC,kCAAM,CAACS;EAAe,gBACpChF,MAAA,GAAAW,OAAA,CAAA0D,aAAA,CAAChE,aAAA,GAAA4E,YAAY;IACXC,YAAY,EAAEpB,YAAa;IAC3BqB,cAAc,EAAGC,GAAG,IAAKjB,QAAQ,CAACiB,GAAG,CAAE;IACvCR,OAAO,EAAE1C,qBAAqB,CAACQ,GAAG,CAAE0B,GAAG,KAAM;MAC3CrB,KAAK,EAAEqB,GAAG;MACViB,OAAO,EAAEzD,MAAM,CAACwC,GAAG;IACrB,CAAC,CAAC;EAAE,CACL,CACE,CACF,CAAC;AAEV","ignoreList":[]}
|
|
@@ -47,9 +47,9 @@ function _componentId() {
|
|
|
47
47
|
};
|
|
48
48
|
return data;
|
|
49
49
|
}
|
|
50
|
-
function
|
|
51
|
-
const data = require("
|
|
52
|
-
|
|
50
|
+
function _lodash() {
|
|
51
|
+
const data = _interopRequireDefault(require("lodash.compact"));
|
|
52
|
+
_lodash = function () {
|
|
53
53
|
return data;
|
|
54
54
|
};
|
|
55
55
|
return data;
|
|
@@ -61,9 +61,16 @@ function _scopes() {
|
|
|
61
61
|
};
|
|
62
62
|
return data;
|
|
63
63
|
}
|
|
64
|
-
function
|
|
65
|
-
const data = require("
|
|
66
|
-
|
|
64
|
+
function _cloudHooks() {
|
|
65
|
+
const data = require("@teambit/cloud.hooks.use-cloud-scopes");
|
|
66
|
+
_cloudHooks = function () {
|
|
67
|
+
return data;
|
|
68
|
+
};
|
|
69
|
+
return data;
|
|
70
|
+
}
|
|
71
|
+
function _reactRouterDom() {
|
|
72
|
+
const data = require("react-router-dom");
|
|
73
|
+
_reactRouterDom = function () {
|
|
67
74
|
return data;
|
|
68
75
|
};
|
|
69
76
|
return data;
|
|
@@ -82,16 +89,16 @@ function _workspaceUi3() {
|
|
|
82
89
|
};
|
|
83
90
|
return data;
|
|
84
91
|
}
|
|
85
|
-
function
|
|
86
|
-
const data = require("
|
|
87
|
-
|
|
92
|
+
function _designUi2() {
|
|
93
|
+
const data = require("@teambit/design.ui.heading");
|
|
94
|
+
_designUi2 = function () {
|
|
88
95
|
return data;
|
|
89
96
|
};
|
|
90
97
|
return data;
|
|
91
98
|
}
|
|
92
|
-
function
|
|
93
|
-
const data =
|
|
94
|
-
|
|
99
|
+
function _workspaceContext() {
|
|
100
|
+
const data = require("../workspace-context");
|
|
101
|
+
_workspaceContext = function () {
|
|
95
102
|
return data;
|
|
96
103
|
};
|
|
97
104
|
return data;
|
|
@@ -103,64 +110,99 @@ function _linkPlugin() {
|
|
|
103
110
|
};
|
|
104
111
|
return data;
|
|
105
112
|
}
|
|
113
|
+
function _useWorkspaceAggregation() {
|
|
114
|
+
const data = require("./use-workspace-aggregation");
|
|
115
|
+
_useWorkspaceAggregation = function () {
|
|
116
|
+
return data;
|
|
117
|
+
};
|
|
118
|
+
return data;
|
|
119
|
+
}
|
|
120
|
+
function _workspaceFilterPanel() {
|
|
121
|
+
const data = require("./workspace-filter-panel");
|
|
122
|
+
_workspaceFilterPanel = function () {
|
|
123
|
+
return data;
|
|
124
|
+
};
|
|
125
|
+
return data;
|
|
126
|
+
}
|
|
127
|
+
function _workspaceOverviewModule() {
|
|
128
|
+
const data = _interopRequireDefault(require("./workspace-overview.module.scss"));
|
|
129
|
+
_workspaceOverviewModule = function () {
|
|
130
|
+
return data;
|
|
131
|
+
};
|
|
132
|
+
return data;
|
|
133
|
+
}
|
|
106
134
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
107
135
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
108
136
|
function WorkspaceOverview() {
|
|
109
137
|
const workspace = (0, _react().useContext)(_workspaceContext().WorkspaceContext);
|
|
110
|
-
const {
|
|
111
|
-
isMinimal
|
|
112
|
-
} = (0, _workspaceUi3().useWorkspaceMode)();
|
|
113
|
-
const compModelsById = new Map(workspace.components.map(comp => [comp.id.toString(), comp]));
|
|
114
138
|
const {
|
|
115
139
|
components,
|
|
116
140
|
componentDescriptors
|
|
117
141
|
} = workspace;
|
|
118
|
-
|
|
119
|
-
const uniqueScopesArr = Array.from(uniqueScopes);
|
|
120
|
-
const {
|
|
121
|
-
cloudScopes = []
|
|
122
|
-
} = (0, _cloudHooks().useCloudScopes)(uniqueScopesArr);
|
|
123
|
-
const cloudScopesById = new Map(cloudScopes.map(scope => [scope.id.toString(), scope]));
|
|
124
|
-
const plugins = useCardPlugins({
|
|
125
|
-
compModelsById,
|
|
126
|
-
showPreview: isMinimal
|
|
127
|
-
});
|
|
128
|
-
if (!components || components.length === 0) return /*#__PURE__*/_react().default.createElement(_workspaceUi().EmptyWorkspace, {
|
|
142
|
+
if (!components.length) return /*#__PURE__*/_react().default.createElement(_workspaceUi().EmptyWorkspace, {
|
|
129
143
|
name: workspace.name
|
|
130
144
|
});
|
|
131
|
-
const
|
|
132
|
-
|
|
145
|
+
const {
|
|
146
|
+
isMinimal
|
|
147
|
+
} = (0, _workspaceUi3().useWorkspaceMode)();
|
|
148
|
+
const compModelsById = (0, _react().useMemo)(() => new Map(components.map(c => [c.id.toString(), c])), [components]);
|
|
149
|
+
const uniqueScopes = [...new Set(components.map(c => c.id.scope))];
|
|
150
|
+
const {
|
|
151
|
+
cloudScopes
|
|
152
|
+
} = (0, _cloudHooks().useCloudScopes)(uniqueScopes);
|
|
153
|
+
const cloudMap = new Map((cloudScopes || []).map(s => [s.id.toString(), s]));
|
|
154
|
+
const compDescriptorMap = new Map(componentDescriptors.map(d => [d.id.toString(), d]));
|
|
155
|
+
const items = (0, _lodash().default)(components.map(component => {
|
|
133
156
|
if (component.deprecation?.isDeprecate) return null;
|
|
134
|
-
const
|
|
135
|
-
if (!
|
|
136
|
-
const cloudScope =
|
|
157
|
+
const descriptor = compDescriptorMap.get(component.id.toString());
|
|
158
|
+
if (!descriptor) return null;
|
|
159
|
+
const cloudScope = cloudMap.get(component.id.scope);
|
|
137
160
|
const scope = cloudScope || _scopes().ScopeID.isValid(component.id.scope) && {
|
|
138
161
|
id: _scopes().ScopeID.fromString(component.id.scope)
|
|
139
162
|
} || undefined;
|
|
140
163
|
return {
|
|
141
164
|
component,
|
|
142
|
-
componentDescriptor,
|
|
143
|
-
scope
|
|
165
|
+
componentDescriptor: descriptor,
|
|
166
|
+
scope: scope && {
|
|
167
|
+
id: scope.id
|
|
168
|
+
} || undefined
|
|
144
169
|
};
|
|
145
170
|
}));
|
|
171
|
+
const [searchParams] = (0, _reactRouterDom().useSearchParams)();
|
|
172
|
+
const aggregation = searchParams.get('aggregation') || 'namespaces';
|
|
173
|
+
const {
|
|
174
|
+
groups,
|
|
175
|
+
groupType,
|
|
176
|
+
availableAggregations,
|
|
177
|
+
filteredCount
|
|
178
|
+
} = (0, _useWorkspaceAggregation().useWorkspaceAggregation)(items, aggregation);
|
|
179
|
+
const plugins = useCardPlugins({
|
|
180
|
+
compModelsById,
|
|
181
|
+
showPreview: isMinimal
|
|
182
|
+
});
|
|
146
183
|
return /*#__PURE__*/_react().default.createElement("div", {
|
|
147
184
|
className: _workspaceOverviewModule().default.container
|
|
148
|
-
}, /*#__PURE__*/_react().default.createElement(
|
|
185
|
+
}, /*#__PURE__*/_react().default.createElement(_workspaceFilterPanel().WorkspaceFilterPanel, {
|
|
186
|
+
aggregation: aggregation,
|
|
187
|
+
availableAggregations: availableAggregations,
|
|
188
|
+
items: items
|
|
189
|
+
}), filteredCount === 0 && /*#__PURE__*/_react().default.createElement(_workspaceUi().EmptyWorkspace, {
|
|
190
|
+
name: workspace.name
|
|
191
|
+
}), groups.map(group => /*#__PURE__*/_react().default.createElement("section", {
|
|
192
|
+
key: group.name,
|
|
193
|
+
className: _workspaceOverviewModule().default.agg
|
|
194
|
+
}, groupType !== 'none' && /*#__PURE__*/_react().default.createElement(_designUi2().H3, {
|
|
195
|
+
className: _workspaceOverviewModule().default.aggregationTitle
|
|
196
|
+
}, group.displayName), /*#__PURE__*/_react().default.createElement(_explorerUiGallery().ComponentGrid, {
|
|
149
197
|
className: _workspaceOverviewModule().default.cardGrid
|
|
150
|
-
},
|
|
151
|
-
component,
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
component: component,
|
|
159
|
-
plugins: plugins,
|
|
160
|
-
scope: scope,
|
|
161
|
-
shouldShowPreviewState: isMinimal
|
|
162
|
-
});
|
|
163
|
-
})));
|
|
198
|
+
}, group.items.map(item => /*#__PURE__*/_react().default.createElement(_workspaceUi2().WorkspaceComponentCard, {
|
|
199
|
+
key: item.component.id.toString(),
|
|
200
|
+
component: item.component,
|
|
201
|
+
componentDescriptor: item.componentDescriptor,
|
|
202
|
+
scope: item.scope,
|
|
203
|
+
plugins: plugins,
|
|
204
|
+
shouldShowPreviewState: isMinimal
|
|
205
|
+
}))))));
|
|
164
206
|
}
|
|
165
207
|
function useCardPlugins({
|
|
166
208
|
compModelsById,
|