@kartverket/backstage-plugin-risk-scorecard 1.0.4 → 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.
@@ -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, Dialog, DialogTitle, DialogActions, Button, Paper, Radio, Stepper, Step, StepButton, CircularProgress, Tab, Divider as Divider$1, Drawer, List, ListSubheader, ListItem, ListItemText as ListItemText$1, ClickAwayListener, Tooltip, DialogContent, DialogContentText, IconButton } from '@material-ui/core';
3
- import { InfoCard, ContentHeader, SupportButton } from '@backstage/core-components';
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 } from './index-4258fc5b.esm.js';
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';
@@ -16,34 +16,34 @@ import ListItemIcon from '@material-ui/core/ListItemIcon';
16
16
  import ListItemText from '@material-ui/core/ListItemText';
17
17
  import MenuItem from '@material-ui/core/MenuItem';
18
18
  import Select from '@material-ui/core/Select';
19
- import { createTranslationRef, createTranslationResource, useTranslationRef } from '@backstage/core-plugin-api/alpha';
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 getSannsynlighetLevel = (risiko) => probabilityOptions.indexOf(risiko.probability) + 1;
408
- const getKonsekvensLevel = (risiko) => consequenceOptions.indexOf(risiko.consequence) + 1;
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 emptyTiltak = () => ({
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((oldTiltak, i) => {
465
- const updatedTiltak = updatedScenario.actions[i];
466
- if (oldTiltak.deadline !== updatedTiltak.deadline)
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
- tittel: false
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 setTittel = (tittel) => {
813
+ const setTitle = (title) => {
789
814
  setScenarioErrors({
790
815
  ...scenarioErrors,
791
- tittel: false
816
+ title: false
792
817
  });
793
818
  setScenario({
794
819
  ...scenario,
795
- title: tittel
820
+ title
796
821
  });
797
822
  };
798
- const setBeskrivelse = (beskrivelse) => {
823
+ const setDescription = (description) => {
799
824
  setScenario({
800
825
  ...scenario,
801
- description: beskrivelse
826
+ description
802
827
  });
803
828
  };
804
- const setTrusselakt\u00F8rer = (trusselakt\u00F8rer) => {
829
+ const setThreatActors = (threatActors) => {
805
830
  setScenario({
806
831
  ...scenario,
807
- threatActors: trusselakt\u00F8rer
832
+ threatActors
808
833
  });
809
834
  };
810
- const setS\u00E5rbarheter = (s\u00E5rbarheter) => {
835
+ const setVulnerabilities = (vulnerabilities) => {
811
836
  setScenario({
812
837
  ...scenario,
813
- vulnerabilities: s\u00E5rbarheter
838
+ vulnerabilities
814
839
  });
815
840
  };
816
- const setSannsynlighet = (sannsynlighetLevel) => setScenario({
841
+ const setProbability = (probabilityLevel) => setScenario({
817
842
  ...scenario,
818
843
  risk: {
819
844
  ...scenario.risk,
820
- probability: probabilityOptions[sannsynlighetLevel - 1]
845
+ probability: probabilityOptions[probabilityLevel - 1]
821
846
  }
822
847
  });
823
- const setKonsekvens = (konsekvensLevel) => setScenario({
848
+ const setConsequence = (consequenceLevel) => setScenario({
824
849
  ...scenario,
825
850
  risk: {
826
851
  ...scenario.risk,
827
- consequence: consequenceOptions[konsekvensLevel - 1]
852
+ consequence: consequenceOptions[consequenceLevel - 1]
828
853
  }
829
854
  });
830
- const setEksisterendeTiltak = (eksisterendeTiltak) => {
855
+ const setExistingActions = (existingActions) => {
831
856
  setScenario({
832
857
  ...scenario,
833
- existingActions: eksisterendeTiltak
858
+ existingActions
834
859
  });
835
860
  };
836
- const addTiltak = () => setScenario({ ...scenario, actions: [...scenario.actions, emptyTiltak()] });
837
- const updateTiltak = (tiltak) => {
838
- const updatedTiltak = scenario.actions.some((t) => t.ID === tiltak.ID) ? scenario.actions.map((t) => t.ID === tiltak.ID ? tiltak : t) : [...scenario.actions, tiltak];
839
- setScenario({ ...scenario, actions: updatedTiltak });
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 deleteTiltak = (tiltak) => {
842
- const updatedTiltak = scenario.actions.filter((t) => t.ID !== tiltak.ID);
843
- setScenario({ ...scenario, actions: updatedTiltak });
866
+ const deleteAction = (action) => {
867
+ const updatedAction = scenario.actions.filter((a) => a.ID !== action.ID);
868
+ setScenario({ ...scenario, actions: updatedAction });
844
869
  };
845
- const updateRestrisiko = (restrisiko) => setScenario({ ...scenario, remainingRisk: restrisiko });
846
- const setRestSannsynlighet = (sannsynlighetLevel) => setScenario({
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[sannsynlighetLevel - 1]
875
+ probability: probabilityOptions[probabilityLevel - 1]
851
876
  }
852
877
  });
853
- const setRestKonsekvens = (konsekvensLevel) => setScenario({
878
+ const setRemainingConsequence = (consequenceLevel) => setScenario({
854
879
  ...scenario,
855
880
  remainingRisk: {
856
881
  ...scenario.remainingRisk,
857
- consequence: consequenceOptions[konsekvensLevel - 1]
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
- setTittel,
892
- setBeskrivelse,
893
- setTrusselakt\u00F8rer,
894
- setS\u00E5rbarheter,
895
- setSannsynlighet,
896
- setKonsekvens,
897
- setEksisterendeTiltak,
898
- addTiltak,
899
- updateTiltak,
900
- deleteTiltak,
901
- updateRestrisiko,
902
- setRestSannsynlighet,
903
- setRestKonsekvens
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
- tiltakSubtitle: {
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
  {
@@ -1362,431 +1332,28 @@ const Dropdown = ({
1362
1332
  ), error && /* @__PURE__ */ React.createElement(FormHelperText, { error: true }, error));
1363
1333
  };
1364
1334
 
1365
- const pluginRiScTranslationRef = createTranslationRef({
1366
- id: "plugin.riSc",
1367
- messages: {
1368
- contentHeader: {
1369
- title: "Risk scorecard",
1370
- createNewButton: "Create new scorecard"
1371
- },
1372
- dictionary: {
1373
- cancel: "Cancel",
1374
- close: "Close",
1375
- completed: "Completed",
1376
- confirm: "Confirm",
1377
- consequence: "Consequence",
1378
- // Severity, Impact, Effect or Consequence
1379
- deadline: "Deadline",
1380
- // Deadline or Due date
1381
- delete: "Delete",
1382
- description: "Description",
1383
- discardChanges: "Discard changes",
1384
- edit: "Edit",
1385
- estimatedRisk: "Estimated risk",
1386
- initialRisk: "Initial risk",
1387
- // Starting or Initial risk
1388
- measure: "Actions",
1389
- // Measure, Action or Initiative
1390
- measureOwner: "Responsible",
1391
- // Responsible? Measure owner? Initiative owner?
1392
- next: "Next",
1393
- planned: "Planned",
1394
- previous: "Previous",
1395
- probability: "Probability",
1396
- // Likelihood or Probability
1397
- restRisk: "Remaining risk",
1398
- // Residual or Remaining risk
1399
- risk: "Risk",
1400
- save: "Save",
1401
- saveAndClose: "Save and close",
1402
- saveError: "Could not save scenario. Please try again.",
1403
- scenario: "Scenario",
1404
- scope: "Scope",
1405
- status: "Status",
1406
- threatActors: "Threat actors",
1407
- title: "Title",
1408
- vulnerabilities: "Vulnerabilities"
1409
- },
1410
- rosStatus: {
1411
- statusBadge: {
1412
- missing: "Awaiting acceptance from risk owner",
1413
- // Mangler godkjenning av risikoeier
1414
- approved: "Accepted by risk owner",
1415
- // Godkjent av risikoeier
1416
- error: "Failed to retrieve status"
1417
- // Kunne ikke hente status
1418
- },
1419
- prStatus: "Pending PR approval in Github ",
1420
- // Avventer godkjenning av PR i Github
1421
- approveButton: "Accept risks"
1422
- // Godkjenn ROS
1423
- },
1424
- publishDialog: {
1425
- title: "Accept risks",
1426
- // Godkjenn ROS
1427
- checkboxLabel: "I confirm that I am the risk owner and accept the risks detailed in this risk scorecard."
1428
- },
1429
- scenarioTable: {
1430
- title: "Risk scenarios",
1431
- addScenarioButton: "Add scenario",
1432
- columns: {
1433
- measuresCount: "Actions",
1434
- consequenceChar: "C",
1435
- probabilityChar: "P",
1436
- completed: "complete"
1437
- }
1438
- },
1439
- riskMatrix: {
1440
- title: "Risk matrix",
1441
- // Risk matrix or Risk overview
1442
- estimatedRisk: {
1443
- title: "Estimated risk",
1444
- suffix: {
1445
- thousand: "{{count}} thousand",
1446
- million_one: "{{count}} million",
1447
- million_other: "{{count}} million",
1448
- billion_one: "{{count}} billion",
1449
- billion_other: "{{count}} billion",
1450
- trillion_one: "{{count}} trillion",
1451
- trillion_other: "{{count}} trillion"
1452
- },
1453
- unit: {
1454
- nokPerYear: "NOK/year"
1455
- }
1456
- },
1457
- tooltip: {
1458
- title: "Risk scenarios"
1459
- }
1460
- },
1461
- infoDialog: {
1462
- title: "Estimated risk",
1463
- description: "The estimated risk is a calculation based on the risks the different scenarios pose. If there is a high probability that a serious consequence will occur, this could potentially become a large cost for the organization. In other words, the cost is an attempt to make the risk value more tangible and is the sum of the estimated risk for all the risk scenarios in this risk scorecard.",
1464
- calculatedHowTitle: "How do we calculate the estimated risk?",
1465
- calculatedHow: "Consequence is measured in cost (in NOK) per incident and probability is measured in incidents per year. The estimated risk is calculated as C x P.",
1466
- consequenceTitle: "Consequence (NOK/incident)",
1467
- // incident, event or occurrence
1468
- probabilityTitle: "Probability (incidents/year)",
1469
- probabilityDescription: {
1470
- "0": "every 100 years",
1471
- // 100 year intervals?
1472
- "1": "every 10 years",
1473
- // 10 year intervals?
1474
- "2": "yearly",
1475
- // almost yearly?
1476
- "3": "weekly",
1477
- "4": "daily"
1478
- },
1479
- example: "A scenario with consequence 2 and probability 4 has an estimated risk of 30 000 NOK/incident x 50 incidents/year = 1 500 000 NOK/year."
1480
- },
1481
- rosDialog: {
1482
- titleNew: "New risk scorecard",
1483
- titleEdit: "Edit scorecard",
1484
- titleError: "The scorecard has to have a title",
1485
- scopeDescription: "Describe what the risk analysis will assess. Specify any key areas which are not part of the scope.",
1486
- scopeError: "The scorecard has to have a description of the scope"
1487
- },
1488
- scenarioStepper: {
1489
- initialRiskStep: {
1490
- title: "Initial risk",
1491
- subtitle: "The initial risk is defined by the consequence of the scenario and the probability of it occurring.",
1492
- consequenceSubtitle: "How severe is the potential impact? If the scenario can impact more than one category, choose the highest level of consequence.",
1493
- probabilitySubtitle: "How likely is it that this scenario will occur? If you are between two probability values, choose the higher one."
1494
- },
1495
- restRiskStep: {
1496
- title: "Remaining risk",
1497
- subtitle: "What is the risk reduced to when all the planned actions have been completed?",
1498
- consequenceSubtitle: "How severe is the consequence of this scenario after all actions are complete?",
1499
- probabilitySubtitle: "What is the likelihood of this scenario after all actions are complete?"
1500
- }
1501
- },
1502
- scenarioDrawer: {
1503
- title: "Risk scenario",
1504
- titleError: "Scenario title is required",
1505
- subtitle: "An unwanted incident that could potentially harm the component.",
1506
- // harm or affect negatively?
1507
- threatActorSubtitle: "Someone who attempts to access or abuse the system",
1508
- // system or component or both?
1509
- vulnerabilitySubtitle: "Weakness in the system that the threat actor can exploit",
1510
- consequenceTab: {
1511
- subtitle: "How severe is the potential impact? If the scenario can impact more than one category, choose the highest level of consequence."
1512
- },
1513
- probabilityTab: {
1514
- subtitle: "How likely is it that this scenario will occur? If you are between two probability values, choose the higher one."
1515
- },
1516
- measureTab: {
1517
- subtitle: "What actions should be taken to avoid or reduce the risk of this scenario?",
1518
- measureOwnerDescription: "Decide who will be responsible for completion of this action",
1519
- addMeasureButton: "Add planned action",
1520
- actionsTitle: "Planned actions",
1521
- plannedMeasures: "Planned actions",
1522
- existingMeasure: "Existing measures",
1523
- existingMeasureSubtitle: "Brief description of relevant measures that have already been implemented to reduce the risk of this scenario"
1524
- },
1525
- restRiskTab: {
1526
- subtitle: "Define the remaining risk for the scenario. Remaining risk is the consequence and probability for this scenario after all planned actions have been completed."
1527
- },
1528
- deleteScenarioButton: "Delete scenario",
1529
- deleteScenarioConfirmation: "Are you sure you want to delete this scenario?",
1530
- closeConfirmation: "Do you want to save your changes?"
1531
- },
1532
- consequenceTable: {
1533
- rows: {
1534
- "1": "Negligible",
1535
- // Insignificant, negligible (ubetydelig)
1536
- "2": "Small",
1537
- // Liten
1538
- "3": "Moderate",
1539
- "4": "Severe",
1540
- // Alvorlig
1541
- "5": "Critical"
1542
- // Catastrophic eller Critical
1543
- },
1544
- columns: {
1545
- health: "Life and health",
1546
- // Health and safety, Life and limb, Health and lives (Liv og helse)
1547
- economical: "Financial",
1548
- // Financial consequences, economic implications
1549
- privacy: "Privacy",
1550
- // Personvern
1551
- reputation: "Reputation and trust"
1552
- // Reputation and trust, confidence, faith (Omdømme og tillit)
1553
- },
1554
- cells: {
1555
- health: {
1556
- "1": "Impact on life and health cannot be rated less severe than 3",
1557
- // Liv og helse kan ikke være mindre alvorlig enn 3
1558
- "2": "Impact on life and health cannot be rated less severe than 3",
1559
- "3": "Temporary or less severe health implications",
1560
- // implications, effects or consequence? Midlertidig eller mindre alvorlige helsemessige konsekvenser
1561
- "4": "Permanent or severe health implications",
1562
- // implications, effects or consequence? Lasting or Permanent? Varige eller alvorlige helsemessige konsekvenser
1563
- "5": "Death or permanent severe health implications"
1564
- // implications, effects or consequence? Lasting or permanent? Død eller varige alvorlige helsemssige konsekvenser
1565
- },
1566
- economical: {
1567
- "1": "Temporary minor financial loss",
1568
- // TODO: Hvor kort er forbigående? Forbigående mindre økonomisk tap
1569
- "2": "Temporary financial loss",
1570
- // Forbigående økonomisk tap
1571
- "3": "Financial loss of some duration",
1572
- // Økonomisk tap av noe varighet
1573
- "4": "Financial loss of considerable duration for the organization and any third parties",
1574
- // Økonomisk tap av betydelig varighet for Kartverket og evt. tredjeparter
1575
- "5": "Permanent and severe financial loss"
1576
- // Varig og alvorlig økonomisk tap
1577
- },
1578
- privacy: {
1579
- "1": "The right to privacy is violated for a very short period and does not involve sensitive categories or vulnerable groups",
1580
- //særlige kategorier = sensitive kategorier? special/particular/sensitive categories
1581
- "2": "The right to privacy is violated for a longer period and involves sensitive categories or vulnerable groups",
1582
- "3": "The right to privacy is severely violated for a longer period and involves sensitive categories or vulnerable groups",
1583
- "4": "The right to privacy is being violated in a very serious manner",
1584
- // very severely violated?
1585
- "5": "Impact on privacy cannot be rated more severe than 4"
1586
- },
1587
- reputation: {
1588
- "1": "Temporary loss of reputation and little impact on trust",
1589
- "2": "Negative attention in national media that can reduce trust",
1590
- // articles, news, items, publicity, mentions, attention?
1591
- "3": "Lasting negative attention in national and international media that can reduce trust",
1592
- "4": "Impact on reputation and trust cannot be rated more severe than 3",
1593
- "5": "Impact on reputation and trust cannot be rated more severe than 3"
1594
- }
1595
- }
1596
- },
1597
- probabilityTable: {
1598
- rows: {
1599
- "1": "Very low",
1600
- // svært liten
1601
- "2": "Low",
1602
- // liten
1603
- "3": "Moderat",
1604
- // moderat
1605
- "4": "High",
1606
- // stor
1607
- "5": "Very high"
1608
- // svært stor
1609
- },
1610
- cells: {
1611
- "1": "The scenario is unlikely to occur. It occurs less often than every 100 years",
1612
- "2": "The scenario is unlikely to occur. It can occur every 10 years",
1613
- "3": "The scenario can occur. It can occur almost every year",
1614
- "4": "The scenario will very likely occur. It can occur almost weekly",
1615
- "5": "The scenario is almost guaranteed to occur. It can occur almost daily"
1616
- }
1617
- }
1618
- }
1619
- });
1620
- createTranslationResource({
1621
- ref: pluginRiScTranslationRef,
1622
- translations: {
1623
- no: () => Promise.resolve({
1624
- default: {
1625
- "contentHeader.title": "Risiko- og s\xE5rbarhetsanalyse",
1626
- "contentHeader.createNewButton": "Opprett ny analyse",
1627
- "dictionary.cancel": "Avbryt",
1628
- "dictionary.close": "Lukk",
1629
- "dictionary.completed": "Fullf\xF8rt",
1630
- "dictionary.confirm": "Bekreft",
1631
- "dictionary.consequence": "Konsekvens",
1632
- "dictionary.deadline": "Frist",
1633
- "dictionary.delete": "Slett",
1634
- "dictionary.description": "Beskrivelse",
1635
- "dictionary.discardChanges": "Forkast endringer",
1636
- "dictionary.edit": "Rediger",
1637
- "dictionary.estimatedRisk": "Estimert risiko",
1638
- "dictionary.initialRisk": "Startrisiko",
1639
- "dictionary.measure": "Tiltak",
1640
- "dictionary.measureOwner": "Tiltakseier",
1641
- "dictionary.next": "Neste",
1642
- "dictionary.planned": "Planlagt",
1643
- "dictionary.previous": "Forrige",
1644
- "dictionary.probability": "Sannsynlighet",
1645
- "dictionary.restRisk": "Restrisiko",
1646
- "dictionary.risk": "Risiko",
1647
- "dictionary.save": "Lagre",
1648
- "dictionary.saveAndClose": "Lagre og lukk",
1649
- "dictionary.saveError": "Noe gikk galt ved lagring. Venligst pr\xF8v igjen.",
1650
- "dictionary.scenario": "Scenario",
1651
- "dictionary.scope": "Omfang",
1652
- "dictionary.status": "Status",
1653
- "dictionary.threatActors": "Trusselakt\xF8rer",
1654
- "dictionary.title": "Tittel",
1655
- "dictionary.vulnerabilities": "S\xE5rbarheter",
1656
- "rosStatus.statusBadge.missing": "Venter p\xE5 godkjenning av risikoeier",
1657
- "rosStatus.statusBadge.approved": "Godkjent av risikoeier",
1658
- "rosStatus.statusBadge.error": "Kunne ikke hente status",
1659
- "rosStatus.prStatus": "Avventer godkjenning av PR i Github",
1660
- "rosStatus.approveButton": "Godkjenn ROS",
1661
- "publishDialog.title": "Godkjenn ROS-analyse",
1662
- "publishDialog.checkboxLabel": "Jeg bekrefter at jeg er risikoeier og godtar risikoen beskrevet i denne risiko- og s\xE5rbarhetsanalysen.",
1663
- "scenarioTable.title": "Risikoscenarioer",
1664
- "scenarioTable.addScenarioButton": "Legg til scenario",
1665
- "scenarioTable.columns.measuresCount": "Tiltak",
1666
- "scenarioTable.columns.consequenceChar": "K",
1667
- "scenarioTable.columns.probabilityChar": "S",
1668
- "scenarioTable.columns.completed": "fullf\xF8rt",
1669
- "riskMatrix.title": "Risikomatrise",
1670
- "riskMatrix.estimatedRisk.title": "Estimert risiko",
1671
- "riskMatrix.estimatedRisk.suffix.thousand": "{{count}} tusen",
1672
- "riskMatrix.estimatedRisk.suffix.million_one": "{{count}} million",
1673
- "riskMatrix.estimatedRisk.suffix.million_other": "{{count}} millioner",
1674
- "riskMatrix.estimatedRisk.suffix.billion_one": "{{count}} milliard",
1675
- "riskMatrix.estimatedRisk.suffix.billion_other": "{{count}} milliarder",
1676
- "riskMatrix.estimatedRisk.suffix.trillion_one": "{{count}} billion",
1677
- "riskMatrix.estimatedRisk.suffix.trillion_other": "{{count}} billioner",
1678
- "riskMatrix.estimatedRisk.unit.nokPerYear": "kr/\xE5r",
1679
- "riskMatrix.tooltip.title": "Risikoscenarioer",
1680
- "infoDialog.title": "Estimert risiko",
1681
- "infoDialog.description": "Den estimerte risikoen er basert p\xE5 hvor stor risiko de forskjellige scenariene utgj\xF8r. Hvis det er stor sannsynlighet for at en alvorlig konsekvens skjer er det h\xF8y risiko for at det kan bli en stor kostnad for Kartverket. Kostnaden er med andre ord et fors\xF8k p\xE5 \xE5 konkretisere verdien av risiko og er summen av den estimerte risikoen for alle risikoscenariene i denne ROS-analysen.",
1682
- "infoDialog.calculatedHowTitle": "Hvordan regner vi ut estimert risiko?",
1683
- "infoDialog.calculatedHow": "Konsekvens m\xE5les i kroner per hendelse og sannsynlighet m\xE5les i hendelser per \xE5r. Den estimerte risikoen blir da: K x S.",
1684
- "infoDialog.consequenceTitle": "Konsekvens (kr/hendelse)",
1685
- "infoDialog.probabilityTitle": "Sannsynlighet (hendelser/\xE5r)",
1686
- "infoDialog.probabilityDescription.0": "ca hvert 100. \xE5r",
1687
- "infoDialog.probabilityDescription.1": "ca hvert 10. \xE5r",
1688
- "infoDialog.probabilityDescription.2": "ca \xE5rlig",
1689
- "infoDialog.probabilityDescription.3": "ca ukentlig",
1690
- "infoDialog.probabilityDescription.4": "ca daglig",
1691
- "infoDialog.example": "Et risikoscenario med konsekvens 2 og sannsynlighet 4 har en estimert risiko p\xE5 30 000 kr/hendelse x 50 hendelser/\xE5r = 1 500 000 kr/\xE5r.",
1692
- "rosDialog.titleNew": "Ny risiko- og s\xE5rbarhetsanalyse",
1693
- "rosDialog.titleEdit": "Rediger tittel og omfang",
1694
- "rosDialog.titleError": "ROS-analysen m\xE5 ha en tittel",
1695
- "rosDialog.scopeDescription": "Beskriv hva analysen skal vurdere. Hva som ikke inng\xE5r som en del av omfanget m\xE5 ogs\xE5 defineres.",
1696
- //TODO
1697
- "rosDialog.scopeError": "ROS-analysen m\xE5 ha et omfang",
1698
- "scenarioStepper.initialRiskStep.title": "Startrisiko",
1699
- "scenarioStepper.initialRiskStep.subtitle": "Risikoen er kombinasjonen av konsekvensen av scenarioet og sannsynligheten for at det inntreffer.",
1700
- "scenarioStepper.initialRiskStep.consequenceSubtitle": "Hvor alvorlig er den potensielle konsekvensen? Hvis konsekvensen gjelder flere kategorier velg det h\xF8yeste konsekvensniv\xE5et av disse.",
1701
- "scenarioStepper.initialRiskStep.probabilitySubtitle": "Hvor stor sannsynlighet er det for at dette scenarioet vil forekomme. Dersom du er mellom to sannsynlighetsverdier velg den h\xF8yeste.",
1702
- "scenarioStepper.restRiskStep.title": "Restrisiko",
1703
- "scenarioStepper.restRiskStep.subtitle": "Hvordan endrer risikoen seg fra startrisikoen etter alle tiltakene er fullf\xF8rt?",
1704
- "scenarioStepper.restRiskStep.consequenceSubtitle": "Hva blir konsekvensen etter alle tiltakene er fullf\xF8rt?",
1705
- "scenarioStepper.restRiskStep.probabilitySubtitle": "Hva blir sannsynligheten etter alle tiltakene er fullf\xF8rt?",
1706
- "scenarioDrawer.title": "Risikoscenario",
1707
- "scenarioDrawer.titleError": "Scenarioet m\xE5 ha en tittel",
1708
- "scenarioDrawer.subtitle": "En u\xF8nsket hendelse som potensielt kan ramme komponenten",
1709
- "scenarioDrawer.threatActorSubtitle": "Noen som pr\xF8ver \xE5 f\xE5 tilgang til eller misbruke systemet",
1710
- "scenarioDrawer.vulnerabilitySubtitle": "Svakhet i systemet som kan utnyttes av trusselakt\xF8ren",
1711
- "scenarioDrawer.consequenceTab.subtitle": "Hvor alvorlig er den potensielle konsekvensen? Hvis scenarioet kan f\xE5 konsekvenser i flere kategorier velg det h\xF8yeste konsekvensniv\xE5et av disse.",
1712
- "scenarioDrawer.probabilityTab.subtitle": "Hvor stor sannsynlighet er det for at dette scenarioet vil forekomme. Dersom du er mellom to sannsynlighetsverdier velg den h\xF8yeste.",
1713
- "scenarioDrawer.measureTab.subtitle": "Hvilke tiltak b\xF8r gj\xF8res for \xE5 unng\xE5 scenarioet?",
1714
- "scenarioDrawer.measureTab.actionsTitle": "Planlagte tiltak",
1715
- "scenarioDrawer.measureTab.measureOwnerDescription": "De eller den som er ansvarlig for at tiltaket blir gjennomf\xF8rt",
1716
- "scenarioDrawer.measureTab.addMeasureButton": "Legg til tiltak",
1717
- "scenarioDrawer.measureTab.plannedMeasures": "Planlagte tiltak",
1718
- "scenarioDrawer.measureTab.existingMeasure": "Eksisterende tiltak",
1719
- "scenarioDrawer.measureTab.existingMeasureSubtitle": "Kort beskrivelse av relevante tiltak som allerede har blitt gjennomf\xF8rt",
1720
- "scenarioDrawer.restRiskTab.subtitle": "Sett restrisiko for scenarioet. Restrisiko er konsekvens og sannsynlighet for scenarioet etter at alle tiltak i listen er gjennomf\xF8rt.",
1721
- "scenarioDrawer.deleteScenarioButton": "Slett scenario",
1722
- "scenarioDrawer.deleteScenarioConfirmation": "Er du sikker p\xE5 at du vil slette scenario?",
1723
- "scenarioDrawer.closeConfirmation": "Vil du lagre endringene dine?",
1724
- "consequenceTable.rows.1": "Ubetydelig",
1725
- "consequenceTable.rows.2": "Liten",
1726
- "consequenceTable.rows.3": "Moderat",
1727
- "consequenceTable.rows.4": "Alvorlig",
1728
- "consequenceTable.rows.5": "Kritisk",
1729
- "consequenceTable.columns.health": "Liv og helse",
1730
- "consequenceTable.columns.economical": "\xD8konomisk",
1731
- "consequenceTable.columns.privacy": "Personvern",
1732
- "consequenceTable.columns.reputation": "Omd\xF8mme og tillit",
1733
- "consequenceTable.cells.health.1": "Liv og helse kan ikke v\xE6re mindre alvorlig enn 3",
1734
- "consequenceTable.cells.health.2": "Liv og helse kan ikke v\xE6re mindre alvorlig enn 3",
1735
- "consequenceTable.cells.health.3": "Midlertidig eller mindre alvorlige helsemessige konsekvenser",
1736
- "consequenceTable.cells.health.4": "Varige eller alvorlige helsemessige konsekvenser",
1737
- "consequenceTable.cells.health.5": "D\xF8d eller varige alvorlige helsemssige konsekvenser",
1738
- "consequenceTable.cells.economical.1": "Forbig\xE5ende mindre \xF8konomisk tap",
1739
- "consequenceTable.cells.economical.2": "Forbig\xE5ende \xF8konomisk tap",
1740
- "consequenceTable.cells.economical.3": "\xD8konomisk tap av noe varighet",
1741
- "consequenceTable.cells.economical.4": "\xD8konomisk tap av betydelig varighet for Kartverket og evt. tredjeparter",
1742
- "consequenceTable.cells.economical.5": "Varig og alvorlig \xF8konomisk tap",
1743
- "consequenceTable.cells.privacy.1": "Retten til personvern utfordres i en sv\xE6rt kort periode og involverer ikke s\xE6rlige kategorier/s\xE5rbare grupper",
1744
- "consequenceTable.cells.privacy.2": "Retten til personvern krenkes i en lengre periode eller involverer s\xE6rlige kategorier/s\xE5rbare grupper",
1745
- "consequenceTable.cells.privacy.3": "Retten til personvern krenkes alvorlig i en lengre periode og involverer s\xE6rlige kategorier/s\xE5rbare grupper",
1746
- "consequenceTable.cells.privacy.4": "Retten til personvern krenkes p\xE5 en sv\xE6rt alvorlig m\xE5te",
1747
- "consequenceTable.cells.privacy.5": "Personvern kan ikke v\xE6re mer alvorlig enn 4",
1748
- "consequenceTable.cells.reputation.1": "Midlertidig omd\xF8mmetap og liten innvirkning p\xE5 tillit",
1749
- "consequenceTable.cells.reputation.2": "Negative saker i nasjonale medier som kan redusere tillit",
1750
- "consequenceTable.cells.reputation.3": "Varig negativ oppmerksomhet i nasjonale og internasjonale medier som kan redusere tillit",
1751
- "consequenceTable.cells.reputation.4": "Omd\xF8mme og tillit kan ikke v\xE6re mer alvorlig enn 3",
1752
- "consequenceTable.cells.reputation.5": "Omd\xF8mme og tillit kan ikke v\xE6re mer alvorlig enn 3",
1753
- "probabilityTable.rows.1": "Sv\xE6rt liten",
1754
- "probabilityTable.rows.2": "Liten",
1755
- "probabilityTable.rows.3": "Moderat",
1756
- "probabilityTable.rows.4": "Stor",
1757
- "probabilityTable.rows.5": "Sv\xE6rt stor",
1758
- "probabilityTable.cells.1": "Scenarioet er usannsynlig \xE5 inntreffe. Det inntreffer sjeldnere enn hvert 100. \xE5r",
1759
- "probabilityTable.cells.2": "Scenarioet er lite sannsynlig \xE5 inntreffe. Det kan inntreffe hvert 10. \xE5r",
1760
- "probabilityTable.cells.3": "Scenarioet kan inntreffe. Det kan inntreffe n\xE6rmest \xE5rlig",
1761
- "probabilityTable.cells.4": "Scenarioet vil med stor sannsynlighet inntreffe. Det kan inntreffe n\xE6rmest ukentlig",
1762
- "probabilityTable.cells.5": "Scenarioet er nesten garantert \xE5 inntreffe. Det kan inntreffe n\xE6rmest daglig"
1763
- }
1764
- })
1765
- }
1766
- });
1767
-
1768
1335
  const ScenarioContext = createContext(null);
1769
1336
 
1770
1337
  const ScenarioStep = () => {
1338
+ const { t } = useTranslationRef(pluginRiScTranslationRef);
1339
+ const { labelSubtitle, label, h2, subtitle2 } = useFontStyles();
1771
1340
  const {
1772
1341
  scenario,
1773
1342
  scenarioErrors,
1774
- setTittel,
1775
- setBeskrivelse,
1776
- setTrusselakt\u00F8rer,
1777
- setS\u00E5rbarheter
1343
+ setTitle,
1344
+ setDescription,
1345
+ setThreatActors,
1346
+ setVulnerabilities
1778
1347
  } = useContext(ScenarioContext);
1779
- const { labelSubtitle, label, h2, subtitle2 } = useFontStyles();
1780
- const { t } = useTranslationRef(pluginRiScTranslationRef);
1781
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(
1782
1349
  TextField,
1783
1350
  {
1784
1351
  label: t("dictionary.title"),
1785
1352
  value: scenario.title,
1786
- error: scenarioErrors.tittel ? t("scenarioDrawer.titleError") : "",
1353
+ error: scenarioErrors.title ? t("scenarioDrawer.titleError") : "",
1787
1354
  required: true,
1788
1355
  minRows: 1,
1789
- handleChange: setTittel
1356
+ handleChange: setTitle
1790
1357
  }
1791
1358
  )), /* @__PURE__ */ React.createElement(
1792
1359
  Grid,
@@ -1806,7 +1373,7 @@ const ScenarioStep = () => {
1806
1373
  {
1807
1374
  selectedValues: scenario.threatActors,
1808
1375
  options: threatActorsOptions,
1809
- handleChange: setTrusselakt\u00F8rer
1376
+ handleChange: setThreatActors
1810
1377
  }
1811
1378
  )
1812
1379
  ), /* @__PURE__ */ React.createElement(
@@ -1827,7 +1394,7 @@ const ScenarioStep = () => {
1827
1394
  {
1828
1395
  selectedValues: scenario.vulnerabilities,
1829
1396
  options: vulnerabilitiesOptions,
1830
- handleChange: setS\u00E5rbarheter
1397
+ handleChange: setVulnerabilities
1831
1398
  }
1832
1399
  )
1833
1400
  ), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(
@@ -1836,56 +1403,41 @@ const ScenarioStep = () => {
1836
1403
  label: t("dictionary.description"),
1837
1404
  value: scenario.description,
1838
1405
  minRows: 4,
1839
- handleChange: setBeskrivelse
1406
+ handleChange: setDescription
1840
1407
  }
1841
1408
  )));
1842
1409
  };
1843
1410
 
1844
- const CloseConfirmation = ({
1845
- isOpen,
1846
- close,
1847
- save
1848
- }) => {
1849
- const { t } = useTranslationRef(pluginRiScTranslationRef);
1850
- 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"))));
1851
- };
1852
-
1853
- const TiltakEdit = ({
1854
- tiltak,
1411
+ const ActionEdit = ({
1412
+ action,
1855
1413
  index,
1856
- updateTiltak,
1857
- deleteTiltak
1414
+ updateAction,
1415
+ deleteAction
1858
1416
  }) => {
1859
- const setBeskrivelse = (beskrivelse) => {
1860
- updateTiltak({
1861
- ...tiltak,
1862
- description: beskrivelse
1863
- });
1864
- };
1865
- const setStatus = (status) => {
1866
- updateTiltak({
1867
- ...tiltak,
1868
- status
1869
- });
1870
- };
1871
- const setTiltaksfrist = (newValue) => {
1872
- if (newValue) {
1873
- const formattedDate = new Date(newValue).toISOString().split("T")[0];
1874
- updateTiltak({
1875
- ...tiltak,
1876
- 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
1877
1434
  });
1878
1435
  }
1879
1436
  };
1880
- const setTiltakseier = (tiltakseier) => {
1881
- updateTiltak({
1882
- ...tiltak,
1883
- owner: tiltakseier
1884
- });
1885
- };
1886
- const { paper, formControl } = useInputFieldStyles();
1887
- const { label, labelSubtitle } = useFontStyles();
1888
- const { t } = useTranslationRef(pluginRiScTranslationRef);
1437
+ const setOwner = (owner) => updateAction({
1438
+ ...action,
1439
+ owner
1440
+ });
1889
1441
  return /* @__PURE__ */ React.createElement(Paper, { className: paper }, /* @__PURE__ */ React.createElement(Grid, { container: true, style: { display: "flex", rowGap: "0.7rem" } }, /* @__PURE__ */ React.createElement(
1890
1442
  Grid,
1891
1443
  {
@@ -1903,8 +1455,7 @@ const TiltakEdit = ({
1903
1455
  {
1904
1456
  startIcon: /* @__PURE__ */ React.createElement(DeleteIcon, null),
1905
1457
  key: "dismiss",
1906
- title: "Slett tiltaket",
1907
- onClick: () => deleteTiltak(tiltak),
1458
+ onClick: () => deleteAction(action),
1908
1459
  color: "primary"
1909
1460
  },
1910
1461
  t("dictionary.delete")
@@ -1913,8 +1464,8 @@ const TiltakEdit = ({
1913
1464
  TextField,
1914
1465
  {
1915
1466
  label: t("dictionary.description"),
1916
- value: tiltak.description,
1917
- handleChange: setBeskrivelse,
1467
+ value: action.description,
1468
+ handleChange: setDescription,
1918
1469
  minRows: 1
1919
1470
  }
1920
1471
  )), /* @__PURE__ */ React.createElement(
@@ -1930,14 +1481,7 @@ const TiltakEdit = ({
1930
1481
  },
1931
1482
  /* @__PURE__ */ React.createElement(Typography, { className: label }, t("dictionary.measureOwner")),
1932
1483
  /* @__PURE__ */ React.createElement(Typography, { className: labelSubtitle }, t("scenarioDrawer.measureTab.measureOwnerDescription")),
1933
- /* @__PURE__ */ React.createElement(
1934
- TextField,
1935
- {
1936
- value: tiltak.owner,
1937
- handleChange: setTiltakseier,
1938
- minRows: 1
1939
- }
1940
- )
1484
+ /* @__PURE__ */ React.createElement(TextField, { value: action.owner, handleChange: setOwner, minRows: 1 })
1941
1485
  ), /* @__PURE__ */ React.createElement(
1942
1486
  Grid,
1943
1487
  {
@@ -1955,7 +1499,7 @@ const TiltakEdit = ({
1955
1499
  Dropdown,
1956
1500
  {
1957
1501
  options: actionStatusOptions,
1958
- selectedValues: tiltak.status,
1502
+ selectedValues: action.status,
1959
1503
  handleChange: setStatus
1960
1504
  }
1961
1505
  )
@@ -1972,38 +1516,38 @@ const TiltakEdit = ({
1972
1516
  }
1973
1517
  },
1974
1518
  /* @__PURE__ */ React.createElement(Typography, { className: label }, t("dictionary.deadline")),
1975
- /* @__PURE__ */ React.createElement(FormControl$1, { className: formControl }, /* @__PURE__ */ React.createElement(LocalizationProvider, { dateAdapter: AdapterDateFns, adapterLocale: nb }, /* @__PURE__ */ React.createElement(DatePicker, { value: tiltak.deadline, onChange: setTiltaksfrist })))
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 })))
1976
1520
  )));
1977
1521
  };
1978
1522
 
1979
- const InitiativesStep = () => {
1523
+ const ActionsStep = () => {
1524
+ const { t } = useTranslationRef(pluginRiScTranslationRef);
1525
+ const { h2, subtitle2, actionSubtitle } = useFontStyles();
1980
1526
  const {
1981
1527
  scenario,
1982
- setEksisterendeTiltak,
1983
- updateTiltak,
1984
- deleteTiltak,
1985
- addTiltak
1528
+ setExistingActions,
1529
+ updateAction,
1530
+ deleteAction,
1531
+ addAction
1986
1532
  } = useContext(ScenarioContext);
1987
- const { h2, subtitle2, tiltakSubtitle } = useFontStyles();
1988
- const { t } = useTranslationRef(pluginRiScTranslationRef);
1989
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(
1990
1534
  TextField,
1991
1535
  {
1992
1536
  label: t("scenarioDrawer.measureTab.existingMeasure"),
1993
1537
  subtitle: t("scenarioDrawer.measureTab.existingMeasureSubtitle"),
1994
1538
  value: scenario.existingActions,
1995
- handleChange: setEksisterendeTiltak,
1539
+ handleChange: setExistingActions,
1996
1540
  minRows: 3
1997
1541
  }
1998
- )), /* @__PURE__ */ React.createElement(Typography, { variant: "h6", className: tiltakSubtitle }, t("scenarioDrawer.measureTab.plannedMeasures")), scenario.actions.map((tiltak, index) => /* @__PURE__ */ React.createElement(
1999
- TiltakEdit,
1542
+ )), /* @__PURE__ */ React.createElement(Typography, { variant: "h6", className: actionSubtitle }, t("scenarioDrawer.measureTab.plannedMeasures")), scenario.actions.map((action, index) => /* @__PURE__ */ React.createElement(
1543
+ ActionEdit,
2000
1544
  {
2001
- tiltak,
1545
+ action,
2002
1546
  index: index + 1,
2003
- updateTiltak,
2004
- deleteTiltak
1547
+ updateAction,
1548
+ deleteAction
2005
1549
  }
2006
- )), /* @__PURE__ */ React.createElement(Button, { startIcon: /* @__PURE__ */ React.createElement(AddCircle, null), color: "primary", onClick: addTiltak }, t("scenarioDrawer.measureTab.addMeasureButton")));
1550
+ )), /* @__PURE__ */ React.createElement(Button, { startIcon: /* @__PURE__ */ React.createElement(AddCircle, null), color: "primary", onClick: addAction }, t("scenarioDrawer.measureTab.addMeasureButton")));
2007
1551
  };
2008
1552
 
2009
1553
  const useTableStyles$1 = makeStyles((theme) => ({
@@ -2044,15 +1588,33 @@ const useTableStyles$1 = makeStyles((theme) => ({
2044
1588
  textTransform: "uppercase"
2045
1589
  }
2046
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
+
2047
1611
  const ConsequenceTable = ({
2048
1612
  selectedValue,
2049
1613
  handleChange
2050
1614
  }) => {
2051
- const { table, labelCell, cell, voidCell, radio } = useTableStyles$1();
2052
1615
  const { t } = useTranslationRef(pluginRiScTranslationRef);
2053
- const handleChangeRow = (row) => () => {
2054
- handleChange(row);
2055
- };
1616
+ const { table, labelCell, cell, voidCell, radio } = useTableStyles$1();
1617
+ const handleChangeRow = (row) => () => handleChange(row);
2056
1618
  const getRadioCell = (row) => {
2057
1619
  return /* @__PURE__ */ React.createElement("th", { scope: "col" }, /* @__PURE__ */ React.createElement("div", { className: radio }, /* @__PURE__ */ React.createElement(
2058
1620
  Radio,
@@ -2079,98 +1641,51 @@ const ConsequenceTable = ({
2079
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])));
2080
1642
  };
2081
1643
 
2082
- const ProbabilityTable = ({
2083
- selectedValue,
2084
- handleChange
2085
- }) => {
2086
- const { table, cell, radio } = useTableStyles$1();
2087
- const { t } = useTranslationRef(pluginRiScTranslationRef);
2088
- const handleChangeRow = (row) => () => {
2089
- handleChange(row);
2090
- };
2091
- const radioCell = (row) => /* @__PURE__ */ React.createElement("th", { scope: "col" }, /* @__PURE__ */ React.createElement("div", { className: radio }, /* @__PURE__ */ React.createElement(
2092
- Radio,
2093
- {
2094
- checked: selectedValue === row,
2095
- onChange: handleChangeRow(row),
2096
- style: { padding: 0, color: "#9BC9FE" }
2097
- }
2098
- ), row, ": ", t(`probabilityTable.rows.${row}`)));
2099
- const contentCell = (row) => /* @__PURE__ */ React.createElement("td", { className: cell }, t(`probabilityTable.cells.${row}`));
2100
- 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))));
2101
- };
2102
-
2103
- const useStyles$2 = makeStyles((theme) => ({
1644
+ const useRiskStepStyles = makeStyles((theme) => ({
2104
1645
  box: {
2105
1646
  paddingBottom: theme.spacing(2)
2106
1647
  }
2107
1648
  }));
1649
+
2108
1650
  const RiskStep = ({ riskType, restEqualsInitial }) => {
1651
+ const { t } = useTranslationRef(pluginRiScTranslationRef);
1652
+ const { h2, h3, subtitle2 } = useFontStyles();
1653
+ const { box } = useRiskStepStyles();
2109
1654
  const {
2110
1655
  scenario,
2111
- setKonsekvens,
2112
- setSannsynlighet,
2113
- setRestKonsekvens,
2114
- setRestSannsynlighet
1656
+ setConsequence,
1657
+ setProbability,
1658
+ setRemainingConsequence,
1659
+ setRemainingProbability
2115
1660
  } = useContext(ScenarioContext);
2116
- const { h2, h3, subtitle2 } = useFontStyles();
2117
- const { t } = useTranslationRef(pluginRiScTranslationRef);
2118
1661
  const resourceKey = riskType === "initial" ? "initialRiskStep" : "restRiskStep";
2119
1662
  const risk = riskType === "initial" ? scenario.risk : scenario.remainingRisk;
2120
- const { box } = useStyles$2();
2121
1663
  useEffect(() => {
2122
1664
  if (restEqualsInitial)
2123
- setRestKonsekvens(getKonsekvensLevel(scenario.risk));
1665
+ setRemainingConsequence(getConsequenceLevel(scenario.risk));
2124
1666
  }, [scenario.risk.consequence]);
2125
1667
  useEffect(() => {
2126
1668
  if (restEqualsInitial)
2127
- setRestSannsynlighet(getSannsynlighetLevel(scenario.risk));
1669
+ setRemainingProbability(getProbabilityLevel(scenario.risk));
2128
1670
  }, [scenario.risk.probability]);
2129
- const setC = riskType === "initial" ? setKonsekvens : setRestKonsekvens;
2130
- const setP = riskType === "initial" ? setSannsynlighet : setRestSannsynlighet;
1671
+ const setC = riskType === "initial" ? setConsequence : setRemainingConsequence;
1672
+ const setP = riskType === "initial" ? setProbability : setRemainingProbability;
2131
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(
2132
1674
  ProbabilityTable,
2133
1675
  {
2134
- selectedValue: getSannsynlighetLevel(risk),
1676
+ selectedValue: getProbabilityLevel(risk),
2135
1677
  handleChange: setP
2136
1678
  }
2137
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(
2138
1680
  ConsequenceTable,
2139
1681
  {
2140
- selectedValue: getKonsekvensLevel(risk),
1682
+ selectedValue: getConsequenceLevel(risk),
2141
1683
  handleChange: setC
2142
1684
  }
2143
1685
  )));
2144
1686
  };
2145
1687
 
2146
- const useButtonStyles = makeStyles(() => ({
2147
- godkjennButton: {
2148
- borderRadius: "2px",
2149
- whiteSpace: "nowrap",
2150
- overflow: "hidden",
2151
- textOverflow: "ellipsis"
2152
- },
2153
- settingsButton: {
2154
- borderRadius: "2px",
2155
- minWidth: "80%",
2156
- padding: "5px 10px 5px 10px"
2157
- }
2158
- }));
2159
- const useLoadingStyles = makeStyles({
2160
- container: {
2161
- display: "flex",
2162
- minWidth: "100wh",
2163
- height: "100vh",
2164
- justifyContent: "center",
2165
- alignItems: "flex-start"
2166
- },
2167
- spinner: {
2168
- display: "flex",
2169
- marginTop: "200px"
2170
- }
2171
- });
2172
-
2173
- const useStyle = makeStyles((theme) => ({
1688
+ const useWizardStyle = makeStyles((theme) => ({
2174
1689
  root: {
2175
1690
  display: "flex",
2176
1691
  justifyContent: "center",
@@ -2206,11 +1721,26 @@ const useStyle = makeStyles((theme) => ({
2206
1721
  gap: theme.spacing(2)
2207
1722
  }
2208
1723
  }));
2209
- const ScenarioWizardSteps = [
2210
- "scenario",
2211
- "initialRisk",
2212
- "measure",
2213
- "restRisk"
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
+
1739
+ const ScenarioWizardSteps = [
1740
+ "scenario",
1741
+ "initialRisk",
1742
+ "measure",
1743
+ "restRisk"
2214
1744
  ];
2215
1745
  const ScenarioWizard = ({
2216
1746
  step,
@@ -2220,7 +1750,6 @@ const ScenarioWizard = ({
2220
1750
  const wizardRef = useRef(null);
2221
1751
  const { t } = useTranslationRef(pluginRiScTranslationRef);
2222
1752
  const { h1, label } = useFontStyles();
2223
- const classes = useLoadingStyles();
2224
1753
  const {
2225
1754
  root,
2226
1755
  container,
@@ -2230,7 +1759,7 @@ const ScenarioWizard = ({
2230
1759
  buttonContainer,
2231
1760
  buttonContainerRight,
2232
1761
  saveAndNextButtons
2233
- } = useStyle();
1762
+ } = useWizardStyle();
2234
1763
  const {
2235
1764
  scenario,
2236
1765
  originalScenario,
@@ -2310,7 +1839,7 @@ const ScenarioWizard = ({
2310
1839
  t(`dictionary.${wizardStep}`),
2311
1840
  " "
2312
1841
  )))
2313
- ), /* @__PURE__ */ React.createElement(Divider, null), isFetching && /* @__PURE__ */ React.createElement("div", { className: classes.container }, /* @__PURE__ */ React.createElement(CircularProgress, { className: classes.spinner, size: 80 })), !isFetching && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Box, { className: steps }, {
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 }, {
2314
1843
  [ScenarioWizardSteps[0]]: /* @__PURE__ */ React.createElement(ScenarioStep, null),
2315
1844
  [ScenarioWizardSteps[1]]: /* @__PURE__ */ React.createElement(
2316
1845
  RiskStep,
@@ -2319,7 +1848,7 @@ const ScenarioWizard = ({
2319
1848
  restEqualsInitial
2320
1849
  }
2321
1850
  ),
2322
- [ScenarioWizardSteps[2]]: /* @__PURE__ */ React.createElement(InitiativesStep, null),
1851
+ [ScenarioWizardSteps[2]]: /* @__PURE__ */ React.createElement(ActionsStep, null),
2323
1852
  [ScenarioWizardSteps[3]]: /* @__PURE__ */ React.createElement(RiskStep, { riskType: "rest" })
2324
1853
  }[step]), updateStatus.isError && /* @__PURE__ */ React.createElement(Alert, { style: { marginBottom: "1rem" }, severity: "error" }, /* @__PURE__ */ React.createElement(Typography, null, t("dictionary.saveError"))), /* @__PURE__ */ React.createElement(
2325
1854
  Box,
@@ -2361,362 +1890,53 @@ const ScenarioWizard = ({
2361
1890
  ));
2362
1891
  };
2363
1892
 
2364
- const useTabsStyle = makeStyles((theme) => ({
2365
- tab: {
2366
- backgroundColor: "transparent",
2367
- color: theme.palette.type === "dark" ? "white" : "black",
2368
- "&:hover": {
2369
- backgroundColor: "transparent",
2370
- color: theme.palette.type === "dark" ? "white" : "black"
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)
2371
1900
  }
2372
- }
2373
- }));
2374
-
2375
- const Tabs$1 = ({ setTab }) => {
2376
- const tabsStyle = useTabsStyle();
2377
- const { t } = useTranslationRef(pluginRiScTranslationRef);
2378
- return /* @__PURE__ */ React.createElement(Box$2, { sx: { borderBottom: 1, borderColor: "divider" } }, /* @__PURE__ */ React.createElement(
2379
- TabList,
2380
- {
2381
- onChange: (_, newValue) => setTab(newValue),
2382
- variant: "fullWidth",
2383
- indicatorColor: "primary"
2384
- },
2385
- /* @__PURE__ */ React.createElement(
2386
- Tab,
2387
- {
2388
- label: /* @__PURE__ */ React.createElement(Typography, { variant: "subtitle1", style: { fontWeight: "bold" } }, t("dictionary.consequence")),
2389
- value: "konsekvens",
2390
- className: tabsStyle.tab
2391
- }
2392
- ),
2393
- /* @__PURE__ */ React.createElement(
2394
- Tab,
2395
- {
2396
- label: /* @__PURE__ */ React.createElement(Typography, { variant: "subtitle1", style: { fontWeight: "bold" } }, t("dictionary.probability")),
2397
- value: "sannsynlighet",
2398
- className: tabsStyle.tab
2399
- }
2400
- ),
2401
- /* @__PURE__ */ React.createElement(
2402
- Tab,
2403
- {
2404
- label: /* @__PURE__ */ React.createElement(Typography, { variant: "subtitle1", style: { fontWeight: "bold" } }, t("dictionary.measure")),
2405
- value: "tiltak",
2406
- className: tabsStyle.tab
2407
- }
2408
- )
2409
- ));
2410
- };
2411
-
2412
- const useTabsTiltakStyles = makeStyles((theme) => ({
2413
- arrow: {
1901
+ },
1902
+ header: {
2414
1903
  display: "flex",
2415
- justifyContent: "center",
2416
- alignItems: "center",
2417
- marginTop: theme.spacing(3)
2418
- }
2419
- }));
2420
- const tabStyles = makeStyles((theme) => ({
2421
- tabPanel: {
2422
- padding: 0,
2423
- paddingTop: theme.spacing(3)
2424
- }
2425
- }));
2426
-
2427
- const TabPanelKonsekvens = ({
2428
- setKonsekvens,
2429
- selected
2430
- }) => {
2431
- const { tabPanel } = tabStyles();
2432
- const { headerSubtitle } = useFontStyles();
2433
- const { t } = useTranslationRef(pluginRiScTranslationRef);
2434
- 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 }));
2435
- };
2436
-
2437
- const TabPanelSannsynlighet = ({
2438
- selected,
2439
- setSannsynlighet
2440
- }) => {
2441
- const { tabPanel } = tabStyles();
2442
- const { headerSubtitle } = useFontStyles();
2443
- const { t } = useTranslationRef(pluginRiScTranslationRef);
2444
- const handleChange = (value) => {
2445
- setSannsynlighet(value);
2446
- };
2447
- 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 }));
2448
- };
2449
-
2450
- const TabPanelTiltak = ({
2451
- scenario,
2452
- setEksisterendeTiltak,
2453
- updateTiltak,
2454
- deleteTiltak,
2455
- addTiltak,
2456
- updateRestrisiko,
2457
- options
2458
- }) => {
2459
- const { arrow } = useTabsTiltakStyles();
2460
- const setRestKonsekvens = (restKonsekvensLevel) => {
2461
- updateRestrisiko({
2462
- ...scenario.remainingRisk,
2463
- consequence: consequenceOptions[restKonsekvensLevel - 1]
2464
- });
2465
- };
2466
- const setRestSannsynlighet = (restSannsynlighetLevel) => {
2467
- updateRestrisiko({
2468
- ...scenario.remainingRisk,
2469
- probability: probabilityOptions[restSannsynlighetLevel - 1]
2470
- });
2471
- };
2472
- const { tabPanel } = tabStyles();
2473
- const { body2, headerSubtitle, tiltakSubtitle } = useFontStyles();
2474
- const { t } = useTranslationRef(pluginRiScTranslationRef);
2475
- 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(
2476
- TextField,
2477
- {
2478
- label: t("scenarioDrawer.measureTab.existingMeasure"),
2479
- subtitle: t("scenarioDrawer.measureTab.existingMeasureSubtitle"),
2480
- value: scenario.existingActions,
2481
- handleChange: setEksisterendeTiltak,
2482
- minRows: 3
2483
- }
2484
- )), /* @__PURE__ */ React.createElement(Typography, { variant: "h6", className: tiltakSubtitle }, t("scenarioDrawer.measureTab.plannedMeasures")), scenario.actions.map((tiltak, index) => /* @__PURE__ */ React.createElement(
2485
- TiltakEdit,
2486
- {
2487
- tiltak,
2488
- index: index + 1,
2489
- updateTiltak,
2490
- deleteTiltak
2491
- }
2492
- )), /* @__PURE__ */ React.createElement(
2493
- Button,
2494
- {
2495
- startIcon: /* @__PURE__ */ React.createElement(AddCircleOutlineIcon, null),
2496
- color: "primary",
2497
- onClick: addTiltak,
2498
- style: { textTransform: "none" }
2499
- },
2500
- t("scenarioDrawer.measureTab.addMeasureButton")
2501
- ), /* @__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(
2502
- TextField,
2503
- {
2504
- label: t("dictionary.consequence"),
2505
- value: getKonsekvensLevel(scenario.risk)
2506
- }
2507
- )), /* @__PURE__ */ React.createElement(Grid$1, { item: true, xs: 2 }, /* @__PURE__ */ React.createElement(
2508
- TextField,
2509
- {
2510
- label: t("dictionary.probability"),
2511
- value: getSannsynlighetLevel(scenario.risk)
2512
- }
2513
- )), /* @__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(
2514
- Dropdown,
2515
- {
2516
- label: t("dictionary.consequence"),
2517
- options,
2518
- selectedValues: getKonsekvensLevel(scenario.remainingRisk),
2519
- handleChange: setRestKonsekvens
2520
- }
2521
- )), /* @__PURE__ */ React.createElement(Grid$1, { item: true, xs: 2 }, /* @__PURE__ */ React.createElement(
2522
- Dropdown,
2523
- {
2524
- label: t("dictionary.probability"),
2525
- options,
2526
- selectedValues: getSannsynlighetLevel(scenario.remainingRisk),
2527
- handleChange: setRestSannsynlighet
2528
- }
2529
- ))));
2530
- };
2531
-
2532
- const DeleteConfirmation = () => {
2533
- const { deleteConfirmationIsOpen, abortDeletion, confirmDeletion } = useContext(ScenarioContext);
2534
- const { t } = useTranslationRef(pluginRiScTranslationRef);
2535
- 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"))));
2536
- };
2537
-
2538
- const ScenarioDrawerEdit = () => {
2539
- const { header, buttons } = useScenarioDrawerContentStyles();
2540
- const { h1, headerSubtitle, labelSubtitle, button, label } = useFontStyles();
2541
- const { t } = useTranslationRef(pluginRiScTranslationRef);
2542
- const {
2543
- scenario,
2544
- originalScenario,
2545
- saveScenario,
2546
- scenarioErrors,
2547
- openDeleteConfirmation,
2548
- setTittel,
2549
- setBeskrivelse,
2550
- setTrusselakt\u00F8rer,
2551
- setS\u00E5rbarheter,
2552
- setSannsynlighet,
2553
- setKonsekvens,
2554
- setEksisterendeTiltak,
2555
- addTiltak,
2556
- updateTiltak,
2557
- deleteTiltak,
2558
- updateRestrisiko,
2559
- closeScenario
2560
- } = useContext(ScenarioContext);
2561
- const [tab, setTab] = useState("konsekvens");
2562
- const [showCloseConfirmation, setShowCloseConfirmation] = useState(false);
2563
- const close = () => {
2564
- closeScenario();
2565
- setShowCloseConfirmation(false);
2566
- };
2567
- const saveAndClose = () => {
2568
- if (saveScenario()) {
2569
- close();
2570
- }
2571
- };
2572
- const handleCloseDrawer = () => {
2573
- if (JSON.stringify(scenario) !== JSON.stringify(originalScenario)) {
2574
- setShowCloseConfirmation(true);
2575
- } else {
2576
- close();
2577
- }
2578
- };
2579
- 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(
2580
- Button,
2581
- {
2582
- className: button,
2583
- variant: "outlined",
2584
- color: "primary",
2585
- onClick: handleCloseDrawer,
2586
- endIcon: /* @__PURE__ */ React.createElement(KeyboardTabIcon, null)
2587
- },
2588
- t("dictionary.close")
2589
- )), /* @__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(
2590
- TextField,
2591
- {
2592
- label: t("dictionary.title"),
2593
- value: scenario.title,
2594
- error: scenarioErrors.tittel,
2595
- required: true,
2596
- minRows: 1,
2597
- handleChange: setTittel
2598
- }
2599
- )), /* @__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(
2600
- Dropdown,
2601
- {
2602
- selectedValues: scenario.threatActors,
2603
- options: threatActorsOptions,
2604
- handleChange: setTrusselakt\u00F8rer
2605
- }
2606
- )), /* @__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(
2607
- Dropdown,
2608
- {
2609
- selectedValues: scenario.vulnerabilities,
2610
- options: vulnerabilitiesOptions,
2611
- handleChange: setS\u00E5rbarheter
2612
- }
2613
- )), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(
2614
- TextField,
2615
- {
2616
- label: t("dictionary.description"),
2617
- value: scenario.description,
2618
- minRows: 4,
2619
- handleChange: setBeskrivelse
2620
- }
2621
- )), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(TabContext, { value: tab }, /* @__PURE__ */ React.createElement(Tabs$1, { setTab }), /* @__PURE__ */ React.createElement(
2622
- TabPanelKonsekvens,
2623
- {
2624
- selected: getKonsekvensLevel(scenario.risk),
2625
- setKonsekvens
2626
- }
2627
- ), /* @__PURE__ */ React.createElement(
2628
- TabPanelSannsynlighet,
2629
- {
2630
- selected: getSannsynlighetLevel(scenario.risk),
2631
- setSannsynlighet,
2632
- options: probabilityOptions.map(
2633
- (_, index) => (index + 1).toString()
2634
- )
2635
- }
2636
- ), /* @__PURE__ */ React.createElement(
2637
- TabPanelTiltak,
2638
- {
2639
- scenario,
2640
- setEksisterendeTiltak,
2641
- updateTiltak,
2642
- deleteTiltak,
2643
- addTiltak,
2644
- updateRestrisiko,
2645
- options: consequenceOptions.map(
2646
- (_, index) => (index + 1).toString()
2647
- )
2648
- }
2649
- ))), /* @__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(
2650
- Button,
2651
- {
2652
- variant: "outlined",
2653
- color: "primary",
2654
- onClick: handleCloseDrawer
2655
- },
2656
- t("dictionary.cancel")
2657
- ), /* @__PURE__ */ React.createElement(
2658
- Grid,
2659
- {
2660
- item: true,
2661
- container: true,
2662
- xs: 12,
2663
- style: { display: "flex", justifyContent: "flex-end" }
2664
- },
2665
- /* @__PURE__ */ React.createElement(
2666
- Button,
2667
- {
2668
- startIcon: /* @__PURE__ */ React.createElement(DeleteIcon$1, null),
2669
- variant: "text",
2670
- color: "primary",
2671
- onClick: openDeleteConfirmation
2672
- },
2673
- t("scenarioDrawer.deleteScenarioButton")
2674
- )
2675
- ))), /* @__PURE__ */ React.createElement(DeleteConfirmation, null), /* @__PURE__ */ React.createElement(
2676
- CloseConfirmation,
2677
- {
2678
- isOpen: showCloseConfirmation,
2679
- close,
2680
- save: saveAndClose
2681
- }
2682
- ));
2683
- };
2684
-
2685
- const useTiltakViewStyles = makeStyles((_) => ({
2686
- alignCenter: {
1904
+ flexDirection: "row",
1905
+ justifyContent: "space-between"
1906
+ },
1907
+ buttons: {
2687
1908
  display: "flex",
2688
- alignItems: "center"
1909
+ flexDirection: "row",
1910
+ alignItems: "center",
1911
+ gap: theme.spacing(2),
1912
+ marginTop: theme.spacing(4)
2689
1913
  },
2690
- justifyEnd: {
1914
+ risikoBadge: {
1915
+ width: "20px",
1916
+ height: "48px",
1917
+ borderRadius: "20%"
1918
+ },
1919
+ titleAndButton: {
2691
1920
  display: "flex",
2692
- justifyContent: "flex-end"
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)"
2693
1936
  }
2694
1937
  }));
2695
1938
 
2696
- const TiltakView = ({ tiltak, index }) => {
2697
- const { measure } = useScenarioDrawerContentStyles();
2698
- const { alignCenter, justifyEnd } = useTiltakViewStyles();
2699
- const { body2, label } = useFontStyles();
2700
- const { t } = useTranslationRef(pluginRiScTranslationRef);
2701
- 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(
2702
- Chip,
2703
- {
2704
- label: tiltak.status,
2705
- size: "small",
2706
- style: {
2707
- margin: 0,
2708
- padding: 0,
2709
- backgroundColor: "#D9D9D9",
2710
- color: "#000000"
2711
- }
2712
- }
2713
- ))), /* @__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))));
2714
- };
2715
-
2716
- const RiskView = () => {
2717
- const { risikoBadge, titleAndButton, section, editIcon } = useScenarioDrawerContentStyles();
2718
- const { h3, body1, label, button } = useFontStyles();
2719
- const { t } = useTranslationRef(pluginRiScTranslationRef);
1939
+ const RiskSection = () => {
2720
1940
  const { scenario, editScenario } = useContext(ScenarioContext);
2721
1941
  return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
2722
1942
  Box$2,
@@ -2727,178 +1947,185 @@ const RiskView = () => {
2727
1947
  alignItems: "center"
2728
1948
  }
2729
1949
  },
2730
- /* @__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.initialRisk")), /* @__PURE__ */ React.createElement(
2731
- Button,
2732
- {
2733
- className: button,
2734
- variant: "text",
2735
- color: "primary",
2736
- onClick: () => editScenario("initialRisk"),
2737
- startIcon: /* @__PURE__ */ React.createElement(EditIcon, { className: editIcon, "aria-label": "Edit" })
2738
- }
2739
- )), /* @__PURE__ */ React.createElement(Grid, { container: true }, /* @__PURE__ */ React.createElement(
2740
- Grid,
2741
- {
2742
- item: true,
2743
- xs: 12,
2744
- style: {
2745
- display: "flex",
2746
- flexDirection: "row",
2747
- gap: "0.5rem",
2748
- alignItems: "center"
2749
- }
2750
- },
2751
- /* @__PURE__ */ React.createElement(
2752
- Box$2,
2753
- {
2754
- className: risikoBadge,
2755
- style: {
2756
- backgroundColor: getRiskMatrixColor(scenario.risk)
2757
- }
2758
- }
2759
- ),
2760
- /* @__PURE__ */ React.createElement(
2761
- Grid,
2762
- {
2763
- item: true,
2764
- xs: 12,
2765
- style: {
2766
- display: "flex",
2767
- flexDirection: "column",
2768
- alignItems: "start"
2769
- }
2770
- },
2771
- /* @__PURE__ */ React.createElement(Typography, { className: label }, t("dictionary.probability"), ":", " ", getSannsynlighetLevel(scenario.risk)),
2772
- /* @__PURE__ */ React.createElement(Typography, { className: label }, t("dictionary.consequence"), ":", " ", getKonsekvensLevel(scenario.risk))
2773
- )
2774
- ), /* @__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(
2775
- scenario.risk.consequence * scenario.risk.probability
2776
- ), " ", t("riskMatrix.estimatedRisk.unit.nokPerYear"))))),
2777
1950
  /* @__PURE__ */ React.createElement(
2778
- Grid,
1951
+ RiskBox,
2779
1952
  {
2780
- item: true,
2781
- xs: 2,
2782
- style: {
2783
- display: "flex",
2784
- justifyContent: "center",
2785
- alignItems: "center"
2786
- }
2787
- },
2788
- /* @__PURE__ */ React.createElement(KeyboardDoubleArrowRightIcon, { fontSize: "large" })
2789
- ),
2790
- /* @__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.restRisk")), /* @__PURE__ */ React.createElement(
2791
- Button,
2792
- {
2793
- className: button,
2794
- variant: "text",
2795
- color: "primary",
2796
- onClick: () => editScenario("restRisk"),
2797
- startIcon: /* @__PURE__ */ React.createElement(EditIcon, { className: editIcon, "aria-label": "Edit" })
1953
+ risk: scenario.risk,
1954
+ riskType: "initialRisk",
1955
+ editScenario
2798
1956
  }
2799
- )), /* @__PURE__ */ React.createElement(Grid, { container: true }, /* @__PURE__ */ React.createElement(
1957
+ ),
1958
+ /* @__PURE__ */ React.createElement(
2800
1959
  Grid,
2801
1960
  {
2802
1961
  item: true,
2803
- xs: 12,
1962
+ xs: 2,
2804
1963
  style: {
2805
1964
  display: "flex",
2806
- flexDirection: "row",
2807
- gap: "0.5rem",
1965
+ justifyContent: "center",
2808
1966
  alignItems: "center"
2809
1967
  }
2810
1968
  },
2811
- /* @__PURE__ */ React.createElement(
2812
- Box$2,
2813
- {
2814
- className: risikoBadge,
2815
- style: {
2816
- backgroundColor: getRiskMatrixColor(scenario.remainingRisk)
2817
- }
2818
- }
2819
- ),
2820
- /* @__PURE__ */ React.createElement(
2821
- Grid,
2822
- {
2823
- item: true,
2824
- xs: 12,
2825
- style: {
2826
- display: "flex",
2827
- flexDirection: "column",
2828
- alignItems: "start"
2829
- }
2830
- },
2831
- /* @__PURE__ */ React.createElement(Typography, { className: label }, t("dictionary.probability"), ":", " ", getSannsynlighetLevel(scenario.remainingRisk)),
2832
- /* @__PURE__ */ React.createElement(Typography, { className: label }, t("dictionary.consequence"), ":", " ", getKonsekvensLevel(scenario.remainingRisk))
2833
- )
2834
- ), /* @__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(
2835
- scenario.remainingRisk.consequence * scenario.remainingRisk.probability
2836
- ), " ", t("riskMatrix.estimatedRisk.unit.nokPerYear")))))
1969
+ /* @__PURE__ */ React.createElement(KeyboardDoubleArrowRightIcon, { fontSize: "large" })
1970
+ ),
1971
+ /* @__PURE__ */ React.createElement(
1972
+ RiskBox,
1973
+ {
1974
+ risk: scenario.risk,
1975
+ riskType: "initialRisk",
1976
+ editScenario
1977
+ }
1978
+ )
2837
1979
  ));
2838
1980
  };
2839
-
2840
- const ScenarioView = () => {
2841
- const { header, titleAndButton, section, editIcon } = useScenarioDrawerContentStyles();
2842
- const { h1, h3, body2, label, button } = useFontStyles();
2843
- 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();
2844
1984
  const { t } = useTranslationRef(pluginRiScTranslationRef);
2845
- 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(
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(
2846
1986
  Button,
2847
1987
  {
2848
1988
  className: button,
2849
1989
  variant: "text",
2850
1990
  color: "primary",
2851
- onClick: () => editScenario("scenario"),
1991
+ onClick: () => editScenario(riskType),
2852
1992
  startIcon: /* @__PURE__ */ React.createElement(EditIcon, { className: editIcon, "aria-label": "Edit" })
2853
1993
  }
2854
- )), /* @__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))))));
2855
- };
2856
-
2857
- const ScenarioDrawerView = () => {
2858
- const { buttons, titleAndButton, section, editIcon } = useScenarioDrawerContentStyles();
2859
- const { h3, button } = useFontStyles();
2860
- const {
2861
- scenario,
2862
- saveScenario,
2863
- openDeleteConfirmation,
2864
- closeScenario,
2865
- editScenario
2866
- } = useContext(ScenarioContext);
2867
- const { t } = useTranslationRef(pluginRiScTranslationRef);
2868
- const [showCloseConfirmation, setShowCloseConfirmation] = useState(false);
2869
- const close = () => {
2870
- closeScenario();
2871
- setShowCloseConfirmation(false);
2872
- };
2873
- const saveAndClose = () => {
2874
- if (saveScenario()) {
2875
- close();
2876
- }
2877
- };
2878
- return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
2879
- Box$2,
1994
+ )), /* @__PURE__ */ React.createElement(Grid, { container: true }, /* @__PURE__ */ React.createElement(
1995
+ Grid,
2880
1996
  {
2881
- className: buttons,
1997
+ item: true,
1998
+ xs: 12,
2882
1999
  style: {
2883
- marginBottom: "8px",
2884
- marginTop: "8px",
2885
2000
  display: "flex",
2886
2001
  flexDirection: "row",
2887
2002
  gap: "0.5rem",
2888
- justifyContent: "flex-end"
2003
+ alignItems: "center"
2889
2004
  }
2890
2005
  },
2891
2006
  /* @__PURE__ */ React.createElement(
2892
- Button,
2007
+ Box$2,
2893
2008
  {
2894
- className: button,
2895
- variant: "outlined",
2896
- color: "primary",
2897
- onClick: closeScenario
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
+ }
2898
2025
  },
2899
- t("dictionary.close")
2026
+ /* @__PURE__ */ React.createElement(Typography, { className: label }, t("dictionary.probability"), ": ", getProbabilityLevel(risk)),
2027
+ /* @__PURE__ */ React.createElement(Typography, { className: label }, t("dictionary.consequence"), ": ", getConsequenceLevel(risk))
2900
2028
  )
2901
- ), /* @__PURE__ */ React.createElement(ScenarioView, null), /* @__PURE__ */ React.createElement(RiskView, null), /* @__PURE__ */ React.createElement(Box$2, null, /* @__PURE__ */ React.createElement(Paper, { className: section, style: { padding: "1rem" } }, /* @__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(
2902
2129
  Grid,
2903
2130
  {
2904
2131
  item: true,
@@ -2919,52 +2146,105 @@ const ScenarioDrawerView = () => {
2919
2146
  startIcon: /* @__PURE__ */ React.createElement(EditIcon, { className: editIcon, "aria-label": "Edit" })
2920
2147
  }
2921
2148
  )
2922
- ), scenario.actions.map((action, index) => /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(TiltakView, { tiltak: action, index: index + 1 }), index !== scenario.actions.length - 1 && /* @__PURE__ */ React.createElement(Divider$1, { variant: "fullWidth" }))))), /* @__PURE__ */ React.createElement(
2923
- Box$2,
2149
+ ), scenario.actions.map((action, index) => /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
2150
+ ActionBox,
2924
2151
  {
2925
- className: buttons,
2926
- style: {
2927
- display: "flex",
2928
- flexDirection: "row",
2929
- gap: "0.5rem",
2930
- justifyContent: "flex-start"
2931
- }
2932
- },
2933
- /* @__PURE__ */ React.createElement(
2934
- Button,
2935
- {
2936
- startIcon: /* @__PURE__ */ React.createElement(DeleteIcon$1, null),
2937
- variant: "text",
2938
- color: "primary",
2939
- onClick: openDeleteConfirmation
2940
- },
2941
- t("scenarioDrawer.deleteScenarioButton")
2942
- )
2943
- ), /* @__PURE__ */ React.createElement(DeleteConfirmation, null), /* @__PURE__ */ React.createElement(
2944
- CloseConfirmation,
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,
2945
2173
  {
2946
- isOpen: showCloseConfirmation,
2947
- close,
2948
- save: saveAndClose
2174
+ className: button,
2175
+ variant: "text",
2176
+ color: "primary",
2177
+ onClick: () => editScenario("scenario"),
2178
+ startIcon: /* @__PURE__ */ React.createElement(EditIcon, { className: editIcon, "aria-label": "Edit" })
2949
2179
  }
2950
- ));
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))))));
2951
2181
  };
2952
2182
 
2953
2183
  const ScenarioDrawer = () => {
2954
- const { paperEdit, paperView } = useScenarioDrawerStyles();
2955
- const { scenarioDrawerState, closeScenario } = useContext(ScenarioContext);
2184
+ const { t } = useTranslationRef(pluginRiScTranslationRef);
2185
+ const { drawer, buttons } = useScenarioDrawerStyles();
2186
+ const { button } = useFontStyles();
2187
+ const { scenarioDrawerState, openDeleteConfirmation, closeScenario } = useContext(ScenarioContext);
2956
2188
  const isOpen = scenarioDrawerState !== ScenarioDrawerState.Closed;
2957
- const editMode = scenarioDrawerState === ScenarioDrawerState.Edit;
2958
2189
  return /* @__PURE__ */ React.createElement(
2959
2190
  Drawer,
2960
2191
  {
2961
- classes: { paper: editMode ? paperEdit : paperView },
2192
+ classes: { paper: drawer },
2962
2193
  variant: "temporary",
2963
2194
  anchor: "right",
2964
2195
  open: isOpen,
2965
2196
  onClose: closeScenario
2966
2197
  },
2967
- editMode ? /* @__PURE__ */ React.createElement(ScenarioDrawerEdit, null) : /* @__PURE__ */ React.createElement(ScenarioDrawerView, null)
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)
2968
2248
  );
2969
2249
  };
2970
2250
 
@@ -3041,8 +2321,9 @@ const RiskMatrixScenarioCount = ({
3041
2321
  riSc,
3042
2322
  probability,
3043
2323
  consequence,
3044
- startRisiko
2324
+ initialRisk
3045
2325
  }) => {
2326
+ const { t } = useTranslationRef(pluginRiScTranslationRef);
3046
2327
  const {
3047
2328
  circle,
3048
2329
  centered,
@@ -3052,19 +2333,18 @@ const RiskMatrixScenarioCount = ({
3052
2333
  tooltipArrow,
3053
2334
  tooltipText
3054
2335
  } = useRiskMatrixStyles();
3055
- const { t } = useTranslationRef(pluginRiScTranslationRef);
3056
2336
  const [tooltipOpen, setTooltipOpen] = useState(false);
3057
- const scenarier = riSc.scenarios.filter(
2337
+ const scenarios = riSc.scenarios.filter(
3058
2338
  (scenario) => probabilityOptions.indexOf(
3059
- startRisiko ? scenario.risk.probability : scenario.remainingRisk.probability
2339
+ initialRisk ? scenario.risk.probability : scenario.remainingRisk.probability
3060
2340
  ) === probability && consequenceOptions.indexOf(
3061
- startRisiko ? scenario.risk.consequence : scenario.remainingRisk.consequence
2341
+ initialRisk ? scenario.risk.consequence : scenario.remainingRisk.consequence
3062
2342
  ) === consequence
3063
2343
  );
3064
- if (scenarier.length === 0) {
2344
+ if (scenarios.length === 0) {
3065
2345
  return null;
3066
2346
  }
3067
- 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"))), scenarier.map((s) => /* @__PURE__ */ React.createElement(ListItem, { button: true, disableGutters: true, className: tooltipText }, /* @__PURE__ */ React.createElement(CircleIcon, { className: tooltipText, style: { width: "10px" } }), /* @__PURE__ */ React.createElement(
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(
3068
2348
  ListItemText$1,
3069
2349
  {
3070
2350
  className: tooltipText,
@@ -3088,12 +2368,12 @@ const RiskMatrixScenarioCount = ({
3088
2368
  elevation: 10,
3089
2369
  onClick: () => setTooltipOpen(!tooltipOpen)
3090
2370
  },
3091
- /* @__PURE__ */ React.createElement(Typography, { className: `${circleText} ${text}` }, scenarier.length)
2371
+ /* @__PURE__ */ React.createElement(Typography, { className: `${circleText} ${text}` }, scenarios.length)
3092
2372
  )
3093
2373
  ));
3094
2374
  };
3095
2375
 
3096
- const useStyles$1 = makeStyles({
2376
+ const useEstimatedRiskInfoDialogStyles = makeStyles({
3097
2377
  paper: {
3098
2378
  backgroundColor: "white"
3099
2379
  },
@@ -3105,16 +2385,17 @@ const useStyles$1 = makeStyles({
3105
2385
  color: "black"
3106
2386
  }
3107
2387
  });
2388
+
3108
2389
  const EstimatedRiskInfoDialog = ({
3109
2390
  isOpen,
3110
2391
  onClose
3111
2392
  }) => {
3112
- const classes = useStyles$1();
3113
2393
  const { t } = useTranslationRef(pluginRiScTranslationRef);
3114
- return /* @__PURE__ */ React.createElement(Dialog, { open: isOpen, onClose, maxWidth: "xs" }, /* @__PURE__ */ React.createElement(Paper, { className: classes.paper }, /* @__PURE__ */ React.createElement(DialogTitle, { className: classes.title }, t("infoDialog.title")), /* @__PURE__ */ React.createElement(DialogContent, { className: classes.text, dividers: true }, /* @__PURE__ */ React.createElement(DialogContentText, { className: classes.text }, t("infoDialog.description")), /* @__PURE__ */ React.createElement(Typography, { style: { fontWeight: "bold" } }, t("infoDialog.calculatedHowTitle")), /* @__PURE__ */ React.createElement(DialogContentText, { className: classes.text }, t("infoDialog.calculatedHow")), /* @__PURE__ */ React.createElement(Typography, { style: { fontWeight: "bold" } }, t("infoDialog.consequenceTitle")), /* @__PURE__ */ React.createElement(DialogContentText, { className: classes.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: classes.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: classes.text }, t("infoDialog.example")))));
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")))));
3115
2396
  };
3116
2397
 
3117
- const useStyles = makeStyles({
2398
+ const useAggregatedCostStyles = makeStyles({
3118
2399
  outerBox: {
3119
2400
  display: "flex",
3120
2401
  flexDirection: "column",
@@ -3125,14 +2406,15 @@ const useStyles = makeStyles({
3125
2406
  alignItems: "center"
3126
2407
  }
3127
2408
  });
2409
+
3128
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);
3129
2415
  const cost = riSc.scenarios.map(
3130
2416
  (scenario) => initialRisk ? scenario.risk.probability * scenario.risk.consequence : scenario.remainingRisk.probability * scenario.remainingRisk.consequence
3131
2417
  ).reduce((a, b) => a + b, 0);
3132
- const [showDialog, setShowDialog] = useState(false);
3133
- const { outerBox, innerBox } = useStyles();
3134
- const { label2, body2 } = useFontStyles();
3135
- const { t } = useTranslationRef(pluginRiScTranslationRef);
3136
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(
3137
2419
  EstimatedRiskInfoDialog,
3138
2420
  {
@@ -3141,25 +2423,21 @@ const AggregatedCost = ({ riSc, initialRisk }) => {
3141
2423
  }
3142
2424
  ));
3143
2425
  };
3144
- function formatNumber(cost, t) {
3145
- if (cost < 1e4) {
3146
- return formatNOK(cost);
3147
- } else {
3148
- let { threshold, unit } = [
3149
- { threshold: 1e6, unit: "thousand" },
3150
- { threshold: 1e9, unit: "million" },
3151
- { threshold: 1e12, unit: "billion" },
3152
- { threshold: 1e15, unit: "trillion" }
3153
- ].find(({ threshold: threshold2 }) => cost < threshold2);
3154
- return t(`riskMatrix.estimatedRisk.suffix.${unit}`, {
3155
- count: Number((cost / threshold * 1e3).toFixed(0))
3156
- });
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
+ }
3157
2435
  }
3158
- }
2436
+ }));
3159
2437
 
3160
2438
  const Tabs = ({ setTab }) => {
3161
- const tabsStyle = useTabsStyle();
3162
2439
  const { t } = useTranslationRef(pluginRiScTranslationRef);
2440
+ const tabsStyle = useTabsStyle();
3163
2441
  return /* @__PURE__ */ React.createElement(Box$2, { sx: { borderBottom: 1, borderColor: "divider" } }, /* @__PURE__ */ React.createElement(
3164
2442
  TabList,
3165
2443
  {
@@ -3171,7 +2449,7 @@ const Tabs = ({ setTab }) => {
3171
2449
  Tab,
3172
2450
  {
3173
2451
  label: /* @__PURE__ */ React.createElement(Typography, { variant: "subtitle1", style: { fontWeight: "bold" } }, t("dictionary.initialRisk")),
3174
- value: "startrisiko",
2452
+ value: RiskMatrixTabs.initialRisk,
3175
2453
  className: tabsStyle.tab
3176
2454
  }
3177
2455
  ),
@@ -3179,15 +2457,21 @@ const Tabs = ({ setTab }) => {
3179
2457
  Tab,
3180
2458
  {
3181
2459
  label: /* @__PURE__ */ React.createElement(Typography, { variant: "subtitle1", style: { fontWeight: "bold" } }, t("dictionary.restRisk")),
3182
- value: "restrisiko",
2460
+ value: RiskMatrixTabs.remainingRisk,
3183
2461
  className: tabsStyle.tab
3184
2462
  }
3185
2463
  )
3186
2464
  ));
3187
2465
  };
3188
2466
 
2467
+ var RiskMatrixTabs = /* @__PURE__ */ ((RiskMatrixTabs2) => {
2468
+ RiskMatrixTabs2["initialRisk"] = "initialRisk";
2469
+ RiskMatrixTabs2["remainingRisk"] = "remainingRisk";
2470
+ return RiskMatrixTabs2;
2471
+ })(RiskMatrixTabs || {});
3189
2472
  const RiskMatrix = ({ riSc }) => {
3190
- const indices = [0, 1, 2, 3, 4];
2473
+ const { t } = useTranslationRef(pluginRiScTranslationRef);
2474
+ const { label2 } = useFontStyles();
3191
2475
  const {
3192
2476
  riskSummary,
3193
2477
  grid,
@@ -3198,10 +2482,14 @@ const RiskMatrix = ({ riSc }) => {
3198
2482
  text,
3199
2483
  centered
3200
2484
  } = useRiskMatrixStyles();
3201
- const { label2 } = useFontStyles();
3202
- const [tab, setTab] = useState("startrisiko");
3203
- const { t } = useTranslationRef(pluginRiScTranslationRef);
3204
- 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(AggregatedCost, { riSc, initialRisk: tab === "startrisiko" })), /* @__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"))), indices.map((row) => /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Box$2, { className: centered }, /* @__PURE__ */ React.createElement(Typography, { className: text }, 5 - row)), indices.map((col) => /* @__PURE__ */ React.createElement(
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(
3205
2493
  Box$2,
3206
2494
  {
3207
2495
  className: `${square} ${centered}`,
@@ -3213,10 +2501,10 @@ const RiskMatrix = ({ riSc }) => {
3213
2501
  riSc,
3214
2502
  probability: col,
3215
2503
  consequence: 4 - row,
3216
- startRisiko: tab === "startrisiko"
2504
+ initialRisk: tab === "initialRisk" /* initialRisk */
3217
2505
  }
3218
2506
  )
3219
- )))), /* @__PURE__ */ React.createElement(Box$2, { className: centered }), /* @__PURE__ */ React.createElement(Box$2, { className: centered }), indices.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")))))));
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")))))));
3220
2508
  };
3221
2509
 
3222
2510
  const useTableStyles = makeStyles((theme) => ({
@@ -3259,15 +2547,11 @@ const ScenarioTableRow = ({
3259
2547
  viewRow,
3260
2548
  isLastRow
3261
2549
  }) => {
3262
- const sannsynlighet = probabilityOptions.indexOf(scenario.risk.probability) + 1;
3263
- const konsekvens = consequenceOptions.indexOf(scenario.risk.consequence) + 1;
3264
- const restSannsynlighet = probabilityOptions.indexOf(scenario.remainingRisk.probability) + 1;
3265
- const restKonsekvens = consequenceOptions.indexOf(scenario.remainingRisk.consequence) + 1;
2550
+ const { t } = useTranslationRef(pluginRiScTranslationRef);
2551
+ const { riskColor, rowBackground, rowBorder, tableCell } = useTableStyles();
3266
2552
  const remainingActions = scenario.actions.filter(
3267
2553
  (a) => a.status !== "Completed"
3268
2554
  );
3269
- const { riskColor, rowBackground, rowBorder, tableCell } = useTableStyles();
3270
- const { t } = useTranslationRef(pluginRiScTranslationRef);
3271
2555
  return /* @__PURE__ */ React.createElement(TableRow, { className: isLastRow ? void 0 : rowBorder }, /* @__PURE__ */ React.createElement(
3272
2556
  "button",
3273
2557
  {
@@ -3300,7 +2584,7 @@ const ScenarioTableRow = ({
3300
2584
  backgroundColor: getRiskMatrixColor(scenario.risk)
3301
2585
  }
3302
2586
  }
3303
- ), t("scenarioTable.columns.probabilityChar"), ":", sannsynlighet, " ", t("scenarioTable.columns.consequenceChar"), ":", konsekvens),
2587
+ ), t("scenarioTable.columns.probabilityChar"), ":", getProbabilityLevel(scenario.risk), " ", t("scenarioTable.columns.consequenceChar"), ":", getConsequenceLevel(scenario.risk)),
3304
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")),
3305
2589
  /* @__PURE__ */ React.createElement(TableCell, { className: tableCell }, /* @__PURE__ */ React.createElement(
3306
2590
  Paper,
@@ -3310,14 +2594,14 @@ const ScenarioTableRow = ({
3310
2594
  backgroundColor: getRiskMatrixColor(scenario.remainingRisk)
3311
2595
  }
3312
2596
  }
3313
- ), t("scenarioTable.columns.probabilityChar"), ":", restSannsynlighet, " ", t("scenarioTable.columns.consequenceChar"), ":", restKonsekvens)
2597
+ ), t("scenarioTable.columns.probabilityChar"), ":", getProbabilityLevel(scenario.remainingRisk), " ", t("scenarioTable.columns.consequenceChar"), ":", getConsequenceLevel(scenario.remainingRisk))
3314
2598
  ));
3315
2599
  };
3316
2600
 
3317
2601
  const ScenarioTable = ({ riSc }) => {
3318
- const { newScenario, openScenario } = useContext(ScenarioContext);
3319
- const { titleBox, rowBorder, tableCell } = useTableStyles();
3320
2602
  const { t } = useTranslationRef(pluginRiScTranslationRef);
2603
+ const { titleBox, rowBorder, tableCell } = useTableStyles();
2604
+ const { newScenario, openScenario } = useContext(ScenarioContext);
3321
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(
3322
2606
  Box$1,
3323
2607
  {
@@ -3455,6 +2739,9 @@ const RiScDialog = ({
3455
2739
  riSc,
3456
2740
  ...props
3457
2741
  }) => {
2742
+ const { t } = useTranslationRef(pluginRiScTranslationRef);
2743
+ const { paper, content, buttons } = useRiScDialogStyles();
2744
+ const { h1 } = useFontStyles();
3458
2745
  const [newRiSc, setNewRiSc] = useState(
3459
2746
  dialogState === 1 /* Edit */ ? riSc.content : emptyRiSc()
3460
2747
  );
@@ -3462,9 +2749,6 @@ const RiScDialog = ({
3462
2749
  title: null,
3463
2750
  scope: null
3464
2751
  });
3465
- const classes = useRiScDialogStyles();
3466
- const { h1 } = useFontStyles();
3467
- const { t } = useTranslationRef(pluginRiScTranslationRef);
3468
2752
  const handleCancel = () => {
3469
2753
  onClose();
3470
2754
  setNewRiSc(emptyRiSc());
@@ -3487,53 +2771,53 @@ const RiScDialog = ({
3487
2771
  }
3488
2772
  handleCancel();
3489
2773
  };
3490
- const setTittel = (tittel) => {
2774
+ const setTitle = (title) => {
3491
2775
  setNewRiScError({
3492
2776
  ...newRiScError,
3493
2777
  title: null
3494
2778
  });
3495
2779
  setNewRiSc({
3496
2780
  ...newRiSc,
3497
- title: tittel
2781
+ title
3498
2782
  });
3499
2783
  };
3500
- const setOmfang = (omfang) => {
2784
+ const setScope = (scope) => {
3501
2785
  setNewRiScError({
3502
2786
  ...newRiScError,
3503
2787
  scope: null
3504
2788
  });
3505
2789
  setNewRiSc({
3506
2790
  ...newRiSc,
3507
- scope: omfang
2791
+ scope
3508
2792
  });
3509
2793
  };
3510
2794
  const header = dialogState === 2 /* Create */ ? t("rosDialog.titleNew") : t("rosDialog.titleEdit");
3511
2795
  return /* @__PURE__ */ React.createElement(
3512
2796
  Dialog,
3513
2797
  {
3514
- classes: { paper: classes.paper },
2798
+ classes: { paper },
3515
2799
  open: dialogState !== 0 /* Closed */,
3516
2800
  onClose: handleSave,
3517
2801
  ...props
3518
2802
  },
3519
- /* @__PURE__ */ React.createElement(DialogContent, null, /* @__PURE__ */ React.createElement(Typography, { className: h1 }, header), /* @__PURE__ */ React.createElement(Box$1, { className: classes.content }, /* @__PURE__ */ React.createElement(
2803
+ /* @__PURE__ */ React.createElement(DialogContent, null, /* @__PURE__ */ React.createElement(Typography, { className: h1 }, header), /* @__PURE__ */ React.createElement(Box$1, { className: content }, /* @__PURE__ */ React.createElement(
3520
2804
  TextField,
3521
2805
  {
3522
2806
  label: t("dictionary.title"),
3523
2807
  value: newRiSc.title,
3524
2808
  minRows: 1,
3525
- handleChange: setTittel,
2809
+ handleChange: setTitle,
3526
2810
  error: newRiScError.title,
3527
2811
  required: true
3528
2812
  }
3529
- )), /* @__PURE__ */ React.createElement(Box$1, { className: classes.content }, /* @__PURE__ */ React.createElement(
2813
+ )), /* @__PURE__ */ React.createElement(Box$1, { className: content }, /* @__PURE__ */ React.createElement(
3530
2814
  TextField,
3531
2815
  {
3532
2816
  label: t("dictionary.scope"),
3533
2817
  subtitle: t("rosDialog.scopeDescription"),
3534
2818
  value: newRiSc.scope,
3535
2819
  minRows: 4,
3536
- handleChange: setOmfang,
2820
+ handleChange: setScope,
3537
2821
  error: newRiScError.scope,
3538
2822
  required: true
3539
2823
  }
@@ -3548,7 +2832,7 @@ const RiScDialog = ({
3548
2832
  alignItems: "center"
3549
2833
  }
3550
2834
  },
3551
- /* @__PURE__ */ React.createElement(Box$1, { className: classes.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")))
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")))
3552
2836
  )
3553
2837
  );
3554
2838
  };
@@ -3592,15 +2876,6 @@ const useStatusTextStyles = makeStyles(() => ({
3592
2876
  marginLeft: "2px"
3593
2877
  }
3594
2878
  }));
3595
- makeStyles(() => ({
3596
- noApprovalBanner: {
3597
- backgroundColor: "#FCEBCD",
3598
- color: "#303030"
3599
- },
3600
- "MuiAlert-message": {
3601
- color: "#B2750B"
3602
- }
3603
- }));
3604
2879
 
3605
2880
  const getChipColor = (status, classes) => {
3606
2881
  switch (status) {
@@ -3671,22 +2946,31 @@ const StatusChip = ({ currentRiScStatus }) => {
3671
2946
  );
3672
2947
  };
3673
2948
 
2949
+ const useButtonStyles = makeStyles(() => ({
2950
+ approveButton: {
2951
+ borderRadius: "2px",
2952
+ whiteSpace: "nowrap",
2953
+ overflow: "hidden",
2954
+ textOverflow: "ellipsis"
2955
+ }
2956
+ }));
2957
+
3674
2958
  const RiScPublishDialog = ({
3675
2959
  openDialog,
3676
2960
  handleCancel,
3677
2961
  handlePublish
3678
2962
  }) => {
3679
- const classes = useRiScDialogStyles();
3680
2963
  const { t } = useTranslationRef(pluginRiScTranslationRef);
3681
- const [userIsRisikoEierAndApproves, setUserIsRisikoEierAndApproves] = useState(false);
2964
+ const { buttons } = useRiScDialogStyles();
2965
+ const [riskOwnerApproves, setRiskOwnerApproves] = useState(false);
3682
2966
  const handleCheckboxInput = (event) => {
3683
- setUserIsRisikoEierAndApproves(event.target.checked);
2967
+ setRiskOwnerApproves(event.target.checked);
3684
2968
  };
3685
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(
3686
2970
  Checkbox,
3687
2971
  {
3688
2972
  color: "primary",
3689
- checked: userIsRisikoEierAndApproves,
2973
+ checked: riskOwnerApproves,
3690
2974
  onChange: handleCheckboxInput
3691
2975
  }
3692
2976
  )), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 8 }, t("publishDialog.checkboxLabel"))))), /* @__PURE__ */ React.createElement(
@@ -3699,13 +2983,13 @@ const RiScPublishDialog = ({
3699
2983
  alignItems: "center"
3700
2984
  }
3701
2985
  },
3702
- /* @__PURE__ */ React.createElement(Box$1, { className: classes.buttons }, /* @__PURE__ */ React.createElement(Button, { variant: "outlined", color: "primary", onClick: handleCancel }, t("dictionary.cancel")), /* @__PURE__ */ React.createElement(
2986
+ /* @__PURE__ */ React.createElement(Box$1, { className: buttons }, /* @__PURE__ */ React.createElement(Button, { variant: "outlined", color: "primary", onClick: handleCancel }, t("dictionary.cancel")), /* @__PURE__ */ React.createElement(
3703
2987
  Button,
3704
2988
  {
3705
2989
  variant: "contained",
3706
2990
  color: "primary",
3707
2991
  onClick: handlePublish,
3708
- disabled: !userIsRisikoEierAndApproves
2992
+ disabled: !riskOwnerApproves
3709
2993
  },
3710
2994
  t("dictionary.confirm")
3711
2995
  ))
@@ -3715,8 +2999,8 @@ const RiScStatusComponent = ({
3715
2999
  selectedRiSc,
3716
3000
  publishRiScFn
3717
3001
  }) => {
3718
- const statusComponentClasses = useButtonStyles();
3719
3002
  const { t } = useTranslationRef(pluginRiScTranslationRef);
3003
+ const { approveButton } = useButtonStyles();
3720
3004
  const [publishRiScDialogIsOpen, setPublishRiScDialogIsOpen] = useState(false);
3721
3005
  const handleApproveAndPublish = () => {
3722
3006
  publishRiScFn();
@@ -3728,7 +3012,7 @@ const RiScStatusComponent = ({
3728
3012
  color: "primary",
3729
3013
  variant: "contained",
3730
3014
  onClick: () => setPublishRiScDialogIsOpen(!publishRiScDialogIsOpen),
3731
- className: statusComponentClasses.godkjennButton,
3015
+ className: approveButton,
3732
3016
  fullWidth: true,
3733
3017
  disabled: selectedRiSc.status !== RiScStatus.Draft
3734
3018
  },
@@ -3750,9 +3034,9 @@ const useRiScInfoStyles = makeStyles(() => ({
3750
3034
  }));
3751
3035
 
3752
3036
  const RiScInfo = ({ riSc, approveRiSc, edit }) => {
3037
+ const { t } = useTranslationRef(pluginRiScTranslationRef);
3753
3038
  const { label, body2 } = useFontStyles();
3754
3039
  const { infoCard } = useRiScInfoStyles();
3755
- const { t } = useTranslationRef(pluginRiScTranslationRef);
3756
3040
  return /* @__PURE__ */ React.createElement(Grid, { container: true }, /* @__PURE__ */ React.createElement(
3757
3041
  Grid,
3758
3042
  {
@@ -3783,6 +3067,7 @@ const RiScInfo = ({ riSc, approveRiSc, edit }) => {
3783
3067
  const Plugin = () => {
3784
3068
  var _a, _b;
3785
3069
  const params = useParams();
3070
+ const { t } = useTranslationRef(pluginRiScTranslationRef);
3786
3071
  const [RiScDialogState, setRiScDialogState] = useState(
3787
3072
  RiScDialogStates.Closed
3788
3073
  );
@@ -3806,8 +3091,6 @@ const Plugin = () => {
3806
3091
  updateRiSc,
3807
3092
  params.scenarioId
3808
3093
  );
3809
- const classes = useLoadingStyles();
3810
- const { t } = useTranslationRef(pluginRiScTranslationRef);
3811
3094
  const [searchParams] = useSearchParams();
3812
3095
  const scenarioWizardStep = searchParams.get("step") || null;
3813
3096
  useEffect(() => {
@@ -3821,7 +3104,7 @@ const Plugin = () => {
3821
3104
  isFetching,
3822
3105
  updateStatus: updateRiScStatus
3823
3106
  }
3824
- ) : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(ContentHeader, { title: t("contentHeader.title") }, /* @__PURE__ */ React.createElement(SupportButton, null, "Kul plugin ass!")), isFetching && /* @__PURE__ */ React.createElement("div", { className: classes.container }, /* @__PURE__ */ React.createElement(CircularProgress, { className: classes.spinner, size: 80 })), /* @__PURE__ */ React.createElement(Grid, { container: true, spacing: 4 }, riScs !== null && riScs.length !== 0 && /* @__PURE__ */ React.createElement(
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(
3825
3108
  Grid,
3826
3109
  {
3827
3110
  item: true,
@@ -3876,4 +3159,4 @@ const RiScPlugin = () => {
3876
3159
  };
3877
3160
 
3878
3161
  export { RiScPlugin };
3879
- //# sourceMappingURL=index-af063c38.esm.js.map
3162
+ //# sourceMappingURL=index-153cf81f.esm.js.map