@kartverket/backstage-plugin-risk-scorecard 1.3.1 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/dist/components/riScDialog/MatrixDialog.esm.js +53 -0
  2. package/dist/components/riScDialog/MatrixDialog.esm.js.map +1 -0
  3. package/dist/components/riScInfo/riScStatus/RiScStatusComponent.esm.js +30 -12
  4. package/dist/components/riScInfo/riScStatus/RiScStatusComponent.esm.js.map +1 -1
  5. package/dist/components/riScPlugin/RiScPlugin.esm.js +2 -2
  6. package/dist/components/riScPlugin/RiScPlugin.esm.js.map +1 -1
  7. package/dist/components/scenarioDrawer/ScenarioDrawer.esm.js +28 -8
  8. package/dist/components/scenarioDrawer/ScenarioDrawer.esm.js.map +1 -1
  9. package/dist/components/scenarioDrawer/components/ActionBox.esm.js +103 -27
  10. package/dist/components/scenarioDrawer/components/ActionBox.esm.js.map +1 -1
  11. package/dist/components/scenarioDrawer/components/{ActionFormSection.esm.js → ActionFormItem.esm.js} +18 -37
  12. package/dist/components/scenarioDrawer/components/ActionFormItem.esm.js.map +1 -0
  13. package/dist/components/scenarioDrawer/components/ActionsSection.esm.js +42 -4
  14. package/dist/components/scenarioDrawer/components/ActionsSection.esm.js.map +1 -1
  15. package/dist/components/scenarioDrawer/components/RiskFormSection.esm.js +25 -10
  16. package/dist/components/scenarioDrawer/components/RiskFormSection.esm.js.map +1 -1
  17. package/dist/components/scenarioDrawer/components/ScopeFormSection.esm.js.map +1 -1
  18. package/dist/components/scenarioDrawer/scenarioDrawerComponents.esm.js +25 -2
  19. package/dist/components/scenarioDrawer/scenarioDrawerComponents.esm.js.map +1 -1
  20. package/dist/components/scenarioTable/ScenarioTable.esm.js +94 -6
  21. package/dist/components/scenarioTable/ScenarioTable.esm.js.map +1 -1
  22. package/dist/components/scenarioTable/ScenarioTableRow.esm.js +50 -3
  23. package/dist/components/scenarioTable/ScenarioTableRow.esm.js.map +1 -1
  24. package/dist/components/scenarioTable/ScenarioTableStyles.esm.js +9 -0
  25. package/dist/components/scenarioTable/ScenarioTableStyles.esm.js.map +1 -1
  26. package/dist/components/scenarioWizard/components/ConsequenceTable.esm.js +30 -2
  27. package/dist/components/scenarioWizard/components/ConsequenceTable.esm.js.map +1 -1
  28. package/dist/components/scenarioWizard/components/ProbabilityTable.esm.js +31 -2
  29. package/dist/components/scenarioWizard/components/ProbabilityTable.esm.js.map +1 -1
  30. package/dist/contexts/RiScContext.esm.js +2 -2
  31. package/dist/contexts/RiScContext.esm.js.map +1 -1
  32. package/dist/contexts/ScenarioContext.esm.js +35 -1
  33. package/dist/contexts/ScenarioContext.esm.js.map +1 -1
  34. package/dist/utils/translations.esm.js +27 -5
  35. package/dist/utils/translations.esm.js.map +1 -1
  36. package/dist/utils/types.esm.js.map +1 -1
  37. package/dist/utils/utilityfunctions.esm.js +38 -10
  38. package/dist/utils/utilityfunctions.esm.js.map +1 -1
  39. package/package.json +3 -1
  40. package/dist/components/scenarioDrawer/components/ActionFormSection.esm.js.map +0 -1
@@ -0,0 +1,53 @@
1
+ import React from 'react';
2
+ import { ConsequenceTableInfoWithHeaders } from '../scenarioWizard/components/ConsequenceTable.esm.js';
3
+ import CloseIcon from '@mui/icons-material/Close';
4
+ import { ProbabilityTableInfoWithHeaders } from '../scenarioWizard/components/ProbabilityTable.esm.js';
5
+ import { heading3 } from '../common/typography.esm.js';
6
+ import { pluginRiScTranslationRef } from '../../utils/translations.esm.js';
7
+ import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
8
+ import Box from '@mui/material/Box';
9
+ import Dialog from '@mui/material/Dialog';
10
+ import DialogTitle from '@mui/material/DialogTitle';
11
+ import IconButton from '@mui/material/IconButton';
12
+ import DialogContent from '@mui/material/DialogContent';
13
+ import Typography from '@mui/material/Typography';
14
+ import DialogActions from '@mui/material/DialogActions';
15
+ import Button from '@mui/material/Button';
16
+
17
+ const MatrixDialog = ({
18
+ open,
19
+ close
20
+ }) => {
21
+ const { t } = useTranslationRef(pluginRiScTranslationRef);
22
+ return /* @__PURE__ */ React.createElement(Dialog, { maxWidth: "lg", open, onClose: close }, /* @__PURE__ */ React.createElement(DialogTitle, null, t("scenarioDrawer.riskMatrixModal.title")), /* @__PURE__ */ React.createElement(
23
+ IconButton,
24
+ {
25
+ "aria-label": "close",
26
+ onClick: close,
27
+ sx: {
28
+ position: "absolute",
29
+ right: 8,
30
+ top: 8,
31
+ color: (theme) => theme.palette.grey[500]
32
+ }
33
+ },
34
+ /* @__PURE__ */ React.createElement(CloseIcon, null)
35
+ ), /* @__PURE__ */ React.createElement(DialogContent, null, /* @__PURE__ */ React.createElement(
36
+ Typography,
37
+ {
38
+ sx: {
39
+ paddingBottom: "32px"
40
+ }
41
+ },
42
+ t("scenarioStepper.initialRiskStep.subtitle")
43
+ ), /* @__PURE__ */ React.createElement(Box, null, /* @__PURE__ */ React.createElement(Typography, { sx: { ...heading3, paddingBottom: "4px" } }, t("dictionary.probability"))), /* @__PURE__ */ React.createElement(ProbabilityTableInfoWithHeaders, null), /* @__PURE__ */ React.createElement(Box, null, /* @__PURE__ */ React.createElement(
44
+ Typography,
45
+ {
46
+ sx: { ...heading3, paddingTop: "16px", paddingBottom: "4px" }
47
+ },
48
+ t("dictionary.consequence")
49
+ )), /* @__PURE__ */ React.createElement(ConsequenceTableInfoWithHeaders, null)), /* @__PURE__ */ React.createElement(DialogActions, null, /* @__PURE__ */ React.createElement(Button, { onClick: close }, t("dictionary.close"))));
50
+ };
51
+
52
+ export { MatrixDialog };
53
+ //# sourceMappingURL=MatrixDialog.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MatrixDialog.esm.js","sources":["../../../src/components/riScDialog/MatrixDialog.tsx"],"sourcesContent":["import React from 'react';\nimport { ConsequenceTableInfoWithHeaders } from '../scenarioWizard/components/ConsequenceTable';\nimport CloseIcon from '@mui/icons-material/Close';\nimport { ProbabilityTableInfoWithHeaders } from '../scenarioWizard/components/ProbabilityTable';\nimport { heading3 } from '../common/typography';\nimport { pluginRiScTranslationRef } from '../../utils/translations';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport Box from '@mui/material/Box';\nimport Dialog from '@mui/material/Dialog';\nimport DialogTitle from '@mui/material/DialogTitle';\nimport IconButton from '@mui/material/IconButton';\nimport DialogContent from '@mui/material/DialogContent';\nimport Typography from '@mui/material/Typography';\nimport DialogActions from '@mui/material/DialogActions';\nimport Button from '@mui/material/Button';\n\nexport const MatrixDialog = ({\n open,\n close,\n}: {\n open: boolean;\n close: () => void;\n}) => {\n const { t } = useTranslationRef(pluginRiScTranslationRef);\n\n return (\n <Dialog maxWidth=\"lg\" open={open} onClose={close}>\n <DialogTitle>{t('scenarioDrawer.riskMatrixModal.title')}</DialogTitle>\n <IconButton\n aria-label=\"close\"\n onClick={close}\n sx={{\n position: 'absolute',\n right: 8,\n top: 8,\n color: theme => theme.palette.grey[500],\n }}\n >\n <CloseIcon />\n </IconButton>\n <DialogContent>\n <Typography\n sx={{\n paddingBottom: '32px',\n }}\n >\n {t('scenarioStepper.initialRiskStep.subtitle')}\n </Typography>\n <Box>\n <Typography sx={{ ...heading3, paddingBottom: '4px' }}>\n {t('dictionary.probability')}\n </Typography>\n </Box>\n <ProbabilityTableInfoWithHeaders />\n <Box>\n <Typography\n sx={{ ...heading3, paddingTop: '16px', paddingBottom: '4px' }}\n >\n {t('dictionary.consequence')}\n </Typography>\n </Box>\n <ConsequenceTableInfoWithHeaders />\n </DialogContent>\n <DialogActions>\n <Button onClick={close}>{t('dictionary.close')}</Button>\n </DialogActions>\n </Dialog>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAgBO,MAAM,eAAe,CAAC;AAAA,EAC3B,IAAA;AAAA,EACA,KAAA;AACF,CAGM,KAAA;AACJ,EAAA,MAAM,EAAE,CAAA,EAAM,GAAA,iBAAA,CAAkB,wBAAwB,CAAA,CAAA;AAExD,EAAA,uBACG,KAAA,CAAA,aAAA,CA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AA,CAAC,+BAAgC,EAAA,IAAA,CACnC,mBACC,KAAA,CAAA,aAAA,CAAA,aAAA,EAAA,IAAA,kBACE,KAAA,CAAA,aAAA,CAAA,MAAA,EAAA,EAAO,SAAS,KAAQ,EAAA,EAAA,CAAA,CAAE,kBAAkB,CAAE,CACjD,CACF,CAAA,CAAA;AAEJ;;;;"}
@@ -18,6 +18,8 @@ import { InfoCard } from '@backstage/core-components';
18
18
  import { PullRequestSvg } from '../../common/Icons.esm.js';
19
19
  import { useRiScs } from '../../../contexts/RiScContext.esm.js';
20
20
  import { subtitle1 } from '../../common/typography.esm.js';
