mirror of
https://github.com/balena-io/etcher.git
synced 2025-04-24 07:17:18 +00:00
fix(GUI): don't show the "too small" badge if the size is null (#1779)
Some devices don't have a size, like USB devices in the usbboot adaptor. The `.isDriveLargeEnough()` correctly returns `false` in this case, however we don't want to show the `TOO SMALL` badge for aesthetics purposes. So if a drive has a size that equals `null`, we don't allow such drive to be selected, and we don't show a badge for it. Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
This commit is contained in:
parent
ec1f3665eb
commit
0f8043b35b
@ -375,7 +375,7 @@ exports.getDriveImageCompatibilityStatuses = (drive, image) => {
|
||||
type: exports.COMPATIBILITY_STATUS_TYPES.ERROR,
|
||||
message: exports.COMPATIBILITY_STATUS_MESSAGES.LOCKED
|
||||
})
|
||||
} else if (!_.isNil(drive) && !exports.isDriveLargeEnough(drive, image)) {
|
||||
} else if (!_.isNil(drive) && !_.isNil(drive.size) && !exports.isDriveLargeEnough(drive, image)) {
|
||||
statusList.push({
|
||||
type: exports.COMPATIBILITY_STATUS_TYPES.ERROR,
|
||||
message: exports.COMPATIBILITY_STATUS_MESSAGES.TOO_SMALL
|
||||
|
@ -1021,6 +1021,18 @@ describe('Shared: DriveConstraints', function () {
|
||||
})
|
||||
})
|
||||
|
||||
describe('given the drive size is null', () => {
|
||||
it('should not return the too small error', function () {
|
||||
this.image.size.final.value = this.drive.size + 1
|
||||
this.drive.size = null
|
||||
|
||||
const result = constraints.getDriveImageCompatibilityStatuses(this.drive, this.image)
|
||||
const expectedTuples = []
|
||||
|
||||
expectStatusTypesAndMessagesToBe(result, expectedTuples)
|
||||
})
|
||||
})
|
||||
|
||||
describe('given the drive is locked', () => {
|
||||
it('should return the locked drive error', function () {
|
||||
this.drive.protected = true
|
||||
|
Loading…
x
Reference in New Issue
Block a user