@kwirthmagnify/kwirth-plugin-trivy 0.2.10 → 0.2.11

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 +11 -13
  2. package/package.json +1 -1
package/front.js CHANGED
@@ -76,12 +76,13 @@
76
76
  });
77
77
 
78
78
  // src/front/TrivyChannel.ts
79
- var import_kwirth_common_front2 = __toESM(require_kwirth_common_front(), 1);
79
+ var import_kwirth_common_front3 = __toESM(require_kwirth_common_front(), 1);
80
80
  var import_kwirth_common2 = __toESM(require_kwirth_common(), 1);
81
81
 
82
82
  // src/front/TrivySetup.tsx
83
83
  var import_react2 = __toESM(require_react(), 1);
84
84
  var import_material2 = __toESM(require_material(), 1);
85
+ var import_kwirth_common_front = __toESM(require_kwirth_common_front(), 1);
85
86
 
86
87
  // src/front/TrivyConfig.ts
87
88
  var TrivyConfig = class {
@@ -117,9 +118,6 @@
117
118
 
118
119
  // src/front/TrivySetup.tsx
119
120
  var addGetAuthorization2 = (accessString) => ({ headers: { "Authorization": "Bearer " + accessString } });
120
- var MsgBoxOk = (title, content, setter) => /* @__PURE__ */ import_react2.default.createElement(import_material2.Dialog, { open: true }, /* @__PURE__ */ import_react2.default.createElement(import_material2.DialogTitle, null, title), /* @__PURE__ */ import_react2.default.createElement(import_material2.DialogContent, null, /* @__PURE__ */ import_react2.default.createElement(import_material2.Typography, null, content)), /* @__PURE__ */ import_react2.default.createElement(import_material2.DialogActions, null, /* @__PURE__ */ import_react2.default.createElement(import_material2.Button, { variant: "contained", onClick: () => setter(null) }, "OK")));
121
- var MsgBoxOkError = (title, content, setter) => /* @__PURE__ */ import_react2.default.createElement(import_material2.Dialog, { open: true }, /* @__PURE__ */ import_react2.default.createElement(import_material2.DialogTitle, { sx: { color: "error.main" } }, title), /* @__PURE__ */ import_react2.default.createElement(import_material2.DialogContent, null, /* @__PURE__ */ import_react2.default.createElement(import_material2.Typography, null, content)), /* @__PURE__ */ import_react2.default.createElement(import_material2.DialogActions, null, /* @__PURE__ */ import_react2.default.createElement(import_material2.Button, { variant: "contained", color: "error", onClick: () => setter(null) }, "OK")));
122
- var MsgBoxWaitCancel = (title, content, setter, _cb) => /* @__PURE__ */ import_react2.default.createElement(import_material2.Dialog, { open: true }, /* @__PURE__ */ import_react2.default.createElement(import_material2.DialogTitle, null, title), /* @__PURE__ */ import_react2.default.createElement(import_material2.DialogContent, null, /* @__PURE__ */ import_react2.default.createElement(import_material2.Stack, { direction: "row", spacing: 2, alignItems: "center" }, /* @__PURE__ */ import_react2.default.createElement(import_material2.CircularProgress, { size: 20 }), /* @__PURE__ */ import_react2.default.createElement(import_material2.Typography, null, content))), /* @__PURE__ */ import_react2.default.createElement(import_material2.DialogActions, null, /* @__PURE__ */ import_react2.default.createElement(import_material2.Button, { onClick: () => setter(null) }, "CANCEL")));
123
121
  var TrivyIcon = /* @__PURE__ */ import_react2.default.createElement(import_icons_material.VerifiedUser, null);
124
122
  var TrivySetup = (props) => {
125
123
  let trivyInstanceConfig = props.setupConfig?.channelInstanceConfig || new TrivyInstanceConfig();
@@ -129,7 +127,7 @@
129
127
  const [ignoreHigh, setIgnoreHigh] = (0, import_react2.useState)(trivyInstanceConfig.ignoreHigh || false);
130
128
  const [ignoreMedium, setIgnoreMedium] = (0, import_react2.useState)(trivyInstanceConfig.ignoreMedium ? true : false);
131
129
  const [ignoreLow, setIgnoreLow] = (0, import_react2.useState)(trivyInstanceConfig.ignoreLow ? true : false);
132
- const [msgBox, setMsgBox] = (0, import_react2.useState)(null);
130
+ const [msgBox, setMsgBox] = (0, import_react2.useState)(/* @__PURE__ */ import_react2.default.createElement(import_react2.default.Fragment, null));
133
131
  const [showOperatorManage, setShowOperatorManage] = (0, import_react2.useState)(false);
134
132
  const defaultRef = (0, import_react2.useRef)(null);
135
133
  const ok = () => {
@@ -145,12 +143,12 @@
145
143
  const onOperatorManageClosed = async (action) => {
146
144
  setShowOperatorManage(false);
147
145
  if (action) {
148
- setMsgBox(MsgBoxWaitCancel("Manage Trivy", `We are waiting for the action to complete...`, setMsgBox, (_a) => setMsgBox(null)));
146
+ setMsgBox((0, import_kwirth_common_front.MsgBoxWaitCancel)("Manage Trivy", `We are waiting for the action to complete...`, setMsgBox));
149
147
  const result = await fetch(`${props.channelObject.clusterUrl}/${trivyData.ri}/channel/trivy/operator?action=${action}`, addGetAuthorization2(props.channelObject.accessString));
150
148
  if (result.status === 200)
151
- setMsgBox(MsgBoxOk("Trivy", `Action '${action}' successfully sent, check results on your cluster.`, setMsgBox));
149
+ setMsgBox((0, import_kwirth_common_front.MsgBoxOk)("Trivy", `Action '${action}' successfully sent, check results on your cluster.`, setMsgBox));
152
150
  else
153
- setMsgBox(MsgBoxOkError("Trivy", `Trivy action has shown some errors: ${await result.text()}.`, setMsgBox));
151
+ setMsgBox((0, import_kwirth_common_front.MsgBoxOkError)("Trivy", `Trivy action has shown some errors: ${await result.text()}.`, setMsgBox));
154
152
  }
155
153
  };
156
154
  return /* @__PURE__ */ import_react2.default.createElement(import_react2.default.Fragment, null, /* @__PURE__ */ import_react2.default.createElement(import_material2.Dialog, { open: true, maxWidth: false, sx: { "& .MuiDialog-paper": { width: "28vw", minWidth: "500px", maxWidth: "50vw", height: "55vh" } } }, /* @__PURE__ */ import_react2.default.createElement(import_material2.DialogTitle, null, "Configure Trivy channel"), /* @__PURE__ */ import_react2.default.createElement(import_material2.DialogContent, null, /* @__PURE__ */ import_react2.default.createElement(import_material2.Stack, { direction: "column", justifyContent: "space-between", height: "100%" }, /* @__PURE__ */ import_react2.default.createElement(import_material2.Stack, { spacing: 2, direction: "column", sx: { mt: "16px" } }, /* @__PURE__ */ import_react2.default.createElement(import_material2.Typography, null, "Activate or deactivate severities for including or excluding them from Trivy reports:"), /* @__PURE__ */ import_react2.default.createElement(import_material2.Stack, { direction: "column" }, /* @__PURE__ */ import_react2.default.createElement(import_material2.Stack, { direction: "row", alignItems: "center" }, /* @__PURE__ */ import_react2.default.createElement(import_material2.Typography, { flex: 1 }), /* @__PURE__ */ import_react2.default.createElement(import_material2.Typography, null, "Ignore")), [["Critical", ignoreCritical, setIgnoreCritical], ["High", ignoreHigh, setIgnoreHigh], ["Medium", ignoreMedium, setIgnoreMedium], ["Low", ignoreLow, setIgnoreLow]].map(([label, val, setter]) => /* @__PURE__ */ import_react2.default.createElement(import_material2.Stack, { key: label, direction: "row", alignItems: "center" }, /* @__PURE__ */ import_react2.default.createElement(import_material2.Typography, { flex: 1, fontWeight: 800, width: "80px" }, label), /* @__PURE__ */ import_react2.default.createElement(import_material2.Checkbox, { checked: val, onChange: () => setter(!val) }))))), /* @__PURE__ */ import_react2.default.createElement(import_material2.Stack, { direction: "row" }, /* @__PURE__ */ import_react2.default.createElement(import_material2.Stack, { direction: "column" }, /* @__PURE__ */ import_react2.default.createElement(import_material2.Typography, null, "You can manage your cluster Trivy installation from Kwirth."), /* @__PURE__ */ import_react2.default.createElement(import_material2.Typography, { fontSize: "10px" }, "You need to start the channel at least once in order to be able to configure Trivy operator.")), /* @__PURE__ */ import_react2.default.createElement(import_material2.Typography, { flex: 1 }), /* @__PURE__ */ import_react2.default.createElement(import_material2.Button, { onClick: () => setShowOperatorManage(true), disabled: !trivyData.ri }, "Manage Trivy")))), /* @__PURE__ */ import_react2.default.createElement(import_material2.DialogActions, null, /* @__PURE__ */ import_react2.default.createElement(import_material2.FormControlLabel, { control: /* @__PURE__ */ import_react2.default.createElement(import_material2.Checkbox, { slotProps: { input: { ref: defaultRef } } }), label: "Set as default", sx: { width: "100%", ml: "8px" } }), /* @__PURE__ */ import_react2.default.createElement(import_material2.Button, { onClick: ok }, "OK"), /* @__PURE__ */ import_react2.default.createElement(import_material2.Button, { onClick: cancel }, "CANCEL"))), showOperatorManage && /* @__PURE__ */ import_react2.default.createElement(TrivyOperator, { onClose: onOperatorManageClosed, clusterUrl: props.channelObject.clusterUrl, accessString: props.channelObject.accessString, channelObject: props.channelObject }), msgBox);
@@ -271,14 +269,14 @@
271
269
  };
272
270
 
273
271
  // src/front/components/TrivyTabContentAssetDetails.tsx
274
- var import_kwirth_common_front = __toESM(require_kwirth_common_front(), 1);
272
+ var import_kwirth_common_front2 = __toESM(require_kwirth_common_front(), 1);
275
273
  var summaryVulnAuditExposed = (asset, detail) => {
276
274
  const report = asset[detail].report;
277
275
  return /* @__PURE__ */ import_react8.default.createElement(import_material7.TableContainer, { component: import_material7.Paper, sx: { mt: 1 } }, /* @__PURE__ */ import_react8.default.createElement(import_material7.Table, { sx: { minWidth: "100%" }, size: "small" }, /* @__PURE__ */ import_react8.default.createElement(import_material7.TableHead, null, /* @__PURE__ */ import_react8.default.createElement(import_material7.TableRow, null, /* @__PURE__ */ import_react8.default.createElement(import_material7.TableCell, { align: "center" }, /* @__PURE__ */ import_react8.default.createElement("b", null, "Critical")), /* @__PURE__ */ import_react8.default.createElement(import_material7.TableCell, { align: "center" }, /* @__PURE__ */ import_react8.default.createElement("b", null, "High")), /* @__PURE__ */ import_react8.default.createElement(import_material7.TableCell, { align: "center" }, /* @__PURE__ */ import_react8.default.createElement("b", null, "Medium")), /* @__PURE__ */ import_react8.default.createElement(import_material7.TableCell, { align: "center" }, /* @__PURE__ */ import_react8.default.createElement("b", null, "Low")))), /* @__PURE__ */ import_react8.default.createElement(import_material7.TableBody, null, /* @__PURE__ */ import_react8.default.createElement(import_material7.TableRow, { sx: { "&:last-child td, &:last-child th": { border: 0 } } }, /* @__PURE__ */ import_react8.default.createElement(import_material7.TableCell, { align: "center" }, report.summary.criticalCount), /* @__PURE__ */ import_react8.default.createElement(import_material7.TableCell, { align: "center" }, report.summary.highCount), /* @__PURE__ */ import_react8.default.createElement(import_material7.TableCell, { align: "center" }, report.summary.mediumCount), /* @__PURE__ */ import_react8.default.createElement(import_material7.TableCell, { align: "center" }, report.summary.lowCount)))));
278
276
  };
279
277
  var TrivyTabContentAssetDetails = (props) => {
280
278
  const [, setTick] = (0, import_react8.useState)(0);
281
- (0, import_kwirth_common_front.useKeyboard)(props.onClose);
279
+ (0, import_kwirth_common_front2.useKeyboard)(props.onClose);
282
280
  const asset = props.asset;
283
281
  const report = asset[props.detail].report;
284
282
  const levels = ["CRITICAL", "HIGH", "MEDIUM", "LOW"];
@@ -570,7 +568,7 @@
570
568
  this.setupVisible = visibility;
571
569
  }
572
570
  processChannelMessage(channelObject, wsEvent) {
573
- let action = import_kwirth_common_front2.EChannelRefreshAction.NONE;
571
+ let action = import_kwirth_common_front3.EChannelRefreshAction.NONE;
574
572
  let trivyData = channelObject.data;
575
573
  let trivyMessageResponse = JSON.parse(wsEvent.data);
576
574
  const getAsset = (namespace, name, container, create) => {
@@ -607,7 +605,7 @@
607
605
  }
608
606
  }
609
607
  trivyData.assets = [...trivyData.assets];
610
- action = import_kwirth_common_front2.EChannelRefreshAction.REFRESH;
608
+ action = import_kwirth_common_front3.EChannelRefreshAction.REFRESH;
611
609
  }
612
610
  break;
613
611
  case import_kwirth_common2.EInstanceMessageType.SIGNAL: {
@@ -631,7 +629,7 @@
631
629
  break;
632
630
  }
633
631
  }
634
- action = import_kwirth_common_front2.EChannelRefreshAction.REFRESH;
632
+ action = import_kwirth_common_front3.EChannelRefreshAction.REFRESH;
635
633
  break;
636
634
  }
637
635
  }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "id": "trivy",
3
3
  "name": "@kwirthmagnify/kwirth-plugin-trivy",
4
4
  "displayName": "Trivy",
5
- "version": "0.2.10",
5
+ "version": "0.2.11",
6
6
  "description": "Trivy security scanning channel plugin for Kwirth",
7
7
  "icon": "VerifiedUser",
8
8
  "website": "https://kwirthmagnify.dev"