@kwirthmagnify/kwirth-plugin-pinocchio 0.2.6 → 0.2.8

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 +24 -7
  2. package/package.json +1 -1
package/front.js CHANGED
@@ -76,9 +76,9 @@
76
76
  }
77
77
  });
78
78
 
79
- // ../../common-ai/dist/front.js
79
+ // node_modules/@kwirthmagnify/kwirth-common-ai/dist/front.js
80
80
  var require_front = __commonJS({
81
- "../../common-ai/dist/front.js"(exports) {
81
+ "node_modules/@kwirthmagnify/kwirth-common-ai/dist/front.js"(exports) {
82
82
  "use strict";
83
83
  var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
84
84
  if (k2 === void 0) k2 = k;
@@ -122,8 +122,17 @@
122
122
  var react_1 = __importStar(require_react());
123
123
  var material_1 = require_material();
124
124
  var icons_material_1 = require_icons_material();
125
- var downloadJson = (data, filename) => {
126
- const blob = new Blob([JSON.stringify(data, null, 2)], { type: "application/json" });
125
+ var downloadJson = async (data, filename) => {
126
+ var _a, _b;
127
+ const json = JSON.stringify(data, null, 2);
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);
133
+ return;
134
+ }
135
+ const blob = new Blob([json], { type: "application/json" });
127
136
  const url = URL.createObjectURL(blob);
128
137
  const a = document.createElement("a");
129
138
  a.href = url;
@@ -754,13 +763,21 @@
754
763
  const [importTriggers, setImportTriggers] = (0, import_react5.useState)(/* @__PURE__ */ new Set());
755
764
  const [importError, setImportError] = (0, import_react5.useState)("");
756
765
  const [mode, setMode] = (0, import_react5.useState)("export");
757
- const handleDownload = () => {
766
+ const handleDownload = async () => {
758
767
  const data = { version: "1", triggers: props.config.triggers.filter((t) => exportTriggers.has(t.id)) };
759
- const blob = new Blob([JSON.stringify(data, null, 2)], { type: "application/json" });
768
+ const json = JSON.stringify(data, null, 2);
769
+ const filename = `pinocchio-triggers-${(/* @__PURE__ */ new Date()).toISOString().slice(0, 10)}.json`;
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);
774
+ return;
775
+ }
776
+ const blob = new Blob([json], { type: "application/json" });
760
777
  const url = URL.createObjectURL(blob);
761
778
  const a = document.createElement("a");
762
779
  a.href = url;
763
- a.download = `pinocchio-triggers-${(/* @__PURE__ */ new Date()).toISOString().slice(0, 10)}.json`;
780
+ a.download = filename;
764
781
  a.click();
765
782
  URL.revokeObjectURL(url);
766
783
  };
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.6",
5
+ "version": "0.2.8",
6
6
  "description": "Pinocchio AI channel plugin for Kwirth - LLM-based Kubernetes event analysis",
7
7
  "icon": "AutoFixHigh",
8
8
  "website": "https://kwirthmagnify.dev"