code-kg 0.1.10 → 0.1.11
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/server/ui.js +22 -11
- package/dist/server/ui.js.map +1 -1
- package/package.json +1 -1
package/dist/server/ui.js
CHANGED
|
@@ -584,7 +584,7 @@ function renderUiHtml() {
|
|
|
584
584
|
const POINTER_INTERACTION_MAX_EDGES = 15000;
|
|
585
585
|
|
|
586
586
|
const state = {
|
|
587
|
-
view: '
|
|
587
|
+
view: 'fileDeps',
|
|
588
588
|
graph: null,
|
|
589
589
|
graphData: { nodes: [], links: [], nodeById: new Map() },
|
|
590
590
|
graphMeta: null,
|
|
@@ -1297,12 +1297,12 @@ function renderUiHtml() {
|
|
|
1297
1297
|
const rawNodes = Array.isArray(apiData && apiData.nodes) ? apiData.nodes : [];
|
|
1298
1298
|
const rawEdges = Array.isArray(apiData && apiData.edges) ? apiData.edges : [];
|
|
1299
1299
|
const degree = Object.create(null);
|
|
1300
|
-
const links =
|
|
1300
|
+
const links = [];
|
|
1301
1301
|
|
|
1302
1302
|
for (let i = 0; i < rawEdges.length; i += 1) {
|
|
1303
1303
|
const edge = rawEdges[i];
|
|
1304
|
-
const sourceRaw = edge.from || edge.source;
|
|
1305
|
-
const targetRaw = edge.to || edge.target;
|
|
1304
|
+
const sourceRaw = edge.fromId || edge.from || edge.source;
|
|
1305
|
+
const targetRaw = edge.toId || edge.to || edge.target;
|
|
1306
1306
|
const source = typeof sourceRaw === 'string'
|
|
1307
1307
|
? sourceRaw
|
|
1308
1308
|
: sourceRaw && sourceRaw.id
|
|
@@ -1314,14 +1314,13 @@ function renderUiHtml() {
|
|
|
1314
1314
|
? String(targetRaw.id)
|
|
1315
1315
|
: '';
|
|
1316
1316
|
|
|
1317
|
-
if (source.length
|
|
1318
|
-
|
|
1319
|
-
}
|
|
1320
|
-
if (target.length > 0) {
|
|
1321
|
-
degree[target] = (degree[target] || 0) + 1;
|
|
1317
|
+
if (source.length === 0 || target.length === 0) {
|
|
1318
|
+
continue;
|
|
1322
1319
|
}
|
|
1320
|
+
degree[source] = (degree[source] || 0) + 1;
|
|
1321
|
+
degree[target] = (degree[target] || 0) + 1;
|
|
1323
1322
|
|
|
1324
|
-
links
|
|
1323
|
+
links.push({
|
|
1325
1324
|
id: edge.id,
|
|
1326
1325
|
source,
|
|
1327
1326
|
target,
|
|
@@ -1331,7 +1330,7 @@ function renderUiHtml() {
|
|
|
1331
1330
|
__color: colorForEdge(edge.type),
|
|
1332
1331
|
__highlight: false,
|
|
1333
1332
|
__renderVisible: true
|
|
1334
|
-
};
|
|
1333
|
+
});
|
|
1335
1334
|
}
|
|
1336
1335
|
|
|
1337
1336
|
const nodes = new Array(rawNodes.length);
|
|
@@ -1596,6 +1595,18 @@ function renderUiHtml() {
|
|
|
1596
1595
|
}
|
|
1597
1596
|
const data = await readEnvelope(graphUrl);
|
|
1598
1597
|
state.graphData = toGraphData(data);
|
|
1598
|
+
|
|
1599
|
+
if (state.graphData.links.length === 0 && state.graphData.nodes.length > 1 && view !== 'fileDeps') {
|
|
1600
|
+
const fallbackData = await readEnvelope('/api/graph?view=fileDeps');
|
|
1601
|
+
const fallbackGraph = toGraphData(fallbackData);
|
|
1602
|
+
if (fallbackGraph.links.length > 0) {
|
|
1603
|
+
state.graphData = fallbackGraph;
|
|
1604
|
+
state.view = 'fileDeps';
|
|
1605
|
+
if (els.view) {
|
|
1606
|
+
els.view.value = 'fileDeps';
|
|
1607
|
+
}
|
|
1608
|
+
}
|
|
1609
|
+
}
|
|
1599
1610
|
const normalizedMeta = normalizeGraphMeta(
|
|
1600
1611
|
data && data.meta ? data.meta : null,
|
|
1601
1612
|
state.graphData.nodes.length,
|
package/dist/server/ui.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ui.js","sourceRoot":"","sources":["../../src/server/ui.ts"],"names":[],"mappings":";;AAEA,
|
|
1
|
+
{"version":3,"file":"ui.js","sourceRoot":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