@balena/ui-shared-components 13.0.0-build-upgrade-storybook-9-438bc209db8ac0658743037813f035cdb3e395a8-1 → 13.0.0-build-rename-and-require-widget-extracontext-8a761b0e057cdaba8527bd7cde97ff3ea5faa969-1
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/CollapsedList/index.js +4 -3
- package/dist/components/DownloadImageDialog/ApplicationInstructions.js +16 -28
- package/dist/components/DownloadImageDialog/ImageForm.js +6 -7
- package/dist/components/DownloadImageDialog/OsTypeSelector.js +4 -2
- package/dist/components/DownloadImageDialog/VariantSelector.js +3 -2
- package/dist/components/DownloadImageDialog/index.js +4 -3
- package/dist/components/DownloadImageDialog/models.d.ts +1 -32
- package/dist/components/DropDownButton/index.js +4 -3
- package/dist/components/Form/Widgets/PasswordWidget.js +3 -2
- package/dist/components/Form/Widgets/SelectWidget.js +1 -1
- package/dist/components/RJST/components/Widget/Formats/BooleanAsIconWidget.js +1 -1
- package/dist/components/RJST/components/Widget/Formats/CodeWidget.js +1 -1
- package/dist/components/RJST/components/Widget/Formats/DisabledTextWidget.js +1 -1
- package/dist/components/RJST/components/Widget/Formats/DurationWidget.d.ts +1 -6
- package/dist/components/RJST/components/Widget/Formats/DurationWidget.js +1 -1
- package/dist/components/RJST/components/Widget/Formats/ElapsedTimeWidget.js +2 -2
- package/dist/components/RJST/components/Widget/Formats/HashWidget.js +2 -3
- package/dist/components/RJST/components/Widget/Formats/PercentageWidget.js +1 -1
- package/dist/components/RJST/components/Widget/Formats/PlaceholderTextWidget.js +1 -1
- package/dist/components/RJST/components/Widget/Formats/TemperatureWidget.js +1 -1
- package/dist/components/RJST/components/Widget/Formats/TxtWidget.js +9 -9
- package/dist/components/RJST/components/Widget/Formats/WrapWidget.js +1 -1
- package/dist/components/RJST/components/Widget/index.d.ts +1 -1
- package/dist/components/RJST/components/Widget/index.js +2 -2
- package/dist/components/RJST/components/Widget/utils.d.ts +2 -2
- package/dist/components/RJST/components/Widget/utils.js +3 -1
- package/dist/components/RJST/index.d.ts +2 -2
- package/dist/components/RJST/index.js +3 -3
- package/dist/components/RJST/models/helpers.d.ts +1 -5
- package/dist/components/RJST/models/helpers.js +1 -16
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/theme.js +1 -0
- package/package.json +4 -7
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Avatar, Box, Button, Collapse, Typography } from '@mui/material';
|
|
3
3
|
import { useMemo, useState } from 'react';
|
|
4
|
-
import
|
|
5
|
-
import
|
|
4
|
+
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
5
|
+
import { faCaretDown } from '@fortawesome/free-solid-svg-icons/faCaretDown';
|
|
6
|
+
import { faCaretUp } from '@fortawesome/free-solid-svg-icons/faCaretUp';
|
|
6
7
|
/**
|
|
7
8
|
* This will collapse a long list and allow to expand it by clicking the "expand" button.
|
|
8
9
|
*/
|
|
@@ -21,5 +22,5 @@ export const CollapsedList = ({ list, collapseItems = 3, }) => {
|
|
|
21
22
|
}
|
|
22
23
|
return (_jsxs(Box, { display: "flex", flexDirection: "column", justifyContent: "center", children: [_jsx(Collapse, { in: showMore, collapsedSize: collapseItems * 33, children: listItems }), list.length > collapseItems && (_jsxs(Button, { onClick: () => {
|
|
23
24
|
setShowMore(!showMore);
|
|
24
|
-
}, children: [showMore ? 'Less' : 'More', showMore ? _jsx(
|
|
25
|
+
}, children: [showMore ? 'Less' : 'More', showMore ? (_jsx(FontAwesomeIcon, { icon: faCaretUp })) : (_jsx(FontAwesomeIcon, { icon: faCaretDown }))] }))] }));
|
|
25
26
|
};
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import has from 'lodash/has';
|
|
3
3
|
import { interpolateMustache } from './utils';
|
|
4
4
|
import { Box, List, Tab, Tabs, Typography } from '@mui/material';
|
|
5
|
-
import { memo, useEffect,
|
|
5
|
+
import { memo, useEffect, useState } from 'react';
|
|
6
6
|
import { MUILinkWithTracking } from '../MUILinkWithTracking';
|
|
7
7
|
import { OrderedListItem } from '../OrderedListItem';
|
|
8
8
|
import { Markdown } from '../Markdown';
|
|
@@ -19,50 +19,38 @@ export const getUserOs = () => {
|
|
|
19
19
|
}
|
|
20
20
|
return 'Unknown';
|
|
21
21
|
};
|
|
22
|
-
const dtJsonTocontractOsKeyMap = {
|
|
23
|
-
windows: 'Windows',
|
|
24
|
-
osx: 'MacOS',
|
|
25
|
-
linux: 'Linux',
|
|
26
|
-
};
|
|
27
22
|
export const ApplicationInstructions = memo(function ApplicationInstructions({ deviceType, templateData, }) {
|
|
28
23
|
var _a;
|
|
29
24
|
const [currentOs, setCurrentOs] = useState(getUserOs());
|
|
30
|
-
const
|
|
31
|
-
if ((deviceType === null || deviceType === void 0 ? void 0 : deviceType.instructions) == null ||
|
|
32
|
-
Array.isArray(deviceType.instructions) ||
|
|
33
|
-
typeof deviceType.instructions !== 'object') {
|
|
34
|
-
return deviceType === null || deviceType === void 0 ? void 0 : deviceType.instructions;
|
|
35
|
-
}
|
|
36
|
-
const instructionsByOs = deviceType.instructions;
|
|
37
|
-
return Object.fromEntries(Object.entries(instructionsByOs).map(([key, value]) => {
|
|
38
|
-
const normalizedKey = key in dtJsonTocontractOsKeyMap
|
|
39
|
-
? dtJsonTocontractOsKeyMap[key]
|
|
40
|
-
: key;
|
|
41
|
-
return [normalizedKey, value];
|
|
42
|
-
}));
|
|
43
|
-
}, [deviceType === null || deviceType === void 0 ? void 0 : deviceType.instructions]);
|
|
44
|
-
const hasOsSpecificInstructions = !Array.isArray(instructions);
|
|
25
|
+
const hasOsSpecificInstructions = !Array.isArray(deviceType.instructions);
|
|
45
26
|
const normalizedOs = currentOs === 'Unknown' ? 'Linux' : currentOs;
|
|
46
27
|
useEffect(() => {
|
|
47
|
-
if (hasOsSpecificInstructions && instructions) {
|
|
48
|
-
const oses = Object.keys(instructions);
|
|
28
|
+
if (hasOsSpecificInstructions && deviceType.instructions) {
|
|
29
|
+
const oses = Object.keys(deviceType.instructions);
|
|
49
30
|
if (!oses.includes(currentOs) && oses.length > 0) {
|
|
50
31
|
setCurrentOs(oses[0]);
|
|
51
32
|
}
|
|
52
33
|
}
|
|
53
|
-
}, [
|
|
54
|
-
|
|
34
|
+
}, [
|
|
35
|
+
currentOs,
|
|
36
|
+
setCurrentOs,
|
|
37
|
+
deviceType.instructions,
|
|
38
|
+
hasOsSpecificInstructions,
|
|
39
|
+
]);
|
|
40
|
+
if (!deviceType.instructions) {
|
|
55
41
|
return (_jsx(Typography, { variant: "body1", children: "Instructions for this device type are not currently available. Please try again later." }));
|
|
56
42
|
}
|
|
57
|
-
const interpolatedInstructions = (_a = (hasOsSpecificInstructions
|
|
43
|
+
const interpolatedInstructions = (_a = (hasOsSpecificInstructions
|
|
44
|
+
? deviceType.instructions[normalizedOs]
|
|
45
|
+
: deviceType.instructions)) === null || _a === void 0 ? void 0 : _a.map((instruction) => interpolateMustache(templateData, instruction.replace(/<a/, '<a target="_blank"')));
|
|
58
46
|
const finalInstructions = [
|
|
59
47
|
'Use the form on the left to configure and download balenaOS for your new device.',
|
|
60
48
|
...interpolatedInstructions,
|
|
61
49
|
'Your device should appear in your application dashboard within a few minutes. Have fun!',
|
|
62
50
|
];
|
|
63
|
-
return (_jsxs(Box, { display: "flex", flexDirection: "column", alignItems: "flex-start", children: [_jsx(Typography, { variant: "h5", children: "Instructions" }), hasOsSpecificInstructions && (_jsx(Box, { mb: 3, children: _jsx(Box, { sx: { borderBottom: 1, borderColor: 'divider' }, children: _jsx(Tabs, { value: Object.keys(instructions).find((key) => key === currentOs), onChange: (_event, value) => {
|
|
51
|
+
return (_jsxs(Box, { display: "flex", flexDirection: "column", alignItems: "flex-start", children: [_jsx(Typography, { variant: "h5", children: "Instructions" }), hasOsSpecificInstructions && (_jsx(Box, { mb: 3, children: _jsx(Box, { sx: { borderBottom: 1, borderColor: 'divider' }, children: _jsx(Tabs, { value: Object.keys(deviceType.instructions).find((key) => key === currentOs), onChange: (_event, value) => {
|
|
64
52
|
setCurrentOs(value !== null && value !== void 0 ? value : 'Unknown');
|
|
65
|
-
}, "aria-label": "os tabs", children: Object.keys(instructions).map((os) => {
|
|
53
|
+
}, "aria-label": "os tabs", children: Object.keys(deviceType.instructions).map((os) => {
|
|
66
54
|
return _jsx(Tab, { label: os, value: os }, os);
|
|
67
55
|
}) }) }) })), _jsx(InstructionsList, { instructions: finalInstructions }), _jsx(Box, { mt: 2, children: _jsxs(Typography, { children: ["For more details please refer to our", ' ', _jsx(MUILinkWithTracking, { href: `https://www.balena.io/docs/learn/getting-started/${deviceType.slug}/nodejs/`, children: "Getting Started Guide" }), "."] }) })] }));
|
|
68
56
|
});
|
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import { Avatar, Box, Checkbox, Chip, Divider, FormControl, FormControlLabel, FormLabel, InputAdornment, Radio, RadioGroup, TextField, Tooltip, Typography, IconButton, Autocomplete, Stack, Accordion, AccordionSummary, AccordionDetails, accordionSummaryClasses, } from '@mui/material';
|
|
4
|
-
import HelpIcon from '@mui/icons-material/Help';
|
|
5
4
|
import { memo, useCallback, useEffect, useMemo, useState } from 'react';
|
|
6
5
|
import { getPreferredVersionOpts, transformVersions } from './version';
|
|
7
6
|
import { OsTypeSelector } from './OsTypeSelector';
|
|
8
7
|
import { VariantSelector } from './VariantSelector';
|
|
9
|
-
import
|
|
8
|
+
import { faFileLines } from '@fortawesome/free-solid-svg-icons/faFileLines';
|
|
10
9
|
import { MUILinkWithTracking } from '../MUILinkWithTracking';
|
|
11
|
-
import { Visibility, VisibilityOff } from '@mui/icons-material';
|
|
12
10
|
import { FALLBACK_LOGO_UNKNOWN_DEVICE } from './utils';
|
|
13
11
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
14
|
-
import { faChevronRight, faTriangleExclamation, } from '@fortawesome/free-solid-svg-icons';
|
|
12
|
+
import { faChevronRight, faEye, faEyeSlash, faQuestionCircle, faTriangleExclamation, } from '@fortawesome/free-solid-svg-icons';
|
|
15
13
|
import { Callout } from '../Callout';
|
|
16
14
|
import { token } from '../../utils/token';
|
|
17
15
|
const POLL_INTERVAL_DOCS = 'https://www.balena.io/docs/reference/supervisor/bandwidth-reduction/#side-effects--warnings';
|
|
@@ -120,7 +118,7 @@ export const ImageForm = memo(function ImageForm({ compatibleDeviceTypes, osVers
|
|
|
120
118
|
}, renderInput: (_a) => {
|
|
121
119
|
var _b;
|
|
122
120
|
var { InputProps } = _a, params = __rest(_a, ["InputProps"]);
|
|
123
|
-
return (_jsx(TextField, Object.assign({}, params, { label: _jsxs(Stack, { direction: "row", alignItems: "center", gap: 1, children: ["Device type", _jsx(Tooltip, { title: "Applications can support any devices that share the same architecture as their default device type.", children: _jsx(
|
|
121
|
+
return (_jsx(TextField, Object.assign({}, params, { label: _jsxs(Stack, { direction: "row", alignItems: "center", gap: 1, children: ["Device type", _jsx(Tooltip, { title: "Applications can support any devices that share the same architecture as their default device type.", children: _jsx(FontAwesomeIcon, { icon: faQuestionCircle, color: "info", fontSize: "1rem" }) })] }), slotProps: {
|
|
124
122
|
input: Object.assign(Object.assign({}, InputProps), { startAdornment: (_jsx(Avatar, { variant: "square", src: (_b = model.deviceType.logo) !== null && _b !== void 0 ? _b : FALLBACK_LOGO_UNKNOWN_DEVICE, sx: { mr: 3, width: '20px', height: '20px' } })) }),
|
|
125
123
|
} })));
|
|
126
124
|
}, onChange: (_event, value) => {
|
|
@@ -167,7 +165,7 @@ export const ImageForm = memo(function ImageForm({ compatibleDeviceTypes, osVers
|
|
|
167
165
|
setShowPassword((show) => !show);
|
|
168
166
|
}, onMouseDown: (event) => {
|
|
169
167
|
event.preventDefault();
|
|
170
|
-
}, edge: "end", children: showPassword ? _jsx(
|
|
168
|
+
}, edge: "end", children: showPassword ? (_jsx(FontAwesomeIcon, { icon: faEyeSlash })) : (_jsx(FontAwesomeIcon, { icon: faEye })) }) })),
|
|
171
169
|
},
|
|
172
170
|
}, onChange: (event) => {
|
|
173
171
|
onChange({ wifiKey: event.target.value });
|
|
@@ -194,7 +192,8 @@ export const ImageForm = memo(function ImageForm({ compatibleDeviceTypes, osVers
|
|
|
194
192
|
display: 'flex',
|
|
195
193
|
alignItems: 'center',
|
|
196
194
|
height: '1.5rem',
|
|
197
|
-
|
|
195
|
+
gap: 1,
|
|
196
|
+
}, children: _jsx(FontAwesomeIcon, { icon: faFileLines, fontSize: "1.15rem" }) })] }) }), _jsx(TextField, { name: "provisioningKeyName", value: (_a = model.provisioningKeyName) !== null && _a !== void 0 ? _a : '', slotProps: {
|
|
198
197
|
htmlInput: {
|
|
199
198
|
name: 'provisioningKeyName',
|
|
200
199
|
autoComplete: 'provisioningKeyName-auto-complete',
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Box, InputLabel, MenuItem, Select, Tooltip, Typography, Stack, } from '@mui/material';
|
|
3
3
|
import { getOsTypeName } from './utils';
|
|
4
|
-
import ArticleIcon from '@mui/icons-material/Article';
|
|
5
4
|
import { MUILinkWithTracking } from '../MUILinkWithTracking';
|
|
6
5
|
import { OsTypesEnum } from './models';
|
|
7
6
|
import { Chip } from '../Chip';
|
|
7
|
+
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
8
|
+
// TODO: replace with PRO version if we will have access to it
|
|
9
|
+
import { faFileLines } from '@fortawesome/free-solid-svg-icons';
|
|
8
10
|
const OsTypeOption = ({ osType }) => {
|
|
9
11
|
if (!osType) {
|
|
10
12
|
return _jsx(Typography, { variant: "body1", children: "Select OS type..." });
|
|
@@ -30,7 +32,7 @@ export const OsTypeSelector = ({ supportedOsTypes, hasEsrVersions, selectedOsTyp
|
|
|
30
32
|
};
|
|
31
33
|
});
|
|
32
34
|
const selectedOsType = selectOsTypes.find((osType) => osType.slug === selectedOsTypeSlug && osType.supportedForDeviceType);
|
|
33
|
-
return (_jsxs(Stack, { flex: 1, children: [_jsx(Stack, { direction: "row", alignItems: "center", gap: 1, children: _jsxs(InputLabel, { id: "newAppApplicationType-label", sx: { display: 'flex', alignItems: 'center', gap: 1 }, children: ["OS type", _jsx(MUILinkWithTracking, { sx: { height: 12 }, href: "https://www.balena.io/docs/reference/OS/extended-support-release", children: _jsx(
|
|
35
|
+
return (_jsxs(Stack, { flex: 1, children: [_jsx(Stack, { direction: "row", alignItems: "center", gap: 1, children: _jsxs(InputLabel, { id: "newAppApplicationType-label", sx: { display: 'flex', alignItems: 'center', gap: 1 }, children: ["OS type", _jsx(MUILinkWithTracking, { sx: { height: 12 }, href: "https://www.balena.io/docs/reference/OS/extended-support-release", children: _jsx(FontAwesomeIcon, { icon: faFileLines, fontSize: "1rem" }) })] }) }), _jsx(Select, { id: "newAppApplicationType", fullWidth: true, disabled: supportedOsTypes.length === 0, value: (_a = selectedOsType === null || selectedOsType === void 0 ? void 0 : selectedOsType.slug) !== null && _a !== void 0 ? _a : OsTypesEnum.DEFAULT, renderValue: (selected) => (_jsx(Box, { display: "flex", width: "100%", children: _jsx(OsTypeOption, { osType: selectOsTypes.find((osType) => selected === osType.slug) }) })), onChange: (event) => {
|
|
34
36
|
const osType = selectOsTypes.find((os) => os.slug === event.target.value);
|
|
35
37
|
if (!osType.disabled) {
|
|
36
38
|
onSelectedOsTypeChange(osType.slug);
|
|
@@ -2,12 +2,13 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
2
2
|
import { FormControl, FormControlLabel, FormLabel, Radio, RadioGroup, Stack, Tooltip, Typography, } from '@mui/material';
|
|
3
3
|
import { MUILinkWithTracking } from '../MUILinkWithTracking';
|
|
4
4
|
import { getOsVariantDisplayText } from './utils';
|
|
5
|
-
import { Lightbulb } from '@mui/icons-material';
|
|
6
5
|
import { token } from '../../utils/token';
|
|
7
6
|
import { Callout } from '../Callout';
|
|
7
|
+
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
8
|
+
import { faLightbulb } from '@fortawesome/free-solid-svg-icons';
|
|
8
9
|
const variantInfo = (selected) => ({
|
|
9
10
|
dev: {
|
|
10
|
-
title: (_jsxs(Stack, { gap: 1, direction: "row", alignItems: "center", children: [_jsx(Typography, { children: getOsVariantDisplayText('dev') }), _jsxs(Typography, { variant: "bodySm", color: token('color.text.accent'), alignItems: "center", display: "flex", children: [_jsx(
|
|
11
|
+
title: (_jsxs(Stack, { gap: 1, direction: "row", alignItems: "center", children: [_jsx(Typography, { children: getOsVariantDisplayText('dev') }), _jsxs(Typography, { variant: "bodySm", color: token('color.text.accent'), alignItems: "center", display: "flex", children: [_jsx(FontAwesomeIcon, { icon: faLightbulb, width: 14, height: 14 }), "Recommended for first time users"] })] })),
|
|
11
12
|
description: (_jsxs(Stack, { gap: 1, children: [_jsxs(Typography, { children: ["Development images should be used when you are developing an application and want to use the fast", ' ', _jsx(MUILinkWithTracking, { href: "https://balena.io/docs/development/local-mode/", children: "local mode" }), ' ', "workflow."] }), selected === 'dev' && (_jsxs(Callout, { severity: "warning", size: "sm", children: ["This variant should never be used in production for security reasons.", ' ', _jsx(MUILinkWithTracking, { href: "https://docs.balena.io/reference/OS/overview/#development-vs-production-mode", children: "Learn more" }), "."] }))] })),
|
|
12
13
|
},
|
|
13
14
|
prod: {
|
|
@@ -5,7 +5,6 @@ import { FALLBACK_LOGO_UNKNOWN_DEVICE, isUrlAccessible, stripVersionBuild, } fro
|
|
|
5
5
|
import { ImageForm } from './ImageForm';
|
|
6
6
|
import { ApplicationInstructions } from './ApplicationInstructions';
|
|
7
7
|
import { DropDownButton } from '../DropDownButton';
|
|
8
|
-
import DownloadIcon from '@mui/icons-material/Download';
|
|
9
8
|
import pickBy from 'lodash/pickBy';
|
|
10
9
|
import debounce from 'lodash/debounce';
|
|
11
10
|
import isEmpty from 'lodash/isEmpty';
|
|
@@ -15,6 +14,8 @@ import { enqueueSnackbar } from 'notistack';
|
|
|
15
14
|
import { DialogWithCloseButton } from '../DialogWithCloseButton';
|
|
16
15
|
import { Callout } from '../Callout';
|
|
17
16
|
import { Spinner } from '../Spinner';
|
|
17
|
+
import { faDownload } from '@fortawesome/free-solid-svg-icons';
|
|
18
|
+
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
18
19
|
const etcherLogoBase64 = 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iODAwIiBoZWlnaHQ9IjYwMCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KIDxnPgogIDx0aXRsZT5FdGNoZXI8L3RpdGxlPgogIDxnIGlkPSJzdmdfMSIgc3Ryb2tlPSJudWxsIj4KICAgPHBhdGggaWQ9InN2Z18yIiBjbGFzcz0ic3QxIiBkPSJtNDEyLjkwMzgzLDM1OC4wNjcxM2wwLDE3MS40OTU4M2M3LjQ5MjU0LC0xLjY2NTAxIDE0LjE1MjU3LC0zLjMzMDAyIDIwLjgxMjYsLTcuNDkyNTRsMTQyLjM1ODE5LC04MS41ODUzOWMyMC44MTI2LC0xMS42NTUwNiAzMy4zMDAxNiwtMzQuMTMyNjYgMzMuMzAwMTYsLTU4LjI3NTI4bDAsLTE2Mi4zMzgyOGMwLC02LjY2MDAzIC0wLjgzMjUsLTEzLjMyMDA2IC0zLjMzMDAyLC0xOS4xNDc1OWwtMTU0LjAxMzI0LDg5LjA3NzkzYy0zMi40Njc2NiwyMi40Nzc2MSAtMzkuMTI3NjksNDMuMjkwMjEgLTM5LjEyNzY5LDY4LjI2NTMzbDAsLTAuMDAwMDF6IiBmaWxsPSIjQTVERTM3IiBzdHJva2U9Im51bGwiLz4KICAgPHBhdGggaWQ9InN2Z18zIiBjbGFzcz0ic3QyIiBkPSJtNjYyLjY1NTAzLDE2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ena.io/etcher/open-image-url';
|
|
20
21
|
export var ActionType;
|
|
@@ -150,7 +151,7 @@ export const DownloadImageDialog = ({ open, applicationId, releaseId, compatible
|
|
|
150
151
|
onDownloadStart === null || onDownloadStart === void 0 ? void 0 : onDownloadStart(formModel, ActionType.downloadOs);
|
|
151
152
|
formElement.current.submit();
|
|
152
153
|
}),
|
|
153
|
-
children: (_jsxs(_Fragment, { children: [_jsx(
|
|
154
|
+
children: (_jsxs(_Fragment, { children: [_jsx(FontAwesomeIcon, { icon: faDownload }), " Download balenaOS", ' ', formModel.version && downloadSize ? ` (~${downloadSize})` : ''] })),
|
|
154
155
|
},
|
|
155
156
|
];
|
|
156
157
|
if (downloadConfig) {
|
|
@@ -164,7 +165,7 @@ export const DownloadImageDialog = ({ open, applicationId, releaseId, compatible
|
|
|
164
165
|
onDownloadStart === null || onDownloadStart === void 0 ? void 0 : onDownloadStart(formModel, ActionType.downloadConfigFile);
|
|
165
166
|
await downloadConfig(formModel);
|
|
166
167
|
},
|
|
167
|
-
children: (_jsxs(_Fragment, { children: [_jsx(
|
|
168
|
+
children: (_jsxs(_Fragment, { children: [_jsx(FontAwesomeIcon, { icon: faDownload }), " Download configuration file only"] })),
|
|
168
169
|
});
|
|
169
170
|
}
|
|
170
171
|
return dropDownButtonActions;
|
|
@@ -29,40 +29,11 @@ export interface OsVersion {
|
|
|
29
29
|
export interface OsVersionsByDeviceType {
|
|
30
30
|
[deviceTypeSlug: string]: OsVersion[];
|
|
31
31
|
}
|
|
32
|
-
/** @deprecated the legacy device-type.json format */
|
|
33
|
-
export interface OsSpecificDeviceTypeJsonInstructions {
|
|
34
|
-
linux: string[];
|
|
35
|
-
osx: string[];
|
|
36
|
-
windows: string[];
|
|
37
|
-
}
|
|
38
32
|
export type OsSpecificContractInstructions = Record<'Linux' | 'MacOS' | 'Windows', string[]>;
|
|
39
33
|
export interface DeviceTypeDownloadAlert {
|
|
40
34
|
type: string;
|
|
41
35
|
message: string;
|
|
42
36
|
}
|
|
43
|
-
/** @deprecated */
|
|
44
|
-
export interface DeviceTypeOptions {
|
|
45
|
-
options: DeviceTypeOptionsGroup[];
|
|
46
|
-
collapsed: boolean;
|
|
47
|
-
isCollapsible: boolean;
|
|
48
|
-
isGroup: boolean;
|
|
49
|
-
message: string;
|
|
50
|
-
name: string;
|
|
51
|
-
}
|
|
52
|
-
/** @deprecated */
|
|
53
|
-
export interface DeviceTypeOptionsGroup {
|
|
54
|
-
default: number | string;
|
|
55
|
-
message: string;
|
|
56
|
-
name: string;
|
|
57
|
-
type: string;
|
|
58
|
-
min?: number;
|
|
59
|
-
max?: number;
|
|
60
|
-
docs?: string;
|
|
61
|
-
hidden?: boolean;
|
|
62
|
-
when?: Dictionary<number | string | boolean>;
|
|
63
|
-
choices?: string[] | number[];
|
|
64
|
-
choicesLabels?: Dictionary<string>;
|
|
65
|
-
}
|
|
66
37
|
export interface DeviceType {
|
|
67
38
|
slug: string;
|
|
68
39
|
name: string;
|
|
@@ -70,7 +41,5 @@ export interface DeviceType {
|
|
|
70
41
|
contract?: Record<string, any> | null;
|
|
71
42
|
/** @deprecated */
|
|
72
43
|
imageDownloadAlerts?: DeviceTypeDownloadAlert[];
|
|
73
|
-
instructions?: string[] |
|
|
74
|
-
/** @deprecated */
|
|
75
|
-
options?: DeviceTypeOptions[];
|
|
44
|
+
instructions?: string[] | OsSpecificContractInstructions;
|
|
76
45
|
}
|
|
@@ -6,8 +6,9 @@ import { ButtonWithTracking } from '../ButtonWithTracking';
|
|
|
6
6
|
import { useAnalyticsContext } from '../../contexts/AnalyticsContext';
|
|
7
7
|
import groupBy from 'lodash/groupBy';
|
|
8
8
|
import flatMap from 'lodash/flatMap';
|
|
9
|
-
import { KeyboardArrowDown, KeyboardArrowUp, ArrowDropDown, ArrowDropUp, } from '@mui/icons-material';
|
|
10
9
|
import { Tooltip } from '../Tooltip';
|
|
10
|
+
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
11
|
+
import { faCaretDown, faCaretUp, faChevronDown, faChevronUp, } from '@fortawesome/free-solid-svg-icons';
|
|
11
12
|
/**
|
|
12
13
|
* This component implements a Dropdown button using MUI (This can be removed as soon as MUI implements it. Check
|
|
13
14
|
* progress: https://mui.com/material-ui/discover-more/roadmap/#new-components)
|
|
@@ -49,9 +50,9 @@ export const DropDownButton = (_a) => {
|
|
|
49
50
|
};
|
|
50
51
|
return (_jsxs(_Fragment, { children: [children ? (_jsx(Button, Object.assign({ "aria-controls": anchorEl ? 'dropdown' : undefined, "aria-expanded": anchorEl ? 'true' : undefined, onClick: (event) => {
|
|
51
52
|
setAnchorEl(event.currentTarget);
|
|
52
|
-
}, endIcon: anchorEl ? _jsx(
|
|
53
|
+
}, endIcon: anchorEl ? (_jsx(FontAwesomeIcon, { icon: faChevronUp })) : (_jsx(FontAwesomeIcon, { icon: faChevronDown })) }, buttonProps, { children: children }))) : (_jsxs(ButtonGroup, Object.assign({ variant: "contained", disableElevation: true }, buttonProps, { children: [_jsx(ButtonWithTracking, { onClick: handleClick, eventName: memoizedItems[selectedIndex].eventName, eventProperties: memoizedItems[selectedIndex].eventProperties, tooltip: memoizedItems[selectedIndex].tooltip, children: memoizedItems[selectedIndex].children }), _jsx(Button, { onClick: handleToggle,
|
|
53
54
|
// It doesn't look good without it, hence the addition.
|
|
54
|
-
sx: (theme) => ({ pl: 2, pr: `calc(${theme.spacing(2)} + 2px)` }), children: anchorEl ? _jsx(
|
|
55
|
+
sx: (theme) => ({ pl: 2, pr: `calc(${theme.spacing(2)} + 2px)` }), children: anchorEl ? (_jsx(FontAwesomeIcon, { icon: faCaretUp })) : (_jsx(FontAwesomeIcon, { icon: faCaretDown })) })] }))), _jsx(Menu, { anchorEl: anchorEl, open: !!anchorEl, onClose: () => {
|
|
55
56
|
setAnchorEl(null);
|
|
56
57
|
}, children: memoizedItems.map((item, index) => (_jsx(MenuItemWithTracking, Object.assign({}, item, { onClick: (event) => {
|
|
57
58
|
handleMenuItemClick(event, index);
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { FormControl, IconButton, InputAdornment, TextField, } from '@mui/material';
|
|
3
3
|
import { Suspense, lazy, useState } from 'react';
|
|
4
|
-
import {
|
|
4
|
+
import { faEye, faEyeSlash } from '@fortawesome/free-solid-svg-icons';
|
|
5
|
+
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
5
6
|
const PasswordStrength = lazy(async () => {
|
|
6
7
|
const importedModule = await import('../PasswordStrength');
|
|
7
8
|
return {
|
|
@@ -27,6 +28,6 @@ export const PasswordWidget = ({ id, label, value, disabled, name, placeholder,
|
|
|
27
28
|
setShowPassword((show) => !show);
|
|
28
29
|
}, onMouseDown: (event) => {
|
|
29
30
|
event.preventDefault();
|
|
30
|
-
}, edge: "end", children: showPassword ? _jsx(
|
|
31
|
+
}, edge: "end", children: showPassword ? (_jsx(FontAwesomeIcon, { icon: faEyeSlash })) : (_jsx(FontAwesomeIcon, { icon: faEye })) }) })),
|
|
31
32
|
} }), options.showPasswordStrengthMeter && (_jsx(Suspense, { fallback: null, children: _jsx(PasswordStrength, { password: value }) }))] }));
|
|
32
33
|
};
|
|
@@ -61,7 +61,7 @@ export const SelectWidget = ({ id, label, value, disabled, name, placeholder, on
|
|
|
61
61
|
? option.some((o) => o.disabled)
|
|
62
62
|
: !!option.disabled, renderInput: (params) => (_jsx(TextField, Object.assign({}, params, { slotProps: {
|
|
63
63
|
htmlInput: Object.assign(Object.assign({}, params.inputProps), (inputProps !== null && inputProps !== void 0 ? inputProps : {})),
|
|
64
|
-
} }, (multiple && {
|
|
64
|
+
}, placeholder: placeholder }, (multiple && {
|
|
65
65
|
onKeyDown: (e) => {
|
|
66
66
|
// Prevent deleting the last chip with backspace or delete https://github.com/mui/material-ui/issues/21129#issuecomment-636919142
|
|
67
67
|
if (e.key === 'Backspace' || e.key === 'Delete') {
|
|
@@ -4,7 +4,7 @@ import { faTimesCircle } from '@fortawesome/free-solid-svg-icons/faTimesCircle';
|
|
|
4
4
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
5
5
|
import { JsonTypes, widgetFactory } from '../utils';
|
|
6
6
|
import { Box, Typography } from '@mui/material';
|
|
7
|
-
export const BooleanAsIconWidget = widgetFactory('BooleanAsIcon',
|
|
7
|
+
export const BooleanAsIconWidget = widgetFactory('BooleanAsIcon', [
|
|
8
8
|
JsonTypes.boolean,
|
|
9
9
|
JsonTypes.number,
|
|
10
10
|
JsonTypes.null,
|
|
@@ -3,6 +3,6 @@ import { Tooltip } from '@mui/material';
|
|
|
3
3
|
import { Copy } from '../../../../Copy';
|
|
4
4
|
import { JsonTypes, widgetFactory } from '../utils';
|
|
5
5
|
import { Code } from '../../../../Code';
|
|
6
|
-
export const CodeWidget = widgetFactory('Code',
|
|
6
|
+
export const CodeWidget = widgetFactory('Code', [JsonTypes.string])(({ value, }) => {
|
|
7
7
|
return (_jsx(Copy, { copy: value, children: _jsx(Tooltip, { title: value, children: _jsx(Code, { noWrap: true, children: value }) }) }));
|
|
8
8
|
});
|
|
@@ -3,7 +3,7 @@ import { Tooltip, Typography } from '@mui/material';
|
|
|
3
3
|
import { useTranslation } from '../../../../../hooks/useTranslations';
|
|
4
4
|
import { JsonTypes, widgetFactory } from '../utils';
|
|
5
5
|
import { token } from '../../../../../utils/token';
|
|
6
|
-
export const DisabledTextWidget = widgetFactory('DisabledText',
|
|
6
|
+
export const DisabledTextWidget = widgetFactory('DisabledText', [
|
|
7
7
|
JsonTypes.string,
|
|
8
8
|
JsonTypes.number,
|
|
9
9
|
JsonTypes.null,
|
|
@@ -3,7 +3,7 @@ import React from 'react';
|
|
|
3
3
|
import { intervalToDuration } from 'date-fns';
|
|
4
4
|
import { JsonTypes, widgetFactory } from '../utils';
|
|
5
5
|
import { Typography } from '@mui/material';
|
|
6
|
-
export const DurationWidget = widgetFactory('Duration',
|
|
6
|
+
export const DurationWidget = widgetFactory('Duration', [JsonTypes.object])(({ value }) => {
|
|
7
7
|
const duration = React.useMemo(() => {
|
|
8
8
|
var _a, _b, _c;
|
|
9
9
|
if (!value.start || !value.end) {
|
|
@@ -2,9 +2,9 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { UiOption, JsonTypes, widgetFactory, formatTimestamp, timeSince, } from '../utils';
|
|
3
3
|
import { Material, Tooltip } from '../../../../..';
|
|
4
4
|
const { Typography } = Material;
|
|
5
|
-
export const ElapsedTimeWidget = widgetFactory('ElapsedTime', {
|
|
5
|
+
export const ElapsedTimeWidget = widgetFactory('ElapsedTime', [JsonTypes.string, JsonTypes.number], {
|
|
6
6
|
dtFormat: UiOption.string,
|
|
7
|
-
}
|
|
7
|
+
})(({ value }) => {
|
|
8
8
|
if (!value) {
|
|
9
9
|
return null;
|
|
10
10
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Code } from '@mui/icons-material';
|
|
3
2
|
import { Copy } from '../../../../Copy';
|
|
4
3
|
import { JsonTypes, truncateHash, widgetFactory } from '../utils';
|
|
5
|
-
export const HashWidget = widgetFactory('Hash',
|
|
6
|
-
return
|
|
4
|
+
export const HashWidget = widgetFactory('Hash', [JsonTypes.string])(({ value, }) => {
|
|
5
|
+
return _jsx(Copy, { copy: value, children: truncateHash(value) });
|
|
7
6
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { JsonTypes, widgetFactory } from '../utils';
|
|
3
|
-
export const PercentageWidget = widgetFactory('Percentage',
|
|
3
|
+
export const PercentageWidget = widgetFactory('Percentage', [
|
|
4
4
|
JsonTypes.string,
|
|
5
5
|
JsonTypes.number,
|
|
6
6
|
])(({ value }) => {
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { Typography } from '@mui/material';
|
|
3
3
|
import { JsonTypes, widgetFactory } from '../utils';
|
|
4
4
|
import { token } from '../../../../../utils/token';
|
|
5
|
-
export const PlaceholderTextWidget = widgetFactory('PlaceholderText',
|
|
5
|
+
export const PlaceholderTextWidget = widgetFactory('PlaceholderText', [
|
|
6
6
|
JsonTypes.string,
|
|
7
7
|
JsonTypes.number,
|
|
8
8
|
JsonTypes.null,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { JsonTypes, widgetFactory } from '../utils';
|
|
3
|
-
export const TemperatureWidget = widgetFactory('Temperature',
|
|
3
|
+
export const TemperatureWidget = widgetFactory('Temperature', [
|
|
4
4
|
JsonTypes.number,
|
|
5
5
|
])(({ value }) => {
|
|
6
6
|
return _jsx(_Fragment, { children: value ? `~${value}°C` : '-' });
|
|
@@ -19,7 +19,14 @@ const getArrayValue = (value, uiSchema) => {
|
|
|
19
19
|
return arrayString;
|
|
20
20
|
};
|
|
21
21
|
const DATE_TIME_FORMATS = ['date-time', 'date', 'time'];
|
|
22
|
-
const TxtWidget = widgetFactory('Txt',
|
|
22
|
+
const TxtWidget = widgetFactory('Txt', [
|
|
23
|
+
JsonTypes.string,
|
|
24
|
+
JsonTypes.null,
|
|
25
|
+
JsonTypes.integer,
|
|
26
|
+
JsonTypes.number,
|
|
27
|
+
JsonTypes.boolean,
|
|
28
|
+
JsonTypes.array,
|
|
29
|
+
], {
|
|
23
30
|
dtFormat: UiOption.string,
|
|
24
31
|
align: Object.assign(Object.assign({}, UiOption.string), { enum: ['inherit', 'left', 'center', 'right', 'justify'] }),
|
|
25
32
|
gutterBottom: UiOption.bolean,
|
|
@@ -27,14 +34,7 @@ const TxtWidget = widgetFactory('Txt', {
|
|
|
27
34
|
paragraph: UiOption.boolean,
|
|
28
35
|
sx: UiOption.object,
|
|
29
36
|
variant: UiOption.string,
|
|
30
|
-
},
|
|
31
|
-
JsonTypes.string,
|
|
32
|
-
JsonTypes.null,
|
|
33
|
-
JsonTypes.integer,
|
|
34
|
-
JsonTypes.number,
|
|
35
|
-
JsonTypes.boolean,
|
|
36
|
-
JsonTypes.array,
|
|
37
|
-
])(({ value, schema, uiSchema }) => {
|
|
37
|
+
})(({ value, schema, uiSchema }) => {
|
|
38
38
|
var _a;
|
|
39
39
|
let displayValue = isArray(value)
|
|
40
40
|
? getArrayValue(value, uiSchema)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Typography } from '@mui/material';
|
|
3
3
|
import { JsonTypes, widgetFactory } from '../utils';
|
|
4
|
-
export const WrapWidget = widgetFactory('Wrap',
|
|
4
|
+
export const WrapWidget = widgetFactory('Wrap', [JsonTypes.string])(({ value, }) => {
|
|
5
5
|
return (_jsx(Typography, { sx: { maxWidth: '475px', whitespace: 'normal' }, children: value }));
|
|
6
6
|
});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { WidgetProps } from './utils';
|
|
2
|
-
export declare const Widget: ({ value,
|
|
2
|
+
export declare const Widget: ({ value, resource, schema, extraFormats, uiSchema, }: WidgetProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -31,7 +31,7 @@ const getWidget = (value, format, uiSchemaWidget, extraFormats) => {
|
|
|
31
31
|
});
|
|
32
32
|
return (_b = (_a = extraFormat === null || extraFormat === void 0 ? void 0 : extraFormat.widget) !== null && _a !== void 0 ? _a : typeWidgets[valueType]) !== null && _b !== void 0 ? _b : typeWidgets.default;
|
|
33
33
|
};
|
|
34
|
-
export const Widget = ({ value,
|
|
34
|
+
export const Widget = ({ value, resource, schema = {}, extraFormats, uiSchema, }) => {
|
|
35
35
|
const format = getSchemaFormat(schema);
|
|
36
36
|
if (!format) {
|
|
37
37
|
return _jsx(_Fragment, { children: value });
|
|
@@ -43,5 +43,5 @@ export const Widget = ({ value, extraContext, schema = {}, extraFormats, uiSchem
|
|
|
43
43
|
return null;
|
|
44
44
|
}
|
|
45
45
|
const WidgetComponent = getWidget(processedValue, format, undefined, extraFormats);
|
|
46
|
-
return (_jsx(WidgetComponent, {
|
|
46
|
+
return (_jsx(WidgetComponent, { resource: resource, value: processedValue !== null && processedValue !== void 0 ? processedValue : null, schema: schema }));
|
|
47
47
|
};
|
|
@@ -19,7 +19,7 @@ export interface WidgetProps<T extends object = object> {
|
|
|
19
19
|
schema: JSONSchema | undefined;
|
|
20
20
|
extraFormats?: Format[];
|
|
21
21
|
uiSchema?: UiSchema;
|
|
22
|
-
|
|
22
|
+
resource: T;
|
|
23
23
|
}
|
|
24
24
|
export interface Widget<T extends object = object, ExtraProps = object> {
|
|
25
25
|
uiOptions?: UiOptions;
|
|
@@ -49,7 +49,7 @@ export type UiOptions = {
|
|
|
49
49
|
[key: string]: JSONSchema;
|
|
50
50
|
};
|
|
51
51
|
export declare const UiOption: UiOptions;
|
|
52
|
-
export declare const widgetFactory: <ST extends Array<keyof JsonTypesTypeMap>>(displayName: string,
|
|
52
|
+
export declare const widgetFactory: <ST extends Array<keyof JsonTypesTypeMap>>(displayName: string, supportedTypes: ST, uiOptions?: Widget["uiOptions"]) => <T extends object, ExtraProps extends object = object, V extends WidgetProps["value"] | null = JsonTypesTypeMap[ST[number]]>(widgetFn: (props: Overwrite<WidgetProps<T>, {
|
|
53
53
|
value: V;
|
|
54
54
|
}> & ExtraProps) => JSX.Element | null) => Widget<T, ExtraProps>;
|
|
55
55
|
export declare const formatTimestamp: (timestamp: string | number, uiSchema?: UiSchema) => string;
|
|
@@ -33,7 +33,9 @@ export const UiOption = {
|
|
|
33
33
|
// TODO: Replace the HOF with a plain function once TS supports optional generic types
|
|
34
34
|
// See: https://github.com/microsoft/TypeScript/issues/14400
|
|
35
35
|
// TODO: convert the fn args to an object once we bump TS
|
|
36
|
-
export const widgetFactory = (displayName,
|
|
36
|
+
export const widgetFactory = (displayName, supportedTypes,
|
|
37
|
+
// TODO: Implement a way to pass these from RJST to widgets. Likely by adding a uiSchema property or something
|
|
38
|
+
uiOptions = {}) => {
|
|
37
39
|
return (widgetFn) => {
|
|
38
40
|
const widget = widgetFn;
|
|
39
41
|
Object.assign(widget, {
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import type { RJSTSdk, RJSTAction, RJSTModel, RJSTBaseResource, RJSTRawModel } from './schemaOps';
|
|
3
3
|
import { rjstJsonSchemaPick, rjstAddToSchema, generateSchemaFromRefScheme, getPropertyScheme, getSubSchemaFromRefScheme, parseDescription, parseDescriptionProperty } from './schemaOps';
|
|
4
4
|
import type { JSONSchema7 as JSONSchema } from 'json-schema';
|
|
5
|
-
import { rjstDefaultPermissions, rjstGetModelForCollection,
|
|
5
|
+
import { rjstDefaultPermissions, rjstGetModelForCollection, rjstRunTransformers } from './models/helpers';
|
|
6
6
|
import { rjstGetDisabledReason } from './utils';
|
|
7
7
|
import type { LensTemplate } from './Lenses';
|
|
8
8
|
import type { BoxProps } from '@mui/material';
|
|
@@ -58,4 +58,4 @@ export interface RJSTProps<T> extends Omit<BoxProps, 'onChange'> {
|
|
|
58
58
|
persistFilters?: boolean;
|
|
59
59
|
}
|
|
60
60
|
export declare const RJST: <T extends RJSTBaseResource<T>>({ model: modelRaw, data, formats, actions, sdk, customSort, refresh, getBaseUrl, onEntityClick, onChange, pagination, customLenses, loading, rowKey, noDataInfo, persistFilters, ...boxProps }: RJSTProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
61
|
-
export { rjstRunTransformers, rjstDefaultPermissions, rjstGetModelForCollection,
|
|
61
|
+
export { rjstRunTransformers, rjstDefaultPermissions, rjstGetModelForCollection, rjstAddToSchema, type RJSTAction, type RJSTBaseResource, type RJSTRawModel, type RJSTModel, rjstJsonSchemaPick, rjstGetDisabledReason, getPropertyScheme, getSubSchemaFromRefScheme, parseDescription, parseDescriptionProperty, generateSchemaFromRefScheme, };
|
|
@@ -8,7 +8,7 @@ import { Filters } from './Filters/Filters';
|
|
|
8
8
|
import { Tags } from './Actions/Tags';
|
|
9
9
|
import { Update } from './Actions/Update';
|
|
10
10
|
import { Create } from './Actions/Create';
|
|
11
|
-
import { rjstDefaultPermissions, rjstGetModelForCollection,
|
|
11
|
+
import { rjstDefaultPermissions, rjstGetModelForCollection, rjstRunTransformers, } from './models/helpers';
|
|
12
12
|
import { rjstGetDisabledReason, getFromLocalStorage, getTagsDisabledReason, setToLocalStorage, getSortingFunction, DEFAULT_ITEMS_PER_PAGE, } from './utils';
|
|
13
13
|
import { getLenses } from './Lenses';
|
|
14
14
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
@@ -278,7 +278,7 @@ export const RJST = (_a) => {
|
|
|
278
278
|
setSelected: $setSelected,
|
|
279
279
|
})] }) }) })));
|
|
280
280
|
};
|
|
281
|
-
export { rjstRunTransformers, rjstDefaultPermissions, rjstGetModelForCollection,
|
|
281
|
+
export { rjstRunTransformers, rjstDefaultPermissions, rjstGetModelForCollection, rjstAddToSchema, rjstJsonSchemaPick, rjstGetDisabledReason, getPropertyScheme, getSubSchemaFromRefScheme, parseDescription, parseDescriptionProperty, generateSchemaFromRefScheme, };
|
|
282
282
|
const getTitleAndLabel = (t, jsonSchema, propertyKey, refScheme) => {
|
|
283
283
|
var _a, _b, _c;
|
|
284
284
|
const subSchema = getSubSchemaFromRefScheme(jsonSchema, refScheme);
|
|
@@ -378,7 +378,7 @@ const getColumnsFromSchema = ({ t, schema, idField, isServerSide, customSort, pr
|
|
|
378
378
|
? fieldCustomSort
|
|
379
379
|
: getSortingFunction(key, val), render: (fieldVal, entry) => {
|
|
380
380
|
const calculatedField = rjstAdaptRefScheme(fieldVal, val);
|
|
381
|
-
return (_jsx(Widget, { extraFormats: [...(formats !== null && formats !== void 0 ? formats : []), ...defaultFormats], schema: widgetSchema, value: calculatedField,
|
|
381
|
+
return (_jsx(Widget, { extraFormats: [...(formats !== null && formats !== void 0 ? formats : []), ...defaultFormats], schema: widgetSchema, value: calculatedField, resource: entry }));
|
|
382
382
|
} });
|
|
383
383
|
});
|
|
384
384
|
};
|
|
@@ -9,9 +9,5 @@ export declare const rjstDefaultPermissions: {
|
|
|
9
9
|
delete: boolean;
|
|
10
10
|
};
|
|
11
11
|
export declare const rjstRunTransformers: <T extends Dictionary<any>, TResult extends T, TContext = null>(data: T | undefined, transformers: Transformers<T, Omit<TResult, keyof T>, TContext>, context?: TContext) => TResult | undefined;
|
|
12
|
-
|
|
13
|
-
export declare const rjstGetModelForCollection: <T>(model: RJSTRawModel<T>, context?: {
|
|
14
|
-
accessRole?: string | null;
|
|
15
|
-
}) => RJSTModel<T>;
|
|
16
|
-
export declare const rjstGetModelForCollection2: <T>(model: RJSTRawModel<T>, permissions: Permissions<T>) => RJSTModel<T>;
|
|
12
|
+
export declare const rjstGetModelForCollection: <T>(model: RJSTRawModel<T>, permissions: Permissions<T>) => RJSTModel<T>;
|
|
17
13
|
export {};
|
|
@@ -28,23 +28,8 @@ export const rjstRunTransformers = (data, transformers, context) => {
|
|
|
28
28
|
}
|
|
29
29
|
return mutatedData;
|
|
30
30
|
};
|
|
31
|
-
// TODO: Drop me in the next major
|
|
32
|
-
/** @deprecated This function will be removed in the next major. Use rjstGetModelForCollection2 instead */
|
|
33
31
|
// This transformation would happen elsewhere, and it wouldn't be part of RJST
|
|
34
|
-
export const rjstGetModelForCollection = (model,
|
|
35
|
-
const accessRole = context === null || context === void 0 ? void 0 : context.accessRole;
|
|
36
|
-
const schema = model.priorities
|
|
37
|
-
? rjstJsonSchemaPick(model.schema, [
|
|
38
|
-
...model.priorities.primary,
|
|
39
|
-
...model.priorities.secondary,
|
|
40
|
-
...model.priorities.tertiary,
|
|
41
|
-
])
|
|
42
|
-
: model.schema;
|
|
43
|
-
return Object.assign(Object.assign({}, model), { permissions: (accessRole != null && model.permissions[accessRole]) ||
|
|
44
|
-
model.permissions['default'], schema });
|
|
45
|
-
};
|
|
46
|
-
// This transformation would happen elsewhere, and it wouldn't be part of RJST
|
|
47
|
-
export const rjstGetModelForCollection2 = (model, permissions) => {
|
|
32
|
+
export const rjstGetModelForCollection = (model, permissions) => {
|
|
48
33
|
const schema = model.priorities
|
|
49
34
|
? rjstJsonSchemaPick(model.schema, [
|
|
50
35
|
...model.priorities.primary,
|
package/dist/index.d.ts
CHANGED
|
@@ -74,7 +74,7 @@ export { SettingsCard, SettingsCardItem } from './components/SettingsCard';
|
|
|
74
74
|
export { Tag, type TagProps, type TagItem } from './components/Tag';
|
|
75
75
|
export { TagManagementDialog, type TagManagementDialogProps, } from './components/TagManagementDialog';
|
|
76
76
|
export { AnalyticsContextProvider, useAnalyticsContext, AnalyticsStoreActions, } from './contexts/AnalyticsContext';
|
|
77
|
-
export { RJST, type RJSTProps, rjstRunTransformers, rjstDefaultPermissions, rjstGetModelForCollection,
|
|
77
|
+
export { RJST, type RJSTProps, rjstRunTransformers, rjstDefaultPermissions, rjstGetModelForCollection, rjstAddToSchema, type RJSTAction, type RJSTBaseResource, type RJSTRawModel, type RJSTModel, rjstJsonSchemaPick, rjstGetDisabledReason, type NoDataInfo, getPropertyScheme, getSubSchemaFromRefScheme, parseDescription, parseDescriptionProperty, generateSchemaFromRefScheme, } from './components/RJST';
|
|
78
78
|
export { removeFieldsWithNoFilter, modifySchemaWithRefSchemes, removeRefSchemeSeparatorsFromFilters, } from './components/RJST/Filters/utils';
|
|
79
79
|
export type { PineFilterObject } from './components/RJST/oData/jsonToOData';
|
|
80
80
|
export { type FormData, FULL_TEXT_SLUG, ajvFilter, getPropertySchema, parseFilterDescription, createModelFilter, createFilter, createFullTextSearchFilter, convertSchemaToDefaultValue, } from './components/RJST/components/Filters/SchemaSieve';
|
package/dist/index.js
CHANGED
|
@@ -39,7 +39,7 @@ export { SettingsCard, SettingsCardItem } from './components/SettingsCard';
|
|
|
39
39
|
export { Tag } from './components/Tag';
|
|
40
40
|
export { TagManagementDialog, } from './components/TagManagementDialog';
|
|
41
41
|
export { AnalyticsContextProvider, useAnalyticsContext, AnalyticsStoreActions, } from './contexts/AnalyticsContext';
|
|
42
|
-
export { RJST, rjstRunTransformers, rjstDefaultPermissions, rjstGetModelForCollection,
|
|
42
|
+
export { RJST, rjstRunTransformers, rjstDefaultPermissions, rjstGetModelForCollection, rjstAddToSchema, rjstJsonSchemaPick, rjstGetDisabledReason, getPropertyScheme, getSubSchemaFromRefScheme, parseDescription, parseDescriptionProperty, generateSchemaFromRefScheme, } from './components/RJST';
|
|
43
43
|
export { removeFieldsWithNoFilter, modifySchemaWithRefSchemes, removeRefSchemeSeparatorsFromFilters, } from './components/RJST/Filters/utils';
|
|
44
44
|
export { FULL_TEXT_SLUG, ajvFilter, getPropertySchema, parseFilterDescription, createModelFilter, createFilter, createFullTextSearchFilter, convertSchemaToDefaultValue, } from './components/RJST/components/Filters/SchemaSieve';
|
|
45
45
|
export { Filters, } from './components/RJST/components/Filters';
|
package/dist/theme.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@balena/ui-shared-components",
|
|
3
|
-
"version": "13.0.0-build-
|
|
3
|
+
"version": "13.0.0-build-rename-and-require-widget-extracontext-8a761b0e057cdaba8527bd7cde97ff3ea5faa969-1",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"files": [
|
|
@@ -17,7 +17,6 @@
|
|
|
17
17
|
"@emotion/styled": "^11.10.6",
|
|
18
18
|
"@fortawesome/free-solid-svg-icons": "^6.5.1",
|
|
19
19
|
"@fortawesome/react-fontawesome": "^0.2.0",
|
|
20
|
-
"@mui/icons-material": "^6.3.1",
|
|
21
20
|
"@mui/lab": "6.0.0-beta.24",
|
|
22
21
|
"@mui/material": "^6.3.1",
|
|
23
22
|
"@mui/styled-engine-sc": "^6.3.1",
|
|
@@ -39,6 +38,7 @@
|
|
|
39
38
|
"jest": "^29.7.0",
|
|
40
39
|
"lodash": "^4.17.21",
|
|
41
40
|
"notistack": "^3.0.1",
|
|
41
|
+
"qs": "^6.14.0",
|
|
42
42
|
"react": "^18.2.0",
|
|
43
43
|
"react-dom": "^18.2.0",
|
|
44
44
|
"react-dropzone": "^14.2.3",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"@types/zxcvbn": "^4.4.4",
|
|
72
72
|
"eslint-plugin-storybook": "^9.0.0",
|
|
73
73
|
"husky": "^9.0.0",
|
|
74
|
-
"lint-staged": "^
|
|
74
|
+
"lint-staged": "^16.0.0",
|
|
75
75
|
"prop-types": "^15.8.1",
|
|
76
76
|
"storybook": "^9.0.0",
|
|
77
77
|
"ts-loader": "^9.5.1",
|
|
@@ -89,9 +89,6 @@
|
|
|
89
89
|
"build-storybook": "storybook build --docs",
|
|
90
90
|
"deploy-docs": "npm ci && storybook build --docs && mv storybook-static build"
|
|
91
91
|
},
|
|
92
|
-
"engines": {
|
|
93
|
-
"node": "^22.0.0"
|
|
94
|
-
},
|
|
95
92
|
"eslintConfig": {
|
|
96
93
|
"extends": [
|
|
97
94
|
"react-app",
|
|
@@ -135,7 +132,7 @@
|
|
|
135
132
|
},
|
|
136
133
|
"homepage": "https://github.com/balena-io/ui-shared-components#readme",
|
|
137
134
|
"versionist": {
|
|
138
|
-
"publishedAt": "2025-
|
|
135
|
+
"publishedAt": "2025-07-23T12:03:49.761Z"
|
|
139
136
|
},
|
|
140
137
|
"overrides": {
|
|
141
138
|
"storybook": "$storybook"
|