@kwirthmagnify/kwirth-plugin-status 0.2.4 → 0.2.5

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.
Files changed (2) hide show
  1. package/front.js +16 -2
  2. package/package.json +1 -1
package/front.js CHANGED
@@ -178,6 +178,7 @@
178
178
  const vueltas = import_react2.default.useRef({ inventario: inventory, n: 0 });
179
179
  if (vueltas.current.inventario !== inventory) vueltas.current = { inventario: inventory, n: vueltas.current.n + 1 };
180
180
  const frenada = `statusFrenada${vueltas.current.n % 2}`;
181
+ const nodosPintados = import_react2.default.useRef(/* @__PURE__ */ new Map());
181
182
  const [posiciones, setPosiciones] = import_react2.default.useState(void 0);
182
183
  const [seleccionado, setSeleccionado] = import_react2.default.useState(void 0);
183
184
  const colores = {
@@ -205,7 +206,12 @@
205
206
  ...productores.map((p) => ({
206
207
  id: p.id,
207
208
  position: { x: 0, y: 0 },
208
- data: { label: p.displayName, esProductor: true, health: p.health, subscribers: p.subscribers, known: p.knownConsumers },
209
+ /*
210
+ SOLO lo que se pinta (o lo que usa el layout). Aquí llegaron a ir los suscriptores y la
211
+ salud sin que nadie los leyera, y como el nodo se rehace cuando cambia su data (ver
212
+ 'colocados'), un contador que variaba entre fotos hacía parpadear nodos idénticos.
213
+ */
214
+ data: { label: p.displayName, esProductor: true },
209
215
  // Con el grafo en vertical, la arista tiene que salir por ABAJO y entrar por ARRIBA; si
210
216
  // no, React Flow las saca por los lados y los cables dan un rodeo absurdo.
211
217
  sourcePosition: import_react3.Position.Bottom,
@@ -290,7 +296,15 @@
290
296
  if (!posiciones) {
291
297
  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
298
  }
293
- const colocados = nodos.map((n) => ({ ...n, position: posiciones[n.id] ?? { x: 0, y: 0 } }));
299
+ const colocados = nodos.map((n) => {
300
+ const position = posiciones[n.id] ?? { x: 0, y: 0 };
301
+ const firma = JSON.stringify([n.data, n.style, position]);
302
+ const previo = nodosPintados.current.get(n.id);
303
+ if (previo?.firma === firma) return previo.nodo;
304
+ const nodo = { ...n, position };
305
+ nodosPintados.current.set(n.id, { firma, nodo });
306
+ return nodo;
307
+ });
294
308
  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
309
  import_material2.Chip,
296
310
  {
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.4",
7
+ "version": "0.2.5",
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,