@kartverket/backstage-plugin-risk-scorecard 3.1.1 → 3.1.3
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/common/Input.esm.js +25 -32
- package/dist/components/common/Input.esm.js.map +1 -1
- package/dist/components/common/Markdown.esm.js +15 -2
- package/dist/components/common/Markdown.esm.js.map +1 -1
- package/dist/components/common/MarkdownInput.esm.js +19 -3
- package/dist/components/common/MarkdownInput.esm.js.map +1 -1
- package/dist/components/riScDialog/ConfigEncryptionDialog.esm.js +78 -37
- package/dist/components/riScDialog/ConfigEncryptionDialog.esm.js.map +1 -1
- package/dist/components/riScDialog/ConfigRiscInfo.esm.js +3 -3
- package/dist/components/riScDialog/ConfigRiscInfo.esm.js.map +1 -1
- package/dist/components/riScInfo/MigrationDialog.esm.js +2 -2
- package/dist/components/riScInfo/MigrationDialog.esm.js.map +1 -1
- package/dist/components/riScInfo/PublishDialog.esm.js +2 -2
- package/dist/components/riScInfo/PublishDialog.esm.js.map +1 -1
- package/dist/components/riScInfo/riScStatus/DifferenceText.esm.js +45 -81
- package/dist/components/riScInfo/riScStatus/DifferenceText.esm.js.map +1 -1
- package/dist/components/riScInfo/riScStatus/RiScDifferenceDialog.esm.js +4 -3
- package/dist/components/riScInfo/riScStatus/RiScDifferenceDialog.esm.js.map +1 -1
- package/dist/components/riScInfo/riScStatus/RiScStatusComponent.esm.js +31 -42
- package/dist/components/riScInfo/riScStatus/RiScStatusComponent.esm.js.map +1 -1
- package/dist/components/riScInfo/riScStatus/StatusIconWithText.esm.js +25 -0
- package/dist/components/riScInfo/riScStatus/StatusIconWithText.esm.js.map +1 -0
- package/dist/components/riScPlugin/RiScPlugin.esm.js +2 -2
- package/dist/components/riScPlugin/RiScPlugin.esm.js.map +1 -1
- package/dist/components/scenarioDrawer/ScenarioDrawer.esm.js +2 -2
- package/dist/components/scenarioDrawer/ScenarioDrawer.esm.js.map +1 -1
- package/dist/components/scenarioDrawer/components/ActionBox.esm.js +47 -41
- package/dist/components/scenarioDrawer/components/ActionBox.esm.js.map +1 -1
- package/dist/components/scenarioDrawer/components/ActionFormItem.esm.js +18 -14
- package/dist/components/scenarioDrawer/components/ActionFormItem.esm.js.map +1 -1
- package/dist/components/scenarioDrawer/components/ActionsSection.esm.js +14 -11
- package/dist/components/scenarioDrawer/components/ActionsSection.esm.js.map +1 -1
- package/dist/components/scenarioDrawer/components/DeleteConfirmation.esm.js +55 -22
- package/dist/components/scenarioDrawer/components/DeleteConfirmation.esm.js.map +1 -1
- package/dist/components/scenarioDrawer/components/ScopeFormSection.esm.js +20 -16
- package/dist/components/scenarioDrawer/components/ScopeFormSection.esm.js.map +1 -1
- package/dist/components/scenarioTable/ScenarioTable.esm.js +15 -15
- package/dist/components/scenarioTable/ScenarioTable.esm.js.map +1 -1
- package/dist/components/scenarioTable/ScenarioTableProgressBar.esm.js +46 -0
- package/dist/components/scenarioTable/ScenarioTableProgressBar.esm.js.map +1 -0
- package/dist/components/scenarioTable/ScenarioTableRow.esm.js +21 -21
- package/dist/components/scenarioTable/ScenarioTableRow.esm.js.map +1 -1
- package/dist/components/scenarioWizard/components/CloseConfirmation.esm.js +1 -1
- package/dist/components/scenarioWizard/components/CloseConfirmation.esm.js.map +1 -1
- package/dist/components/scenarioWizard/steps/ActionsStep.esm.js +59 -24
- package/dist/components/scenarioWizard/steps/ActionsStep.esm.js.map +1 -1
- package/dist/components/scenarioWizard/steps/ScenarioStep.esm.js +17 -14
- package/dist/components/scenarioWizard/steps/ScenarioStep.esm.js.map +1 -1
- package/dist/components/sopsConfigDialog/GcpCryptoKeyMenu.esm.js +19 -7
- package/dist/components/sopsConfigDialog/GcpCryptoKeyMenu.esm.js.map +1 -1
- package/dist/components/sopsConfigDialog/GcpCryptoKeyMenuItem.esm.js +36 -33
- package/dist/components/sopsConfigDialog/GcpCryptoKeyMenuItem.esm.js.map +1 -1
- package/dist/contexts/RiScContext.esm.js +0 -1
- package/dist/contexts/RiScContext.esm.js.map +1 -1
- package/dist/utils/constants.esm.js +33 -9
- package/dist/utils/constants.esm.js.map +1 -1
- package/dist/utils/style.esm.js +12 -1
- package/dist/utils/style.esm.js.map +1 -1
- package/dist/utils/translations.esm.js +422 -419
- package/dist/utils/translations.esm.js.map +1 -1
- package/dist/utils/types.esm.js +11 -1
- package/dist/utils/types.esm.js.map +1 -1
- package/dist/utils/utilityfunctions.esm.js +35 -51
- package/dist/utils/utilityfunctions.esm.js.map +1 -1
- package/package.json +10 -1
- package/dist/risc_schema_en_v4_0.json.esm.js +0 -88
- package/dist/risc_schema_en_v4_0.json.esm.js.map +0 -1
|
@@ -5,41 +5,34 @@ import FormLabel from '@mui/material/FormLabel';
|
|
|
5
5
|
import TextField from '@mui/material/TextField';
|
|
6
6
|
import { forwardRef } from 'react';
|
|
7
7
|
import { formLabel, formHelperText } from './typography.esm.js';
|
|
8
|
+
import { formControlStyles, commonTextColor } from '../../utils/style.esm.js';
|
|
8
9
|
|
|
9
10
|
const Input = forwardRef(
|
|
10
11
|
({ label, sublabel, error, helperText, required, ...props }, ref) => {
|
|
11
|
-
return /* @__PURE__ */ jsxs(
|
|
12
|
-
|
|
13
|
-
{
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
},
|
|
36
|
-
...props
|
|
37
|
-
}
|
|
38
|
-
),
|
|
39
|
-
helperText && /* @__PURE__ */ jsx(FormHelperText, { children: helperText })
|
|
40
|
-
]
|
|
41
|
-
}
|
|
42
|
-
);
|
|
12
|
+
return /* @__PURE__ */ jsxs(FormControl, { sx: formControlStyles, error, required, children: [
|
|
13
|
+
label && /* @__PURE__ */ jsx(FormLabel, { required, sx: formLabel, children: label }),
|
|
14
|
+
sublabel && /* @__PURE__ */ jsx(FormHelperText, { sx: formHelperText, children: sublabel }),
|
|
15
|
+
/* @__PURE__ */ jsx(
|
|
16
|
+
TextField,
|
|
17
|
+
{
|
|
18
|
+
id: "filled-multiline-static",
|
|
19
|
+
error,
|
|
20
|
+
multiline: true,
|
|
21
|
+
fullWidth: true,
|
|
22
|
+
variant: "outlined",
|
|
23
|
+
inputRef: ref,
|
|
24
|
+
InputProps: {
|
|
25
|
+
sx: (theme) => ({
|
|
26
|
+
"&.Mui-disabled": {
|
|
27
|
+
color: commonTextColor(theme, true)
|
|
28
|
+
}
|
|
29
|
+
})
|
|
30
|
+
},
|
|
31
|
+
...props
|
|
32
|
+
}
|
|
33
|
+
),
|
|
34
|
+
helperText && /* @__PURE__ */ jsx(FormHelperText, { children: helperText })
|
|
35
|
+
] });
|
|
43
36
|
}
|
|
44
37
|
);
|
|
45
38
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Input.esm.js","sources":["../../../src/components/common/Input.tsx"],"sourcesContent":["import FormControl from '@mui/material/FormControl';\nimport FormHelperText from '@mui/material/FormHelperText';\nimport FormLabel from '@mui/material/FormLabel';\nimport TextField, { TextFieldProps } from '@mui/material/TextField';\nimport { forwardRef } from 'react';\nimport { formHelperText, formLabel } from './typography';\n\ntype Props = TextFieldProps & {\n sublabel?: string;\n};\n\nexport const Input = forwardRef<HTMLInputElement, Props>(\n ({ label, sublabel, error, helperText, required, ...props }, ref) => {\n return (\n <FormControl
|
|
1
|
+
{"version":3,"file":"Input.esm.js","sources":["../../../src/components/common/Input.tsx"],"sourcesContent":["import FormControl from '@mui/material/FormControl';\nimport FormHelperText from '@mui/material/FormHelperText';\nimport FormLabel from '@mui/material/FormLabel';\nimport TextField, { TextFieldProps } from '@mui/material/TextField';\nimport { forwardRef } from 'react';\nimport { formHelperText, formLabel } from './typography';\nimport { commonTextColor, formControlStyles } from '../../utils/style';\n\ntype Props = TextFieldProps & {\n sublabel?: string;\n};\n\nexport const Input = forwardRef<HTMLInputElement, Props>(\n ({ label, sublabel, error, helperText, required, ...props }, ref) => {\n return (\n <FormControl sx={formControlStyles} error={error} required={required}>\n {label && (\n <FormLabel required={required} sx={formLabel}>\n {label}\n </FormLabel>\n )}\n {sublabel && (\n <FormHelperText sx={formHelperText}>{sublabel}</FormHelperText>\n )}\n <TextField\n id=\"filled-multiline-static\"\n error={error}\n multiline\n fullWidth\n variant=\"outlined\"\n inputRef={ref}\n InputProps={{\n sx: theme => ({\n '&.Mui-disabled': {\n color: commonTextColor(theme, true),\n },\n }),\n }}\n {...props}\n />\n {helperText && <FormHelperText>{helperText}</FormHelperText>}\n </FormControl>\n );\n },\n);\n"],"names":[],"mappings":";;;;;;;;;AAYO,MAAM,KAAQ,GAAA,UAAA;AAAA,EACnB,CAAC,EAAE,KAAA,EAAO,QAAU,EAAA,KAAA,EAAO,YAAY,QAAU,EAAA,GAAG,KAAM,EAAA,EAAG,GAAQ,KAAA;AACnE,IAAA,uBACG,IAAA,CAAA,WAAA,EAAA,EAAY,EAAI,EAAA,iBAAA,EAAmB,OAAc,QAC/C,EAAA,QAAA,EAAA;AAAA,MAAA,KAAA,oBACE,GAAA,CAAA,SAAA,EAAA,EAAU,QAAoB,EAAA,EAAA,EAAI,WAChC,QACH,EAAA,KAAA,EAAA,CAAA;AAAA,MAED,QACC,oBAAA,GAAA,CAAC,cAAe,EAAA,EAAA,EAAA,EAAI,gBAAiB,QAAS,EAAA,QAAA,EAAA,CAAA;AAAA,sBAEhD,GAAA;AAAA,QAAC,SAAA;AAAA,QAAA;AAAA,UACC,EAAG,EAAA,yBAAA;AAAA,UACH,KAAA;AAAA,UACA,SAAS,EAAA,IAAA;AAAA,UACT,SAAS,EAAA,IAAA;AAAA,UACT,OAAQ,EAAA,UAAA;AAAA,UACR,QAAU,EAAA,GAAA;AAAA,UACV,UAAY,EAAA;AAAA,YACV,IAAI,CAAU,KAAA,MAAA;AAAA,cACZ,gBAAkB,EAAA;AAAA,gBAChB,KAAA,EAAO,eAAgB,CAAA,KAAA,EAAO,IAAI;AAAA;AACpC,aACF;AAAA,WACF;AAAA,UACC,GAAG;AAAA;AAAA,OACN;AAAA,MACC,UAAA,oBAAe,GAAA,CAAA,cAAA,EAAA,EAAgB,QAAW,EAAA,UAAA,EAAA;AAAA,KAC7C,EAAA,CAAA;AAAA;AAGN;;;;"}
|
|
@@ -1,11 +1,24 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import Typography from '@mui/material/Typography';
|
|
3
3
|
import ReactMarkdown from 'react-markdown';
|
|
4
|
+
import { useTheme } from '@mui/material/styles';
|
|
4
5
|
import 'github-markdown-css/github-markdown.css';
|
|
5
6
|
import remarkBreaks from 'remark-breaks';
|
|
7
|
+
import { commonBackgroundColor, commonTextColor } from '../../utils/style.esm.js';
|
|
6
8
|
|
|
7
|
-
function Markdown({ description }) {
|
|
8
|
-
|
|
9
|
+
function Markdown({ description, disabled = false }) {
|
|
10
|
+
const theme = useTheme();
|
|
11
|
+
return /* @__PURE__ */ jsx(
|
|
12
|
+
Typography,
|
|
13
|
+
{
|
|
14
|
+
className: "markdown-body",
|
|
15
|
+
sx: {
|
|
16
|
+
color: commonTextColor(theme, disabled),
|
|
17
|
+
backgroundColor: commonBackgroundColor(theme, disabled)
|
|
18
|
+
},
|
|
19
|
+
children: /* @__PURE__ */ jsx(ReactMarkdown, { remarkPlugins: [remarkBreaks], children: description })
|
|
20
|
+
}
|
|
21
|
+
);
|
|
9
22
|
}
|
|
10
23
|
|
|
11
24
|
export { Markdown };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Markdown.esm.js","sources":["../../../src/components/common/Markdown.tsx"],"sourcesContent":["import Typography from '@mui/material/Typography';\nimport ReactMarkdown from 'react-markdown';\nimport 'github-markdown-css/github-markdown.css';\nimport remarkBreaks from 'remark-breaks';\n\ntype Props = {\n description: string;\n};\n\nexport function Markdown({ description }: Props) {\n return (\n <Typography
|
|
1
|
+
{"version":3,"file":"Markdown.esm.js","sources":["../../../src/components/common/Markdown.tsx"],"sourcesContent":["import Typography from '@mui/material/Typography';\nimport ReactMarkdown from 'react-markdown';\nimport { useTheme } from '@mui/material/styles';\nimport 'github-markdown-css/github-markdown.css';\nimport remarkBreaks from 'remark-breaks';\nimport { commonTextColor, commonBackgroundColor } from '../../utils/style';\n\ntype Props = {\n description: string;\n disabled?: boolean;\n};\n\nexport function Markdown({ description, disabled = false }: Props) {\n const theme = useTheme();\n\n return (\n <Typography\n className=\"markdown-body\"\n sx={{\n color: commonTextColor(theme, disabled),\n backgroundColor: commonBackgroundColor(theme, disabled),\n }}\n >\n <ReactMarkdown remarkPlugins={[remarkBreaks]}>\n {description}\n </ReactMarkdown>\n </Typography>\n );\n}\n"],"names":[],"mappings":";;;;;;;;AAYO,SAAS,QAAS,CAAA,EAAE,WAAa,EAAA,QAAA,GAAW,OAAgB,EAAA;AACjE,EAAA,MAAM,QAAQ,QAAS,EAAA;AAEvB,EACE,uBAAA,GAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,SAAU,EAAA,eAAA;AAAA,MACV,EAAI,EAAA;AAAA,QACF,KAAA,EAAO,eAAgB,CAAA,KAAA,EAAO,QAAQ,CAAA;AAAA,QACtC,eAAA,EAAiB,qBAAsB,CAAA,KAAA,EAAO,QAAQ;AAAA,OACxD;AAAA,MAEA,8BAAC,aAAc,EAAA,EAAA,aAAA,EAAe,CAAC,YAAY,GACxC,QACH,EAAA,WAAA,EAAA;AAAA;AAAA,GACF;AAEJ;;;;"}
|
|
@@ -5,12 +5,24 @@ import FormHelperText from '@mui/material/FormHelperText';
|
|
|
5
5
|
import FormLabel from '@mui/material/FormLabel';
|
|
6
6
|
import MDEditor from '@uiw/react-md-editor';
|
|
7
7
|
import { formLabel, formHelperText } from './typography.esm.js';
|
|
8
|
+
import { useTheme } from '@mui/material/styles';
|
|
9
|
+
import { formControlStyles, commonBackgroundColor, commonTextColor } from '../../utils/style.esm.js';
|
|
8
10
|
|
|
9
11
|
const MarkdownInput = forwardRef(
|
|
10
|
-
({
|
|
12
|
+
({
|
|
13
|
+
label,
|
|
14
|
+
sublabel,
|
|
15
|
+
error,
|
|
16
|
+
helperText,
|
|
17
|
+
minRows,
|
|
18
|
+
value,
|
|
19
|
+
onMarkdownChange,
|
|
20
|
+
disabled = false
|
|
21
|
+
}, ref) => {
|
|
11
22
|
const [markdownContent, setMarkdownContent] = useState(
|
|
12
23
|
value
|
|
13
24
|
);
|
|
25
|
+
const theme = useTheme();
|
|
14
26
|
useEffect(() => {
|
|
15
27
|
setMarkdownContent(value);
|
|
16
28
|
}, [value]);
|
|
@@ -18,7 +30,7 @@ const MarkdownInput = forwardRef(
|
|
|
18
30
|
setMarkdownContent(newValue || "");
|
|
19
31
|
onMarkdownChange?.(newValue || "");
|
|
20
32
|
};
|
|
21
|
-
return /* @__PURE__ */ jsxs(FormControl, { sx:
|
|
33
|
+
return /* @__PURE__ */ jsxs(FormControl, { sx: formControlStyles, error, children: [
|
|
22
34
|
label && /* @__PURE__ */ jsx(FormLabel, { sx: formLabel, children: label }),
|
|
23
35
|
sublabel && /* @__PURE__ */ jsx(FormHelperText, { sx: formHelperText, children: sublabel }),
|
|
24
36
|
/* @__PURE__ */ jsx(
|
|
@@ -28,7 +40,11 @@ const MarkdownInput = forwardRef(
|
|
|
28
40
|
value: markdownContent,
|
|
29
41
|
onChange: handleMarkdownChange,
|
|
30
42
|
preview: "edit",
|
|
31
|
-
height: minRows ? minRows * 24 : 64
|
|
43
|
+
height: minRows ? minRows * 24 : 64,
|
|
44
|
+
style: {
|
|
45
|
+
color: commonTextColor(theme, disabled),
|
|
46
|
+
backgroundColor: commonBackgroundColor(theme, disabled)
|
|
47
|
+
}
|
|
32
48
|
}
|
|
33
49
|
),
|
|
34
50
|
helperText && /* @__PURE__ */ jsx(FormHelperText, { children: helperText })
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MarkdownInput.esm.js","sources":["../../../src/components/common/MarkdownInput.tsx"],"sourcesContent":["import { forwardRef, useState, useEffect } from 'react';\nimport FormControl from '@mui/material/FormControl';\nimport FormHelperText from '@mui/material/FormHelperText';\nimport FormLabel from '@mui/material/FormLabel';\nimport MDEditor from '@uiw/react-md-editor';\nimport { formHelperText, formLabel } from './typography';\nimport { TextFieldProps } from '@material-ui/core';\n\ntype Props = TextFieldProps & {\n sublabel?: string;\n value?: string;\n onMarkdownChange?: (markdown: string) => void;\n minRows?: number;\n};\n\nexport const MarkdownInput = forwardRef<HTMLDivElement, Props>(\n (\n {
|
|
1
|
+
{"version":3,"file":"MarkdownInput.esm.js","sources":["../../../src/components/common/MarkdownInput.tsx"],"sourcesContent":["import { forwardRef, useState, useEffect } from 'react';\nimport FormControl from '@mui/material/FormControl';\nimport FormHelperText from '@mui/material/FormHelperText';\nimport FormLabel from '@mui/material/FormLabel';\nimport MDEditor from '@uiw/react-md-editor';\nimport { formHelperText, formLabel } from './typography';\nimport { TextFieldProps } from '@material-ui/core';\nimport { useTheme } from '@mui/material/styles';\nimport {\n commonTextColor,\n commonBackgroundColor,\n formControlStyles,\n} from '../../utils/style';\n\ntype Props = TextFieldProps & {\n sublabel?: string;\n value?: string;\n onMarkdownChange?: (markdown: string) => void;\n minRows?: number;\n};\n\nexport const MarkdownInput = forwardRef<HTMLDivElement, Props>(\n (\n {\n label,\n sublabel,\n error,\n helperText,\n minRows,\n value,\n onMarkdownChange,\n disabled = false,\n },\n ref,\n ) => {\n const [markdownContent, setMarkdownContent] = useState<string | undefined>(\n value,\n );\n\n const theme = useTheme();\n\n useEffect(() => {\n setMarkdownContent(value);\n }, [value]);\n\n const handleMarkdownChange = (newValue: string | undefined) => {\n setMarkdownContent(newValue || '');\n onMarkdownChange?.(newValue || '');\n };\n\n return (\n <FormControl sx={formControlStyles} error={error}>\n {label && <FormLabel sx={formLabel}>{label}</FormLabel>}\n {sublabel && (\n <FormHelperText sx={formHelperText}>{sublabel}</FormHelperText>\n )}\n <MDEditor\n ref={ref}\n value={markdownContent}\n onChange={handleMarkdownChange}\n preview=\"edit\"\n height={minRows ? minRows * 24 : 64}\n style={{\n color: commonTextColor(theme, disabled),\n backgroundColor: commonBackgroundColor(theme, disabled),\n }}\n />\n {helperText && <FormHelperText>{helperText}</FormHelperText>}\n </FormControl>\n );\n },\n);\n"],"names":[],"mappings":";;;;;;;;;;AAqBO,MAAM,aAAgB,GAAA,UAAA;AAAA,EAC3B,CACE;AAAA,IACE,KAAA;AAAA,IACA,QAAA;AAAA,IACA,KAAA;AAAA,IACA,UAAA;AAAA,IACA,OAAA;AAAA,IACA,KAAA;AAAA,IACA,gBAAA;AAAA,IACA,QAAW,GAAA;AAAA,KAEb,GACG,KAAA;AACH,IAAM,MAAA,CAAC,eAAiB,EAAA,kBAAkB,CAAI,GAAA,QAAA;AAAA,MAC5C;AAAA,KACF;AAEA,IAAA,MAAM,QAAQ,QAAS,EAAA;AAEvB,IAAA,SAAA,CAAU,MAAM;AACd,MAAA,kBAAA,CAAmB,KAAK,CAAA;AAAA,KAC1B,EAAG,CAAC,KAAK,CAAC,CAAA;AAEV,IAAM,MAAA,oBAAA,GAAuB,CAAC,QAAiC,KAAA;AAC7D,MAAA,kBAAA,CAAmB,YAAY,EAAE,CAAA;AACjC,MAAA,gBAAA,GAAmB,YAAY,EAAE,CAAA;AAAA,KACnC;AAEA,IAAA,uBACG,IAAA,CAAA,WAAA,EAAA,EAAY,EAAI,EAAA,iBAAA,EAAmB,KACjC,EAAA,QAAA,EAAA;AAAA,MAAA,KAAA,oBAAU,GAAA,CAAA,SAAA,EAAA,EAAU,EAAI,EAAA,SAAA,EAAY,QAAM,EAAA,KAAA,EAAA,CAAA;AAAA,MAC1C,QACC,oBAAA,GAAA,CAAC,cAAe,EAAA,EAAA,EAAA,EAAI,gBAAiB,QAAS,EAAA,QAAA,EAAA,CAAA;AAAA,sBAEhD,GAAA;AAAA,QAAC,QAAA;AAAA,QAAA;AAAA,UACC,GAAA;AAAA,UACA,KAAO,EAAA,eAAA;AAAA,UACP,QAAU,EAAA,oBAAA;AAAA,UACV,OAAQ,EAAA,MAAA;AAAA,UACR,MAAA,EAAQ,OAAU,GAAA,OAAA,GAAU,EAAK,GAAA,EAAA;AAAA,UACjC,KAAO,EAAA;AAAA,YACL,KAAA,EAAO,eAAgB,CAAA,KAAA,EAAO,QAAQ,CAAA;AAAA,YACtC,eAAA,EAAiB,qBAAsB,CAAA,KAAA,EAAO,QAAQ;AAAA;AACxD;AAAA,OACF;AAAA,MACC,UAAA,oBAAe,GAAA,CAAA,cAAA,EAAA,EAAgB,QAAW,EAAA,UAAA,EAAA;AAAA,KAC7C,EAAA,CAAA;AAAA;AAGN;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
2
|
-
import { Box, DialogContentText, Typography, Accordion, AccordionSummary, AccordionDetails, FormLabel, List, ListItem, ListItemText, ListItemSecondaryAction, IconButton, Link,
|
|
2
|
+
import { Box, DialogContentText, Typography, Accordion, AccordionSummary, AccordionDetails, FormLabel, List, ListItem, ListItemText, ListItemSecondaryAction, IconButton, Link, Button, TextField } from '@mui/material';
|
|
3
3
|
import { GcpCryptoKeyMenu } from '../sopsConfigDialog/GcpCryptoKeyMenu.esm.js';
|
|
4
4
|
import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
|
|
5
5
|
import { pluginRiScTranslationRef } from '../../utils/translations.esm.js';
|
|
@@ -49,6 +49,10 @@ function ConfigEncryptionDialog({
|
|
|
49
49
|
}
|
|
50
50
|
return gcpCryptoKeys[0];
|
|
51
51
|
});
|
|
52
|
+
const [isAddPublicAgeKeyVisible, setIsAddPublicAgeKeyVisible] = useState(false);
|
|
53
|
+
function showAddPublicAgeKey() {
|
|
54
|
+
setIsAddPublicAgeKeyVisible(true);
|
|
55
|
+
}
|
|
52
56
|
useEffect(() => {
|
|
53
57
|
setValue("sopsConfig", {
|
|
54
58
|
shamir_threshold: 2,
|
|
@@ -112,20 +116,31 @@ function ConfigEncryptionDialog({
|
|
|
112
116
|
),
|
|
113
117
|
/* @__PURE__ */ jsx(AccordionDetails, { children: /* @__PURE__ */ jsxs(Box, { children: [
|
|
114
118
|
publicAgeKeys.length > 0 && /* @__PURE__ */ jsx(FormLabel, { children: t("sopsConfigDialog.publicAgeKeysAlreadyPresent") }),
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
119
|
+
publicAgeKeys.length > 0 && /* @__PURE__ */ jsx(
|
|
120
|
+
Box,
|
|
121
|
+
{
|
|
122
|
+
sx: {
|
|
123
|
+
border: "1px solid",
|
|
124
|
+
borderColor: (theme) => theme.palette.mode === "dark" ? "white" : "grey.300",
|
|
125
|
+
borderRadius: "4px",
|
|
126
|
+
marginBottom: 2
|
|
127
|
+
},
|
|
128
|
+
children: /* @__PURE__ */ jsx(List, { children: publicAgeKeys.map((key) => /* @__PURE__ */ jsxs(ListItem, { dense: true, children: [
|
|
129
|
+
/* @__PURE__ */ jsx(ListItemText, { children: key }),
|
|
130
|
+
/* @__PURE__ */ jsx(ListItemSecondaryAction, { children: /* @__PURE__ */ jsx(
|
|
131
|
+
IconButton,
|
|
132
|
+
{
|
|
133
|
+
onClick: () => {
|
|
134
|
+
setPublicAgeKeys(
|
|
135
|
+
publicAgeKeys.filter((k) => k !== key)
|
|
136
|
+
);
|
|
137
|
+
},
|
|
138
|
+
children: /* @__PURE__ */ jsx(DeleteIcon, {})
|
|
139
|
+
}
|
|
140
|
+
) })
|
|
141
|
+
] }, key)) })
|
|
142
|
+
}
|
|
143
|
+
),
|
|
129
144
|
/* @__PURE__ */ jsxs(Typography, { children: [
|
|
130
145
|
t("dictionary.click"),
|
|
131
146
|
" ",
|
|
@@ -153,41 +168,67 @@ function ConfigEncryptionDialog({
|
|
|
153
168
|
display: "flex",
|
|
154
169
|
flexDirection: "column",
|
|
155
170
|
alignItems: "space-between",
|
|
156
|
-
gap: 2
|
|
171
|
+
gap: 2,
|
|
172
|
+
marginTop: 2
|
|
157
173
|
},
|
|
158
174
|
children: [
|
|
159
|
-
/* @__PURE__ */ jsx(
|
|
160
|
-
TextField,
|
|
161
|
-
{
|
|
162
|
-
label: t("sopsConfigDialog.publicAgeKey"),
|
|
163
|
-
helperText: publicAgeKeyHelperText,
|
|
164
|
-
error: publicAgeKeyError,
|
|
165
|
-
onKeyDown: (e) => {
|
|
166
|
-
if (e.key === "Enter") {
|
|
167
|
-
handleAddPublicAgeKey();
|
|
168
|
-
}
|
|
169
|
-
},
|
|
170
|
-
onFocus: () => {
|
|
171
|
-
setPublicKeyTextFieldError(false);
|
|
172
|
-
setPublicKeyTextFieldHelperText("");
|
|
173
|
-
},
|
|
174
|
-
value: newPublicAgeKey,
|
|
175
|
-
onChange: (e) => setNewPublicAgeKey(e.target.value)
|
|
176
|
-
}
|
|
177
|
-
),
|
|
178
|
-
/* @__PURE__ */ jsx(
|
|
175
|
+
!isAddPublicAgeKeyVisible && /* @__PURE__ */ jsx(
|
|
179
176
|
Button,
|
|
180
177
|
{
|
|
181
178
|
startIcon: /* @__PURE__ */ jsx(AddCircle, {}),
|
|
182
179
|
variant: "text",
|
|
183
180
|
color: "primary",
|
|
184
|
-
onClick:
|
|
181
|
+
onClick: showAddPublicAgeKey,
|
|
185
182
|
sx: {
|
|
186
183
|
maxWidth: 200,
|
|
187
184
|
mt: 1
|
|
188
185
|
},
|
|
189
186
|
children: t("sopsConfigDialog.addPublicAgeKey")
|
|
190
187
|
}
|
|
188
|
+
),
|
|
189
|
+
isAddPublicAgeKeyVisible && /* @__PURE__ */ jsxs(
|
|
190
|
+
Box,
|
|
191
|
+
{
|
|
192
|
+
sx: {
|
|
193
|
+
display: "flex",
|
|
194
|
+
alignItems: "center",
|
|
195
|
+
gap: 1
|
|
196
|
+
},
|
|
197
|
+
children: [
|
|
198
|
+
/* @__PURE__ */ jsx(
|
|
199
|
+
TextField,
|
|
200
|
+
{
|
|
201
|
+
label: t("sopsConfigDialog.publicAgeKey"),
|
|
202
|
+
helperText: publicAgeKeyHelperText,
|
|
203
|
+
error: publicAgeKeyError,
|
|
204
|
+
onKeyDown: (e) => {
|
|
205
|
+
if (e.key === "Enter") {
|
|
206
|
+
handleAddPublicAgeKey();
|
|
207
|
+
}
|
|
208
|
+
},
|
|
209
|
+
onFocus: () => {
|
|
210
|
+
setPublicKeyTextFieldError(false);
|
|
211
|
+
setPublicKeyTextFieldHelperText("");
|
|
212
|
+
},
|
|
213
|
+
value: newPublicAgeKey,
|
|
214
|
+
onChange: (e) => setNewPublicAgeKey(e.target.value),
|
|
215
|
+
sx: { flex: 1 }
|
|
216
|
+
}
|
|
217
|
+
),
|
|
218
|
+
/* @__PURE__ */ jsx(
|
|
219
|
+
Button,
|
|
220
|
+
{
|
|
221
|
+
variant: "contained",
|
|
222
|
+
color: "primary",
|
|
223
|
+
onClick: handleAddPublicAgeKey,
|
|
224
|
+
sx: {
|
|
225
|
+
maxWidth: 200
|
|
226
|
+
},
|
|
227
|
+
children: t("sopsConfigDialog.addPublicAgeKey")
|
|
228
|
+
}
|
|
229
|
+
)
|
|
230
|
+
]
|
|
231
|
+
}
|
|
191
232
|
)
|
|
192
233
|
]
|
|
193
234
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigEncryptionDialog.esm.js","sources":["../../../src/components/riScDialog/ConfigEncryptionDialog.tsx"],"sourcesContent":["import {\n Accordion,\n AccordionDetails,\n AccordionSummary,\n Box,\n Button,\n DialogContentText,\n FormLabel,\n IconButton,\n Link,\n List,\n ListItem,\n ListItemSecondaryAction,\n ListItemText,\n TextField,\n Typography,\n} from '@mui/material';\nimport { GcpCryptoKeyMenu } from '../sopsConfigDialog/GcpCryptoKeyMenu';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { pluginRiScTranslationRef } from '../../utils/translations';\nimport { AddCircle, ExpandMore } from '@mui/icons-material';\nimport DeleteIcon from '@mui/icons-material/Delete';\nimport { GcpCryptoKeyObject, SopsConfigDTO } from '../../utils/DTOs';\nimport { useEffect, useState } from 'react';\nimport { RiScWithMetadata } from '../../utils/types';\nimport { UseFormRegister, UseFormSetValue } from 'react-hook-form';\nimport { RiScDialogStates } from './RiScDialog';\nimport { isPublicAgeKeyValid } from '../../utils/utilityfunctions';\nimport { FieldErrors } from 'react-hook-form/dist/types/errors';\nimport FormHelperText from '@mui/material/FormHelperText';\nimport { URLS } from '../../urls';\n\ninterface ConfigEncryptionDialogProps {\n gcpCryptoKeys: GcpCryptoKeyObject[];\n sopsData?: SopsConfigDTO;\n setValue: UseFormSetValue<RiScWithMetadata>;\n register: UseFormRegister<RiScWithMetadata>;\n errors: FieldErrors<RiScWithMetadata>;\n state: RiScDialogStates;\n}\n\nfunction ConfigEncryptionDialog({\n gcpCryptoKeys,\n sopsData,\n setValue,\n register,\n errors,\n state,\n}: ConfigEncryptionDialogProps) {\n const { t } = useTranslationRef(pluginRiScTranslationRef);\n const [publicAgeKeyHelperText, setPublicKeyTextFieldHelperText] =\n useState('');\n const [publicAgeKeyError, setPublicKeyTextFieldError] = useState(false);\n const [newPublicAgeKey, setNewPublicAgeKey] = useState('');\n const [publicAgeKeys, setPublicAgeKeys] = useState<string[]>(() => {\n if (sopsData?.age) {\n return sopsData.age.map(age => age.recipient);\n }\n return [];\n });\n\n const [chosenGcpCryptoKey, setChosenGcpCryptoKey] =\n useState<GcpCryptoKeyObject>(() => {\n if (state === RiScDialogStates.EditEncryption && sopsData?.gcp_kms) {\n const gcpKms = sopsData.gcp_kms[0];\n if (gcpKms?.resource_id) {\n const resourceParts = gcpKms.resource_id.split('/');\n if (resourceParts.length === 8) {\n return {\n projectId: resourceParts[1],\n keyRing: resourceParts[5],\n keyName: resourceParts[7],\n locations: resourceParts[3],\n resourceId: gcpKms.resource_id,\n createdAt: gcpKms.created_at,\n hasEncryptDecryptAccess: true,\n };\n }\n }\n }\n return gcpCryptoKeys[0];\n });\n\n useEffect(() => {\n setValue('sopsConfig', {\n shamir_threshold: 2,\n gcp_kms: chosenGcpCryptoKey\n ? [\n {\n resource_id: chosenGcpCryptoKey.resourceId,\n created_at: chosenGcpCryptoKey.createdAt,\n },\n ]\n : [],\n age: publicAgeKeys.map(key => ({ recipient: key })),\n });\n }, [chosenGcpCryptoKey, publicAgeKeys, setValue]);\n\n // Require one key group to contain a GCP key\n register('sopsConfig.gcp_kms', {\n validate: gcpKeys => gcpKeys.length > 0,\n });\n\n function handleChangeGcpCryptoKey(newKey: GcpCryptoKeyObject) {\n setChosenGcpCryptoKey(newKey);\n }\n\n function handleAddPublicAgeKey() {\n if (isPublicAgeKeyValid(newPublicAgeKey)) {\n if (publicAgeKeys.includes(newPublicAgeKey)) {\n setPublicKeyTextFieldHelperText(\n t('sopsConfigDialog.publicKeyHelperTextKeyAlreadyExistInSopsConfig'),\n );\n setPublicKeyTextFieldError(true);\n } else {\n setPublicAgeKeys([...publicAgeKeys, newPublicAgeKey]);\n setNewPublicAgeKey('');\n }\n } else {\n setPublicKeyTextFieldHelperText(\n t('sopsConfigDialog.publicKeyHelperTextKeyNotValid'),\n );\n setPublicKeyTextFieldError(true);\n }\n }\n\n return (\n <Box sx={{ display: 'flex', flexDirection: 'column', gap: '16px' }}>\n <DialogContentText>\n {state === RiScDialogStates.Create\n ? t('sopsConfigDialog.description.new')\n : t('sopsConfigDialog.description.edit')}\n </DialogContentText>\n <Typography variant=\"subtitle2\">\n {t('sopsConfigDialog.selectKeysTitle')}\n </Typography>\n\n {chosenGcpCryptoKey !== undefined ? (\n <>\n {t('sopsConfigDialog.gcpCryptoKeyDescription')}\n <GcpCryptoKeyMenu\n chosenGcpCryptoKey={chosenGcpCryptoKey}\n onChange={handleChangeGcpCryptoKey}\n gcpCryptoKeys={\n gcpCryptoKeys.includes(chosenGcpCryptoKey)\n ? gcpCryptoKeys\n : [...gcpCryptoKeys, chosenGcpCryptoKey]\n }\n />\n </>\n ) : (\n <Typography variant=\"body1\">\n {t('sopsConfigDialog.gcpCryptoKeyNoSelectableKey')}\n </Typography>\n )}\n {errors.sopsConfig !== undefined && (\n <FormHelperText error={true}>\n {t('sopsConfigDialog.gcpCryptoKeyNonSelectedErrorMessage')}\n </FormHelperText>\n )}\n <Box>\n <Accordion elevation={1} defaultExpanded={publicAgeKeys.length > 0}>\n <AccordionSummary\n expandIcon={<ExpandMore />}\n aria-controls=\"panel1-content\"\n id=\"panel1-header\"\n >\n {t('sopsConfigDialog.publicAgeKeyQuestion')}\n </AccordionSummary>\n <AccordionDetails>\n <Box>\n {publicAgeKeys.length > 0 && (\n <FormLabel>\n {t('sopsConfigDialog.publicAgeKeysAlreadyPresent')}\n </FormLabel>\n )}\n <List>\n {publicAgeKeys.map(key => (\n <ListItem key={key} dense>\n <ListItemText>{key}</ListItemText>\n <ListItemSecondaryAction>\n <IconButton\n onClick={() => {\n setPublicAgeKeys(\n publicAgeKeys.filter(k => k !== key),\n );\n }}\n >\n <DeleteIcon />\n </IconButton>\n </ListItemSecondaryAction>\n </ListItem>\n ))}\n </List>\n <Typography>\n {t('dictionary.click')}{' '}\n <Link\n href={\n URLS.external.kartverket_atlassian_net__write_ros_locally\n }\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n color=\"primary\"\n underline=\"hover\"\n >\n {t('dictionary.here')}\n </Link>{' '}\n {t('sopsConfigDialog.writeLocalRiscSuffix')}\n </Typography>\n <Typography>\n {`${t('sopsConfigDialog.publicAgeKeyDescription')} (${t(\n 'dictionary.optional',\n )})`}\n </Typography>\n <Box\n sx={{\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'space-between',\n gap: 2,\n }}\n >\n <TextField\n label={t('sopsConfigDialog.publicAgeKey')}\n helperText={publicAgeKeyHelperText}\n error={publicAgeKeyError}\n onKeyDown={e => {\n if (e.key === 'Enter') {\n handleAddPublicAgeKey();\n }\n }}\n onFocus={() => {\n setPublicKeyTextFieldError(false);\n setPublicKeyTextFieldHelperText('');\n }}\n value={newPublicAgeKey}\n onChange={e => setNewPublicAgeKey(e.target.value)}\n />\n <Button\n startIcon={<AddCircle />}\n variant=\"text\"\n color=\"primary\"\n onClick={handleAddPublicAgeKey}\n sx={{\n maxWidth: 200,\n mt: 1,\n }}\n >\n {t('sopsConfigDialog.addPublicAgeKey')}\n </Button>\n </Box>\n </Box>\n </AccordionDetails>\n </Accordion>\n </Box>\n </Box>\n );\n}\n\nexport default ConfigEncryptionDialog;\n"],"names":[],"mappings":";;;;;;;;;;;;;AAyCA,SAAS,sBAAuB,CAAA;AAAA,EAC9B,aAAA;AAAA,EACA,QAAA;AAAA,EACA,QAAA;AAAA,EACA,QAAA;AAAA,EACA,MAAA;AAAA,EACA;AACF,CAAgC,EAAA;AAC9B,EAAA,MAAM,EAAE,CAAA,EAAM,GAAA,iBAAA,CAAkB,wBAAwB,CAAA;AACxD,EAAA,MAAM,CAAC,sBAAA,EAAwB,+BAA+B,CAAA,GAC5D,SAAS,EAAE,CAAA;AACb,EAAA,MAAM,CAAC,iBAAA,EAAmB,0BAA0B,CAAA,GAAI,SAAS,KAAK,CAAA;AACtE,EAAA,MAAM,CAAC,eAAA,EAAiB,kBAAkB,CAAA,GAAI,SAAS,EAAE,CAAA;AACzD,EAAA,MAAM,CAAC,aAAA,EAAe,gBAAgB,CAAA,GAAI,SAAmB,MAAM;AACjE,IAAA,IAAI,UAAU,GAAK,EAAA;AACjB,MAAA,OAAO,QAAS,CAAA,GAAA,CAAI,GAAI,CAAA,CAAA,GAAA,KAAO,IAAI,SAAS,CAAA;AAAA;AAE9C,IAAA,OAAO,EAAC;AAAA,GACT,CAAA;AAED,EAAA,MAAM,CAAC,kBAAA,EAAoB,qBAAqB,CAAA,GAC9C,SAA6B,MAAM;AACjC,IAAA,IAAI,KAAU,KAAA,gBAAA,CAAiB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;AAAA,kBACA,SAAS,MAAM;AACb,oBAAA,0BAAA,CAA2B,KAAK,CAAA;AAChC,oBAAA,+BAAA,CAAgC,EAAE,CAAA;AAAA,mBACpC;AAAA,kBACA,KAAO,EAAA,eAAA;AAAA,kBACP,QAAU,EAAA,CAAA,CAAA,KAAK,kBAAmB,CAAA,CAAA,CAAE,OAAO,KAAK;AAAA;AAAA,eAClD;AAAA,8BACA,GAAA;AAAA,gBAAC,MAAA;AAAA,gBAAA;AAAA,kBACC,SAAA,sBAAY,SAAU,EAAA,EAAA,CAAA;AAAA,kBACtB,OAAQ,EAAA,MAAA;AAAA,kBACR,KAAM,EAAA,SAAA;AAAA,kBACN,OAAS,EAAA,qBAAA;AAAA,kBACT,EAAI,EAAA;AAAA,oBACF,QAAU,EAAA,GAAA;AAAA,oBACV,EAAI,EAAA;AAAA,mBACN;AAAA,kBAEC,YAAE,kCAAkC;AAAA;AAAA;AACvC;AAAA;AAAA;AACF,OAAA,EACF,CACF,EAAA;AAAA,KAAA,EACF,CACF,EAAA;AAAA,GACF,EAAA,CAAA;AAEJ;;;;"}
|
|
1
|
+
{"version":3,"file":"ConfigEncryptionDialog.esm.js","sources":["../../../src/components/riScDialog/ConfigEncryptionDialog.tsx"],"sourcesContent":["import {\n Accordion,\n AccordionDetails,\n AccordionSummary,\n Box,\n Button,\n DialogContentText,\n FormLabel,\n IconButton,\n Link,\n List,\n ListItem,\n ListItemSecondaryAction,\n ListItemText,\n TextField,\n Typography,\n} from '@mui/material';\nimport { GcpCryptoKeyMenu } from '../sopsConfigDialog/GcpCryptoKeyMenu';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { pluginRiScTranslationRef } from '../../utils/translations';\nimport { AddCircle, ExpandMore } from '@mui/icons-material';\nimport DeleteIcon from '@mui/icons-material/Delete';\nimport { GcpCryptoKeyObject, SopsConfigDTO } from '../../utils/DTOs';\nimport { useEffect, useState } from 'react';\nimport { RiScWithMetadata } from '../../utils/types';\nimport { UseFormRegister, UseFormSetValue } from 'react-hook-form';\nimport { RiScDialogStates } from './RiScDialog';\nimport { isPublicAgeKeyValid } from '../../utils/utilityfunctions';\nimport { FieldErrors } from 'react-hook-form/dist/types/errors';\nimport FormHelperText from '@mui/material/FormHelperText';\nimport { URLS } from '../../urls';\n\ninterface ConfigEncryptionDialogProps {\n gcpCryptoKeys: GcpCryptoKeyObject[];\n sopsData?: SopsConfigDTO;\n setValue: UseFormSetValue<RiScWithMetadata>;\n register: UseFormRegister<RiScWithMetadata>;\n errors: FieldErrors<RiScWithMetadata>;\n state: RiScDialogStates;\n}\n\nfunction ConfigEncryptionDialog({\n gcpCryptoKeys,\n sopsData,\n setValue,\n register,\n errors,\n state,\n}: ConfigEncryptionDialogProps) {\n const { t } = useTranslationRef(pluginRiScTranslationRef);\n const [publicAgeKeyHelperText, setPublicKeyTextFieldHelperText] =\n useState('');\n const [publicAgeKeyError, setPublicKeyTextFieldError] = useState(false);\n const [newPublicAgeKey, setNewPublicAgeKey] = useState('');\n const [publicAgeKeys, setPublicAgeKeys] = useState<string[]>(() => {\n if (sopsData?.age) {\n return sopsData.age.map(age => age.recipient);\n }\n return [];\n });\n\n const [chosenGcpCryptoKey, setChosenGcpCryptoKey] =\n useState<GcpCryptoKeyObject>(() => {\n if (state === RiScDialogStates.EditEncryption && sopsData?.gcp_kms) {\n const gcpKms = sopsData.gcp_kms[0];\n if (gcpKms?.resource_id) {\n const resourceParts = gcpKms.resource_id.split('/');\n if (resourceParts.length === 8) {\n return {\n projectId: resourceParts[1],\n keyRing: resourceParts[5],\n keyName: resourceParts[7],\n locations: resourceParts[3],\n resourceId: gcpKms.resource_id,\n createdAt: gcpKms.created_at,\n hasEncryptDecryptAccess: true,\n };\n }\n }\n }\n return gcpCryptoKeys[0];\n });\n\n const [isAddPublicAgeKeyVisible, setIsAddPublicAgeKeyVisible] =\n useState(false);\n\n function showAddPublicAgeKey() {\n setIsAddPublicAgeKeyVisible(true);\n }\n\n useEffect(() => {\n setValue('sopsConfig', {\n shamir_threshold: 2,\n gcp_kms: chosenGcpCryptoKey\n ? [\n {\n resource_id: chosenGcpCryptoKey.resourceId,\n created_at: chosenGcpCryptoKey.createdAt,\n },\n ]\n : [],\n age: publicAgeKeys.map(key => ({ recipient: key })),\n });\n }, [chosenGcpCryptoKey, publicAgeKeys, setValue]);\n\n // Require one key group to contain a GCP key\n register('sopsConfig.gcp_kms', {\n validate: gcpKeys => gcpKeys.length > 0,\n });\n\n function handleChangeGcpCryptoKey(newKey: GcpCryptoKeyObject) {\n setChosenGcpCryptoKey(newKey);\n }\n\n function handleAddPublicAgeKey() {\n if (isPublicAgeKeyValid(newPublicAgeKey)) {\n if (publicAgeKeys.includes(newPublicAgeKey)) {\n setPublicKeyTextFieldHelperText(\n t('sopsConfigDialog.publicKeyHelperTextKeyAlreadyExistInSopsConfig'),\n );\n setPublicKeyTextFieldError(true);\n } else {\n setPublicAgeKeys([...publicAgeKeys, newPublicAgeKey]);\n setNewPublicAgeKey('');\n }\n } else {\n setPublicKeyTextFieldHelperText(\n t('sopsConfigDialog.publicKeyHelperTextKeyNotValid'),\n );\n setPublicKeyTextFieldError(true);\n }\n }\n\n return (\n <Box sx={{ display: 'flex', flexDirection: 'column', gap: '16px' }}>\n <DialogContentText>\n {state === RiScDialogStates.Create\n ? t('sopsConfigDialog.description.new')\n : t('sopsConfigDialog.description.edit')}\n </DialogContentText>\n <Typography variant=\"subtitle2\">\n {t('sopsConfigDialog.selectKeysTitle')}\n </Typography>\n\n {chosenGcpCryptoKey !== undefined ? (\n <>\n {t('sopsConfigDialog.gcpCryptoKeyDescription')}\n <GcpCryptoKeyMenu\n chosenGcpCryptoKey={chosenGcpCryptoKey}\n onChange={handleChangeGcpCryptoKey}\n gcpCryptoKeys={\n gcpCryptoKeys.includes(chosenGcpCryptoKey)\n ? gcpCryptoKeys\n : [...gcpCryptoKeys, chosenGcpCryptoKey]\n }\n />\n </>\n ) : (\n <Typography variant=\"body1\">\n {t('sopsConfigDialog.gcpCryptoKeyNoSelectableKey')}\n </Typography>\n )}\n {errors.sopsConfig !== undefined && (\n <FormHelperText error={true}>\n {t('sopsConfigDialog.gcpCryptoKeyNonSelectedErrorMessage')}\n </FormHelperText>\n )}\n <Box>\n <Accordion elevation={1} defaultExpanded={publicAgeKeys.length > 0}>\n <AccordionSummary\n expandIcon={<ExpandMore />}\n aria-controls=\"panel1-content\"\n id=\"panel1-header\"\n >\n {t('sopsConfigDialog.publicAgeKeyQuestion')}\n </AccordionSummary>\n <AccordionDetails>\n <Box>\n {publicAgeKeys.length > 0 && (\n <FormLabel>\n {t('sopsConfigDialog.publicAgeKeysAlreadyPresent')}\n </FormLabel>\n )}\n {publicAgeKeys.length > 0 && (\n <Box\n sx={{\n border: '1px solid',\n borderColor: theme =>\n theme.palette.mode === 'dark' ? 'white' : 'grey.300',\n borderRadius: '4px',\n marginBottom: 2,\n }}\n >\n <List>\n {publicAgeKeys.map(key => (\n <ListItem key={key} dense>\n <ListItemText>{key}</ListItemText>\n <ListItemSecondaryAction>\n <IconButton\n onClick={() => {\n setPublicAgeKeys(\n publicAgeKeys.filter(k => k !== key),\n );\n }}\n >\n <DeleteIcon />\n </IconButton>\n </ListItemSecondaryAction>\n </ListItem>\n ))}\n </List>\n </Box>\n )}\n <Typography>\n {t('dictionary.click')}{' '}\n <Link\n href={\n URLS.external.kartverket_atlassian_net__write_ros_locally\n }\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n color=\"primary\"\n underline=\"hover\"\n >\n {t('dictionary.here')}\n </Link>{' '}\n {t('sopsConfigDialog.writeLocalRiscSuffix')}\n </Typography>\n <Typography>\n {`${t('sopsConfigDialog.publicAgeKeyDescription')} (${t(\n 'dictionary.optional',\n )})`}\n </Typography>\n <Box\n sx={{\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'space-between',\n gap: 2,\n marginTop: 2,\n }}\n >\n {!isAddPublicAgeKeyVisible && (\n <Button\n startIcon={<AddCircle />}\n variant=\"text\"\n color=\"primary\"\n onClick={showAddPublicAgeKey}\n sx={{\n maxWidth: 200,\n mt: 1,\n }}\n >\n {t('sopsConfigDialog.addPublicAgeKey')}\n </Button>\n )}\n {isAddPublicAgeKeyVisible && (\n <Box\n sx={{\n display: 'flex',\n alignItems: 'center',\n gap: 1,\n }}\n >\n <TextField\n label={t('sopsConfigDialog.publicAgeKey')}\n helperText={publicAgeKeyHelperText}\n error={publicAgeKeyError}\n onKeyDown={e => {\n if (e.key === 'Enter') {\n handleAddPublicAgeKey();\n }\n }}\n onFocus={() => {\n setPublicKeyTextFieldError(false);\n setPublicKeyTextFieldHelperText('');\n }}\n value={newPublicAgeKey}\n onChange={e => setNewPublicAgeKey(e.target.value)}\n sx={{ flex: 1 }}\n />\n <Button\n variant=\"contained\"\n color=\"primary\"\n onClick={handleAddPublicAgeKey}\n sx={{\n maxWidth: 200,\n }}\n >\n {t('sopsConfigDialog.addPublicAgeKey')}\n </Button>\n </Box>\n )}\n </Box>\n </Box>\n </AccordionDetails>\n </Accordion>\n </Box>\n </Box>\n );\n}\n\nexport default ConfigEncryptionDialog;\n"],"names":[],"mappings":";;;;;;;;;;;;;AAyCA,SAAS,sBAAuB,CAAA;AAAA,EAC9B,aAAA;AAAA,EACA,QAAA;AAAA,EACA,QAAA;AAAA,EACA,QAAA;AAAA,EACA,MAAA;AAAA,EACA;AACF,CAAgC,EAAA;AAC9B,EAAA,MAAM,EAAE,CAAA,EAAM,GAAA,iBAAA,CAAkB,wBAAwB,CAAA;AACxD,EAAA,MAAM,CAAC,sBAAA,EAAwB,+BAA+B,CAAA,GAC5D,SAAS,EAAE,CAAA;AACb,EAAA,MAAM,CAAC,iBAAA,EAAmB,0BAA0B,CAAA,GAAI,SAAS,KAAK,CAAA;AACtE,EAAA,MAAM,CAAC,eAAA,EAAiB,kBAAkB,CAAA,GAAI,SAAS,EAAE,CAAA;AACzD,EAAA,MAAM,CAAC,aAAA,EAAe,gBAAgB,CAAA,GAAI,SAAmB,MAAM;AACjE,IAAA,IAAI,UA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AAA,KAAA;AACd,0BAAI,IAAA,CAAA,CAAE,QAAQ,OAAS,EAAA;AACrB,4BAAsB,qBAAA,EAAA;AAAA;AACxB,yBACF;AAAA,wBACA,SAAS,MAAM;AACb,0BAAA,0BAAA,CAA2B,KAAK,CAAA;AAChC,0BAAA,+BAAA,CAAgC,EAAE,CAAA;AAAA,yBACpC;AAAA,wBACA,KAAO,EAAA,eAAA;AAAA,wBACP,QAAU,EAAA,CAAA,CAAA,KAAK,kBAAmB,CAAA,CAAA,CAAE,OAAO,KAAK,CAAA;AAAA,wBAChD,EAAA,EAAI,EAAE,IAAA,EAAM,CAAE;AAAA;AAAA,qBAChB;AAAA,oCACA,GAAA;AAAA,sBAAC,MAAA;AAAA,sBAAA;AAAA,wBACC,OAAQ,EAAA,WAAA;AAAA,wBACR,KAAM,EAAA,SAAA;AAAA,wBACN,OAAS,EAAA,qBAAA;AAAA,wBACT,EAAI,EAAA;AAAA,0BACF,QAAU,EAAA;AAAA,yBACZ;AAAA,wBAEC,YAAE,kCAAkC;AAAA;AAAA;AACvC;AAAA;AAAA;AACF;AAAA;AAAA;AAEJ,OAAA,EACF,CACF,EAAA;AAAA,KAAA,EACF,CACF,EAAA;AAAA,GACF,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -29,14 +29,14 @@ function ConfigRiscInfo({
|
|
|
29
29
|
...register("content.title", { required: true }),
|
|
30
30
|
error: errors?.content?.title !== void 0,
|
|
31
31
|
label: t("dictionary.title"),
|
|
32
|
-
minRows: 4
|
|
32
|
+
minRows: 4,
|
|
33
|
+
helperText: errors?.content?.title && t("rosDialog.titleError")
|
|
33
34
|
}
|
|
34
35
|
),
|
|
35
36
|
/* @__PURE__ */ jsx(
|
|
36
37
|
MarkdownInput,
|
|
37
38
|
{
|
|
38
|
-
|
|
39
|
-
...register("content.scope", { required: true }),
|
|
39
|
+
...register("content.scope"),
|
|
40
40
|
value: currentScope,
|
|
41
41
|
label: t("dictionary.scope"),
|
|
42
42
|
sublabel: t("rosDialog.scopeDescription"),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigRiscInfo.esm.js","sources":["../../../src/components/riScDialog/ConfigRiscInfo.tsx"],"sourcesContent":["import { MarkdownInput } from '../common/MarkdownInput';\nimport { Input } from '../common/Input';\nimport {\n UseFormRegister,\n UseFormSetValue,\n UseFormWatch,\n} from 'react-hook-form/dist/types/form';\nimport { RiScWithMetadata } from '../../utils/types';\nimport { CreateRiScFrom, RiScDialogStates } from './RiScDialog';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { pluginRiScTranslationRef } from '../../utils/translations';\nimport Box from '@mui/material/Box';\nimport FormControlLabel from '@mui/material/FormControlLabel';\nimport Switch from '@mui/material/Switch';\nimport Typography from '@mui/material/Typography';\nimport { DialogContentText } from '@mui/material';\nimport { FieldErrors } from 'react-hook-form/dist/types/errors';\n\ninterface ConfigRiscInfoProps {\n dialogState: RiScDialogStates;\n createRiScFrom: CreateRiScFrom;\n handleChangeCreateRiScFrom: () => void;\n register: UseFormRegister<RiScWithMetadata>;\n errors: FieldErrors<RiScWithMetadata>;\n setValue: UseFormSetValue<RiScWithMetadata>;\n watch: UseFormWatch<RiScWithMetadata>;\n}\n\nfunction ConfigRiscInfo({\n dialogState,\n createRiScFrom,\n handleChangeCreateRiScFrom,\n register,\n errors,\n setValue,\n watch,\n}: ConfigRiscInfoProps) {\n const { t } = useTranslationRef(pluginRiScTranslationRef);\n\n const currentScope = watch('content.scope');\n\n return (\n <>\n <Input\n required\n {...register('content.title', { required: true })}\n error={errors?.content?.title !== undefined}\n label={t('dictionary.title')}\n minRows={4}\n />\n <MarkdownInput\n
|
|
1
|
+
{"version":3,"file":"ConfigRiscInfo.esm.js","sources":["../../../src/components/riScDialog/ConfigRiscInfo.tsx"],"sourcesContent":["import { MarkdownInput } from '../common/MarkdownInput';\nimport { Input } from '../common/Input';\nimport {\n UseFormRegister,\n UseFormSetValue,\n UseFormWatch,\n} from 'react-hook-form/dist/types/form';\nimport { RiScWithMetadata } from '../../utils/types';\nimport { CreateRiScFrom, RiScDialogStates } from './RiScDialog';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { pluginRiScTranslationRef } from '../../utils/translations';\nimport Box from '@mui/material/Box';\nimport FormControlLabel from '@mui/material/FormControlLabel';\nimport Switch from '@mui/material/Switch';\nimport Typography from '@mui/material/Typography';\nimport { DialogContentText } from '@mui/material';\nimport { FieldErrors } from 'react-hook-form/dist/types/errors';\n\ninterface ConfigRiscInfoProps {\n dialogState: RiScDialogStates;\n createRiScFrom: CreateRiScFrom;\n handleChangeCreateRiScFrom: () => void;\n register: UseFormRegister<RiScWithMetadata>;\n errors: FieldErrors<RiScWithMetadata>;\n setValue: UseFormSetValue<RiScWithMetadata>;\n watch: UseFormWatch<RiScWithMetadata>;\n}\n\nfunction ConfigRiscInfo({\n dialogState,\n createRiScFrom,\n handleChangeCreateRiScFrom,\n register,\n errors,\n setValue,\n watch,\n}: ConfigRiscInfoProps) {\n const { t } = useTranslationRef(pluginRiScTranslationRef);\n\n const currentScope = watch('content.scope');\n\n return (\n <>\n <Input\n required\n {...register('content.title', { required: true })}\n error={errors?.content?.title !== undefined}\n label={t('dictionary.title')}\n minRows={4}\n helperText={errors?.content?.title && t('rosDialog.titleError')}\n />\n <MarkdownInput\n {...register('content.scope')}\n value={currentScope}\n label={t('dictionary.scope')}\n sublabel={t('rosDialog.scopeDescription')}\n error={errors?.content?.scope !== undefined}\n minRows={8}\n onMarkdownChange={value => setValue('content.scope', value)}\n />\n\n {dialogState === RiScDialogStates.Create && (\n <div>\n <DialogContentText>\n {t('rosDialog.generateInitialDescription')}\n </DialogContentText>\n <Box\n sx={{\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'center',\n gap: 4,\n }}\n >\n <Typography\n sx={{\n fontWeight: 'bold',\n }}\n >\n {t('rosDialog.generateInitialToggleDescription')}\n </Typography>\n <FormControlLabel\n control={<Switch onChange={handleChangeCreateRiScFrom} />}\n label={\n createRiScFrom === CreateRiScFrom.Scratch\n ? t('dictionary.no')\n : t('dictionary.yes')\n }\n />\n </Box>\n </div>\n )}\n </>\n );\n}\n\nexport default ConfigRiscInfo;\n"],"names":[],"mappings":";;;;;;;;;;;;AA4BA,SAAS,cAAe,CAAA;AAAA,EACtB,WAAA;AAAA,EACA,cAAA;AAAA,EACA,0BAAA;AAAA,EACA,QAAA;AAAA,EACA,MAAA;AAAA,EACA,QAAA;AAAA,EACA;AACF,CAAwB,EAAA;AACtB,EAAA,MAAM,EAAE,CAAA,EAAM,GAAA,iBAAA,CAAkB,wBAAwB,CAAA;AAExD,EAAM,MAAA,YAAA,GAAe,MAAM,eAAe,CAAA;AAE1C,EAAA,uBAEI,IAAA,CAAA,QAAA,EAAA,EAAA,QAAA,EAAA;AAAA,oBAAA,GAAA;AAAA,MAAC,KAAA;AAAA,MAAA;AAAA,QACC,QAAQ,EAAA,IAAA;AAAA,QACP,GAAG,QAAS,CAAA,eAAA,EAAiB,EAAE,QAAA,EAAU,MAAM,CAAA;AAAA,QAChD,KAAA,EAAO,MAAQ,EAAA,OAAA,EAAS,KAAU,KAAA,MAAA;AAAA,QAClC,KAAA,EAAO,EAAE,kBAAkB,CAAA;AAAA,QAC3B,OAAS,EAAA,CAAA;AAAA,QACT,UAAY,EAAA,MAAA,EAAQ,OAAS,EAAA,KAAA,IAAS,EAAE,sBAAsB;AAAA;AAAA,KAChE;AAAA,oBACA,GAAA;AAAA,MAAC,aAAA;AAAA,MAAA;AAAA,QACE,GAAG,SAAS,eAAe,CAAA;AAAA,QAC5B,KAAO,EAAA,YAAA;AAAA,QACP,KAAA,EAAO,EAAE,kBAAkB,CAAA;AAAA,QAC3B,QAAA,EAAU,EAAE,4BAA4B,CAAA;AAAA,QACxC,KAAA,EAAO,MAAQ,EAAA,OAAA,EAAS,KAAU,KAAA,MAAA;AAAA,QAClC,OAAS,EAAA,CAAA;AAAA,QACT,gBAAkB,EAAA,CAAA,KAAA,KAAS,QAAS,CAAA,eAAA,EAAiB,KAAK;AAAA;AAAA,KAC5D;AAAA,IAEC,WAAgB,KAAA,gBAAA,CAAiB,MAChC,oBAAA,IAAA,CAAC,KACC,EAAA,EAAA,QAAA,EAAA;AAAA,sBAAC,GAAA,CAAA,iBAAA,EAAA,EACE,QAAE,EAAA,CAAA,CAAA,sCAAsC,CAC3C,EAAA,CAAA;AAAA,sBACA,IAAA;AAAA,QAAC,GAAA;AAAA,QAAA;AAAA,UACC,EAAI,EAAA;AAAA,YACF,OAAS,EAAA,MAAA;AAAA,YACT,aAAe,EAAA,KAAA;AAAA,YACf,UAAY,EAAA,QAAA;AAAA,YACZ,GAAK,EAAA;AAAA,WACP;AAAA,UAEA,QAAA,EAAA;AAAA,4BAAA,GAAA;AAAA,cAAC,UAAA;AAAA,cAAA;AAAA,gBACC,EAAI,EAAA;AAAA,kBACF,UAAY,EAAA;AAAA,iBACd;AAAA,gBAEC,YAAE,4CAA4C;AAAA;AAAA,aACjD;AAAA,4BACA,GAAA;AAAA,cAAC,gBAAA;AAAA,cAAA;AAAA,gBACC,OAAS,kBAAA,GAAA,CAAC,MAAO,EAAA,EAAA,QAAA,EAAU,0BAA4B,EAAA,CAAA;AAAA,gBACvD,KAAA,EACE,mBAAmB,cAAe,CAAA,OAAA,GAC9B,EAAE,eAAe,CAAA,GACjB,EAAE,gBAAgB;AAAA;AAAA;AAE1B;AAAA;AAAA;AACF,KACF,EAAA;AAAA,GAEJ,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -65,6 +65,7 @@ const RiScMigrationDialog = ({
|
|
|
65
65
|
) })
|
|
66
66
|
] }),
|
|
67
67
|
/* @__PURE__ */ jsxs(DialogActions, { sx: dialogActions, children: [
|
|
68
|
+
/* @__PURE__ */ jsx(Button, { variant: "outlined", color: "primary", onClick: handleCancel, children: t("dictionary.cancel") }),
|
|
68
69
|
/* @__PURE__ */ jsx(
|
|
69
70
|
Button,
|
|
70
71
|
{
|
|
@@ -73,8 +74,7 @@ const RiScMigrationDialog = ({
|
|
|
73
74
|
disabled: !saveMigration,
|
|
74
75
|
children: t("dictionary.confirm")
|
|
75
76
|
}
|
|
76
|
-
)
|
|
77
|
-
/* @__PURE__ */ jsx(Button, { variant: "outlined", color: "primary", onClick: handleCancel, children: t("dictionary.cancel") })
|
|
77
|
+
)
|
|
78
78
|
] })
|
|
79
79
|
] });
|
|
80
80
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MigrationDialog.esm.js","sources":["../../../src/components/riScInfo/MigrationDialog.tsx"],"sourcesContent":["import { ReactComponentElement, useState } from 'react';\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 FormControlLabel from '@mui/material/FormControlLabel';\nimport Box from '@mui/material/Box';\nimport { pluginRiScTranslationRef } from '../../utils/translations';\nimport { MigrationVersions } from '../../utils/types';\nimport { dialogActions } from '../common/mixins';\nimport { URLS } from '../../urls';\n\ninterface RiScMigrationDialogProps {\n openDialog: boolean;\n handleCancel: () => void;\n handleUpdate: () => void;\n migrationVersions?: MigrationVersions;\n}\n\nexport const 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 function 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={URLS.external.github_com__kartverket_changelog}\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
|
|
1
|
+
{"version":3,"file":"MigrationDialog.esm.js","sources":["../../../src/components/riScInfo/MigrationDialog.tsx"],"sourcesContent":["import { ReactComponentElement, useState } from 'react';\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 FormControlLabel from '@mui/material/FormControlLabel';\nimport Box from '@mui/material/Box';\nimport { pluginRiScTranslationRef } from '../../utils/translations';\nimport { MigrationVersions } from '../../utils/types';\nimport { dialogActions } from '../common/mixins';\nimport { URLS } from '../../urls';\n\ninterface RiScMigrationDialogProps {\n openDialog: boolean;\n handleCancel: () => void;\n handleUpdate: () => void;\n migrationVersions?: MigrationVersions;\n}\n\nexport const 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 function 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={URLS.external.github_com__kartverket_changelog}\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 variant=\"outlined\" color=\"primary\" onClick={handleCancel}>\n {t('dictionary.cancel')}\n </Button>\n <Button\n variant=\"contained\"\n onClick={handleUpdate}\n disabled={!saveMigration}\n >\n {t('dictionary.confirm')}\n </Button>\n </DialogActions>\n </Dialog>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAyBO,MAAM,sBAAsB,CAAC;AAAA,EAClC,UAAA;AAAA,EACA,YAAA;AAAA,EACA,YAAA;AAAA,EACA;AACF,CAA4D,KAAA;AAC1D,EAAA,MAAM,EAAE,CAAA,EAAM,GAAA,iBAAA,CAAkB,wBAAwB,CAAA;AAExD,EAAA,MAAM,CAAC,aAAA,EAAe,gBAAgB,CAAA,GAAI,SAAkB,KAAK,CAAA;AAEjE,EAAA,SAAS,oBAAoB,KAA4C,EAAA;AACvE,IAAiB,gBAAA,CAAA,KAAA,CAAM,OAAO,OAAO,CAAA;AAAA;AAGvC,EACE,uBAAA,IAAA,CAAC,MAAO,EAAA,EAAA,IAAA,EAAM,UACZ,EAAA,QAAA,EAAA;AAAA,oBAAC,GAAA,CAAA,WAAA,EAAA,EAAa,Q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A,CAAA,CAAA,mBAAmB,CACxB,EAAA,CAAA;AAAA,sBACA,GAAA;AAAA,QAAC,MAAA;AAAA,QAAA;AAAA,UACC,OAAQ,EAAA,WAAA;AAAA,UACR,OAAS,EAAA,YAAA;AAAA,UACT,UAAU,CAAC,aAAA;AAAA,UAEV,YAAE,oBAAoB;AAAA;AAAA;AACzB,KACF,EAAA;AAAA,GACF,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -44,6 +44,7 @@ const RiScPublishDialog = ({
|
|
|
44
44
|
) })
|
|
45
45
|
] }) }),
|
|
46
46
|
/* @__PURE__ */ jsxs(DialogActions, { sx: dialogActions, children: [
|
|
47
|
+
/* @__PURE__ */ jsx(Button, { variant: "outlined", color: "primary", onClick: handleCancel, children: t("dictionary.cancel") }),
|
|
47
48
|
/* @__PURE__ */ jsx(
|
|
48
49
|
Button,
|
|
49
50
|
{
|
|
@@ -53,8 +54,7 @@ const RiScPublishDialog = ({
|
|
|
53
54
|
disabled: !riskOwnerApproves,
|
|
54
55
|
children: t("dictionary.confirm")
|
|
55
56
|
}
|
|
56
|
-
)
|
|
57
|
-
/* @__PURE__ */ jsx(Button, { variant: "outlined", color: "primary", onClick: handleCancel, children: t("dictionary.cancel") })
|
|
57
|
+
)
|
|
58
58
|
] })
|
|
59
59
|
] });
|
|
60
60
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PublishDialog.esm.js","sources":["../../../src/components/riScInfo/PublishDialog.tsx"],"sourcesContent":["import { ReactComponentElement, useState } from 'react';\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 Checkbox from '@mui/material/Checkbox';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport FormControlLabel from '@mui/material/FormControlLabel';\nimport { DifferenceFetchState } from '../../utils/types';\nimport { pluginRiScTranslationRef } from '../../utils/translations';\nimport { RiScDifferenceDialog } from './riScStatus/RiScDifferenceDialog';\nimport { dialogActions } from '../common/mixins';\n\ninterface RiScPublishDialogProps {\n openDialog: boolean;\n handleCancel: () => void;\n handlePublish: () => void;\n differenceFetchState: DifferenceFetchState;\n}\n\nexport const 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 function 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
|
|
1
|
+
{"version":3,"file":"PublishDialog.esm.js","sources":["../../../src/components/riScInfo/PublishDialog.tsx"],"sourcesContent":["import { ReactComponentElement, useState } from 'react';\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 Checkbox from '@mui/material/Checkbox';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport FormControlLabel from '@mui/material/FormControlLabel';\nimport { DifferenceFetchState } from '../../utils/types';\nimport { pluginRiScTranslationRef } from '../../utils/translations';\nimport { RiScDifferenceDialog } from './riScStatus/RiScDifferenceDialog';\nimport { dialogActions } from '../common/mixins';\n\ninterface RiScPublishDialogProps {\n openDialog: boolean;\n handleCancel: () => void;\n handlePublish: () => void;\n differenceFetchState: DifferenceFetchState;\n}\n\nexport const 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 function 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 variant=\"outlined\" color=\"primary\" onClick={handleCancel}>\n {t('dictionary.cancel')}\n </Button>\n <Button\n variant=\"contained\"\n color=\"primary\"\n onClick={handlePublish}\n disabled={!riskOwnerApproves}\n >\n {t('dictionary.confirm')}\n </Button>\n </DialogActions>\n </Dialog>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AAsBO,MAAM,oBAAoB,CAAC;AAAA,EAChC,UAAA;AAAA,EACA,YAAA;AAAA,EACA,aAAA;AAAA,EACA;AACF,CAA0D,KAAA;AACxD,EAAA,MAAM,EAAE,CAAA,EAAM,GAAA,iBAAA,CAAkB,wBAAwB,CAAA;AAExD,EAAA,MAAM,CAAC,iBAAA,EAAmB,oBAAoB,CAAA,GAAI,SAAkB,KAAK,CAAA;AAEzE,EAAA,SAAS,oBAAoB,KAA4C,EAAA;AACvE,IAAqB,oBAAA,CAAA,KAAA,CAAM,OAAO,OAAO,CAAA;A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