21
+ import { Box } from '@material-ui/core';
22
+ import { WarningAmberOutlined } from '@mui/icons-material';
21
23
 
22
24
  const RiScPublishDialog = ({
23
25
  openDialog,
@@ -56,14 +58,23 @@ const RiScPublishDialog = ({
56
58
  const RiScMigrationDialog = ({
57
59
  openDialog,
58
60
  handleCancel,
59
- handleUpdate
61
+ handleUpdate,
62
+ migrationVersions
60
63
  }) => {
61
64
  const { t } = useTranslationRef(pluginRiScTranslationRef);
62
65
  const [saveMigration, setSaveMigration] = useState(false);
63
66
  const handleCheckboxInput = (event) => {
64
67
  setSaveMigration(event.target.checked);
65
68
  };
66
- return /* @__PURE__ */ React.createElement(Dialog, { open: openDialog }, /* @__PURE__ */ React.createElement(DialogTitle, null, t("migrationDialog.title")), /* @__PURE__ */ React.createElement(DialogContent, null, /* @__PURE__ */ React.createElement(Alert, { severity: "info", icon: false }, /* @__PURE__ */ React.createElement(
69
+ return /* @__PURE__ */ React.createElement(Dialog, { open: openDialog }, /* @__PURE__ */ React.createElement(DialogTitle, null, t("migrationDialog.title")), /* @__PURE__ */ React.createElement(DialogContent, null, /* @__PURE__ */ React.createElement(Box, { sx: { marginBottom: "16px" } }, /* @__PURE__ */ React.createElement(Typography, null, t("migrationDialog.description"), migrationVersions?.toVersion, " ", t("migrationDialog.description2"), " ", migrationVersions?.fromVersion, t("migrationDialog.description3"), /* @__PURE__ */ React.createElement(
70
+ Link,
71
+ {
72
+ underline: "always",
73
+ target: "_blank",
74
+ href: "https://github.com/kartverket/backstage-plugin-risk-scorecard-backend/blob/main/docs/schemaChangelog.md"
75
+ },
76
+ t("migrationDialog.changelog")
77
+ ), " ", t("migrationDialog.description4"))), /* @__PURE__ */ React.createElement(Alert, { severity: "info", icon: false }, /* @__PURE__ */ React.createElement(
67
78
  FormControlLabel,
68
79
  {
69
80
  control: /* @__PURE__ */ React.createElement(
@@ -91,7 +102,13 @@ const RosAcceptance = ({
91
102
  }) => {
92
103
  const { t } = useTranslationRef(pluginRiScTranslationRef);
93
104
  if (migration) {
94
- return /* @__PURE__ */ React.createElement(Typography, { paragraph: true, sx: subtitle1 }, t("rosStatus.statusBadge.migration"));
105
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Typography, { paragraph: true, sx: subtitle1 }, /* @__PURE__ */ React.createElement(
106
+ WarningAmberOutlined,
107
+ {
108
+ fontSize: "medium",
109
+ sx: { transform: "translateY(5px)", marginTop: "5px" }
110
+ }
111
+ ), " ", t("rosStatus.statusBadge.migration.title")), /* @__PURE__ */ React.createElement(Typography, null, t("rosStatus.statusBadge.migration.description")));
95
112
  }
96
113
  switch (status) {
97
114
  case RiScStatus.Draft:
@@ -135,7 +152,7 @@ const RiScStatusComponent = ({
135
152
  sx: { display: "block", marginLeft: "auto" }
136
153
  },
137
154
  t("rosStatus.approveButton")
138
- ), selectedRiSc.migrationStatus?.migrationChanges && /* @__PURE__ */ React.createElement(
155
+ ), selectedRiSc.migrationStatus?.migrationChanges && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
139
156
  Button,
140
157
  {
141
158
  color: "primary",
@@ -143,21 +160,22 @@ const RiScStatusComponent = ({
143
160
  onClick: () => setMigrationDialogIsOpen(!migrationDialogIsOpen),
144
161
  sx: { display: "block", marginLeft: "auto" }
145
162
  },
146
- /* @__PURE__ */ React.createElement(Typography, { variant: "button" }, t("rosStatus.saveButton"))
163
+ /* @__PURE__ */ React.createElement(Typography, { variant: "button" }, t("rosStatus.moreInformationButton"))
147
164
  ), /* @__PURE__ */ React.createElement(
165
+ RiScMigrationDialog,
166
+ {
167
+ openDialog: migrationDialogIsOpen,
168
+ handleUpdate,
169
+ handleCancel: () => setMigrationDialogIsOpen(false),
170
+ migrationVersions: selectedRiSc.migrationStatus?.migrationVersions
171
+ }
172
+ )), /* @__PURE__ */ React.createElement(
148
173
  RiScPublishDialog,
149
174
  {
150
175
  openDialog: publishRiScDialogIsOpen,
151
176
  handlePublish: handleApproveAndPublish,
152
177
  handleCancel: () => setPublishRiScDialogIsOpen(false)
153
178
  }
154
- ), /* @__PURE__ */ React.createElement(
155
- RiScMigrationDialog,
156
- {
157
- openDialog: migrationDialogIsOpen,
158
- handleUpdate,
159
- handleCancel: () => setMigrationDialogIsOpen(false)
160
- }
161
179
  ));
162
180
  };
163
181
 
@@ -1 +1 @@
1
- {"version":3,"file":"RiScStatusComponent.esm.js","sources":["../../../../src/components/riScInfo/riScStatus/RiScStatusComponent.tsx"],"sourcesContent":["import React, { ReactComponentElement, useState } from 'react';\nimport { RiScStatus, RiScWithMetadata } from '../../../utils/types';\nimport Alert from '@mui/material/Alert';\nimport Button from '@mui/material/Button';\nimport Dialog from '@mui/material/Dialog';\nimport DialogContent from '@mui/material/DialogContent';\nimport DialogTitle from '@mui/material/DialogTitle';\nimport DialogActions from '@mui/material/DialogActions';\nimport Link from '@mui/material/Link';\nimport Typography from '@mui/material/Typography';\nimport Checkbox from '@mui/material/Checkbox';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { pluginRiScTranslationRef } from '../../../utils/translations';\nimport CheckIcon from '@mui/icons-material/Check';\nimport FormControlLabel from '@mui/material/FormControlLabel';\nimport { dialogActions } from '../../common/mixins';\nimport { InfoCard } from '@backstage/core-components';\nimport { PullRequestSvg } from '../../common/Icons';\nimport { useRiScs } from '../../../contexts/RiScContext';\nimport { subtitle1 } from '../../common/typography';\n\ninterface RiScPublishDialogProps {\n openDialog: boolean;\n handleCancel: () => void;\n handlePublish: () => void;\n}\n\nconst RiScPublishDialog = ({\n openDialog,\n handleCancel,\n handlePublish,\n}: RiScPublishDialogProps): ReactComponentElement<any> => {\n const { t } = useTranslationRef(pluginRiScTranslationRef);\n\n const [riskOwnerApproves, setRiskOwnerApproves] = useState<boolean>(false);\n\n const handleCheckboxInput = (event: React.ChangeEvent<HTMLInputElement>) => {\n setRiskOwnerApproves(event.target.checked);\n };\n\n return (\n <Dialog open={openDialog}>\n <DialogTitle>{t('publishDialog.title')}</DialogTitle>\n <DialogContent>\n <Alert severity=\"info\" icon={false}>\n <FormControlLabel\n control={\n <Checkbox\n color=\"primary\"\n checked={riskOwnerApproves}\n onChange={handleCheckboxInput}\n />\n }\n label={t('publishDialog.checkboxLabel')}\n />\n </Alert>\n </DialogContent>\n <DialogActions sx={dialogActions}>\n <Button\n variant=\"contained\"\n color=\"primary\"\n onClick={handlePublish}\n disabled={!riskOwnerApproves}\n >\n {t('dictionary.confirm')}\n </Button>\n <Button variant=\"outlined\" color=\"primary\" onClick={handleCancel}>\n {t('dictionary.cancel')}\n </Button>\n </DialogActions>\n </Dialog>\n );\n};\n\ninterface RiScMigrationDialogProps {\n openDialog: boolean;\n handleCancel: () => void;\n handleUpdate: () => void;\n}\n\nconst RiScMigrationDialog = ({\n openDialog,\n handleCancel,\n handleUpdate,\n}: RiScMigrationDialogProps): ReactComponentElement<any> => {\n const { t } = useTranslationRef(pluginRiScTranslationRef);\n\n const [saveMigration, setSaveMigration] = useState<boolean>(false);\n\n const handleCheckboxInput = (event: React.ChangeEvent<HTMLInputElement>) => {\n setSaveMigration(event.target.checked);\n };\n\n return (\n <Dialog open={openDialog}>\n <DialogTitle>{t('migrationDialog.title')}</DialogTitle>\n <DialogContent>\n <Alert severity=\"info\" icon={false}>\n <FormControlLabel\n control={\n <Checkbox\n checked={saveMigration}\n onChange={handleCheckboxInput}\n />\n }\n label={t('migrationDialog.checkboxLabel')}\n />\n </Alert>\n </DialogContent>\n <DialogActions sx={dialogActions}>\n <Button\n variant=\"contained\"\n onClick={handleUpdate}\n disabled={!saveMigration}\n >\n {t('dictionary.confirm')}\n </Button>\n <Button variant=\"outlined\" color=\"primary\" onClick={handleCancel}>\n {t('dictionary.cancel')}\n </Button>\n </DialogActions>\n </Dialog>\n );\n};\n\nconst RosAcceptance = ({\n status,\n migration,\n}: {\n status: RiScStatus;\n migration?: boolean;\n}): React.JSX.Element => {\n const { t } = useTranslationRef(pluginRiScTranslationRef);\n if (migration) {\n return (\n <Typography paragraph sx={subtitle1}>\n {t('rosStatus.statusBadge.migration')}\n </Typography>\n );\n }\n switch (status) {\n case RiScStatus.Draft:\n return (\n <Typography paragraph sx={subtitle1}>\n {t('rosStatus.statusBadge.missing')}\n </Typography>\n );\n case RiScStatus.SentForApproval:\n case RiScStatus.Published:\n return (\n <Typography paragraph sx={subtitle1}>\n <CheckIcon fontSize=\"medium\" sx={{ transform: 'translateY(5px)' }} />{' '}\n {t('rosStatus.statusBadge.approved')}\n </Typography>\n );\n default:\n return (\n <Typography paragraph sx={subtitle1}>\n {t('rosStatus.statusBadge.error')}\n </Typography>\n );\n }\n};\n\ninterface RiScStatusProps {\n selectedRiSc: RiScWithMetadata;\n publishRiScFn: () => void;\n}\n\nexport const RiScStatusComponent = ({\n selectedRiSc,\n publishRiScFn,\n}: RiScStatusProps) => {\n const { t } = useTranslationRef(pluginRiScTranslationRef);\n\n const [publishRiScDialogIsOpen, setPublishRiScDialogIsOpen] =\n useState<boolean>(false);\n\n const [migrationDialogIsOpen, setMigrationDialogIsOpen] =\n useState<boolean>(false);\n\n const { updateRiSc } = useRiScs();\n\n const handleApproveAndPublish = () => {\n publishRiScFn();\n setPublishRiScDialogIsOpen(false);\n };\n\n const handleUpdate = () => {\n updateRiSc(selectedRiSc.content);\n setMigrationDialogIsOpen(false);\n };\n\n return (\n <InfoCard>\n <Typography variant=\"h5\">Status</Typography>\n\n <RosAcceptance\n status={selectedRiSc.status}\n migration={selectedRiSc.migrationStatus?.migrationChanges}\n />\n {selectedRiSc.status === RiScStatus.SentForApproval &&\n !selectedRiSc.migrationStatus?.migrationChanges && (\n <Typography sx={{ fontWeight: 700 }} paragraph variant=\"subtitle1\">\n <PullRequestSvg />\n {t('rosStatus.prStatus')}\n <Link target=\"_blank\" href={selectedRiSc.pullRequestUrl}>\n Github\n </Link>\n </Typography>\n )}\n {selectedRiSc.status === RiScStatus.Draft &&\n !selectedRiSc.migrationStatus?.migrationChanges && (\n <Button\n color=\"primary\"\n variant=\"contained\"\n onClick={() => setPublishRiScDialogIsOpen(!publishRiScDialogIsOpen)}\n disabled={selectedRiSc.status !== RiScStatus.Draft}\n sx={{ display: 'block', marginLeft: 'auto' }}\n >\n {t('rosStatus.approveButton')}\n </Button>\n )}\n {selectedRiSc.migrationStatus?.migrationChanges && (\n <Button\n color=\"primary\"\n variant=\"contained\"\n onClick={() => setMigrationDialogIsOpen(!migrationDialogIsOpen)}\n sx={{ display: 'block', marginLeft: 'auto' }}\n >\n <Typography variant=\"button\">{t('rosStatus.saveButton')}</Typography>\n </Button>\n )}\n <RiScPublishDialog\n openDialog={publishRiScDialogIsOpen}\n handlePublish={handleApproveAndPublish}\n handleCancel={() => setPublishRiScDialogIsOpen(false)}\n />\n <RiScMigrationDialog\n openDialog={migrationDialogIsOpen}\n handleUpdate={handleUpdate}\n handleCancel={() => setMigrationDialogIsOpen(false)}\n />\n </InfoCard>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AA2BA,MAAM,oBAAoB,CAAC;AAAA,EACzB,UAAA;AAAA,EACA,YAAA;AAAA,EACA,aAAA;AACF,CAA0D,KAAA;AACxD,EAAA,MAAM,EAAE,CAAA,EAAM,GAAA,iBAAA,CAAkB,wBAAwB,CAAA,CAAA;AAExD,EAAA,MAAM,CAAC,iBAAA,EAAmB,oBAAoB,CAAA,GAAI,SAAkB,KAAK,CAAA,CAAA;AAEzE,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
+ {"version":3,"file":"RiScStatusComponent.esm.js","sources":["../../../../src/components/riScInfo/riScStatus/RiScStatusComponent.tsx"],"sourcesContent":["import React, { ReactComponentElement, useState } from 'react';\nimport {\n MigrationVersions,\n RiScStatus,\n RiScWithMetadata,\n} from '../../../utils/types';\nimport Alert from '@mui/material/Alert';\nimport Button from '@mui/material/Button';\nimport Dialog from '@mui/material/Dialog';\nimport DialogContent from '@mui/material/DialogContent';\nimport DialogTitle from '@mui/material/DialogTitle';\nimport DialogActions from '@mui/material/DialogActions';\nimport Link from '@mui/material/Link';\nimport Typography from '@mui/material/Typography';\nimport Checkbox from '@mui/material/Checkbox';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { pluginRiScTranslationRef } from '../../../utils/translations';\nimport CheckIcon from '@mui/icons-material/Check';\nimport FormControlLabel from '@mui/material/FormControlLabel';\nimport { dialogActions } from '../../common/mixins';\nimport { InfoCard } from '@backstage/core-components';\nimport { PullRequestSvg } from '../../common/Icons';\nimport { useRiScs } from '../../../contexts/RiScContext';\nimport { subtitle1 } from '../../common/typography';\nimport { Box } from '@material-ui/core';\nimport { WarningAmberOutlined } from '@mui/icons-material';\n\ninterface RiScPublishDialogProps {\n openDialog: boolean;\n handleCancel: () => void;\n handlePublish: () => void;\n}\n\nconst RiScPublishDialog = ({\n openDialog,\n handleCancel,\n handlePublish,\n}: RiScPublishDialogProps): ReactComponentElement<any> => {\n const { t } = useTranslationRef(pluginRiScTranslationRef);\n\n const [riskOwnerApproves, setRiskOwnerApproves] = useState<boolean>(false);\n\n const handleCheckboxInput = (event: React.ChangeEvent<HTMLInputElement>) => {\n setRiskOwnerApproves(event.target.checked);\n };\n\n return (\n <Dialog open={openDialog}>\n <DialogTitle>{t('publishDialog.title')}</DialogTitle>\n <DialogContent>\n <Alert severity=\"info\" icon={false}>\n <FormControlLabel\n control={\n <Checkbox\n color=\"primary\"\n checked={riskOwnerApproves}\n onChange={handleCheckboxInput}\n />\n }\n label={t('publishDialog.checkboxLabel')}\n />\n </Alert>\n </DialogContent>\n <DialogActions sx={dialogActions}>\n <Button\n variant=\"contained\"\n color=\"primary\"\n onClick={handlePublish}\n disabled={!riskOwnerApproves}\n >\n {t('dictionary.confirm')}\n </Button>\n <Button variant=\"outlined\" color=\"primary\" onClick={handleCancel}>\n {t('dictionary.cancel')}\n </Button>\n </DialogActions>\n </Dialog>\n );\n};\n\ninterface RiScMigrationDialogProps {\n openDialog: boolean;\n handleCancel: () => void;\n handleUpdate: () => void;\n migrationVersions?: MigrationVersions;\n}\n\nconst RiScMigrationDialog = ({\n openDialog,\n handleCancel,\n handleUpdate,\n migrationVersions,\n}: RiScMigrationDialogProps): ReactComponentElement<any> => {\n const { t } = useTranslationRef(pluginRiScTranslationRef);\n\n const [saveMigration, setSaveMigration] = useState<boolean>(false);\n\n const handleCheckboxInput = (event: React.ChangeEvent<HTMLInputElement>) => {\n setSaveMigration(event.target.checked);\n };\n\n return (\n <Dialog open={openDialog}>\n <DialogTitle>{t('migrationDialog.title')}</DialogTitle>\n <DialogContent>\n <Box sx={{ marginBottom: '16px' }}>\n <Typography>\n {t('migrationDialog.description')}\n {migrationVersions?.toVersion} {t('migrationDialog.description2')}{' '}\n {migrationVersions?.fromVersion}\n {t('migrationDialog.description3')}\n <Link\n underline=\"always\"\n target=\"_blank\"\n href=\"https://github.com/kartverket/backstage-plugin-risk-scorecard-backend/blob/main/docs/schemaChangelog.md\"\n >\n {t('migrationDialog.changelog')}\n </Link>{' '}\n {t('migrationDialog.description4')}\n </Typography>\n </Box>\n <Alert severity=\"info\" icon={false}>\n <FormControlLabel\n control={\n <Checkbox\n checked={saveMigration}\n onChange={handleCheckboxInput}\n />\n }\n label={t('migrationDialog.checkboxLabel')}\n />\n </Alert>\n </DialogContent>\n <DialogActions sx={dialogActions}>\n <Button\n variant=\"contained\"\n onClick={handleUpdate}\n disabled={!saveMigration}\n >\n {t('dictionary.confirm')}\n </Button>\n <Button variant=\"outlined\" color=\"primary\" onClick={handleCancel}>\n {t('dictionary.cancel')}\n </Button>\n </DialogActions>\n </Dialog>\n );\n};\n\nconst RosAcceptance = ({\n status,\n migration,\n}: {\n status: RiScStatus;\n migration?: boolean;\n}): React.JSX.Element => {\n const { t } = useTranslationRef(pluginRiScTranslationRef);\n if (migration) {\n return (\n <>\n <Typography paragraph sx={subtitle1}>\n <WarningAmberOutlined\n fontSize=\"medium\"\n sx={{ transform: 'translateY(5px)', marginTop: '5px' }}\n />{' '}\n {t('rosStatus.statusBadge.migration.title')}\n </Typography>\n <Typography>\n {t('rosStatus.statusBadge.migration.description')}\n </Typography>\n </>\n );\n }\n switch (status) {\n case RiScStatus.Draft:\n return (\n <Typography paragraph sx={subtitle1}>\n {t('rosStatus.statusBadge.missing')}\n </Typography>\n );\n case RiScStatus.SentForApproval:\n case RiScStatus.Published:\n return (\n <Typography paragraph sx={subtitle1}>\n <CheckIcon fontSize=\"medium\" sx={{ transform: 'translateY(5px)' }} />{' '}\n {t('rosStatus.statusBadge.approved')}\n </Typography>\n );\n default:\n return (\n <Typography paragraph sx={subtitle1}>\n {t('rosStatus.statusBadge.error')}\n </Typography>\n );\n }\n};\n\ninterface RiScStatusProps {\n selectedRiSc: RiScWithMetadata;\n publishRiScFn: () => void;\n}\n\nexport const RiScStatusComponent = ({\n selectedRiSc,\n publishRiScFn,\n}: RiScStatusProps) => {\n const { t } = useTranslationRef(pluginRiScTranslationRef);\n\n const [publishRiScDialogIsOpen, setPublishRiScDialogIsOpen] =\n useState<boolean>(false);\n\n const [migrationDialogIsOpen, setMigrationDialogIsOpen] =\n useState<boolean>(false);\n\n const { updateRiSc } = useRiScs();\n\n const handleApproveAndPublish = () => {\n publishRiScFn();\n setPublishRiScDialogIsOpen(false);\n };\n\n const handleUpdate = () => {\n updateRiSc(selectedRiSc.content);\n setMigrationDialogIsOpen(false);\n };\n\n return (\n <InfoCard>\n <Typography variant=\"h5\">Status</Typography>\n\n <RosAcceptance\n status={selectedRiSc.status}\n migration={selectedRiSc.migrationStatus?.migrationChanges}\n />\n {selectedRiSc.status === RiScStatus.SentForApproval &&\n !selectedRiSc.migrationStatus?.migrationChanges && (\n <Typography sx={{ fontWeight: 700 }} paragraph variant=\"subtitle1\">\n <PullRequestSvg />\n {t('rosStatus.prStatus')}\n <Link target=\"_blank\" href={selectedRiSc.pullRequestUrl}>\n Github\n </Link>\n </Typography>\n )}\n {selectedRiSc.status === RiScStatus.Draft &&\n !selectedRiSc.migrationStatus?.migrationChanges && (\n <Button\n color=\"primary\"\n variant=\"contained\"\n onClick={() => setPublishRiScDialogIsOpen(!publishRiScDialogIsOpen)}\n disabled={selectedRiSc.status !== RiScStatus.Draft}\n sx={{ display: 'block', marginLeft: 'auto' }}\n >\n {t('rosStatus.approveButton')}\n </Button>\n )}\n {selectedRiSc.migrationStatus?.migrationChanges && (\n <>\n <Button\n color=\"primary\"\n variant=\"contained\"\n onClick={() => setMigrationDialogIsOpen(!migrationDialogIsOpen)}\n sx={{ display: 'block', marginLeft: 'auto' }}\n >\n <Typography variant=\"button\">\n {t('rosStatus.moreInformationButton')}\n </Typography>\n </Button>\n <RiScMigrationDialog\n openDialog={migrationDialogIsOpen}\n handleUpdate={handleUpdate}\n handleCancel={() => setMigrationDialogIsOpen(false)}\n migrationVersions={selectedRiSc.migrationStatus?.migrationVersions}\n />\n </>\n )}\n <RiScPublishDialog\n openDialog={publishRiScDialogIsOpen}\n handlePublish={handleApproveAndPublish}\n handleCancel={() => setPublishRiScDialogIsOpen(false)}\n />\n </InfoCard>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAiCA,MAAM,oBAAoB,CAAC;AAAA,EACzB,UAAA;AAAA,EACA,YAAA;AAAA,EACA,aAAA;AACF,CAA0D,KAAA;AACxD,EAAA,MAAM,EAAE,CAAA,EAAM,GAAA,iBAAA,CAAkB,wBAAwB,CAAA,CAAA;AAExD,EAAA,MAAM,CAAC,iBAAA,EAAmB,oBAAoB,CAAA,GAAI,SAAkB,KAAK,CAA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AA,OAAA,EAAS,YAAY,MAAO,EAAA;AAAA,KAAA;AAAA,IAE1C,EAAE,yBAAyB,CAAA;AAAA,GAGjC,EAAA,YAAA,CAAa,eAAiB,EAAA,gBAAA,oBAE3B,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,MAAA;AAAA,IAAA;AAAA,MACC,KAAM,EAAA,SAAA;AAAA,MACN,OAAQ,EAAA,WAAA;AAAA,MACR,OAAS,EAAA,MAAM,wBAAyB,CAAA,CAAC,qBAAqB,CAAA;AAAA,MAC9D,EAAI,EAAA,EAAE,OAAS,EAAA,OAAA,EAAS,YAAY,MAAO,EAAA;AAAA,KAAA;AAAA,wCAE1C,UAAW,EAAA,EAAA,OAAA,EAAQ,QACjB,EAAA,EAAA,CAAA,CAAE,iCAAiC,CACtC,CAAA;AAAA,GAEF,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,mBAAA;AAAA,IAAA;AAAA,MACC,UAAY,EAAA,qBAAA;AAAA,MACZ,YAAA;AAAA,MACA,YAAA,EAAc,MAAM,wBAAA,CAAyB,KAAK,CAAA;AAAA,MAClD,iBAAA,EAAmB,aAAa,eAAiB,EAAA,iBAAA;AAAA,KAAA;AAAA,GAErD,CAEF,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,iBAAA;AAAA,IAAA;AAAA,MACC,UAAY,EAAA,uBAAA;AAAA,MACZ,aAAe,EAAA,uBAAA;AAAA,MACf,YAAA,EAAc,MAAM,0BAAA,CAA2B,KAAK,CAAA;AAAA,KAAA;AAAA,GAExD,CAAA,CAAA;AAEJ;;;;"}
@@ -4,7 +4,6 @@ import { useSearchParams } from 'react-router-dom';
4
4
  import { ScenarioWizard } from '../scenarioWizard/ScenarioWizard.esm.js';
5
5
  import { ScenarioDrawer } from '../scenarioDrawer/ScenarioDrawer.esm.js';
6
6
  import { RiskMatrix } from '../riskMatrix/RiskMatrix.esm.js';
7
- import { ScenarioTable } from '../scenarioTable/ScenarioTable.esm.js';
8
7
  import Alert from '@mui/material/Alert';
9
8
  import Button from '@mui/material/Button';
10
9
  import Grid from '@mui/material/Grid';
@@ -21,6 +20,7 @@ import { useRiScs } from '../../contexts/RiScContext.esm.js';
21
20
  import MUISelect from '@mui/material/Select';
22
21
  import MenuItem from '@mui/material/MenuItem';
23
22
  import ListItemText from '@mui/material/ListItemText';
23
+ import { ScenarioTableWrapper } from '../scenarioTable/ScenarioTable.esm.js';
24
24
 
25
25
  const RiScPlugin = () => {
26
26
  const { t } = useTranslationRef(pluginRiScTranslationRef);
@@ -95,7 +95,7 @@ const RiScPlugin = () => {
95
95
  }
96
96
  },
97
97
  t("contentHeader.createNewButton")
98
- )), selectedRiSc && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(RiScInfo, { riSc: selectedRiSc, edit: openEditRiScDialog })), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: true, md: 7, lg: 8 }, /* @__PURE__ */ React.createElement(ScenarioTable, { riSc: selectedRiSc.content })), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: true, md: 5, lg: 4 }, /* @__PURE__ */ React.createElement(RiskMatrix, { riSc: selectedRiSc.content }))))), riScDialogState !== RiScDialogStates.Closed && /* @__PURE__ */ React.createElement(RiScDialog, { onClose: closeRiScDialog, dialogState: riScDialogState }), !scenarioWizardStep && /* @__PURE__ */ React.createElement(ScenarioDrawer, null));
98
+ )), selectedRiSc && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(RiScInfo, { riSc: selectedRiSc, edit: openEditRiScDialog })), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: true, md: 7, lg: 8 }, /* @__PURE__ */ React.createElement(ScenarioTableWrapper, { riSc: selectedRiSc })), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: true, md: 5, lg: 4 }, /* @__PURE__ */ React.createElement(RiskMatrix, { riSc: selectedRiSc.content }))))), riScDialogState !== RiScDialogStates.Closed && /* @__PURE__ */ React.createElement(RiScDialog, { onClose: closeRiScDialog, dialogState: riScDialogState }), !scenarioWizardStep && /* @__PURE__ */ React.createElement(ScenarioDrawer, null));
99
99
  };
