@kartverket/backstage-plugin-risk-scorecard 1.0.9 → 1.0.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.
- package/dist/esm/{index-28348a2f.esm.js → index-55c3e55b.esm.js} +152 -106
- package/dist/esm/index-55c3e55b.esm.js.map +1 -0
- package/dist/esm/{index-558ec32a.esm.js → index-f0f7d618.esm.js} +35 -43
- package/dist/esm/index-f0f7d618.esm.js.map +1 -0
- package/dist/index.esm.js +1 -1
- package/package.json +4 -2
- package/dist/esm/index-28348a2f.esm.js.map +0 -1
- package/dist/esm/index-558ec32a.esm.js.map +0 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import React, { useState, useEffect, createContext, useContext, Fragment, useRef } from 'react';
|
|
2
|
-
import { makeStyles, FormControl, FormLabel, FormHelperText, TextField as TextField$1, Grid, Typography, Box as Box$1, Paper, Button, Radio, CircularProgress, Dialog, DialogTitle, DialogActions, Stepper, Step, StepButton, Divider as Divider$1, Drawer, List, ListSubheader, ListItem, ListItemText as ListItemText$1, ClickAwayListener, Tooltip, DialogContent, DialogContentText, IconButton, Tab } from '@material-ui/core';
|
|
3
|
-
import { InfoCard, ContentHeader } from '@backstage/core-components';
|
|
1
|
+
import React, { useState, useEffect, useCallback, createContext, useContext, Fragment, useRef } from 'react';
|
|
2
|
+
import { makeStyles, FormControl, FormLabel, FormHelperText, TextField as TextField$1, Grid, Typography, Box as Box$1, useTheme, Paper, Button, Radio, CircularProgress, Dialog, DialogTitle, DialogActions, Stepper, Step, StepButton, Divider as Divider$1, Drawer, List, ListSubheader, ListItem, ListItemText as ListItemText$1, ClickAwayListener, Tooltip, DialogContent, DialogContentText, IconButton, Tab } from '@material-ui/core';
|
|
3
|
+
import { InfoCard, ContentHeader, SupportButton } 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-
|
|
6
|
+
import { s as scenarioRouteRef, r as riScRouteRef, p as pluginRiScTranslationRef } from './index-f0f7d618.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';
|
|
@@ -25,8 +25,9 @@ import { LocalizationProvider, DatePicker } from '@mui/x-date-pickers';
|
|
|
25
25
|
import { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFnsV3';
|
|
26
26
|
import { nb } from 'date-fns/locale/nb';
|
|
27
27
|
import Button$1 from '@mui/material/Button';
|
|
28
|
-
import { KeyboardArrowLeft, KeyboardArrowRight } from '@material-ui/icons';
|
|
29
28
|
import Alert from '@mui/material/Alert';
|
|
29
|
+
import KeyboardArrowRight from '@material-ui/icons/KeyboardArrowRight';
|
|
30
|
+
import KeyboardArrowLeft from '@material-ui/icons/KeyboardArrowLeft';
|
|
30
31
|
import Box$2 from '@mui/material/Box';
|
|
31
32
|
import KeyboardDoubleArrowRightIcon from '@mui/icons-material/KeyboardDoubleArrowRight';
|
|
32
33
|
import EditIcon from '@mui/icons-material/Edit';
|
|
@@ -470,19 +471,24 @@ const requiresNewApproval = (oldRiSc, updatedRiSc) => {
|
|
|
470
471
|
return requiresApproval;
|
|
471
472
|
};
|
|
472
473
|
function formatNumber(cost, t) {
|
|
473
|
-
|
|
474
|
-
return formatNOK(cost);
|
|
475
|
-
} else {
|
|
476
|
-
let { threshold, unit } = [
|
|
477
|
-
{ threshold: 1e6, unit: "thousand" },
|
|
478
|
-
{ threshold: 1e9, unit: "million" },
|
|
479
|
-
{ threshold: 1e12, unit: "billion" },
|
|
480
|
-
{ threshold: 1e15, unit: "trillion" }
|
|
481
|
-
].find(({ threshold: threshold2 }) => cost < threshold2);
|
|
474
|
+
function getTranslationWithCorrectUnit(costValue, threshold, unit) {
|
|
482
475
|
return t(`riskMatrix.estimatedRisk.suffix.${unit}`, {
|
|
483
|
-
count: Number((
|
|
476
|
+
count: Number((costValue / threshold * 1e3).toFixed(0))
|
|
484
477
|
});
|
|
485
478
|
}
|
|
479
|
+
if (cost < 1e4) {
|
|
480
|
+
return formatNOK(cost);
|
|
481
|
+
}
|
|
482
|
+
if (cost < 1e6) {
|
|
483
|
+
return getTranslationWithCorrectUnit(cost, 1e6, "thousand");
|
|
484
|
+
}
|
|
485
|
+
if (cost < 1e9) {
|
|
486
|
+
return getTranslationWithCorrectUnit(cost, 1e9, "million");
|
|
487
|
+
}
|
|
488
|
+
if (cost < 1e12) {
|
|
489
|
+
return getTranslationWithCorrectUnit(cost, 1e12, "billion");
|
|
490
|
+
}
|
|
491
|
+
return getTranslationWithCorrectUnit(cost, 1e15, "trillion");
|
|
486
492
|
}
|
|
487
493
|
|
|
488
494
|
function dtoToRiSc(riScDTO) {
|
|
@@ -749,7 +755,7 @@ const useScenarioDrawer = (riSc, updateRiSc, scenarioIdFromParams) => {
|
|
|
749
755
|
setOriginalScenario(selectedScenario);
|
|
750
756
|
setScenarioDrawerState(2 /* View */);
|
|
751
757
|
}
|
|
752
|
-
}, [riSc, scenarioIdFromParams]);
|
|
758
|
+
}, [getRiScPath, isNewScenario, navigate, riSc, scenarioIdFromParams, setSearchParams]);
|
|
753
759
|
const openScenario = (id) => {
|
|
754
760
|
if (riSc) {
|
|
755
761
|
navigate(getScenarioPath({ riScId: riSc.id, scenarioId: id }));
|
|
@@ -943,7 +949,7 @@ const useFetchRiScs = (riScIdFromParams) => {
|
|
|
943
949
|
status: ProcessingStatus.ErrorWhenFetchingRiScs
|
|
944
950
|
});
|
|
945
951
|
}
|
|
946
|
-
}, [location]);
|
|
952
|
+
}, [location, setResponse]);
|
|
947
953
|
useEffectOnce(() => {
|
|
948
954
|
fetchRiScs(
|
|
949
955
|
(res) => {
|
|
@@ -983,11 +989,13 @@ const useFetchRiScs = (riScIdFromParams) => {
|
|
|
983
989
|
}
|
|
984
990
|
}
|
|
985
991
|
}, [riScs, riScIdFromParams]);
|
|
986
|
-
const resetRiScStatus = () =>
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
992
|
+
const resetRiScStatus = useCallback(() => {
|
|
993
|
+
setUpdateRiScStatus({
|
|
994
|
+
isLoading: false,
|
|
995
|
+
isSuccess: false,
|
|
996
|
+
isError: false
|
|
997
|
+
});
|
|
998
|
+
}, []);
|
|
991
999
|
const selectRiSc = (title) => {
|
|
992
1000
|
var _a;
|
|
993
1001
|
const riScId = (_a = riScs == null ? void 0 : riScs.find((riSc) => riSc.content.title === title)) == null ? void 0 : _a.id;
|
|
@@ -1363,8 +1371,7 @@ const ScenarioStep = () => {
|
|
|
1363
1371
|
xs: 12,
|
|
1364
1372
|
style: {
|
|
1365
1373
|
display: "flex",
|
|
1366
|
-
flexDirection: "column"
|
|
1367
|
-
justifyContent: "space-between"
|
|
1374
|
+
flexDirection: "column"
|
|
1368
1375
|
}
|
|
1369
1376
|
},
|
|
1370
1377
|
/* @__PURE__ */ React.createElement(Box$1, null, /* @__PURE__ */ React.createElement(Typography, { className: label }, t("dictionary.threatActors")), /* @__PURE__ */ React.createElement(Typography, { className: labelSubtitle }, t("scenarioDrawer.threatActorSubtitle"))),
|
|
@@ -1384,8 +1391,7 @@ const ScenarioStep = () => {
|
|
|
1384
1391
|
xs: 12,
|
|
1385
1392
|
style: {
|
|
1386
1393
|
display: "flex",
|
|
1387
|
-
flexDirection: "column"
|
|
1388
|
-
justifyContent: "space-between"
|
|
1394
|
+
flexDirection: "column"
|
|
1389
1395
|
}
|
|
1390
1396
|
},
|
|
1391
1397
|
/* @__PURE__ */ React.createElement(Box$1, null, /* @__PURE__ */ React.createElement(Typography, { className: label }, t("dictionary.vulnerabilities")), /* @__PURE__ */ React.createElement(Typography, { className: labelSubtitle }, t("scenarioDrawer.vulnerabilitySubtitle"))),
|
|
@@ -1417,6 +1423,7 @@ const ActionEdit = ({
|
|
|
1417
1423
|
const { t } = useTranslationRef(pluginRiScTranslationRef);
|
|
1418
1424
|
const { paper, formControl } = useInputFieldStyles();
|
|
1419
1425
|
const { label, labelSubtitle } = useFontStyles();
|
|
1426
|
+
const theme = useTheme();
|
|
1420
1427
|
const setDescription = (description) => updateAction({
|
|
1421
1428
|
...action,
|
|
1422
1429
|
description
|
|
@@ -1516,7 +1523,29 @@ const ActionEdit = ({
|
|
|
1516
1523
|
}
|
|
1517
1524
|
},
|
|
1518
1525
|
/* @__PURE__ */ React.createElement(Typography, { className: label }, t("dictionary.deadline")),
|
|
1519
|
-
/* @__PURE__ */ React.createElement(FormControl$1, { className: formControl }, /* @__PURE__ */ React.createElement(LocalizationProvider, { dateAdapter: AdapterDateFns, adapterLocale: nb }, /* @__PURE__ */ React.createElement(
|
|
1526
|
+
/* @__PURE__ */ React.createElement(FormControl$1, { className: formControl }, /* @__PURE__ */ React.createElement(LocalizationProvider, { dateAdapter: AdapterDateFns, adapterLocale: nb }, /* @__PURE__ */ React.createElement(
|
|
1527
|
+
DatePicker,
|
|
1528
|
+
{
|
|
1529
|
+
value: action.deadline,
|
|
1530
|
+
onChange: setDeadline,
|
|
1531
|
+
sx: {
|
|
1532
|
+
".MuiInputBase-root": {
|
|
1533
|
+
color: theme.palette.type === "dark" ? "white" : "black"
|
|
1534
|
+
},
|
|
1535
|
+
".MuiOutlinedInput-notchedOutline": {
|
|
1536
|
+
borderColor: theme.palette.type === "dark" ? "#616161" : "#0000003b"
|
|
1537
|
+
},
|
|
1538
|
+
".MuiOutlinedInput-root": {
|
|
1539
|
+
"&:hover .MuiOutlinedInput-notchedOutline": {
|
|
1540
|
+
borderColor: theme.palette.type === "dark" ? "white" : "black"
|
|
1541
|
+
}
|
|
1542
|
+
},
|
|
1543
|
+
".MuiIconButton-root": {
|
|
1544
|
+
color: theme.palette.type === "dark" ? "white" : "black"
|
|
1545
|
+
}
|
|
1546
|
+
}
|
|
1547
|
+
}
|
|
1548
|
+
)))
|
|
1520
1549
|
)));
|
|
1521
1550
|
};
|
|
1522
1551
|
|
|
@@ -1542,6 +1571,7 @@ const ActionsStep = () => {
|
|
|
1542
1571
|
)), /* @__PURE__ */ React.createElement(Typography, { variant: "h6", className: actionSubtitle }, t("scenarioDrawer.measureTab.plannedMeasures")), scenario.actions.map((action, index) => /* @__PURE__ */ React.createElement(
|
|
1543
1572
|
ActionEdit,
|
|
1544
1573
|
{
|
|
1574
|
+
key: action.ID,
|
|
1545
1575
|
action,
|
|
1546
1576
|
index: index + 1,
|
|
1547
1577
|
updateAction,
|
|
@@ -1663,11 +1693,11 @@ const RiskStep = ({ riskType, restEqualsInitial }) => {
|
|
|
1663
1693
|
useEffect(() => {
|
|
1664
1694
|
if (restEqualsInitial)
|
|
1665
1695
|
setRemainingConsequence(getConsequenceLevel(scenario.risk));
|
|
1666
|
-
}, [scenario.risk.consequence]);
|
|
1696
|
+
}, [restEqualsInitial, scenario.risk, scenario.risk.consequence, setRemainingConsequence]);
|
|
1667
1697
|
useEffect(() => {
|
|
1668
1698
|
if (restEqualsInitial)
|
|
1669
1699
|
setRemainingProbability(getProbabilityLevel(scenario.risk));
|
|
1670
|
-
}, [scenario.risk.probability]);
|
|
1700
|
+
}, [restEqualsInitial, scenario.risk, scenario.risk.probability, setRemainingProbability]);
|
|
1671
1701
|
const setC = riskType === "initial" ? setConsequence : setRemainingConsequence;
|
|
1672
1702
|
const setP = riskType === "initial" ? setProbability : setRemainingProbability;
|
|
1673
1703
|
return /* @__PURE__ */ React.createElement(Fragment, null, /* @__PURE__ */ React.createElement(Box, { className: box }, /* @__PURE__ */ React.createElement(Typography, { className: h2 }, t(`scenarioStepper.${resourceKey}.title`)), /* @__PURE__ */ React.createElement(Typography, { className: subtitle2 }, t(`scenarioStepper.${resourceKey}.subtitle`))), /* @__PURE__ */ React.createElement(Box, { className: box }, /* @__PURE__ */ React.createElement(Typography, { className: h3 }, t("dictionary.probability")), /* @__PURE__ */ React.createElement(Typography, { className: subtitle2 }, t(`scenarioStepper.${resourceKey}.probabilitySubtitle`))), /* @__PURE__ */ React.createElement(Box, { className: box }, /* @__PURE__ */ React.createElement(
|
|
@@ -1736,7 +1766,7 @@ const CloseConfirmation = ({
|
|
|
1736
1766
|
return /* @__PURE__ */ React.createElement(Dialog, { open: isOpen }, /* @__PURE__ */ React.createElement(DialogTitle, null, t("scenarioDrawer.closeConfirmation")), /* @__PURE__ */ React.createElement(DialogActions, null, /* @__PURE__ */ React.createElement(Button, { style: { textTransform: "none" }, onClick: close }, t("dictionary.discardChanges")), /* @__PURE__ */ React.createElement(Button, { style: { textTransform: "none" }, onClick: save }, t("dictionary.save"))));
|
|
1737
1767
|
};
|
|
1738
1768
|
|
|
1739
|
-
const
|
|
1769
|
+
const scenarioWizardSteps = [
|
|
1740
1770
|
"scenario",
|
|
1741
1771
|
"initialRisk",
|
|
1742
1772
|
"measure",
|
|
@@ -1775,6 +1805,10 @@ const ScenarioWizard = ({
|
|
|
1775
1805
|
if (step === "restRisk")
|
|
1776
1806
|
setRestEqualsInitial(false);
|
|
1777
1807
|
}, [step]);
|
|
1808
|
+
const close = useCallback(() => {
|
|
1809
|
+
closeScenario();
|
|
1810
|
+
setShowCloseConfirmation(false);
|
|
1811
|
+
}, [closeScenario]);
|
|
1778
1812
|
useEffect(() => {
|
|
1779
1813
|
if (updateStatus.isSuccess) {
|
|
1780
1814
|
close();
|
|
@@ -1782,11 +1816,7 @@ const ScenarioWizard = ({
|
|
|
1782
1816
|
setShowCloseConfirmation(false);
|
|
1783
1817
|
wizardRef.current.scrollIntoView({ behavior: "smooth", block: "end" });
|
|
1784
1818
|
}
|
|
1785
|
-
}, [updateStatus]);
|
|
1786
|
-
const close = () => {
|
|
1787
|
-
closeScenario();
|
|
1788
|
-
setShowCloseConfirmation(false);
|
|
1789
|
-
};
|
|
1819
|
+
}, [close, updateStatus]);
|
|
1790
1820
|
const saveAndClose = () => {
|
|
1791
1821
|
saveScenario();
|
|
1792
1822
|
};
|
|
@@ -1800,32 +1830,32 @@ const ScenarioWizard = ({
|
|
|
1800
1830
|
const nextStep = () => {
|
|
1801
1831
|
const isValidScenario = validateScenario();
|
|
1802
1832
|
if (isValidScenario) {
|
|
1803
|
-
const currentIndex =
|
|
1804
|
-
if (currentIndex <
|
|
1805
|
-
editScenario(
|
|
1833
|
+
const currentIndex = scenarioWizardSteps.indexOf(step);
|
|
1834
|
+
if (currentIndex < scenarioWizardSteps.length - 1) {
|
|
1835
|
+
editScenario(scenarioWizardSteps[currentIndex + 1]);
|
|
1806
1836
|
}
|
|
1807
1837
|
}
|
|
1808
1838
|
};
|
|
1809
1839
|
const previousStep = () => {
|
|
1810
|
-
const currentIndex =
|
|
1840
|
+
const currentIndex = scenarioWizardSteps.indexOf(step);
|
|
1811
1841
|
if (currentIndex > 0) {
|
|
1812
|
-
editScenario(
|
|
1842
|
+
editScenario(scenarioWizardSteps[currentIndex - 1]);
|
|
1813
1843
|
}
|
|
1814
1844
|
};
|
|
1815
1845
|
const isFirstStep = () => {
|
|
1816
|
-
return
|
|
1846
|
+
return scenarioWizardSteps.indexOf(step) === 0;
|
|
1817
1847
|
};
|
|
1818
1848
|
const isLastStep = () => {
|
|
1819
|
-
return
|
|
1849
|
+
return scenarioWizardSteps.indexOf(step) === scenarioWizardSteps.length - 1;
|
|
1820
1850
|
};
|
|
1821
1851
|
return /* @__PURE__ */ React.createElement("div", { ref: wizardRef }, /* @__PURE__ */ React.createElement(Box, { className: root }, /* @__PURE__ */ React.createElement(Box, { className: container }, /* @__PURE__ */ React.createElement(Box, { className: header }, /* @__PURE__ */ React.createElement(Typography, { className: h1 }, t("scenarioDrawer.title")), /* @__PURE__ */ React.createElement(Button$1, { variant: "outlined", onClick: handleCloseStepper }, t("dictionary.cancel"))), /* @__PURE__ */ React.createElement(
|
|
1822
1852
|
Stepper,
|
|
1823
1853
|
{
|
|
1824
1854
|
className: stepper,
|
|
1825
|
-
activeStep:
|
|
1855
|
+
activeStep: scenarioWizardSteps.indexOf(step),
|
|
1826
1856
|
alternativeLabel: true
|
|
1827
1857
|
},
|
|
1828
|
-
|
|
1858
|
+
scenarioWizardSteps.map((wizardStep) => /* @__PURE__ */ React.createElement(Step, { key: wizardStep, completed: false }, /* @__PURE__ */ React.createElement(
|
|
1829
1859
|
StepButton,
|
|
1830
1860
|
{
|
|
1831
1861
|
disabled: false,
|
|
@@ -1840,16 +1870,16 @@ const ScenarioWizard = ({
|
|
|
1840
1870
|
" "
|
|
1841
1871
|
)))
|
|
1842
1872
|
), /* @__PURE__ */ React.createElement(Divider, null), isFetching ? /* @__PURE__ */ React.createElement(Spinner, { size: 80 }) : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Box, { className: steps }, {
|
|
1843
|
-
[
|
|
1844
|
-
[
|
|
1873
|
+
[scenarioWizardSteps[0]]: /* @__PURE__ */ React.createElement(ScenarioStep, null),
|
|
1874
|
+
[scenarioWizardSteps[1]]: /* @__PURE__ */ React.createElement(
|
|
1845
1875
|
RiskStep,
|
|
1846
1876
|
{
|
|
1847
1877
|
riskType: "initial",
|
|
1848
1878
|
restEqualsInitial
|
|
1849
1879
|
}
|
|
1850
1880
|
),
|
|
1851
|
-
[
|
|
1852
|
-
[
|
|
1881
|
+
[scenarioWizardSteps[2]]: /* @__PURE__ */ React.createElement(ActionsStep, null),
|
|
1882
|
+
[scenarioWizardSteps[3]]: /* @__PURE__ */ React.createElement(RiskStep, { riskType: "rest" })
|
|
1853
1883
|
}[step]), updateStatus.isError && /* @__PURE__ */ React.createElement(Alert, { style: { marginBottom: "1rem" }, severity: "error" }, /* @__PURE__ */ React.createElement(Typography, null, t("dictionary.saveError"))), /* @__PURE__ */ React.createElement(
|
|
1854
1884
|
Box,
|
|
1855
1885
|
{
|
|
@@ -2497,19 +2527,19 @@ const RiskMatrix = ({ riSc }) => {
|
|
|
2497
2527
|
riSc,
|
|
2498
2528
|
initialRisk: tab === "initialRisk" /* initialRisk */
|
|
2499
2529
|
}
|
|
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((
|
|
2530
|
+
)), /* @__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, rowIndex) => /* @__PURE__ */ React.createElement(Fragment, { key: rowIndex }, /* @__PURE__ */ React.createElement(Box$2, { className: centered }, /* @__PURE__ */ React.createElement(Typography, { className: text }, 5 - rowIndex)), row.map((col, colIndex) => /* @__PURE__ */ React.createElement(
|
|
2501
2531
|
Box$2,
|
|
2502
2532
|
{
|
|
2503
2533
|
className: `${square} ${centered}`,
|
|
2504
|
-
style: { backgroundColor:
|
|
2505
|
-
key:
|
|
2534
|
+
style: { backgroundColor: col },
|
|
2535
|
+
key: colIndex
|
|
2506
2536
|
},
|
|
2507
2537
|
/* @__PURE__ */ React.createElement(
|
|
2508
2538
|
RiskMatrixScenarioCount,
|
|
2509
2539
|
{
|
|
2510
2540
|
riSc,
|
|
2511
|
-
probability:
|
|
2512
|
-
consequence: 4 -
|
|
2541
|
+
probability: colIndex,
|
|
2542
|
+
consequence: 4 - rowIndex,
|
|
2513
2543
|
initialRisk: tab === "initialRisk" /* initialRisk */
|
|
2514
2544
|
}
|
|
2515
2545
|
)
|
|
@@ -2521,7 +2551,9 @@ const useTableStyles = makeStyles((theme) => ({
|
|
|
2521
2551
|
display: "flex",
|
|
2522
2552
|
alignItems: "center",
|
|
2523
2553
|
justifyContent: "center",
|
|
2524
|
-
padding: theme.spacing(1)
|
|
2554
|
+
padding: theme.spacing(1),
|
|
2555
|
+
width: theme.spacing(1),
|
|
2556
|
+
height: theme.spacing(1)
|
|
2525
2557
|
},
|
|
2526
2558
|
rowBackground: {
|
|
2527
2559
|
display: "flex",
|
|
@@ -2530,7 +2562,8 @@ const useTableStyles = makeStyles((theme) => ({
|
|
|
2530
2562
|
border: "none",
|
|
2531
2563
|
padding: 0,
|
|
2532
2564
|
"&.MuiTableRow-root": {
|
|
2533
|
-
backgroundColor: theme.palette.type === "dark" ? "#424242" : "white"
|
|
2565
|
+
backgroundColor: theme.palette.type === "dark" ? "#424242" : "white",
|
|
2566
|
+
border: "none"
|
|
2534
2567
|
},
|
|
2535
2568
|
transition: "background-color 0.3s",
|
|
2536
2569
|
"&:hover": {
|
|
@@ -2546,15 +2579,37 @@ const useTableStyles = makeStyles((theme) => ({
|
|
|
2546
2579
|
rowBorder: {
|
|
2547
2580
|
display: "flex",
|
|
2548
2581
|
alignItems: "center",
|
|
2549
|
-
|
|
2582
|
+
"&.MuiTableRow-root": {
|
|
2583
|
+
borderBottom: theme.palette.type === "dark" ? "1px solid #616161" : "1px solid #0000001f"
|
|
2584
|
+
}
|
|
2550
2585
|
},
|
|
2551
2586
|
tableCell: {
|
|
2587
|
+
minWidth: "120px",
|
|
2588
|
+
padding: "20px 10px 20px 16px",
|
|
2589
|
+
width: "15%",
|
|
2590
|
+
gap: "0.4rem",
|
|
2591
|
+
"&.MuiTableCell-root": {
|
|
2592
|
+
fontSize: theme.spacing(2),
|
|
2593
|
+
color: theme.palette.type === "dark" ? "#F8F8F8" : "rgba(0, 0, 0, 0.87)",
|
|
2594
|
+
border: "none"
|
|
2595
|
+
}
|
|
2596
|
+
},
|
|
2597
|
+
tableCellTitle: {
|
|
2552
2598
|
display: "flex",
|
|
2553
|
-
width: "20%",
|
|
2554
2599
|
minWidth: "120px",
|
|
2555
2600
|
padding: "20px 10px 20px 16px",
|
|
2556
2601
|
gap: "0.4rem",
|
|
2557
|
-
|
|
2602
|
+
width: "55%",
|
|
2603
|
+
"&.MuiTableCell-root": {
|
|
2604
|
+
fontSize: theme.spacing(2),
|
|
2605
|
+
color: theme.palette.type === "dark" ? "#F8F8F8" : "rgba(0, 0, 0, 0.87)",
|
|
2606
|
+
border: "none"
|
|
2607
|
+
}
|
|
2608
|
+
},
|
|
2609
|
+
tableCellContainer: {
|
|
2610
|
+
display: "flex",
|
|
2611
|
+
gap: theme.spacing(1),
|
|
2612
|
+
alignItems: "center"
|
|
2558
2613
|
}
|
|
2559
2614
|
}));
|
|
2560
2615
|
|
|
@@ -2564,7 +2619,14 @@ const ScenarioTableRow = ({
|
|
|
2564
2619
|
isLastRow
|
|
2565
2620
|
}) => {
|
|
2566
2621
|
const { t } = useTranslationRef(pluginRiScTranslationRef);
|
|
2567
|
-
const {
|
|
2622
|
+
const {
|
|
2623
|
+
riskColor,
|
|
2624
|
+
rowBackground,
|
|
2625
|
+
rowBorder,
|
|
2626
|
+
tableCell,
|
|
2627
|
+
tableCellTitle,
|
|
2628
|
+
tableCellContainer
|
|
2629
|
+
} = useTableStyles();
|
|
2568
2630
|
const remainingActions = scenario.actions.filter(
|
|
2569
2631
|
(a) => a.status !== "Completed"
|
|
2570
2632
|
);
|
|
@@ -2574,18 +2636,8 @@ const ScenarioTableRow = ({
|
|
|
2574
2636
|
className: `${isLastRow ? void 0 : rowBorder} ${rowBackground}`,
|
|
2575
2637
|
onClick: () => viewRow(scenario.ID)
|
|
2576
2638
|
},
|
|
2577
|
-
/* @__PURE__ */ React.createElement(
|
|
2578
|
-
|
|
2579
|
-
{
|
|
2580
|
-
className: tableCell,
|
|
2581
|
-
style: {
|
|
2582
|
-
width: "40%",
|
|
2583
|
-
minWidth: "200px"
|
|
2584
|
-
}
|
|
2585
|
-
},
|
|
2586
|
-
/* @__PURE__ */ React.createElement(Typography, { color: "primary", style: { fontWeight: 600 } }, scenario.title)
|
|
2587
|
-
),
|
|
2588
|
-
/* @__PURE__ */ React.createElement(TableCell, { className: tableCell }, /* @__PURE__ */ React.createElement(
|
|
2639
|
+
/* @__PURE__ */ React.createElement(TableCell, { className: tableCellTitle }, /* @__PURE__ */ React.createElement(Typography, { color: "primary", style: { fontWeight: 600 } }, scenario.title)),
|
|
2640
|
+
/* @__PURE__ */ React.createElement(TableCell, { className: tableCell }, /* @__PURE__ */ React.createElement("div", { className: tableCellContainer }, /* @__PURE__ */ React.createElement(
|
|
2589
2641
|
Paper,
|
|
2590
2642
|
{
|
|
2591
2643
|
className: riskColor,
|
|
@@ -2593,9 +2645,9 @@ const ScenarioTableRow = ({
|
|
|
2593
2645
|
backgroundColor: getRiskMatrixColor(scenario.risk)
|
|
2594
2646
|
}
|
|
2595
2647
|
}
|
|
2596
|
-
), t("scenarioTable.columns.probabilityChar"), ":", getProbabilityLevel(scenario.risk), " ", t("scenarioTable.columns.consequenceChar"), ":", getConsequenceLevel(scenario.risk)),
|
|
2597
|
-
/* @__PURE__ */ React.createElement(TableCell, { className: tableCell }, remainingActions.length > 0 ? /* @__PURE__ */ React.createElement(React.Fragment, null, remainingActions.length, " ", t("dictionary.planned").toLowerCase()) : t("dictionary.completed")),
|
|
2598
|
-
/* @__PURE__ */ React.createElement(TableCell, { className: tableCell }, /* @__PURE__ */ React.createElement(
|
|
2648
|
+
), t("scenarioTable.columns.probabilityChar"), ":", getProbabilityLevel(scenario.risk), " ", t("scenarioTable.columns.consequenceChar"), ":", getConsequenceLevel(scenario.risk))),
|
|
2649
|
+
/* @__PURE__ */ React.createElement(TableCell, { className: tableCell }, /* @__PURE__ */ React.createElement("div", { className: tableCellContainer }, remainingActions.length > 0 ? /* @__PURE__ */ React.createElement(React.Fragment, null, remainingActions.length, " ", t("dictionary.planned").toLowerCase()) : t("dictionary.completed"))),
|
|
2650
|
+
/* @__PURE__ */ React.createElement(TableCell, { className: tableCell }, /* @__PURE__ */ React.createElement("div", { className: tableCellContainer }, /* @__PURE__ */ React.createElement(
|
|
2599
2651
|
Paper,
|
|
2600
2652
|
{
|
|
2601
2653
|
className: riskColor,
|
|
@@ -2603,13 +2655,13 @@ const ScenarioTableRow = ({
|
|
|
2603
2655
|
backgroundColor: getRiskMatrixColor(scenario.remainingRisk)
|
|
2604
2656
|
}
|
|
2605
2657
|
}
|
|
2606
|
-
), t("scenarioTable.columns.probabilityChar"), ":", getProbabilityLevel(scenario.remainingRisk), " ", t("scenarioTable.columns.consequenceChar"), ":", getConsequenceLevel(scenario.remainingRisk))
|
|
2658
|
+
), t("scenarioTable.columns.probabilityChar"), ":", getProbabilityLevel(scenario.remainingRisk), " ", t("scenarioTable.columns.consequenceChar"), ":", getConsequenceLevel(scenario.remainingRisk)))
|
|
2607
2659
|
);
|
|
2608
2660
|
};
|
|
2609
2661
|
|
|
2610
2662
|
const ScenarioTable = ({ riSc }) => {
|
|
2611
2663
|
const { t } = useTranslationRef(pluginRiScTranslationRef);
|
|
2612
|
-
const { titleBox, rowBorder, tableCell } = useTableStyles();
|
|
2664
|
+
const { titleBox, rowBorder, tableCell, tableCellTitle } = useTableStyles();
|
|
2613
2665
|
const { newScenario, openScenario } = useContext(ScenarioContext);
|
|
2614
2666
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Paper, null, /* @__PURE__ */ React.createElement(Box$1, { className: titleBox }, /* @__PURE__ */ React.createElement(Typography, { variant: "h5", style: { padding: "1rem" } }, t("scenarioTable.title")), riSc.scenarios.length > 0 && /* @__PURE__ */ React.createElement(
|
|
2615
2667
|
Box$1,
|
|
@@ -2655,24 +2707,14 @@ const ScenarioTable = ({ riSc }) => {
|
|
|
2655
2707
|
},
|
|
2656
2708
|
t("scenarioTable.addScenarioButton")
|
|
2657
2709
|
)
|
|
2658
|
-
) : /* @__PURE__ */ React.createElement(TableContainer, { style: { overflow: "auto" }, component: Paper }, /* @__PURE__ */ React.createElement(Table, null, /* @__PURE__ */ React.createElement(TableHead, null, /* @__PURE__ */ React.createElement(TableRow, { className: rowBorder }, /* @__PURE__ */ React.createElement(
|
|
2659
|
-
|
|
2710
|
+
) : /* @__PURE__ */ React.createElement(TableContainer, { style: { overflow: "auto" }, component: Paper }, /* @__PURE__ */ React.createElement(Table, null, /* @__PURE__ */ React.createElement(TableHead, null, /* @__PURE__ */ React.createElement(TableRow, { className: rowBorder }, /* @__PURE__ */ React.createElement(TableCell, { className: tableCellTitle }, /* @__PURE__ */ React.createElement(
|
|
2711
|
+
Typography,
|
|
2660
2712
|
{
|
|
2661
|
-
|
|
2662
|
-
style: {
|
|
2663
|
-
width: "40%",
|
|
2664
|
-
minWidth: "200px"
|
|
2665
|
-
}
|
|
2713
|
+
variant: "subtitle1",
|
|
2714
|
+
style: { fontWeight: "bold", textTransform: "uppercase" }
|
|
2666
2715
|
},
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
{
|
|
2670
|
-
variant: "subtitle1",
|
|
2671
|
-
style: { fontWeight: "bold", textTransform: "uppercase" }
|
|
2672
|
-
},
|
|
2673
|
-
t("dictionary.title")
|
|
2674
|
-
)
|
|
2675
|
-
), /* @__PURE__ */ React.createElement(TableCell, { className: tableCell }, /* @__PURE__ */ React.createElement(
|
|
2716
|
+
t("dictionary.title")
|
|
2717
|
+
)), /* @__PURE__ */ React.createElement(TableCell, { className: tableCell }, /* @__PURE__ */ React.createElement(
|
|
2676
2718
|
Typography,
|
|
2677
2719
|
{
|
|
2678
2720
|
variant: "subtitle1",
|
|
@@ -2690,7 +2732,10 @@ const ScenarioTable = ({ riSc }) => {
|
|
|
2690
2732
|
Typography,
|
|
2691
2733
|
{
|
|
2692
2734
|
variant: "subtitle1",
|
|
2693
|
-
style: {
|
|
2735
|
+
style: {
|
|
2736
|
+
fontWeight: "bold",
|
|
2737
|
+
textTransform: "uppercase"
|
|
2738
|
+
}
|
|
2694
2739
|
},
|
|
2695
2740
|
t("dictionary.restRisk")
|
|
2696
2741
|
)))), /* @__PURE__ */ React.createElement(TableBody, null, riSc.scenarios.map((scenario, idx) => /* @__PURE__ */ React.createElement(
|
|
@@ -2878,9 +2923,9 @@ const useStatusTextStyles = makeStyles(() => ({
|
|
|
2878
2923
|
wrap: "wrap"
|
|
2879
2924
|
},
|
|
2880
2925
|
prIcon: {
|
|
2881
|
-
fontSize: "12px",
|
|
2882
2926
|
margin: "0px",
|
|
2883
2927
|
padding: "0px",
|
|
2928
|
+
marginBottom: "-1px",
|
|
2884
2929
|
marginRight: "2px",
|
|
2885
2930
|
marginLeft: "2px"
|
|
2886
2931
|
}
|
|
@@ -2897,7 +2942,7 @@ const getChipColor = (status, classes) => {
|
|
|
2897
2942
|
return classes.riScDraft;
|
|
2898
2943
|
}
|
|
2899
2944
|
};
|
|
2900
|
-
const
|
|
2945
|
+
const useChipText = (status) => {
|
|
2901
2946
|
const { t } = useTranslationRef(pluginRiScTranslationRef);
|
|
2902
2947
|
switch (status) {
|
|
2903
2948
|
case RiScStatus.Draft:
|
|
@@ -2909,21 +2954,22 @@ const chipText = (status) => {
|
|
|
2909
2954
|
return t("rosStatus.statusBadge.error");
|
|
2910
2955
|
}
|
|
2911
2956
|
};
|
|
2912
|
-
|
|
2957
|
+
function ChipTextStatus({ status }) {
|
|
2913
2958
|
const { statusChipText } = useStatusChipStyles();
|
|
2914
|
-
|
|
2915
|
-
};
|
|
2916
|
-
|
|
2959
|
+
const chipText = useChipText(status);
|
|
2960
|
+
return /* @__PURE__ */ React.createElement("span", { className: statusChipText }, chipText);
|
|
2961
|
+
}
|
|
2962
|
+
function PRStatus({ status, classes }) {
|
|
2917
2963
|
const { t } = useTranslationRef(pluginRiScTranslationRef);
|
|
2918
2964
|
switch (status) {
|
|
2919
2965
|
case RiScStatus.SentForApproval:
|
|
2920
|
-
return /* @__PURE__ */ React.createElement(Typography, { className: classes.prStatus }, /* @__PURE__ */ React.createElement(GitHubIcon, { className: classes.prIcon }), t("rosStatus.prStatus"));
|
|
2966
|
+
return /* @__PURE__ */ React.createElement(Typography, { className: classes.prStatus }, /* @__PURE__ */ React.createElement(GitHubIcon, { fontSize: "inherit", className: classes.prIcon }), t("rosStatus.prStatus"));
|
|
2921
2967
|
case RiScStatus.Draft:
|
|
2922
2968
|
case RiScStatus.Published:
|
|
2923
2969
|
default:
|
|
2924
2970
|
return null;
|
|
2925
2971
|
}
|
|
2926
|
-
}
|
|
2972
|
+
}
|
|
2927
2973
|
const StatusChip = ({ currentRiScStatus }) => {
|
|
2928
2974
|
const chipClasses = useStatusChipStyles();
|
|
2929
2975
|
const textClasses = useStatusTextStyles();
|
|
@@ -2946,12 +2992,12 @@ const StatusChip = ({ currentRiScStatus }) => {
|
|
|
2946
2992
|
color: "primary",
|
|
2947
2993
|
size: "medium",
|
|
2948
2994
|
variant: "outlined",
|
|
2949
|
-
label:
|
|
2995
|
+
label: /* @__PURE__ */ React.createElement(ChipTextStatus, { status: currentRiScStatus }),
|
|
2950
2996
|
icon: /* @__PURE__ */ React.createElement(CircleIcon$1, { className: chipClasses.statusIcon }),
|
|
2951
2997
|
className: [chipColorClass, chipClasses.statusChip].join(" ")
|
|
2952
2998
|
}
|
|
2953
2999
|
)),
|
|
2954
|
-
/* @__PURE__ */ React.createElement(Grid, { item: true },
|
|
3000
|
+
/* @__PURE__ */ React.createElement(Grid, { item: true }, /* @__PURE__ */ React.createElement(PRStatus, { status: currentRiScStatus, classes: textClasses }))
|
|
2955
3001
|
);
|
|
2956
3002
|
};
|
|
2957
3003
|
|
|
@@ -3105,7 +3151,7 @@ const Plugin = () => {
|
|
|
3105
3151
|
useEffect(() => {
|
|
3106
3152
|
if (scenarioWizardStep !== null)
|
|
3107
3153
|
resetRiScStatus();
|
|
3108
|
-
}, [scenarioWizardStep]);
|
|
3154
|
+
}, [resetRiScStatus, scenarioWizardStep]);
|
|
3109
3155
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(ScenarioContext.Provider, { value: scenario }, response && /* @__PURE__ */ React.createElement(Alert, { severity: getAlertSeverity(response.status) }, /* @__PURE__ */ React.createElement(Typography, null, response.statusMessage)), scenarioWizardStep !== null ? /* @__PURE__ */ React.createElement(
|
|
3110
3156
|
ScenarioWizard,
|
|
3111
3157
|
{
|
|
@@ -3113,7 +3159,7 @@ const Plugin = () => {
|
|
|
3113
3159
|
isFetching,
|
|
3114
3160
|
updateStatus: updateRiScStatus
|
|
3115
3161
|
}
|
|
3116
|
-
) : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(ContentHeader, { title: t("contentHeader.title") }), isFetching && /* @__PURE__ */ React.createElement(Spinner, { size: 80 }), /* @__PURE__ */ React.createElement(Grid, { container: true, spacing: 4 }, riScs !== null && riScs.length !== 0 && /* @__PURE__ */ React.createElement(
|
|
3162
|
+
) : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(ContentHeader, { title: t("contentHeader.title") }, /* @__PURE__ */ React.createElement(SupportButton, null)), isFetching && /* @__PURE__ */ React.createElement(Spinner, { size: 80 }), /* @__PURE__ */ React.createElement(Grid, { container: true, spacing: 4 }, riScs !== null && riScs.length !== 0 && /* @__PURE__ */ React.createElement(
|
|
3117
3163
|
Grid,
|
|
3118
3164
|
{
|
|
3119
3165
|
item: true,
|
|
@@ -3168,4 +3214,4 @@ const RiScPlugin = () => {
|
|
|
3168
3214
|
};
|
|
3169
3215
|
|
|
3170
3216
|
export { RiScPlugin };
|
|
3171
|
-
//# sourceMappingURL=index-
|
|
3217
|
+
//# sourceMappingURL=index-55c3e55b.esm.js.map
|