@balena/ui-shared-components 12.3.2-build-fix-non-unified-os-release-variant-selection-90cd58ee804ea7899167b6feb1468e8a2e6beb56-1 → 12.3.2-build-fix-non-unified-os-release-variant-selection-da43c55fce8efff9448ca4ad4807613647f1195f-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.
|
@@ -14,7 +14,7 @@ interface ImageFormProps {
|
|
|
14
14
|
model: DownloadImageFormModel;
|
|
15
15
|
hasEsrVersions?: boolean;
|
|
16
16
|
onSelectedOsTypeChange: (osType: string) => void;
|
|
17
|
-
onChange: (
|
|
17
|
+
onChange: (obj: Partial<DownloadImageFormModel>) => void;
|
|
18
18
|
}
|
|
19
19
|
export declare const ImageForm: import("react").NamedExoticComponent<ImageFormProps>;
|
|
20
20
|
export {};
|
|
@@ -48,30 +48,35 @@ export const ImageForm = memo(function ImageForm({ compatibleDeviceTypes, osVers
|
|
|
48
48
|
const showAllVersionsToggle = useMemo(() => preferredSelectionOpts.length < selectionOpts.length, [preferredSelectionOpts.length, selectionOpts.length]);
|
|
49
49
|
const handleVariantChange = useCallback((newVariant) => {
|
|
50
50
|
setVariant(newVariant);
|
|
51
|
-
|
|
51
|
+
const newState = {
|
|
52
|
+
developmentMode: newVariant === 'dev',
|
|
53
|
+
};
|
|
52
54
|
if (version === null || version === void 0 ? void 0 : version.hasPrebuiltVariants) {
|
|
53
55
|
const rawVersionForVariant = version.rawVersions[newVariant];
|
|
54
|
-
if (rawVersionForVariant != null
|
|
55
|
-
|
|
56
|
-
onChange('version', rawVersionForVariant);
|
|
56
|
+
if (rawVersionForVariant != null) {
|
|
57
|
+
newState.version = rawVersionForVariant;
|
|
57
58
|
}
|
|
58
59
|
}
|
|
60
|
+
onChange(newState);
|
|
59
61
|
}, [onChange, version]);
|
|
60
62
|
const handleVersionChange = useCallback((ver) => {
|
|
61
63
|
var _a;
|
|
62
64
|
ver !== null && ver !== void 0 ? ver : (ver = (_a = versionSelectionOpts.find((v) => v.isRecommended)) !== null && _a !== void 0 ? _a : versionSelectionOpts[0]);
|
|
65
|
+
const newState = {
|
|
66
|
+
developmentMode: variant === 'dev',
|
|
67
|
+
};
|
|
63
68
|
if (ver === null || ver === void 0 ? void 0 : ver.hasPrebuiltVariants) {
|
|
64
69
|
const rawVersionForVariant = ver.rawVersions[variant];
|
|
65
|
-
if (rawVersionForVariant) {
|
|
66
|
-
onChange('version', rawVersionForVariant);
|
|
67
|
-
setVersion(ver);
|
|
68
|
-
}
|
|
69
|
-
else {
|
|
70
|
+
if (!rawVersionForVariant) {
|
|
70
71
|
handleVariantChange(variant === 'dev' ? 'prod' : 'dev');
|
|
72
|
+
return;
|
|
71
73
|
}
|
|
72
|
-
|
|
74
|
+
newState.version = rawVersionForVariant;
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
newState.version = ver === null || ver === void 0 ? void 0 : ver.rawVersion;
|
|
73
78
|
}
|
|
74
|
-
onChange(
|
|
79
|
+
onChange(newState);
|
|
75
80
|
setVersion(ver);
|
|
76
81
|
}, [versionSelectionOpts, variant, onChange, handleVariantChange]);
|
|
77
82
|
// TODO: Revisit this as it is clearly not using hooks as intended
|
|
@@ -103,7 +108,7 @@ export const ImageForm = memo(function ImageForm({ compatibleDeviceTypes, osVers
|
|
|
103
108
|
if (!newDeviceType) {
|
|
104
109
|
return;
|
|
105
110
|
}
|
|
106
|
-
onChange(
|
|
111
|
+
onChange({ deviceType: newDeviceType });
|
|
107
112
|
}, [compatibleDeviceTypes, model.deviceType.slug, onChange]);
|
|
108
113
|
const recommendedVersion = useMemo(() => { var _a; return (_a = versionSelectionOpts.find((v) => { var _a; return !((_a = v.knownIssueList) === null || _a === void 0 ? void 0 : _a.length); })) === null || _a === void 0 ? void 0 : _a.value; }, [versionSelectionOpts]);
|
|
109
114
|
return (_jsxs(Box, { action: downloadUrl, method: "post", component: "form", noValidate: true, autoComplete: "off", p: 2, ref: formElement, children: [_jsx("input", { type: "hidden", name: "deviceType", value: model.deviceType.slug }), _jsx("input", { type: "hidden", name: "_token", value: authToken }), _jsx("input", { type: "hidden", name: "appId", value: applicationId }), _jsx("input", { type: "hidden", name: "fileType", value: ".zip" }), _jsx("input", { type: "hidden", name: "version", value: model.version }), _jsxs(Box, { py: 3, display: "flex", flexWrap: "wrap", gap: 2, children: [compatibleDeviceTypes && compatibleDeviceTypes.length > 1 && (_jsxs(Box, { display: "flex", flexDirection: "column", flex: "1", maxWidth: "100%", children: [_jsxs(InputLabel, { htmlFor: "device-type-select", sx: { display: 'flex', alignItems: 'center', mb: 2 }, children: ["Select device type", ' ', _jsx(Tooltip, { title: "Applications can support any devices that share the same architecture as their default device type.", children: _jsx(HelpIcon, { color: "info", sx: { fontSize: '1rem', marginLeft: 1 } }) })] }), _jsx(Autocomplete, { fullWidth: true, id: "device-type-select", value: model.deviceType, options: compatibleDeviceTypes, getOptionLabel: (option) => option.name, renderOption: (props, option) => {
|
|
@@ -134,14 +139,17 @@ export const ImageForm = memo(function ImageForm({ compatibleDeviceTypes, osVers
|
|
|
134
139
|
height: 54, children: _jsx(FormControlLabel, { control: _jsx(Checkbox, { id: "e2e-show-all-versions-check", checked: showAllVersions, onChange: handleShowAllVersions }), label: "Show outdated versions" }) }))] })), (!isInitialDefault || !variant) && (_jsx(Box, { sx: { mt: 3 }, children: _jsx(VariantSelector, { version: version, variant: variant, onVariantChange: (v) => {
|
|
135
140
|
handleVariantChange(v ? 'dev' : 'prod');
|
|
136
141
|
} }) })), _jsx(Divider, { variant: "fullWidth", sx: { my: 3, borderStyle: 'dashed' } }), _jsxs(Box, { display: "flex", flexDirection: "column", children: [_jsxs(FormControl, { children: [_jsx(FormLabel, { id: "network-radio-buttons-group-label", children: "Network" }), _jsxs(RadioGroup, { "aria-labelledby": "network-radio-buttons-group-label", value: model.network, name: "network", onChange: (event) => {
|
|
137
|
-
onChange(
|
|
142
|
+
onChange({
|
|
143
|
+
network: event.target
|
|
144
|
+
.value,
|
|
145
|
+
});
|
|
138
146
|
}, children: [_jsx(FormControlLabel, { value: "ethernet", control: _jsx(Radio, {}), label: "Ethernet only" }), _jsx(FormControlLabel, { value: "wifi", control: _jsx(Radio, {}), label: "Wifi + Ethernet" })] })] }), model.network === 'wifi' && (_jsxs(_Fragment, { children: [_jsx(InputLabel, { htmlFor: "device-wifi-ssid", sx: { mb: 2 }, children: "WiFi SSID" }), _jsx(TextField, { value: model.wifiSsid, id: "device-wifi-ssid", slotProps: {
|
|
139
147
|
htmlInput: {
|
|
140
148
|
name: 'wifiSsid',
|
|
141
149
|
autoComplete: 'wifiSsid-auto-complete',
|
|
142
150
|
},
|
|
143
151
|
}, onChange: (event) => {
|
|
144
|
-
onChange(
|
|
152
|
+
onChange({ wifiSsid: event.target.value });
|
|
145
153
|
} }), _jsx(InputLabel, { htmlFor: "device-wifi-password", sx: { my: 2 }, children: "Wifi Passphrase" }), _jsx(TextField, { type: showPassword ? 'text' : 'password', id: "device-wifi-password", value: model.wifiKey, slotProps: {
|
|
146
154
|
htmlInput: {
|
|
147
155
|
name: 'wifiKey',
|
|
@@ -155,7 +163,7 @@ export const ImageForm = memo(function ImageForm({ compatibleDeviceTypes, osVers
|
|
|
155
163
|
}, edge: "end", children: showPassword ? _jsx(VisibilityOff, {}) : _jsx(Visibility, {}) }) })),
|
|
156
164
|
},
|
|
157
165
|
}, onChange: (event) => {
|
|
158
|
-
onChange(
|
|
166
|
+
onChange({ wifiKey: event.target.value });
|
|
159
167
|
} })] }))] }), _jsx(Divider, { variant: "fullWidth", sx: { my: 3, borderStyle: 'dashed' } }), _jsxs(Button, { onClick: () => {
|
|
160
168
|
setShowAdvancedSettings(!showAdvancedSettings);
|
|
161
169
|
}, variant: "outlined", sx: { mb: 2 }, children: [showAdvancedSettings ? _jsx(RemoveIcon, {}) : _jsx(AddIcon, {}), " Advanced settings"] }), _jsx(Collapse, { in: showAdvancedSettings, collapsedSize: 0, children: _jsxs(Box, { display: "flex", flexDirection: "column", children: [_jsxs(FormControl, { children: [_jsxs(FormLabel, { htmlFor: "poll-interval-label", sx: { display: 'flex' }, children: ["Check for updates every X minutes", ' ', _jsx(MUILinkWithTracking, { href: POLL_INTERVAL_DOCS, sx: {
|
|
@@ -168,21 +176,23 @@ export const ImageForm = memo(function ImageForm({ compatibleDeviceTypes, osVers
|
|
|
168
176
|
autoComplete: 'appUpdatePollInterval-auto-complete',
|
|
169
177
|
},
|
|
170
178
|
}, onChange: (event) => {
|
|
171
|
-
onChange(
|
|
179
|
+
onChange({
|
|
180
|
+
appUpdatePollInterval: parseInt(event.target.value, 10),
|
|
181
|
+
});
|
|
172
182
|
} })] }), _jsx(InputLabel, { htmlFor: "provision-key-name", sx: { my: 2 }, children: "Provisioning Key name" }), _jsx(TextField, { name: "provisioningKeyName", id: "provision-key-name", value: (_a = model.provisioningKeyName) !== null && _a !== void 0 ? _a : '', slotProps: {
|
|
173
183
|
htmlInput: {
|
|
174
184
|
name: 'provisioningKeyName',
|
|
175
185
|
autoComplete: 'provisioningKeyName-auto-complete',
|
|
176
186
|
},
|
|
177
187
|
}, onChange: (event) => {
|
|
178
|
-
onChange(
|
|
188
|
+
onChange({ provisioningKeyName: event.target.value });
|
|
179
189
|
} }), _jsx(InputLabel, { htmlFor: "provision-key-expiring", sx: { my: 2 }, children: "Provisioning Key expiring on" }), _jsx(TextField, { type: "date", id: "provision-key-expiring", value: (_b = model.provisioningKeyExpiryDate) !== null && _b !== void 0 ? _b : '', slotProps: {
|
|
180
190
|
htmlInput: {
|
|
181
191
|
name: 'provisioningKeyExpiryDate',
|
|
182
192
|
autoComplete: 'provisioningKeyExpiryDate-auto-complete',
|
|
183
193
|
},
|
|
184
194
|
}, onChange: (event) => {
|
|
185
|
-
onChange(
|
|
195
|
+
onChange({ provisioningKeyExpiryDate: event.target.value });
|
|
186
196
|
} })] }) })] }));
|
|
187
197
|
});
|
|
188
198
|
// TODO: We need a better way than just copying the styling. Consider creating a component to export
|
|
@@ -242,13 +242,13 @@ export const DownloadImageDialog = ({ open, applicationId, releaseId, compatible
|
|
|
242
242
|
const setOsTypeCallback = useCallback((osT) => {
|
|
243
243
|
setOsType(osT);
|
|
244
244
|
}, []);
|
|
245
|
-
const handleChange = useCallback((
|
|
245
|
+
const handleChange = useCallback((updatedProps) => {
|
|
246
246
|
let newFormModelState;
|
|
247
|
-
if (
|
|
248
|
-
newFormModelState = getInitialState(
|
|
247
|
+
if (updatedProps.deviceType != null) {
|
|
248
|
+
newFormModelState = getInitialState(updatedProps.deviceType, applicationId, releaseId);
|
|
249
249
|
}
|
|
250
250
|
else {
|
|
251
|
-
newFormModelState = Object.assign(Object.assign({}, formModel),
|
|
251
|
+
newFormModelState = Object.assign(Object.assign({}, formModel), updatedProps);
|
|
252
252
|
onFieldChange === null || onFieldChange === void 0 ? void 0 : onFieldChange(newFormModelState);
|
|
253
253
|
}
|
|
254
254
|
setFormModel(newFormModelState);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@balena/ui-shared-components",
|
|
3
|
-
"version": "12.3.2-build-fix-non-unified-os-release-variant-selection-
|
|
3
|
+
"version": "12.3.2-build-fix-non-unified-os-release-variant-selection-da43c55fce8efff9448ca4ad4807613647f1195f-1",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"files": [
|
|
@@ -138,6 +138,6 @@
|
|
|
138
138
|
},
|
|
139
139
|
"homepage": "https://github.com/balena-io/ui-shared-components#readme",
|
|
140
140
|
"versionist": {
|
|
141
|
-
"publishedAt": "2025-04-
|
|
141
|
+
"publishedAt": "2025-04-24T13:20:07.505Z"
|
|
142
142
|
}
|
|
143
143
|
}
|