100
100
 
101
101
  export { RiScPlugin };
@@ -1 +1 @@
1
- {"version":3,"file":"RiScPlugin.esm.js","sources":["../../../src/components/riScPlugin/RiScPlugin.tsx"],"sourcesContent":["import React, { useEffect, useState } from 'react';\nimport { ContentHeader, SupportButton } from '@backstage/core-components';\nimport { useSearchParams } from 'react-router-dom';\nimport { ScenarioWizard } from '../scenarioWizard/ScenarioWizard';\nimport { ScenarioDrawer } from '../scenarioDrawer/ScenarioDrawer';\nimport { RiskMatrix } from '../riskMatrix/RiskMatrix';\nimport { ScenarioTable } from '../scenarioTable/ScenarioTable';\nimport Alert from '@mui/material/Alert';\nimport Button from '@mui/material/Button';\nimport Grid from '@mui/material/Grid';\nimport LinearProgress from '@mui/material/LinearProgress';\nimport Typography from '@mui/material/Typography';\nimport { getAlertSeverity } from '../../utils/utilityfunctions';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { pluginRiScTranslationRef } from '../../utils/translations';\nimport { RiScDialog, RiScDialogStates } from '../riScDialog/RiScDialog';\nimport { RiScInfo } from '../riScInfo/RiScInfo';\nimport AddCircle from '@mui/icons-material/AddCircle';\nimport { Spinner } from '../common/Spinner';\nimport { useRiScs } from '../../contexts/RiScContext';\nimport Select from '@mui/material/Select';\nimport MenuItem from '@mui/material/MenuItem';\nimport ListItemText from '@mui/material/ListItemText';\nimport { ScenarioWizardSteps } from '../../contexts/ScenarioContext';\n\nexport const RiScPlugin = () => {\n const { t } = useTranslationRef(pluginRiScTranslationRef);\n\n const [riScDialogState, setRiScDialogState] = useState<RiScDialogStates>(\n RiScDialogStates.Closed,\n );\n\n const openCreateRiScDialog = () =>\n setRiScDialogState(RiScDialogStates.Create);\n const openEditRiScDialog = () => setRiScDialogState(RiScDialogStates.Edit);\n const closeRiScDialog = () => setRiScDialogState(RiScDialogStates.Closed);\n\n const {\n selectedRiSc,\n riScs,\n selectRiSc,\n isFetching,\n resetRiScStatus,\n response,\n riScUpdateStatus,\n } = useRiScs();\n\n const [searchParams] = useSearchParams();\n const scenarioWizardStep = searchParams.get(\n 'step',\n ) as ScenarioWizardSteps | null;\n\n useEffect(() => {\n if (scenarioWizardStep !== null) resetRiScStatus();\n }, [resetRiScStatus, scenarioWizardStep]);\n\n return (\n <>\n {response && (\n <Alert\n severity={getAlertSeverity(response.status)}\n sx={{ marginBottom: 2 }}\n >\n <Typography>{response.statusMessage}</Typography>\n </Alert>\n )}\n {riScUpdateStatus.isLoading && (\n <LinearProgress\n sx={{\n position: 'sticky',\n top: 0,\n margin: 2,\n }}\n />\n )}\n\n {scenarioWizardStep !== null ? (\n <ScenarioWizard step={scenarioWizardStep} />\n ) : (\n <>\n <ContentHeader title={t('contentHeader.title')}>\n <SupportButton />\n </ContentHeader>\n\n {isFetching && <Spinner size={80} />}\n\n <Grid container spacing={4}>\n {riScs !== null && riScs.length !== 0 && (\n <Grid\n item\n xs={12}\n sm={6}\n sx={{\n maxWidth: '600px',\n minWidth: '300px',\n }}\n >\n <Select\n variant=\"standard\"\n value={selectedRiSc?.content.title ?? ''}\n onChange={e => selectRiSc(e.target.value)}\n sx={{ width: '100%' }}\n >\n {riScs.map(riSc => (\n <MenuItem key={riSc.id} value={riSc.content.title}>\n <ListItemText primary={riSc.content.title} />\n </MenuItem>\n )) ?? []}\n </Select>\n </Grid>\n )}\n\n {!isFetching && (\n <Grid item xs>\n <Button\n startIcon={<AddCircle />}\n variant=\"text\"\n color=\"primary\"\n onClick={openCreateRiScDialog}\n sx={{\n minWidth: '205px',\n }}\n >\n {t('contentHeader.createNewButton')}\n </Button>\n </Grid>\n )}\n\n {selectedRiSc && (\n <>\n <Grid item xs={12}>\n <RiScInfo riSc={selectedRiSc} edit={openEditRiScDialog} />\n </Grid>\n <Grid item xs md={7} lg={8}>\n <ScenarioTable riSc={selectedRiSc.content} />\n </Grid>\n <Grid item xs md={5} lg={4}>\n <RiskMatrix riSc={selectedRiSc.content} />\n </Grid>\n </>\n )}\n </Grid>\n </>\n )}\n\n {riScDialogState !== RiScDialogStates.Closed && (\n <RiScDialog onClose={closeRiScDialog} dialogState={riScDialogState} />\n )}\n\n {!scenarioWizardStep && <ScenarioDrawer />}\n </>\n );\n};\n"],"names":["Select"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAyBO,MAAM,aAAa,MAAM;AAC9B,EAAA,MAAM,EAAE,CAAA,EAAM,GAAA,iBAAA,CAAkB,wBAAwB,CAAA,CAAA;AAExD,EAAM,MAAA,CAAC,eAAiB,EAAA,kBAAkB,CAAI,GAAA,QAAA;AAAA,IAC5C,gBAAiB,CAAA,MAAA;AAAA,GACnB,CAAA;AAEA,EAAA,MAAM,oBAAuB,GAAA,MAC3B,kBAAmB,CAAA,gBAAA,CAAiB,MAAM,CAAA,CAAA;AAC5C,EAAA,MAAM,kBAAqB,GAAA,MAAM,kBAAmB,CAAA,gBAAA,CAAiB,IAAI,CAAA,CAAA;AACzE,EAAA,MAAM,eAAkB,GAAA,MAAM,kBAAmB,CAAA,gBAAA,CAAiB,MAAM,CAAA,CAAA;AAExE,EAAM,MAAA;AAAA,IACJ,YAAA;AAAA,IACA,KAAA;AAAA,IACA,UAAA;AAAA,IACA,UAAA;AAAA,IACA,eAAA;AAAA,IACA,QAAA;AAAA,IACA,gBAAA;AAAA,MACE,QAAS,EAAA,CAAA;AAEb,EAAM,MAAA,CAAC,YAAY,CAAA,GAAI,eAAgB,EAAA,CAAA;AACvC,EAAA,MAAM,qBAAqB,YAAa,CAAA,GAAA;AAAA,IACtC,MAAA;AAAA,GACF,CAAA;AAEA,EAAA,SAAA,CAAU,MAAM;AACd,IAAI,IAAA,kBAAA,KAAuB,MAAsB,eAAA,EAAA,C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AA,EAAI,IAAC,EAAA,EAAA,EAAI,EACb,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,QAAS,EAAA,EAAA,IAAA,EAAM,cAAc,IAAM,EAAA,kBAAA,EAAoB,CAC1D,CAAA,kBACC,KAAA,CAAA,aAAA,CAAA,IAAA,EAAA,EAAK,IAAI,EAAA,IAAA,EAAC,IAAE,IAAC,EAAA,EAAA,EAAI,CAAG,EAAA,EAAA,EAAI,CACvB,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,aAAc,EAAA,EAAA,IAAA,EAAM,aAAa,OAAS,EAAA,CAC7C,CACA,kBAAA,KAAA,CAAA,aAAA,CAAC,IAAK,EAAA,EAAA,IAAA,EAAI,IAAC,EAAA,EAAA,EAAE,MAAC,EAAI,EAAA,CAAA,EAAG,EAAI,EAAA,CAAA,EAAA,kBACtB,KAAA,CAAA,aAAA,CAAA,UAAA,EAAA,EAAW,IAAM,EAAA,YAAA,CAAa,SAAS,CAC1C,CACF,CAEJ,CACF,CAGD,EAAA,eAAA,KAAoB,gBAAiB,CAAA,MAAA,wCACnC,UAAW,EAAA,EAAA,OAAA,EAAS,eAAiB,EAAA,WAAA,EAAa,iBAAiB,CAGrE,EAAA,CAAC,kBAAsB,oBAAA,KAAA,CAAA,aAAA,CAAC,oBAAe,CAC1C,CAAA,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"RiScPlugin.esm.js","sources":["../../../src/components/riScPlugin/RiScPlugin.tsx"],"sourcesContent":["import React, { useEffect, useState } from 'react';\nimport { ContentHeader, SupportButton } from '@backstage/core-components';\nimport { useSearchParams } from 'react-router-dom';\nimport { ScenarioWizard } from '../scenarioWizard/ScenarioWizard';\nimport { ScenarioDrawer } from '../scenarioDrawer/ScenarioDrawer';\nimport { RiskMatrix } from '../riskMatrix/RiskMatrix';\nimport Alert from '@mui/material/Alert';\nimport Button from '@mui/material/Button';\nimport Grid from '@mui/material/Grid';\nimport LinearProgress from '@mui/material/LinearProgress';\nimport Typography from '@mui/material/Typography';\nimport { getAlertSeverity } from '../../utils/utilityfunctions';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { pluginRiScTranslationRef } from '../../utils/translations';\nimport { RiScDialog, RiScDialogStates } from '../riScDialog/RiScDialog';\nimport { RiScInfo } from '../riScInfo/RiScInfo';\nimport AddCircle from '@mui/icons-material/AddCircle';\nimport { Spinner } from '../common/Spinner';\nimport { useRiScs } from '../../contexts/RiScContext';\nimport Select from '@mui/material/Select';\nimport MenuItem from '@mui/material/MenuItem';\nimport ListItemText from '@mui/material/ListItemText';\nimport { ScenarioWizardSteps } from '../../contexts/ScenarioContext';\nimport { ScenarioTableWrapper } from '../scenarioTable/ScenarioTable';\n\nexport const RiScPlugin = () => {\n const { t } = useTranslationRef(pluginRiScTranslationRef);\n\n const [riScDialogState, setRiScDialogState] = useState<RiScDialogStates>(\n RiScDialogStates.Closed,\n );\n\n const openCreateRiScDialog = () =>\n setRiScDialogState(RiScDialogStates.Create);\n const openEditRiScDialog = () => setRiScDialogState(RiScDialogStates.Edit);\n const closeRiScDialog = () => setRiScDialogState(RiScDialogStates.Closed);\n\n const {\n selectedRiSc,\n riScs,\n selectRiSc,\n isFetching,\n resetRiScStatus,\n response,\n riScUpdateStatus,\n } = useRiScs();\n\n const [searchParams] = useSearchParams();\n const scenarioWizardStep = searchParams.get(\n 'step',\n ) as ScenarioWizardSteps | null;\n\n useEffect(() => {\n if (scenarioWizardStep !== null) resetRiScStatus();\n }, [resetRiScStatus, scenarioWizardStep]);\n\n return (\n <>\n {response && (\n <Alert\n severity={getAlertSeverity(response.status)}\n sx={{ marginBottom: 2 }}\n >\n <Typography>{response.statusMessage}</Typography>\n </Alert>\n )}\n {riScUpdateStatus.isLoading && (\n <LinearProgress\n sx={{\n position: 'sticky',\n top: 0,\n margin: 2,\n }}\n />\n )}\n\n {scenarioWizardStep !== null ? (\n <ScenarioWizard step={scenarioWizardStep} />\n ) : (\n <>\n <ContentHeader title={t('contentHeader.title')}>\n <SupportButton />\n </ContentHeader>\n\n {isFetching && <Spinner size={80} />}\n\n <Grid container spacing={4}>\n {riScs !== null && riScs.length !== 0 && (\n <Grid\n item\n xs={12}\n sm={6}\n sx={{\n maxWidth: '600px',\n minWidth: '300px',\n }}\n >\n <Select\n variant=\"standard\"\n value={selectedRiSc?.content.title ?? ''}\n onChange={e => selectRiSc(e.target.value)}\n sx={{ width: '100%' }}\n >\n {riScs.map(riSc => (\n <MenuItem key={riSc.id} value={riSc.content.title}>\n <ListItemText primary={riSc.content.title} />\n </MenuItem>\n )) ?? []}\n </Select>\n </Grid>\n )}\n\n {!isFetching && (\n <Grid item xs>\n <Button\n startIcon={<AddCircle />}\n variant=\"text\"\n color=\"primary\"\n onClick={openCreateRiScDialog}\n sx={{\n minWidth: '205px',\n }}\n >\n {t('contentHeader.createNewButton')}\n </Button>\n </Grid>\n )}\n\n {selectedRiSc && (\n <>\n <Grid item xs={12}>\n <RiScInfo riSc={selectedRiSc} edit={openEditRiScDialog} />\n </Grid>\n <Grid item xs md={7} lg={8}>\n <ScenarioTableWrapper riSc={selectedRiSc} />\n </Grid>\n <Grid item xs md={5} lg={4}>\n <RiskMatrix riSc={selectedRiSc.content} />\n </Grid>\n </>\n )}\n </Grid>\n </>\n )}\n\n {riScDialogState !== RiScDialogStates.Closed && (\n <RiScDialog onClose={closeRiScDialog} dialogState={riScDialogState} />\n )}\n\n {!scenarioWizardStep && <ScenarioDrawer />}\n </>\n );\n};\n"],"names":["Select"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAyBO,MAAM,aAAa,MAAM;AAC9B,EAAA,MAAM,EAAE,CAAA,EAAM,GAAA,iBAAA,CAAkB,wBAAwB,CAAA,CAAA;AAExD,EAAM,MAAA,CAAC,eAAiB,EAAA,kBAAkB,CAAI,GAAA,QAAA;AAAA,IAC5C,gBAAiB,CAAA,MAAA;AAAA,GACnB,CAAA;AAEA,EAAA,MAAM,oBAAuB,GAAA,MAC3B,kBAAmB,CAAA,gB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AAA,gBAAA,CAAiB,MACpC,oBAAA,KAAA,CAAA,aAAA,CAAC,cAAW,OAAS,EAAA,eAAA,EAAiB,WAAa,EAAA,eAAA,EAAiB,CAGrE,EAAA,CAAC,kBAAsB,oBAAA,KAAA,CAAA,aAAA,CAAC,oBAAe,CAC1C,CAAA,CAAA;AAEJ;;;;"}
@@ -11,7 +11,6 @@ import { ScopeSection } from './components/ScopeSection.esm.js';
11
11
  import { useForm } from 'react-hook-form';
12
12
  import { ProcessingStatus } from '../../utils/types.esm.js';
13
13
  import ScenarioForm from './components/RiskFormSection.esm.js';
14
- import ActionFormSection from './components/ActionFormSection.esm.js';
15
14
  import ScopeFormSection from './components/ScopeFormSection.esm.js';
16
15
  import Drawer from '@mui/material/Drawer';
17
16
  import Button from '@mui/material/Button';
@@ -20,6 +19,7 @@ import CircularProgress from '@mui/material/CircularProgress';
20
19
  import Alert from '@mui/material/Alert';
21
20
  import { getAlertSeverity } from '../../utils/utilityfunctions.esm.js';
22
21
  import Typography from '@mui/material/Typography';
22
+ import { MatrixDialog } from '../riScDialog/MatrixDialog.esm.js';
23
23
 
24
24
  const ScenarioDrawer = () => {
25
25
  const { t } = useTranslationRef(pluginRiScTranslationRef);
@@ -28,16 +28,19 @@ const ScenarioDrawer = () => {
28
28
  scenario,
29
29
  isDrawerOpen,
30
30
  closeScenarioForm,
31
- submitEditedScenarioToRiSc
31
+ submitEditedScenarioToRiSc,
32
+ mapScenarioToFormScenario,
33
+ mapFormScenarioToScenario
32
34
  } = useScenario();
33
35
  const [deleteConfirmationIsOpen, setDeleteConfirmationIsOpen] = useState(false);
36
+ const [isMatrixDialogOpen, setIsMatrixDialogOpen] = useState(false);
34
37
  const { riScUpdateStatus, response } = useRiScs();
35
38
  const formMethods = useForm({
36
- defaultValues: scenario,
39
+ defaultValues: mapScenarioToFormScenario(scenario),
37
40
  mode: "onBlur"
38
41
  });
39
42
  const onCancel = () => {
40
- formMethods.reset(scenario);
43
+ formMethods.reset(mapScenarioToFormScenario(scenario));
41
44
  setIsEditing(false);
42
45
  };
43
46
  const onClose = () => {
@@ -45,11 +48,14 @@ const ScenarioDrawer = () => {
45
48
  setIsEditing(false);
46
49
  };
47
50
  const onSubmit = formMethods.handleSubmit((data) => {
48
- submitEditedScenarioToRiSc(data, () => setIsEditing(false));
51
+ submitEditedScenarioToRiSc(
52
+ mapFormScenarioToScenario(data),
53
+ () => setIsEditing(false)
54
+ );
49
55
  });
50
56
  useEffect(() => {
51
- formMethods.reset(scenario);
52
- }, [scenario, formMethods]);
57
+ formMethods.reset(mapScenarioToFormScenario(scenario));
58
+ }, [scenario, formMethods, mapScenarioToFormScenario]);
53
59
  return /* @__PURE__ */ React.createElement(
54
60
  Drawer,
55
61
  {
@@ -98,7 +104,14 @@ const ScenarioDrawer = () => {
98
104
  t(isEditing ? "dictionary.cancel" : "dictionary.close")
99
105
  )
100
106
  ),
101
- isEditing ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(ScopeFormSection, { formMethods }), /* @__PURE__ */ React.createElement(ScenarioForm, { formMethods }), /* @__PURE__ */ React.createElement(ActionFormSection, { formMethods })) : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(ScopeSection, null), /* @__PURE__ */ React.createElement(RiskSection, null), /* @__PURE__ */ React.createElement(ActionsSection, null)),
107
+ isEditing ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(ScopeFormSection, { formMethods }), /* @__PURE__ */ React.createElement(
108
+ ScenarioForm,
109
+ {
110
+ formMethods,
111
+ setIsMatrixDialogOpen
112
+ }
113
+ )) : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(ScopeSection, null), /* @__PURE__ */ React.createElement(RiskSection, null)),
114
+ /* @__PURE__ */ React.createElement(ActionsSection, { formMethods, isEditing }),
102
115
  /* @__PURE__ */ React.createElement(
103
116
  Box,
104
117
  {
@@ -143,6 +156,13 @@ const ScenarioDrawer = () => {
143
156
  deleteConfirmationIsOpen,
144
157
  setDeleteConfirmationIsOpen
145
158
  }
159
+ ),
160
+ /* @__PURE__ */ React.createElement(
161
+ MatrixDialog,
162
+ {
163
+ open: isMatrixDialogOpen,
164
+ close: () => setIsMatrixDialogOpen(false)
165
+ }
146
166
  )
147
167
  );
