@kartverket/backstage-plugin-risk-scorecard 1.4.0 → 1.5.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.
- package/dist/components/riScInfo/riScStatus/DifferenceText.esm.js +126 -0
- package/dist/components/riScInfo/riScStatus/DifferenceText.esm.js.map +1 -0
- package/dist/components/riScInfo/riScStatus/RiScDifferenceDialog.esm.js +121 -0
- package/dist/components/riScInfo/riScStatus/RiScDifferenceDialog.esm.js.map +1 -0
- package/dist/components/riScInfo/riScStatus/RiScStatusComponent.esm.js +58 -8
- package/dist/components/riScInfo/riScStatus/RiScStatusComponent.esm.js.map +1 -1
- package/dist/components/riScPlugin/RiScPlugin.esm.js +8 -4
- package/dist/components/riScPlugin/RiScPlugin.esm.js.map +1 -1
- package/dist/components/scenarioDrawer/ScenarioDrawer.esm.js +40 -6
- package/dist/components/scenarioDrawer/ScenarioDrawer.esm.js.map +1 -1
- package/dist/components/scenarioDrawer/components/ActionBox.esm.js +19 -10
- package/dist/components/scenarioDrawer/components/ActionBox.esm.js.map +1 -1
- package/dist/components/scenarioDrawer/components/ActionFormItem.esm.js +11 -3
- package/dist/components/scenarioDrawer/components/ActionFormItem.esm.js.map +1 -1
- package/dist/components/scenarioDrawer/components/ActionsSection.esm.js +4 -2
- package/dist/components/scenarioDrawer/components/ActionsSection.esm.js.map +1 -1
- package/dist/components/scenarioDrawer/components/DeleteActionConfirmation.esm.js +27 -0
- package/dist/components/scenarioDrawer/components/DeleteActionConfirmation.esm.js.map +1 -0
- package/dist/components/scenarioWizard/ScenarioWizard.esm.js +2 -1
- package/dist/components/scenarioWizard/ScenarioWizard.esm.js.map +1 -1
- package/dist/contexts/RiScContext.esm.js +89 -26
- package/dist/contexts/RiScContext.esm.js.map +1 -1
- package/dist/contexts/ScenarioContext.esm.js +5 -2
- package/dist/contexts/ScenarioContext.esm.js.map +1 -1
- package/dist/utils/hooks.esm.js +37 -17
- package/dist/utils/hooks.esm.js.map +1 -1
- package/dist/utils/translations.esm.js +62 -4
- package/dist/utils/translations.esm.js.map +1 -1
- package/dist/utils/types.esm.js +1 -0
- package/dist/utils/types.esm.js.map +1 -1
- package/dist/utils/utilityfunctions.esm.js +27 -10
- package/dist/utils/utilityfunctions.esm.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import List from '@mui/material/List';
|
|
3
|
+
import ListItem from '@mui/material/ListItem';
|
|
4
|
+
import Typography from '@mui/material/Typography';
|
|
5
|
+
import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
|
|
6
|
+
import { pluginRiScTranslationRef } from '../../../utils/translations.esm.js';
|
|
7
|
+
|
|
8
|
+
const DifferenceText = ({
|
|
9
|
+
differenceFetchState
|
|
10
|
+
}) => {
|
|
11
|
+
const { t } = useTranslationRef(pluginRiScTranslationRef);
|
|
12
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
13
|
+
Typography,
|
|
14
|
+
{
|
|
15
|
+
sx: {
|
|
16
|
+
fontWeight: 700,
|
|
17
|
+
paddingBottom: "4px"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
t("rosStatus.difference.differences.titleRemoved")
|
|
21
|
+
), /* @__PURE__ */ React.createElement(
|
|
22
|
+
List,
|
|
23
|
+
{
|
|
24
|
+
sx: { paddingBottom: "40px", paddingTop: 0, listStyleType: "disc" }
|
|
25
|
+
},
|
|
26
|
+
differenceFetchState.differenceState.entriesOnLeft.length === 0 && /* @__PURE__ */ React.createElement(
|
|
27
|
+
ListItem,
|
|
28
|
+
{
|
|
29
|
+
sx: {
|
|
30
|
+
display: "list-item",
|
|
31
|
+
marginLeft: "26px",
|
|
32
|
+
paddingTop: "4px",
|
|
33
|
+
paddingBottom: "4px"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
/* @__PURE__ */ React.createElement(Typography, null, t("rosStatus.difference.differences.noneRemoved"))
|
|
37
|
+
),
|
|
38
|
+
differenceFetchState.differenceState.entriesOnLeft.map((item) => /* @__PURE__ */ React.createElement(
|
|
39
|
+
ListItem,
|
|
40
|
+
{
|
|
41
|
+
key: item,
|
|
42
|
+
sx: {
|
|
43
|
+
display: "list-item",
|
|
44
|
+
marginLeft: "26px",
|
|
45
|
+
paddingTop: "4px",
|
|
46
|
+
paddingBottom: "4px"
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
/* @__PURE__ */ React.createElement(Typography, null, item)
|
|
50
|
+
))
|
|
51
|
+
), /* @__PURE__ */ React.createElement(
|
|
52
|
+
Typography,
|
|
53
|
+
{
|
|
54
|
+
sx: {
|
|
55
|
+
fontWeight: 700,
|
|
56
|
+
paddingBottom: "4px"
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
t("rosStatus.difference.differences.titleExisting")
|
|
60
|
+
), /* @__PURE__ */ React.createElement(
|
|
61
|
+
List,
|
|
62
|
+
{
|
|
63
|
+
sx: { paddingBottom: "40px", paddingTop: 0, listStyleType: "disc" }
|
|
64
|
+
},
|
|
65
|
+
differenceFetchState.differenceState.difference.length === 0 && /* @__PURE__ */ React.createElement(
|
|
66
|
+
ListItem,
|
|
67
|
+
{
|
|
68
|
+
sx: {
|
|
69
|
+
display: "list-item",
|
|
70
|
+
marginLeft: "26px",
|
|
71
|
+
paddingTop: "4px",
|
|
72
|
+
paddingBottom: "4px"
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
/* @__PURE__ */ React.createElement(Typography, null, t("rosStatus.difference.differences.noneExisting"))
|
|
76
|
+
),
|
|
77
|
+
differenceFetchState.differenceState.difference.map((item) => /* @__PURE__ */ React.createElement(
|
|
78
|
+
ListItem,
|
|
79
|
+
{
|
|
80
|
+
key: item,
|
|
81
|
+
sx: {
|
|
82
|
+
display: "list-item",
|
|
83
|
+
marginLeft: "26px",
|
|
84
|
+
paddingTop: "4px",
|
|
85
|
+
paddingBottom: "4px"
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
/* @__PURE__ */ React.createElement(Typography, null, item)
|
|
89
|
+
))
|
|
90
|
+
), /* @__PURE__ */ React.createElement(
|
|
91
|
+
Typography,
|
|
92
|
+
{
|
|
93
|
+
sx: {
|
|
94
|
+
fontWeight: 700,
|
|
95
|
+
paddingBottom: "4px"
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
t("rosStatus.difference.differences.titleAdded")
|
|
99
|
+
), /* @__PURE__ */ React.createElement(List, { sx: { listStyleType: "disc", paddingTop: 0 } }, differenceFetchState.differenceState.entriesOnRight.length === 0 && /* @__PURE__ */ React.createElement(
|
|
100
|
+
ListItem,
|
|
101
|
+
{
|
|
102
|
+
sx: {
|
|
103
|
+
display: "list-item",
|
|
104
|
+
marginLeft: "26px",
|
|
105
|
+
paddingTop: "4px",
|
|
106
|
+
paddingBottom: "4px"
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
/* @__PURE__ */ React.createElement(Typography, null, t("rosStatus.difference.differences.noneAdded"))
|
|
110
|
+
), differenceFetchState.differenceState.entriesOnRight.map((item) => /* @__PURE__ */ React.createElement(
|
|
111
|
+
ListItem,
|
|
112
|
+
{
|
|
113
|
+
key: item,
|
|
114
|
+
sx: {
|
|
115
|
+
display: "list-item",
|
|
116
|
+
marginLeft: "26px",
|
|
117
|
+
paddingTop: "4px",
|
|
118
|
+
paddingBottom: "4px"
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
/* @__PURE__ */ React.createElement(Typography, null, item)
|
|
122
|
+
))));
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
export { DifferenceText };
|
|
126
|
+
//# sourceMappingURL=DifferenceText.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DifferenceText.esm.js","sources":["../../../../src/components/riScInfo/riScStatus/DifferenceText.tsx"],"sourcesContent":["import React from 'react';\nimport { DifferenceFetchState } from '../../../utils/types';\nimport List from '@mui/material/List';\nimport ListItem from '@mui/material/ListItem';\nimport Typography from '@mui/material/Typography';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { pluginRiScTranslationRef } from '../../../utils/translations';\n\ntype DifferenceTextProps = {\n differenceFetchState: DifferenceFetchState;\n};\n\nexport const DifferenceText = ({\n differenceFetchState,\n}: DifferenceTextProps) => {\n const { t } = useTranslationRef(pluginRiScTranslationRef);\n return (\n <>\n <Typography\n sx={{\n fontWeight: 700,\n paddingBottom: '4px',\n }}\n >\n {t('rosStatus.difference.differences.titleRemoved')}\n </Typography>\n <List\n sx={{ paddingBottom: '40px', paddingTop: 0, listStyleType: 'disc' }}\n >\n {differenceFetchState.differenceState.entriesOnLeft.length === 0 && (\n <ListItem\n sx={{\n display: 'list-item',\n marginLeft: '26px',\n paddingTop: '4px',\n paddingBottom: '4px',\n }}\n >\n <Typography>\n {t('rosStatus.difference.differences.noneRemoved')}\n </Typography>\n </ListItem>\n )}\n {differenceFetchState.differenceState.entriesOnLeft.map(item => (\n <ListItem\n key={item}\n sx={{\n display: 'list-item',\n marginLeft: '26px',\n paddingTop: '4px',\n paddingBottom: '4px',\n }}\n >\n <Typography>{item}</Typography>\n </ListItem>\n ))}\n </List>\n <Typography\n sx={{\n fontWeight: 700,\n paddingBottom: '4px',\n }}\n >\n {t('rosStatus.difference.differences.titleExisting')}\n </Typography>\n <List\n sx={{ paddingBottom: '40px', paddingTop: 0, listStyleType: 'disc' }}\n >\n {differenceFetchState.differenceState.difference.length === 0 && (\n <ListItem\n sx={{\n display: 'list-item',\n marginLeft: '26px',\n paddingTop: '4px',\n paddingBottom: '4px',\n }}\n >\n <Typography>\n {t('rosStatus.difference.differences.noneExisting')}\n </Typography>\n </ListItem>\n )}\n {differenceFetchState.differenceState.difference.map(item => (\n <ListItem\n key={item}\n sx={{\n display: 'list-item',\n marginLeft: '26px',\n paddingTop: '4px',\n paddingBottom: '4px',\n }}\n >\n <Typography>{item}</Typography>\n </ListItem>\n ))}\n </List>\n <Typography\n sx={{\n fontWeight: 700,\n paddingBottom: '4px',\n }}\n >\n {t('rosStatus.difference.differences.titleAdded')}\n </Typography>\n <List sx={{ listStyleType: 'disc', paddingTop: 0 }}>\n {differenceFetchState.differenceState.entriesOnRight.length === 0 && (\n <ListItem\n sx={{\n display: 'list-item',\n marginLeft: '26px',\n paddingTop: '4px',\n paddingBottom: '4px',\n }}\n >\n <Typography>\n {t('rosStatus.difference.differences.noneAdded')}\n </Typography>\n </ListItem>\n )}\n {differenceFetchState.differenceState.entriesOnRight.map(item => (\n <ListItem\n key={item}\n sx={{\n display: 'list-item',\n marginLeft: '26px',\n paddingTop: '4px',\n paddingBottom: '4px',\n }}\n >\n <Typography>{item}</Typography>\n </ListItem>\n ))}\n </List>\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;AAYO,MAAM,iBAAiB,CAAC;AAAA,EAC7B,oBAAA;AACF,CAA2B,KAAA;AACzB,EAAA,MAAM,EAAE,CAAA,EAAM,GAAA,iBAAA,CAAkB,wBAAwB,CAAA,CAAA;AACxD,EAAA,uBAEI,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,EAAI,EAAA;AAAA,QACF,UAAY,EAAA,GAAA;AAAA,QACZ,aAAe,EAAA,KAAA;AAAA,OACjB;AAAA,KAAA;AAAA,IAEC,EAAE,+CAA+C,CAAA;AAAA,GAEpD,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,IAAA;AAAA,IAAA;AAAA,MACC,IAAI,EAAE,aAAA,EAAe,QAAQ,UAAY,EAAA,CAAA,EAAG,eAAe,MAAO,EAAA;AAAA,KAAA;AAAA,IAEjE,oBAAqB,CAAA,eAAA,CAAgB,aAAc,CAAA,MAAA,KAAW,CAC7D,oBAAA,KAAA,CAAA,aAAA;AAAA,MAAC,QAAA;AAAA,MAAA;AAAA,QACC,EAAI,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,CAAA,UAAA,EAAA,IAAA,EACE,CAAE,CAAA,4CAA4C,CACjD,CAAA;AAAA,GAGH,EAAA,oBAAA,CAAqB,eAAgB,CAAA,cAAA,CAAe,IAAI,CACvD,IAAA,qBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,QAAA;AAAA,IAAA;AAAA,MACC,GAAK,EAAA,IAAA;AAAA,MACL,EAAI,EAAA;AAAA,QACF,OAAS,EAAA,WAAA;AAAA,QACT,UAAY,EAAA,MAAA;AAAA,QACZ,UAAY,EAAA,KAAA;AAAA,QACZ,aAAe,EAAA,KAAA;AAAA,OACjB;AAAA,KAAA;AAAA,oBAEA,KAAA,CAAA,aAAA,CAAC,kBAAY,IAAK,CAAA;AAAA,GAErB,CACH,CACF,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Box from '@mui/material/Box';
|
|
3
|
+
import Typography from '@mui/material/Typography';
|
|
4
|
+
import Card from '@mui/material/Card';
|
|
5
|
+
import CircularProgress from '@mui/material/CircularProgress';
|
|
6
|
+
import { ErrorOutline, Favorite } from '@mui/icons-material';
|
|
7
|
+
import { DifferenceText } from './DifferenceText.esm.js';
|
|
8
|
+
import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
|
|
9
|
+
import { pluginRiScTranslationRef } from '../../../utils/translations.esm.js';
|
|
10
|
+
import { parseISODateFromEncryptedROS } from '../../../utils/utilityfunctions.esm.js';
|
|
11
|
+
import { parseISO } from 'date-fns';
|
|
12
|
+
|
|
13
|
+
const RiScDifferenceDialog = ({
|
|
14
|
+
differenceFetchState
|
|
15
|
+
}) => {
|
|
16
|
+
const { t } = useTranslationRef(pluginRiScTranslationRef);
|
|
17
|
+
const formatedDateString = parseISODateFromEncryptedROS(
|
|
18
|
+
differenceFetchState.defaultLastModifiedDateString
|
|
19
|
+
);
|
|
20
|
+
const parsedDateString = formatedDateString ? parseISO(formatedDateString).toLocaleDateString() : null;
|
|
21
|
+
return /* @__PURE__ */ React.createElement(Box, null, /* @__PURE__ */ React.createElement(Typography, null, t("rosStatus.difference.description")), /* @__PURE__ */ React.createElement(
|
|
22
|
+
Typography,
|
|
23
|
+
{
|
|
24
|
+
sx: {
|
|
25
|
+
fontWeight: 700,
|
|
26
|
+
fontSize: "0.8rem",
|
|
27
|
+
paddingBottom: "40px"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
parsedDateString && t("rosStatus.difference.publishDate", {
|
|
31
|
+
date: parsedDateString
|
|
32
|
+
})
|
|
33
|
+
), /* @__PURE__ */ React.createElement(Box, null, /* @__PURE__ */ React.createElement(
|
|
34
|
+
Typography,
|
|
35
|
+
{
|
|
36
|
+
variant: "h3",
|
|
37
|
+
sx: {
|
|
38
|
+
fontSize: 18
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
t("rosStatus.difference.differences.title")
|
|
42
|
+
), /* @__PURE__ */ React.createElement(
|
|
43
|
+
Card,
|
|
44
|
+
{
|
|
45
|
+
sx: {
|
|
46
|
+
backgroundColor: "rgb(51, 51, 51)",
|
|
47
|
+
padding: "20px",
|
|
48
|
+
position: "relative",
|
|
49
|
+
marginBottom: "20px",
|
|
50
|
+
minHeight: "260px"
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
differenceFetchState.isLoading && /* @__PURE__ */ React.createElement(
|
|
54
|
+
Box,
|
|
55
|
+
{
|
|
56
|
+
sx: {
|
|
57
|
+
display: "flex",
|
|
58
|
+
flexDirection: "column",
|
|
59
|
+
alignItems: "center",
|
|
60
|
+
margin: "auto 0"
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
/* @__PURE__ */ React.createElement(
|
|
64
|
+
CircularProgress,
|
|
65
|
+
{
|
|
66
|
+
size: 30,
|
|
67
|
+
sx: { marginLeft: 1, color: "inherit", margin: "10px" }
|
|
68
|
+
}
|
|
69
|
+
),
|
|
70
|
+
t("rosStatus.difference.fetching")
|
|
71
|
+
),
|
|
72
|
+
differenceFetchState.status !== null && differenceFetchState.status !== "Success" && differenceFetchState.status !== "GithubFileNotFound" && /* @__PURE__ */ React.createElement(
|
|
73
|
+
Box,
|
|
74
|
+
{
|
|
75
|
+
sx: {
|
|
76
|
+
display: "flex",
|
|
77
|
+
flexDirection: "column",
|
|
78
|
+
alignItems: "center",
|
|
79
|
+
margin: "auto 0"
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
/* @__PURE__ */ React.createElement(
|
|
83
|
+
ErrorOutline,
|
|
84
|
+
{
|
|
85
|
+
sx: {
|
|
86
|
+
fontSize: "30px",
|
|
87
|
+
marginBottom: "16px",
|
|
88
|
+
color: "red"
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
),
|
|
92
|
+
t("rosStatus.difference.error")
|
|
93
|
+
),
|
|
94
|
+
differenceFetchState.status !== null && differenceFetchState.status === "GithubFileNotFound" && /* @__PURE__ */ React.createElement(
|
|
95
|
+
Box,
|
|
96
|
+
{
|
|
97
|
+
sx: {
|
|
98
|
+
display: "flex",
|
|
99
|
+
flexDirection: "column",
|
|
100
|
+
alignItems: "center",
|
|
101
|
+
margin: "auto 0"
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
/* @__PURE__ */ React.createElement(
|
|
105
|
+
Favorite,
|
|
106
|
+
{
|
|
107
|
+
sx: {
|
|
108
|
+
fontSize: "30px",
|
|
109
|
+
marginBottom: "16px",
|
|
110
|
+
color: "green"
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
),
|
|
114
|
+
t("rosStatus.difference.newROS")
|
|
115
|
+
),
|
|
116
|
+
differenceFetchState.status === "Success" && /* @__PURE__ */ React.createElement(DifferenceText, { differenceFetchState })
|
|
117
|
+
)));
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
export { RiScDifferenceDialog };
|
|
121
|
+
//# sourceMappingURL=RiScDifferenceDialog.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RiScDifferenceDialog.esm.js","sources":["../../../../src/components/riScInfo/riScStatus/RiScDifferenceDialog.tsx"],"sourcesContent":["import React from 'react';\nimport { DifferenceFetchState } from '../../../utils/types';\nimport Box from '@mui/material/Box';\nimport Typography from '@mui/material/Typography';\nimport Card from '@mui/material/Card';\nimport CircularProgress from '@mui/material/CircularProgress';\nimport { ErrorOutline, Favorite } from '@mui/icons-material';\nimport { DifferenceText } from './DifferenceText';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { pluginRiScTranslationRef } from '../../../utils/translations';\nimport { parseISODateFromEncryptedROS } from '../../../utils/utilityfunctions';\nimport { parseISO } from 'date-fns';\n\ntype RiScDifferenceDialogProps = {\n differenceFetchState: DifferenceFetchState;\n};\n\nexport const RiScDifferenceDialog = ({\n differenceFetchState,\n}: RiScDifferenceDialogProps) => {\n const { t } = useTranslationRef(pluginRiScTranslationRef);\n\n const formatedDateString = parseISODateFromEncryptedROS(\n differenceFetchState.defaultLastModifiedDateString,\n );\n\n const parsedDateString = formatedDateString\n ? parseISO(formatedDateString).toLocaleDateString()\n : null;\n return (\n <Box>\n <Typography>{t('rosStatus.difference.description')}</Typography>\n <Typography\n sx={{\n fontWeight: 700,\n fontSize: '0.8rem',\n paddingBottom: '40px',\n }}\n >\n {parsedDateString &&\n t('rosStatus.difference.publishDate', {\n date: parsedDateString,\n })}\n </Typography>\n <Box>\n <Typography\n variant=\"h3\"\n sx={{\n fontSize: 18,\n }}\n >\n {t('rosStatus.difference.differences.title')}\n </Typography>\n <Card\n sx={{\n backgroundColor: 'rgb(51, 51, 51)',\n padding: '20px',\n position: 'relative',\n marginBottom: '20px',\n minHeight: '260px',\n }}\n >\n {differenceFetchState.isLoading && (\n <Box\n sx={{\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n margin: 'auto 0',\n }}\n >\n <CircularProgress\n size={30}\n sx={{ marginLeft: 1, color: 'inherit', margin: '10px' }}\n />\n {t('rosStatus.difference.fetching')}\n </Box>\n )}\n {differenceFetchState.status !== null &&\n differenceFetchState.status !== 'Success' &&\n differenceFetchState.status !== 'GithubFileNotFound' && (\n <Box\n sx={{\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n margin: 'auto 0',\n }}\n >\n <ErrorOutline\n sx={{\n fontSize: '30px',\n marginBottom: '16px',\n color: 'red',\n }}\n />\n {t('rosStatus.difference.error')}\n </Box>\n )}\n {differenceFetchState.status !== null &&\n differenceFetchState.status === 'GithubFileNotFound' && (\n <Box\n sx={{\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n margin: 'auto 0',\n }}\n >\n <Favorite\n sx={{\n fontSize: '30px',\n marginBottom: '16px',\n color: 'green',\n }}\n />\n {t('rosStatus.difference.newROS')}\n </Box>\n )}\n {differenceFetchState.status === 'Success' && (\n <DifferenceText differenceFetchState={differenceFetchState} />\n )}\n </Card>\n </Box>\n </Box>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;AAiBO,MAAM,uBAAuB,CAAC;AAAA,EACnC,oBAAA;AACF,CAAiC,KAAA;AAC/B,EAAA,MAAM,EAAE,CAAA,EAAM,GAAA,iBAAA,CAAkB,wBAAwB,CAAA,CAAA;AAExD,EAAA,MAAM,kBAAqB,GAAA,4BAAA;AAAA,IACzB,oBAAqB,CAAA,6BAAA;AAAA,GACvB,CAAA;AAEA,EAAA,MAAM,mBAAmB,kBACrB,GAAA,QAAA,CAAS,kBAAkB,CAAA,CAAE,oBAC7B,GAAA,IAAA,CAAA;AACJ,EAAA,2CACG,GACC,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,kBAAY,CAAE,CAAA,kCAAkC,CAAE,CACnD,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,EAAI,EAAA;AAAA,QACF,UAAY,EAAA,GAAA;AAAA,QACZ,QAAU,EAAA,QAAA;AAAA,QACV,aAAe,EAAA,MAAA;AAAA,OACjB;AAAA,KAAA;AAAA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,QACC,EAAI,EAAA;AAAA,UACF,OAAS,EAAA,MAAA;AAAA,UACT,aAAe,EAAA,QAAA;AAAA,UACf,UAAY,EAAA,QAAA;AAAA,UACZ,MAAQ,EAAA,QAAA;AAAA,SACV;AAAA,OAAA;AAAA,sBAEA,KAAA,CAAA,aAAA;AAAA,QAAC,YAAA;AAAA,QAAA;AAAA,UACC,EAAI,EAAA;AAAA,YACF,QAAU,EAAA,MAAA;AAAA,YACV,YAAc,EAAA,MAAA;AAAA,YACd,KAAO,EAAA,KAAA;AAAA,WACT;AAAA,SAAA;AAAA,OACF;AAAA,MACC,EAAE,4BAA4B,CAAA;AAAA,KACjC;AAAA,IAEH,oBAAqB,CAAA,MAAA,KAAW,IAC/B,IAAA,oBAAA,CAAqB,WAAW,oBAC9B,oBAAA,KAAA,CAAA,aAAA;AAAA,MAAC,GAAA;AAAA,MAAA;AAAA,QACC,EAAI,EAAA;AAAA,UACF,OAAS,EAAA,MAAA;AAAA,UACT,aAAe,EAAA,QAAA;AAAA,UACf,UAAY,EAAA,QAAA;AAAA,UACZ,MAAQ,EAAA,QAAA;AAAA,SACV;AAAA,OAAA;AAAA,sBAEA,KAAA,CAAA,aAAA;AAAA,QAAC,QAAA;AAAA,QAAA;AAAA,UACC,EAAI,EAAA;AAAA,YACF,QAAU,EAAA,MAAA;AAAA,YACV,YAAc,EAAA,MAAA;AAAA,YACd,KAAO,EAAA,OAAA;AAAA,WACT;AAAA,SAAA;AAAA,OACF;AAAA,MACC,EAAE,6BAA6B,CAAA;AAAA,KAClC;AAAA,IAEH,oBAAqB,CAAA,MAAA,KAAW,SAC/B,oBAAA,KAAA,CAAA,aAAA,CAAC,kBAAe,oBAA4C,EAAA,CAAA;AAAA,GAGlE,CACF,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
2
|
import { RiScStatus } from '../../../utils/types.esm.js';
|
|
3
3
|
import Alert from '@mui/material/Alert';
|
|
4
4
|
import Button from '@mui/material/Button';
|
|
@@ -18,20 +18,23 @@ 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
|
|
21
|
+
import Box from '@mui/material/Box';
|
|
22
22
|
import { WarningAmberOutlined } from '@mui/icons-material';
|
|
23
|
+
import { useAuthenticatedFetch } from '../../../utils/hooks.esm.js';
|
|
24
|
+
import { RiScDifferenceDialog } from './RiScDifferenceDialog.esm.js';
|
|
23
25
|
|
|
24
26
|
const RiScPublishDialog = ({
|
|
25
27
|
openDialog,
|
|
26
28
|
handleCancel,
|
|
27
|
-
handlePublish
|
|
29
|
+
handlePublish,
|
|
30
|
+
differenceFetchState
|
|
28
31
|
}) => {
|
|
29
32
|
const { t } = useTranslationRef(pluginRiScTranslationRef);
|
|
30
33
|
const [riskOwnerApproves, setRiskOwnerApproves] = useState(false);
|
|
31
34
|
const handleCheckboxInput = (event) => {
|
|
32
35
|
setRiskOwnerApproves(event.target.checked);
|
|
33
36
|
};
|
|
34
|
-
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(
|
|
37
|
+
return /* @__PURE__ */ React.createElement(Dialog, { open: openDialog }, /* @__PURE__ */ React.createElement(DialogTitle, null, t("publishDialog.title")), /* @__PURE__ */ React.createElement(DialogContent, null, /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(RiScDifferenceDialog, { differenceFetchState }), /* @__PURE__ */ React.createElement(Alert, { severity: "info", icon: false }, /* @__PURE__ */ React.createElement(
|
|
35
38
|
FormControlLabel,
|
|
36
39
|
{
|
|
37
40
|
control: /* @__PURE__ */ React.createElement(
|
|
@@ -44,7 +47,7 @@ const RiScPublishDialog = ({
|
|
|
44
47
|
),
|
|
45
48
|
label: t("publishDialog.checkboxLabel")
|
|
46
49
|
}
|
|
47
|
-
))), /* @__PURE__ */ React.createElement(DialogActions, { sx: dialogActions }, /* @__PURE__ */ React.createElement(
|
|
50
|
+
)))), /* @__PURE__ */ React.createElement(DialogActions, { sx: dialogActions }, /* @__PURE__ */ React.createElement(
|
|
48
51
|
Button,
|
|
49
52
|
{
|
|
50
53
|
variant: "contained",
|
|
@@ -120,22 +123,69 @@ const RosAcceptance = ({
|
|
|
120
123
|
return /* @__PURE__ */ React.createElement(Typography, { paragraph: true, sx: subtitle1 }, t("rosStatus.statusBadge.error"));
|
|
121
124
|
}
|
|
122
125
|
};
|
|
126
|
+
const emptyDifferenceFetchState = {
|
|
127
|
+
differenceState: {
|
|
128
|
+
entriesOnLeft: [],
|
|
129
|
+
entriesOnRight: [],
|
|
130
|
+
difference: []
|
|
131
|
+
},
|
|
132
|
+
status: null,
|
|
133
|
+
isLoading: false,
|
|
134
|
+
errorMessage: "",
|
|
135
|
+
currentDifferenceId: "",
|
|
136
|
+
defaultLastModifiedDateString: ""
|
|
137
|
+
};
|
|
123
138
|
const RiScStatusComponent = ({
|
|
124
139
|
selectedRiSc,
|
|
125
140
|
publishRiScFn
|
|
126
141
|
}) => {
|
|
127
142
|
const { t } = useTranslationRef(pluginRiScTranslationRef);
|
|
143
|
+
const { fetchDifference } = useAuthenticatedFetch();
|
|
128
144
|
const [publishRiScDialogIsOpen, setPublishRiScDialogIsOpen] = useState(false);
|
|
129
145
|
const [migrationDialogIsOpen, setMigrationDialogIsOpen] = useState(false);
|
|
146
|
+
const [differenceFetchState, setDifferenceFetchState] = useState(emptyDifferenceFetchState);
|
|
130
147
|
const { updateRiSc } = useRiScs();
|
|
131
148
|
const handleApproveAndPublish = () => {
|
|
132
149
|
publishRiScFn();
|
|
133
150
|
setPublishRiScDialogIsOpen(false);
|
|
134
151
|
};
|
|
152
|
+
const getDifferences = () => {
|
|
153
|
+
if (!selectedRiSc || differenceFetchState.isLoading || differenceFetchState.currentDifferenceId === selectedRiSc.id)
|
|
154
|
+
return;
|
|
155
|
+
setDifferenceFetchState({ ...differenceFetchState, isLoading: true });
|
|
156
|
+
fetchDifference(
|
|
157
|
+
selectedRiSc,
|
|
158
|
+
(response) => {
|
|
159
|
+
setDifferenceFetchState({
|
|
160
|
+
differenceState: response.differenceState,
|
|
161
|
+
isLoading: false,
|
|
162
|
+
currentDifferenceId: selectedRiSc.id,
|
|
163
|
+
status: response.status,
|
|
164
|
+
errorMessage: response.errorMessage,
|
|
165
|
+
defaultLastModifiedDateString: response.defaultLastModifiedDateString
|
|
166
|
+
});
|
|
167
|
+
},
|
|
168
|
+
() => {
|
|
169
|
+
setDifferenceFetchState({
|
|
170
|
+
...emptyDifferenceFetchState,
|
|
171
|
+
errorMessage: t("rosStatus.difference.error"),
|
|
172
|
+
status: "FrontendFallback"
|
|
173
|
+
// Fallback when the backend does not deliver a response with status
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
);
|
|
177
|
+
};
|
|
135
178
|
const handleUpdate = () => {
|
|
136
179
|
updateRiSc(selectedRiSc.content);
|
|
137
180
|
setMigrationDialogIsOpen(false);
|
|
138
181
|
};
|
|
182
|
+
const handleOpenPublishRiScDialog = () => {
|
|
183
|
+
setPublishRiScDialogIsOpen(true);
|
|
184
|
+
getDifferences();
|
|
185
|
+
};
|
|
186
|
+
useEffect(() => {
|
|
187
|
+
setDifferenceFetchState(emptyDifferenceFetchState);
|
|
188
|
+
}, [selectedRiSc]);
|
|
139
189
|
return /* @__PURE__ */ React.createElement(InfoCard, null, /* @__PURE__ */ React.createElement(Typography, { variant: "h5" }, "Status"), /* @__PURE__ */ React.createElement(
|
|
140
190
|
RosAcceptance,
|
|
141
191
|
{
|
|
@@ -147,8 +197,7 @@ const RiScStatusComponent = ({
|
|
|
147
197
|
{
|
|
148
198
|
color: "primary",
|
|
149
199
|
variant: "contained",
|
|
150
|
-
onClick:
|
|
151
|
-
disabled: selectedRiSc.status !== RiScStatus.Draft,
|
|
200
|
+
onClick: handleOpenPublishRiScDialog,
|
|
152
201
|
sx: { display: "block", marginLeft: "auto" }
|
|
153
202
|
},
|
|
154
203
|
t("rosStatus.approveButton")
|
|
@@ -174,7 +223,8 @@ const RiScStatusComponent = ({
|
|
|
174
223
|
{
|
|
175
224
|
openDialog: publishRiScDialogIsOpen,
|
|
176
225
|
handlePublish: handleApproveAndPublish,
|
|
177
|
-
handleCancel: () => setPublishRiScDialogIsOpen(false)
|
|
226
|
+
handleCancel: () => setPublishRiScDialogIsOpen(false),
|
|
227
|
+
differenceFetchState
|
|
178
228
|
}
|
|
179
229
|
));
|
|
180
230
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"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,CAAA,CAAA;AAEzE,EAAM,MAAA,mBAAA,GAAsB,CAAC,KAA+C,KAAA;AAC1E,IAAqB,oBAAA,CAAA,KAAA,CAAM,OAAO,OAAO,CAAA,CAAA;AAAA,GAC3C,CAAA;AAEA,EAAA,2CACG,MAAO,EAAA,EAAA,IAAA,EAAM,UACZ,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,mBAAa,CAAE,CAAA,qBAAqB,CAAE,CAAA,sCACtC,aACC,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,SAAM,QAAS,EAAA,MAAA,EAAO,MAAM,KAC3B,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,gBAAA;AAAA,IAAA;AAAA,MACC,OACE,kBAAA,KAAA,CAAA,aAAA;AAAA,QAAC,QAAA;AAAA,QAAA;AAAA,UACC,KAAM,EAAA,SAAA;AAAA,UACN,OAAS,EAAA,iBAAA;AAAA,UACT,QAAU,EAAA,mBAAA;AAAA,SAAA;AAAA,OACZ;AAAA,MAEF,KAAA,EAAO,EAAE,6BAA6B,CAAA;AAA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;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;;;;"}
|
|
1
|
+
{"version":3,"file":"RiScStatusComponent.esm.js","sources":["../../../../src/components/riScInfo/riScStatus/RiScStatusComponent.tsx"],"sourcesContent":["import React, { ReactComponentElement, useEffect, useState } from 'react';\nimport {\n DifferenceFetchState,\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 '@mui/material/Box';\nimport { WarningAmberOutlined } from '@mui/icons-material';\nimport { useAuthenticatedFetch } from '../../../utils/hooks';\nimport { RiScDifferenceDialog } from './RiScDifferenceDialog';\n\ninterface RiScPublishDialogProps {\n openDialog: boolean;\n handleCancel: () => void;\n handlePublish: () => void;\n differenceFetchState: DifferenceFetchState;\n}\n\nconst RiScPublishDialog = ({\n openDialog,\n handleCancel,\n handlePublish,\n differenceFetchState,\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 <>\n <RiScDifferenceDialog differenceFetchState={differenceFetchState} />\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 </>\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\nconst emptyDifferenceFetchState: DifferenceFetchState = {\n differenceState: {\n entriesOnLeft: [],\n entriesOnRight: [],\n difference: [],\n },\n status: null,\n isLoading: false,\n errorMessage: '',\n currentDifferenceId: '',\n defaultLastModifiedDateString: '',\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 const { fetchDifference } = useAuthenticatedFetch();\n\n const [publishRiScDialogIsOpen, setPublishRiScDialogIsOpen] =\n useState<boolean>(false);\n\n const [migrationDialogIsOpen, setMigrationDialogIsOpen] =\n useState<boolean>(false);\n\n const [differenceFetchState, setDifferenceFetchState] =\n useState<DifferenceFetchState>(emptyDifferenceFetchState);\n\n const { updateRiSc } = useRiScs();\n\n const handleApproveAndPublish = () => {\n publishRiScFn();\n setPublishRiScDialogIsOpen(false);\n };\n\n const getDifferences = () => {\n if (\n !selectedRiSc ||\n differenceFetchState.isLoading ||\n differenceFetchState.currentDifferenceId === selectedRiSc.id\n )\n return;\n\n setDifferenceFetchState({ ...differenceFetchState, isLoading: true });\n fetchDifference(\n selectedRiSc,\n response => {\n setDifferenceFetchState({\n differenceState: response.differenceState,\n isLoading: false,\n currentDifferenceId: selectedRiSc.id,\n status: response.status,\n errorMessage: response.errorMessage,\n defaultLastModifiedDateString: response.defaultLastModifiedDateString,\n });\n },\n () => {\n setDifferenceFetchState({\n ...emptyDifferenceFetchState,\n errorMessage: t('rosStatus.difference.error'),\n status: 'FrontendFallback', // Fallback when the backend does not deliver a response with status\n });\n },\n );\n };\n\n const handleUpdate = () => {\n updateRiSc(selectedRiSc.content);\n setMigrationDialogIsOpen(false);\n };\n\n const handleOpenPublishRiScDialog = () => {\n setPublishRiScDialogIsOpen(true);\n getDifferences();\n };\n\n useEffect(() => {\n setDifferenceFetchState(emptyDifferenceFetchState);\n }, [selectedRiSc]);\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={handleOpenPublishRiScDialog}\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 differenceFetchState={differenceFetchState}\n />\n </InfoCard>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAqCA,MAAM,oBAAoB,CAAC;AAAA,EACzB,UAAA;AAAA,EACA,YAAA;AAAA,EACA,aAAA;AAAA,EACA,oBAAA;AACF,CAA0D,KAAA;AACxD,EAAA,MAAM,EAAE,CAAA,EAAM,GAAA,iB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AA,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,MACpD,oBAAA;AAAA,KAAA;AAAA,GAEJ,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -35,6 +35,7 @@ const RiScPlugin = () => {
|
|
|
35
35
|
riScs,
|
|
36
36
|
selectRiSc,
|
|
37
37
|
isFetching,
|
|
38
|
+
resetResponse,
|
|
38
39
|
resetRiScStatus,
|
|
39
40
|
response,
|
|
40
41
|
riScUpdateStatus
|
|
@@ -44,12 +45,15 @@ const RiScPlugin = () => {
|
|
|
44
45
|
"step"
|
|
45
46
|
);
|
|
46
47
|
useEffect(() => {
|
|
47
|
-
if (scenarioWizardStep !== null)
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
if (scenarioWizardStep !== null) {
|
|
49
|
+
resetRiScStatus();
|
|
50
|
+
resetResponse();
|
|
51
|
+
}
|
|
52
|
+
}, [resetRiScStatus, resetResponse, scenarioWizardStep]);
|
|
53
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, response && !riScUpdateStatus.isLoading && /* @__PURE__ */ React.createElement(
|
|
50
54
|
Alert,
|
|
51
55
|
{
|
|
52
|
-
severity: getAlertSeverity(
|
|
56
|
+
severity: getAlertSeverity(riScUpdateStatus),
|
|
53
57
|
sx: { marginBottom: 2 }
|
|
54
58
|
},
|
|
55
59
|
/* @__PURE__ */ React.createElement(Typography, null, response.statusMessage)
|
|
@@ -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 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(
|
|
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 resetResponse,\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) {\n resetRiScStatus();\n resetResponse();\n }\n }, [resetRiScStatus, resetResponse, scenarioWizardStep]);\n\n return (\n <>\n {response && !riScUpdateStatus.isLoading && (\n <Alert\n severity={getAlertSeverity(riScUpdateStatus)}\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} d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