@kartverket/backstage-plugin-risk-scorecard 5.1.0 → 5.1.2
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/ConfirmationDialog.esm.js +123 -0
- package/dist/components/common/ConfirmationDialog.esm.js.map +1 -0
- package/dist/components/riScInfo/MigrationDialog.esm.js +9 -36
- package/dist/components/riScInfo/MigrationDialog.esm.js.map +1 -1
- package/dist/components/riScInfo/PublishDialog.esm.js +9 -47
- package/dist/components/riScInfo/PublishDialog.esm.js.map +1 -1
- package/dist/components/riScInfo/RiScSelectionCard.module.css.esm.js +2 -2
- package/dist/components/scenarioDrawer/components/DeleteConfirmation.esm.js +10 -52
- package/dist/components/scenarioDrawer/components/DeleteConfirmation.esm.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import Checkbox from '@mui/material/Checkbox';
|
|
4
|
+
import FormControlLabel from '@mui/material/FormControlLabel';
|
|
5
|
+
import Alert from '@mui/material/Alert';
|
|
6
|
+
import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
|
|
7
|
+
import { pluginRiScTranslationRef } from '../../utils/translations.esm.js';
|
|
8
|
+
import { Flex, Button } from '@backstage/ui';
|
|
9
|
+
import DialogComponent from '../dialog/DialogComponent.esm.js';
|
|
10
|
+
|
|
11
|
+
function ConfirmationDialogWithCheckbox({
|
|
12
|
+
isOpen,
|
|
13
|
+
onCancel,
|
|
14
|
+
onConfirm,
|
|
15
|
+
title,
|
|
16
|
+
checkboxLabel,
|
|
17
|
+
children,
|
|
18
|
+
className,
|
|
19
|
+
confirmButtonText
|
|
20
|
+
}) {
|
|
21
|
+
const { t } = useTranslationRef(pluginRiScTranslationRef);
|
|
22
|
+
const [isChecked, setIsChecked] = useState(false);
|
|
23
|
+
const handleCheckboxChange = (event) => {
|
|
24
|
+
setIsChecked(event.target.checked);
|
|
25
|
+
};
|
|
26
|
+
const handleCancel = () => {
|
|
27
|
+
setIsChecked(false);
|
|
28
|
+
onCancel();
|
|
29
|
+
};
|
|
30
|
+
const handleConfirm = () => {
|
|
31
|
+
setIsChecked(false);
|
|
32
|
+
onConfirm();
|
|
33
|
+
};
|
|
34
|
+
return /* @__PURE__ */ jsxs(
|
|
35
|
+
DialogComponent,
|
|
36
|
+
{
|
|
37
|
+
isOpen,
|
|
38
|
+
onClick: handleCancel,
|
|
39
|
+
header: title,
|
|
40
|
+
className,
|
|
41
|
+
children: [
|
|
42
|
+
children,
|
|
43
|
+
/* @__PURE__ */ jsx(Alert, { severity: "info", icon: false, children: /* @__PURE__ */ jsx(
|
|
44
|
+
FormControlLabel,
|
|
45
|
+
{
|
|
46
|
+
control: /* @__PURE__ */ jsx(
|
|
47
|
+
Checkbox,
|
|
48
|
+
{
|
|
49
|
+
color: "primary",
|
|
50
|
+
checked: isChecked,
|
|
51
|
+
onChange: handleCheckboxChange
|
|
52
|
+
}
|
|
53
|
+
),
|
|
54
|
+
label: checkboxLabel
|
|
55
|
+
}
|
|
56
|
+
) }),
|
|
57
|
+
/* @__PURE__ */ jsxs(Flex, { justify: "between", pt: "24px", children: [
|
|
58
|
+
/* @__PURE__ */ jsx(Button, { variant: "secondary", size: "medium", onClick: handleCancel, children: t("dictionary.cancel") }),
|
|
59
|
+
/* @__PURE__ */ jsx(
|
|
60
|
+
Button,
|
|
61
|
+
{
|
|
62
|
+
variant: "primary",
|
|
63
|
+
size: "medium",
|
|
64
|
+
onClick: handleConfirm,
|
|
65
|
+
isDisabled: !isChecked,
|
|
66
|
+
children: confirmButtonText || t("dictionary.confirm")
|
|
67
|
+
}
|
|
68
|
+
)
|
|
69
|
+
] })
|
|
70
|
+
]
|
|
71
|
+
}
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
function ConfirmationDialogWithoutCheckbox({
|
|
75
|
+
isOpen,
|
|
76
|
+
onCancel,
|
|
77
|
+
onConfirm,
|
|
78
|
+
title,
|
|
79
|
+
confirmButtonText,
|
|
80
|
+
className,
|
|
81
|
+
children
|
|
82
|
+
}) {
|
|
83
|
+
const { t } = useTranslationRef(pluginRiScTranslationRef);
|
|
84
|
+
return /* @__PURE__ */ jsxs(
|
|
85
|
+
DialogComponent,
|
|
86
|
+
{
|
|
87
|
+
isOpen,
|
|
88
|
+
onClick: () => onCancel(),
|
|
89
|
+
header: title,
|
|
90
|
+
className,
|
|
91
|
+
children: [
|
|
92
|
+
children,
|
|
93
|
+
/* @__PURE__ */ jsxs(Flex, { justify: "between", children: [
|
|
94
|
+
/* @__PURE__ */ jsx(
|
|
95
|
+
Button,
|
|
96
|
+
{
|
|
97
|
+
variant: "secondary",
|
|
98
|
+
size: "medium",
|
|
99
|
+
onClick: () => {
|
|
100
|
+
onCancel?.();
|
|
101
|
+
},
|
|
102
|
+
children: t("dictionary.cancel")
|
|
103
|
+
}
|
|
104
|
+
),
|
|
105
|
+
/* @__PURE__ */ jsx(
|
|
106
|
+
Button,
|
|
107
|
+
{
|
|
108
|
+
onClick: () => {
|
|
109
|
+
onConfirm();
|
|
110
|
+
},
|
|
111
|
+
variant: "primary",
|
|
112
|
+
size: "medium",
|
|
113
|
+
children: confirmButtonText || t("dictionary.confirm")
|
|
114
|
+
}
|
|
115
|
+
)
|
|
116
|
+
] })
|
|
117
|
+
]
|
|
118
|
+
}
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export { ConfirmationDialogWithCheckbox, ConfirmationDialogWithoutCheckbox };
|
|
123
|
+
//# sourceMappingURL=ConfirmationDialog.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConfirmationDialog.esm.js","sources":["../../../src/components/common/ConfirmationDialog.tsx"],"sourcesContent":["import { useState, ReactNode } from 'react';\nimport Checkbox from '@mui/material/Checkbox';\nimport FormControlLabel from '@mui/material/FormControlLabel';\nimport Alert from '@mui/material/Alert';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { pluginRiScTranslationRef } from '../../utils/translations';\nimport { Flex, Button } from '@backstage/ui';\nimport DialogComponent from '../dialog/DialogComponent';\n\ntype ConfirmationDialogWithCheckboxProps = {\n isOpen: boolean;\n onCancel: () => void;\n onConfirm: () => void;\n title: string;\n checkboxLabel: string;\n children?: ReactNode;\n className?: string;\n confirmButtonText?: string;\n};\n\nexport function ConfirmationDialogWithCheckbox({\n isOpen,\n onCancel,\n onConfirm,\n title,\n checkboxLabel,\n children,\n className,\n confirmButtonText,\n}: ConfirmationDialogWithCheckboxProps) {\n const { t } = useTranslationRef(pluginRiScTranslationRef);\n const [isChecked, setIsChecked] = useState(false);\n\n const handleCheckboxChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n setIsChecked(event.target.checked);\n };\n\n const handleCancel = () => {\n setIsChecked(false);\n onCancel();\n };\n\n const handleConfirm = () => {\n setIsChecked(false);\n onConfirm();\n };\n\n return (\n <DialogComponent\n isOpen={isOpen}\n onClick={handleCancel}\n header={title}\n className={className}\n >\n {children}\n <Alert severity=\"info\" icon={false}>\n <FormControlLabel\n control={\n <Checkbox\n color=\"primary\"\n checked={isChecked}\n onChange={handleCheckboxChange}\n />\n }\n label={checkboxLabel}\n />\n </Alert>\n <Flex justify=\"between\" pt=\"24px\">\n <Button variant=\"secondary\" size=\"medium\" onClick={handleCancel}>\n {t('dictionary.cancel')}\n </Button>\n <Button\n variant=\"primary\"\n size=\"medium\"\n onClick={handleConfirm}\n isDisabled={!isChecked}\n >\n {confirmButtonText || t('dictionary.confirm')}\n </Button>\n </Flex>\n </DialogComponent>\n );\n}\n\ninterface ConfirmationDialogWithoutCheckboxProps {\n isOpen: boolean;\n onCancel: () => void;\n onConfirm: () => void;\n title: string;\n confirmButtonText?: string;\n className?: string;\n children?: ReactNode;\n}\n\nexport function ConfirmationDialogWithoutCheckbox({\n isOpen,\n onCancel,\n onConfirm,\n title,\n confirmButtonText,\n className,\n children,\n}: ConfirmationDialogWithoutCheckboxProps) {\n const { t } = useTranslationRef(pluginRiScTranslationRef);\n\n return (\n <DialogComponent\n isOpen={isOpen}\n onClick={() => onCancel()}\n header={title}\n className={className}\n >\n {children}\n <Flex justify=\"between\">\n <Button\n variant=\"secondary\"\n size=\"medium\"\n onClick={() => {\n onCancel?.();\n }}\n >\n {t('dictionary.cancel')}\n </Button>\n <Button\n onClick={() => {\n onConfirm();\n }}\n variant=\"primary\"\n size=\"medium\"\n >\n {confirmButtonText || t('dictionary.confirm')}\n </Button>\n </Flex>\n </DialogComponent>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;AAoBO,SAAS,8BAAA,CAA+B;AAAA,EAC7C,MAAA;AAAA,EACA,QAAA;AAAA,EACA,SAAA;AAAA,EACA,KAAA;AAAA,EACA,aAAA;AAAA,EACA,QAAA;AAAA,EACA,SAAA;AAAA,EACA;AACF,CAAA,EAAwC;AACtC,EAAA,MAAM,EAAE,CAAA,EAAE,GAAI,iBAAA,CAAkB,wBAAwB,CAAA;AACxD,EAAA,MAAM,CAAC,SAAA,EAAW,YAAY,CAAA,GAAI,SAAS,KAAK,CAAA;AAEhD,EAAA,MAAM,oBAAA,GAAuB,CAAC,KAAA,KAA+C;AAC3E,IAAA,YAAA,CAAa,KAAA,CAAM,OAAO,OAAO,CAAA;AAAA,EACnC,CAAA;AAEA,EAAA,MAAM,eAAe,MAAM;AACzB,IAAA,YAAA,CAAa,KAAK,CAAA;AAClB,IAAA,QAAA,EAAS;AAAA,EACX,CAAA;AAEA,EAAA,MAAM,gBAAgB,MAAM;AAC1B,IAAA,YAAA,CAAa,KAAK,CAAA;AAClB,IAAA,SAAA,EAAU;AAAA,EACZ,CAAA;AAEA,EAAA,uBACE,IAAA;AAAA,IAAC,eAAA;AAAA,IAAA;AAAA,MACC,MAAA;AAAA,MACA,OAAA,EAAS,YAAA;AAAA,MACT,MAAA,EAAQ,KAAA;AAAA,MACR,SAAA;AAAA,MAEC,QAAA,EAAA;AAAA,QAAA,QAAA;AAAA,wBACD,GAAA,CAAC,KAAA,EAAA,EAAM,QAAA,EAAS,MAAA,EAAO,MAAM,KAAA,EAC3B,QAAA,kBAAA,GAAA;AAAA,UAAC,gBAAA;AAAA,UAAA;AAAA,YACC,OAAA,kBACE,GAAA;AAAA,cAAC,QAAA;AAAA,cAAA;AAAA,gBACC,KAAA,EAAM,SAAA;AAAA,gBACN,OAAA,EAAS,SAAA;AAAA,gBACT,QAAA,EAAU;AAAA;AAAA,aACZ;AAAA,YAEF,KAAA,EAAO;AAAA;AAAA,SACT,EACF,CAAA;AAAA,wBACA,IAAA,CAAC,IAAA,EAAA,EAAK,OAAA,EAAQ,SAAA,EAAU,IAAG,MAAA,EACzB,QAAA,EAAA;AAAA,0BAAA,GAAA,CAAC,MAAA,EAAA,EAAO,SAAQ,WAAA,EAAY,IAAA,EAAK,UAAS,OAAA,EAAS,YAAA,EAChD,QAAA,EAAA,CAAA,CAAE,mBAAmB,CAAA,EACxB,CAAA;AAAA,0BACA,GAAA;AAAA,YAAC,MAAA;AAAA,YAAA;AAAA,cACC,OAAA,EAAQ,SAAA;AAAA,cACR,IAAA,EAAK,QAAA;AAAA,cACL,OAAA,EAAS,aAAA;AAAA,cACT,YAAY,CAAC,SAAA;AAAA,cAEZ,QAAA,EAAA,iBAAA,IAAqB,EAAE,oBAAoB;AAAA;AAAA;AAC9C,SAAA,EACF;AAAA;AAAA;AAAA,GACF;AAEJ;AAYO,SAAS,iCAAA,CAAkC;AAAA,EAChD,MAAA;AAAA,EACA,QAAA;AAAA,EACA,SAAA;AAAA,EACA,KAAA;AAAA,EACA,iBAAA;AAAA,EACA,SAAA;AAAA,EACA;AACF,CAAA,EAA2C;AACzC,EAAA,MAAM,EAAE,CAAA,EAAE,GAAI,iBAAA,CAAkB,wBAAwB,CAAA;AAExD,EAAA,uBACE,IAAA;AAAA,IAAC,eAAA;AAAA,IAAA;AAAA,MACC,MAAA;AAAA,MACA,OAAA,EAAS,MAAM,QAAA,EAAS;AAAA,MACxB,MAAA,EAAQ,KAAA;AAAA,MACR,SAAA;AAAA,MAEC,QAAA,EAAA;AAAA,QAAA,QAAA;AAAA,wBACD,IAAA,CAAC,IAAA,EAAA,EAAK,OAAA,EAAQ,SAAA,EACZ,QAAA,EAAA;AAAA,0BAAA,GAAA;AAAA,YAAC,MAAA;AAAA,YAAA;AAAA,cACC,OAAA,EAAQ,WAAA;AAAA,cACR,IAAA,EAAK,QAAA;AAAA,cACL,SAAS,MAAM;AACb,gBAAA,QAAA,IAAW;AAAA,cACb,CAAA;AAAA,cAEC,YAAE,mBAAmB;AAAA;AAAA,WACxB;AAAA,0BACA,GAAA;AAAA,YAAC,MAAA;AAAA,YAAA;AAAA,cACC,SAAS,MAAM;AACb,gBAAA,SAAA,EAAU;AAAA,cACZ,CAAA;AAAA,cACA,OAAA,EAAQ,SAAA;AAAA,cACR,IAAA,EAAK,QAAA;AAAA,cAEJ,QAAA,EAAA,iBAAA,IAAqB,EAAE,oBAAoB;AAAA;AAAA;AAC9C,SAAA,EACF;AAAA;AAAA;AAAA,GACF;AAEJ;;;;"}
|
|
@@ -1,16 +1,10 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { useState } from 'react';
|
|
3
|
-
import Alert from '@mui/material/Alert';
|
|
4
|
-
import Button from '@mui/material/Button';
|
|
5
|
-
import Checkbox from '@mui/material/Checkbox';
|
|
6
2
|
import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
|
|
7
|
-
import FormControlLabel from '@mui/material/FormControlLabel';
|
|
8
|
-
import Box from '@mui/material/Box';
|
|
9
3
|
import { pluginRiScTranslationRef } from '../../utils/translations.esm.js';
|
|
10
4
|
import { RiScMigrationChanges } from './migrations/RiScMigrationChanges.esm.js';
|
|
11
|
-
import {
|
|
5
|
+
import { Box, Text } from '@backstage/ui';
|
|
12
6
|
import riscStyles from './RiScSelectionCard.module.css.esm.js';
|
|
13
|
-
import
|
|
7
|
+
import { ConfirmationDialogWithCheckbox } from '../common/ConfirmationDialog.esm.js';
|
|
14
8
|
|
|
15
9
|
const RiScMigrationDialog = ({
|
|
16
10
|
openDialog,
|
|
@@ -19,39 +13,18 @@ const RiScMigrationDialog = ({
|
|
|
19
13
|
migrationStatus
|
|
20
14
|
}) => {
|
|
21
15
|
const { t } = useTranslationRef(pluginRiScTranslationRef);
|
|
22
|
-
const [saveMigration, setSaveMigration] = useState(false);
|
|
23
|
-
function handleCheckboxInput(event) {
|
|
24
|
-
setSaveMigration(event.target.checked);
|
|
25
|
-
}
|
|
26
16
|
return /* @__PURE__ */ jsxs(
|
|
27
|
-
|
|
17
|
+
ConfirmationDialogWithCheckbox,
|
|
28
18
|
{
|
|
29
19
|
isOpen: openDialog,
|
|
30
|
-
|
|
31
|
-
|
|
20
|
+
onCancel: handleCancel,
|
|
21
|
+
onConfirm: handleUpdate,
|
|
22
|
+
title: t("migrationDialog.title"),
|
|
23
|
+
checkboxLabel: t("migrationDialog.checkboxLabel"),
|
|
32
24
|
className: riscStyles.riScInfoDialog,
|
|
33
25
|
children: [
|
|
34
|
-
/* @__PURE__ */ jsx(Box, {
|
|
35
|
-
/* @__PURE__ */ jsx(RiScMigrationChanges, { migrationStatus })
|
|
36
|
-
/* @__PURE__ */ jsx(Alert, { severity: "info", icon: false, children: /* @__PURE__ */ jsx(
|
|
37
|
-
FormControlLabel,
|
|
38
|
-
{
|
|
39
|
-
control: /* @__PURE__ */ jsx(Checkbox, { checked: saveMigration, onChange: handleCheckboxInput }),
|
|
40
|
-
label: t("migrationDialog.checkboxLabel")
|
|
41
|
-
}
|
|
42
|
-
) }),
|
|
43
|
-
/* @__PURE__ */ jsxs(Flex, { justify: "between", pt: "24px", children: [
|
|
44
|
-
/* @__PURE__ */ jsx(Button, { variant: "outlined", color: "primary", onClick: handleCancel, children: t("dictionary.cancel") }),
|
|
45
|
-
/* @__PURE__ */ jsx(
|
|
46
|
-
Button,
|
|
47
|
-
{
|
|
48
|
-
variant: "contained",
|
|
49
|
-
onClick: handleUpdate,
|
|
50
|
-
disabled: !saveMigration,
|
|
51
|
-
children: t("dictionary.confirm")
|
|
52
|
-
}
|
|
53
|
-
)
|
|
54
|
-
] })
|
|
26
|
+
/* @__PURE__ */ jsx(Box, { className: riscStyles.riscDescriptionContainer, children: /* @__PURE__ */ jsx(Text, { variant: "body-large", children: t("migrationDialog.description") }) }),
|
|
27
|
+
/* @__PURE__ */ jsx(RiScMigrationChanges, { migrationStatus })
|
|
55
28
|
]
|
|
56
29
|
}
|
|
57
30
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MigrationDialog.esm.js","sources":["../../../src/components/riScInfo/MigrationDialog.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"MigrationDialog.esm.js","sources":["../../../src/components/riScInfo/MigrationDialog.tsx"],"sourcesContent":["import { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { pluginRiScTranslationRef } from '../../utils/translations';\nimport { MigrationStatus } from '../../utils/types';\nimport { RiScMigrationChanges } from './migrations/RiScMigrationChanges.tsx';\nimport { Text, Box } from '@backstage/ui';\nimport styles from './RiScSelectionCard.module.css';\nimport { ConfirmationDialogWithCheckbox } from '../common/ConfirmationDialog.tsx';\n\ninterface RiScMigrationDialogProps {\n openDialog: boolean;\n handleCancel: () => void;\n handleUpdate: () => void;\n migrationStatus: MigrationStatus;\n}\n\nexport const RiScMigrationDialog = ({\n openDialog,\n handleCancel,\n handleUpdate,\n migrationStatus,\n}: RiScMigrationDialogProps) => {\n const { t } = useTranslationRef(pluginRiScTranslationRef);\n\n return (\n <ConfirmationDialogWithCheckbox\n isOpen={openDialog}\n onCancel={handleCancel}\n onConfirm={handleUpdate}\n title={t('migrationDialog.title')}\n checkboxLabel={t('migrationDialog.checkboxLabel')}\n className={styles.riScInfoDialog}\n >\n <Box className={styles.riscDescriptionContainer}>\n <Text variant=\"body-large\">{t('migrationDialog.description')}</Text>\n </Box>\n <RiScMigrationChanges migrationStatus={migrationStatus} />\n </ConfirmationDialogWithCheckbox>\n );\n};\n"],"names":["styles"],"mappings":";;;;;;;;AAeO,MAAM,sBAAsB,CAAC;AAAA,EAClC,UAAA;AAAA,EACA,YAAA;AAAA,EACA,YAAA;AAAA,EACA;AACF,CAAA,KAAgC;AAC9B,EAAA,MAAM,EAAE,CAAA,EAAE,GAAI,iBAAA,CAAkB,wBAAwB,CAAA;AAExD,EAAA,uBACE,IAAA;AAAA,IAAC,8BAAA;AAAA,IAAA;AAAA,MACC,MAAA,EAAQ,UAAA;AAAA,MACR,QAAA,EAAU,YAAA;AAAA,MACV,SAAA,EAAW,YAAA;AAAA,MACX,KAAA,EAAO,EAAE,uBAAuB,CAAA;AAAA,MAChC,aAAA,EAAe,EAAE,+BAA+B,CAAA;AAAA,MAChD,WAAWA,UAAA,CAAO,cAAA;AAAA,MAElB,QAAA,EAAA;AAAA,wBAAA,GAAA,CAAC,GAAA,EAAA,EAAI,SAAA,EAAWA,UAAA,CAAO,wBAAA,EACrB,QAAA,kBAAA,GAAA,CAAC,IAAA,EAAA,EAAK,OAAA,EAAQ,YAAA,EAAc,QAAA,EAAA,CAAA,CAAE,6BAA6B,CAAA,EAAE,CAAA,EAC/D,CAAA;AAAA,wBACA,GAAA,CAAC,wBAAqB,eAAA,EAAkC;AAAA;AAAA;AAAA,GAC1D;AAEJ;;;;"}
|
|
@@ -1,14 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useState } from 'react';
|
|
3
|
-
import Alert from '@mui/material/Alert';
|
|
4
|
-
import { Flex, Button } from '@backstage/ui';
|
|
5
|
-
import Checkbox from '@mui/material/Checkbox';
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
6
2
|
import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
|
|
7
|
-
import FormControlLabel from '@mui/material/FormControlLabel';
|
|
8
3
|
import { pluginRiScTranslationRef } from '../../utils/translations.esm.js';
|
|
9
4
|
import { RiScDifferenceDialog } from './riScStatus/RiScDifferenceDialog.esm.js';
|
|
10
5
|
import riscStyles from './RiScSelectionCard.module.css.esm.js';
|
|
11
|
-
import
|
|
6
|
+
import { ConfirmationDialogWithCheckbox } from '../common/ConfirmationDialog.esm.js';
|
|
12
7
|
|
|
13
8
|
const RiScPublishDialog = ({
|
|
14
9
|
openDialog,
|
|
@@ -18,49 +13,16 @@ const RiScPublishDialog = ({
|
|
|
18
13
|
differenceFetchState
|
|
19
14
|
}) => {
|
|
20
15
|
const { t } = useTranslationRef(pluginRiScTranslationRef);
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
setRiskOwnerApproves(event.target.checked);
|
|
24
|
-
}
|
|
25
|
-
return /* @__PURE__ */ jsxs(
|
|
26
|
-
DialogComponent,
|
|
16
|
+
return /* @__PURE__ */ jsx(
|
|
17
|
+
ConfirmationDialogWithCheckbox,
|
|
27
18
|
{
|
|
28
19
|
isOpen: openDialog,
|
|
29
|
-
|
|
30
|
-
|
|
20
|
+
onCancel: handleCancel,
|
|
21
|
+
onConfirm: handlePublish,
|
|
22
|
+
title: isDeletion ? t("publishDialog.titleDelete") : t("publishDialog.titleUpdate"),
|
|
23
|
+
checkboxLabel: isDeletion ? t("publishDialog.checkboxLabelDelete") : t("publishDialog.checkboxLabelUpdate"),
|
|
31
24
|
className: riscStyles.riScInfoDialog,
|
|
32
|
-
children:
|
|
33
|
-
/* @__PURE__ */ jsxs(Fragment, { children: [
|
|
34
|
-
!isDeletion && /* @__PURE__ */ jsx(RiScDifferenceDialog, { differenceFetchState }),
|
|
35
|
-
/* @__PURE__ */ jsx(Alert, { severity: "info", icon: false, children: /* @__PURE__ */ jsx(
|
|
36
|
-
FormControlLabel,
|
|
37
|
-
{
|
|
38
|
-
control: /* @__PURE__ */ jsx(
|
|
39
|
-
Checkbox,
|
|
40
|
-
{
|
|
41
|
-
color: "primary",
|
|
42
|
-
checked: riskOwnerApproves,
|
|
43
|
-
onChange: handleCheckboxInput
|
|
44
|
-
}
|
|
45
|
-
),
|
|
46
|
-
label: isDeletion ? t("publishDialog.checkboxLabelDelete") : t("publishDialog.checkboxLabelUpdate")
|
|
47
|
-
}
|
|
48
|
-
) })
|
|
49
|
-
] }),
|
|
50
|
-
/* @__PURE__ */ jsxs(Flex, { justify: "between", pt: "24px", children: [
|
|
51
|
-
/* @__PURE__ */ jsx(Button, { size: "medium", variant: "secondary", onClick: handleCancel, children: t("dictionary.cancel") }),
|
|
52
|
-
/* @__PURE__ */ jsx(
|
|
53
|
-
Button,
|
|
54
|
-
{
|
|
55
|
-
size: "medium",
|
|
56
|
-
variant: "primary",
|
|
57
|
-
onClick: handlePublish,
|
|
58
|
-
isDisabled: !riskOwnerApproves,
|
|
59
|
-
children: t("dictionary.confirm")
|
|
60
|
-
}
|
|
61
|
-
)
|
|
62
|
-
] })
|
|
63
|
-
]
|
|
25
|
+
children: !isDeletion && /* @__PURE__ */ jsx(RiScDifferenceDialog, { differenceFetchState })
|
|
64
26
|
}
|
|
65
27
|
);
|
|
66
28
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PublishDialog.esm.js","sources":["../../../src/components/riScInfo/PublishDialog.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"PublishDialog.esm.js","sources":["../../../src/components/riScInfo/PublishDialog.tsx"],"sourcesContent":["import { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { DifferenceFetchState } from '../../utils/types';\nimport { pluginRiScTranslationRef } from '../../utils/translations';\nimport { RiScDifferenceDialog } from './riScStatus/RiScDifferenceDialog';\nimport styles from './RiScSelectionCard.module.css';\nimport { ConfirmationDialogWithCheckbox } from '../common/ConfirmationDialog';\n\ninterface RiScPublishDialogProps {\n openDialog: boolean;\n isDeletion: boolean;\n handleCancel: () => void;\n handlePublish: () => void;\n differenceFetchState: DifferenceFetchState;\n}\n\nexport const RiScPublishDialog = ({\n openDialog,\n isDeletion,\n handleCancel,\n handlePublish,\n differenceFetchState,\n}: RiScPublishDialogProps): React.ReactElement<any> => {\n const { t } = useTranslationRef(pluginRiScTranslationRef);\n\n return (\n <ConfirmationDialogWithCheckbox\n isOpen={openDialog}\n onCancel={handleCancel}\n onConfirm={handlePublish}\n title={\n isDeletion\n ? t('publishDialog.titleDelete')\n : t('publishDialog.titleUpdate')\n }\n checkboxLabel={\n isDeletion\n ? t('publishDialog.checkboxLabelDelete')\n : t('publishDialog.checkboxLabelUpdate')\n }\n className={styles.riScInfoDialog}\n >\n {!isDeletion && (\n <RiScDifferenceDialog differenceFetchState={differenceFetchState} />\n )}\n </ConfirmationDialogWithCheckbox>\n );\n};\n"],"names":["styles"],"mappings":";;;;;;;AAeO,MAAM,oBAAoB,CAAC;AAAA,EAChC,UAAA;AAAA,EACA,UAAA;AAAA,EACA,YAAA;AAAA,EACA,aAAA;AAAA,EACA;AACF,CAAA,KAAuD;AACrD,EAAA,MAAM,EAAE,CAAA,EAAE,GAAI,iBAAA,CAAkB,wBAAwB,CAAA;AAExD,EAAA,uBACE,GAAA;AAAA,IAAC,8BAAA;AAAA,IAAA;AAAA,MACC,MAAA,EAAQ,UAAA;AAAA,MACR,QAAA,EAAU,YAAA;AAAA,MACV,SAAA,EAAW,aAAA;AAAA,MACX,OACE,UAAA,GACI,CAAA,CAAE,2BAA2B,CAAA,GAC7B,EAAE,2BAA2B,CAAA;AAAA,MAEnC,eACE,UAAA,GACI,CAAA,CAAE,mCAAmC,CAAA,GACrC,EAAE,mCAAmC,CAAA;AAAA,MAE3C,WAAWA,UAAA,CAAO,cAAA;AAAA,MAEjB,QAAA,EAAA,CAAC,UAAA,oBACA,GAAA,CAAC,oBAAA,EAAA,EAAqB,oBAAA,EAA4C;AAAA;AAAA,GAEtE;AAEJ;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import styleInject from '../../node_modules_dist/style-inject/dist/style-inject.es.esm.js';
|
|
2
2
|
|
|
3
|
-
var css_248z = ".
|
|
4
|
-
var riscStyles = {"selectTrigger":"
|
|
3
|
+
var css_248z = ".RiScSelectionCard_selectTrigger__c76f5ad70b button {\n background-color: transparent;\n}\n\n.RiScSelectionCard_riScInfoDialog__c76f5ad70b {\n padding: 24px;\n border-radius: 4px;\n width: 800px;\n}\n\n.RiScSelectionCard_riscSelectionDialogHeader__c76f5ad70b {\n padding: 0 0 16px 0;\n}\n\n.RiScSelectionCard_riscSelectionDialogBody__c76f5ad70b {\n gap: 16px;\n padding: 16px 0 0 0;\n}\n\n.RiScSelectionCard_riscDescriptionComponent__c76f5ad70b {\n padding-bottom: 10px;\n}\n.RiScSelectionCard_componentLayout__c76f5ad70b {\n height: 60%;\n}\n\n.RiScSelectionCard_riscDescriptionContainer__c76f5ad70b {\n margin-bottom: 16px;\n}\n";
|
|
4
|
+
var riscStyles = {"selectTrigger":"RiScSelectionCard_selectTrigger__c76f5ad70b","riScInfoDialog":"RiScSelectionCard_riScInfoDialog__c76f5ad70b","riscDescriptionComponent":"RiScSelectionCard_riscDescriptionComponent__c76f5ad70b","componentLayout":"RiScSelectionCard_componentLayout__c76f5ad70b","riscDescriptionContainer":"RiScSelectionCard_riscDescriptionContainer__c76f5ad70b"};
|
|
5
5
|
styleInject(css_248z);
|
|
6
6
|
|
|
7
7
|
export { riscStyles as default };
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import { jsx
|
|
2
|
-
import Button from '@mui/material/Button';
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
2
|
import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
|
|
4
3
|
import { pluginRiScTranslationRef } from '../../../utils/translations.esm.js';
|
|
5
|
-
import { Flex } from '@backstage/ui';
|
|
6
4
|
import styles from './ScenarioDrawer.module.css.esm.js';
|
|
7
|
-
import
|
|
5
|
+
import { ConfirmationDialogWithoutCheckbox } from '../../common/ConfirmationDialog.esm.js';
|
|
8
6
|
|
|
9
7
|
function DeleteScenarioConfirmation({
|
|
10
8
|
isOpen,
|
|
@@ -13,16 +11,17 @@ function DeleteScenarioConfirmation({
|
|
|
13
11
|
}) {
|
|
14
12
|
const { t } = useTranslationRef(pluginRiScTranslationRef);
|
|
15
13
|
return /* @__PURE__ */ jsx(
|
|
16
|
-
|
|
14
|
+
ConfirmationDialogWithoutCheckbox,
|
|
17
15
|
{
|
|
18
16
|
isOpen,
|
|
19
|
-
|
|
17
|
+
onCancel: () => setIsOpen(false),
|
|
20
18
|
onConfirm: () => {
|
|
21
19
|
setIsOpen(false);
|
|
22
20
|
onConfirm?.();
|
|
23
21
|
},
|
|
24
22
|
title: t("scenarioDrawer.deleteScenarioConfirmation"),
|
|
25
|
-
confirmButtonText: t("scenarioDrawer.deleteScenarioButton")
|
|
23
|
+
confirmButtonText: t("scenarioDrawer.deleteScenarioButton"),
|
|
24
|
+
className: styles.deleteConfirmationDialog
|
|
26
25
|
}
|
|
27
26
|
);
|
|
28
27
|
}
|
|
@@ -33,58 +32,17 @@ function DeleteActionConfirmation({
|
|
|
33
32
|
}) {
|
|
34
33
|
const { t } = useTranslationRef(pluginRiScTranslationRef);
|
|
35
34
|
return /* @__PURE__ */ jsx(
|
|
36
|
-
|
|
35
|
+
ConfirmationDialogWithoutCheckbox,
|
|
37
36
|
{
|
|
38
37
|
isOpen,
|
|
39
|
-
|
|
38
|
+
onCancel: () => setIsOpen(false),
|
|
40
39
|
onConfirm: () => {
|
|
41
40
|
setIsOpen(false);
|
|
42
41
|
onConfirm?.();
|
|
43
42
|
},
|
|
44
43
|
title: t("scenarioDrawer.deleteActionConfirmation"),
|
|
45
|
-
confirmButtonText: t("scenarioDrawer.deleteActionButton")
|
|
46
|
-
|
|
47
|
-
);
|
|
48
|
-
}
|
|
49
|
-
function ConfirmationDialog({
|
|
50
|
-
isOpen,
|
|
51
|
-
onClose,
|
|
52
|
-
onConfirm,
|
|
53
|
-
title,
|
|
54
|
-
confirmButtonText
|
|
55
|
-
}) {
|
|
56
|
-
const { t } = useTranslationRef(pluginRiScTranslationRef);
|
|
57
|
-
return /* @__PURE__ */ jsx(
|
|
58
|
-
DialogComponent,
|
|
59
|
-
{
|
|
60
|
-
isOpen,
|
|
61
|
-
onClick: () => onClose?.(),
|
|
62
|
-
header: title,
|
|
63
|
-
className: styles.deleteConfirmationDialog,
|
|
64
|
-
children: /* @__PURE__ */ jsxs(Flex, { justify: "between", children: [
|
|
65
|
-
/* @__PURE__ */ jsx(
|
|
66
|
-
Button,
|
|
67
|
-
{
|
|
68
|
-
variant: "outlined",
|
|
69
|
-
onClick: (event) => {
|
|
70
|
-
event.stopPropagation();
|
|
71
|
-
onClose?.();
|
|
72
|
-
},
|
|
73
|
-
children: t("dictionary.cancel")
|
|
74
|
-
}
|
|
75
|
-
),
|
|
76
|
-
/* @__PURE__ */ jsx(
|
|
77
|
-
Button,
|
|
78
|
-
{
|
|
79
|
-
onClick: (event) => {
|
|
80
|
-
event.stopPropagation();
|
|
81
|
-
onConfirm?.();
|
|
82
|
-
},
|
|
83
|
-
variant: "contained",
|
|
84
|
-
children: confirmButtonText
|
|
85
|
-
}
|
|
86
|
-
)
|
|
87
|
-
] })
|
|
44
|
+
confirmButtonText: t("scenarioDrawer.deleteActionButton"),
|
|
45
|
+
className: styles.deleteConfirmationDialog
|
|
88
46
|
}
|
|
89
47
|
);
|
|
90
48
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeleteConfirmation.esm.js","sources":["../../../../src/components/scenarioDrawer/components/DeleteConfirmation.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"DeleteConfirmation.esm.js","sources":["../../../../src/components/scenarioDrawer/components/DeleteConfirmation.tsx"],"sourcesContent":["import { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { pluginRiScTranslationRef } from '../../../utils/translations';\nimport type { SetState } from '../../../utils/types';\nimport styles from '../components/ScenarioDrawer.module.css';\nimport { ConfirmationDialogWithoutCheckbox } from '../../common/ConfirmationDialog';\n\ntype DeleteScenarioConfirmationProps = {\n isOpen: boolean;\n setIsOpen: SetState<boolean>;\n onConfirm?: () => void;\n};\n\nexport function DeleteScenarioConfirmation({\n isOpen,\n setIsOpen,\n onConfirm,\n}: DeleteScenarioConfirmationProps) {\n const { t } = useTranslationRef(pluginRiScTranslationRef);\n\n return (\n <ConfirmationDialogWithoutCheckbox\n isOpen={isOpen}\n onCancel={() => setIsOpen(false)}\n onConfirm={() => {\n setIsOpen(false);\n onConfirm?.();\n }}\n title={t('scenarioDrawer.deleteScenarioConfirmation')}\n confirmButtonText={t('scenarioDrawer.deleteScenarioButton')}\n className={styles.deleteConfirmationDialog}\n />\n );\n}\n\ntype DeleteActionConfirmationProps = {\n isOpen: boolean;\n setIsOpen: SetState<boolean>;\n onConfirm?: () => void;\n};\n\nexport function DeleteActionConfirmation({\n isOpen,\n setIsOpen,\n onConfirm,\n}: DeleteActionConfirmationProps) {\n const { t } = useTranslationRef(pluginRiScTranslationRef);\n\n return (\n <ConfirmationDialogWithoutCheckbox\n isOpen={isOpen}\n onCancel={() => setIsOpen(false)}\n onConfirm={() => {\n setIsOpen(false);\n onConfirm?.();\n }}\n title={t('scenarioDrawer.deleteActionConfirmation')}\n confirmButtonText={t('scenarioDrawer.deleteActionButton')}\n className={styles.deleteConfirmationDialog}\n />\n );\n}\n"],"names":[],"mappings":";;;;;;AAYO,SAAS,0BAAA,CAA2B;AAAA,EACzC,MAAA;AAAA,EACA,SAAA;AAAA,EACA;AACF,CAAA,EAAoC;AAClC,EAAA,MAAM,EAAE,CAAA,EAAE,GAAI,iBAAA,CAAkB,wBAAwB,CAAA;AAExD,EAAA,uBACE,GAAA;AAAA,IAAC,iCAAA;AAAA,IAAA;AAAA,MACC,MAAA;AAAA,MACA,QAAA,EAAU,MAAM,SAAA,CAAU,KAAK,CAAA;AAAA,MAC/B,WAAW,MAAM;AACf,QAAA,SAAA,CAAU,KAAK,CAAA;AACf,QAAA,SAAA,IAAY;AAAA,MACd,CAAA;AAAA,MACA,KAAA,EAAO,EAAE,2CAA2C,CAAA;AAAA,MACpD,iBAAA,EAAmB,EAAE,qCAAqC,CAAA;AAAA,MAC1D,WAAW,MAAA,CAAO;AAAA;AAAA,GACpB;AAEJ;AAQO,SAAS,wBAAA,CAAyB;AAAA,EACvC,MAAA;AAAA,EACA,SAAA;AAAA,EACA;AACF,CAAA,EAAkC;AAChC,EAAA,MAAM,EAAE,CAAA,EAAE,GAAI,iBAAA,CAAkB,wBAAwB,CAAA;AAExD,EAAA,uBACE,GAAA;AAAA,IAAC,iCAAA;AAAA,IAAA;AAAA,MACC,MAAA;AAAA,MACA,QAAA,EAAU,MAAM,SAAA,CAAU,KAAK,CAAA;AAAA,MAC/B,WAAW,MAAM;AACf,QAAA,SAAA,CAAU,KAAK,CAAA;AACf,QAAA,SAAA,IAAY;AAAA,MACd,CAAA;AAAA,MACA,KAAA,EAAO,EAAE,yCAAyC,CAAA;AAAA,MAClD,iBAAA,EAAmB,EAAE,mCAAmC,CAAA;AAAA,MACxD,WAAW,MAAA,CAAO;AAAA;AAAA,GACpB;AAEJ;;;;"}
|