@kartverket/backstage-plugin-risk-scorecard 1.0.5 → 1.0.6
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-fd361b7d.esm.js → index-153cf81f.esm.js} +561 -875
- package/dist/esm/index-153cf81f.esm.js.map +1 -0
- package/dist/esm/{index-c43b6519.esm.js → index-5b89cb4c.esm.js} +2 -2
- package/dist/esm/{index-c43b6519.esm.js.map → index-5b89cb4c.esm.js.map} +1 -1
- package/dist/index.esm.js +1 -1
- package/package.json +2 -2
- package/dist/esm/index-fd361b7d.esm.js.map +0 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
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,
|
|
3
|
-
import { InfoCard, ContentHeader
|
|
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';
|
|
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-5b89cb4c.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';
|
|
@@ -19,31 +19,31 @@ import Select from '@material-ui/core/Select';
|
|
|
19
19
|
import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
|
|
20
20
|
import Divider from '@mui/material/Divider';
|
|
21
21
|
import Grid$1 from '@mui/material/Grid';
|
|
22
|
+
import AddCircle from '@material-ui/icons/AddCircle';
|
|
22
23
|
import DeleteIcon from '@material-ui/icons/Delete';
|
|
23
24
|
import { LocalizationProvider, DatePicker } from '@mui/x-date-pickers';
|
|
24
25
|
import { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFnsV3';
|
|
25
26
|
import { nb } from 'date-fns/locale/nb';
|
|
26
|
-
import AddCircle from '@material-ui/icons/AddCircle';
|
|
27
27
|
import Button$1 from '@mui/material/Button';
|
|
28
28
|
import { KeyboardArrowLeft, KeyboardArrowRight } from '@material-ui/icons';
|
|
29
29
|
import Alert from '@mui/material/Alert';
|
|
30
30
|
import Box$2 from '@mui/material/Box';
|
|
31
|
-
import TabContext from '@material-ui/lab/TabContext';
|
|
32
|
-
import TabList from '@material-ui/lab/TabList/TabList';
|
|
33
|
-
import KeyboardTabIcon from '@mui/icons-material/KeyboardTab';
|
|
34
|
-
import DeleteIcon$1 from '@mui/icons-material/Delete';
|
|
35
|
-
import TabPanel from '@material-ui/lab/TabPanel';
|
|
36
|
-
import AddCircleOutlineIcon from '@material-ui/icons/AddCircleOutline';
|
|
37
31
|
import KeyboardDoubleArrowRightIcon from '@mui/icons-material/KeyboardDoubleArrowRight';
|
|
38
32
|
import EditIcon from '@mui/icons-material/Edit';
|
|
33
|
+
import Menu from '@material-ui/core/Menu';
|
|
34
|
+
import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown';
|
|
35
|
+
import DeleteIcon$1 from '@mui/icons-material/Delete';
|
|
39
36
|
import CircleIcon from '@material-ui/icons/FiberManualRecord';
|
|
40
37
|
import InfoIcon from '@mui/icons-material/Info';
|
|
38
|
+
import TabContext from '@material-ui/lab/TabContext';
|
|
39
|
+
import TabList from '@material-ui/lab/TabList/TabList';
|
|
41
40
|
import TableRow from '@mui/material/TableRow';
|
|
42
41
|
import Table from '@mui/material/Table';
|
|
43
42
|
import TableBody from '@mui/material/TableBody';
|
|
44
43
|
import TableCell from '@mui/material/TableCell';
|
|
45
44
|
import TableContainer from '@mui/material/TableContainer';
|
|
46
45
|
import TableHead from '@mui/material/TableHead';
|
|
46
|
+
import AddCircleOutlineIcon from '@material-ui/icons/AddCircleOutline';
|
|
47
47
|
import CircleIcon$1 from '@mui/icons-material/Circle';
|
|
48
48
|
import GitHubIcon from '@mui/icons-material/GitHub';
|
|
49
49
|
|
|
@@ -404,8 +404,8 @@ function getRiskMatrixColor(risiko) {
|
|
|
404
404
|
const konsekvens = consequenceOptions.indexOf(risiko.consequence);
|
|
405
405
|
return riskMatrix[4 - konsekvens][sannsynlighet];
|
|
406
406
|
}
|
|
407
|
-
const
|
|
408
|
-
const
|
|
407
|
+
const getProbabilityLevel = (risiko) => probabilityOptions.indexOf(risiko.probability) + 1;
|
|
408
|
+
const getConsequenceLevel = (risiko) => consequenceOptions.indexOf(risiko.consequence) + 1;
|
|
409
409
|
const emptyRiSc = () => ({
|
|
410
410
|
schemaVersion: "3.2",
|
|
411
411
|
title: "",
|
|
@@ -432,7 +432,7 @@ const emptyScenario = () => ({
|
|
|
432
432
|
consequence: 1e3
|
|
433
433
|
}
|
|
434
434
|
});
|
|
435
|
-
const
|
|
435
|
+
const emptyAction = () => ({
|
|
436
436
|
ID: generateRandomId(),
|
|
437
437
|
title: "",
|
|
438
438
|
description: "",
|
|
@@ -461,14 +461,29 @@ const requiresNewApproval = (oldRiSc, updatedRiSc) => {
|
|
|
461
461
|
requiresApproval = true;
|
|
462
462
|
if (oldScenario.remainingRisk.consequence !== updatedScenario.remainingRisk.consequence)
|
|
463
463
|
requiresApproval = true;
|
|
464
|
-
oldScenario.actions.map((
|
|
465
|
-
const
|
|
466
|
-
if (
|
|
464
|
+
oldScenario.actions.map((oldAction, i) => {
|
|
465
|
+
const updatedAction = updatedScenario.actions[i];
|
|
466
|
+
if (oldAction.deadline !== updatedAction.deadline)
|
|
467
467
|
requiresApproval = true;
|
|
468
468
|
});
|
|
469
469
|
});
|
|
470
470
|
return requiresApproval;
|
|
471
471
|
};
|
|
472
|
+
function formatNumber(cost, t) {
|
|
473
|
+
if (cost < 1e4) {
|
|
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);
|
|
482
|
+
return t(`riskMatrix.estimatedRisk.suffix.${unit}`, {
|
|
483
|
+
count: Number((cost / threshold * 1e3).toFixed(0))
|
|
484
|
+
});
|
|
485
|
+
}
|
|
486
|
+
}
|
|
472
487
|
|
|
473
488
|
function dtoToRiSc(riScDTO) {
|
|
474
489
|
return {
|
|
@@ -692,7 +707,7 @@ var ScenarioDrawerState = /* @__PURE__ */ ((ScenarioDrawerState2) => {
|
|
|
692
707
|
return ScenarioDrawerState2;
|
|
693
708
|
})(ScenarioDrawerState || {});
|
|
694
709
|
const emptyScenarioErrors = () => ({
|
|
695
|
-
|
|
710
|
+
title: false
|
|
696
711
|
});
|
|
697
712
|
const useScenarioDrawer = (riSc, updateRiSc, scenarioIdFromParams) => {
|
|
698
713
|
const [scenarioDrawerState, setScenarioDrawerState] = useState(
|
|
@@ -750,6 +765,16 @@ const useScenarioDrawer = (riSc, updateRiSc, scenarioIdFromParams) => {
|
|
|
750
765
|
setScenarioDrawerState(0 /* Closed */);
|
|
751
766
|
setSearchParams({ step });
|
|
752
767
|
};
|
|
768
|
+
const validateScenario = () => {
|
|
769
|
+
if (scenario.title === "") {
|
|
770
|
+
setScenarioErrors({
|
|
771
|
+
...scenarioErrors,
|
|
772
|
+
title: true
|
|
773
|
+
});
|
|
774
|
+
return false;
|
|
775
|
+
}
|
|
776
|
+
return true;
|
|
777
|
+
};
|
|
753
778
|
const saveScenario = () => {
|
|
754
779
|
if (riSc) {
|
|
755
780
|
if (validateScenario()) {
|
|
@@ -785,93 +810,78 @@ const useScenarioDrawer = (riSc, updateRiSc, scenarioIdFromParams) => {
|
|
|
785
810
|
openScenario(s.ID);
|
|
786
811
|
}
|
|
787
812
|
};
|
|
788
|
-
const
|
|
813
|
+
const setTitle = (title) => {
|
|
789
814
|
setScenarioErrors({
|
|
790
815
|
...scenarioErrors,
|
|
791
|
-
|
|
816
|
+
title: false
|
|
792
817
|
});
|
|
793
818
|
setScenario({
|
|
794
819
|
...scenario,
|
|
795
|
-
title
|
|
820
|
+
title
|
|
796
821
|
});
|
|
797
822
|
};
|
|
798
|
-
const
|
|
823
|
+
const setDescription = (description) => {
|
|
799
824
|
setScenario({
|
|
800
825
|
...scenario,
|
|
801
|
-
description
|
|
826
|
+
description
|
|
802
827
|
});
|
|
803
828
|
};
|
|
804
|
-
const
|
|
829
|
+
const setThreatActors = (threatActors) => {
|
|
805
830
|
setScenario({
|
|
806
831
|
...scenario,
|
|
807
|
-
threatActors
|
|
832
|
+
threatActors
|
|
808
833
|
});
|
|
809
834
|
};
|
|
810
|
-
const
|
|
835
|
+
const setVulnerabilities = (vulnerabilities) => {
|
|
811
836
|
setScenario({
|
|
812
837
|
...scenario,
|
|
813
|
-
vulnerabilities
|
|
838
|
+
vulnerabilities
|
|
814
839
|
});
|
|
815
840
|
};
|
|
816
|
-
const
|
|
841
|
+
const setProbability = (probabilityLevel) => setScenario({
|
|
817
842
|
...scenario,
|
|
818
843
|
risk: {
|
|
819
844
|
...scenario.risk,
|
|
820
|
-
probability: probabilityOptions[
|
|
845
|
+
probability: probabilityOptions[probabilityLevel - 1]
|
|
821
846
|
}
|
|
822
847
|
});
|
|
823
|
-
const
|
|
848
|
+
const setConsequence = (consequenceLevel) => setScenario({
|
|
824
849
|
...scenario,
|
|
825
850
|
risk: {
|
|
826
851
|
...scenario.risk,
|
|
827
|
-
consequence: consequenceOptions[
|
|
852
|
+
consequence: consequenceOptions[consequenceLevel - 1]
|
|
828
853
|
}
|
|
829
854
|
});
|
|
830
|
-
const
|
|
855
|
+
const setExistingActions = (existingActions) => {
|
|
831
856
|
setScenario({
|
|
832
857
|
...scenario,
|
|
833
|
-
existingActions
|
|
858
|
+
existingActions
|
|
834
859
|
});
|
|
835
860
|
};
|
|
836
|
-
const
|
|
837
|
-
const
|
|
838
|
-
const
|
|
839
|
-
setScenario({ ...scenario, actions:
|
|
861
|
+
const addAction = () => setScenario({ ...scenario, actions: [...scenario.actions, emptyAction()] });
|
|
862
|
+
const updateAction = (action) => {
|
|
863
|
+
const updatedAction = scenario.actions.some((a) => a.ID === action.ID) ? scenario.actions.map((a) => a.ID === action.ID ? action : a) : [...scenario.actions, action];
|
|
864
|
+
setScenario({ ...scenario, actions: updatedAction });
|
|
840
865
|
};
|
|
841
|
-
const
|
|
842
|
-
const
|
|
843
|
-
setScenario({ ...scenario, actions:
|
|
866
|
+
const deleteAction = (action) => {
|
|
867
|
+
const updatedAction = scenario.actions.filter((a) => a.ID !== action.ID);
|
|
868
|
+
setScenario({ ...scenario, actions: updatedAction });
|
|
844
869
|
};
|
|
845
|
-
const
|
|
846
|
-
const
|
|
870
|
+
const updateRemainingRisk = (remainingRisk) => setScenario({ ...scenario, remainingRisk });
|
|
871
|
+
const setRemainingProbability = (probabilityLevel) => setScenario({
|
|
847
872
|
...scenario,
|
|
848
873
|
remainingRisk: {
|
|
849
874
|
...scenario.remainingRisk,
|
|
850
|
-
probability: probabilityOptions[
|
|
875
|
+
probability: probabilityOptions[probabilityLevel - 1]
|
|
851
876
|
}
|
|
852
877
|
});
|
|
853
|
-
const
|
|
878
|
+
const setRemainingConsequence = (consequenceLevel) => setScenario({
|
|
854
879
|
...scenario,
|
|
855
880
|
remainingRisk: {
|
|
856
881
|
...scenario.remainingRisk,
|
|
857
|
-
consequence: consequenceOptions[
|
|
882
|
+
consequence: consequenceOptions[consequenceLevel - 1]
|
|
858
883
|
}
|
|
859
884
|
});
|
|
860
|
-
const validateScenario = () => {
|
|
861
|
-
if (scenario.title === "") {
|
|
862
|
-
setScenarioErrors({
|
|
863
|
-
...scenarioErrors,
|
|
864
|
-
tittel: true
|
|
865
|
-
});
|
|
866
|
-
return false;
|
|
867
|
-
} else {
|
|
868
|
-
setScenarioErrors({
|
|
869
|
-
...scenarioErrors,
|
|
870
|
-
tittel: false
|
|
871
|
-
});
|
|
872
|
-
}
|
|
873
|
-
return true;
|
|
874
|
-
};
|
|
875
885
|
return {
|
|
876
886
|
scenarioDrawerState,
|
|
877
887
|
scenario,
|
|
@@ -888,19 +898,19 @@ const useScenarioDrawer = (riSc, updateRiSc, scenarioIdFromParams) => {
|
|
|
888
898
|
openDeleteConfirmation,
|
|
889
899
|
abortDeletion,
|
|
890
900
|
confirmDeletion,
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
901
|
+
setTitle,
|
|
902
|
+
setDescription,
|
|
903
|
+
setThreatActors,
|
|
904
|
+
setVulnerabilities,
|
|
905
|
+
setProbability,
|
|
906
|
+
setConsequence,
|
|
907
|
+
setExistingActions,
|
|
908
|
+
addAction,
|
|
909
|
+
updateAction,
|
|
910
|
+
deleteAction,
|
|
911
|
+
updateRemainingRisk,
|
|
912
|
+
setRemainingProbability,
|
|
913
|
+
setRemainingConsequence
|
|
904
914
|
};
|
|
905
915
|
};
|
|
906
916
|
const useFetchRiScs = (riScIdFromParams) => {
|
|
@@ -1140,57 +1150,6 @@ const menuProps = {
|
|
|
1140
1150
|
},
|
|
1141
1151
|
variant: "menu"
|
|
1142
1152
|
};
|
|
1143
|
-
const useScenarioDrawerStyles = makeStyles((theme) => ({
|
|
1144
|
-
paperEdit: {
|
|
1145
|
-
padding: theme.spacing(4),
|
|
1146
|
-
width: "65%"
|
|
1147
|
-
},
|
|
1148
|
-
paperView: {
|
|
1149
|
-
padding: theme.spacing(4),
|
|
1150
|
-
width: "50%",
|
|
1151
|
-
[theme.breakpoints.down("sm")]: {
|
|
1152
|
-
width: "90%",
|
|
1153
|
-
padding: theme.spacing(2)
|
|
1154
|
-
}
|
|
1155
|
-
}
|
|
1156
|
-
}));
|
|
1157
|
-
const useScenarioDrawerContentStyles = makeStyles((theme) => ({
|
|
1158
|
-
header: {
|
|
1159
|
-
display: "flex",
|
|
1160
|
-
flexDirection: "row",
|
|
1161
|
-
justifyContent: "space-between"
|
|
1162
|
-
},
|
|
1163
|
-
buttons: {
|
|
1164
|
-
display: "flex",
|
|
1165
|
-
flexDirection: "row",
|
|
1166
|
-
alignItems: "center",
|
|
1167
|
-
gap: theme.spacing(2),
|
|
1168
|
-
marginTop: theme.spacing(4)
|
|
1169
|
-
},
|
|
1170
|
-
risikoBadge: {
|
|
1171
|
-
width: "20px",
|
|
1172
|
-
height: "48px",
|
|
1173
|
-
borderRadius: "20%"
|
|
1174
|
-
},
|
|
1175
|
-
titleAndButton: {
|
|
1176
|
-
display: "flex",
|
|
1177
|
-
flexDirection: "row",
|
|
1178
|
-
justifyContent: "space-between"
|
|
1179
|
-
},
|
|
1180
|
-
section: {
|
|
1181
|
-
padding: theme.spacing(2),
|
|
1182
|
-
marginBottom: theme.spacing(2),
|
|
1183
|
-
backgroundColor: theme.palette.type === "dark" ? "#555555" : "#e0e0e0"
|
|
1184
|
-
},
|
|
1185
|
-
measure: {
|
|
1186
|
-
padding: theme.spacing(2),
|
|
1187
|
-
marginBottom: theme.palette.type === "dark" ? theme.spacing(1) : "7px",
|
|
1188
|
-
backgroundColor: theme.palette.type === "dark" ? "#55555519" : "#e0e0e019"
|
|
1189
|
-
},
|
|
1190
|
-
editIcon: {
|
|
1191
|
-
color: theme.palette.type === "dark" ? "#fff" : "rgba(0, 0, 0, 0.54)"
|
|
1192
|
-
}
|
|
1193
|
-
}));
|
|
1194
1153
|
const useFontStyles = makeStyles((theme) => ({
|
|
1195
1154
|
h1: {
|
|
1196
1155
|
fontSize: theme.spacing(4),
|
|
@@ -1254,7 +1213,7 @@ const useFontStyles = makeStyles((theme) => ({
|
|
|
1254
1213
|
fontWeight: 700,
|
|
1255
1214
|
paddingTop: 0
|
|
1256
1215
|
},
|
|
1257
|
-
|
|
1216
|
+
actionSubtitle: {
|
|
1258
1217
|
fontSize: theme.spacing(2.25),
|
|
1259
1218
|
fontWeight: 700,
|
|
1260
1219
|
marginBottom: theme.spacing(2),
|
|
@@ -1283,6 +1242,19 @@ const useInputFieldStyles = makeStyles((theme) => ({
|
|
|
1283
1242
|
}
|
|
1284
1243
|
}
|
|
1285
1244
|
}));
|
|
1245
|
+
const useSpinnerStyles = makeStyles({
|
|
1246
|
+
container: {
|
|
1247
|
+
display: "flex",
|
|
1248
|
+
minWidth: "100wh",
|
|
1249
|
+
height: "100vh",
|
|
1250
|
+
justifyContent: "center",
|
|
1251
|
+
alignItems: "flex-start"
|
|
1252
|
+
},
|
|
1253
|
+
spinner: {
|
|
1254
|
+
display: "flex",
|
|
1255
|
+
marginTop: "200px"
|
|
1256
|
+
}
|
|
1257
|
+
});
|
|
1286
1258
|
|
|
1287
1259
|
const TextField = ({
|
|
1288
1260
|
label,
|
|
@@ -1325,9 +1297,7 @@ const Dropdown = ({
|
|
|
1325
1297
|
}) => {
|
|
1326
1298
|
const { formLabel, formControl } = useInputFieldStyles();
|
|
1327
1299
|
const multiple = Array.isArray(selectedValues);
|
|
1328
|
-
const onChange = (event) =>
|
|
1329
|
-
handleChange(event.target.value);
|
|
1330
|
-
};
|
|
1300
|
+
const onChange = (event) => handleChange(event.target.value);
|
|
1331
1301
|
const renderValue = (selected) => multiple ? /* @__PURE__ */ React.createElement(
|
|
1332
1302
|
Box,
|
|
1333
1303
|
{
|
|
@@ -1365,25 +1335,25 @@ const Dropdown = ({
|
|
|
1365
1335
|
const ScenarioContext = createContext(null);
|
|
1366
1336
|
|
|
1367
1337
|
const ScenarioStep = () => {
|
|
1338
|
+
const { t } = useTranslationRef(pluginRiScTranslationRef);
|
|
1339
|
+
const { labelSubtitle, label, h2, subtitle2 } = useFontStyles();
|
|
1368
1340
|
const {
|
|
1369
1341
|
scenario,
|
|
1370
1342
|
scenarioErrors,
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1343
|
+
setTitle,
|
|
1344
|
+
setDescription,
|
|
1345
|
+
setThreatActors,
|
|
1346
|
+
setVulnerabilities
|
|
1375
1347
|
} = useContext(ScenarioContext);
|
|
1376
|
-
const { labelSubtitle, label, h2, subtitle2 } = useFontStyles();
|
|
1377
|
-
const { t } = useTranslationRef(pluginRiScTranslationRef);
|
|
1378
1348
|
return /* @__PURE__ */ React.createElement(Grid, { container: true }, /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(Typography, { className: h2 }, t("scenarioDrawer.title")), /* @__PURE__ */ React.createElement(Typography, { className: subtitle2 }, t("scenarioDrawer.subtitle"))), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(
|
|
1379
1349
|
TextField,
|
|
1380
1350
|
{
|
|
1381
1351
|
label: t("dictionary.title"),
|
|
1382
1352
|
value: scenario.title,
|
|
1383
|
-
error: scenarioErrors.
|
|
1353
|
+
error: scenarioErrors.title ? t("scenarioDrawer.titleError") : "",
|
|
1384
1354
|
required: true,
|
|
1385
1355
|
minRows: 1,
|
|
1386
|
-
handleChange:
|
|
1356
|
+
handleChange: setTitle
|
|
1387
1357
|
}
|
|
1388
1358
|
)), /* @__PURE__ */ React.createElement(
|
|
1389
1359
|
Grid,
|
|
@@ -1403,7 +1373,7 @@ const ScenarioStep = () => {
|
|
|
1403
1373
|
{
|
|
1404
1374
|
selectedValues: scenario.threatActors,
|
|
1405
1375
|
options: threatActorsOptions,
|
|
1406
|
-
handleChange:
|
|
1376
|
+
handleChange: setThreatActors
|
|
1407
1377
|
}
|
|
1408
1378
|
)
|
|
1409
1379
|
), /* @__PURE__ */ React.createElement(
|
|
@@ -1424,7 +1394,7 @@ const ScenarioStep = () => {
|
|
|
1424
1394
|
{
|
|
1425
1395
|
selectedValues: scenario.vulnerabilities,
|
|
1426
1396
|
options: vulnerabilitiesOptions,
|
|
1427
|
-
handleChange:
|
|
1397
|
+
handleChange: setVulnerabilities
|
|
1428
1398
|
}
|
|
1429
1399
|
)
|
|
1430
1400
|
), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(
|
|
@@ -1433,56 +1403,41 @@ const ScenarioStep = () => {
|
|
|
1433
1403
|
label: t("dictionary.description"),
|
|
1434
1404
|
value: scenario.description,
|
|
1435
1405
|
minRows: 4,
|
|
1436
|
-
handleChange:
|
|
1406
|
+
handleChange: setDescription
|
|
1437
1407
|
}
|
|
1438
1408
|
)));
|
|
1439
1409
|
};
|
|
1440
1410
|
|
|
1441
|
-
const
|
|
1442
|
-
|
|
1443
|
-
close,
|
|
1444
|
-
save
|
|
1445
|
-
}) => {
|
|
1446
|
-
const { t } = useTranslationRef(pluginRiScTranslationRef);
|
|
1447
|
-
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"))));
|
|
1448
|
-
};
|
|
1449
|
-
|
|
1450
|
-
const TiltakEdit = ({
|
|
1451
|
-
tiltak,
|
|
1411
|
+
const ActionEdit = ({
|
|
1412
|
+
action,
|
|
1452
1413
|
index,
|
|
1453
|
-
|
|
1454
|
-
|
|
1414
|
+
updateAction,
|
|
1415
|
+
deleteAction
|
|
1455
1416
|
}) => {
|
|
1456
|
-
const
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
deadline: formattedDate
|
|
1417
|
+
const { t } = useTranslationRef(pluginRiScTranslationRef);
|
|
1418
|
+
const { paper, formControl } = useInputFieldStyles();
|
|
1419
|
+
const { label, labelSubtitle } = useFontStyles();
|
|
1420
|
+
const setDescription = (description) => updateAction({
|
|
1421
|
+
...action,
|
|
1422
|
+
description
|
|
1423
|
+
});
|
|
1424
|
+
const setStatus = (status) => updateAction({
|
|
1425
|
+
...action,
|
|
1426
|
+
status
|
|
1427
|
+
});
|
|
1428
|
+
const setDeadline = (deadline) => {
|
|
1429
|
+
if (deadline) {
|
|
1430
|
+
const formattedDeadline = new Date(deadline).toISOString().split("T")[0];
|
|
1431
|
+
updateAction({
|
|
1432
|
+
...action,
|
|
1433
|
+
deadline: formattedDeadline
|
|
1474
1434
|
});
|
|
1475
1435
|
}
|
|
1476
1436
|
};
|
|
1477
|
-
const
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
});
|
|
1482
|
-
};
|
|
1483
|
-
const { paper, formControl } = useInputFieldStyles();
|
|
1484
|
-
const { label, labelSubtitle } = useFontStyles();
|
|
1485
|
-
const { t } = useTranslationRef(pluginRiScTranslationRef);
|
|
1437
|
+
const setOwner = (owner) => updateAction({
|
|
1438
|
+
...action,
|
|
1439
|
+
owner
|
|
1440
|
+
});
|
|
1486
1441
|
return /* @__PURE__ */ React.createElement(Paper, { className: paper }, /* @__PURE__ */ React.createElement(Grid, { container: true, style: { display: "flex", rowGap: "0.7rem" } }, /* @__PURE__ */ React.createElement(
|
|
1487
1442
|
Grid,
|
|
1488
1443
|
{
|
|
@@ -1500,8 +1455,7 @@ const TiltakEdit = ({
|
|
|
1500
1455
|
{
|
|
1501
1456
|
startIcon: /* @__PURE__ */ React.createElement(DeleteIcon, null),
|
|
1502
1457
|
key: "dismiss",
|
|
1503
|
-
|
|
1504
|
-
onClick: () => deleteTiltak(tiltak),
|
|
1458
|
+
onClick: () => deleteAction(action),
|
|
1505
1459
|
color: "primary"
|
|
1506
1460
|
},
|
|
1507
1461
|
t("dictionary.delete")
|
|
@@ -1510,8 +1464,8 @@ const TiltakEdit = ({
|
|
|
1510
1464
|
TextField,
|
|
1511
1465
|
{
|
|
1512
1466
|
label: t("dictionary.description"),
|
|
1513
|
-
value:
|
|
1514
|
-
handleChange:
|
|
1467
|
+
value: action.description,
|
|
1468
|
+
handleChange: setDescription,
|
|
1515
1469
|
minRows: 1
|
|
1516
1470
|
}
|
|
1517
1471
|
)), /* @__PURE__ */ React.createElement(
|
|
@@ -1527,14 +1481,7 @@ const TiltakEdit = ({
|
|
|
1527
1481
|
},
|
|
1528
1482
|
/* @__PURE__ */ React.createElement(Typography, { className: label }, t("dictionary.measureOwner")),
|
|
1529
1483
|
/* @__PURE__ */ React.createElement(Typography, { className: labelSubtitle }, t("scenarioDrawer.measureTab.measureOwnerDescription")),
|
|
1530
|
-
/* @__PURE__ */ React.createElement(
|
|
1531
|
-
TextField,
|
|
1532
|
-
{
|
|
1533
|
-
value: tiltak.owner,
|
|
1534
|
-
handleChange: setTiltakseier,
|
|
1535
|
-
minRows: 1
|
|
1536
|
-
}
|
|
1537
|
-
)
|
|
1484
|
+
/* @__PURE__ */ React.createElement(TextField, { value: action.owner, handleChange: setOwner, minRows: 1 })
|
|
1538
1485
|
), /* @__PURE__ */ React.createElement(
|
|
1539
1486
|
Grid,
|
|
1540
1487
|
{
|
|
@@ -1552,7 +1499,7 @@ const TiltakEdit = ({
|
|
|
1552
1499
|
Dropdown,
|
|
1553
1500
|
{
|
|
1554
1501
|
options: actionStatusOptions,
|
|
1555
|
-
selectedValues:
|
|
1502
|
+
selectedValues: action.status,
|
|
1556
1503
|
handleChange: setStatus
|
|
1557
1504
|
}
|
|
1558
1505
|
)
|
|
@@ -1569,38 +1516,38 @@ const TiltakEdit = ({
|
|
|
1569
1516
|
}
|
|
1570
1517
|
},
|
|
1571
1518
|
/* @__PURE__ */ React.createElement(Typography, { className: label }, t("dictionary.deadline")),
|
|
1572
|
-
/* @__PURE__ */ React.createElement(FormControl$1, { className: formControl }, /* @__PURE__ */ React.createElement(LocalizationProvider, { dateAdapter: AdapterDateFns, adapterLocale: nb }, /* @__PURE__ */ React.createElement(DatePicker, { value:
|
|
1519
|
+
/* @__PURE__ */ React.createElement(FormControl$1, { className: formControl }, /* @__PURE__ */ React.createElement(LocalizationProvider, { dateAdapter: AdapterDateFns, adapterLocale: nb }, /* @__PURE__ */ React.createElement(DatePicker, { value: action.deadline, onChange: setDeadline })))
|
|
1573
1520
|
)));
|
|
1574
1521
|
};
|
|
1575
1522
|
|
|
1576
|
-
const
|
|
1523
|
+
const ActionsStep = () => {
|
|
1524
|
+
const { t } = useTranslationRef(pluginRiScTranslationRef);
|
|
1525
|
+
const { h2, subtitle2, actionSubtitle } = useFontStyles();
|
|
1577
1526
|
const {
|
|
1578
1527
|
scenario,
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1528
|
+
setExistingActions,
|
|
1529
|
+
updateAction,
|
|
1530
|
+
deleteAction,
|
|
1531
|
+
addAction
|
|
1583
1532
|
} = useContext(ScenarioContext);
|
|
1584
|
-
const { h2, subtitle2, tiltakSubtitle } = useFontStyles();
|
|
1585
|
-
const { t } = useTranslationRef(pluginRiScTranslationRef);
|
|
1586
1533
|
return /* @__PURE__ */ React.createElement(Box, null, /* @__PURE__ */ React.createElement(Typography, { className: h2 }, t("dictionary.measure")), /* @__PURE__ */ React.createElement(Typography, { className: subtitle2 }, t("scenarioDrawer.measureTab.subtitle")), /* @__PURE__ */ React.createElement(Grid$1, { item: true, xs: 12, style: { paddingTop: "1.5rem" } }, /* @__PURE__ */ React.createElement(
|
|
1587
1534
|
TextField,
|
|
1588
1535
|
{
|
|
1589
1536
|
label: t("scenarioDrawer.measureTab.existingMeasure"),
|
|
1590
1537
|
subtitle: t("scenarioDrawer.measureTab.existingMeasureSubtitle"),
|
|
1591
1538
|
value: scenario.existingActions,
|
|
1592
|
-
handleChange:
|
|
1539
|
+
handleChange: setExistingActions,
|
|
1593
1540
|
minRows: 3
|
|
1594
1541
|
}
|
|
1595
|
-
)), /* @__PURE__ */ React.createElement(Typography, { variant: "h6", className:
|
|
1596
|
-
|
|
1542
|
+
)), /* @__PURE__ */ React.createElement(Typography, { variant: "h6", className: actionSubtitle }, t("scenarioDrawer.measureTab.plannedMeasures")), scenario.actions.map((action, index) => /* @__PURE__ */ React.createElement(
|
|
1543
|
+
ActionEdit,
|
|
1597
1544
|
{
|
|
1598
|
-
|
|
1545
|
+
action,
|
|
1599
1546
|
index: index + 1,
|
|
1600
|
-
|
|
1601
|
-
|
|
1547
|
+
updateAction,
|
|
1548
|
+
deleteAction
|
|
1602
1549
|
}
|
|
1603
|
-
)), /* @__PURE__ */ React.createElement(Button, { startIcon: /* @__PURE__ */ React.createElement(AddCircle, null), color: "primary", onClick:
|
|
1550
|
+
)), /* @__PURE__ */ React.createElement(Button, { startIcon: /* @__PURE__ */ React.createElement(AddCircle, null), color: "primary", onClick: addAction }, t("scenarioDrawer.measureTab.addMeasureButton")));
|
|
1604
1551
|
};
|
|
1605
1552
|
|
|
1606
1553
|
const useTableStyles$1 = makeStyles((theme) => ({
|
|
@@ -1641,15 +1588,33 @@ const useTableStyles$1 = makeStyles((theme) => ({
|
|
|
1641
1588
|
textTransform: "uppercase"
|
|
1642
1589
|
}
|
|
1643
1590
|
}));
|
|
1591
|
+
|
|
1592
|
+
const ProbabilityTable = ({
|
|
1593
|
+
selectedValue,
|
|
1594
|
+
handleChange
|
|
1595
|
+
}) => {
|
|
1596
|
+
const { t } = useTranslationRef(pluginRiScTranslationRef);
|
|
1597
|
+
const { table, cell, radio } = useTableStyles$1();
|
|
1598
|
+
const handleChangeRow = (row) => () => handleChange(row);
|
|
1599
|
+
const radioCell = (row) => /* @__PURE__ */ React.createElement("th", { scope: "col" }, /* @__PURE__ */ React.createElement("div", { className: radio }, /* @__PURE__ */ React.createElement(
|
|
1600
|
+
Radio,
|
|
1601
|
+
{
|
|
1602
|
+
checked: selectedValue === row,
|
|
1603
|
+
onChange: handleChangeRow(row),
|
|
1604
|
+
style: { padding: 0, color: "#9BC9FE" }
|
|
1605
|
+
}
|
|
1606
|
+
), row, ": ", t(`probabilityTable.rows.${row}`)));
|
|
1607
|
+
const contentCell = (row) => /* @__PURE__ */ React.createElement("td", { className: cell }, t(`probabilityTable.cells.${row}`));
|
|
1608
|
+
return /* @__PURE__ */ React.createElement("table", { className: table }, /* @__PURE__ */ React.createElement("tbody", null, /* @__PURE__ */ React.createElement("tr", null, radioCell(1), radioCell(2), radioCell(3), radioCell(4), radioCell(5)), /* @__PURE__ */ React.createElement("tr", null, contentCell(1), contentCell(2), contentCell(3), contentCell(4), contentCell(5))));
|
|
1609
|
+
};
|
|
1610
|
+
|
|
1644
1611
|
const ConsequenceTable = ({
|
|
1645
1612
|
selectedValue,
|
|
1646
1613
|
handleChange
|
|
1647
1614
|
}) => {
|
|
1648
|
-
const { table, labelCell, cell, voidCell, radio } = useTableStyles$1();
|
|
1649
1615
|
const { t } = useTranslationRef(pluginRiScTranslationRef);
|
|
1650
|
-
const
|
|
1651
|
-
|
|
1652
|
-
};
|
|
1616
|
+
const { table, labelCell, cell, voidCell, radio } = useTableStyles$1();
|
|
1617
|
+
const handleChangeRow = (row) => () => handleChange(row);
|
|
1653
1618
|
const getRadioCell = (row) => {
|
|
1654
1619
|
return /* @__PURE__ */ React.createElement("th", { scope: "col" }, /* @__PURE__ */ React.createElement("div", { className: radio }, /* @__PURE__ */ React.createElement(
|
|
1655
1620
|
Radio,
|
|
@@ -1676,98 +1641,51 @@ const ConsequenceTable = ({
|
|
|
1676
1641
|
return /* @__PURE__ */ React.createElement("table", { className: table }, /* @__PURE__ */ React.createElement("tbody", null, /* @__PURE__ */ React.createElement("tr", null, /* @__PURE__ */ React.createElement("td", { className: labelCell }), getRadioCell(1), getRadioCell(2), getRadioCell(3), getRadioCell(4), getRadioCell(5)), getRow("economical", [cell, cell, cell, cell, cell]), getRow("privacy", [cell, cell, cell, cell, voidCell]), getRow("reputation", [cell, cell, cell, voidCell, voidCell]), getRow("health", [voidCell, voidCell, cell, cell, cell])));
|
|
1677
1642
|
};
|
|
1678
1643
|
|
|
1679
|
-
const
|
|
1680
|
-
selectedValue,
|
|
1681
|
-
handleChange
|
|
1682
|
-
}) => {
|
|
1683
|
-
const { table, cell, radio } = useTableStyles$1();
|
|
1684
|
-
const { t } = useTranslationRef(pluginRiScTranslationRef);
|
|
1685
|
-
const handleChangeRow = (row) => () => {
|
|
1686
|
-
handleChange(row);
|
|
1687
|
-
};
|
|
1688
|
-
const radioCell = (row) => /* @__PURE__ */ React.createElement("th", { scope: "col" }, /* @__PURE__ */ React.createElement("div", { className: radio }, /* @__PURE__ */ React.createElement(
|
|
1689
|
-
Radio,
|
|
1690
|
-
{
|
|
1691
|
-
checked: selectedValue === row,
|
|
1692
|
-
onChange: handleChangeRow(row),
|
|
1693
|
-
style: { padding: 0, color: "#9BC9FE" }
|
|
1694
|
-
}
|
|
1695
|
-
), row, ": ", t(`probabilityTable.rows.${row}`)));
|
|
1696
|
-
const contentCell = (row) => /* @__PURE__ */ React.createElement("td", { className: cell }, t(`probabilityTable.cells.${row}`));
|
|
1697
|
-
return /* @__PURE__ */ React.createElement("table", { className: table }, /* @__PURE__ */ React.createElement("tbody", null, /* @__PURE__ */ React.createElement("tr", null, radioCell(1), radioCell(2), radioCell(3), radioCell(4), radioCell(5)), /* @__PURE__ */ React.createElement("tr", null, contentCell(1), contentCell(2), contentCell(3), contentCell(4), contentCell(5))));
|
|
1698
|
-
};
|
|
1699
|
-
|
|
1700
|
-
const useStyles$2 = makeStyles((theme) => ({
|
|
1644
|
+
const useRiskStepStyles = makeStyles((theme) => ({
|
|
1701
1645
|
box: {
|
|
1702
1646
|
paddingBottom: theme.spacing(2)
|
|
1703
1647
|
}
|
|
1704
1648
|
}));
|
|
1649
|
+
|
|
1705
1650
|
const RiskStep = ({ riskType, restEqualsInitial }) => {
|
|
1651
|
+
const { t } = useTranslationRef(pluginRiScTranslationRef);
|
|
1652
|
+
const { h2, h3, subtitle2 } = useFontStyles();
|
|
1653
|
+
const { box } = useRiskStepStyles();
|
|
1706
1654
|
const {
|
|
1707
1655
|
scenario,
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1656
|
+
setConsequence,
|
|
1657
|
+
setProbability,
|
|
1658
|
+
setRemainingConsequence,
|
|
1659
|
+
setRemainingProbability
|
|
1712
1660
|
} = useContext(ScenarioContext);
|
|
1713
|
-
const { h2, h3, subtitle2 } = useFontStyles();
|
|
1714
|
-
const { t } = useTranslationRef(pluginRiScTranslationRef);
|
|
1715
1661
|
const resourceKey = riskType === "initial" ? "initialRiskStep" : "restRiskStep";
|
|
1716
1662
|
const risk = riskType === "initial" ? scenario.risk : scenario.remainingRisk;
|
|
1717
|
-
const { box } = useStyles$2();
|
|
1718
1663
|
useEffect(() => {
|
|
1719
1664
|
if (restEqualsInitial)
|
|
1720
|
-
|
|
1665
|
+
setRemainingConsequence(getConsequenceLevel(scenario.risk));
|
|
1721
1666
|
}, [scenario.risk.consequence]);
|
|
1722
1667
|
useEffect(() => {
|
|
1723
1668
|
if (restEqualsInitial)
|
|
1724
|
-
|
|
1669
|
+
setRemainingProbability(getProbabilityLevel(scenario.risk));
|
|
1725
1670
|
}, [scenario.risk.probability]);
|
|
1726
|
-
const setC = riskType === "initial" ?
|
|
1727
|
-
const setP = riskType === "initial" ?
|
|
1671
|
+
const setC = riskType === "initial" ? setConsequence : setRemainingConsequence;
|
|
1672
|
+
const setP = riskType === "initial" ? setProbability : setRemainingProbability;
|
|
1728
1673
|
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(
|
|
1729
1674
|
ProbabilityTable,
|
|
1730
1675
|
{
|
|
1731
|
-
selectedValue:
|
|
1676
|
+
selectedValue: getProbabilityLevel(risk),
|
|
1732
1677
|
handleChange: setP
|
|
1733
1678
|
}
|
|
1734
1679
|
)), /* @__PURE__ */ React.createElement(Box, { className: box }, /* @__PURE__ */ React.createElement(Typography, { className: h3 }, t("dictionary.consequence")), /* @__PURE__ */ React.createElement(Typography, { className: subtitle2 }, t(`scenarioStepper.${resourceKey}.consequenceSubtitle`))), /* @__PURE__ */ React.createElement(Box, { className: box }, /* @__PURE__ */ React.createElement(
|
|
1735
1680
|
ConsequenceTable,
|
|
1736
1681
|
{
|
|
1737
|
-
selectedValue:
|
|
1682
|
+
selectedValue: getConsequenceLevel(risk),
|
|
1738
1683
|
handleChange: setC
|
|
1739
1684
|
}
|
|
1740
1685
|
)));
|
|
1741
1686
|
};
|
|
1742
1687
|
|
|
1743
|
-
const
|
|
1744
|
-
godkjennButton: {
|
|
1745
|
-
borderRadius: "2px",
|
|
1746
|
-
whiteSpace: "nowrap",
|
|
1747
|
-
overflow: "hidden",
|
|
1748
|
-
textOverflow: "ellipsis"
|
|
1749
|
-
},
|
|
1750
|
-
settingsButton: {
|
|
1751
|
-
borderRadius: "2px",
|
|
1752
|
-
minWidth: "80%",
|
|
1753
|
-
padding: "5px 10px 5px 10px"
|
|
1754
|
-
}
|
|
1755
|
-
}));
|
|
1756
|
-
const useLoadingStyles = makeStyles({
|
|
1757
|
-
container: {
|
|
1758
|
-
display: "flex",
|
|
1759
|
-
minWidth: "100wh",
|
|
1760
|
-
height: "100vh",
|
|
1761
|
-
justifyContent: "center",
|
|
1762
|
-
alignItems: "flex-start"
|
|
1763
|
-
},
|
|
1764
|
-
spinner: {
|
|
1765
|
-
display: "flex",
|
|
1766
|
-
marginTop: "200px"
|
|
1767
|
-
}
|
|
1768
|
-
});
|
|
1769
|
-
|
|
1770
|
-
const useStyle = makeStyles((theme) => ({
|
|
1688
|
+
const useWizardStyle = makeStyles((theme) => ({
|
|
1771
1689
|
root: {
|
|
1772
1690
|
display: "flex",
|
|
1773
1691
|
justifyContent: "center",
|
|
@@ -1803,6 +1721,21 @@ const useStyle = makeStyles((theme) => ({
|
|
|
1803
1721
|
gap: theme.spacing(2)
|
|
1804
1722
|
}
|
|
1805
1723
|
}));
|
|
1724
|
+
|
|
1725
|
+
const Spinner = ({ size }) => {
|
|
1726
|
+
const { container, spinner } = useSpinnerStyles();
|
|
1727
|
+
return /* @__PURE__ */ React.createElement("div", { className: container }, /* @__PURE__ */ React.createElement(CircularProgress, { className: spinner, size }));
|
|
1728
|
+
};
|
|
1729
|
+
|
|
1730
|
+
const CloseConfirmation = ({
|
|
1731
|
+
isOpen,
|
|
1732
|
+
close,
|
|
1733
|
+
save
|
|
1734
|
+
}) => {
|
|
1735
|
+
const { t } = useTranslationRef(pluginRiScTranslationRef);
|
|
1736
|
+
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
|
+
};
|
|
1738
|
+
|
|
1806
1739
|
const ScenarioWizardSteps = [
|
|
1807
1740
|
"scenario",
|
|
1808
1741
|
"initialRisk",
|
|
@@ -1817,7 +1750,6 @@ const ScenarioWizard = ({
|
|
|
1817
1750
|
const wizardRef = useRef(null);
|
|
1818
1751
|
const { t } = useTranslationRef(pluginRiScTranslationRef);
|
|
1819
1752
|
const { h1, label } = useFontStyles();
|
|
1820
|
-
const classes = useLoadingStyles();
|
|
1821
1753
|
const {
|
|
1822
1754
|
root,
|
|
1823
1755
|
container,
|
|
@@ -1827,7 +1759,7 @@ const ScenarioWizard = ({
|
|
|
1827
1759
|
buttonContainer,
|
|
1828
1760
|
buttonContainerRight,
|
|
1829
1761
|
saveAndNextButtons
|
|
1830
|
-
} =
|
|
1762
|
+
} = useWizardStyle();
|
|
1831
1763
|
const {
|
|
1832
1764
|
scenario,
|
|
1833
1765
|
originalScenario,
|
|
@@ -1907,7 +1839,7 @@ const ScenarioWizard = ({
|
|
|
1907
1839
|
t(`dictionary.${wizardStep}`),
|
|
1908
1840
|
" "
|
|
1909
1841
|
)))
|
|
1910
|
-
), /* @__PURE__ */ React.createElement(Divider, null), isFetching
|
|
1842
|
+
), /* @__PURE__ */ React.createElement(Divider, null), isFetching ? /* @__PURE__ */ React.createElement(Spinner, { size: 80 }) : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Box, { className: steps }, {
|
|
1911
1843
|
[ScenarioWizardSteps[0]]: /* @__PURE__ */ React.createElement(ScenarioStep, null),
|
|
1912
1844
|
[ScenarioWizardSteps[1]]: /* @__PURE__ */ React.createElement(
|
|
1913
1845
|
RiskStep,
|
|
@@ -1916,7 +1848,7 @@ const ScenarioWizard = ({
|
|
|
1916
1848
|
restEqualsInitial
|
|
1917
1849
|
}
|
|
1918
1850
|
),
|
|
1919
|
-
[ScenarioWizardSteps[2]]: /* @__PURE__ */ React.createElement(
|
|
1851
|
+
[ScenarioWizardSteps[2]]: /* @__PURE__ */ React.createElement(ActionsStep, null),
|
|
1920
1852
|
[ScenarioWizardSteps[3]]: /* @__PURE__ */ React.createElement(RiskStep, { riskType: "rest" })
|
|
1921
1853
|
}[step]), updateStatus.isError && /* @__PURE__ */ React.createElement(Alert, { style: { marginBottom: "1rem" }, severity: "error" }, /* @__PURE__ */ React.createElement(Typography, null, t("dictionary.saveError"))), /* @__PURE__ */ React.createElement(
|
|
1922
1854
|
Box,
|
|
@@ -1958,362 +1890,53 @@ const ScenarioWizard = ({
|
|
|
1958
1890
|
));
|
|
1959
1891
|
};
|
|
1960
1892
|
|
|
1961
|
-
const
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
"
|
|
1966
|
-
|
|
1967
|
-
|
|
1893
|
+
const useScenarioDrawerStyles = makeStyles((theme) => ({
|
|
1894
|
+
drawer: {
|
|
1895
|
+
padding: theme.spacing(4),
|
|
1896
|
+
width: "50%",
|
|
1897
|
+
[theme.breakpoints.down("sm")]: {
|
|
1898
|
+
width: "90%",
|
|
1899
|
+
padding: theme.spacing(2)
|
|
1968
1900
|
}
|
|
1969
|
-
}
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
const Tabs$1 = ({ setTab }) => {
|
|
1973
|
-
const tabsStyle = useTabsStyle();
|
|
1974
|
-
const { t } = useTranslationRef(pluginRiScTranslationRef);
|
|
1975
|
-
return /* @__PURE__ */ React.createElement(Box$2, { sx: { borderBottom: 1, borderColor: "divider" } }, /* @__PURE__ */ React.createElement(
|
|
1976
|
-
TabList,
|
|
1977
|
-
{
|
|
1978
|
-
onChange: (_, newValue) => setTab(newValue),
|
|
1979
|
-
variant: "fullWidth",
|
|
1980
|
-
indicatorColor: "primary"
|
|
1981
|
-
},
|
|
1982
|
-
/* @__PURE__ */ React.createElement(
|
|
1983
|
-
Tab,
|
|
1984
|
-
{
|
|
1985
|
-
label: /* @__PURE__ */ React.createElement(Typography, { variant: "subtitle1", style: { fontWeight: "bold" } }, t("dictionary.consequence")),
|
|
1986
|
-
value: "konsekvens",
|
|
1987
|
-
className: tabsStyle.tab
|
|
1988
|
-
}
|
|
1989
|
-
),
|
|
1990
|
-
/* @__PURE__ */ React.createElement(
|
|
1991
|
-
Tab,
|
|
1992
|
-
{
|
|
1993
|
-
label: /* @__PURE__ */ React.createElement(Typography, { variant: "subtitle1", style: { fontWeight: "bold" } }, t("dictionary.probability")),
|
|
1994
|
-
value: "sannsynlighet",
|
|
1995
|
-
className: tabsStyle.tab
|
|
1996
|
-
}
|
|
1997
|
-
),
|
|
1998
|
-
/* @__PURE__ */ React.createElement(
|
|
1999
|
-
Tab,
|
|
2000
|
-
{
|
|
2001
|
-
label: /* @__PURE__ */ React.createElement(Typography, { variant: "subtitle1", style: { fontWeight: "bold" } }, t("dictionary.measure")),
|
|
2002
|
-
value: "tiltak",
|
|
2003
|
-
className: tabsStyle.tab
|
|
2004
|
-
}
|
|
2005
|
-
)
|
|
2006
|
-
));
|
|
2007
|
-
};
|
|
2008
|
-
|
|
2009
|
-
const useTabsTiltakStyles = makeStyles((theme) => ({
|
|
2010
|
-
arrow: {
|
|
1901
|
+
},
|
|
1902
|
+
header: {
|
|
2011
1903
|
display: "flex",
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
}));
|
|
2017
|
-
const tabStyles = makeStyles((theme) => ({
|
|
2018
|
-
tabPanel: {
|
|
2019
|
-
padding: 0,
|
|
2020
|
-
paddingTop: theme.spacing(3)
|
|
2021
|
-
}
|
|
2022
|
-
}));
|
|
2023
|
-
|
|
2024
|
-
const TabPanelKonsekvens = ({
|
|
2025
|
-
setKonsekvens,
|
|
2026
|
-
selected
|
|
2027
|
-
}) => {
|
|
2028
|
-
const { tabPanel } = tabStyles();
|
|
2029
|
-
const { headerSubtitle } = useFontStyles();
|
|
2030
|
-
const { t } = useTranslationRef(pluginRiScTranslationRef);
|
|
2031
|
-
return /* @__PURE__ */ React.createElement(TabPanel, { className: tabPanel, value: "konsekvens" }, /* @__PURE__ */ React.createElement(Typography, { variant: "h5" }, t("dictionary.consequence")), /* @__PURE__ */ React.createElement(Typography, { className: headerSubtitle }, t("scenarioDrawer.consequenceTab.subtitle")), /* @__PURE__ */ React.createElement(ConsequenceTable, { selectedValue: selected, handleChange: setKonsekvens }));
|
|
2032
|
-
};
|
|
2033
|
-
|
|
2034
|
-
const TabPanelSannsynlighet = ({
|
|
2035
|
-
selected,
|
|
2036
|
-
setSannsynlighet
|
|
2037
|
-
}) => {
|
|
2038
|
-
const { tabPanel } = tabStyles();
|
|
2039
|
-
const { headerSubtitle } = useFontStyles();
|
|
2040
|
-
const { t } = useTranslationRef(pluginRiScTranslationRef);
|
|
2041
|
-
const handleChange = (value) => {
|
|
2042
|
-
setSannsynlighet(value);
|
|
2043
|
-
};
|
|
2044
|
-
return /* @__PURE__ */ React.createElement(TabPanel, { className: tabPanel, value: "sannsynlighet" }, /* @__PURE__ */ React.createElement(Typography, { variant: "h5" }, t("dictionary.probability")), /* @__PURE__ */ React.createElement(Typography, { className: headerSubtitle }, t("scenarioDrawer.probabilityTab.subtitle")), /* @__PURE__ */ React.createElement(ProbabilityTable, { selectedValue: selected, handleChange }));
|
|
2045
|
-
};
|
|
2046
|
-
|
|
2047
|
-
const TabPanelTiltak = ({
|
|
2048
|
-
scenario,
|
|
2049
|
-
setEksisterendeTiltak,
|
|
2050
|
-
updateTiltak,
|
|
2051
|
-
deleteTiltak,
|
|
2052
|
-
addTiltak,
|
|
2053
|
-
updateRestrisiko,
|
|
2054
|
-
options
|
|
2055
|
-
}) => {
|
|
2056
|
-
const { arrow } = useTabsTiltakStyles();
|
|
2057
|
-
const setRestKonsekvens = (restKonsekvensLevel) => {
|
|
2058
|
-
updateRestrisiko({
|
|
2059
|
-
...scenario.remainingRisk,
|
|
2060
|
-
consequence: consequenceOptions[restKonsekvensLevel - 1]
|
|
2061
|
-
});
|
|
2062
|
-
};
|
|
2063
|
-
const setRestSannsynlighet = (restSannsynlighetLevel) => {
|
|
2064
|
-
updateRestrisiko({
|
|
2065
|
-
...scenario.remainingRisk,
|
|
2066
|
-
probability: probabilityOptions[restSannsynlighetLevel - 1]
|
|
2067
|
-
});
|
|
2068
|
-
};
|
|
2069
|
-
const { tabPanel } = tabStyles();
|
|
2070
|
-
const { body2, headerSubtitle, tiltakSubtitle } = useFontStyles();
|
|
2071
|
-
const { t } = useTranslationRef(pluginRiScTranslationRef);
|
|
2072
|
-
return /* @__PURE__ */ React.createElement(TabPanel, { value: "tiltak", className: tabPanel }, /* @__PURE__ */ React.createElement(Typography, { variant: "h5" }, t("dictionary.measure")), /* @__PURE__ */ React.createElement(Typography, { className: headerSubtitle }, t("scenarioDrawer.measureTab.subtitle")), /* @__PURE__ */ React.createElement(Grid$1, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(
|
|
2073
|
-
TextField,
|
|
2074
|
-
{
|
|
2075
|
-
label: t("scenarioDrawer.measureTab.existingMeasure"),
|
|
2076
|
-
subtitle: t("scenarioDrawer.measureTab.existingMeasureSubtitle"),
|
|
2077
|
-
value: scenario.existingActions,
|
|
2078
|
-
handleChange: setEksisterendeTiltak,
|
|
2079
|
-
minRows: 3
|
|
2080
|
-
}
|
|
2081
|
-
)), /* @__PURE__ */ React.createElement(Typography, { variant: "h6", className: tiltakSubtitle }, t("scenarioDrawer.measureTab.plannedMeasures")), scenario.actions.map((tiltak, index) => /* @__PURE__ */ React.createElement(
|
|
2082
|
-
TiltakEdit,
|
|
2083
|
-
{
|
|
2084
|
-
tiltak,
|
|
2085
|
-
index: index + 1,
|
|
2086
|
-
updateTiltak,
|
|
2087
|
-
deleteTiltak
|
|
2088
|
-
}
|
|
2089
|
-
)), /* @__PURE__ */ React.createElement(
|
|
2090
|
-
Button,
|
|
2091
|
-
{
|
|
2092
|
-
startIcon: /* @__PURE__ */ React.createElement(AddCircleOutlineIcon, null),
|
|
2093
|
-
color: "primary",
|
|
2094
|
-
onClick: addTiltak,
|
|
2095
|
-
style: { textTransform: "none" }
|
|
2096
|
-
},
|
|
2097
|
-
t("scenarioDrawer.measureTab.addMeasureButton")
|
|
2098
|
-
), /* @__PURE__ */ React.createElement(Divider, { variant: "fullWidth", style: { paddingTop: "1.5rem" } }), /* @__PURE__ */ React.createElement(Grid$1, { container: true, style: { paddingTop: "1.5rem" }, columns: 9 }, /* @__PURE__ */ React.createElement(Grid$1, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(Typography, { variant: "h5" }, t("dictionary.restRisk")), /* @__PURE__ */ React.createElement(Typography, { className: headerSubtitle }, t("scenarioDrawer.restRiskTab.subtitle"))), /* @__PURE__ */ React.createElement(Grid$1, { item: true, xs: 4 }, /* @__PURE__ */ React.createElement(Typography, { className: body2 }, t("dictionary.initialRisk"))), /* @__PURE__ */ React.createElement(Grid$1, { item: true, xs: 1 }), /* @__PURE__ */ React.createElement(Grid$1, { item: true, xs: 4 }, /* @__PURE__ */ React.createElement(Typography, { className: body2 }, t("dictionary.restRisk"))), /* @__PURE__ */ React.createElement(Grid$1, { item: true, xs: 2 }, /* @__PURE__ */ React.createElement(
|
|
2099
|
-
TextField,
|
|
2100
|
-
{
|
|
2101
|
-
label: t("dictionary.consequence"),
|
|
2102
|
-
value: getKonsekvensLevel(scenario.risk)
|
|
2103
|
-
}
|
|
2104
|
-
)), /* @__PURE__ */ React.createElement(Grid$1, { item: true, xs: 2 }, /* @__PURE__ */ React.createElement(
|
|
2105
|
-
TextField,
|
|
2106
|
-
{
|
|
2107
|
-
label: t("dictionary.probability"),
|
|
2108
|
-
value: getSannsynlighetLevel(scenario.risk)
|
|
2109
|
-
}
|
|
2110
|
-
)), /* @__PURE__ */ React.createElement(Grid$1, { item: true, xs: 1, className: arrow }, /* @__PURE__ */ React.createElement(KeyboardDoubleArrowRightIcon, { fontSize: "large" })), /* @__PURE__ */ React.createElement(Grid$1, { item: true, xs: 2 }, /* @__PURE__ */ React.createElement(
|
|
2111
|
-
Dropdown,
|
|
2112
|
-
{
|
|
2113
|
-
label: t("dictionary.consequence"),
|
|
2114
|
-
options,
|
|
2115
|
-
selectedValues: getKonsekvensLevel(scenario.remainingRisk),
|
|
2116
|
-
handleChange: setRestKonsekvens
|
|
2117
|
-
}
|
|
2118
|
-
)), /* @__PURE__ */ React.createElement(Grid$1, { item: true, xs: 2 }, /* @__PURE__ */ React.createElement(
|
|
2119
|
-
Dropdown,
|
|
2120
|
-
{
|
|
2121
|
-
label: t("dictionary.probability"),
|
|
2122
|
-
options,
|
|
2123
|
-
selectedValues: getSannsynlighetLevel(scenario.remainingRisk),
|
|
2124
|
-
handleChange: setRestSannsynlighet
|
|
2125
|
-
}
|
|
2126
|
-
))));
|
|
2127
|
-
};
|
|
2128
|
-
|
|
2129
|
-
const DeleteConfirmation = () => {
|
|
2130
|
-
const { deleteConfirmationIsOpen, abortDeletion, confirmDeletion } = useContext(ScenarioContext);
|
|
2131
|
-
const { t } = useTranslationRef(pluginRiScTranslationRef);
|
|
2132
|
-
return /* @__PURE__ */ React.createElement(Dialog, { open: deleteConfirmationIsOpen }, /* @__PURE__ */ React.createElement(DialogTitle, null, t("scenarioDrawer.deleteScenarioConfirmation")), /* @__PURE__ */ React.createElement(DialogActions, null, /* @__PURE__ */ React.createElement(Button, { style: { textTransform: "none" }, onClick: abortDeletion }, t("dictionary.cancel")), /* @__PURE__ */ React.createElement(Button, { style: { textTransform: "none" }, onClick: confirmDeletion }, t("scenarioDrawer.deleteScenarioButton"))));
|
|
2133
|
-
};
|
|
2134
|
-
|
|
2135
|
-
const ScenarioDrawerEdit = () => {
|
|
2136
|
-
const { header, buttons } = useScenarioDrawerContentStyles();
|
|
2137
|
-
const { h1, headerSubtitle, labelSubtitle, button, label } = useFontStyles();
|
|
2138
|
-
const { t } = useTranslationRef(pluginRiScTranslationRef);
|
|
2139
|
-
const {
|
|
2140
|
-
scenario,
|
|
2141
|
-
originalScenario,
|
|
2142
|
-
saveScenario,
|
|
2143
|
-
scenarioErrors,
|
|
2144
|
-
openDeleteConfirmation,
|
|
2145
|
-
setTittel,
|
|
2146
|
-
setBeskrivelse,
|
|
2147
|
-
setTrusselakt\u00F8rer,
|
|
2148
|
-
setS\u00E5rbarheter,
|
|
2149
|
-
setSannsynlighet,
|
|
2150
|
-
setKonsekvens,
|
|
2151
|
-
setEksisterendeTiltak,
|
|
2152
|
-
addTiltak,
|
|
2153
|
-
updateTiltak,
|
|
2154
|
-
deleteTiltak,
|
|
2155
|
-
updateRestrisiko,
|
|
2156
|
-
closeScenario
|
|
2157
|
-
} = useContext(ScenarioContext);
|
|
2158
|
-
const [tab, setTab] = useState("konsekvens");
|
|
2159
|
-
const [showCloseConfirmation, setShowCloseConfirmation] = useState(false);
|
|
2160
|
-
const close = () => {
|
|
2161
|
-
closeScenario();
|
|
2162
|
-
setShowCloseConfirmation(false);
|
|
2163
|
-
};
|
|
2164
|
-
const saveAndClose = () => {
|
|
2165
|
-
if (saveScenario()) {
|
|
2166
|
-
close();
|
|
2167
|
-
}
|
|
2168
|
-
};
|
|
2169
|
-
const handleCloseDrawer = () => {
|
|
2170
|
-
if (JSON.stringify(scenario) !== JSON.stringify(originalScenario)) {
|
|
2171
|
-
setShowCloseConfirmation(true);
|
|
2172
|
-
} else {
|
|
2173
|
-
close();
|
|
2174
|
-
}
|
|
2175
|
-
};
|
|
2176
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Box$2, { className: header }, /* @__PURE__ */ React.createElement(Typography, { className: h1 }, t("scenarioDrawer.title")), /* @__PURE__ */ React.createElement(
|
|
2177
|
-
Button,
|
|
2178
|
-
{
|
|
2179
|
-
className: button,
|
|
2180
|
-
variant: "outlined",
|
|
2181
|
-
color: "primary",
|
|
2182
|
-
onClick: handleCloseDrawer,
|
|
2183
|
-
endIcon: /* @__PURE__ */ React.createElement(KeyboardTabIcon, null)
|
|
2184
|
-
},
|
|
2185
|
-
t("dictionary.close")
|
|
2186
|
-
)), /* @__PURE__ */ React.createElement(Typography, { className: headerSubtitle }, t("scenarioDrawer.subtitle")), /* @__PURE__ */ React.createElement(Grid, { container: true }, /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(
|
|
2187
|
-
TextField,
|
|
2188
|
-
{
|
|
2189
|
-
label: t("dictionary.title"),
|
|
2190
|
-
value: scenario.title,
|
|
2191
|
-
error: scenarioErrors.tittel,
|
|
2192
|
-
required: true,
|
|
2193
|
-
minRows: 1,
|
|
2194
|
-
handleChange: setTittel
|
|
2195
|
-
}
|
|
2196
|
-
)), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 6 }, /* @__PURE__ */ React.createElement(Typography, { className: label }, t("dictionary.threatActors")), /* @__PURE__ */ React.createElement(Typography, { className: labelSubtitle }, t("scenarioDrawer.threatActorSubtitle")), /* @__PURE__ */ React.createElement(
|
|
2197
|
-
Dropdown,
|
|
2198
|
-
{
|
|
2199
|
-
selectedValues: scenario.threatActors,
|
|
2200
|
-
options: threatActorsOptions,
|
|
2201
|
-
handleChange: setTrusselakt\u00F8rer
|
|
2202
|
-
}
|
|
2203
|
-
)), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 6 }, /* @__PURE__ */ React.createElement(Typography, { className: label }, t("dictionary.vulnerabilities")), /* @__PURE__ */ React.createElement(Typography, { className: labelSubtitle }, t("scenarioDrawer.vulnerabilitySubtitle")), /* @__PURE__ */ React.createElement(
|
|
2204
|
-
Dropdown,
|
|
2205
|
-
{
|
|
2206
|
-
selectedValues: scenario.vulnerabilities,
|
|
2207
|
-
options: vulnerabilitiesOptions,
|
|
2208
|
-
handleChange: setS\u00E5rbarheter
|
|
2209
|
-
}
|
|
2210
|
-
)), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(
|
|
2211
|
-
TextField,
|
|
2212
|
-
{
|
|
2213
|
-
label: t("dictionary.description"),
|
|
2214
|
-
value: scenario.description,
|
|
2215
|
-
minRows: 4,
|
|
2216
|
-
handleChange: setBeskrivelse
|
|
2217
|
-
}
|
|
2218
|
-
)), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(TabContext, { value: tab }, /* @__PURE__ */ React.createElement(Tabs$1, { setTab }), /* @__PURE__ */ React.createElement(
|
|
2219
|
-
TabPanelKonsekvens,
|
|
2220
|
-
{
|
|
2221
|
-
selected: getKonsekvensLevel(scenario.risk),
|
|
2222
|
-
setKonsekvens
|
|
2223
|
-
}
|
|
2224
|
-
), /* @__PURE__ */ React.createElement(
|
|
2225
|
-
TabPanelSannsynlighet,
|
|
2226
|
-
{
|
|
2227
|
-
selected: getSannsynlighetLevel(scenario.risk),
|
|
2228
|
-
setSannsynlighet,
|
|
2229
|
-
options: probabilityOptions.map(
|
|
2230
|
-
(_, index) => (index + 1).toString()
|
|
2231
|
-
)
|
|
2232
|
-
}
|
|
2233
|
-
), /* @__PURE__ */ React.createElement(
|
|
2234
|
-
TabPanelTiltak,
|
|
2235
|
-
{
|
|
2236
|
-
scenario,
|
|
2237
|
-
setEksisterendeTiltak,
|
|
2238
|
-
updateTiltak,
|
|
2239
|
-
deleteTiltak,
|
|
2240
|
-
addTiltak,
|
|
2241
|
-
updateRestrisiko,
|
|
2242
|
-
options: consequenceOptions.map(
|
|
2243
|
-
(_, index) => (index + 1).toString()
|
|
2244
|
-
)
|
|
2245
|
-
}
|
|
2246
|
-
))), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12, className: buttons, style: { paddingTop: "1rem" } }, /* @__PURE__ */ React.createElement(Button, { variant: "contained", color: "primary", onClick: saveAndClose }, t("dictionary.save")), /* @__PURE__ */ React.createElement(
|
|
2247
|
-
Button,
|
|
2248
|
-
{
|
|
2249
|
-
variant: "outlined",
|
|
2250
|
-
color: "primary",
|
|
2251
|
-
onClick: handleCloseDrawer
|
|
2252
|
-
},
|
|
2253
|
-
t("dictionary.cancel")
|
|
2254
|
-
), /* @__PURE__ */ React.createElement(
|
|
2255
|
-
Grid,
|
|
2256
|
-
{
|
|
2257
|
-
item: true,
|
|
2258
|
-
container: true,
|
|
2259
|
-
xs: 12,
|
|
2260
|
-
style: { display: "flex", justifyContent: "flex-end" }
|
|
2261
|
-
},
|
|
2262
|
-
/* @__PURE__ */ React.createElement(
|
|
2263
|
-
Button,
|
|
2264
|
-
{
|
|
2265
|
-
startIcon: /* @__PURE__ */ React.createElement(DeleteIcon$1, null),
|
|
2266
|
-
variant: "text",
|
|
2267
|
-
color: "primary",
|
|
2268
|
-
onClick: openDeleteConfirmation
|
|
2269
|
-
},
|
|
2270
|
-
t("scenarioDrawer.deleteScenarioButton")
|
|
2271
|
-
)
|
|
2272
|
-
))), /* @__PURE__ */ React.createElement(DeleteConfirmation, null), /* @__PURE__ */ React.createElement(
|
|
2273
|
-
CloseConfirmation,
|
|
2274
|
-
{
|
|
2275
|
-
isOpen: showCloseConfirmation,
|
|
2276
|
-
close,
|
|
2277
|
-
save: saveAndClose
|
|
2278
|
-
}
|
|
2279
|
-
));
|
|
2280
|
-
};
|
|
2281
|
-
|
|
2282
|
-
const useTiltakViewStyles = makeStyles((_) => ({
|
|
2283
|
-
alignCenter: {
|
|
1904
|
+
flexDirection: "row",
|
|
1905
|
+
justifyContent: "space-between"
|
|
1906
|
+
},
|
|
1907
|
+
buttons: {
|
|
2284
1908
|
display: "flex",
|
|
2285
|
-
|
|
1909
|
+
flexDirection: "row",
|
|
1910
|
+
alignItems: "center",
|
|
1911
|
+
gap: theme.spacing(2),
|
|
1912
|
+
marginTop: theme.spacing(4)
|
|
2286
1913
|
},
|
|
2287
|
-
|
|
1914
|
+
risikoBadge: {
|
|
1915
|
+
width: "20px",
|
|
1916
|
+
height: "48px",
|
|
1917
|
+
borderRadius: "20%"
|
|
1918
|
+
},
|
|
1919
|
+
titleAndButton: {
|
|
2288
1920
|
display: "flex",
|
|
2289
|
-
|
|
1921
|
+
flexDirection: "row",
|
|
1922
|
+
justifyContent: "space-between"
|
|
1923
|
+
},
|
|
1924
|
+
section: {
|
|
1925
|
+
padding: theme.spacing(2),
|
|
1926
|
+
marginBottom: theme.spacing(2),
|
|
1927
|
+
backgroundColor: theme.palette.type === "dark" ? "#555555" : "#e0e0e0"
|
|
1928
|
+
},
|
|
1929
|
+
gridContainer: {
|
|
1930
|
+
padding: theme.spacing(2),
|
|
1931
|
+
marginBottom: theme.palette.type === "dark" ? theme.spacing(1) : "7px",
|
|
1932
|
+
backgroundColor: theme.palette.type === "dark" ? "#55555519" : "#e0e0e019"
|
|
1933
|
+
},
|
|
1934
|
+
editIcon: {
|
|
1935
|
+
color: theme.palette.type === "dark" ? "#fff" : "rgba(0, 0, 0, 0.54)"
|
|
2290
1936
|
}
|
|
2291
1937
|
}));
|
|
2292
1938
|
|
|
2293
|
-
const
|
|
2294
|
-
const { measure } = useScenarioDrawerContentStyles();
|
|
2295
|
-
const { alignCenter, justifyEnd } = useTiltakViewStyles();
|
|
2296
|
-
const { body2, label } = useFontStyles();
|
|
2297
|
-
const { t } = useTranslationRef(pluginRiScTranslationRef);
|
|
2298
|
-
return /* @__PURE__ */ React.createElement(Grid, { container: true, className: measure }, /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12, className: alignCenter }, /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 6 }, /* @__PURE__ */ React.createElement(Typography, { className: label }, t("dictionary.measure"), " ", index)), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 6, className: justifyEnd }, /* @__PURE__ */ React.createElement(
|
|
2299
|
-
Chip,
|
|
2300
|
-
{
|
|
2301
|
-
label: tiltak.status,
|
|
2302
|
-
size: "small",
|
|
2303
|
-
style: {
|
|
2304
|
-
margin: 0,
|
|
2305
|
-
padding: 0,
|
|
2306
|
-
backgroundColor: "#D9D9D9",
|
|
2307
|
-
color: "#000000"
|
|
2308
|
-
}
|
|
2309
|
-
}
|
|
2310
|
-
))), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(Typography, { className: body2 }, tiltak.description)), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 4 }, /* @__PURE__ */ React.createElement(Typography, { className: label }, t("dictionary.measureOwner")), /* @__PURE__ */ React.createElement(Typography, { className: body2 }, tiltak.owner)), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 4 }, /* @__PURE__ */ React.createElement(Typography, { className: label }, t("dictionary.deadline")), /* @__PURE__ */ React.createElement(Typography, { className: body2 }, formatDate(tiltak.deadline))));
|
|
2311
|
-
};
|
|
2312
|
-
|
|
2313
|
-
const RiskView = () => {
|
|
2314
|
-
const { risikoBadge, titleAndButton, section, editIcon } = useScenarioDrawerContentStyles();
|
|
2315
|
-
const { h3, body1, label, button } = useFontStyles();
|
|
2316
|
-
const { t } = useTranslationRef(pluginRiScTranslationRef);
|
|
1939
|
+
const RiskSection = () => {
|
|
2317
1940
|
const { scenario, editScenario } = useContext(ScenarioContext);
|
|
2318
1941
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
2319
1942
|
Box$2,
|
|
@@ -2324,53 +1947,14 @@ const RiskView = () => {
|
|
|
2324
1947
|
alignItems: "center"
|
|
2325
1948
|
}
|
|
2326
1949
|
},
|
|
2327
|
-
/* @__PURE__ */ React.createElement(
|
|
2328
|
-
|
|
1950
|
+
/* @__PURE__ */ React.createElement(
|
|
1951
|
+
RiskBox,
|
|
2329
1952
|
{
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
onClick: () => editScenario("initialRisk"),
|
|
2334
|
-
startIcon: /* @__PURE__ */ React.createElement(EditIcon, { className: editIcon, "aria-label": "Edit" })
|
|
1953
|
+
risk: scenario.risk,
|
|
1954
|
+
riskType: "initialRisk",
|
|
1955
|
+
editScenario
|
|
2335
1956
|
}
|
|
2336
|
-
)
|
|
2337
|
-
Grid,
|
|
2338
|
-
{
|
|
2339
|
-
item: true,
|
|
2340
|
-
xs: 12,
|
|
2341
|
-
style: {
|
|
2342
|
-
display: "flex",
|
|
2343
|
-
flexDirection: "row",
|
|
2344
|
-
gap: "0.5rem",
|
|
2345
|
-
alignItems: "center"
|
|
2346
|
-
}
|
|
2347
|
-
},
|
|
2348
|
-
/* @__PURE__ */ React.createElement(
|
|
2349
|
-
Box$2,
|
|
2350
|
-
{
|
|
2351
|
-
className: risikoBadge,
|
|
2352
|
-
style: {
|
|
2353
|
-
backgroundColor: getRiskMatrixColor(scenario.risk)
|
|
2354
|
-
}
|
|
2355
|
-
}
|
|
2356
|
-
),
|
|
2357
|
-
/* @__PURE__ */ React.createElement(
|
|
2358
|
-
Grid,
|
|
2359
|
-
{
|
|
2360
|
-
item: true,
|
|
2361
|
-
xs: 12,
|
|
2362
|
-
style: {
|
|
2363
|
-
display: "flex",
|
|
2364
|
-
flexDirection: "column",
|
|
2365
|
-
alignItems: "start"
|
|
2366
|
-
}
|
|
2367
|
-
},
|
|
2368
|
-
/* @__PURE__ */ React.createElement(Typography, { className: label }, t("dictionary.probability"), ":", " ", getSannsynlighetLevel(scenario.risk)),
|
|
2369
|
-
/* @__PURE__ */ React.createElement(Typography, { className: label }, t("dictionary.consequence"), ":", " ", getKonsekvensLevel(scenario.risk))
|
|
2370
|
-
)
|
|
2371
|
-
), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12, style: { paddingBottom: 0 } }, /* @__PURE__ */ React.createElement(Typography, { className: label }, t("dictionary.estimatedRisk"))), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12, style: { paddingTop: 0 } }, /* @__PURE__ */ React.createElement(Typography, { className: body1 }, formatNOK(
|
|
2372
|
-
scenario.risk.consequence * scenario.risk.probability
|
|
2373
|
-
), " ", t("riskMatrix.estimatedRisk.unit.nokPerYear"))))),
|
|
1957
|
+
),
|
|
2374
1958
|
/* @__PURE__ */ React.createElement(
|
|
2375
1959
|
Grid,
|
|
2376
1960
|
{
|
|
@@ -2384,118 +1968,164 @@ const RiskView = () => {
|
|
|
2384
1968
|
},
|
|
2385
1969
|
/* @__PURE__ */ React.createElement(KeyboardDoubleArrowRightIcon, { fontSize: "large" })
|
|
2386
1970
|
),
|
|
2387
|
-
/* @__PURE__ */ React.createElement(
|
|
2388
|
-
|
|
1971
|
+
/* @__PURE__ */ React.createElement(
|
|
1972
|
+
RiskBox,
|
|
2389
1973
|
{
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
onClick: () => editScenario("restRisk"),
|
|
2394
|
-
startIcon: /* @__PURE__ */ React.createElement(EditIcon, { className: editIcon, "aria-label": "Edit" })
|
|
1974
|
+
risk: scenario.risk,
|
|
1975
|
+
riskType: "initialRisk",
|
|
1976
|
+
editScenario
|
|
2395
1977
|
}
|
|
2396
|
-
)
|
|
2397
|
-
Grid,
|
|
2398
|
-
{
|
|
2399
|
-
item: true,
|
|
2400
|
-
xs: 12,
|
|
2401
|
-
style: {
|
|
2402
|
-
display: "flex",
|
|
2403
|
-
flexDirection: "row",
|
|
2404
|
-
gap: "0.5rem",
|
|
2405
|
-
alignItems: "center"
|
|
2406
|
-
}
|
|
2407
|
-
},
|
|
2408
|
-
/* @__PURE__ */ React.createElement(
|
|
2409
|
-
Box$2,
|
|
2410
|
-
{
|
|
2411
|
-
className: risikoBadge,
|
|
2412
|
-
style: {
|
|
2413
|
-
backgroundColor: getRiskMatrixColor(scenario.remainingRisk)
|
|
2414
|
-
}
|
|
2415
|
-
}
|
|
2416
|
-
),
|
|
2417
|
-
/* @__PURE__ */ React.createElement(
|
|
2418
|
-
Grid,
|
|
2419
|
-
{
|
|
2420
|
-
item: true,
|
|
2421
|
-
xs: 12,
|
|
2422
|
-
style: {
|
|
2423
|
-
display: "flex",
|
|
2424
|
-
flexDirection: "column",
|
|
2425
|
-
alignItems: "start"
|
|
2426
|
-
}
|
|
2427
|
-
},
|
|
2428
|
-
/* @__PURE__ */ React.createElement(Typography, { className: label }, t("dictionary.probability"), ":", " ", getSannsynlighetLevel(scenario.remainingRisk)),
|
|
2429
|
-
/* @__PURE__ */ React.createElement(Typography, { className: label }, t("dictionary.consequence"), ":", " ", getKonsekvensLevel(scenario.remainingRisk))
|
|
2430
|
-
)
|
|
2431
|
-
), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12, style: { paddingBottom: 0 } }, /* @__PURE__ */ React.createElement(Typography, { className: label }, t("dictionary.estimatedRisk"))), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12, style: { paddingTop: 0 } }, /* @__PURE__ */ React.createElement(Typography, { className: body1 }, formatNOK(
|
|
2432
|
-
scenario.remainingRisk.consequence * scenario.remainingRisk.probability
|
|
2433
|
-
), " ", t("riskMatrix.estimatedRisk.unit.nokPerYear")))))
|
|
1978
|
+
)
|
|
2434
1979
|
));
|
|
2435
1980
|
};
|
|
2436
|
-
|
|
2437
|
-
const
|
|
2438
|
-
const {
|
|
2439
|
-
const { h1, h3, body2, label, button } = useFontStyles();
|
|
2440
|
-
const { scenario, editScenario } = useContext(ScenarioContext);
|
|
1981
|
+
const RiskBox = ({ risk, riskType, editScenario }) => {
|
|
1982
|
+
const { risikoBadge, titleAndButton, section, editIcon } = useScenarioDrawerStyles();
|
|
1983
|
+
const { h3, body1, label, button } = useFontStyles();
|
|
2441
1984
|
const { t } = useTranslationRef(pluginRiScTranslationRef);
|
|
2442
|
-
return /* @__PURE__ */ React.createElement(Paper, { className: section, style: { padding: "1rem" } }, /* @__PURE__ */ React.createElement(
|
|
1985
|
+
return /* @__PURE__ */ React.createElement(Paper, { className: section, style: { padding: "1rem" } }, /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12, className: titleAndButton }, /* @__PURE__ */ React.createElement(Typography, { className: h3 }, t(`dictionary.${riskType}`)), /* @__PURE__ */ React.createElement(
|
|
2443
1986
|
Button,
|
|
2444
1987
|
{
|
|
2445
1988
|
className: button,
|
|
2446
1989
|
variant: "text",
|
|
2447
1990
|
color: "primary",
|
|
2448
|
-
onClick: () => editScenario(
|
|
1991
|
+
onClick: () => editScenario(riskType),
|
|
2449
1992
|
startIcon: /* @__PURE__ */ React.createElement(EditIcon, { className: editIcon, "aria-label": "Edit" })
|
|
2450
1993
|
}
|
|
2451
|
-
)), /* @__PURE__ */ React.createElement(Grid, {
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
const ScenarioDrawerView = () => {
|
|
2455
|
-
const { buttons, titleAndButton, section, editIcon } = useScenarioDrawerContentStyles();
|
|
2456
|
-
const { h3, button } = useFontStyles();
|
|
2457
|
-
const {
|
|
2458
|
-
scenario,
|
|
2459
|
-
saveScenario,
|
|
2460
|
-
openDeleteConfirmation,
|
|
2461
|
-
closeScenario,
|
|
2462
|
-
editScenario
|
|
2463
|
-
} = useContext(ScenarioContext);
|
|
2464
|
-
const { t } = useTranslationRef(pluginRiScTranslationRef);
|
|
2465
|
-
const [showCloseConfirmation, setShowCloseConfirmation] = useState(false);
|
|
2466
|
-
const close = () => {
|
|
2467
|
-
closeScenario();
|
|
2468
|
-
setShowCloseConfirmation(false);
|
|
2469
|
-
};
|
|
2470
|
-
const saveAndClose = () => {
|
|
2471
|
-
if (saveScenario()) {
|
|
2472
|
-
close();
|
|
2473
|
-
}
|
|
2474
|
-
};
|
|
2475
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
2476
|
-
Box$2,
|
|
1994
|
+
)), /* @__PURE__ */ React.createElement(Grid, { container: true }, /* @__PURE__ */ React.createElement(
|
|
1995
|
+
Grid,
|
|
2477
1996
|
{
|
|
2478
|
-
|
|
1997
|
+
item: true,
|
|
1998
|
+
xs: 12,
|
|
2479
1999
|
style: {
|
|
2480
|
-
marginBottom: "8px",
|
|
2481
|
-
marginTop: "8px",
|
|
2482
2000
|
display: "flex",
|
|
2483
2001
|
flexDirection: "row",
|
|
2484
2002
|
gap: "0.5rem",
|
|
2485
|
-
|
|
2003
|
+
alignItems: "center"
|
|
2486
2004
|
}
|
|
2487
2005
|
},
|
|
2488
2006
|
/* @__PURE__ */ React.createElement(
|
|
2489
|
-
|
|
2007
|
+
Box$2,
|
|
2490
2008
|
{
|
|
2491
|
-
className:
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2009
|
+
className: risikoBadge,
|
|
2010
|
+
style: {
|
|
2011
|
+
backgroundColor: getRiskMatrixColor(risk)
|
|
2012
|
+
}
|
|
2013
|
+
}
|
|
2014
|
+
),
|
|
2015
|
+
/* @__PURE__ */ React.createElement(
|
|
2016
|
+
Grid,
|
|
2017
|
+
{
|
|
2018
|
+
item: true,
|
|
2019
|
+
xs: 12,
|
|
2020
|
+
style: {
|
|
2021
|
+
display: "flex",
|
|
2022
|
+
flexDirection: "column",
|
|
2023
|
+
alignItems: "start"
|
|
2024
|
+
}
|
|
2495
2025
|
},
|
|
2496
|
-
t("dictionary.
|
|
2026
|
+
/* @__PURE__ */ React.createElement(Typography, { className: label }, t("dictionary.probability"), ": ", getProbabilityLevel(risk)),
|
|
2027
|
+
/* @__PURE__ */ React.createElement(Typography, { className: label }, t("dictionary.consequence"), ": ", getConsequenceLevel(risk))
|
|
2497
2028
|
)
|
|
2498
|
-
), /* @__PURE__ */ React.createElement(
|
|
2029
|
+
), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12, style: { paddingBottom: 0 } }, /* @__PURE__ */ React.createElement(Typography, { className: label }, t("dictionary.estimatedRisk"))), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12, style: { paddingTop: 0 } }, /* @__PURE__ */ React.createElement(Typography, { className: body1 }, formatNOK(risk.consequence * risk.probability), " ", t("riskMatrix.estimatedRisk.unit.nokPerYear")))));
|
|
2030
|
+
};
|
|
2031
|
+
|
|
2032
|
+
const useActionBoxStyles = makeStyles((_) => ({
|
|
2033
|
+
alignCenter: {
|
|
2034
|
+
display: "flex",
|
|
2035
|
+
alignItems: "center"
|
|
2036
|
+
},
|
|
2037
|
+
justifyEnd: {
|
|
2038
|
+
display: "flex",
|
|
2039
|
+
justifyContent: "flex-end"
|
|
2040
|
+
}
|
|
2041
|
+
}));
|
|
2042
|
+
|
|
2043
|
+
const ChipDropdown = ({
|
|
2044
|
+
options,
|
|
2045
|
+
selectedValue,
|
|
2046
|
+
handleChange
|
|
2047
|
+
}) => {
|
|
2048
|
+
const [anchorEl, setAnchorEl] = useState(null);
|
|
2049
|
+
const [menuAnchorEl, setMenuAnchorEl] = useState(null);
|
|
2050
|
+
const handleClick = (item) => {
|
|
2051
|
+
setAnchorEl(null);
|
|
2052
|
+
handleChange(item);
|
|
2053
|
+
};
|
|
2054
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
2055
|
+
Chip,
|
|
2056
|
+
{
|
|
2057
|
+
style: {
|
|
2058
|
+
margin: 0,
|
|
2059
|
+
padding: 0,
|
|
2060
|
+
backgroundColor: "#D9D9D9",
|
|
2061
|
+
color: "#000000"
|
|
2062
|
+
},
|
|
2063
|
+
label: selectedValue,
|
|
2064
|
+
onClick: (e) => {
|
|
2065
|
+
setAnchorEl(e.currentTarget);
|
|
2066
|
+
setMenuAnchorEl(e.currentTarget);
|
|
2067
|
+
},
|
|
2068
|
+
icon: /* @__PURE__ */ React.createElement(KeyboardArrowDownIcon, { style: { color: "#000000" } })
|
|
2069
|
+
}
|
|
2070
|
+
), /* @__PURE__ */ React.createElement(
|
|
2071
|
+
Menu,
|
|
2072
|
+
{
|
|
2073
|
+
anchorEl: menuAnchorEl,
|
|
2074
|
+
open: Boolean(anchorEl),
|
|
2075
|
+
onClose: () => setAnchorEl(null),
|
|
2076
|
+
getContentAnchorEl: null,
|
|
2077
|
+
anchorOrigin: {
|
|
2078
|
+
vertical: "bottom",
|
|
2079
|
+
horizontal: "center"
|
|
2080
|
+
},
|
|
2081
|
+
transformOrigin: {
|
|
2082
|
+
vertical: "top",
|
|
2083
|
+
horizontal: "center"
|
|
2084
|
+
}
|
|
2085
|
+
},
|
|
2086
|
+
options.map((item) => /* @__PURE__ */ React.createElement(MenuItem, { key: item, onClick: () => handleClick(item) }, item))
|
|
2087
|
+
));
|
|
2088
|
+
};
|
|
2089
|
+
|
|
2090
|
+
const ActionBox = ({
|
|
2091
|
+
action,
|
|
2092
|
+
index,
|
|
2093
|
+
updateAction,
|
|
2094
|
+
saveScenario
|
|
2095
|
+
}) => {
|
|
2096
|
+
const { t } = useTranslationRef(pluginRiScTranslationRef);
|
|
2097
|
+
const { body2, label } = useFontStyles();
|
|
2098
|
+
const { gridContainer } = useScenarioDrawerStyles();
|
|
2099
|
+
const { alignCenter, justifyEnd } = useActionBoxStyles();
|
|
2100
|
+
const [previousAction, setPreviousAction] = useState(action);
|
|
2101
|
+
useEffect(() => {
|
|
2102
|
+
if (previousAction !== action) {
|
|
2103
|
+
saveScenario();
|
|
2104
|
+
setPreviousAction(action);
|
|
2105
|
+
}
|
|
2106
|
+
}, [action, saveScenario, previousAction]);
|
|
2107
|
+
const setStatus = (status) => {
|
|
2108
|
+
updateAction({
|
|
2109
|
+
...action,
|
|
2110
|
+
status
|
|
2111
|
+
});
|
|
2112
|
+
};
|
|
2113
|
+
return /* @__PURE__ */ React.createElement(Grid, { container: true, className: gridContainer }, /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12, className: alignCenter }, /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 6 }, /* @__PURE__ */ React.createElement(Typography, { className: label }, t("dictionary.measure"), " ", index)), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 6, className: justifyEnd }, /* @__PURE__ */ React.createElement(
|
|
2114
|
+
ChipDropdown,
|
|
2115
|
+
{
|
|
2116
|
+
options: actionStatusOptions,
|
|
2117
|
+
selectedValue: action.status,
|
|
2118
|
+
handleChange: setStatus
|
|
2119
|
+
}
|
|
2120
|
+
))), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(Typography, { className: body2 }, action.description)), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 4 }, /* @__PURE__ */ React.createElement(Typography, { className: label }, t("dictionary.measureOwner")), /* @__PURE__ */ React.createElement(Typography, { className: body2 }, action.owner)), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 4 }, /* @__PURE__ */ React.createElement(Typography, { className: label }, t("dictionary.deadline")), /* @__PURE__ */ React.createElement(Typography, { className: body2 }, formatDate(action.deadline))));
|
|
2121
|
+
};
|
|
2122
|
+
|
|
2123
|
+
const ActionsSection = () => {
|
|
2124
|
+
const { t } = useTranslationRef(pluginRiScTranslationRef);
|
|
2125
|
+
const { h3, button } = useFontStyles();
|
|
2126
|
+
const { titleAndButton, section, editIcon } = useScenarioDrawerStyles();
|
|
2127
|
+
const { scenario, editScenario, saveScenario, updateAction } = useContext(ScenarioContext);
|
|
2128
|
+
return /* @__PURE__ */ React.createElement(Box$2, null, /* @__PURE__ */ React.createElement(Paper, { className: section, style: { padding: "1rem" } }, /* @__PURE__ */ React.createElement(
|
|
2499
2129
|
Grid,
|
|
2500
2130
|
{
|
|
2501
2131
|
item: true,
|
|
@@ -2516,52 +2146,105 @@ const ScenarioDrawerView = () => {
|
|
|
2516
2146
|
startIcon: /* @__PURE__ */ React.createElement(EditIcon, { className: editIcon, "aria-label": "Edit" })
|
|
2517
2147
|
}
|
|
2518
2148
|
)
|
|
2519
|
-
), scenario.actions.map((action, index) => /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
2520
|
-
|
|
2149
|
+
), scenario.actions.map((action, index) => /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
2150
|
+
ActionBox,
|
|
2521
2151
|
{
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2152
|
+
action,
|
|
2153
|
+
index: index + 1,
|
|
2154
|
+
updateAction,
|
|
2155
|
+
saveScenario
|
|
2156
|
+
}
|
|
2157
|
+
), index !== scenario.actions.length - 1 && /* @__PURE__ */ React.createElement(Divider$1, { variant: "fullWidth" })))));
|
|
2158
|
+
};
|
|
2159
|
+
|
|
2160
|
+
const DeleteConfirmation = () => {
|
|
2161
|
+
const { t } = useTranslationRef(pluginRiScTranslationRef);
|
|
2162
|
+
const { deleteConfirmationIsOpen, abortDeletion, confirmDeletion } = useContext(ScenarioContext);
|
|
2163
|
+
return /* @__PURE__ */ React.createElement(Dialog, { open: deleteConfirmationIsOpen }, /* @__PURE__ */ React.createElement(DialogTitle, null, t("scenarioDrawer.deleteScenarioConfirmation")), /* @__PURE__ */ React.createElement(DialogActions, null, /* @__PURE__ */ React.createElement(Button, { style: { textTransform: "none" }, onClick: abortDeletion }, t("dictionary.cancel")), /* @__PURE__ */ React.createElement(Button, { style: { textTransform: "none" }, onClick: confirmDeletion }, t("scenarioDrawer.deleteScenarioButton"))));
|
|
2164
|
+
};
|
|
2165
|
+
|
|
2166
|
+
const ScopeSection = () => {
|
|
2167
|
+
const { t } = useTranslationRef(pluginRiScTranslationRef);
|
|
2168
|
+
const { h1, h3, body2, label, button } = useFontStyles();
|
|
2169
|
+
const { header, titleAndButton, section, editIcon } = useScenarioDrawerStyles();
|
|
2170
|
+
const { scenario, editScenario } = useContext(ScenarioContext);
|
|
2171
|
+
return /* @__PURE__ */ React.createElement(Paper, { className: section, style: { padding: "1rem" } }, /* @__PURE__ */ React.createElement(Box$2, { className: header }, /* @__PURE__ */ React.createElement(Grid, { container: true }, /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12, className: titleAndButton }, /* @__PURE__ */ React.createElement(Typography, { variant: "h3", className: h3 }, t("scenarioDrawer.title")), /* @__PURE__ */ React.createElement(
|
|
2172
|
+
Button,
|
|
2542
2173
|
{
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2174
|
+
className: button,
|
|
2175
|
+
variant: "text",
|
|
2176
|
+
color: "primary",
|
|
2177
|
+
onClick: () => editScenario("scenario"),
|
|
2178
|
+
startIcon: /* @__PURE__ */ React.createElement(EditIcon, { className: editIcon, "aria-label": "Edit" })
|
|
2546
2179
|
}
|
|
2547
|
-
));
|
|
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))))));
|
|
2548
2181
|
};
|
|
2549
2182
|
|
|
2550
2183
|
const ScenarioDrawer = () => {
|
|
2551
|
-
const {
|
|
2552
|
-
const {
|
|
2184
|
+
const { t } = useTranslationRef(pluginRiScTranslationRef);
|
|
2185
|
+
const { drawer, buttons } = useScenarioDrawerStyles();
|
|
2186
|
+
const { button } = useFontStyles();
|
|
2187
|
+
const { scenarioDrawerState, openDeleteConfirmation, closeScenario } = useContext(ScenarioContext);
|
|
2553
2188
|
const isOpen = scenarioDrawerState !== ScenarioDrawerState.Closed;
|
|
2554
|
-
const editMode = scenarioDrawerState === ScenarioDrawerState.Edit;
|
|
2555
2189
|
return /* @__PURE__ */ React.createElement(
|
|
2556
2190
|
Drawer,
|
|
2557
2191
|
{
|
|
2558
|
-
classes: { paper:
|
|
2192
|
+
classes: { paper: drawer },
|
|
2559
2193
|
variant: "temporary",
|
|
2560
2194
|
anchor: "right",
|
|
2561
2195
|
open: isOpen,
|
|
2562
2196
|
onClose: closeScenario
|
|
2563
2197
|
},
|
|
2564
|
-
|
|
2198
|
+
/* @__PURE__ */ React.createElement(
|
|
2199
|
+
Box$2,
|
|
2200
|
+
{
|
|
2201
|
+
className: buttons,
|
|
2202
|
+
style: {
|
|
2203
|
+
marginBottom: "8px",
|
|
2204
|
+
marginTop: "8px",
|
|
2205
|
+
display: "flex",
|
|
2206
|
+
flexDirection: "row",
|
|
2207
|
+
gap: "0.5rem",
|
|
2208
|
+
justifyContent: "flex-end"
|
|
2209
|
+
}
|
|
2210
|
+
},
|
|
2211
|
+
/* @__PURE__ */ React.createElement(
|
|
2212
|
+
Button,
|
|
2213
|
+
{
|
|
2214
|
+
className: button,
|
|
2215
|
+
variant: "outlined",
|
|
2216
|
+
color: "primary",
|
|
2217
|
+
onClick: closeScenario
|
|
2218
|
+
},
|
|
2219
|
+
t("dictionary.close")
|
|
2220
|
+
)
|
|
2221
|
+
),
|
|
2222
|
+
/* @__PURE__ */ React.createElement(ScopeSection, null),
|
|
2223
|
+
/* @__PURE__ */ React.createElement(RiskSection, null),
|
|
2224
|
+
/* @__PURE__ */ React.createElement(ActionsSection, null),
|
|
2225
|
+
/* @__PURE__ */ React.createElement(
|
|
2226
|
+
Box$2,
|
|
2227
|
+
{
|
|
2228
|
+
className: buttons,
|
|
2229
|
+
style: {
|
|
2230
|
+
display: "flex",
|
|
2231
|
+
flexDirection: "row",
|
|
2232
|
+
gap: "0.5rem",
|
|
2233
|
+
justifyContent: "flex-start"
|
|
2234
|
+
}
|
|
2235
|
+
},
|
|
2236
|
+
/* @__PURE__ */ React.createElement(
|
|
2237
|
+
Button,
|
|
2238
|
+
{
|
|
2239
|
+
startIcon: /* @__PURE__ */ React.createElement(DeleteIcon$1, null),
|
|
2240
|
+
variant: "text",
|
|
2241
|
+
color: "primary",
|
|
2242
|
+
onClick: openDeleteConfirmation
|
|
2243
|
+
},
|
|
2244
|
+
t("scenarioDrawer.deleteScenarioButton")
|
|
2245
|
+
)
|
|
2246
|
+
),
|
|
2247
|
+
/* @__PURE__ */ React.createElement(DeleteConfirmation, null)
|
|
2565
2248
|
);
|
|
2566
2249
|
};
|
|
2567
2250
|
|
|
@@ -2638,8 +2321,9 @@ const RiskMatrixScenarioCount = ({
|
|
|
2638
2321
|
riSc,
|
|
2639
2322
|
probability,
|
|
2640
2323
|
consequence,
|
|
2641
|
-
|
|
2324
|
+
initialRisk
|
|
2642
2325
|
}) => {
|
|
2326
|
+
const { t } = useTranslationRef(pluginRiScTranslationRef);
|
|
2643
2327
|
const {
|
|
2644
2328
|
circle,
|
|
2645
2329
|
centered,
|
|
@@ -2649,19 +2333,18 @@ const RiskMatrixScenarioCount = ({
|
|
|
2649
2333
|
tooltipArrow,
|
|
2650
2334
|
tooltipText
|
|
2651
2335
|
} = useRiskMatrixStyles();
|
|
2652
|
-
const { t } = useTranslationRef(pluginRiScTranslationRef);
|
|
2653
2336
|
const [tooltipOpen, setTooltipOpen] = useState(false);
|
|
2654
|
-
const
|
|
2337
|
+
const scenarios = riSc.scenarios.filter(
|
|
2655
2338
|
(scenario) => probabilityOptions.indexOf(
|
|
2656
|
-
|
|
2339
|
+
initialRisk ? scenario.risk.probability : scenario.remainingRisk.probability
|
|
2657
2340
|
) === probability && consequenceOptions.indexOf(
|
|
2658
|
-
|
|
2341
|
+
initialRisk ? scenario.risk.consequence : scenario.remainingRisk.consequence
|
|
2659
2342
|
) === consequence
|
|
2660
2343
|
);
|
|
2661
|
-
if (
|
|
2344
|
+
if (scenarios.length === 0) {
|
|
2662
2345
|
return null;
|
|
2663
2346
|
}
|
|
2664
|
-
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"))),
|
|
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(
|
|
2665
2348
|
ListItemText$1,
|
|
2666
2349
|
{
|
|
2667
2350
|
className: tooltipText,
|
|
@@ -2685,12 +2368,12 @@ const RiskMatrixScenarioCount = ({
|
|
|
2685
2368
|
elevation: 10,
|
|
2686
2369
|
onClick: () => setTooltipOpen(!tooltipOpen)
|
|
2687
2370
|
},
|
|
2688
|
-
/* @__PURE__ */ React.createElement(Typography, { className: `${circleText} ${text}` },
|
|
2371
|
+
/* @__PURE__ */ React.createElement(Typography, { className: `${circleText} ${text}` }, scenarios.length)
|
|
2689
2372
|
)
|
|
2690
2373
|
));
|
|
2691
2374
|
};
|
|
2692
2375
|
|
|
2693
|
-
const
|
|
2376
|
+
const useEstimatedRiskInfoDialogStyles = makeStyles({
|
|
2694
2377
|
paper: {
|
|
2695
2378
|
backgroundColor: "white"
|
|
2696
2379
|
},
|
|
@@ -2702,16 +2385,17 @@ const useStyles$1 = makeStyles({
|
|
|
2702
2385
|
color: "black"
|
|
2703
2386
|
}
|
|
2704
2387
|
});
|
|
2388
|
+
|
|
2705
2389
|
const EstimatedRiskInfoDialog = ({
|
|
2706
2390
|
isOpen,
|
|
2707
2391
|
onClose
|
|
2708
2392
|
}) => {
|
|
2709
|
-
const classes = useStyles$1();
|
|
2710
2393
|
const { t } = useTranslationRef(pluginRiScTranslationRef);
|
|
2711
|
-
|
|
2394
|
+
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")))));
|
|
2712
2396
|
};
|
|
2713
2397
|
|
|
2714
|
-
const
|
|
2398
|
+
const useAggregatedCostStyles = makeStyles({
|
|
2715
2399
|
outerBox: {
|
|
2716
2400
|
display: "flex",
|
|
2717
2401
|
flexDirection: "column",
|
|
@@ -2722,14 +2406,15 @@ const useStyles = makeStyles({
|
|
|
2722
2406
|
alignItems: "center"
|
|
2723
2407
|
}
|
|
2724
2408
|
});
|
|
2409
|
+
|
|
2725
2410
|
const AggregatedCost = ({ riSc, initialRisk }) => {
|
|
2411
|
+
const { t } = useTranslationRef(pluginRiScTranslationRef);
|
|
2412
|
+
const { outerBox, innerBox } = useAggregatedCostStyles();
|
|
2413
|
+
const { label2, body2 } = useFontStyles();
|
|
2414
|
+
const [showDialog, setShowDialog] = useState(false);
|
|
2726
2415
|
const cost = riSc.scenarios.map(
|
|
2727
2416
|
(scenario) => initialRisk ? scenario.risk.probability * scenario.risk.consequence : scenario.remainingRisk.probability * scenario.remainingRisk.consequence
|
|
2728
2417
|
).reduce((a, b) => a + b, 0);
|
|
2729
|
-
const [showDialog, setShowDialog] = useState(false);
|
|
2730
|
-
const { outerBox, innerBox } = useStyles();
|
|
2731
|
-
const { label2, body2 } = useFontStyles();
|
|
2732
|
-
const { t } = useTranslationRef(pluginRiScTranslationRef);
|
|
2733
2418
|
return /* @__PURE__ */ React.createElement(Box$1, { className: outerBox }, /* @__PURE__ */ React.createElement(Typography, { className: label2 }, t("riskMatrix.estimatedRisk.title")), /* @__PURE__ */ React.createElement(Box$1, { className: innerBox }, /* @__PURE__ */ React.createElement(Typography, { className: body2 }, formatNumber(cost, t), " ", t("riskMatrix.estimatedRisk.unit.nokPerYear")), /* @__PURE__ */ React.createElement(IconButton, { size: "small", onClick: () => setShowDialog(true) }, /* @__PURE__ */ React.createElement(InfoIcon, null))), /* @__PURE__ */ React.createElement(
|
|
2734
2419
|
EstimatedRiskInfoDialog,
|
|
2735
2420
|
{
|
|
@@ -2738,25 +2423,21 @@ const AggregatedCost = ({ riSc, initialRisk }) => {
|
|
|
2738
2423
|
}
|
|
2739
2424
|
));
|
|
2740
2425
|
};
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
].find(({ threshold: threshold2 }) => cost < threshold2);
|
|
2751
|
-
return t(`riskMatrix.estimatedRisk.suffix.${unit}`, {
|
|
2752
|
-
count: Number((cost / threshold * 1e3).toFixed(0))
|
|
2753
|
-
});
|
|
2426
|
+
|
|
2427
|
+
const useTabsStyle = makeStyles((theme) => ({
|
|
2428
|
+
tab: {
|
|
2429
|
+
backgroundColor: "transparent",
|
|
2430
|
+
color: theme.palette.type === "dark" ? "white" : "black",
|
|
2431
|
+
"&:hover": {
|
|
2432
|
+
backgroundColor: "transparent",
|
|
2433
|
+
color: theme.palette.type === "dark" ? "white" : "black"
|
|
2434
|
+
}
|
|
2754
2435
|
}
|
|
2755
|
-
}
|
|
2436
|
+
}));
|
|
2756
2437
|
|
|
2757
2438
|
const Tabs = ({ setTab }) => {
|
|
2758
|
-
const tabsStyle = useTabsStyle();
|
|
2759
2439
|
const { t } = useTranslationRef(pluginRiScTranslationRef);
|
|
2440
|
+
const tabsStyle = useTabsStyle();
|
|
2760
2441
|
return /* @__PURE__ */ React.createElement(Box$2, { sx: { borderBottom: 1, borderColor: "divider" } }, /* @__PURE__ */ React.createElement(
|
|
2761
2442
|
TabList,
|
|
2762
2443
|
{
|
|
@@ -2768,7 +2449,7 @@ const Tabs = ({ setTab }) => {
|
|
|
2768
2449
|
Tab,
|
|
2769
2450
|
{
|
|
2770
2451
|
label: /* @__PURE__ */ React.createElement(Typography, { variant: "subtitle1", style: { fontWeight: "bold" } }, t("dictionary.initialRisk")),
|
|
2771
|
-
value:
|
|
2452
|
+
value: RiskMatrixTabs.initialRisk,
|
|
2772
2453
|
className: tabsStyle.tab
|
|
2773
2454
|
}
|
|
2774
2455
|
),
|
|
@@ -2776,15 +2457,21 @@ const Tabs = ({ setTab }) => {
|
|
|
2776
2457
|
Tab,
|
|
2777
2458
|
{
|
|
2778
2459
|
label: /* @__PURE__ */ React.createElement(Typography, { variant: "subtitle1", style: { fontWeight: "bold" } }, t("dictionary.restRisk")),
|
|
2779
|
-
value:
|
|
2460
|
+
value: RiskMatrixTabs.remainingRisk,
|
|
2780
2461
|
className: tabsStyle.tab
|
|
2781
2462
|
}
|
|
2782
2463
|
)
|
|
2783
2464
|
));
|
|
2784
2465
|
};
|
|
2785
2466
|
|
|
2467
|
+
var RiskMatrixTabs = /* @__PURE__ */ ((RiskMatrixTabs2) => {
|
|
2468
|
+
RiskMatrixTabs2["initialRisk"] = "initialRisk";
|
|
2469
|
+
RiskMatrixTabs2["remainingRisk"] = "remainingRisk";
|
|
2470
|
+
return RiskMatrixTabs2;
|
|
2471
|
+
})(RiskMatrixTabs || {});
|
|
2786
2472
|
const RiskMatrix = ({ riSc }) => {
|
|
2787
|
-
const
|
|
2473
|
+
const { t } = useTranslationRef(pluginRiScTranslationRef);
|
|
2474
|
+
const { label2 } = useFontStyles();
|
|
2788
2475
|
const {
|
|
2789
2476
|
riskSummary,
|
|
2790
2477
|
grid,
|
|
@@ -2795,10 +2482,14 @@ const RiskMatrix = ({ riSc }) => {
|
|
|
2795
2482
|
text,
|
|
2796
2483
|
centered
|
|
2797
2484
|
} = useRiskMatrixStyles();
|
|
2798
|
-
const
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2485
|
+
const [tab, setTab] = useState("initialRisk" /* initialRisk */);
|
|
2486
|
+
return /* @__PURE__ */ React.createElement(InfoCard, { title: t("riskMatrix.title") }, /* @__PURE__ */ React.createElement(TabContext, { value: tab }, /* @__PURE__ */ React.createElement(Tabs, { setTab }), riSc.scenarios.length > 0 && /* @__PURE__ */ React.createElement(Box$2, { className: riskSummary }, /* @__PURE__ */ React.createElement(
|
|
2487
|
+
AggregatedCost,
|
|
2488
|
+
{
|
|
2489
|
+
riSc,
|
|
2490
|
+
initialRisk: tab === "initialRisk" /* initialRisk */
|
|
2491
|
+
}
|
|
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(
|
|
2802
2493
|
Box$2,
|
|
2803
2494
|
{
|
|
2804
2495
|
className: `${square} ${centered}`,
|
|
@@ -2810,10 +2501,10 @@ const RiskMatrix = ({ riSc }) => {
|
|
|
2810
2501
|
riSc,
|
|
2811
2502
|
probability: col,
|
|
2812
2503
|
consequence: 4 - row,
|
|
2813
|
-
|
|
2504
|
+
initialRisk: tab === "initialRisk" /* initialRisk */
|
|
2814
2505
|
}
|
|
2815
2506
|
)
|
|
2816
|
-
)))), /* @__PURE__ */ React.createElement(Box$2, { className: centered }), /* @__PURE__ */ React.createElement(Box$2, { className: centered }),
|
|
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")))))));
|
|
2817
2508
|
};
|
|
2818
2509
|
|
|
2819
2510
|
const useTableStyles = makeStyles((theme) => ({
|
|
@@ -2856,15 +2547,11 @@ const ScenarioTableRow = ({
|
|
|
2856
2547
|
viewRow,
|
|
2857
2548
|
isLastRow
|
|
2858
2549
|
}) => {
|
|
2859
|
-
const
|
|
2860
|
-
const
|
|
2861
|
-
const restSannsynlighet = probabilityOptions.indexOf(scenario.remainingRisk.probability) + 1;
|
|
2862
|
-
const restKonsekvens = consequenceOptions.indexOf(scenario.remainingRisk.consequence) + 1;
|
|
2550
|
+
const { t } = useTranslationRef(pluginRiScTranslationRef);
|
|
2551
|
+
const { riskColor, rowBackground, rowBorder, tableCell } = useTableStyles();
|
|
2863
2552
|
const remainingActions = scenario.actions.filter(
|
|
2864
2553
|
(a) => a.status !== "Completed"
|
|
2865
2554
|
);
|
|
2866
|
-
const { riskColor, rowBackground, rowBorder, tableCell } = useTableStyles();
|
|
2867
|
-
const { t } = useTranslationRef(pluginRiScTranslationRef);
|
|
2868
2555
|
return /* @__PURE__ */ React.createElement(TableRow, { className: isLastRow ? void 0 : rowBorder }, /* @__PURE__ */ React.createElement(
|
|
2869
2556
|
"button",
|
|
2870
2557
|
{
|
|
@@ -2897,7 +2584,7 @@ const ScenarioTableRow = ({
|
|
|
2897
2584
|
backgroundColor: getRiskMatrixColor(scenario.risk)
|
|
2898
2585
|
}
|
|
2899
2586
|
}
|
|
2900
|
-
), t("scenarioTable.columns.probabilityChar"), ":",
|
|
2587
|
+
), t("scenarioTable.columns.probabilityChar"), ":", getProbabilityLevel(scenario.risk), " ", t("scenarioTable.columns.consequenceChar"), ":", getConsequenceLevel(scenario.risk)),
|
|
2901
2588
|
/* @__PURE__ */ React.createElement(TableCell, { className: tableCell }, remainingActions.length > 0 ? /* @__PURE__ */ React.createElement(React.Fragment, null, remainingActions.length, " ", t("dictionary.planned").toLowerCase()) : t("dictionary.completed")),
|
|
2902
2589
|
/* @__PURE__ */ React.createElement(TableCell, { className: tableCell }, /* @__PURE__ */ React.createElement(
|
|
2903
2590
|
Paper,
|
|
@@ -2907,14 +2594,14 @@ const ScenarioTableRow = ({
|
|
|
2907
2594
|
backgroundColor: getRiskMatrixColor(scenario.remainingRisk)
|
|
2908
2595
|
}
|
|
2909
2596
|
}
|
|
2910
|
-
), t("scenarioTable.columns.probabilityChar"), ":",
|
|
2597
|
+
), t("scenarioTable.columns.probabilityChar"), ":", getProbabilityLevel(scenario.remainingRisk), " ", t("scenarioTable.columns.consequenceChar"), ":", getConsequenceLevel(scenario.remainingRisk))
|
|
2911
2598
|
));
|
|
2912
2599
|
};
|
|
2913
2600
|
|
|
2914
2601
|
const ScenarioTable = ({ riSc }) => {
|
|
2915
|
-
const { newScenario, openScenario } = useContext(ScenarioContext);
|
|
2916
|
-
const { titleBox, rowBorder, tableCell } = useTableStyles();
|
|
2917
2602
|
const { t } = useTranslationRef(pluginRiScTranslationRef);
|
|
2603
|
+
const { titleBox, rowBorder, tableCell } = useTableStyles();
|
|
2604
|
+
const { newScenario, openScenario } = useContext(ScenarioContext);
|
|
2918
2605
|
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(
|
|
2919
2606
|
Box$1,
|
|
2920
2607
|
{
|
|
@@ -3052,6 +2739,9 @@ const RiScDialog = ({
|
|
|
3052
2739
|
riSc,
|
|
3053
2740
|
...props
|
|
3054
2741
|
}) => {
|
|
2742
|
+
const { t } = useTranslationRef(pluginRiScTranslationRef);
|
|
2743
|
+
const { paper, content, buttons } = useRiScDialogStyles();
|
|
2744
|
+
const { h1 } = useFontStyles();
|
|
3055
2745
|
const [newRiSc, setNewRiSc] = useState(
|
|
3056
2746
|
dialogState === 1 /* Edit */ ? riSc.content : emptyRiSc()
|
|
3057
2747
|
);
|
|
@@ -3059,9 +2749,6 @@ const RiScDialog = ({
|
|
|
3059
2749
|
title: null,
|
|
3060
2750
|
scope: null
|
|
3061
2751
|
});
|
|
3062
|
-
const classes = useRiScDialogStyles();
|
|
3063
|
-
const { h1 } = useFontStyles();
|
|
3064
|
-
const { t } = useTranslationRef(pluginRiScTranslationRef);
|
|
3065
2752
|
const handleCancel = () => {
|
|
3066
2753
|
onClose();
|
|
3067
2754
|
setNewRiSc(emptyRiSc());
|
|
@@ -3084,53 +2771,53 @@ const RiScDialog = ({
|
|
|
3084
2771
|
}
|
|
3085
2772
|
handleCancel();
|
|
3086
2773
|
};
|
|
3087
|
-
const
|
|
2774
|
+
const setTitle = (title) => {
|
|
3088
2775
|
setNewRiScError({
|
|
3089
2776
|
...newRiScError,
|
|
3090
2777
|
title: null
|
|
3091
2778
|
});
|
|
3092
2779
|
setNewRiSc({
|
|
3093
2780
|
...newRiSc,
|
|
3094
|
-
title
|
|
2781
|
+
title
|
|
3095
2782
|
});
|
|
3096
2783
|
};
|
|
3097
|
-
const
|
|
2784
|
+
const setScope = (scope) => {
|
|
3098
2785
|
setNewRiScError({
|
|
3099
2786
|
...newRiScError,
|
|
3100
2787
|
scope: null
|
|
3101
2788
|
});
|
|
3102
2789
|
setNewRiSc({
|
|
3103
2790
|
...newRiSc,
|
|
3104
|
-
scope
|
|
2791
|
+
scope
|
|
3105
2792
|
});
|
|
3106
2793
|
};
|
|
3107
2794
|
const header = dialogState === 2 /* Create */ ? t("rosDialog.titleNew") : t("rosDialog.titleEdit");
|
|
3108
2795
|
return /* @__PURE__ */ React.createElement(
|
|
3109
2796
|
Dialog,
|
|
3110
2797
|
{
|
|
3111
|
-
classes: { paper
|
|
2798
|
+
classes: { paper },
|
|
3112
2799
|
open: dialogState !== 0 /* Closed */,
|
|
3113
2800
|
onClose: handleSave,
|
|
3114
2801
|
...props
|
|
3115
2802
|
},
|
|
3116
|
-
/* @__PURE__ */ React.createElement(DialogContent, null, /* @__PURE__ */ React.createElement(Typography, { className: h1 }, header), /* @__PURE__ */ React.createElement(Box$1, { className:
|
|
2803
|
+
/* @__PURE__ */ React.createElement(DialogContent, null, /* @__PURE__ */ React.createElement(Typography, { className: h1 }, header), /* @__PURE__ */ React.createElement(Box$1, { className: content }, /* @__PURE__ */ React.createElement(
|
|
3117
2804
|
TextField,
|
|
3118
2805
|
{
|
|
3119
2806
|
label: t("dictionary.title"),
|
|
3120
2807
|
value: newRiSc.title,
|
|
3121
2808
|
minRows: 1,
|
|
3122
|
-
handleChange:
|
|
2809
|
+
handleChange: setTitle,
|
|
3123
2810
|
error: newRiScError.title,
|
|
3124
2811
|
required: true
|
|
3125
2812
|
}
|
|
3126
|
-
)), /* @__PURE__ */ React.createElement(Box$1, { className:
|
|
2813
|
+
)), /* @__PURE__ */ React.createElement(Box$1, { className: content }, /* @__PURE__ */ React.createElement(
|
|
3127
2814
|
TextField,
|
|
3128
2815
|
{
|
|
3129
2816
|
label: t("dictionary.scope"),
|
|
3130
2817
|
subtitle: t("rosDialog.scopeDescription"),
|
|
3131
2818
|
value: newRiSc.scope,
|
|
3132
2819
|
minRows: 4,
|
|
3133
|
-
handleChange:
|
|
2820
|
+
handleChange: setScope,
|
|
3134
2821
|
error: newRiScError.scope,
|
|
3135
2822
|
required: true
|
|
3136
2823
|
}
|
|
@@ -3145,7 +2832,7 @@ const RiScDialog = ({
|
|
|
3145
2832
|
alignItems: "center"
|
|
3146
2833
|
}
|
|
3147
2834
|
},
|
|
3148
|
-
/* @__PURE__ */ React.createElement(Box$1, { className:
|
|
2835
|
+
/* @__PURE__ */ React.createElement(Box$1, { className: buttons }, /* @__PURE__ */ React.createElement(Button, { variant: "contained", color: "primary", onClick: handleSave }, t("dictionary.save")), /* @__PURE__ */ React.createElement(Button, { variant: "outlined", color: "primary", onClick: handleCancel }, t("dictionary.cancel")))
|
|
3149
2836
|
)
|
|
3150
2837
|
);
|
|
3151
2838
|
};
|
|
@@ -3189,15 +2876,6 @@ const useStatusTextStyles = makeStyles(() => ({
|
|
|
3189
2876
|
marginLeft: "2px"
|
|
3190
2877
|
}
|
|
3191
2878
|
}));
|
|
3192
|
-
makeStyles(() => ({
|
|
3193
|
-
noApprovalBanner: {
|
|
3194
|
-
backgroundColor: "#FCEBCD",
|
|
3195
|
-
color: "#303030"
|
|
3196
|
-
},
|
|
3197
|
-
"MuiAlert-message": {
|
|
3198
|
-
color: "#B2750B"
|
|
3199
|
-
}
|
|
3200
|
-
}));
|
|
3201
2879
|
|
|
3202
2880
|
const getChipColor = (status, classes) => {
|
|
3203
2881
|
switch (status) {
|
|
@@ -3268,22 +2946,31 @@ const StatusChip = ({ currentRiScStatus }) => {
|
|
|
3268
2946
|
);
|
|
3269
2947
|
};
|
|
3270
2948
|
|
|
2949
|
+
const useButtonStyles = makeStyles(() => ({
|
|
2950
|
+
approveButton: {
|
|
2951
|
+
borderRadius: "2px",
|
|
2952
|
+
whiteSpace: "nowrap",
|
|
2953
|
+
overflow: "hidden",
|
|
2954
|
+
textOverflow: "ellipsis"
|
|
2955
|
+
}
|
|
2956
|
+
}));
|
|
2957
|
+
|
|
3271
2958
|
const RiScPublishDialog = ({
|
|
3272
2959
|
openDialog,
|
|
3273
2960
|
handleCancel,
|
|
3274
2961
|
handlePublish
|
|
3275
2962
|
}) => {
|
|
3276
|
-
const classes = useRiScDialogStyles();
|
|
3277
2963
|
const { t } = useTranslationRef(pluginRiScTranslationRef);
|
|
3278
|
-
const
|
|
2964
|
+
const { buttons } = useRiScDialogStyles();
|
|
2965
|
+
const [riskOwnerApproves, setRiskOwnerApproves] = useState(false);
|
|
3279
2966
|
const handleCheckboxInput = (event) => {
|
|
3280
|
-
|
|
2967
|
+
setRiskOwnerApproves(event.target.checked);
|
|
3281
2968
|
};
|
|
3282
2969
|
return /* @__PURE__ */ React.createElement(Dialog, { open: openDialog }, /* @__PURE__ */ React.createElement(DialogTitle, null, t("publishDialog.title")), /* @__PURE__ */ React.createElement(DialogContent, null, /* @__PURE__ */ React.createElement(Alert, { severity: "info", icon: false }, /* @__PURE__ */ React.createElement(Grid, { container: true }, /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 1 }, /* @__PURE__ */ React.createElement(
|
|
3283
2970
|
Checkbox,
|
|
3284
2971
|
{
|
|
3285
2972
|
color: "primary",
|
|
3286
|
-
checked:
|
|
2973
|
+
checked: riskOwnerApproves,
|
|
3287
2974
|
onChange: handleCheckboxInput
|
|
3288
2975
|
}
|
|
3289
2976
|
)), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 8 }, t("publishDialog.checkboxLabel"))))), /* @__PURE__ */ React.createElement(
|
|
@@ -3296,13 +2983,13 @@ const RiScPublishDialog = ({
|
|
|
3296
2983
|
alignItems: "center"
|
|
3297
2984
|
}
|
|
3298
2985
|
},
|
|
3299
|
-
/* @__PURE__ */ React.createElement(Box$1, { className:
|
|
2986
|
+
/* @__PURE__ */ React.createElement(Box$1, { className: buttons }, /* @__PURE__ */ React.createElement(Button, { variant: "outlined", color: "primary", onClick: handleCancel }, t("dictionary.cancel")), /* @__PURE__ */ React.createElement(
|
|
3300
2987
|
Button,
|
|
3301
2988
|
{
|
|
3302
2989
|
variant: "contained",
|
|
3303
2990
|
color: "primary",
|
|
3304
2991
|
onClick: handlePublish,
|
|
3305
|
-
disabled: !
|
|
2992
|
+
disabled: !riskOwnerApproves
|
|
3306
2993
|
},
|
|
3307
2994
|
t("dictionary.confirm")
|
|
3308
2995
|
))
|
|
@@ -3312,8 +2999,8 @@ const RiScStatusComponent = ({
|
|
|
3312
2999
|
selectedRiSc,
|
|
3313
3000
|
publishRiScFn
|
|
3314
3001
|
}) => {
|
|
3315
|
-
const statusComponentClasses = useButtonStyles();
|
|
3316
3002
|
const { t } = useTranslationRef(pluginRiScTranslationRef);
|
|
3003
|
+
const { approveButton } = useButtonStyles();
|
|
3317
3004
|
const [publishRiScDialogIsOpen, setPublishRiScDialogIsOpen] = useState(false);
|
|
3318
3005
|
const handleApproveAndPublish = () => {
|
|
3319
3006
|
publishRiScFn();
|
|
@@ -3325,7 +3012,7 @@ const RiScStatusComponent = ({
|
|
|
3325
3012
|
color: "primary",
|
|
3326
3013
|
variant: "contained",
|
|
3327
3014
|
onClick: () => setPublishRiScDialogIsOpen(!publishRiScDialogIsOpen),
|
|
3328
|
-
className:
|
|
3015
|
+
className: approveButton,
|
|
3329
3016
|
fullWidth: true,
|
|
3330
3017
|
disabled: selectedRiSc.status !== RiScStatus.Draft
|
|
3331
3018
|
},
|
|
@@ -3347,9 +3034,9 @@ const useRiScInfoStyles = makeStyles(() => ({
|
|
|
3347
3034
|
}));
|
|
3348
3035
|
|
|
3349
3036
|
const RiScInfo = ({ riSc, approveRiSc, edit }) => {
|
|
3037
|
+
const { t } = useTranslationRef(pluginRiScTranslationRef);
|
|
3350
3038
|
const { label, body2 } = useFontStyles();
|
|
3351
3039
|
const { infoCard } = useRiScInfoStyles();
|
|
3352
|
-
const { t } = useTranslationRef(pluginRiScTranslationRef);
|
|
3353
3040
|
return /* @__PURE__ */ React.createElement(Grid, { container: true }, /* @__PURE__ */ React.createElement(
|
|
3354
3041
|
Grid,
|
|
3355
3042
|
{
|
|
@@ -3380,6 +3067,7 @@ const RiScInfo = ({ riSc, approveRiSc, edit }) => {
|
|
|
3380
3067
|
const Plugin = () => {
|
|
3381
3068
|
var _a, _b;
|
|
3382
3069
|
const params = useParams();
|
|
3070
|
+
const { t } = useTranslationRef(pluginRiScTranslationRef);
|
|
3383
3071
|
const [RiScDialogState, setRiScDialogState] = useState(
|
|
3384
3072
|
RiScDialogStates.Closed
|
|
3385
3073
|
);
|
|
@@ -3403,8 +3091,6 @@ const Plugin = () => {
|
|
|
3403
3091
|
updateRiSc,
|
|
3404
3092
|
params.scenarioId
|
|
3405
3093
|
);
|
|
3406
|
-
const classes = useLoadingStyles();
|
|
3407
|
-
const { t } = useTranslationRef(pluginRiScTranslationRef);
|
|
3408
3094
|
const [searchParams] = useSearchParams();
|
|
3409
3095
|
const scenarioWizardStep = searchParams.get("step") || null;
|
|
3410
3096
|
useEffect(() => {
|
|
@@ -3418,7 +3104,7 @@ const Plugin = () => {
|
|
|
3418
3104
|
isFetching,
|
|
3419
3105
|
updateStatus: updateRiScStatus
|
|
3420
3106
|
}
|
|
3421
|
-
) : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(ContentHeader, { title: t("contentHeader.title") }
|
|
3107
|
+
) : /* @__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(
|
|
3422
3108
|
Grid,
|
|
3423
3109
|
{
|
|
3424
3110
|
item: true,
|
|
@@ -3473,4 +3159,4 @@ const RiScPlugin = () => {
|
|
|
3473
3159
|
};
|
|
3474
3160
|
|
|
3475
3161
|
export { RiScPlugin };
|
|
3476
|
-
//# sourceMappingURL=index-
|
|
3162
|
+
//# sourceMappingURL=index-153cf81f.esm.js.map
|