@kwirthmagnify/kwirth-plugin-status 0.2.1 → 0.2.3

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 (3) hide show
  1. package/back.js +1 -1
  2. package/front.js +6 -5
  3. package/package.json +1 -1
package/back.js CHANGED
@@ -75,7 +75,7 @@ var StatusChannel = class {
75
75
  modifiable: false,
76
76
  reconnectable: true,
77
77
  metrics: false,
78
- sources: [import_kwirth_common_back.EClusterType.KUBERNETES, import_kwirth_common_back.EClusterType.DOCKER],
78
+ sources: [import_kwirth_common_back.EClusterType.KUBERNETES],
79
79
  endpoints: [],
80
80
  websocket: false,
81
81
  cluster: true,
package/front.js CHANGED
@@ -97,6 +97,10 @@
97
97
  var StatusIcon = (props) => /* @__PURE__ */ import_react.default.createElement(import_material.SvgIcon, { ...props, viewBox: "0 0 24 24" }, /* @__PURE__ */ import_react.default.createElement("g", { fill: "none", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round" }, /* @__PURE__ */ import_react.default.createElement("rect", { x: "2.6", y: "4.6", width: "18.8", height: "14.8", rx: "2.2" }), /* @__PURE__ */ import_react.default.createElement("path", { d: "M6 12h2.6l1.5-3.4 2.6 6.8 1.5-3.4H18" })));
98
98
 
99
99
  // src/front/StatusData.ts
100
+ var countUnbrokeredConsumers = (components) => components.reduce((n, c) => {
101
+ if (c.subscribers === void 0 || c.knownConsumers === void 0) return n;
102
+ return n + Math.max(0, c.subscribers - c.knownConsumers);
103
+ }, 0);
100
104
  var StatusData = class {
101
105
  constructor() {
102
106
  this.view = "table";
@@ -275,17 +279,14 @@
275
279
  vigente = false;
276
280
  };
277
281
  }, [firmaGrafo]);
282
+ const anonimos = countUnbrokeredConsumers(inventory.components);
278
283
  if (inventory.edges.length === 0) {
279
- 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" }, "Nothing is subscribed to anything right now, so there is no graph to draw."));
284
+ 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" }, anonimos > 0 ? `There is consumption right now \u2014 ${anonimos} subscriber${anonimos > 1 ? "s" : ""} \u2014 but no graph to draw: they subscribed straight to the provider instead of going through the core, so nobody knows who they are. The table still shows how much each producer is delivering.` : "Nothing is subscribed to anything right now, so there is no graph to draw."));
280
285
  }
281
286
  if (!posiciones) {
282
287
  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"));
283
288
  }
284
289
  const colocados = nodos.map((n) => ({ ...n, position: posiciones[n.id] ?? { x: 0, y: 0 } }));
285
- const anonimos = inventory.components.reduce((n, c) => {
286
- if (c.subscribers === void 0 || c.knownConsumers === void 0) return n;
287
- return n + Math.max(0, c.subscribers - c.knownConsumers);
288
- }, 0);
289
290
  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(
290
291
  import_material2.Chip,
291
292
  {
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.1",
7
+ "version": "0.2.3",
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,