@kwirthmagnify/kwirth-plugin-pinocchio 0.2.6 → 0.2.7

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 +12 -5
  2. package/package.json +1 -1
package/front.js CHANGED
@@ -756,13 +756,20 @@
756
756
  const [mode, setMode] = (0, import_react5.useState)("export");
757
757
  const handleDownload = () => {
758
758
  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" });
760
- const url = URL.createObjectURL(blob);
759
+ const json = JSON.stringify(data, null, 2);
760
+ const filename = `pinocchio-triggers-${(/* @__PURE__ */ new Date()).toISOString().slice(0, 10)}.json`;
761
+ const tauri = window.__TAURI__;
762
+ if (tauri?.dialog?.save && tauri?.fs?.writeTextFile) {
763
+ tauri.dialog.save({ defaultPath: filename, filters: [{ name: "JSON", extensions: ["json"] }] }).then((path) => {
764
+ if (path) tauri.fs.writeTextFile(path, json);
765
+ });
766
+ return;
767
+ }
768
+ const uri = "data:application/json;charset=utf-8," + encodeURIComponent(json);
761
769
  const a = document.createElement("a");
762
- a.href = url;
763
- a.download = `pinocchio-triggers-${(/* @__PURE__ */ new Date()).toISOString().slice(0, 10)}.json`;
770
+ a.href = uri;
771
+ a.download = filename;
764
772
  a.click();
765
- URL.revokeObjectURL(url);
766
773
  };
767
774
  const handleFileChange = (e) => {
768
775
  const file = e.target.files?.[0];
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.7",
6
6
  "description": "Pinocchio AI channel plugin for Kwirth - LLM-based Kubernetes event analysis",
7
7
  "icon": "AutoFixHigh",
8
8
  "website": "https://kwirthmagnify.dev"