@kartverket/backstage-plugin-risk-scorecard 1.1.1 → 1.3.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/common/Icons.esm.js +27 -0
- package/dist/components/common/Icons.esm.js.map +1 -0
- package/dist/components/common/Input.esm.js +29 -18
- package/dist/components/common/Input.esm.js.map +1 -1
- package/dist/components/common/Select.esm.js +2 -2
- package/dist/components/common/Select.esm.js.map +1 -1
- package/dist/components/common/mixins.esm.js +9 -0
- package/dist/components/common/mixins.esm.js.map +1 -0
- package/dist/components/common/typography.esm.js +25 -13
- package/dist/components/common/typography.esm.js.map +1 -1
- package/dist/components/riScDialog/RiScDialog.esm.js +40 -86
- package/dist/components/riScDialog/RiScDialog.esm.js.map +1 -1
- package/dist/components/riScInfo/RiScInfo.esm.js +1 -7
- package/dist/components/riScInfo/RiScInfo.esm.js.map +1 -1
- package/dist/components/riScInfo/riScStatus/RiScStatusComponent.esm.js +101 -84
- package/dist/components/riScInfo/riScStatus/RiScStatusComponent.esm.js.map +1 -1
- package/dist/components/riScPlugin/RiScPlugin.esm.js +30 -15
- package/dist/components/riScPlugin/RiScPlugin.esm.js.map +1 -1
- package/dist/components/scenarioDrawer/components/ActionFormSection.esm.js +1 -8
- package/dist/components/scenarioDrawer/components/ActionFormSection.esm.js.map +1 -1
- package/dist/components/scenarioDrawer/components/ActionsSection.esm.js +2 -3
- package/dist/components/scenarioDrawer/components/ActionsSection.esm.js.map +1 -1
- package/dist/components/scenarioDrawer/components/DeleteConfirmation.esm.js +2 -1
- package/dist/components/scenarioDrawer/components/DeleteConfirmation.esm.js.map +1 -1
- package/dist/components/scenarioWizard/ScenarioWizard.esm.js +86 -96
- package/dist/components/scenarioWizard/ScenarioWizard.esm.js.map +1 -1
- package/dist/components/scenarioWizard/components/ActionEdit.esm.js +79 -69
- package/dist/components/scenarioWizard/components/ActionEdit.esm.js.map +1 -1
- package/dist/components/scenarioWizard/components/CloseConfirmation.esm.js +6 -2
- package/dist/components/scenarioWizard/components/CloseConfirmation.esm.js.map +1 -1
- package/dist/components/scenarioWizard/components/ConsequenceTable.esm.js +53 -27
- package/dist/components/scenarioWizard/components/ConsequenceTable.esm.js.map +1 -1
- package/dist/components/scenarioWizard/components/ProbabilityTable.esm.js +27 -15
- package/dist/components/scenarioWizard/components/ProbabilityTable.esm.js.map +1 -1
- package/dist/components/scenarioWizard/steps/ActionsStep.esm.js +17 -19
- package/dist/components/scenarioWizard/steps/ActionsStep.esm.js.map +1 -1
- package/dist/components/scenarioWizard/steps/RiskStep.esm.js +8 -10
- package/dist/components/scenarioWizard/steps/RiskStep.esm.js.map +1 -1
- package/dist/components/scenarioWizard/steps/ScenarioStep.esm.js +23 -48
- package/dist/components/scenarioWizard/steps/ScenarioStep.esm.js.map +1 -1
- package/dist/components/scenarioWizard/wizardStyles.esm.js +32 -0
- package/dist/components/scenarioWizard/wizardStyles.esm.js.map +1 -0
- package/dist/contexts/RiScContext.esm.js +15 -11
- package/dist/contexts/RiScContext.esm.js.map +1 -1
- package/dist/contexts/ScenarioContext.esm.js +7 -4
- package/dist/contexts/ScenarioContext.esm.js.map +1 -1
- package/dist/{risc_schema_en_v3_3.json.esm.js → risc_schema_en_v4_0.json.esm.js} +8 -20
- package/dist/{risc_schema_en_v3_3.json.esm.js.map → risc_schema_en_v4_0.json.esm.js.map} +1 -1
- package/dist/utils/DTOs.esm.js +0 -4
- package/dist/utils/DTOs.esm.js.map +1 -1
- package/dist/utils/constants.esm.js +1 -1
- package/dist/utils/constants.esm.js.map +1 -1
- package/dist/utils/hooks.esm.js +22 -20
- package/dist/utils/hooks.esm.js.map +1 -1
- package/dist/utils/style.esm.js +0 -16
- package/dist/utils/style.esm.js.map +1 -1
- package/dist/utils/translations.esm.js +52 -45
- package/dist/utils/translations.esm.js.map +1 -1
- package/dist/utils/types.esm.js.map +1 -1
- package/dist/utils/utilityfunctions.esm.js +1 -10
- package/dist/utils/utilityfunctions.esm.js.map +1 -1
- package/package.json +1 -1
- package/dist/components/riScDialog/riScDialogStyle.esm.js +0 -34
- package/dist/components/riScDialog/riScDialogStyle.esm.js.map +0 -1
- package/dist/components/riScInfo/riScStatus/riScStatusComponentStyle.esm.js +0 -13
- package/dist/components/riScInfo/riScStatus/riScStatusComponentStyle.esm.js.map +0 -1
- package/dist/components/riScPlugin/linearProgressStyle.esm.js +0 -12
- package/dist/components/riScPlugin/linearProgressStyle.esm.js.map +0 -1
- package/dist/components/scenarioWizard/components/tableStyles.esm.js +0 -43
- package/dist/components/scenarioWizard/components/tableStyles.esm.js.map +0 -1
- package/dist/components/scenarioWizard/scenarioWizardStyle.esm.js +0 -50
- package/dist/components/scenarioWizard/scenarioWizardStyle.esm.js.map +0 -1
- package/dist/components/scenarioWizard/steps/riskStepStyles.esm.js +0 -10
- package/dist/components/scenarioWizard/steps/riskStepStyles.esm.js.map +0 -1
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import SvgIcon from '@mui/material/SvgIcon';
|
|
3
|
+
|
|
4
|
+
const PullRequestSvg = () => /* @__PURE__ */ React.createElement(
|
|
5
|
+
SvgIcon,
|
|
6
|
+
{
|
|
7
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
8
|
+
viewBox: "0 0 16 16",
|
|
9
|
+
sx: {
|
|
10
|
+
width: "24px",
|
|
11
|
+
height: "16px",
|
|
12
|
+
fill: "none",
|
|
13
|
+
transform: "translateY(2px)",
|
|
14
|
+
color: (theme) => theme.palette.mode === "dark" ? "white" : "rgba(0, 0, 0, 0.87)"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
/* @__PURE__ */ React.createElement(
|
|
18
|
+
"path",
|
|
19
|
+
{
|
|
20
|
+
d: "M9.55625 0.065625C9.825 0.184375 10 0.453125 10 0.75V2.25H10.5C12.5719 2.25 14.25 3.92812 14.25 6V11.1156C15.2656 11.4344 16 12.3813 16 13.5C16 14.8813 14.8813 16 13.5 16C12.1187 16 11 14.8813 11 13.5C11 12.3813 11.7344 11.4344 12.75 11.1156V6C12.75 4.75625 11.7437 3.75 10.5 3.75H10V5.25C10 5.54688 9.825 5.81562 9.55625 5.93437C9.2875 6.05312 8.96875 6.00625 8.75 5.80625L6.25 3.55625C6.09062 3.4125 6.00313 3.2125 6.00313 3C6.00313 2.7875 6.09375 2.58437 6.25 2.44375L8.75 0.19375C8.96875 -0.00312501 9.2875 -0.053125 9.55625 0.065625ZM3.5 2.5C3.5 2.23478 3.39464 1.98043 3.20711 1.79289C3.01957 1.60536 2.76522 1.5 2.5 1.5C2.23478 1.5 1.98043 1.60536 1.79289 1.79289C1.60536 1.98043 1.5 2.23478 1.5 2.5C1.5 2.76522 1.60536 3.01957 1.79289 3.20711C1.98043 3.39464 2.23478 3.5 2.5 3.5C2.76522 3.5 3.01957 3.39464 3.20711 3.20711C3.39464 3.01957 3.5 2.76522 3.5 2.5ZM3.25 4.88438V11.1156C4.26562 11.4344 5 12.3813 5 13.5C5 14.8813 3.88125 16 2.5 16C1.11875 16 0 14.8813 0 13.5C0 12.3813 0.734375 11.4344 1.75 11.1156V4.88438C0.734375 4.56563 0 3.61875 0 2.5C0 1.11875 1.11875 0 2.5 0C3.88125 0 5 1.11875 5 2.5C5 3.61875 4.26562 4.56563 3.25 4.88438ZM3.5 13.5C3.5 13.2348 3.39464 12.9804 3.20711 12.7929C3.01957 12.6054 2.76522 12.5 2.5 12.5C2.23478 12.5 1.98043 12.6054 1.79289 12.7929C1.60536 12.9804 1.5 13.2348 1.5 13.5C1.5 13.7652 1.60536 14.0196 1.79289 14.2071C1.98043 14.3946 2.23478 14.5 2.5 14.5C2.76522 14.5 3.01957 14.3946 3.20711 14.2071C3.39464 14.0196 3.5 13.7652 3.5 13.5ZM13.5 14.5C13.7652 14.5 14.0196 14.3946 14.2071 14.2071C14.3946 14.0196 14.5 13.7652 14.5 13.5C14.5 13.2348 14.3946 12.9804 14.2071 12.7929C14.0196 12.6054 13.7652 12.5 13.5 12.5C13.2348 12.5 12.9804 12.6054 12.7929 12.7929C12.6054 12.9804 12.5 13.2348 12.5 13.5C12.5 13.7652 12.6054 14.0196 12.7929 14.2071C12.9804 14.3946 13.2348 14.5 13.5 14.5Z",
|
|
21
|
+
fill: "currentColor"
|
|
22
|
+
}
|
|
23
|
+
)
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
export { PullRequestSvg };
|
|
27
|
+
//# sourceMappingURL=Icons.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Icons.esm.js","sources":["../../../src/components/common/Icons.tsx"],"sourcesContent":["import React from 'react';\nimport SvgIcon from '@mui/material/SvgIcon';\n\nexport const PullRequestSvg = () => (\n <SvgIcon\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 16 16\"\n sx={{\n width: '24px',\n height: '16px',\n fill: 'none',\n transform: 'translateY(2px)',\n color: theme =>\n theme.palette.mode === 'dark' ? 'white' : 'rgba(0, 0, 0, 0.87)',\n }}\n >\n <path\n d=\"M9.55625 0.065625C9.825 0.184375 10 0.453125 10 0.75V2.25H10.5C12.5719 2.25 14.25 3.92812 14.25 6V11.1156C15.2656 11.4344 16 12.3813 16 13.5C16 14.8813 14.8813 16 13.5 16C12.1187 16 11 14.8813 11 13.5C11 12.3813 11.7344 11.4344 12.75 11.1156V6C12.75 4.75625 11.7437 3.75 10.5 3.75H10V5.25C10 5.54688 9.825 5.81562 9.55625 5.93437C9.2875 6.05312 8.96875 6.00625 8.75 5.80625L6.25 3.55625C6.09062 3.4125 6.00313 3.2125 6.00313 3C6.00313 2.7875 6.09375 2.58437 6.25 2.44375L8.75 0.19375C8.96875 -0.00312501 9.2875 -0.053125 9.55625 0.065625ZM3.5 2.5C3.5 2.23478 3.39464 1.98043 3.20711 1.79289C3.01957 1.60536 2.76522 1.5 2.5 1.5C2.23478 1.5 1.98043 1.60536 1.79289 1.79289C1.60536 1.98043 1.5 2.23478 1.5 2.5C1.5 2.76522 1.60536 3.01957 1.79289 3.20711C1.98043 3.39464 2.23478 3.5 2.5 3.5C2.76522 3.5 3.01957 3.39464 3.20711 3.20711C3.39464 3.01957 3.5 2.76522 3.5 2.5ZM3.25 4.88438V11.1156C4.26562 11.4344 5 12.3813 5 13.5C5 14.8813 3.88125 16 2.5 16C1.11875 16 0 14.8813 0 13.5C0 12.3813 0.734375 11.4344 1.75 11.1156V4.88438C0.734375 4.56563 0 3.61875 0 2.5C0 1.11875 1.11875 0 2.5 0C3.88125 0 5 1.11875 5 2.5C5 3.61875 4.26562 4.56563 3.25 4.88438ZM3.5 13.5C3.5 13.2348 3.39464 12.9804 3.20711 12.7929C3.01957 12.6054 2.76522 12.5 2.5 12.5C2.23478 12.5 1.98043 12.6054 1.79289 12.7929C1.60536 12.9804 1.5 13.2348 1.5 13.5C1.5 13.7652 1.60536 14.0196 1.79289 14.2071C1.98043 14.3946 2.23478 14.5 2.5 14.5C2.76522 14.5 3.01957 14.3946 3.20711 14.2071C3.39464 14.0196 3.5 13.7652 3.5 13.5ZM13.5 14.5C13.7652 14.5 14.0196 14.3946 14.2071 14.2071C14.3946 14.0196 14.5 13.7652 14.5 13.5C14.5 13.2348 14.3946 12.9804 14.2071 12.7929C14.0196 12.6054 13.7652 12.5 13.5 12.5C13.2348 12.5 12.9804 12.6054 12.7929 12.7929C12.6054 12.9804 12.5 13.2348 12.5 13.5C12.5 13.7652 12.6054 14.0196 12.7929 14.2071C12.9804 14.3946 13.2348 14.5 13.5 14.5Z\"\n fill=\"currentColor\"\n />\n </SvgIcon>\n);\n"],"names":[],"mappings":";;;AAGO,MAAM,iBAAiB,sBAC5B,KAAA,CAAA,aAAA;AAAA,EAAC,OAAA;AAAA,EAAA;AAAA,IACC,KAAM,EAAA,4BAAA;AAAA,IACN,OAAQ,EAAA,WAAA;AAAA,IACR,EAAI,EAAA;AAAA,MACF,KAAO,EAAA,MAAA;AAAA,MACP,MAAQ,EAAA,MAAA;AAAA,MACR,IAAM,EAAA,MAAA;AAAA,MACN,SAAW,EAAA,iBAAA;AAAA,MACX,OAAO,CACL,KAAA,KAAA,KAAA,CAAM,OAAQ,CAAA,IAAA,KAAS,SAAS,OAAU,GAAA,qBAAA;AAAA,KAC9C;AAAA,GAAA;AAAA,kBAEA,KAAA,CAAA,aAAA;AAAA,IAAC,MAAA;AAAA,IAAA;AAAA,MACC,CAAE,EAAA,6yDAAA;AAAA,MACF,IAAK,EAAA,cAAA;AAAA,KAAA;AAAA,GACP;AACF;;;;"}
|
|
@@ -3,29 +3,40 @@ import FormHelperText from '@mui/material/FormHelperText';
|
|
|
3
3
|
import FormLabel from '@mui/material/FormLabel';
|
|
4
4
|
import TextField from '@mui/material/TextField';
|
|
5
5
|
import React, { forwardRef } from 'react';
|
|
6
|
-
import { formLabel,
|
|
6
|
+
import { formLabel, formHelperText } from './typography.esm.js';
|
|
7
7
|
|
|
8
8
|
const Input = forwardRef(
|
|
9
9
|
({ label, sublabel, error, helperText, required, ...props }, ref) => {
|
|
10
|
-
return /* @__PURE__ */ React.createElement(
|
|
11
|
-
|
|
10
|
+
return /* @__PURE__ */ React.createElement(
|
|
11
|
+
FormControl,
|
|
12
12
|
{
|
|
13
|
-
|
|
13
|
+
sx: { width: "100%", gap: "4px" },
|
|
14
14
|
error,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
15
|
+
required
|
|
16
|
+
},
|
|
17
|
+
label && /* @__PURE__ */ React.createElement(FormLabel, { required, sx: formLabel }, label),
|
|
18
|
+
sublabel && /* @__PURE__ */ React.createElement(FormHelperText, { sx: formHelperText }, sublabel),
|
|
19
|
+
/* @__PURE__ */ React.createElement(
|
|
20
|
+
TextField,
|
|
21
|
+
{
|
|
22
|
+
id: "filled-multiline-static",
|
|
23
|
+
error,
|
|
24
|
+
multiline: true,
|
|
25
|
+
fullWidth: true,
|
|
26
|
+
variant: "outlined",
|
|
27
|
+
inputRef: ref,
|
|
28
|
+
InputProps: {
|
|
29
|
+
sx: (theme) => ({
|
|
30
|
+
"&.Mui-disabled": {
|
|
31
|
+
color: theme.palette.mode === "dark" ? "#FFFFFF80" : "#757575"
|
|
32
|
+
}
|
|
33
|
+
})
|
|
34
|
+
},
|
|
35
|
+
...props
|
|
36
|
+
}
|
|
37
|
+
),
|
|
38
|
+
helperText && /* @__PURE__ */ React.createElement(FormHelperText, null, helperText)
|
|
39
|
+
);
|
|
29
40
|
}
|
|
30
41
|
);
|
|
31
42
|
|
|
@@ -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 React, { forwardRef } from 'react';\nimport {
|
|
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 React, { 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\n sx={{ width: '100%', gap: '4px' }}\n error={error}\n required={required}\n >\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: theme.palette.mode === 'dark' ? '#FFFFFF80' : '#757575',\n },\n }),\n }}\n {...props}\n />\n {helperText && <FormHelperText>{helperText}</FormHelperText>}\n </FormControl>\n );\n },\n);\n"],"names":[],"mappings":";;;;;;;AAWO,MAAM,KAAQ,GAAA,UAAA;AAAA,EACnB,CAAC,EAAE,KAAA,EAAO,QAAU,EAAA,KAAA,EAAO,YAAY,QAAU,EAAA,GAAG,KAAM,EAAA,EAAG,GAAQ,KAAA;AACnE,IACE,uBAAA,KAAA,CAAA,aAAA;AAAA,MAAC,WAAA;AAAA,MAAA;AAAA,QACC,EAAI,EAAA,EAAE,KAAO,EAAA,MAAA,EAAQ,KAAK,KAAM,EAAA;AAAA,QAChC,KAAA;AAAA,QACA,QAAA;AAAA,OAAA;AAAA,MAEC,yBACE,KAAA,CAAA,aAAA,CAAA,SAAA,EAAA,EAAU,QAAoB,EAAA,EAAA,EAAI,aAChC,KACH,CAAA;AAAA,MAED,QACC,oBAAA,KAAA,CAAA,aAAA,CAAC,cAAe,EAAA,EAAA,EAAA,EAAI,kBAAiB,QAAS,CAAA;AAAA,sBAEhD,KAAA,CAAA,aAAA;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,KAAO,EAAA,KAAA,CAAM,OAAQ,CAAA,IAAA,KAAS,SAAS,WAAc,GAAA,SAAA;AAAA,eACvD;AAAA,aACF,CAAA;AAAA,WACF;AAAA,UACC,GAAG,KAAA;AAAA,SAAA;AAAA,OACN;AAAA,MACC,UAAA,oBAAe,KAAA,CAAA,aAAA,CAAA,cAAA,EAAA,IAAA,EAAgB,UAAW,CAAA;AAAA,KAC7C,CAAA;AAAA,GAEJ;AACF;;;;"}
|
|
@@ -11,7 +11,7 @@ import MUISelect from '@mui/material/Select';
|
|
|
11
11
|
import Checkbox from '@mui/material/Checkbox';
|
|
12
12
|
import MenuItem from '@mui/material/MenuItem';
|
|
13
13
|
import ListItemText from '@mui/material/ListItemText';
|
|
14
|
-
import { formLabel,
|
|
14
|
+
import { formLabel, formHelperText } from './typography.esm.js';
|
|
15
15
|
|
|
16
16
|
const Select = ({
|
|
17
17
|
label,
|
|
@@ -57,7 +57,7 @@ const Select = ({
|
|
|
57
57
|
if (Array.isArray(fieldValue)) return fieldValue.includes(optionValue);
|
|
58
58
|
return fieldValue === optionValue;
|
|
59
59
|
};
|
|
60
|
-
return /* @__PURE__ */ React.createElement(FormControl, { sx: { width: "100%" } }, label && /* @__PURE__ */ React.createElement(FormLabel, { sx: formLabel, required }, label), sublabel && /* @__PURE__ */ React.createElement(FormHelperText, { sx:
|
|
60
|
+
return /* @__PURE__ */ React.createElement(FormControl, { sx: { width: "100%", gap: "4px" } }, label && /* @__PURE__ */ React.createElement(FormLabel, { sx: formLabel, required }, label), sublabel && /* @__PURE__ */ React.createElement(FormHelperText, { sx: formHelperText }, sublabel), /* @__PURE__ */ React.createElement(
|
|
61
61
|
MUISelect,
|
|
62
62
|
{
|
|
63
63
|
MenuProps: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Select.esm.js","sources":["../../../src/components/common/Select.tsx"],"sourcesContent":["import React from 'react';\nimport {\n Control,\n FieldValues,\n Path,\n PathValue,\n useController,\n} from 'react-hook-form';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { pluginRiScTranslationRef } from '../../utils/translations';\nimport Box from '@mui/material/Box';\nimport Chip from '@mui/material/Chip';\nimport FormControl from '@mui/material/FormControl';\nimport FormHelperText from '@mui/material/FormHelperText';\nimport FormLabel from '@mui/material/FormLabel';\nimport MUISelect, { SelectProps } from '@mui/material/Select';\nimport Checkbox from '@mui/material/Checkbox';\nimport MenuItem from '@mui/material/MenuItem';\nimport ListItemText from '@mui/material/ListItemText';\nimport {
|
|
1
|
+
{"version":3,"file":"Select.esm.js","sources":["../../../src/components/common/Select.tsx"],"sourcesContent":["import React from 'react';\nimport {\n Control,\n FieldValues,\n Path,\n PathValue,\n useController,\n} from 'react-hook-form';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { pluginRiScTranslationRef } from '../../utils/translations';\nimport Box from '@mui/material/Box';\nimport Chip from '@mui/material/Chip';\nimport FormControl from '@mui/material/FormControl';\nimport FormHelperText from '@mui/material/FormHelperText';\nimport FormLabel from '@mui/material/FormLabel';\nimport MUISelect, { SelectProps } from '@mui/material/Select';\nimport Checkbox from '@mui/material/Checkbox';\nimport MenuItem from '@mui/material/MenuItem';\nimport ListItemText from '@mui/material/ListItemText';\nimport { formHelperText, formLabel } from './typography';\n\ntype Props<T extends FieldValues> = SelectProps & {\n sublabel?: string;\n helperText?: string;\n control?: Control<T, any>;\n name: Path<T>;\n labelTranslationKey?: string;\n options: { value: string | number; renderedValue: string | number }[];\n};\n\nexport const Select = <T extends FieldValues>({\n label,\n sublabel,\n error,\n helperText,\n required,\n control,\n name,\n multiple,\n labelTranslationKey,\n options,\n ...props\n}: Props<T>) => {\n const { t } = useTranslationRef(pluginRiScTranslationRef);\n const { field } = useController({\n name,\n control,\n rules: { required },\n });\n\n // values er strengt tatt unknown, men da må vi bruke mye ts-ignore for å komme i mål\n const renderValue = (values: any) =>\n multiple ? (\n <Box\n sx={{\n display: 'flex',\n flexWrap: 'wrap',\n marginBottom: 0,\n paddingBottom: 0,\n }}\n >\n {values.map((value: string) => (\n <Chip\n key={value}\n label={\n /* @ts-ignore Because ts can't typecheck strings against our keys */\n labelTranslationKey ? t(`${labelTranslationKey}.${value}`) : value\n }\n />\n ))}\n </Box>\n ) : (\n options.find(option => option.value === values)?.renderedValue\n );\n\n const handleChecked = (\n fieldValue: PathValue<T, (string | undefined) & Path<T>>,\n optionValue: Props<T>['options'][0]['value'],\n ) => {\n if (Array.isArray(fieldValue)) return fieldValue.includes(optionValue);\n return fieldValue === optionValue;\n };\n\n return (\n <FormControl sx={{ width: '100%', gap: '4px' }}>\n {label && (\n <FormLabel sx={formLabel} required={required}>\n {label}\n </FormLabel>\n )}\n {sublabel && (\n <FormHelperText sx={formHelperText}>{sublabel}</FormHelperText>\n )}\n\n <MUISelect\n MenuProps={{\n disablePortal: true,\n }}\n variant=\"outlined\"\n renderValue={renderValue}\n multiple={multiple}\n SelectDisplayProps={\n multiple\n ? {\n style: {\n paddingBottom: 8,\n paddingTop: 16,\n minHeight: 40,\n },\n }\n : {}\n }\n inputRef={field.ref}\n {...field}\n {...props}\n >\n {options.map(option => (\n <MenuItem key={option.value} value={option.value}>\n {multiple && (\n <Checkbox checked={handleChecked(field.value, option.value)} />\n )}\n <ListItemText primary={option.renderedValue} />\n </MenuItem>\n ))}\n </MUISelect>\n {error && <FormHelperText error>{helperText}</FormHelperText>}\n </FormControl>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AA8BO,MAAM,SAAS,CAAwB;AAAA,EAC5C,KAAA;AAAA,EACA,QAAA;AAAA,EACA,KAAA;AAAA,EACA,UAAA;AAAA,EACA,QAAA;AAAA,EACA,OAAA;AAAA,EACA,IAAA;AAAA,EACA,QAAA;AAAA,EACA,mBAAA;AAAA,EACA,OAAA;AAAA,EACA,GAAG,KAAA;AACL,CAAgB,KAAA;AACd,EAAA,MAAM,EAAE,CAAA,EAAM,GAAA,iBAAA,CAAkB,wBAAwB,CAAA,CAAA;AACxD,EAAM,MAAA,EAAE,KAAM,EAAA,GAAI,aAAc,CAAA;AAAA,IAC9B,IAAA;AAAA,IACA,OAAA;AAAA,IACA,KAAA,EAAO,EAAE,QAAS,EAAA;AAAA,GACnB,CAAA,CAAA;AAGD,EAAM,MAAA,WAAA,GAAc,CAAC,MAAA,KACnB,QACE,m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,OACjB;AAAA,MACA,OAAQ,EAAA,UAAA;AAAA,MACR,WAAA;AAAA,MACA,QAAA;AAAA,MACA,oBACE,QACI,GAAA;AAAA,QACE,KAAO,EAAA;AAAA,UACL,aAAe,EAAA,CAAA;AAAA,UACf,UAAY,EAAA,EAAA;AAAA,UACZ,SAAW,EAAA,EAAA;AAAA,SACb;AAAA,UAEF,EAAC;AAAA,MAEP,UAAU,KAAM,CAAA,GAAA;AAAA,MACf,GAAG,KAAA;AAAA,MACH,GAAG,KAAA;AAAA,KAAA;AAAA,IAEH,OAAQ,CAAA,GAAA,CAAI,CACX,MAAA,qBAAA,KAAA,CAAA,aAAA,CAAC,QAAS,EAAA,EAAA,GAAA,EAAK,MAAO,CAAA,KAAA,EAAO,KAAO,EAAA,MAAA,CAAO,KACxC,EAAA,EAAA,QAAA,oBACE,KAAA,CAAA,aAAA,CAAA,QAAA,EAAA,EAAS,OAAS,EAAA,aAAA,CAAc,KAAM,CAAA,KAAA,EAAO,MAAO,CAAA,KAAK,CAAG,EAAA,CAAA,kBAE9D,KAAA,CAAA,aAAA,CAAA,YAAA,EAAA,EAAa,OAAS,EAAA,MAAA,CAAO,aAAe,EAAA,CAC/C,CACD,CAAA;AAAA,KAEF,KAAS,oBAAA,KAAA,CAAA,aAAA,CAAC,kBAAe,KAAK,EAAA,IAAA,EAAA,EAAE,UAAW,CAC9C,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mixins.esm.js","sources":["../../../src/components/common/mixins.ts"],"sourcesContent":["import { SxProps, Theme } from '@mui/material/styles';\n\nexport const dialogActions: SxProps<Theme> = {\n gap: 1,\n paddingTop: 0,\n paddingX: 3,\n paddingBottom: 2,\n};\n"],"names":[],"mappings":"AAEO,MAAM,aAAgC,GAAA;AAAA,EAC3C,GAAK,EAAA,CAAA;AAAA,EACL,UAAY,EAAA,CAAA;AAAA,EACZ,QAAU,EAAA,CAAA;AAAA,EACV,aAAe,EAAA,CAAA;AACjB;;;;"}
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
const formLabel = {
|
|
2
|
-
fontSize: "0.875rem",
|
|
3
|
-
fontWeight: 700,
|
|
4
|
-
textTransform: "uppercase",
|
|
5
|
-
marginBottom: "8px"
|
|
6
|
-
};
|
|
7
1
|
const heading1 = {
|
|
8
2
|
fontSize: "2rem",
|
|
9
3
|
fontWeight: 700
|
|
10
4
|
};
|
|
5
|
+
const heading2 = {
|
|
6
|
+
fontSize: "1.75rem",
|
|
7
|
+
fontWeight: 500
|
|
8
|
+
};
|
|
11
9
|
const heading3 = {
|
|
12
10
|
fontSize: "1.25rem",
|
|
13
11
|
fontWeight: 500
|
|
@@ -27,21 +25,35 @@ const label = {
|
|
|
27
25
|
textTransform: "uppercase",
|
|
28
26
|
paddingBottom: "0.4rem"
|
|
29
27
|
};
|
|
30
|
-
const labelSubtitle = {
|
|
31
|
-
fontSize: "0.875rem",
|
|
32
|
-
fontWeight: 400,
|
|
33
|
-
paddingBottom: "0.4rem",
|
|
34
|
-
marginTop: "-0.2rem"
|
|
35
|
-
};
|
|
36
28
|
const label2 = {
|
|
37
29
|
fontSize: "0.875rem",
|
|
38
30
|
fontWeight: 700,
|
|
39
31
|
textTransform: "uppercase"
|
|
40
32
|
};
|
|
33
|
+
const formLabel = {
|
|
34
|
+
fontSize: "0.875rem",
|
|
35
|
+
fontWeight: 700,
|
|
36
|
+
textTransform: "uppercase",
|
|
37
|
+
color: "inherit"
|
|
38
|
+
};
|
|
39
|
+
const formHelperText = {
|
|
40
|
+
fontSize: "0.875rem",
|
|
41
|
+
fontWeight: 400,
|
|
42
|
+
color: "inherit",
|
|
43
|
+
margin: 0
|
|
44
|
+
};
|
|
41
45
|
const emptyState = {
|
|
42
46
|
fontSize: "1rem",
|
|
43
47
|
fontStyle: "italic"
|
|
44
48
|
};
|
|
49
|
+
const subtitle1 = {
|
|
50
|
+
fontSize: "1rem",
|
|
51
|
+
fontWeight: 700
|
|
52
|
+
};
|
|
53
|
+
const subtitle2 = {
|
|
54
|
+
fontSize: "1rem",
|
|
55
|
+
fontWeight: 400
|
|
56
|
+
};
|
|
45
57
|
|
|
46
|
-
export { body1, body2, emptyState, formLabel, heading1, heading3, label, label2,
|
|
58
|
+
export { body1, body2, emptyState, formHelperText, formLabel, heading1, heading2, heading3, label, label2, subtitle1, subtitle2 };
|
|
47
59
|
//# sourceMappingURL=typography.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typography.esm.js","sources":["../../../src/components/common/typography.ts"],"sourcesContent":["import { SxProps, Theme } from '@mui/material/styles';\n\nexport const
|
|
1
|
+
{"version":3,"file":"typography.esm.js","sources":["../../../src/components/common/typography.ts"],"sourcesContent":["import { SxProps, Theme } from '@mui/material/styles';\n\nexport const heading1: SxProps<Theme> = {\n fontSize: '2rem',\n fontWeight: 700,\n};\n\nexport const heading2: SxProps<Theme> = {\n fontSize: '1.75rem',\n fontWeight: 500,\n};\n\nexport const heading3: SxProps<Theme> = {\n fontSize: '1.25rem',\n fontWeight: 500,\n};\n\nexport const body1: SxProps<Theme> = {\n fontSize: '1rem',\n fontWeight: 500,\n};\n\nexport const body2: SxProps<Theme> = {\n fontSize: '1rem',\n fontWeight: 400,\n whiteSpace: 'pre-line',\n};\n\nexport const label: SxProps<Theme> = {\n fontSize: '0.875rem',\n fontWeight: 700,\n textTransform: 'uppercase',\n paddingBottom: '0.4rem',\n};\n\nexport const label2: SxProps<Theme> = {\n fontSize: '0.875rem',\n fontWeight: 700,\n textTransform: 'uppercase',\n};\n\nexport const formLabel: SxProps<Theme> = {\n fontSize: '0.875rem',\n fontWeight: 700,\n textTransform: 'uppercase',\n color: 'inherit',\n};\n\nexport const formHelperText: SxProps<Theme> = {\n fontSize: '0.875rem',\n fontWeight: 400,\n color: 'inherit',\n margin: 0,\n};\n\nexport const emptyState: SxProps<Theme> = {\n fontSize: '1rem',\n fontStyle: 'italic',\n};\n\nexport const subtitle1: SxProps<Theme> = {\n fontSize: '1rem',\n fontWeight: 700,\n};\n\nexport const subtitle2: SxProps<Theme> = {\n fontSize: '1rem',\n fontWeight: 400,\n};\n\nexport const headerSubtitle: SxProps<Theme> = {\n fontSize: '1rem',\n fontWeight: 500,\n paddingBottom: '1rem',\n marginTop: '-0.2rem',\n};\n"],"names":[],"mappings":"AAEO,MAAM,QAA2B,GAAA;AAAA,EACtC,QAAU,EAAA,MAAA;AAAA,EACV,UAAY,EAAA,GAAA;AACd,EAAA;AAEO,MAAM,QAA2B,GAAA;AAAA,EACtC,QAAU,EAAA,SAAA;AAAA,EACV,UAAY,EAAA,GAAA;AACd,EAAA;AAEO,MAAM,QAA2B,GAAA;AAAA,EACtC,QAAU,EAAA,SAAA;AAAA,EACV,UAAY,EAAA,GAAA;AACd,EAAA;AAEO,MAAM,KAAwB,GAAA;AAAA,EACnC,QAAU,EAAA,MAAA;AAAA,EACV,UAAY,EAAA,GAAA;AACd,EAAA;AAEO,MAAM,KAAwB,GAAA;AAAA,EACnC,QAAU,EAAA,MAAA;AAAA,EACV,UAAY,EAAA,GAAA;AAAA,EACZ,UAAY,EAAA,UAAA;AACd,EAAA;AAEO,MAAM,KAAwB,GAAA;AAAA,EACnC,QAAU,EAAA,UAAA;AAAA,EACV,UAAY,EAAA,GAAA;AAAA,EACZ,aAAe,EAAA,WAAA;AAAA,EACf,aAAe,EAAA,QAAA;AACjB,EAAA;AAEO,MAAM,MAAyB,GAAA;AAAA,EACpC,QAAU,EAAA,UAAA;AAAA,EACV,UAAY,EAAA,GAAA;AAAA,EACZ,aAAe,EAAA,WAAA;AACjB,EAAA;AAEO,MAAM,SAA4B,GAAA;AAAA,EACvC,QAAU,EAAA,UAAA;AAAA,EACV,UAAY,EAAA,GAAA;AAAA,EACZ,aAAe,EAAA,WAAA;AAAA,EACf,KAAO,EAAA,SAAA;AACT,EAAA;AAEO,MAAM,cAAiC,GAAA;AAAA,EAC5C,QAAU,EAAA,UAAA;AAAA,EACV,UAAY,EAAA,GAAA;AAAA,EACZ,KAAO,EAAA,SAAA;AAAA,EACP,MAAQ,EAAA,CAAA;AACV,EAAA;AAEO,MAAM,UAA6B,GAAA;AAAA,EACxC,QAAU,EAAA,MAAA;AAAA,EACV,SAAW,EAAA,QAAA;AACb,EAAA;AAEO,MAAM,SAA4B,GAAA;AAAA,EACvC,QAAU,EAAA,MAAA;AAAA,EACV,UAAY,EAAA,GAAA;AACd,EAAA;AAEO,MAAM,SAA4B,GAAA;AAAA,EACvC,QAAU,EAAA,MAAA;AAAA,EACV,UAAY,EAAA,GAAA;AACd;;;;"}
|
|
@@ -1,12 +1,16 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import { Dialog, DialogContent, Typography, Box, Button } from '@material-ui/core';
|
|
3
|
-
import { TextField } from '../common/Textfield.esm.js';
|
|
1
|
+
import React from 'react';
|
|
4
2
|
import { emptyRiSc } from '../../utils/utilityfunctions.esm.js';
|
|
5
3
|
import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
|
|
6
4
|
import { pluginRiScTranslationRef } from '../../utils/translations.esm.js';
|
|
7
|
-
import { useRiScDialogStyles } from './riScDialogStyle.esm.js';
|
|
8
|
-
import { useFontStyles } from '../../utils/style.esm.js';
|
|
9
5
|
import { useRiScs } from '../../contexts/RiScContext.esm.js';
|
|
6
|
+
import { useForm } from 'react-hook-form';
|
|
7
|
+
import { Input } from '../common/Input.esm.js';
|
|
8
|
+
import Button from '@mui/material/Button';
|
|
9
|
+
import Dialog from '@mui/material/Dialog';
|
|
10
|
+
import DialogContent from '@mui/material/DialogContent';
|
|
11
|
+
import DialogTitle from '@mui/material/DialogTitle';
|
|
12
|
+
import DialogActions from '@mui/material/DialogActions';
|
|
13
|
+
import { dialogActions } from '../common/mixins.esm.js';
|
|
10
14
|
|
|
11
15
|
var RiScDialogStates = /* @__PURE__ */ ((RiScDialogStates2) => {
|
|
12
16
|
RiScDialogStates2[RiScDialogStates2["Closed"] = 0] = "Closed";
|
|
@@ -16,100 +20,50 @@ var RiScDialogStates = /* @__PURE__ */ ((RiScDialogStates2) => {
|
|
|
16
20
|
})(RiScDialogStates || {});
|
|
17
21
|
const RiScDialog = ({ onClose, dialogState }) => {
|
|
18
22
|
const { t } = useTranslationRef(pluginRiScTranslationRef);
|
|
19
|
-
const { paper, content, buttons } = useRiScDialogStyles();
|
|
20
|
-
const { h1 } = useFontStyles();
|
|
21
23
|
const { selectedRiSc, createNewRiSc, updateRiSc } = useRiScs();
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
const {
|
|
25
|
+
register,
|
|
26
|
+
handleSubmit,
|
|
27
|
+
formState: { isDirty, errors }
|
|
28
|
+
} = useForm({
|
|
29
|
+
defaultValues: dialogState === 1 /* Edit */ ? selectedRiSc.content : emptyRiSc(),
|
|
30
|
+
mode: "onBlur"
|
|
28
31
|
});
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
setNewRiSc(emptyRiSc());
|
|
32
|
-
setNewRiScError({
|
|
33
|
-
title: null,
|
|
34
|
-
scope: null
|
|
35
|
-
});
|
|
36
|
-
};
|
|
37
|
-
const handleSave = () => {
|
|
38
|
-
setNewRiScError({
|
|
39
|
-
title: newRiSc.title === "" ? t("rosDialog.titleError") : null,
|
|
40
|
-
scope: newRiSc.scope === "" ? t("rosDialog.scopeError") : null
|
|
41
|
-
});
|
|
42
|
-
if (!newRiSc.title || !newRiSc.scope) return;
|
|
32
|
+
const titleTranslation = dialogState === 2 /* Create */ ? t("rosDialog.titleNew") : t("rosDialog.titleEdit");
|
|
33
|
+
const onSubmit = handleSubmit((data) => {
|
|
43
34
|
if (dialogState === 2 /* Create */) {
|
|
44
|
-
createNewRiSc(
|
|
35
|
+
createNewRiSc(data);
|
|
45
36
|
} else {
|
|
46
|
-
updateRiSc(
|
|
37
|
+
updateRiSc(data);
|
|
47
38
|
}
|
|
48
|
-
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
...newRiScError,
|
|
53
|
-
title: null
|
|
54
|
-
});
|
|
55
|
-
setNewRiSc({
|
|
56
|
-
...newRiSc,
|
|
57
|
-
title
|
|
58
|
-
});
|
|
59
|
-
};
|
|
60
|
-
const setScope = (scope) => {
|
|
61
|
-
setNewRiScError({
|
|
62
|
-
...newRiScError,
|
|
63
|
-
scope: null
|
|
64
|
-
});
|
|
65
|
-
setNewRiSc({
|
|
66
|
-
...newRiSc,
|
|
67
|
-
scope
|
|
68
|
-
});
|
|
69
|
-
};
|
|
70
|
-
const header = dialogState === 2 /* Create */ ? t("rosDialog.titleNew") : t("rosDialog.titleEdit");
|
|
71
|
-
return /* @__PURE__ */ React.createElement(
|
|
72
|
-
Dialog,
|
|
39
|
+
onClose();
|
|
40
|
+
});
|
|
41
|
+
return /* @__PURE__ */ React.createElement(Dialog, { open: dialogState !== 0 /* Closed */, onClose }, /* @__PURE__ */ React.createElement(DialogTitle, null, titleTranslation), /* @__PURE__ */ React.createElement(
|
|
42
|
+
DialogContent,
|
|
73
43
|
{
|
|
74
|
-
|
|
75
|
-
open: dialogState !== 0 /* Closed */,
|
|
76
|
-
onClose: handleCancel
|
|
44
|
+
sx: { display: "flex", flexDirection: "column", gap: "16px" }
|
|
77
45
|
},
|
|
78
|
-
/* @__PURE__ */ React.createElement(
|
|
79
|
-
|
|
46
|
+
/* @__PURE__ */ React.createElement(
|
|
47
|
+
Input,
|
|
80
48
|
{
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
error: newRiScError.title,
|
|
86
|
-
required: true
|
|
49
|
+
required: true,
|
|
50
|
+
...register("title", { required: true }),
|
|
51
|
+
error: errors.title !== void 0,
|
|
52
|
+
label: t("dictionary.title")
|
|
87
53
|
}
|
|
88
|
-
)
|
|
89
|
-
|
|
54
|
+
),
|
|
55
|
+
/* @__PURE__ */ React.createElement(
|
|
56
|
+
Input,
|
|
90
57
|
{
|
|
58
|
+
required: true,
|
|
59
|
+
...register("scope", { required: true }),
|
|
91
60
|
label: t("dictionary.scope"),
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
minRows: 4
|
|
95
|
-
handleChange: setScope,
|
|
96
|
-
error: newRiScError.scope,
|
|
97
|
-
required: true
|
|
61
|
+
sublabel: t("rosDialog.scopeDescription"),
|
|
62
|
+
error: errors.scope !== void 0,
|
|
63
|
+
minRows: 4
|
|
98
64
|
}
|
|
99
|
-
))),
|
|
100
|
-
/* @__PURE__ */ React.createElement(
|
|
101
|
-
"div",
|
|
102
|
-
{
|
|
103
|
-
style: {
|
|
104
|
-
padding: "20px",
|
|
105
|
-
display: "flex",
|
|
106
|
-
justifyContent: "flex-start",
|
|
107
|
-
alignItems: "center"
|
|
108
|
-
}
|
|
109
|
-
},
|
|
110
|
-
/* @__PURE__ */ React.createElement(Box, { className: buttons }, /* @__PURE__ */ React.createElement(Button, { variant: "contained", color: "primary", onClick: handleSave }, t("dictionary.save")), /* @__PURE__ */ React.createElement(Button, { variant: "outlined", color: "primary", onClick: handleCancel }, t("dictionary.cancel")))
|
|
111
65
|
)
|
|
112
|
-
);
|
|
66
|
+
), /* @__PURE__ */ React.createElement(DialogActions, { sx: dialogActions }, /* @__PURE__ */ React.createElement(Button, { variant: "contained", onClick: onSubmit, disabled: !isDirty }, t("dictionary.save")), /* @__PURE__ */ React.createElement(Button, { variant: "outlined", onClick: onClose }, t("dictionary.cancel"))));
|
|
113
67
|
};
|
|
114
68
|
|
|
115
69
|
export { RiScDialog, RiScDialogStates };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RiScDialog.esm.js","sources":["../../../src/components/riScDialog/RiScDialog.tsx"],"sourcesContent":["import React
|
|
1
|
+
{"version":3,"file":"RiScDialog.esm.js","sources":["../../../src/components/riScDialog/RiScDialog.tsx"],"sourcesContent":["import React from 'react';\nimport { RiSc } from '../../utils/types';\nimport { emptyRiSc } from '../../utils/utilityfunctions';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { pluginRiScTranslationRef } from '../../utils/translations';\nimport { useRiScs } from '../../contexts/RiScContext';\nimport { useForm } from 'react-hook-form';\nimport { Input } from '../common/Input';\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 { dialogActions } from '../common/mixins';\n\nexport enum RiScDialogStates {\n Closed,\n Edit,\n Create,\n}\n\ninterface RiScDialogProps {\n onClose: () => void;\n dialogState: RiScDialogStates;\n}\n\nexport const RiScDialog = ({ onClose, dialogState }: RiScDialogProps) => {\n const { t } = useTranslationRef(pluginRiScTranslationRef);\n const { selectedRiSc, createNewRiSc, updateRiSc } = useRiScs();\n\n const {\n register,\n handleSubmit,\n formState: { isDirty, errors },\n } = useForm<RiSc>({\n defaultValues:\n dialogState === RiScDialogStates.Edit\n ? selectedRiSc!.content\n : emptyRiSc(),\n mode: 'onBlur',\n });\n\n const titleTranslation =\n dialogState === RiScDialogStates.Create\n ? t('rosDialog.titleNew')\n : t('rosDialog.titleEdit');\n\n const onSubmit = handleSubmit((data: RiSc) => {\n if (dialogState === RiScDialogStates.Create) {\n createNewRiSc(data);\n } else {\n updateRiSc(data);\n }\n onClose();\n });\n\n return (\n <Dialog open={dialogState !== RiScDialogStates.Closed} onClose={onClose}>\n <DialogTitle>{titleTranslation}</DialogTitle>\n\n <DialogContent\n sx={{ display: 'flex', flexDirection: 'column', gap: '16px' }}\n >\n <Input\n required\n {...register('title', { required: true })}\n error={errors.title !== undefined}\n label={t('dictionary.title')}\n />\n <Input\n required\n {...register('scope', { required: true })}\n label={t('dictionary.scope')}\n sublabel={t('rosDialog.scopeDescription')}\n error={errors.scope !== undefined}\n minRows={4}\n />\n </DialogContent>\n\n <DialogActions sx={dialogActions}>\n <Button variant=\"contained\" onClick={onSubmit} disabled={!isDirty}>\n {t('dictionary.save')}\n </Button>\n <Button variant=\"outlined\"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A,EAAS,QAAU,EAAA,QAAA,EAAU,CAAC,OAAA,EAAA,EACvD,CAAE,CAAA,iBAAiB,CACtB,CAAA,kBACC,KAAA,CAAA,aAAA,CAAA,MAAA,EAAA,EAAO,OAAQ,EAAA,UAAA,EAAW,OAAS,EAAA,OAAA,EAAA,EACjC,CAAE,CAAA,mBAAmB,CACxB,CACF,CACF,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -36,13 +36,7 @@ const RiScInfo = ({ riSc, edit }) => {
|
|
|
36
36
|
/* @__PURE__ */ React.createElement(Typography, { variant: "h5" }, riSc.content.title),
|
|
37
37
|
/* @__PURE__ */ React.createElement(EditButton, { onClick: edit })
|
|
38
38
|
), /* @__PURE__ */ React.createElement(Typography, { className: label }, t("dictionary.scope")), /* @__PURE__ */ React.createElement(Typography, { className: body2 }, riSc.content.scope))
|
|
39
|
-
), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12, sm: 6, md: 6 }, /* @__PURE__ */ React.createElement(
|
|
40
|
-
RiScStatusComponent,
|
|
41
|
-
{
|
|
42
|
-
selectedRiSc: riSc,
|
|
43
|
-
publishRiScFn: approveRiSc
|
|
44
|
-
}
|
|
45
|
-
))));
|
|
39
|
+
), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12, sm: 6, md: 6 }, /* @__PURE__ */ React.createElement(RiScStatusComponent, { selectedRiSc: riSc, publishRiScFn: approveRiSc })));
|
|
46
40
|
};
|
|
47
41
|
|
|
48
42
|
export { RiScInfo };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RiScInfo.esm.js","sources":["../../../src/components/riScInfo/RiScInfo.tsx"],"sourcesContent":["import React from 'react';\nimport { RiScWithMetadata } from '../../utils/types';\nimport { Box, Grid, Typography } from '@material-ui/core';\nimport { RiScStatusComponent } from './riScStatus/RiScStatusComponent';\nimport { InfoCard } from '@backstage/core-components';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { pluginRiScTranslationRef } from '../../utils/translations';\nimport { useFontStyles } from '../../utils/style';\nimport EditButton from '../common/EditButton';\nimport { useRiScs } from '../../contexts/RiScContext';\n\ninterface RiScInfoProps {\n riSc: RiScWithMetadata;\n edit: () => void;\n}\n\nexport const RiScInfo = ({ riSc, edit }: RiScInfoProps) => {\n const { t } = useTranslationRef(pluginRiScTranslationRef);\n const { label, body2 } = useFontStyles();\n\n const { approveRiSc } = useRiScs();\n\n return (\n <Grid container>\n <Grid\n item\n xs={12}\n sm={6}\n md={6}\n style={{\n display: 'flex',\n flexDirection: 'column',\n }}\n >\n <InfoCard>\n <Box\n style={{\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n }}\n >\n <Typography variant=\"h5\">{riSc.content.title}</Typography>\n <EditButton onClick={edit} />\n </Box>\n <Typography className={label}>{t('dictionary.scope')}</Typography>\n <Typography className={body2}>{riSc.content.scope}</Typography>\n </InfoCard>\n </Grid>\n <Grid item xs={12} sm={6} md={6}>\n <
|
|
1
|
+
{"version":3,"file":"RiScInfo.esm.js","sources":["../../../src/components/riScInfo/RiScInfo.tsx"],"sourcesContent":["import React from 'react';\nimport { RiScWithMetadata } from '../../utils/types';\nimport { Box, Grid, Typography } from '@material-ui/core';\nimport { RiScStatusComponent } from './riScStatus/RiScStatusComponent';\nimport { InfoCard } from '@backstage/core-components';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { pluginRiScTranslationRef } from '../../utils/translations';\nimport { useFontStyles } from '../../utils/style';\nimport EditButton from '../common/EditButton';\nimport { useRiScs } from '../../contexts/RiScContext';\n\ninterface RiScInfoProps {\n riSc: RiScWithMetadata;\n edit: () => void;\n}\n\nexport const RiScInfo = ({ riSc, edit }: RiScInfoProps) => {\n const { t } = useTranslationRef(pluginRiScTranslationRef);\n const { label, body2 } = useFontStyles();\n\n const { approveRiSc } = useRiScs();\n\n return (\n <Grid container>\n <Grid\n item\n xs={12}\n sm={6}\n md={6}\n style={{\n display: 'flex',\n flexDirection: 'column',\n }}\n >\n <InfoCard>\n <Box\n style={{\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n }}\n >\n <Typography variant=\"h5\">{riSc.content.title}</Typography>\n <EditButton onClick={edit} />\n </Box>\n <Typography className={label}>{t('dictionary.scope')}</Typography>\n <Typography className={body2}>{riSc.content.scope}</Typography>\n </InfoCard>\n </Grid>\n <Grid item xs={12} sm={6} md={6}>\n <RiScStatusComponent selectedRiSc={riSc} publishRiScFn={approveRiSc} />\n </Grid>\n </Grid>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;AAgBO,MAAM,QAAW,GAAA,CAAC,EAAE,IAAA,EAAM,MAA0B,KAAA;AACzD,EAAA,MAAM,EAAE,CAAA,EAAM,GAAA,iBAAA,CAAkB,wBAAwB,CAAA,CAAA;AACxD,EAAA,MAAM,EAAE,KAAA,EAAO,KAAM,EAAA,GAAI,aAAc,EAAA,CAAA;AAEvC,EAAM,MAAA,EAAE,WAAY,EAAA,GAAI,QAAS,EAAA,CAAA;AAEjC,EACE,uBAAA,KAAA,CAAA,aAAA,CAAC,IAAK,EAAA,EAAA,SAAA,EAAS,IACb,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,IAAA;AAAA,IAAA;AAAA,MACC,IAAI,EAAA,IAAA;AAAA,MACJ,EAAI,EAAA,EAAA;AAAA,MACJ,EAAI,EAAA,CAAA;AAAA,MACJ,EAAI,EAAA,CAAA;AAAA,MACJ,KAAO,EAAA;AAAA,QACL,OAAS,EAAA,MAAA;AAAA,QACT,aAAe,EAAA,QAAA;AAAA,OACjB;AAAA,KAAA;AAAA,wCAEC,QACC,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,MAAC,GAAA;AAAA,MAAA;AAAA,QACC,KAAO,EAAA;AAAA,UACL,OAAS,EAAA,MAAA;AAAA,UACT,UAAY,EAAA,QAAA;AAAA,UACZ,cAAgB,EAAA,eAAA;AAAA,SAClB;AAAA,OAAA;AAAA,0CAEC,UAAW,EAAA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