@kwirthmagnify/kwirth-plugin-pinocchio 0.2.7 → 0.2.9
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.
- package/front.js +21 -12
- package/package.json +1 -1
package/front.js
CHANGED
|
@@ -76,9 +76,9 @@
|
|
|
76
76
|
}
|
|
77
77
|
});
|
|
78
78
|
|
|
79
|
-
//
|
|
79
|
+
// node_modules/@kwirthmagnify/kwirth-common-ai/dist/front.js
|
|
80
80
|
var require_front = __commonJS({
|
|
81
|
-
"
|
|
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,15 @@
|
|
|
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
|
-
|
|
125
|
+
var downloadJson = async (data, filename) => {
|
|
126
|
+
var _a;
|
|
127
|
+
const json = JSON.stringify(data, null, 2);
|
|
128
|
+
const tauri = window.__TAURI__;
|
|
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 });
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
const blob = new Blob([json], { type: "application/json" });
|
|
127
134
|
const url = URL.createObjectURL(blob);
|
|
128
135
|
const a = document.createElement("a");
|
|
129
136
|
a.href = url;
|
|
@@ -734,6 +741,8 @@
|
|
|
734
741
|
var import_react5 = __toESM(require_react(), 1);
|
|
735
742
|
var import_material4 = __toESM(require_material(), 1);
|
|
736
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
|
+
};
|
|
737
746
|
var CheckSection = ({ label, items, selected, onChange, existsLabel }) => {
|
|
738
747
|
const allChecked = items.length > 0 && items.every((k) => selected.has(k));
|
|
739
748
|
const someChecked = items.some((k) => selected.has(k));
|
|
@@ -747,29 +756,29 @@
|
|
|
747
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)")))));
|
|
748
757
|
};
|
|
749
758
|
var PinocchioImportExport = (props) => {
|
|
750
|
-
(
|
|
759
|
+
useKeyboard2(() => props.onClose());
|
|
751
760
|
const fileInputRef = (0, import_react5.useRef)(null);
|
|
752
761
|
const [exportTriggers, setExportTriggers] = (0, import_react5.useState)(new Set(props.config.triggers.map((t) => t.id)));
|
|
753
762
|
const [importFile, setImportFile] = (0, import_react5.useState)(null);
|
|
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
768
|
const json = JSON.stringify(data, null, 2);
|
|
760
769
|
const filename = `pinocchio-triggers-${(/* @__PURE__ */ new Date()).toISOString().slice(0, 10)}.json`;
|
|
761
770
|
const tauri = window.__TAURI__;
|
|
762
|
-
if (tauri?.
|
|
763
|
-
tauri.
|
|
764
|
-
if (path) tauri.fs.writeTextFile(path, json);
|
|
765
|
-
});
|
|
771
|
+
if (tauri?.core?.invoke) {
|
|
772
|
+
await tauri.core.invoke("save_file_dialog", { filename, content: json });
|
|
766
773
|
return;
|
|
767
774
|
}
|
|
768
|
-
const
|
|
775
|
+
const blob = new Blob([json], { type: "application/json" });
|
|
776
|
+
const url = URL.createObjectURL(blob);
|
|
769
777
|
const a = document.createElement("a");
|
|
770
|
-
a.href =
|
|
778
|
+
a.href = url;
|
|
771
779
|
a.download = filename;
|
|
772
780
|
a.click();
|
|
781
|
+
URL.revokeObjectURL(url);
|
|
773
782
|
};
|
|
774
783
|
const handleFileChange = (e) => {
|
|
775
784
|
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.
|
|
5
|
+
"version": "0.2.9",
|
|
6
6
|
"description": "Pinocchio AI channel plugin for Kwirth - LLM-based Kubernetes event analysis",
|
|
7
7
|
"icon": "AutoFixHigh",
|
|
8
8
|
"website": "https://kwirthmagnify.dev"
|