@kartverket/backstage-plugin-risk-scorecard 1.0.8 → 1.0.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.
@@ -3,7 +3,7 @@ import { makeStyles, FormControl, FormLabel, FormHelperText, TextField as TextFi
3
3
  import { InfoCard, ContentHeader } from '@backstage/core-components';
4
4
  import { useEntity } from '@backstage/plugin-catalog-react';
5
5
  import { useRouteRef, useApi, googleAuthApiRef, identityApiRef, fetchApiRef, configApiRef } from '@backstage/core-plugin-api';
6
- import { s as scenarioRouteRef, r as riScRouteRef, p as pluginRiScTranslationRef } from './index-0a8ff39c.esm.js';
6
+ import { s as scenarioRouteRef, r as riScRouteRef, p as pluginRiScTranslationRef } from './index-558ec32a.esm.js';
7
7
  import { useNavigate, useLocation, useParams } from 'react-router';
8
8
  import { useEffectOnce } from 'react-use';
9
9
  import { useSearchParams, Routes, Route } from 'react-router-dom';
@@ -2146,7 +2146,7 @@ const ActionsSection = () => {
2146
2146
  startIcon: /* @__PURE__ */ React.createElement(EditIcon, { className: editIcon, "aria-label": "Edit" })
2147
2147
  }
2148
2148
  )
2149
- ), scenario.actions.map((action, index) => /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
2149
+ ), scenario.actions.map((action, index) => /* @__PURE__ */ React.createElement(Fragment, { key: action.ID }, /* @__PURE__ */ React.createElement(
2150
2150
  ActionBox,
2151
2151
  {
2152
2152
  action,
@@ -2177,7 +2177,7 @@ const ScopeSection = () => {
2177
2177
  onClick: () => editScenario("scenario"),
2178
2178
  startIcon: /* @__PURE__ */ React.createElement(EditIcon, { className: editIcon, "aria-label": "Edit" })
2179
2179
  }
2180
- )), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(Typography, { className: h1 }, scenario.title)), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(Typography, { className: label }, t("dictionary.description")), /* @__PURE__ */ React.createElement(Typography, { className: body2 }, scenario.description)), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(Divider, { variant: "fullWidth" })), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 6 }, /* @__PURE__ */ React.createElement(Typography, { className: label }, t("dictionary.threatActors")), scenario.threatActors.map((threatActor) => /* @__PURE__ */ React.createElement(Typography, { className: body2 }, threatActor))), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 6 }, /* @__PURE__ */ React.createElement(Typography, { className: label }, t("dictionary.vulnerabilities")), scenario.vulnerabilities.map((vulnerability) => /* @__PURE__ */ React.createElement(Typography, { className: body2 }, vulnerability))))));
2180
+ )), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(Typography, { className: h1 }, scenario.title)), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(Typography, { className: label }, t("dictionary.description")), /* @__PURE__ */ React.createElement(Typography, { className: body2 }, scenario.description)), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(Divider, { variant: "fullWidth" })), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 6 }, /* @__PURE__ */ React.createElement(Typography, { className: label }, t("dictionary.threatActors")), scenario.threatActors.map((threatActor) => /* @__PURE__ */ React.createElement(Typography, { key: threatActor, className: body2 }, threatActor))), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 6 }, /* @__PURE__ */ React.createElement(Typography, { className: label }, t("dictionary.vulnerabilities")), scenario.vulnerabilities.map((vulnerability) => /* @__PURE__ */ React.createElement(Typography, { key: vulnerability, className: body2 }, vulnerability))))));
2181
2181
  };
2182
2182
 
