mirror of
https://github.com/balena-io/etcher.git
synced 2025-07-23 19:26:33 +00:00
Sort devices by device path on Linux
Changelog-entry: Sort devices by device path on Linux Change-type: patch
This commit is contained in:
parent
571a3533fb
commit
c09237f0c3
@ -124,7 +124,7 @@ function storeReducer(
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const drives = action.data;
|
let drives = action.data;
|
||||||
|
|
||||||
if (!_.isArray(drives) || !_.every(drives, _.isObject)) {
|
if (!_.isArray(drives) || !_.every(drives, _.isObject)) {
|
||||||
throw errors.createError({
|
throw errors.createError({
|
||||||
@ -132,6 +132,13 @@ function storeReducer(
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
drives = _.sortBy(drives, [
|
||||||
|
// Devices with no devicePath first (usbboot)
|
||||||
|
d => !!d.devicePath,
|
||||||
|
// Then sort by devicePath (only available on Linux with udev) or device
|
||||||
|
d => d.devicePath || d.device,
|
||||||
|
]);
|
||||||
|
|
||||||
const newState = state.set('availableDrives', Immutable.fromJS(drives));
|
const newState = state.set('availableDrives', Immutable.fromJS(drives));
|
||||||
const selectedDevices = newState.getIn(['selection', 'devices']).toJS();
|
const selectedDevices = newState.getIn(['selection', 'devices']).toJS();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user