@kwirthmagnify/kwirth-plugin-pinocchio 0.2.8 → 0.2.10

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 +9 -9
  2. package/package.json +1 -1
package/front.js CHANGED
@@ -123,13 +123,11 @@
123
123
  var material_1 = require_material();
124
124
  var icons_material_1 = require_icons_material();
125
125
  var downloadJson = async (data, filename) => {
126
- var _a, _b;
126
+ var _a;
127
127
  const json = JSON.stringify(data, null, 2);
128
128
  const tauri = window.__TAURI__;
129
- if (((_a = tauri === null || tauri === void 0 ? void 0 : tauri.dialog) === null || _a === void 0 ? void 0 : _a.save) && ((_b = tauri === null || tauri === void 0 ? void 0 : tauri.fs) === null || _b === void 0 ? void 0 : _b.writeTextFile)) {
130
- const path = await tauri.dialog.save({ defaultPath: filename, filters: [{ name: "JSON", extensions: ["json"] }] });
131
- if (path)
132
- await tauri.fs.writeTextFile(path, json);
129
+ if ((_a = tauri === null || tauri === void 0 ? void 0 : tauri.core) === null || _a === void 0 ? void 0 : _a.invoke) {
130
+ await tauri.core.invoke("save_file_dialog", { filename, content: json });
133
131
  return;
134
132
  }
135
133
  const blob = new Blob([json], { type: "application/json" });
@@ -743,6 +741,8 @@
743
741
  var import_react5 = __toESM(require_react(), 1);
744
742
  var import_material4 = __toESM(require_material(), 1);
745
743
  var import_kwirth_common_front2 = __toESM(require_kwirth_common_front(), 1);
744
+ var useKeyboard2 = typeof import_kwirth_common_front2.useKeyboard === "function" ? import_kwirth_common_front2.useKeyboard : () => {
745
+ };
746
746
  var CheckSection = ({ label, items, selected, onChange, existsLabel }) => {
747
747
  const allChecked = items.length > 0 && items.every((k) => selected.has(k));
748
748
  const someChecked = items.some((k) => selected.has(k));
@@ -756,7 +756,7 @@
756
756
  return /* @__PURE__ */ import_react5.default.createElement(import_material4.Box, { sx: { mb: 1 } }, /* @__PURE__ */ import_react5.default.createElement(import_material4.Stack, { direction: "row", alignItems: "center" }, /* @__PURE__ */ import_react5.default.createElement(import_material4.Checkbox, { size: "small", checked: allChecked, indeterminate: someChecked && !allChecked, onChange: toggleAll, disabled: items.length === 0 }), /* @__PURE__ */ import_react5.default.createElement(import_material4.Typography, { variant: "subtitle2", sx: { fontWeight: "bold" } }, label)), /* @__PURE__ */ import_react5.default.createElement(import_material4.Box, { sx: { pl: 3 } }, items.length === 0 ? /* @__PURE__ */ import_react5.default.createElement(import_material4.Typography, { variant: "body2", color: "text.secondary", sx: { ml: 1 } }, "\u2014 none \u2014") : items.map((key) => /* @__PURE__ */ import_react5.default.createElement(import_material4.Stack, { key, direction: "row", alignItems: "center" }, /* @__PURE__ */ import_react5.default.createElement(import_material4.Checkbox, { size: "small", checked: selected.has(key), onChange: () => toggleOne(key) }), /* @__PURE__ */ import_react5.default.createElement(import_material4.Typography, { variant: "body2" }, key), existsLabel?.(key) && /* @__PURE__ */ import_react5.default.createElement(import_material4.Typography, { variant: "caption", color: "warning.main", sx: { ml: 1 } }, "(overwrites existing)")))));
757
757
  };
758
758
  var PinocchioImportExport = (props) => {
759
- (0, import_kwirth_common_front2.useKeyboard)(() => props.onClose());
759
+ useKeyboard2(() => props.onClose());
760
760
  const fileInputRef = (0, import_react5.useRef)(null);
761
761
  const [exportTriggers, setExportTriggers] = (0, import_react5.useState)(new Set(props.config.triggers.map((t) => t.id)));
762
762
  const [importFile, setImportFile] = (0, import_react5.useState)(null);
@@ -768,9 +768,8 @@
768
768
  const json = JSON.stringify(data, null, 2);
769
769
  const filename = `pinocchio-triggers-${(/* @__PURE__ */ new Date()).toISOString().slice(0, 10)}.json`;
770
770
  const tauri = window.__TAURI__;
771
- if (tauri?.dialog?.save && tauri?.fs?.writeTextFile) {
772
- const path = await tauri.dialog.save({ defaultPath: filename, filters: [{ name: "JSON", extensions: ["json"] }] });
773
- if (path) await tauri.fs.writeTextFile(path, json);
771
+ if (tauri?.core?.invoke) {
772
+ await tauri.core.invoke("save_file_dialog", { filename, content: json });
774
773
  return;
775
774
  }
776
775
  const blob = new Blob([json], { type: "application/json" });
@@ -1486,6 +1485,7 @@
1486
1485
  }
1487
1486
  startChannel(channelObject) {
1488
1487
  let pinocchioObject = channelObject.data;
1488
+ pinocchioObject.content = [];
1489
1489
  pinocchioObject.content.push({ timestamp: Date.now(), text: "Local start pinocchio channel" });
1490
1490
  pinocchioObject.paused = false;
1491
1491
  pinocchioObject.started = true;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "id": "pinocchio",
3
3
  "name": "@kwirthmagnify/kwirth-plugin-pinocchio",
4
4
  "displayName": "Pinocchio",
5
- "version": "0.2.8",
5
+ "version": "0.2.10",
6
6
  "description": "Pinocchio AI channel plugin for Kwirth - LLM-based Kubernetes event analysis",
7
7
  "icon": "AutoFixHigh",
8
8
  "website": "https://kwirthmagnify.dev"