2183
2183
  const ScenarioDrawer = () => {
@@ -2334,6 +2334,11 @@ const RiskMatrixScenarioCount = ({
2334
2334
  tooltipText
2335
2335
  } = useRiskMatrixStyles();
2336
2336
  const [tooltipOpen, setTooltipOpen] = useState(false);
2337
+ const { openScenario } = useContext(ScenarioContext);
2338
+ const handleScenarioClick = (ID) => {
2339
+ setTooltipOpen(false);
2340
+ openScenario(ID);
2341
+ };
2337
2342
  const scenarios = riSc.scenarios.filter(
2338
2343
  (scenario) => probabilityOptions.indexOf(
2339
2344
  initialRisk ? scenario.risk.probability : scenario.remainingRisk.probability
@@ -2344,7 +2349,9 @@ const RiskMatrixScenarioCount = ({
2344
2349
  if (scenarios.length === 0) {
2345
2350
  return null;
2346
2351
  }
2347
- const tooltipList = /* @__PURE__ */ React.createElement(List, { dense: true }, /* @__PURE__ */ React.createElement(ListSubheader, { className: tooltipText }, /* @__PURE__ */ React.createElement(Typography, { variant: "h6", className: tooltipText }, t("riskMatrix.tooltip.title"))), scenarios.map((s) => /* @__PURE__ */ React.createElement(ListItem, { button: true, disableGutters: true, className: tooltipText }, /* @__PURE__ */ React.createElement(CircleIcon, { className: tooltipText, style: { width: "10px" } }), /* @__PURE__ */ React.createElement(
2352
+ const tooltipList = /* @__PURE__ */ React.createElement(List, { dense: true }, /* @__PURE__ */ React.createElement(ListSubheader, { className: tooltipText }, /* @__PURE__ */ React.createElement(Typography, { variant: "h6", className: tooltipText }, t("riskMatrix.tooltip.title"))), scenarios.map((s) => /* @__PURE__ */ React.createElement(ListItem, { key: s.ID, button: true, disableGutters: true, className: tooltipText, onClick: () => {
2353
+ handleScenarioClick(s.ID);
2354
+ } }, /* @__PURE__ */ React.createElement(CircleIcon, { className: tooltipText, style: { width: "10px" } }), /* @__PURE__ */ React.createElement(
2348
2355
  ListItemText$1,
2349
2356
  {
2350
2357
  className: tooltipText,
@@ -2355,6 +2362,7 @@ const RiskMatrixScenarioCount = ({
2355
2362
  return /* @__PURE__ */ React.createElement(ClickAwayListener, { onClickAway: () => setTooltipOpen(false) }, /* @__PURE__ */ React.createElement(
2356
2363
  Tooltip,
2357
2364
  {
2365
+ interactive: true,
2358
2366
  classes: { tooltip, arrow: tooltipArrow },
2359
2367
  title: tooltipList,
2360
2368
  placement: "right",
@@ -2392,7 +2400,7 @@ const EstimatedRiskInfoDialog = ({
2392
2400
  }) => {
2393
2401
  const { t } = useTranslationRef(pluginRiScTranslationRef);
2394
2402
  const { paper, title, text } = useEstimatedRiskInfoDialogStyles();
2395
- return /* @__PURE__ */ React.createElement(Dialog, { open: isOpen, onClose, maxWidth: "xs" }, /* @__PURE__ */ React.createElement(Paper, { className: paper }, /* @__PURE__ */ React.createElement(DialogTitle, { className: title }, t("infoDialog.title")), /* @__PURE__ */ React.createElement(DialogContent, { className: text, dividers: true }, /* @__PURE__ */ React.createElement(DialogContentText, { className: text }, t("infoDialog.description")), /* @__PURE__ */ React.createElement(Typography, { style: { fontWeight: "bold" } }, t("infoDialog.calculatedHowTitle")), /* @__PURE__ */ React.createElement(DialogContentText, { className: text }, t("infoDialog.calculatedHow")), /* @__PURE__ */ React.createElement(Typography, { style: { fontWeight: "bold" } }, t("infoDialog.consequenceTitle")), /* @__PURE__ */ React.createElement(DialogContentText, { className: text }, consequenceOptions.map((option, index) => /* @__PURE__ */ React.createElement(React.Fragment, null, index + 1, ": ", formatNOK(option), /* @__PURE__ */ React.createElement("br", null)))), /* @__PURE__ */ React.createElement(Typography, { style: { fontWeight: "bold" } }, t("infoDialog.probabilityTitle")), /* @__PURE__ */ React.createElement(DialogContentText, { className: text }, probabilityOptions.map((option, index) => /* @__PURE__ */ React.createElement(React.Fragment, null, index + 1, ": ", option, ", ", t(`infoDialog.probabilityDescription.${index}`), /* @__PURE__ */ React.createElement("br", null)))), /* @__PURE__ */ React.createElement(DialogContentText, { className: text }, t("infoDialog.example")))));
2403
+ return /* @__PURE__ */ React.createElement(Dialog, { open: isOpen, onClose, maxWidth: "xs" }, /* @__PURE__ */ React.createElement(Paper, { className: paper }, /* @__PURE__ */ React.createElement(DialogTitle, { className: title }, t("infoDialog.title")), /* @__PURE__ */ React.createElement(DialogContent, { className: text, dividers: true }, /* @__PURE__ */ React.createElement(DialogContentText, { className: text }, t("infoDialog.description")), /* @__PURE__ */ React.createElement(Typography, { style: { fontWeight: "bold" } }, t("infoDialog.calculatedHowTitle")), /* @__PURE__ */ React.createElement(DialogContentText, { className: text }, t("infoDialog.calculatedHow")), /* @__PURE__ */ React.createElement(Typography, { style: { fontWeight: "bold" } }, t("infoDialog.consequenceTitle")), /* @__PURE__ */ React.createElement(DialogContentText, { className: text }, consequenceOptions.map((option, index) => /* @__PURE__ */ React.createElement(Fragment, { key: option }, index + 1, ": ", formatNOK(option), /* @__PURE__ */ React.createElement("br", null)))), /* @__PURE__ */ React.createElement(Typography, { style: { fontWeight: "bold" } }, t("infoDialog.probabilityTitle")), /* @__PURE__ */ React.createElement(DialogContentText, { className: text }, probabilityOptions.map((option, index) => /* @__PURE__ */ React.createElement(Fragment, { key: option }, index + 1, ": ", option, ", ", t(`infoDialog.probabilityDescription.${index}`), /* @__PURE__ */ React.createElement("br", null)))), /* @__PURE__ */ React.createElement(DialogContentText, { className: text }, t("infoDialog.example")))));
2396
2404
  };
2397
2405
 
2398
2406
  const useAggregatedCostStyles = makeStyles({
@@ -2489,11 +2497,12 @@ const RiskMatrix = ({ riSc }) => {
2489
2497
  riSc,
2490
2498
  initialRisk: tab === "initialRisk" /* initialRisk */
2491
2499
  }
2492
- )), /* @__PURE__ */ React.createElement(Box$2, { className: gridWrapper }, /* @__PURE__ */ React.createElement(Box$2, { className: grid }, /* @__PURE__ */ React.createElement(Box$2, { className: konsekvens }, /* @__PURE__ */ React.createElement(Typography, { className: `${centered} ${label2}` }, t("dictionary.consequence"))), riskMatrix.map((_, row) => /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Box$2, { className: centered }, /* @__PURE__ */ React.createElement(Typography, { className: text }, 5 - row)), riskMatrix[0].map((_2, col) => /* @__PURE__ */ React.createElement(
2500
+ )), /* @__PURE__ */ React.createElement(Box$2, { className: gridWrapper }, /* @__PURE__ */ React.createElement(Box$2, { className: grid }, /* @__PURE__ */ React.createElement(Box$2, { className: konsekvens }, /* @__PURE__ */ React.createElement(Typography, { className: `${centered} ${label2}` }, t("dictionary.consequence"))), riskMatrix.map((_, row) => /* @__PURE__ */ React.createElement(Fragment, { key: row }, /* @__PURE__ */ React.createElement(Box$2, { className: centered }, /* @__PURE__ */ React.createElement(Typography, { className: text }, 5 - row)), riskMatrix[0].map((_2, col) => /* @__PURE__ */ React.createElement(
2493
2501
  Box$2,
2494
2502
  {
2495
2503
  className: `${square} ${centered}`,
2496
- style: { backgroundColor: riskMatrix[row][col] }
2504
+ style: { backgroundColor: riskMatrix[row][col] },
2505
+ key: col
2497
2506
  },
2498
2507
  /* @__PURE__ */ React.createElement(
2499
2508
  RiskMatrixScenarioCount,
@@ -2504,7 +2513,7 @@ const RiskMatrix = ({ riSc }) => {
2504
2513
  initialRisk: tab === "initialRisk" /* initialRisk */
2505
2514
  }
2506
2515
  )
2507
- )))), /* @__PURE__ */ React.createElement(Box$2, { className: centered }), /* @__PURE__ */ React.createElement(Box$2, { className: centered }), riskMatrix.map((_, col) => /* @__PURE__ */ React.createElement(Box$2, { className: centered }, /* @__PURE__ */ React.createElement(Typography, { className: text }, col + 1))), /* @__PURE__ */ React.createElement(Box$2, { className: sannsynlighet }, /* @__PURE__ */ React.createElement(Typography, { className: `${centered} ${label2}` }, t("dictionary.probability")))))));
2516
+ )))), /* @__PURE__ */ React.createElement(Box$2, { className: centered }), /* @__PURE__ */ React.createElement(Box$2, { className: centered }), riskMatrix.map((_, col) => /* @__PURE__ */ React.createElement(Box$2, { className: centered, key: col }, /* @__PURE__ */ React.createElement(Typography, { className: text }, col + 1))), /* @__PURE__ */ React.createElement(Box$2, { className: sannsynlighet }, /* @__PURE__ */ React.createElement(Typography, { className: `${centered} ${label2}` }, t("dictionary.probability")))))));
2508
2517
  };
2509
2518
 
2510
2519
  const useTableStyles = makeStyles((theme) => ({
@@ -3159,4 +3168,4 @@ const RiScPlugin = () => {
3159
3168
  };
3160
3169
 
3161
3170
  export { RiScPlugin };
3162
- //# sourceMappingURL=index-2ef3f54b.esm.js.map
3171
+ //# sourceMappingURL=index-28348a2f.esm.js.map