@kwirthmagnify/kwirth-plugin-status 0.2.4 → 0.2.6
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/front.js +38 -13
- package/package.json +1 -1
package/front.js
CHANGED
|
@@ -160,9 +160,25 @@
|
|
|
160
160
|
*/
|
|
161
161
|
"elk.direction": "DOWN",
|
|
162
162
|
"elk.spacing.nodeNode": "40",
|
|
163
|
-
"elk.layered.spacing.nodeNodeBetweenLayers": "110"
|
|
163
|
+
"elk.layered.spacing.nodeNodeBetweenLayers": "110",
|
|
164
|
+
/*
|
|
165
|
+
UN solo grafo, no uno por componente. De serie elk coloca cada componente conexo por
|
|
166
|
+
su cuenta y luego los apila: un par suelto como sugarless -> sugarless salia en su
|
|
167
|
+
propio bloque de dos filas, con su canal por ENCIMA de productores del bloque grande.
|
|
168
|
+
*/
|
|
169
|
+
"elk.separateConnectedComponents": "false"
|
|
164
170
|
},
|
|
165
|
-
|
|
171
|
+
/*
|
|
172
|
+
Y la fila de cada nodo, fijada: productores en la primera capa, consumidores en la ultima.
|
|
173
|
+
Sin esto, un productor sin aristas (plugin:montag) es un nodo sin salidas y el layering
|
|
174
|
+
lo puede bajar con los consumidores.
|
|
175
|
+
*/
|
|
176
|
+
children: nodos.map((n) => ({
|
|
177
|
+
id: n.id,
|
|
178
|
+
width: 230,
|
|
179
|
+
height: 56,
|
|
180
|
+
layoutOptions: { "elk.layered.layering.layerConstraint": n.data.esProductor ? "FIRST" : "LAST" }
|
|
181
|
+
})),
|
|
166
182
|
edges: aristas.map((e) => ({ id: e.id, sources: [e.source], targets: [e.target] }))
|
|
167
183
|
});
|
|
168
184
|
const pos = {};
|
|
@@ -178,6 +194,7 @@
|
|
|
178
194
|
const vueltas = import_react2.default.useRef({ inventario: inventory, n: 0 });
|
|
179
195
|
if (vueltas.current.inventario !== inventory) vueltas.current = { inventario: inventory, n: vueltas.current.n + 1 };
|
|
180
196
|
const frenada = `statusFrenada${vueltas.current.n % 2}`;
|
|
197
|
+
const nodosPintados = import_react2.default.useRef(/* @__PURE__ */ new Map());
|
|
181
198
|
const [posiciones, setPosiciones] = import_react2.default.useState(void 0);
|
|
182
199
|
const [seleccionado, setSeleccionado] = import_react2.default.useState(void 0);
|
|
183
200
|
const colores = {
|
|
@@ -205,7 +222,12 @@
|
|
|
205
222
|
...productores.map((p) => ({
|
|
206
223
|
id: p.id,
|
|
207
224
|
position: { x: 0, y: 0 },
|
|
208
|
-
|
|
225
|
+
/*
|
|
226
|
+
SOLO lo que se pinta (o lo que usa el layout). Aquí llegaron a ir los suscriptores y la
|
|
227
|
+
salud sin que nadie los leyera, y como el nodo se rehace cuando cambia su data (ver
|
|
228
|
+
'colocados'), un contador que variaba entre fotos hacía parpadear nodos idénticos.
|
|
229
|
+
*/
|
|
230
|
+
data: { label: p.displayName, esProductor: true },
|
|
209
231
|
// Con el grafo en vertical, la arista tiene que salir por ABAJO y entrar por ARRIBA; si
|
|
210
232
|
// no, React Flow las saca por los lados y los cables dan un rodeo absurdo.
|
|
211
233
|
sourcePosition: import_react3.Position.Bottom,
|
|
@@ -246,15 +268,10 @@
|
|
|
246
268
|
source: e.providerId,
|
|
247
269
|
target: `channel:${e.channelId}`,
|
|
248
270
|
/*
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
mismo error que poner un 0 donde no hay dato — parecería información y sería decoración.
|
|
254
|
-
|
|
255
|
-
Cuando los contadores de S4 midan caudal de verdad, el movimiento (o el grosor) podrá
|
|
256
|
-
significar algo, y entonces se pone.
|
|
257
|
-
*/
|
|
271
|
+
Una línea en movimiento se lee como "por aquí está pasando algo ahora mismo", así que
|
|
272
|
+
solo se mueve cuando eso se ha MEDIDO (ver 'viva'). Quieta, lo único que dice es que la
|
|
273
|
+
suscripción existe. Cómo frena con auto-refresco está en el contenedor del ReactFlow.
|
|
274
|
+
*/
|
|
258
275
|
...(() => {
|
|
259
276
|
const tocaAlSeleccionado = Boolean(seleccionado) && (e.providerId === seleccionado || `channel:${e.channelId}` === seleccionado);
|
|
260
277
|
const viva = active.has(e.providerId);
|
|
@@ -290,7 +307,15 @@
|
|
|
290
307
|
if (!posiciones) {
|
|
291
308
|
return /* @__PURE__ */ import_react2.default.createElement(import_material2.Box, { sx: { p: 3 } }, /* @__PURE__ */ import_react2.default.createElement(import_material2.Typography, { variant: "body2", color: "text.secondary" }, "Laying out the graph\u2026"));
|
|
292
309
|
}
|
|
293
|
-
const colocados = nodos.map((n) =>
|
|
310
|
+
const colocados = nodos.map((n) => {
|
|
311
|
+
const position = posiciones[n.id] ?? { x: 0, y: 0 };
|
|
312
|
+
const firma = JSON.stringify([n.data, n.style, position]);
|
|
313
|
+
const previo = nodosPintados.current.get(n.id);
|
|
314
|
+
if (previo?.firma === firma) return previo.nodo;
|
|
315
|
+
const nodo = { ...n, position };
|
|
316
|
+
nodosPintados.current.set(n.id, { firma, nodo });
|
|
317
|
+
return nodo;
|
|
318
|
+
});
|
|
294
319
|
return /* @__PURE__ */ import_react2.default.createElement(import_material2.Box, { sx: { height: "100%", display: "flex", flexDirection: "column", minHeight: 0 } }, /* @__PURE__ */ import_react2.default.createElement(import_material2.Stack, { direction: "row", spacing: 1, alignItems: "center", sx: { mb: 1 } }, /* @__PURE__ */ import_react2.default.createElement(import_material2.Typography, { variant: "caption", color: "text.secondary" }, "A line means ", /* @__PURE__ */ import_react2.default.createElement("b", null, "an active subscription"), ". A ", /* @__PURE__ */ import_react2.default.createElement("b", null, "moving line"), " means its producer is delivering right now \u2014 but not how much goes to each consumer: that is measured per component, not per line.", " ", "Click a node to highlight what it is connected to; click the background to clear.")), (anonimos > 0 || canalesSueltos > 0) && /* @__PURE__ */ import_react2.default.createElement(import_material2.Stack, { direction: "row", spacing: 1, sx: { mb: 1 } }, anonimos > 0 && /* @__PURE__ */ import_react2.default.createElement(
|
|
295
320
|
import_material2.Chip,
|
|
296
321
|
{
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"id": "status",
|
|
5
5
|
"name": "@kwirthmagnify/kwirth-plugin-status",
|
|
6
6
|
"displayName": "Kwirth Status",
|
|
7
|
-
"version": "0.2.
|
|
7
|
+
"version": "0.2.6",
|
|
8
8
|
"description": "A look inside Kwirth: what is installed, how it is doing and who consumes what",
|
|
9
9
|
"icon": "<svg viewBox='0 0 24 24'><g fill='none' stroke='currentColor' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><rect x='2.6' y='4.6' width='18.8' height='14.8' rx='2.2'/><path d='M6 12h2.6l1.5-3.4 2.6 6.8 1.5-3.4H18'/></g></svg>",
|
|
10
10
|
"requiresRestart": false,
|