Skip to content

Commit

Permalink
feat(gui): Display image size when drive too small
Browse files Browse the repository at this point in the history
This adds a display of the determined image size to the
drive label when the drive has been determined to be too small.

Change-Type: patch
Changelog-Entry: Display image size for comparison if drive is too small
  • Loading branch information
jhermsmeier committed Oct 24, 2017
1 parent 2556807 commit 0a58ae3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/shared/drive-constraints.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

const _ = require('lodash')
const pathIsInside = require('path-is-inside')
const prettyBytes = require('pretty-bytes')

/**
* @summary The default unknown size for things such as images and drives
Expand Down Expand Up @@ -376,9 +377,10 @@ exports.getDriveImageCompatibilityStatuses = (drive, image) => {
message: exports.COMPATIBILITY_STATUS_MESSAGES.LOCKED
})
} else if (!_.isNil(drive) && !_.isNil(drive.size) && !exports.isDriveLargeEnough(drive, image)) {
const imageSize = _.get(image, [ 'size', 'final', 'estimation' ]) ? image.size.original : image.size.final.value
statusList.push({
type: exports.COMPATIBILITY_STATUS_TYPES.ERROR,
message: exports.COMPATIBILITY_STATUS_MESSAGES.TOO_SMALL
message: `${exports.COMPATIBILITY_STATUS_MESSAGES.TOO_SMALL} - ${prettyBytes(imageSize)}`
})
} else {
if (exports.isSystemDrive(drive)) {
Expand Down

0 comments on commit 0a58ae3

Please sign in to comment.