@teambit/workspace 1.0.1079 → 1.0.1081
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-1785260578779.js → preview-1785278532531.js} +2 -2
- package/dist/ui/workspace/use-workspace.js +179 -27
- package/dist/ui/workspace/use-workspace.js.map +1 -1
- package/dist/ui/workspace/workspace-overview/index.d.ts +1 -1
- package/dist/ui/workspace/workspace-overview/index.js +5 -5
- package/dist/ui/workspace/workspace-overview/index.js.map +1 -1
- package/dist/ui/workspace/workspace-overview/workspace-overview.js +13 -143
- package/dist/ui/workspace/workspace-overview/workspace-overview.js.map +1 -1
- package/dist/ui/workspace/workspace-skeleton.d.ts +8 -0
- package/dist/ui/workspace/workspace-skeleton.js +73 -0
- package/dist/ui/workspace/workspace-skeleton.js.map +1 -0
- package/dist/ui/workspace/workspace-skeleton.module.scss +102 -0
- package/dist/ui/workspace/workspace.js +23 -7
- package/dist/ui/workspace/workspace.js.map +1 -1
- package/package.json +65 -74
- package/ui/workspace/use-workspace.ts +185 -27
- package/ui/workspace/workspace-overview/index.ts +1 -1
- package/ui/workspace/workspace-overview/workspace-overview.tsx +9 -102
- package/ui/workspace/workspace-skeleton.module.scss +102 -0
- package/ui/workspace/workspace-skeleton.tsx +35 -0
- package/ui/workspace/workspace.tsx +16 -5
- package/dist/ui/workspace/workspace-overview/card-overlays.d.ts +0 -5
- package/dist/ui/workspace/workspace-overview/card-overlays.js +0 -133
- package/dist/ui/workspace/workspace-overview/card-overlays.js.map +0 -1
- package/dist/ui/workspace/workspace-overview/card-overlays.module.scss +0 -72
- package/dist/ui/workspace/workspace-overview/filter-utils.d.ts +0 -10
- package/dist/ui/workspace/workspace-overview/filter-utils.js +0 -40
- package/dist/ui/workspace/workspace-overview/filter-utils.js.map +0 -1
- package/dist/ui/workspace/workspace-overview/hope-component-card.d.ts +0 -15
- package/dist/ui/workspace/workspace-overview/hope-component-card.js +0 -186
- package/dist/ui/workspace/workspace-overview/hope-component-card.js.map +0 -1
- package/dist/ui/workspace/workspace-overview/hope-component-card.module.scss +0 -169
- package/dist/ui/workspace/workspace-overview/link-plugin.d.ts +0 -3
- package/dist/ui/workspace/workspace-overview/link-plugin.js +0 -14
- package/dist/ui/workspace/workspace-overview/link-plugin.js.map +0 -1
- package/dist/ui/workspace/workspace-overview/namespace-header.d.ts +0 -9
- package/dist/ui/workspace/workspace-overview/namespace-header.js +0 -107
- package/dist/ui/workspace/workspace-overview/namespace-header.js.map +0 -1
- package/dist/ui/workspace/workspace-overview/namespace-header.module.scss +0 -88
- package/dist/ui/workspace/workspace-overview/namespace-sort.d.ts +0 -8
- package/dist/ui/workspace/workspace-overview/namespace-sort.js +0 -47
- package/dist/ui/workspace/workspace-overview/namespace-sort.js.map +0 -1
- package/dist/ui/workspace/workspace-overview/scope-sort.d.ts +0 -1
- package/dist/ui/workspace/workspace-overview/scope-sort.js +0 -14
- package/dist/ui/workspace/workspace-overview/scope-sort.js.map +0 -1
- package/dist/ui/workspace/workspace-overview/use-query-param-with-default.d.ts +0 -6
- package/dist/ui/workspace/workspace-overview/use-query-param-with-default.js +0 -102
- package/dist/ui/workspace/workspace-overview/use-query-param-with-default.js.map +0 -1
- package/dist/ui/workspace/workspace-overview/use-workspace-aggregation.d.ts +0 -3
- package/dist/ui/workspace/workspace-overview/use-workspace-aggregation.js +0 -88
- package/dist/ui/workspace/workspace-overview/use-workspace-aggregation.js.map +0 -1
- package/dist/ui/workspace/workspace-overview/workspace-filter-panel.d.ts +0 -13
- package/dist/ui/workspace/workspace-overview/workspace-filter-panel.js +0 -110
- package/dist/ui/workspace/workspace-overview/workspace-filter-panel.js.map +0 -1
- package/dist/ui/workspace/workspace-overview/workspace-overview.module.scss +0 -91
- package/dist/ui/workspace/workspace-overview/workspace-overview.sort.d.ts +0 -1
- package/dist/ui/workspace/workspace-overview/workspace-overview.sort.js +0 -30
- package/dist/ui/workspace/workspace-overview/workspace-overview.sort.js.map +0 -1
- package/dist/ui/workspace/workspace-overview/workspace-overview.types.d.ts +0 -28
- package/dist/ui/workspace/workspace-overview/workspace-overview.types.js +0 -3
- package/dist/ui/workspace/workspace-overview/workspace-overview.types.js.map +0 -1
- package/ui/workspace/workspace-overview/card-overlays.module.scss +0 -72
- package/ui/workspace/workspace-overview/card-overlays.tsx +0 -66
- package/ui/workspace/workspace-overview/filter-utils.ts +0 -42
- package/ui/workspace/workspace-overview/hope-component-card.module.scss +0 -169
- package/ui/workspace/workspace-overview/hope-component-card.tsx +0 -152
- package/ui/workspace/workspace-overview/link-plugin.ts +0 -5
- package/ui/workspace/workspace-overview/namespace-header.module.scss +0 -88
- package/ui/workspace/workspace-overview/namespace-header.tsx +0 -72
- package/ui/workspace/workspace-overview/namespace-sort.ts +0 -44
- package/ui/workspace/workspace-overview/scope-sort.ts +0 -9
- package/ui/workspace/workspace-overview/use-query-param-with-default.ts +0 -115
- package/ui/workspace/workspace-overview/use-workspace-aggregation.ts +0 -79
- package/ui/workspace/workspace-overview/workspace-filter-panel.tsx +0 -109
- package/ui/workspace/workspace-overview/workspace-overview.module.scss +0 -91
- package/ui/workspace/workspace-overview/workspace-overview.sort.ts +0 -29
- package/ui/workspace/workspace-overview/workspace-overview.types.ts +0 -30
|
@@ -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.1081/dist/workspace.composition.js';
|
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.workspace_workspace@1.0.1081/dist/workspace.docs.mdx';
|
|
3
3
|
|
|
4
4
|
export const compositions = [compositions_0];
|
|
5
5
|
export const overview = [overview_0];
|
|
@@ -53,7 +53,7 @@ function _workspaceModel() {
|
|
|
53
53
|
};
|
|
54
54
|
return data;
|
|
55
55
|
}
|
|
56
|
-
const _excluded = ["data", "previousData", "subscribeToMore"];
|
|
56
|
+
const _excluded = ["data", "previousData", "subscribeToMore", "loading"];
|
|
57
57
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
58
58
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
59
59
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -62,8 +62,15 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
62
62
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
63
63
|
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
64
64
|
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
/**
|
|
66
|
+
* Cheap, card-renderable fields only. Everything here resolves from already-loaded component
|
|
67
|
+
* metadata (id, env, aspects, compositions, preview, deprecation, server, buildStatus, description),
|
|
68
|
+
* so the light query returns fast and the grid can paint immediately. The two expensive async
|
|
69
|
+
* resolvers — `status` (getStatus(): git/scope compare) and `issuesCount` (getIssues(): dependency
|
|
70
|
+
* analysis) — are deliberately omitted here and fetched separately by `wcComponentDetailFields`.
|
|
71
|
+
*/
|
|
72
|
+
const wcComponentFieldsLight = (0, _client().gql)`
|
|
73
|
+
fragment wcComponentFieldsLight on Component {
|
|
67
74
|
id {
|
|
68
75
|
name
|
|
69
76
|
version
|
|
@@ -80,18 +87,6 @@ const wcComponentFields = (0, _client().gql)`
|
|
|
80
87
|
identifier
|
|
81
88
|
}
|
|
82
89
|
description
|
|
83
|
-
issuesCount
|
|
84
|
-
status {
|
|
85
|
-
isOutdated
|
|
86
|
-
isNew
|
|
87
|
-
isInScope
|
|
88
|
-
isStaged
|
|
89
|
-
modifyInfo {
|
|
90
|
-
hasModifiedFiles
|
|
91
|
-
hasModifiedDependencies
|
|
92
|
-
}
|
|
93
|
-
isDeleted
|
|
94
|
-
}
|
|
95
90
|
buildStatus
|
|
96
91
|
preview {
|
|
97
92
|
includesEnvTemplate
|
|
@@ -114,38 +109,98 @@ const wcComponentFields = (0, _client().gql)`
|
|
|
114
109
|
}
|
|
115
110
|
}
|
|
116
111
|
`;
|
|
117
|
-
|
|
118
|
-
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* The expensive per-component fields, split out so they never block first paint. These drive the
|
|
115
|
+
* status pills (changed/building) and the issues badge, both of which gracefully degrade to a
|
|
116
|
+
* neutral "built" / no-issues state until this query resolves.
|
|
117
|
+
*/
|
|
118
|
+
const wcComponentDetailFields = (0, _client().gql)`
|
|
119
|
+
fragment wcComponentDetailFields on Component {
|
|
120
|
+
id {
|
|
121
|
+
name
|
|
122
|
+
version
|
|
123
|
+
scope
|
|
124
|
+
}
|
|
125
|
+
issuesCount
|
|
126
|
+
status {
|
|
127
|
+
isOutdated
|
|
128
|
+
isNew
|
|
129
|
+
isInScope
|
|
130
|
+
isStaged
|
|
131
|
+
modifyInfo {
|
|
132
|
+
hasModifiedFiles
|
|
133
|
+
hasModifiedDependencies
|
|
134
|
+
}
|
|
135
|
+
isDeleted
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
`;
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Full per-component shape (light + detail). Used by the subscriptions: a single added/changed
|
|
142
|
+
* component is cheap to fully resolve, so live updates always carry fresh status.
|
|
143
|
+
*/
|
|
144
|
+
const wcComponentFieldsFull = (0, _client().gql)`
|
|
145
|
+
fragment wcComponentFieldsFull on Component {
|
|
146
|
+
...wcComponentFieldsLight
|
|
147
|
+
...wcComponentDetailFields
|
|
148
|
+
}
|
|
149
|
+
${wcComponentFieldsLight}
|
|
150
|
+
${wcComponentDetailFields}
|
|
151
|
+
`;
|
|
152
|
+
const WORKSPACE_LIGHT = (0, _client().gql)`
|
|
153
|
+
query workspaceLight {
|
|
119
154
|
workspace {
|
|
120
155
|
name
|
|
121
156
|
path
|
|
122
157
|
icon
|
|
123
158
|
components {
|
|
124
|
-
...
|
|
159
|
+
...wcComponentFieldsLight
|
|
125
160
|
}
|
|
126
161
|
}
|
|
127
162
|
}
|
|
128
|
-
${
|
|
163
|
+
${wcComponentFieldsLight}
|
|
129
164
|
`;
|
|
165
|
+
|
|
166
|
+
// The detail fields are fetched one page at a time via the existing `components(offset, limit)`
|
|
167
|
+
// resolver. getStatus()/getIssues() are synchronous CPU work; fetching all 204 at once blocks the
|
|
168
|
+
// server's event loop for ~5s straight (a navigation query issued during that window waited ~10s).
|
|
169
|
+
// Paging it lets the loop breathe between chunks — measured ping latency dropped from ~10s to ~0.3s.
|
|
170
|
+
const WORKSPACE_DETAILS_PAGE = (0, _client().gql)`
|
|
171
|
+
query workspaceDetailsPage($offset: Int!, $limit: Int!) {
|
|
172
|
+
workspace {
|
|
173
|
+
components(offset: $offset, limit: $limit) {
|
|
174
|
+
...wcComponentDetailFields
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
${wcComponentDetailFields}
|
|
179
|
+
`;
|
|
180
|
+
|
|
181
|
+
// Small pages keep any single server-blocking burst under ~350ms; the gap yields the event loop so
|
|
182
|
+
// other requests (navigation, lanes) are serviced promptly between pages.
|
|
183
|
+
const DETAIL_CHUNK_SIZE = 15;
|
|
184
|
+
const DETAIL_CHUNK_GAP_MS = 60;
|
|
130
185
|
const COMPONENT_SUBSCRIPTION_ADDED = (0, _client().gql)`
|
|
131
186
|
subscription OnComponentAdded {
|
|
132
187
|
componentAdded {
|
|
133
188
|
component {
|
|
134
|
-
...
|
|
189
|
+
...wcComponentFieldsFull
|
|
135
190
|
}
|
|
136
191
|
}
|
|
137
192
|
}
|
|
138
|
-
${
|
|
193
|
+
${wcComponentFieldsFull}
|
|
139
194
|
`;
|
|
140
195
|
const COMPONENT_SUBSCRIPTION_CHANGED = (0, _client().gql)`
|
|
141
196
|
subscription OnComponentChanged {
|
|
142
197
|
componentChanged {
|
|
143
198
|
component {
|
|
144
|
-
...
|
|
199
|
+
...wcComponentFieldsFull
|
|
145
200
|
}
|
|
146
201
|
}
|
|
147
202
|
}
|
|
148
|
-
${
|
|
203
|
+
${wcComponentFieldsFull}
|
|
149
204
|
`;
|
|
150
205
|
const COMPONENT_SUBSCRIPTION_REMOVED = (0, _client().gql)`
|
|
151
206
|
subscription OnComponentRemoved {
|
|
@@ -168,16 +223,94 @@ const COMPONENT_SERVER_STARTED = (0, _client().gql)`
|
|
|
168
223
|
}
|
|
169
224
|
}
|
|
170
225
|
`;
|
|
226
|
+
function componentKey(id) {
|
|
227
|
+
return `${id.scope}/${id.name}@${id.version}`;
|
|
228
|
+
}
|
|
171
229
|
function useWorkspace(options = {}) {
|
|
230
|
+
// Light query drives first paint. cache-and-network so a revisit paints instantly from cache,
|
|
231
|
+
// then refreshes in the background (the workspace host otherwise defaults to network-only).
|
|
172
232
|
// `previousData` is destructured out (not spread into `...rest`) so the returned shape matches
|
|
173
233
|
// UseWorkspaceResult, which omits it (along with `data`, replaced by `workspace`).
|
|
174
|
-
const _useDataQuery = (0, _uiFoundationUiHooks().useDataQuery)(
|
|
234
|
+
const _useDataQuery = (0, _uiFoundationUiHooks().useDataQuery)(WORKSPACE_LIGHT, {
|
|
235
|
+
fetchPolicy: 'cache-and-network'
|
|
236
|
+
}),
|
|
175
237
|
{
|
|
176
238
|
data,
|
|
177
239
|
previousData: _previousData,
|
|
178
|
-
subscribeToMore
|
|
240
|
+
subscribeToMore,
|
|
241
|
+
loading
|
|
179
242
|
} = _useDataQuery,
|
|
180
243
|
rest = _objectWithoutProperties(_useDataQuery, _excluded);
|
|
244
|
+
|
|
245
|
+
// CRITICAL: the detail data (status + issuesCount) is NOT fetched in parallel with the light query.
|
|
246
|
+
// getStatus()/getIssues() are synchronous CPU work that monopolizes the server's single-threaded
|
|
247
|
+
// event loop for several seconds on large workspaces; running it concurrently would stall the light
|
|
248
|
+
// query behind it (measured: light alone ~10ms, but ~5s when racing the detail query) and the grid
|
|
249
|
+
// would never paint early. So we wait for the light data to arrive AND for the browser to go idle
|
|
250
|
+
// (i.e. the grid has painted) before kicking off the (chunked) detail fetch in the background.
|
|
251
|
+
const [detailEnabled, setDetailEnabled] = (0, _react().useState)(false);
|
|
252
|
+
const lightDataReady = Boolean(data?.workspace);
|
|
253
|
+
const totalComponents = data?.workspace?.components?.length ?? 0;
|
|
254
|
+
(0, _react().useEffect)(() => {
|
|
255
|
+
if (!lightDataReady || detailEnabled || typeof window === 'undefined') return undefined;
|
|
256
|
+
const enable = () => setDetailEnabled(true);
|
|
257
|
+
const ric = window.requestIdleCallback;
|
|
258
|
+
if (ric) {
|
|
259
|
+
const handle = ric(enable, {
|
|
260
|
+
timeout: 1000
|
|
261
|
+
});
|
|
262
|
+
return () => window.cancelIdleCallback?.(handle);
|
|
263
|
+
}
|
|
264
|
+
const handle = window.setTimeout(enable, 200);
|
|
265
|
+
return () => window.clearTimeout(handle);
|
|
266
|
+
}, [lightDataReady, detailEnabled]);
|
|
267
|
+
|
|
268
|
+
// Detail (status + issuesCount) is paged in once the grid has painted, with a yield between pages
|
|
269
|
+
// so the server stays responsive. Results accumulate by component key and merge in progressively —
|
|
270
|
+
// status pills and issue counts fill in chunk by chunk rather than all-or-nothing after ~5s.
|
|
271
|
+
const client = (0, _client().useApolloClient)();
|
|
272
|
+
const [detailByKey, setDetailByKey] = (0, _react().useState)(new Map());
|
|
273
|
+
(0, _react().useEffect)(() => {
|
|
274
|
+
if (!detailEnabled || !totalComponents) return undefined;
|
|
275
|
+
let cancelled = false;
|
|
276
|
+
(async () => {
|
|
277
|
+
for (let offset = 0; offset < totalComponents; offset += DETAIL_CHUNK_SIZE) {
|
|
278
|
+
if (cancelled) return;
|
|
279
|
+
try {
|
|
280
|
+
const res = await client.query({
|
|
281
|
+
query: WORKSPACE_DETAILS_PAGE,
|
|
282
|
+
variables: {
|
|
283
|
+
offset,
|
|
284
|
+
limit: DETAIL_CHUNK_SIZE
|
|
285
|
+
},
|
|
286
|
+
fetchPolicy: 'network-only'
|
|
287
|
+
});
|
|
288
|
+
if (cancelled) return;
|
|
289
|
+
const comps = res.data?.workspace?.components ?? [];
|
|
290
|
+
if (comps.length) {
|
|
291
|
+
setDetailByKey(prev => {
|
|
292
|
+
const next = new Map(prev);
|
|
293
|
+
for (const c of comps) next.set(componentKey(c.id), {
|
|
294
|
+
status: c.status,
|
|
295
|
+
issuesCount: c.issuesCount
|
|
296
|
+
});
|
|
297
|
+
return next;
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
} catch {
|
|
301
|
+
// a failed page must not abort the rest of the pages
|
|
302
|
+
}
|
|
303
|
+
if (cancelled) return;
|
|
304
|
+
// yield the server event loop between pages
|
|
305
|
+
await new Promise(resolve => {
|
|
306
|
+
setTimeout(resolve, DETAIL_CHUNK_GAP_MS);
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
})();
|
|
310
|
+
return () => {
|
|
311
|
+
cancelled = true;
|
|
312
|
+
};
|
|
313
|
+
}, [detailEnabled, totalComponents, client]);
|
|
181
314
|
const optionsRef = (0, _latest().default)(options);
|
|
182
315
|
(0, _react().useEffect)(() => {
|
|
183
316
|
const unSubCompAddition = subscribeToMore({
|
|
@@ -273,10 +406,29 @@ function useWorkspace(options = {}) {
|
|
|
273
406
|
};
|
|
274
407
|
}, [optionsRef]);
|
|
275
408
|
const workspace = (0, _react().useMemo)(() => {
|
|
276
|
-
|
|
277
|
-
|
|
409
|
+
const rawWorkspace = data?.workspace;
|
|
410
|
+
if (!rawWorkspace) return undefined;
|
|
411
|
+
|
|
412
|
+
// Merge the paged-in heavy fields (status, issuesCount) onto the light components by id.
|
|
413
|
+
// Components are not normalized in the Apollo cache (their `id` is an object, not a scalar key),
|
|
414
|
+
// so the detail pages are accumulated in `detailByKey` and merged here by hand. The light
|
|
415
|
+
// component wins when it already carries a value — a live subscription update (full fragment)
|
|
416
|
+
// refreshes status there, and the paged detail is only the initial enrichment.
|
|
417
|
+
const components = rawWorkspace.components.map(component => {
|
|
418
|
+
const detail = detailByKey.get(componentKey(component.id));
|
|
419
|
+
if (!detail) return component;
|
|
420
|
+
return _objectSpread(_objectSpread({}, component), {}, {
|
|
421
|
+
status: component.status ?? detail.status,
|
|
422
|
+
issuesCount: component.issuesCount ?? detail.issuesCount
|
|
423
|
+
});
|
|
424
|
+
});
|
|
425
|
+
return _workspaceModel().Workspace.from(_objectSpread(_objectSpread({}, rawWorkspace), {}, {
|
|
426
|
+
components
|
|
427
|
+
}));
|
|
428
|
+
}, [data?.workspace, detailByKey]);
|
|
278
429
|
return _objectSpread({
|
|
279
430
|
workspace,
|
|
431
|
+
loading,
|
|
280
432
|
subscribeToMore
|
|
281
433
|
}, rest);
|
|
282
434
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","data","require","_component","_latest","_interopRequireDefault","_uiFoundationUiHooks","_client","_componentId","_workspaceModel","_excluded","e","__esModule","default","ownKeys","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_toPropertyKey","value","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","_objectWithoutProperties","_objectWithoutPropertiesLoose","n","indexOf","propertyIsEnumerable","hasOwnProperty","wcComponentFields","gql","WORKSPACE","COMPONENT_SUBSCRIPTION_ADDED","COMPONENT_SUBSCRIPTION_CHANGED","COMPONENT_SUBSCRIPTION_REMOVED","COMPONENT_SERVER_STARTED","useWorkspace","options","_useDataQuery","useDataQuery","previousData","_previousData","subscribeToMore","rest","optionsRef","useLatest","useEffect","unSubCompAddition","document","updateQuery","prev","subscriptionData","update","addedComponent","componentAdded","component","componentExists","workspace","components","find","ComponentID","isEqualObj","id","ignoreVersion","setTimeout","current","onComponentAdded","ComponentModel","from","unSubCompChange","updatedComponent","componentChanged","onComponentUpdated","map","name","unSubCompRemoved","idsToRemove","componentRemoved","componentIds","onComponentRemoved","fromObject","every","unSubServerStarted","serverInfo","componentServerStarted","updatedComponents","env","server","url","host","basePath","useMemo","Workspace","undefined"],"sources":["use-workspace.ts"],"sourcesContent":["import { useEffect, useMemo } from 'react';\nimport { ComponentModel } from '@teambit/component';\nimport useLatest from '@react-hook/latest';\nimport { useDataQuery } from '@teambit/ui-foundation.ui.hooks.use-data-query';\nimport { gql } from '@apollo/client';\nimport type { ComponentIdObj } from '@teambit/component-id';\nimport { ComponentID } from '@teambit/component-id';\n\nimport { Workspace } from './workspace-model';\n\ntype UseWorkspaceResult = Omit<ReturnType<typeof useDataQuery>, 'data' | 'previousData'> & {\n workspace: Workspace | undefined;\n};\n\ntype UseWorkspaceOptions = {\n onComponentAdded?: (component: ComponentModel[]) => void;\n onComponentUpdated?: (component: ComponentModel[]) => void;\n onComponentRemoved?: (compId: ComponentID[]) => void;\n};\ntype RawComponent = { id: ComponentIdObj };\n\nconst wcComponentFields = gql`\n fragment wcComponentFields on Component {\n id {\n name\n version\n scope\n }\n aspects(include: [\"teambit.preview/preview\", \"teambit.envs/envs\"]) {\n # 'id' property in gql refers to a *global* identifier and used for caching.\n # this makes aspect data cache under the same key, even when they are under different components.\n # renaming the property fixes that.\n aspectId: id\n data\n }\n compositions {\n identifier\n }\n description\n issuesCount\n status {\n isOutdated\n isNew\n isInScope\n isStaged\n modifyInfo {\n hasModifiedFiles\n hasModifiedDependencies\n }\n isDeleted\n }\n buildStatus\n preview {\n includesEnvTemplate\n legacyHeader\n isScaling\n skipIncludes\n }\n deprecation {\n isDeprecate\n newId\n range\n }\n server {\n env\n url\n }\n env {\n id\n icon\n }\n }\n`;\n\nconst WORKSPACE = gql`\n query workspace {\n workspace {\n name\n path\n icon\n components {\n ...wcComponentFields\n }\n }\n }\n ${wcComponentFields}\n`;\n\nconst COMPONENT_SUBSCRIPTION_ADDED = gql`\n subscription OnComponentAdded {\n componentAdded {\n component {\n ...wcComponentFields\n }\n }\n }\n ${wcComponentFields}\n`;\n\nconst COMPONENT_SUBSCRIPTION_CHANGED = gql`\n subscription OnComponentChanged {\n componentChanged {\n component {\n ...wcComponentFields\n }\n }\n }\n ${wcComponentFields}\n`;\n\nconst COMPONENT_SUBSCRIPTION_REMOVED = gql`\n subscription OnComponentRemoved {\n componentRemoved {\n componentIds {\n name\n version\n scope\n }\n }\n }\n`;\n\nconst COMPONENT_SERVER_STARTED = gql`\n subscription OnComponentServerStarted {\n componentServerStarted {\n env\n url\n host\n basePath\n }\n }\n`;\n\nexport function useWorkspace(options: UseWorkspaceOptions = {}): UseWorkspaceResult {\n // `previousData` is destructured out (not spread into `...rest`) so the returned shape matches\n // UseWorkspaceResult, which omits it (along with `data`, replaced by `workspace`).\n const { data, previousData: _previousData, subscribeToMore, ...rest } = useDataQuery(WORKSPACE);\n const optionsRef = useLatest(options);\n\n useEffect(() => {\n const unSubCompAddition = subscribeToMore({\n document: COMPONENT_SUBSCRIPTION_ADDED,\n updateQuery: (prev, { subscriptionData }) => {\n const update = subscriptionData.data;\n const addedComponent = update?.componentAdded?.component;\n if (!addedComponent) return prev;\n\n const componentExists = prev.workspace.components.find((component: any) =>\n ComponentID.isEqualObj(component.id, addedComponent.id, { ignoreVersion: true })\n );\n if (componentExists) return prev;\n\n // side effect - trigger observers\n setTimeout(() => optionsRef.current.onComponentAdded?.([ComponentModel.from(addedComponent)]));\n\n return {\n ...prev,\n workspace: {\n ...prev.workspace,\n components: [...prev.workspace.components, addedComponent],\n },\n };\n },\n });\n\n const unSubCompChange = subscribeToMore({\n document: COMPONENT_SUBSCRIPTION_CHANGED,\n updateQuery: (prev, { subscriptionData }) => {\n const update = subscriptionData.data;\n if (!update) return prev;\n\n const updatedComponent = update.componentChanged.component;\n // side effect - trigger observers\n setTimeout(() => optionsRef.current.onComponentUpdated?.([ComponentModel.from(updatedComponent)]));\n\n return {\n ...prev,\n workspace: {\n ...prev.workspace,\n components: prev.workspace.components.map((component) =>\n component.id.name === updatedComponent.id.name ? updatedComponent : component\n ),\n },\n };\n },\n });\n\n const unSubCompRemoved = subscribeToMore({\n document: COMPONENT_SUBSCRIPTION_REMOVED,\n updateQuery: (prev, { subscriptionData }) => {\n const idsToRemove: ComponentIdObj[] | undefined = subscriptionData?.data?.componentRemoved?.componentIds;\n if (!idsToRemove || idsToRemove.length === 0) return prev;\n\n // side effect - trigger observers\n setTimeout(() => optionsRef.current.onComponentRemoved?.(idsToRemove.map((id) => ComponentID.fromObject(id))));\n\n return {\n ...prev,\n workspace: {\n ...prev.workspace,\n components: prev.workspace.components.filter((component: RawComponent) =>\n idsToRemove.every((id) => !ComponentID.isEqualObj(id, component.id))\n ),\n },\n };\n },\n });\n\n const unSubServerStarted = subscribeToMore({\n document: COMPONENT_SERVER_STARTED,\n updateQuery: (prev, { subscriptionData }) => {\n const update = subscriptionData.data;\n if (!update) return prev;\n\n const serverInfo = update.componentServerStarted;\n if (!serverInfo || serverInfo.length === 0) return prev;\n\n const updatedComponents = prev.workspace.components.map((component) => {\n if (component.env?.id === serverInfo[0].env) {\n return {\n ...component,\n server: {\n env: serverInfo[0].env,\n url: serverInfo[0].url,\n host: serverInfo[0].host,\n basePath: serverInfo[0].basePath,\n },\n };\n }\n return component;\n });\n\n return {\n ...prev,\n workspace: {\n ...prev.workspace,\n components: updatedComponents,\n },\n };\n },\n });\n\n return () => {\n unSubCompAddition();\n unSubCompChange();\n unSubCompRemoved();\n unSubServerStarted();\n };\n }, [optionsRef]);\n\n const workspace = useMemo(() => {\n return data?.workspace ? Workspace.from(data?.workspace) : undefined;\n }, [data?.workspace]);\n\n return {\n workspace,\n subscribeToMore,\n ...rest,\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,WAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,UAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,QAAA;EAAA,MAAAH,IAAA,GAAAI,sBAAA,CAAAH,OAAA;EAAAE,OAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,qBAAA;EAAA,MAAAL,IAAA,GAAAC,OAAA;EAAAI,oBAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,QAAA;EAAA,MAAAN,IAAA,GAAAC,OAAA;EAAAK,OAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAO,aAAA;EAAA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A,QAAA8B,oBAAA,CAAAR,IAAA,CAAA/B,CAAA,EAAAS,CAAA,MAAAkB,CAAA,CAAAlB,CAAA,IAAAT,CAAA,CAAAS,CAAA,aAAAkB,CAAA;AAAA,SAAAS,8BAAAhC,CAAA,EAAAJ,CAAA,gBAAAI,CAAA,iBAAAC,CAAA,gBAAAgC,CAAA,IAAAjC,CAAA,SAAAoC,cAAA,CAAAT,IAAA,CAAA3B,CAAA,EAAAiC,CAAA,gBAAArC,CAAA,CAAAsC,OAAA,CAAAD,CAAA,aAAAhC,CAAA,CAAAgC,CAAA,IAAAjC,CAAA,CAAAiC,CAAA,YAAAhC,CAAA;AAa9C,MAAMoC,iBAAiB,GAAG,IAAAC,aAAG;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAED,MAAMC,SAAS,GAAG,IAAAD,aAAG;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAID,iBAAiB;AACrB,CAAC;AAED,MAAMG,4BAA4B,GAAG,IAAAF,aAAG;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAID,iBAAiB;AACrB,CAAC;AAED,MAAMI,8BAA8B,GAAG,IAAAH,aAAG;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAID,iBAAiB;AACrB,CAAC;AAED,MAAMK,8BAA8B,GAAG,IAAAJ,aAAG;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAED,MAAMK,wBAAwB,GAAG,IAAAL,aAAG;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAEM,SAASM,YA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L;UACA,OAAOnC,SAAS;QAClB,CAAC,CAAC;QAEF,OAAApD,aAAA,CAAAA,aAAA,KACK+C,IAAI;UACPO,SAAS,EAAAtD,aAAA,CAAAA,aAAA,KACJ+C,IAAI,CAACO,SAAS;YACjBC,UAAU,EAAE2B;UAAiB;QAC9B;MAEL;IACF,CAAC,CAAC;IAEF,OAAO,MAAM;MACXtC,iBAAiB,CAAC,CAAC;MACnBsB,eAAe,CAAC,CAAC;MACjBM,gBAAgB,CAAC,CAAC;MAClBO,kBAAkB,CAAC,CAAC;IACtB,CAAC;EACH,CAAC,EAAE,CAACtC,UAAU,CAAC,CAAC;EAEhB,MAAMa,SAAS,GAAG,IAAAkC,gBAAO,EAAC,MAAM;IAC9B,OAAOjH,IAAI,EAAE+E,SAAS,GAAGmC,2BAAS,CAACxB,IAAI,CAAC1F,IAAI,EAAE+E,SAAS,CAAC,GAAGoC,SAAS;EACtE,CAAC,EAAE,CAACnH,IAAI,EAAE+E,SAAS,CAAC,CAAC;EAErB,OAAAtD,aAAA;IACEsD,SAAS;IACTf;EAAe,GACZC,IAAI;AAEX","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_react","data","require","_component","_latest","_interopRequireDefault","_uiFoundationUiHooks","_client","_componentId","_workspaceModel","_excluded","e","__esModule","default","ownKeys","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_toPropertyKey","value","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","_objectWithoutProperties","_objectWithoutPropertiesLoose","n","indexOf","propertyIsEnumerable","hasOwnProperty","wcComponentFieldsLight","gql","wcComponentDetailFields","wcComponentFieldsFull","WORKSPACE_LIGHT","WORKSPACE_DETAILS_PAGE","DETAIL_CHUNK_SIZE","DETAIL_CHUNK_GAP_MS","COMPONENT_SUBSCRIPTION_ADDED","COMPONENT_SUBSCRIPTION_CHANGED","COMPONENT_SUBSCRIPTION_REMOVED","COMPONENT_SERVER_STARTED","componentKey","id","scope","name","version","useWorkspace","options","_useDataQuery","useDataQuery","fetchPolicy","previousData","_previousData","subscribeToMore","loading","rest","detailEnabled","setDetailEnabled","useState","lightDataReady","Boolean","workspace","totalComponents","components","useEffect","window","undefined","enable","ric","requestIdleCallback","handle","timeout","cancelIdleCallback","setTimeout","clearTimeout","client","useApolloClient","detailByKey","setDetailByKey","Map","cancelled","offset","res","query","variables","limit","comps","prev","next","c","set","status","issuesCount","Promise","resolve","optionsRef","useLatest","unSubCompAddition","document","updateQuery","subscriptionData","update","addedComponent","componentAdded","component","componentExists","find","ComponentID","isEqualObj","ignoreVersion","current","onComponentAdded","ComponentModel","from","unSubCompChange","updatedComponent","componentChanged","onComponentUpdated","map","unSubCompRemoved","idsToRemove","componentRemoved","componentIds","onComponentRemoved","fromObject","every","unSubServerStarted","serverInfo","componentServerStarted","updatedComponents","env","server","url","host","basePath","useMemo","rawWorkspace","detail","get","Workspace"],"sources":["use-workspace.ts"],"sourcesContent":["import { useEffect, useMemo, useState } from 'react';\nimport { ComponentModel } from '@teambit/component';\nimport useLatest from '@react-hook/latest';\nimport { useDataQuery } from '@teambit/ui-foundation.ui.hooks.use-data-query';\nimport { gql, useApolloClient } from '@apollo/client';\nimport type { ComponentIdObj } from '@teambit/component-id';\nimport { ComponentID } from '@teambit/component-id';\n\nimport { Workspace } from './workspace-model';\n\ntype UseWorkspaceResult = Omit<ReturnType<typeof useDataQuery>, 'data' | 'previousData'> & {\n workspace: Workspace | undefined;\n};\n\ntype UseWorkspaceOptions = {\n onComponentAdded?: (component: ComponentModel[]) => void;\n onComponentUpdated?: (component: ComponentModel[]) => void;\n onComponentRemoved?: (compId: ComponentID[]) => void;\n};\ntype RawComponent = { id: ComponentIdObj };\n\n/**\n * Cheap, card-renderable fields only. Everything here resolves from already-loaded component\n * metadata (id, env, aspects, compositions, preview, deprecation, server, buildStatus, description),\n * so the light query returns fast and the grid can paint immediately. The two expensive async\n * resolvers — `status` (getStatus(): git/scope compare) and `issuesCount` (getIssues(): dependency\n * analysis) — are deliberately omitted here and fetched separately by `wcComponentDetailFields`.\n */\nconst wcComponentFieldsLight = gql`\n fragment wcComponentFieldsLight on Component {\n id {\n name\n version\n scope\n }\n aspects(include: [\"teambit.preview/preview\", \"teambit.envs/envs\"]) {\n # 'id' property in gql refers to a *global* identifier and used for caching.\n # this makes aspect data cache under the same key, even when they are under different components.\n # renaming the property fixes that.\n aspectId: id\n data\n }\n compositions {\n identifier\n }\n description\n buildStatus\n preview {\n includesEnvTemplate\n legacyHeader\n isScaling\n skipIncludes\n }\n deprecation {\n isDeprecate\n newId\n range\n }\n server {\n env\n url\n }\n env {\n id\n icon\n }\n }\n`;\n\n/**\n * The expensive per-component fields, split out so they never block first paint. These drive the\n * status pills (changed/building) and the issues badge, both of which gracefully degrade to a\n * neutral \"built\" / no-issues state until this query resolves.\n */\nconst wcComponentDetailFields = gql`\n fragment wcComponentDetailFields on Component {\n id {\n name\n version\n scope\n }\n issuesCount\n status {\n isOutdated\n isNew\n isInScope\n isStaged\n modifyInfo {\n hasModifiedFiles\n hasModifiedDependencies\n }\n isDeleted\n }\n }\n`;\n\n/**\n * Full per-component shape (light + detail). Used by the subscriptions: a single added/changed\n * component is cheap to fully resolve, so live updates always carry fresh status.\n */\nconst wcComponentFieldsFull = gql`\n fragment wcComponentFieldsFull on Component {\n ...wcComponentFieldsLight\n ...wcComponentDetailFields\n }\n ${wcComponentFieldsLight}\n ${wcComponentDetailFields}\n`;\n\nconst WORKSPACE_LIGHT = gql`\n query workspaceLight {\n workspace {\n name\n path\n icon\n components {\n ...wcComponentFieldsLight\n }\n }\n }\n ${wcComponentFieldsLight}\n`;\n\n// The detail fields are fetched one page at a time via the existing `components(offset, limit)`\n// resolver. getStatus()/getIssues() are synchronous CPU work; fetching all 204 at once blocks the\n// server's event loop for ~5s straight (a navigation query issued during that window waited ~10s).\n// Paging it lets the loop breathe between chunks — measured ping latency dropped from ~10s to ~0.3s.\nconst WORKSPACE_DETAILS_PAGE = gql`\n query workspaceDetailsPage($offset: Int!, $limit: Int!) {\n workspace {\n components(offset: $offset, limit: $limit) {\n ...wcComponentDetailFields\n }\n }\n }\n ${wcComponentDetailFields}\n`;\n\n// Small pages keep any single server-blocking burst under ~350ms; the gap yields the event loop so\n// other requests (navigation, lanes) are serviced promptly between pages.\nconst DETAIL_CHUNK_SIZE = 15;\nconst DETAIL_CHUNK_GAP_MS = 60;\n\nconst COMPONENT_SUBSCRIPTION_ADDED = gql`\n subscription OnComponentAdded {\n componentAdded {\n component {\n ...wcComponentFieldsFull\n }\n }\n }\n ${wcComponentFieldsFull}\n`;\n\nconst COMPONENT_SUBSCRIPTION_CHANGED = gql`\n subscription OnComponentChanged {\n componentChanged {\n component {\n ...wcComponentFieldsFull\n }\n }\n }\n ${wcComponentFieldsFull}\n`;\n\nconst COMPONENT_SUBSCRIPTION_REMOVED = gql`\n subscription OnComponentRemoved {\n componentRemoved {\n componentIds {\n name\n version\n scope\n }\n }\n }\n`;\n\nconst COMPONENT_SERVER_STARTED = gql`\n subscription OnComponentServerStarted {\n componentServerStarted {\n env\n url\n host\n basePath\n }\n }\n`;\n\nfunction componentKey(id: ComponentIdObj): string {\n return `${id.scope}/${id.name}@${id.version}`;\n}\n\nexport function useWorkspace(options: UseWorkspaceOptions = {}): UseWorkspaceResult {\n // Light query drives first paint. cache-and-network so a revisit paints instantly from cache,\n // then refreshes in the background (the workspace host otherwise defaults to network-only).\n // `previousData` is destructured out (not spread into `...rest`) so the returned shape matches\n // UseWorkspaceResult, which omits it (along with `data`, replaced by `workspace`).\n const {\n data,\n previousData: _previousData,\n subscribeToMore,\n loading,\n ...rest\n } = useDataQuery(WORKSPACE_LIGHT, {\n fetchPolicy: 'cache-and-network',\n });\n\n // CRITICAL: the detail data (status + issuesCount) is NOT fetched in parallel with the light query.\n // getStatus()/getIssues() are synchronous CPU work that monopolizes the server's single-threaded\n // event loop for several seconds on large workspaces; running it concurrently would stall the light\n // query behind it (measured: light alone ~10ms, but ~5s when racing the detail query) and the grid\n // would never paint early. So we wait for the light data to arrive AND for the browser to go idle\n // (i.e. the grid has painted) before kicking off the (chunked) detail fetch in the background.\n const [detailEnabled, setDetailEnabled] = useState(false);\n const lightDataReady = Boolean(data?.workspace);\n const totalComponents = data?.workspace?.components?.length ?? 0;\n\n useEffect(() => {\n if (!lightDataReady || detailEnabled || typeof window === 'undefined') return undefined;\n const enable = () => setDetailEnabled(true);\n const ric = (window as any).requestIdleCallback as\n | ((cb: () => void, opts?: { timeout: number }) => number)\n | undefined;\n if (ric) {\n const handle = ric(enable, { timeout: 1000 });\n return () => (window as any).cancelIdleCallback?.(handle);\n }\n const handle = window.setTimeout(enable, 200);\n return () => window.clearTimeout(handle);\n }, [lightDataReady, detailEnabled]);\n\n // Detail (status + issuesCount) is paged in once the grid has painted, with a yield between pages\n // so the server stays responsive. Results accumulate by component key and merge in progressively —\n // status pills and issue counts fill in chunk by chunk rather than all-or-nothing after ~5s.\n const client = useApolloClient();\n const [detailByKey, setDetailByKey] = useState<Map<string, { status?: any; issuesCount?: number }>>(new Map());\n\n useEffect(() => {\n if (!detailEnabled || !totalComponents) return undefined;\n let cancelled = false;\n\n (async () => {\n for (let offset = 0; offset < totalComponents; offset += DETAIL_CHUNK_SIZE) {\n if (cancelled) return;\n try {\n const res = await client.query({\n query: WORKSPACE_DETAILS_PAGE,\n variables: { offset, limit: DETAIL_CHUNK_SIZE },\n fetchPolicy: 'network-only',\n });\n if (cancelled) return;\n const comps: { id: ComponentIdObj; status?: any; issuesCount?: number }[] =\n res.data?.workspace?.components ?? [];\n if (comps.length) {\n setDetailByKey((prev) => {\n const next = new Map(prev);\n for (const c of comps) next.set(componentKey(c.id), { status: c.status, issuesCount: c.issuesCount });\n return next;\n });\n }\n } catch {\n // a failed page must not abort the rest of the pages\n }\n if (cancelled) return;\n // yield the server event loop between pages\n await new Promise((resolve) => {\n setTimeout(resolve, DETAIL_CHUNK_GAP_MS);\n });\n }\n })();\n\n return () => {\n cancelled = true;\n };\n }, [detailEnabled, totalComponents, client]);\n\n const optionsRef = useLatest(options);\n\n useEffect(() => {\n const unSubCompAddition = subscribeToMore({\n document: COMPONENT_SUBSCRIPTION_ADDED,\n updateQuery: (prev, { subscriptionData }) => {\n const update = subscriptionData.data;\n const addedComponent = update?.componentAdded?.component;\n if (!addedComponent) return prev;\n\n const componentExists = prev.workspace.components.find((component: any) =>\n ComponentID.isEqualObj(component.id, addedComponent.id, { ignoreVersion: true })\n );\n if (componentExists) return prev;\n\n // side effect - trigger observers\n setTimeout(() => optionsRef.current.onComponentAdded?.([ComponentModel.from(addedComponent)]));\n\n return {\n ...prev,\n workspace: {\n ...prev.workspace,\n components: [...prev.workspace.components, addedComponent],\n },\n };\n },\n });\n\n const unSubCompChange = subscribeToMore({\n document: COMPONENT_SUBSCRIPTION_CHANGED,\n updateQuery: (prev, { subscriptionData }) => {\n const update = subscriptionData.data;\n if (!update) return prev;\n\n const updatedComponent = update.componentChanged.component;\n // side effect - trigger observers\n setTimeout(() => optionsRef.current.onComponentUpdated?.([ComponentModel.from(updatedComponent)]));\n\n return {\n ...prev,\n workspace: {\n ...prev.workspace,\n components: prev.workspace.components.map((component) =>\n component.id.name === updatedComponent.id.name ? updatedComponent : component\n ),\n },\n };\n },\n });\n\n const unSubCompRemoved = subscribeToMore({\n document: COMPONENT_SUBSCRIPTION_REMOVED,\n updateQuery: (prev, { subscriptionData }) => {\n const idsToRemove: ComponentIdObj[] | undefined = subscriptionData?.data?.componentRemoved?.componentIds;\n if (!idsToRemove || idsToRemove.length === 0) return prev;\n\n // side effect - trigger observers\n setTimeout(() => optionsRef.current.onComponentRemoved?.(idsToRemove.map((id) => ComponentID.fromObject(id))));\n\n return {\n ...prev,\n workspace: {\n ...prev.workspace,\n components: prev.workspace.components.filter((component: RawComponent) =>\n idsToRemove.every((id) => !ComponentID.isEqualObj(id, component.id))\n ),\n },\n };\n },\n });\n\n const unSubServerStarted = subscribeToMore({\n document: COMPONENT_SERVER_STARTED,\n updateQuery: (prev, { subscriptionData }) => {\n const update = subscriptionData.data;\n if (!update) return prev;\n\n const serverInfo = update.componentServerStarted;\n if (!serverInfo || serverInfo.length === 0) return prev;\n\n const updatedComponents = prev.workspace.components.map((component) => {\n if (component.env?.id === serverInfo[0].env) {\n return {\n ...component,\n server: {\n env: serverInfo[0].env,\n url: serverInfo[0].url,\n host: serverInfo[0].host,\n basePath: serverInfo[0].basePath,\n },\n };\n }\n return component;\n });\n\n return {\n ...prev,\n workspace: {\n ...prev.workspace,\n components: updatedComponents,\n },\n };\n },\n });\n\n return () => {\n unSubCompAddition();\n unSubCompChange();\n unSubCompRemoved();\n unSubServerStarted();\n };\n }, [optionsRef]);\n\n const workspace = useMemo(() => {\n const rawWorkspace = data?.workspace;\n if (!rawWorkspace) return undefined;\n\n // Merge the paged-in heavy fields (status, issuesCount) onto the light components by id.\n // Components are not normalized in the Apollo cache (their `id` is an object, not a scalar key),\n // so the detail pages are accumulated in `detailByKey` and merged here by hand. The light\n // component wins when it already carries a value — a live subscription update (full fragment)\n // refreshes status there, and the paged detail is only the initial enrichment.\n const components = rawWorkspace.components.map((component: any) => {\n const detail = detailByKey.get(componentKey(component.id));\n if (!detail) return component;\n return {\n ...component,\n status: component.status ?? detail.status,\n issuesCount: component.issuesCount ?? detail.issuesCount,\n };\n });\n\n return Workspace.from({ ...rawWorkspace, components });\n }, [data?.workspace, detailByKey]);\n\n return {\n workspace,\n loading,\n subscribeToMore,\n ...rest,\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,WAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,UAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA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;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA,MAAME,qBAAqB,GAAG,IAAAF,aAAG;AACjC;AACA;AACA;AACA;AACA,IAAID,sBAAsB;AAC1B,IAAIE,uBAAuB;AAC3B,CAAC;AAED,MAAME,eAAe,GAAG,IAAAH,aAAG;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAID,sBAAsB;AAC1B,CAAC;;AAED;AACA;AACA;AACA;AACA,MAAMK,sBAAsB,GAAG,IAAAJ,aAAG;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAIC,uBAAuB;AAC3B,CAAC;;AAED;AACA;AACA,MAAMI,iBAAiB,GAAG,EAAE;AAC5B,MAAMC,mBAAmB,GAAG,EAAE;AAE9B,MAAMC,4BAA4B,GAAG,IAAAP,aAAG;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAIE,qBAAqB;AACzB,CAAC;AAED,MAAMM,8BAA8B,GAAG,IAAAR,aAAG;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAIE,qBAAqB;AACzB,CAAC;AAED,MAAMO,8BAA8B,GAAG,IAAAT,aAAG;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAED,MAAMU,wBAAwB,GAAG,IAAAV,aAAG;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAED,SAASW,YAAYA,CAACC,EAAkB,EAAU;EAChD,OAAO,GAAGA,EAAE,CAACC,KAAK,IAAID,EAAE,CAACE,IAAI,IAAIF,EAAE,CAACG,OAAO,EAAE;AAC/C;AAEO,SAASC,YAAYA,CAACC,OAA4B,GAAG,CAAC,CAAC,EAAsB;EAClF;EACA;EACA;EACA;EACA,MAAAC,aAAA,GAMI,IAAAC,mCAAY,EAAChB,eAAe,EAAE;MAChCiB,WAAW,EAAE;IACf,CAAC,CAAC;IARI;MACJxE,IA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BE,UAAU,EAAEkE;UAAiB;QAC9B;MAEL;IACF,CAAC,CAAC;IAEF,OAAO,MAAM;MACXhC,iBAAiB,CAAC,CAAC;MACnBiB,eAAe,CAAC,CAAC;MACjBK,gBAAgB,CAAC,CAAC;MAClBO,kBAAkB,CAAC,CAAC;IACtB,CAAC;EACH,CAAC,EAAE,CAAC/B,UAAU,CAAC,CAAC;EAEhB,MAAMlC,SAAS,GAAG,IAAA0E,gBAAO,EAAC,MAAM;IAC9B,MAAMC,YAAY,GAAG9J,IAAI,EAAEmF,SAAS;IACpC,IAAI,CAAC2E,YAAY,EAAE,OAAOtE,SAAS;;IAEnC;IACA;IACA;IACA;IACA;IACA,MAAMH,UAAU,GAAGyE,YAAY,CAACzE,UAAU,CAACuD,GAAG,CAAEd,SAAc,IAAK;MACjE,MAAMiC,MAAM,GAAG5D,WAAW,CAAC6D,GAAG,CAACjG,YAAY,CAAC+D,SAAS,CAAC9D,EAAE,CAAC,CAAC;MAC1D,IAAI,CAAC+F,MAAM,EAAE,OAAOjC,SAAS;MAC7B,OAAArG,aAAA,CAAAA,aAAA,KACKqG,SAAS;QACZb,MAAM,EAAEa,SAAS,CAACb,MAAM,IAAI8C,MAAM,CAAC9C,MAAM;QACzCC,WAAW,EAAEY,SAAS,CAACZ,WAAW,IAAI6C,MAAM,CAAC7C;MAAW;IAE5D,CAAC,CAAC;IAEF,OAAO+C,2BAAS,CAAC1B,IAAI,CAAA9G,aAAA,CAAAA,aAAA,KAAMqI,YAAY;MAAEzE;IAAU,EAAE,CAAC;EACxD,CAAC,EAAE,CAACrF,IAAI,EAAEmF,SAAS,EAAEgB,WAAW,CAAC,CAAC;EAElC,OAAA1E,aAAA;IACE0D,SAAS;IACTP,OAAO;IACPD;EAAe,GACZE,IAAI;AAEX","ignoreList":[]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { WorkspaceOverview } from './workspace-overview';
|
|
2
|
-
export { useQueryParamWithDefault, useListParamWithDefault } from '
|
|
2
|
+
export { useQueryParamWithDefault, useListParamWithDefault } from '@teambit/explorer.ui.components-overview';
|
|
@@ -12,13 +12,13 @@ Object.defineProperty(exports, "WorkspaceOverview", {
|
|
|
12
12
|
Object.defineProperty(exports, "useListParamWithDefault", {
|
|
13
13
|
enumerable: true,
|
|
14
14
|
get: function () {
|
|
15
|
-
return
|
|
15
|
+
return _explorerUi().useListParamWithDefault;
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
18
|
Object.defineProperty(exports, "useQueryParamWithDefault", {
|
|
19
19
|
enumerable: true,
|
|
20
20
|
get: function () {
|
|
21
|
-
return
|
|
21
|
+
return _explorerUi().useQueryParamWithDefault;
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
24
|
function _workspaceOverview() {
|
|
@@ -28,9 +28,9 @@ function _workspaceOverview() {
|
|
|
28
28
|
};
|
|
29
29
|
return data;
|
|
30
30
|
}
|
|
31
|
-
function
|
|
32
|
-
const data = require("
|
|
33
|
-
|
|
31
|
+
function _explorerUi() {
|
|
32
|
+
const data = require("@teambit/explorer.ui.components-overview");
|
|
33
|
+
_explorerUi = function () {
|
|
34
34
|
return data;
|
|
35
35
|
};
|
|
36
36
|
return data;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_workspaceOverview","data","require","
|
|
1
|
+
{"version":3,"names":["_workspaceOverview","data","require","_explorerUi"],"sources":["index.ts"],"sourcesContent":["export { WorkspaceOverview } from './workspace-overview';\nexport { useQueryParamWithDefault, useListParamWithDefault } from '@teambit/explorer.ui.components-overview';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAAA,mBAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,kBAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,YAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,WAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA","ignoreList":[]}
|
|
@@ -11,34 +11,6 @@ function _react() {
|
|
|
11
11
|
};
|
|
12
12
|
return data;
|
|
13
13
|
}
|
|
14
|
-
function _explorerUiGallery() {
|
|
15
|
-
const data = require("@teambit/explorer.ui.gallery.component-grid");
|
|
16
|
-
_explorerUiGallery = function () {
|
|
17
|
-
return data;
|
|
18
|
-
};
|
|
19
|
-
return data;
|
|
20
|
-
}
|
|
21
|
-
function _lodash() {
|
|
22
|
-
const data = _interopRequireDefault(require("lodash.compact"));
|
|
23
|
-
_lodash = function () {
|
|
24
|
-
return data;
|
|
25
|
-
};
|
|
26
|
-
return data;
|
|
27
|
-
}
|
|
28
|
-
function _scopes() {
|
|
29
|
-
const data = require("@teambit/scopes.scope-id");
|
|
30
|
-
_scopes = function () {
|
|
31
|
-
return data;
|
|
32
|
-
};
|
|
33
|
-
return data;
|
|
34
|
-
}
|
|
35
|
-
function _cloudHooks() {
|
|
36
|
-
const data = require("@teambit/cloud.hooks.use-cloud-scopes");
|
|
37
|
-
_cloudHooks = function () {
|
|
38
|
-
return data;
|
|
39
|
-
};
|
|
40
|
-
return data;
|
|
41
|
-
}
|
|
42
14
|
function _workspaceUi() {
|
|
43
15
|
const data = require("@teambit/workspace.ui.use-workspace-mode");
|
|
44
16
|
_workspaceUi = function () {
|
|
@@ -46,44 +18,16 @@ function _workspaceUi() {
|
|
|
46
18
|
};
|
|
47
19
|
return data;
|
|
48
20
|
}
|
|
49
|
-
function
|
|
50
|
-
const data = require("
|
|
51
|
-
|
|
52
|
-
return data;
|
|
53
|
-
};
|
|
54
|
-
return data;
|
|
55
|
-
}
|
|
56
|
-
function _useWorkspaceAggregation() {
|
|
57
|
-
const data = require("./use-workspace-aggregation");
|
|
58
|
-
_useWorkspaceAggregation = function () {
|
|
21
|
+
function _explorerUi() {
|
|
22
|
+
const data = require("@teambit/explorer.ui.components-overview");
|
|
23
|
+
_explorerUi = function () {
|
|
59
24
|
return data;
|
|
60
25
|
};
|
|
61
26
|
return data;
|
|
62
27
|
}
|
|
63
|
-
function
|
|
64
|
-
const data = require("
|
|
65
|
-
|
|
66
|
-
return data;
|
|
67
|
-
};
|
|
68
|
-
return data;
|
|
69
|
-
}
|
|
70
|
-
function _namespaceHeader() {
|
|
71
|
-
const data = require("./namespace-header");
|
|
72
|
-
_namespaceHeader = function () {
|
|
73
|
-
return data;
|
|
74
|
-
};
|
|
75
|
-
return data;
|
|
76
|
-
}
|
|
77
|
-
function _hopeComponentCard() {
|
|
78
|
-
const data = require("./hope-component-card");
|
|
79
|
-
_hopeComponentCard = function () {
|
|
80
|
-
return data;
|
|
81
|
-
};
|
|
82
|
-
return data;
|
|
83
|
-
}
|
|
84
|
-
function _workspaceFilterPanel() {
|
|
85
|
-
const data = require("./workspace-filter-panel");
|
|
86
|
-
_workspaceFilterPanel = function () {
|
|
28
|
+
function _workspaceContext() {
|
|
29
|
+
const data = require("../workspace-context");
|
|
30
|
+
_workspaceContext = function () {
|
|
87
31
|
return data;
|
|
88
32
|
};
|
|
89
33
|
return data;
|
|
@@ -95,18 +39,7 @@ function _workspaceBlankState() {
|
|
|
95
39
|
};
|
|
96
40
|
return data;
|
|
97
41
|
}
|
|
98
|
-
function _workspaceOverviewModule() {
|
|
99
|
-
const data = _interopRequireDefault(require("./workspace-overview.module.scss"));
|
|
100
|
-
_workspaceOverviewModule = function () {
|
|
101
|
-
return data;
|
|
102
|
-
};
|
|
103
|
-
return data;
|
|
104
|
-
}
|
|
105
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
106
42
|
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); }
|
|
107
|
-
// Legacy empty state — kept around as a fallback while the new blank state rolls out.
|
|
108
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
109
|
-
|
|
110
43
|
function WorkspaceOverview() {
|
|
111
44
|
const workspace = (0, _react().useContext)(_workspaceContext().WorkspaceContext);
|
|
112
45
|
const {
|
|
@@ -116,77 +49,14 @@ function WorkspaceOverview() {
|
|
|
116
49
|
const {
|
|
117
50
|
isMinimal
|
|
118
51
|
} = (0, _workspaceUi().useWorkspaceMode)();
|
|
119
|
-
const uniqueScopes = [...new Set(components.map(c => c.id.scope))];
|
|
120
|
-
const {
|
|
121
|
-
cloudScopes
|
|
122
|
-
} = (0, _cloudHooks().useCloudScopes)(uniqueScopes);
|
|
123
|
-
const cloudMap = new Map((cloudScopes || []).map(s => [s.id.toString(), s]));
|
|
124
|
-
const compDescriptorMap = new Map(componentDescriptors.map(d => [d.id.toString(), d]));
|
|
125
|
-
const items = (0, _lodash().default)(components.map(component => {
|
|
126
|
-
if (component.deprecation?.isDeprecate) return null;
|
|
127
|
-
const descriptor = compDescriptorMap.get(component.id.toString());
|
|
128
|
-
if (!descriptor) return null;
|
|
129
|
-
const cloudScope = cloudMap.get(component.id.scope);
|
|
130
|
-
const scope = cloudScope || _scopes().ScopeID.isValid(component.id.scope) && {
|
|
131
|
-
id: _scopes().ScopeID.fromString(component.id.scope)
|
|
132
|
-
} || undefined;
|
|
133
|
-
return {
|
|
134
|
-
component,
|
|
135
|
-
componentDescriptor: descriptor,
|
|
136
|
-
scope: scope ? {
|
|
137
|
-
id: scope.id,
|
|
138
|
-
icon: scope.icon,
|
|
139
|
-
backgroundIconColor: scope.backgroundIconColor
|
|
140
|
-
} : undefined
|
|
141
|
-
};
|
|
142
|
-
}));
|
|
143
|
-
const [aggregation, setAggregation] = (0, _useQueryParamWithDefault().useQueryParamWithDefault)('aggregation', 'namespaces');
|
|
144
|
-
const [activeNamespaces, setActiveNamespaces] = (0, _useQueryParamWithDefault().useListParamWithDefault)('ns');
|
|
145
|
-
const [activeScopes, setActiveScopes] = (0, _useQueryParamWithDefault().useListParamWithDefault)('scopes');
|
|
146
|
-
const filters = (0, _react().useMemo)(() => ({
|
|
147
|
-
namespaces: activeNamespaces,
|
|
148
|
-
scopes: activeScopes,
|
|
149
|
-
statuses: new Set()
|
|
150
|
-
}), [activeNamespaces, activeScopes]);
|
|
151
|
-
const {
|
|
152
|
-
groups,
|
|
153
|
-
groupType,
|
|
154
|
-
availableAggregations,
|
|
155
|
-
filteredCount
|
|
156
|
-
} = (0, _useWorkspaceAggregation().useWorkspaceAggregation)(items, aggregation, filters);
|
|
157
52
|
if (!components.length) return /*#__PURE__*/_react().default.createElement(_workspaceBlankState().WorkspaceBlankState, null);
|
|
158
|
-
return /*#__PURE__*/_react().default.createElement(
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
activeNamespaces: activeNamespaces,
|
|
166
|
-
onNamespacesChange: setActiveNamespaces,
|
|
167
|
-
activeScopes: activeScopes,
|
|
168
|
-
onScopesChange: setActiveScopes
|
|
169
|
-
}), /*#__PURE__*/_react().default.createElement("div", {
|
|
170
|
-
className: _workspaceOverviewModule().default.content
|
|
171
|
-
}, filteredCount === 0 && /*#__PURE__*/_react().default.createElement(_workspaceBlankState().WorkspaceBlankState, null), groups.map(group => /*#__PURE__*/_react().default.createElement("section", {
|
|
172
|
-
key: group.name,
|
|
173
|
-
className: _workspaceOverviewModule().default.section
|
|
174
|
-
}, groupType !== 'none' && /*#__PURE__*/_react().default.createElement("div", {
|
|
175
|
-
className: _workspaceOverviewModule().default.sectionHeader
|
|
176
|
-
}, /*#__PURE__*/_react().default.createElement(_namespaceHeader().NamespaceHeader, {
|
|
177
|
-
namespace: group.name,
|
|
178
|
-
items: group.items,
|
|
179
|
-
scopeIcon: group.scopeIcon,
|
|
180
|
-
scopeIconColor: group.scopeIconColor
|
|
181
|
-
})), /*#__PURE__*/_react().default.createElement(_explorerUiGallery().ComponentGrid, {
|
|
182
|
-
className: _workspaceOverviewModule().default.cardGrid
|
|
183
|
-
}, group.items.map(item => /*#__PURE__*/_react().default.createElement(_hopeComponentCard().HopeComponentCard, {
|
|
184
|
-
key: item.component.id.toString(),
|
|
185
|
-
component: item.component,
|
|
186
|
-
componentDescriptor: item.componentDescriptor,
|
|
187
|
-
scope: item.scope,
|
|
188
|
-
showPreview: isMinimal
|
|
189
|
-
})))))));
|
|
53
|
+
return /*#__PURE__*/_react().default.createElement(_explorerUi().ComponentsOverview, {
|
|
54
|
+
components: components,
|
|
55
|
+
componentDescriptors: componentDescriptors,
|
|
56
|
+
showPreview: isMinimal,
|
|
57
|
+
storageNamespace: "workspace-overview",
|
|
58
|
+
emptyState: /*#__PURE__*/_react().default.createElement(_workspaceBlankState().WorkspaceBlankState, null)
|
|
59
|
+
});
|
|
190
60
|
}
|
|
191
61
|
|
|
192
62
|
//# sourceMappingURL=workspace-overview.js.map
|