148
168
  };
@@ -1 +1 @@
1
- {"version":3,"file":"ScenarioDrawer.esm.js","sources":["../../../src/components/scenarioDrawer/ScenarioDrawer.tsx"],"sourcesContent":["import React, { useEffect, useState } from 'react';\nimport Box from '@mui/material/Box';\nimport { useScenario } from '../../contexts/ScenarioContext';\nimport { RiskSection } from './components/RiskSection';\nimport { ActionsSection } from './components/ActionsSection';\nimport DeleteIcon from '@mui/icons-material/Delete';\nimport { DeleteConfirmation } from './components/DeleteConfirmation';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { pluginRiScTranslationRef } from '../../utils/translations';\nimport { ScopeSection } from './components/ScopeSection';\nimport { useForm } from 'react-hook-form';\nimport { ProcessingStatus, Scenario } from '../../utils/types';\nimport RiskFormSection from './components/RiskFormSection';\nimport ActionFormSection from './components/ActionFormSection';\nimport ScopeFormSection from './components/ScopeFormSection';\nimport Drawer from '@mui/material/Drawer';\nimport Button from '@mui/material/Button';\nimport { useRiScs } from '../../contexts/RiScContext';\nimport CircularProgress from '@mui/material/CircularProgress';\nimport Alert from '@mui/material/Alert';\nimport { getAlertSeverity } from '../../utils/utilityfunctions';\nimport Typography from '@mui/material/Typography';\n\nexport const ScenarioDrawer = () => {\n const { t } = useTranslationRef(pluginRiScTranslationRef);\n const [isEditing, setIsEditing] = useState(false);\n const {\n scenario,\n isDrawerOpen,\n closeScenarioForm,\n submitEditedScenarioToRiSc,\n } = useScenario();\n\n const [deleteConfirmationIsOpen, setDeleteConfirmationIsOpen] =\n useState(false);\n\n const { riScUpdateStatus, response } = useRiScs();\n\n const formMethods = useForm<Scenario>({\n defaultValues: scenario,\n mode: 'onBlur',\n });\n\n const onCancel = () => {\n formMethods.reset(scenario);\n setIsEditing(false);\n };\n\n const onClose = () => {\n closeScenarioForm();\n setIsEditing(false);\n };\n\n const onSubmit = formMethods.handleSubmit((data: Scenario) => {\n submitEditedScenarioToRiSc(data, () => setIsEditing(false));\n });\n\n useEffect(() => {\n formMethods.reset(scenario);\n }, [scenario, formMethods]);\n\n return (\n <Drawer\n PaperProps={{\n sx: theme => ({\n padding: theme.spacing(4),\n width: '50%',\n gap: theme.spacing(3),\n [theme.breakpoints.down('sm')]: {\n width: '90%',\n padding: theme.spacing(2),\n },\n backgroundColor:\n theme.palette.mode === 'dark' ? '#333333' : '#f8f8f8',\n }),\n }}\n variant=\"temporary\"\n anchor=\"right\"\n open={isDrawerOpen}\n onClose={onClose}\n >\n <Box\n sx={{\n display: 'flex',\n gap: '16px',\n marginLeft: 'auto',\n }}\n >\n {!isEditing && (\n <Button\n color=\"primary\"\n variant=\"contained\"\n onClick={() => setIsEditing(true)}\n >\n {t('dictionary.edit')}\n </Button>\n )}\n <Button\n variant=\"outlined\"\n color=\"primary\"\n onClick={isEditing ? onCancel : onClose}\n >\n {t(isEditing ? 'dictionary.cancel' : 'dictionary.close')}\n </Button>\n </Box>\n\n {isEditing ? (\n <>\n <ScopeFormSection formMethods={formMethods} />\n <RiskFormSection formMethods={formMethods} />\n <ActionFormSection formMethods={formMethods} />\n </>\n ) : (\n <>\n <ScopeSection />\n <RiskSection />\n <ActionsSection />\n </>\n )}\n <Box\n sx={{\n display: 'flex',\n gap: '16px',\n }}\n >\n {isEditing && (\n <Button\n color=\"primary\"\n variant=\"contained\"\n onClick={onSubmit}\n disabled={\n !formMethods.formState.isDirty || riScUpdateStatus.isLoading\n }\n >\n {t('dictionary.save')}\n {riScUpdateStatus.isLoading && (\n <CircularProgress\n size={16}\n sx={{ marginLeft: 1, color: 'inherit' }}\n />\n )}\n </Button>\n )}\n <Button\n startIcon={<DeleteIcon />}\n variant=\"text\"\n color=\"primary\"\n onClick={() => setDeleteConfirmationIsOpen(true)}\n sx={{ marginLeft: 'auto' }}\n >\n {t('scenarioDrawer.deleteScenarioButton')}\n </Button>\n </Box>\n\n {response &&\n response.status !== ProcessingStatus.ErrorWhenFetchingRiScs && (\n <Alert severity={getAlertSeverity(response.status)}>\n <Typography>{response.statusMessage}</Typography>\n </Alert>\n )}\n\n <DeleteConfirmation\n deleteConfirmationIsOpen={deleteConfirmationIsOpen}\n setDeleteConfirmationIsOpen={setDeleteConfirmationIsOpen}\n />\n </Drawer>\n );\n};\n"],"names":["RiskFormSection"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAuBO,MAAM,iBAAiB,MAAM;AAClC,EAAA,MAAM,EAAE,CAAA,EAAM,GAAA,iBAAA,CAAkB,wBAAwB,CAAA,CAAA;AACxD,EAAA,MAAM,CAAC,SAAA,EAAW,YAAY,CAAA,GAAI,SAAS,KAAK,CAAA,CAAA;AAChD,EAAM,MAAA;AAAA,IACJ,QAAA;AAAA,IACA,YAAA;AAAA,IACA,iBAAA;AAAA,IACA,0BAAA;AAAA,MACE,WAAY,EAAA,CAAA;AAEhB,EAAA,MAAM,CAAC,wBAAA,EAA0B,2BAA2B,CAAA,GAC1D,SAAS,KAAK,CAAA,CAAA;AAEhB,EAAA,MAAM,EAAE,gBAAA,EAAkB,QAAS,EAAA,GAAI,QAAS,EAAA,CAAA;AAEhD,EAAA,MAAM,cAAc,OAAkB,CAAA;AAAA,IACpC,aAAe,EAAA,QAAA;AAAA,IACf,IAAM,EAAA,QAAA;AAAA,GACP,CAAA,CAAA;AAED,EAAA,MAAM,WAAW,MAAM;AACrB,IAAA,WAAA,CAAY,MAAM,QAAQ,CAAA,CAAA;AAC1B,IAAA,YAAA,CAAa,KAAK,CAAA,CAAA;AAAA,GACpB,CAAA;AAEA,EAAA,MAAM,UAAU,MAAM;AACpB,IAAkB,iBAAA,EAAA,CAAA;AAClB,IAAA,YAAA,CAAa,KAAK,CAAA,CAAA;AAAA,GACpB,CAAA;AAEA,EAAA,MAAM,QAAW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AQ,EAAA,WAAA;AAAA,UACR,OAAS,EAAA,QAAA;AAAA,UACT,QACE,EAAA,CAAC,WAAY,CAAA,SAAA,CAAU,WAAW,gBAAiB,CAAA,SAAA;AAAA,SAAA;AAAA,QAGpD,EAAE,iBAAiB,CAAA;AAAA,QACnB,iBAAiB,SAChB,oBAAA,KAAA,CAAA,aAAA;AAAA,UAAC,gBAAA;AAAA,UAAA;AAAA,YACC,IAAM,EAAA,EAAA;AAAA,YACN,EAAI,EAAA,EAAE,UAAY,EAAA,CAAA,EAAG,OAAO,SAAU,EAAA;AAAA,WAAA;AAAA,SACxC;AAAA,OAEJ;AAAA,sBAEF,KAAA,CAAA,aAAA;AAAA,QAAC,MAAA;AAAA,QAAA;AAAA,UACC,SAAA,sCAAY,UAAW,EAAA,IAAA,CAAA;AAAA,UACvB,OAAQ,EAAA,MAAA;AAAA,UACR,KAAM,EAAA,SAAA;AAAA,UACN,OAAA,EAAS,MAAM,2BAAA,CAA4B,IAAI,CAAA;AAAA,UAC/C,EAAA,EAAI,EAAE,UAAA,EAAY,MAAO,EAAA;AAAA,SAAA;AAAA,QAExB,EAAE,qCAAqC,CAAA;AAAA,OAC1C;AAAA,KACF;AAAA,IAEC,YACC,QAAS,CAAA,MAAA,KAAW,gBAAiB,CAAA,sBAAA,wCAClC,KAAM,EAAA,EAAA,QAAA,EAAU,gBAAiB,CAAA,QAAA,CAAS,MAAM,CAC/C,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,UAAY,EAAA,IAAA,EAAA,QAAA,CAAS,aAAc,CACtC,CAAA;AAAA,oBAGJ,KAAA,CAAA,aAAA;AAAA,MAAC,kBAAA;AAAA,MAAA;AAAA,QACC,wBAAA;AAAA,QACA,2BAAA;AAAA,OAAA;AAAA,KACF;AAAA,GACF,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"ScenarioDrawer.esm.js","sources":["../../../src/components/scenarioDrawer/ScenarioDrawer.tsx"],"sourcesContent":["import React, { useEffect, useState } from 'react';\nimport Box from '@mui/material/Box';\nimport { useScenario } from '../../contexts/ScenarioContext';\nimport { RiskSection } from './components/RiskSection';\nimport { ActionsSection } from './components/ActionsSection';\nimport DeleteIcon from '@mui/icons-material/Delete';\nimport { DeleteConfirmation } from './components/DeleteConfirmation';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { pluginRiScTranslationRef } from '../../utils/translations';\nimport { ScopeSection } from './components/ScopeSection';\nimport { useForm } from 'react-hook-form';\nimport { FormScenario, ProcessingStatus } from '../../utils/types';\nimport RiskFormSection from './components/RiskFormSection';\nimport ScopeFormSection from './components/ScopeFormSection';\nimport Drawer from '@mui/material/Drawer';\nimport Button from '@mui/material/Button';\nimport { useRiScs } from '../../contexts/RiScContext';\nimport CircularProgress from '@mui/material/CircularProgress';\nimport Alert from '@mui/material/Alert';\nimport { getAlertSeverity } from '../../utils/utilityfunctions';\nimport Typography from '@mui/material/Typography';\nimport { MatrixDialog } from '../riScDialog/MatrixDialog';\n\nexport const ScenarioDrawer = () => {\n const { t } = useTranslationRef(pluginRiScTranslationRef);\n const [isEditing, setIsEditing] = useState(false);\n const {\n scenario,\n isDrawerOpen,\n closeScenarioForm,\n submitEditedScenarioToRiSc,\n mapScenarioToFormScenario,\n mapFormScenarioToScenario,\n } = useScenario();\n\n const [deleteConfirmationIsOpen, setDeleteConfirmationIsOpen] =\n useState(false);\n\n const [isMatrixDialogOpen, setIsMatrixDialogOpen] = useState<boolean>(false);\n\n const { riScUpdateStatus, response } = useRiScs();\n\n const formMethods = useForm<FormScenario>({\n defaultValues: mapScenarioToFormScenario(scenario),\n mode: 'onBlur',\n });\n\n const onCancel = () => {\n formMethods.reset(mapScenarioToFormScenario(scenario));\n setIsEditing(false);\n };\n\n const onClose = () => {\n closeScenarioForm();\n setIsEditing(false);\n };\n\n const onSubmit = formMethods.handleSubmit((data: FormScenario) => {\n submitEditedScenarioToRiSc(mapFormScenarioToScenario(data), () =>\n setIsEditing(false),\n );\n });\n\n useEffect(() => {\n formMethods.reset(mapScenarioToFormScenario(scenario));\n }, [scenario, formMethods, mapScenarioToFormScenario]);\n\n return (\n <Drawer\n PaperProps={{\n sx: theme => ({\n padding: theme.spacing(4),\n width: '50%',\n gap: theme.spacing(3),\n [theme.breakpoints.down('sm')]: {\n width: '90%',\n padding: theme.spacing(2),\n },\n backgroundColor:\n theme.palette.mode === 'dark' ? '#333333' : '#f8f8f8',\n }),\n }}\n variant=\"temporary\"\n anchor=\"right\"\n open={isDrawerOpen}\n onClose={onClose}\n >\n <Box\n sx={{\n display: 'flex',\n gap: '16px',\n marginLeft: 'auto',\n }}\n >\n {!isEditing && (\n <Button\n color=\"primary\"\n variant=\"contained\"\n onClick={() => setIsEditing(true)}\n >\n {t('dictionary.edit')}\n </Button>\n )}\n <Button\n variant=\"outlined\"\n color=\"primary\"\n onClick={isEditing ? onCancel : onClose}\n >\n {t(isEditing ? 'dictionary.cancel' : 'dictionary.close')}\n </Button>\n </Box>\n\n {isEditing ? (\n <>\n <ScopeFormSection formMethods={formMethods} />\n <RiskFormSection\n formMethods={formMethods}\n setIsMatrixDialogOpen={setIsMatrixDialogOpen}\n />\n </>\n ) : (\n <>\n <ScopeSection />\n <RiskSection />\n </>\n )}\n <ActionsSection formMethods={formMethods} isEditing={isEditing} />\n <Box\n sx={{\n display: 'flex',\n gap: '16px',\n }}\n >\n {isEditing && (\n <Button\n color=\"primary\"\n variant=\"contained\"\n onClick={onSubmit}\n disabled={\n !formMethods.formState.isDirty || riScUpdateStatus.isLoading\n }\n >\n {t('dictionary.save')}\n {riScUpdateStatus.isLoading && (\n <CircularProgress\n size={16}\n sx={{ marginLeft: 1, color: 'inherit' }}\n />\n )}\n </Button>\n )}\n <Button\n startIcon={<DeleteIcon />}\n variant=\"text\"\n color=\"primary\"\n onClick={() => setDeleteConfirmationIsOpen(true)}\n sx={{ marginLeft: 'auto' }}\n >\n {t('scenarioDrawer.deleteScenarioButton')}\n </Button>\n </Box>\n\n {response &&\n response.status !== ProcessingStatus.ErrorWhenFetchingRiScs && (\n <Alert severity={getAlertSeverity(response.status)}>\n <Typography>{response.statusMessage}</Typography>\n </Alert>\n )}\n\n <DeleteConfirmation\n deleteConfirmationIsOpen={deleteConfirmationIsOpen}\n setDeleteConfirmationIsOpen={setDeleteConfirmationIsOpen}\n />\n <MatrixDialog\n open={isMatrixDialogOpen}\n close={() => setIsMatrixDialogOpen(false)}\n />\n </Drawer>\n );\n};\n"],"names":["RiskFormSection"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAuBO,MAAM,iBAAiB,MAAM;AAClC,EAAA,MAAM,EAAE,CAAA,EAAM,GAAA,iBAAA,CAAkB,wBAAwB,CAAA,CAAA;AACxD,EAAA,MAAM,CAAC,SAAA,EAAW,YAAY,CAAA,GAAI,SAAS,KAAK,CAAA,CAAA;AAChD,EAAM,MAAA;AAAA,IACJ,QAAA;AAAA,IACA,YAAA;AAAA,IACA,iBAAA;AAAA,IACA,0BAAA;AAAA,IACA,yBAAA;AAAA,IACA,yBAAA;AAAA,MACE,WAAY,EAAA,CAAA;AAEhB,EAAA,MAAM,CAAC,wBAAA,EAA0B,2BAA2B,CAAA,GAC1D,SAAS,KAAK,CAAA,CAAA;AAEhB,EAAA,MAAM,CAAC,kBAAA,EAAoB,qBAAqB,CAAA,GAAI,SAAkB,KAAK,CAAA,CAAA;AAE3E,EAAA,MAAM,EAAE,gBAAA,EAAkB,QAAS,EAAA,GAAI,QAAS,EAAA,CAAA;AAEhD,EAAA,MAAM,cAAc,OAAsB,CAAA;AAAA,IACxC,aAAA,EAAe,0BAA0B,QAAQ,CAAA;AAAA,IACjD,IAAM,EAAA,QAAA;AAAA,GACP,CAAA,CAAA;AAED,EAAA,MAAM,WAAW,MAAM;AACrB,IAAY,WAAA,CAAA,KAAA,CAAM,yBAA0B,CAAA,QAAQ,CAAC,CAAA,CAAA;AACrD,IAAA,YAAA,CAAa,KAAK,CAAA,CAAA;AAAA,GACpB,CAAA;AAEA,EAAA,MAAM,UAAU,M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BAAA;AAAA,QACA,2BAAA;AAAA,OAAA;AAAA,KACF;AAAA,oBACA,KAAA,CAAA,aAAA;AAAA,MAAC,YAAA;AAAA,MAAA;AAAA,QACC,IAAM,EAAA,kBAAA;AAAA,QACN,KAAA,EAAO,MAAM,qBAAA,CAAsB,KAAK,CAAA;AAAA,OAAA;AAAA,KAC1C;AAAA,GACF,CAAA;AAEJ;;;;"}
@@ -6,32 +6,115 @@ import Box from '@mui/material/Box';
6
6
  import Link from '@mui/material/Link';
7
7
  import Typography from '@mui/material/Typography';
8
8
  import { label, body2, emptyState } from '../../common/typography.esm.js';
9
- import Button from '@mui/material/Button';
10
9
  import Collapse from '@mui/material/Collapse';
11
- import { ExpandLess, ExpandMore } from '@mui/icons-material';
10
+ import { ExpandLess, ExpandMore, Edit } from '@mui/icons-material';
11
+ import IconButton from '@mui/material/IconButton';
12
+ import { ActionFormItem } from './ActionFormItem.esm.js';
13
+ import Button from '@mui/material/Button';
14
+ import ButtonGroup from '@mui/material/ButtonGroup';
15
+ import { useScenario } from '../../../contexts/ScenarioContext.esm.js';
16
+ import { useRiScs } from '../../../contexts/RiScContext.esm.js';
17
+ import CircularProgress from '@mui/material/CircularProgress';
12
18
 
13
- const ActionBox = ({ action, index }) => {
19
+ const ActionBox = ({
20
+ action,
21
+ index,
22
+ formMethods,
23
+ remove
24
+ }) => {
14
25
  const { t } = useTranslationRef(pluginRiScTranslationRef);
15
26
  const [isExpanded, setIsExpanded] = useState(false);
27
+ const [isEditing, setIsEditing] = useState(false);
28
+ const { riScUpdateStatus } = useRiScs();
29
+ const { submitEditedScenarioToRiSc, mapFormScenarioToScenario } = useScenario();
16
30
  const isActionTitlePresent = action.title !== null && action.title !== "";
17
31
  const translatedActionStatus = t(`actionStatus.${action.status}`);
32
+ if (isEditing) {
33
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
34
+ ActionFormItem,
35
+ {
36
+ formMethods,
37
+ index,
38
+ remove,
39
+ showTitleNumber: false
40
+ }
41
+ ), /* @__PURE__ */ React.createElement(ButtonGroup, { fullWidth: true }, /* @__PURE__ */ React.createElement(
42
+ Button,
43
+ {
44
+ color: "primary",
45
+ variant: "contained",
46
+ onClick: formMethods.handleSubmit((data) => {
47
+ submitEditedScenarioToRiSc(
48
+ mapFormScenarioToScenario(data),
49
+ () => {
50
+ setIsEditing(false);
51
+ }
52
+ );
53
+ }),
54
+ disabled: !formMethods.formState.isDirty || riScUpdateStatus.isLoading
55
+ },
56
+ t("dictionary.save"),
57
+ riScUpdateStatus.isLoading && /* @__PURE__ */ React.createElement(
58
+ CircularProgress,
59
+ {
60
+ size: 16,
61
+ sx: { marginLeft: 1, color: "inherit" }
62
+ }
63
+ )
64
+ ), /* @__PURE__ */ React.createElement(Button, { onClick: () => setIsEditing(false) }, "Avbryt")));
65
+ }
18
66
  return /* @__PURE__ */ React.createElement(Box, null, /* @__PURE__ */ React.createElement(
19
- Button,
67
+ Box,
20
68
  {
21
69
  sx: {
22
- width: "100%",
23
- fontSize: "16px",
24
- color: "inherit",
25
- textAlign: "left",
26
- justifyContent: "start",
27
- textTransform: "initial"
70
+ display: "flex",
71
+ flexDirection: "row",
72
+ alignItems: "center"
73
+ }
74
+ },
75
+ /* @__PURE__ */ React.createElement(IconButton, { onClick: () => setIsExpanded(!isExpanded) }, isExpanded ? /* @__PURE__ */ React.createElement(ExpandLess, null) : /* @__PURE__ */ React.createElement(ExpandMore, null)),
76
+ /* @__PURE__ */ React.createElement(
77
+ Typography,
78
+ {
79
+ sx: {
80
+ fontSize: "16px",
81
+ fontWeight: 500
82
+ }
28
83
  },
29
- startIcon: isExpanded ? /* @__PURE__ */ React.createElement(ExpandLess, null) : /* @__PURE__ */ React.createElement(ExpandMore, null),
30
- onClick: () => setIsExpanded(!isExpanded),
31
- variant: "text"
84
+ isActionTitlePresent ? action.title : `${t("dictionary.measure")} ${index + 1}`
85
+ ),
86
+ /* @__PURE__ */ React.createElement(
87
+ IconButton,
88
+ {
89
+ sx: {
90
+ marginLeft: "auto",
91
+ opacity: isExpanded ? 1 : 0,
92
+ transition: "opacity 300ms ease-in"
93
+ },
94
+ onClick: () => setIsEditing(!isEditing)
95
+ },
96
+ /* @__PURE__ */ React.createElement(Edit, null)
97
+ ),
98
+ /* @__PURE__ */ React.createElement(
99
+ Chip,
100
+ {
101
+ label: translatedActionStatus,
102
+ sx: {
103
+ margin: 0,
104
+ backgroundColor: action.status === "Completed" ? { backgroundColor: "#6BC6A4" } : void 0
105
+ }
106
+ }
107
+ )
108
+ ), /* @__PURE__ */ React.createElement(Collapse, { in: isExpanded }, /* @__PURE__ */ React.createElement(Typography, { sx: { ...label, marginTop: 1 } }, t("dictionary.description")), /* @__PURE__ */ React.createElement(
109
+ Typography,
110
+ {
111
+ sx: {
112
+ ...body2,
113
+ wordBreak: "break-all"
114
+ }
32
115
  },
33
- isActionTitlePresent ? action.title : `${t("dictionary.measure")} ${index}`
34
- ), /* @__PURE__ */ React.createElement(Collapse, { in: isExpanded }, /* @__PURE__ */ React.createElement(Typography, { sx: { ...label, marginTop: 1 } }, t("dictionary.description")), /* @__PURE__ */ React.createElement(Typography, { sx: body2 }, action.description), /* @__PURE__ */ React.createElement(
116
+ action.description
117
+ ), /* @__PURE__ */ React.createElement(
35
118
  Box,
36
119
  {
37
120
  sx: {
@@ -44,7 +127,10 @@ const ActionBox = ({ action, index }) => {
44
127
  /* @__PURE__ */ React.createElement(Box, null, /* @__PURE__ */ React.createElement(Typography, { sx: label }, t("dictionary.url")), action.url ? /* @__PURE__ */ React.createElement(
45
128
  Link,
46
129
  {
47
- sx: body2,
130
+ sx: {
131
+ ...body2,
132
+ wordBreak: "break-all"
133
+ },
48
134
  target: "_blank",
49
135
  rel: "noreferrer",
50
136
  href: action.url.startsWith("http") ? action.url : `//${action.url}`
@@ -52,17 +138,7 @@ const ActionBox = ({ action, index }) => {
52
138
  action.url
53
139
  ) : /* @__PURE__ */ React.createElement(Typography, { sx: emptyState }, t("dictionary.emptyField", {
54
140
  field: t("dictionary.url").toLowerCase()
55
- }))),
56
- /* @__PURE__ */ React.createElement(
57
- Chip,
58
- {
59
- label: translatedActionStatus,
60
- sx: {
61
- margin: 0,
62
- backgroundColor: action.status === "Completed" ? { backgroundColor: "#6BC6A4" } : void 0
63
- }
64
- }
65
- )
141
+ })))
66
142
  )));
67
143
  };
68
144