diff --git a/lib/gui/app/components/drive-selector/controllers/drive-selector.js b/lib/gui/app/components/drive-selector/controllers/drive-selector.js index 64d7f348..6d2c686e 100644 --- a/lib/gui/app/components/drive-selector/controllers/drive-selector.js +++ b/lib/gui/app/components/drive-selector/controllers/drive-selector.js @@ -119,7 +119,6 @@ module.exports = function ( previouslySelected: selectionState.isCurrentDrive(drive.device) }) - selectionState.deselectOtherDrives(drive.device) selectionState.toggleDrive(drive.device) } }) diff --git a/lib/gui/app/modules/progress-status.js b/lib/gui/app/modules/progress-status.js index 19399ac8..beac4c5f 100644 --- a/lib/gui/app/modules/progress-status.js +++ b/lib/gui/app/modules/progress-status.js @@ -29,7 +29,7 @@ const utils = require('../../../shared/utils') * @example * const status = progressStatus.fromFlashState({ * flashing: 1, - * validating: 0, + * verifying: 0, * succeeded: 0, * failed: 0, * percentage: 55, @@ -41,7 +41,7 @@ const utils = require('../../../shared/utils') */ exports.fromFlashState = (state) => { const isFlashing = Boolean(state.flashing) - const isValidating = !isFlashing && Boolean(state.validating) + const isValidating = !isFlashing && Boolean(state.verifying) const shouldValidate = settings.get('validateWriteOnSuccess') const shouldUnmount = settings.get('unmountOnSuccess') diff --git a/lib/gui/app/pages/main/controllers/drive-selection.js b/lib/gui/app/pages/main/controllers/drive-selection.js index c0ebf23e..f4b039cc 100644 --- a/lib/gui/app/pages/main/controllers/drive-selection.js +++ b/lib/gui/app/pages/main/controllers/drive-selection.js @@ -16,12 +16,52 @@ 'use strict' +const _ = require('lodash') const settings = require('../../../models/settings') const selectionState = require('../../../../../shared/models/selection-state') const analytics = require('../../../modules/analytics') const exceptionReporter = require('../../../modules/exception-reporter') module.exports = function (DriveSelectorService) { + /** + * @summary Get drive title based on device quantity + * @function + * @public + * + * @returns {String} - drives title + * + * @example + * console.log(DriveSelectionController.getDrivesTitle()) + * > 'Multiple Drives (4)' + */ + this.getDrivesTitle = () => { + const drives = selectionState.getSelectedDrives() + + // eslint-disable-next-line no-magic-numbers + if (drives.length === 1) { + return _.head(drives).description + } + + return `Multiple Devices (${drives.length})` + } + + /** + * @summary Get drive list label + * @function + * @public + * + * @returns {String} - 'list' of drives separated by newlines + * + * @example + * console.log(DriveSelectionController.getDriveListLabel()) + * > 'My Drive (/dev/disk1)\nMy Other Drive (/dev/disk2)' + */ + this.getDriveListLabel = () => { + return _.join(_.map(selectionState.getSelectedDrives(), (drive) => { + return `${drive.description} (${drive.displayName})` + }), '\n') + } + /** * @summary Open drive selector * @function diff --git a/lib/gui/app/pages/main/controllers/flash.js b/lib/gui/app/pages/main/controllers/flash.js index ad15c032..e5d158da 100644 --- a/lib/gui/app/pages/main/controllers/flash.js +++ b/lib/gui/app/pages/main/controllers/flash.js @@ -32,12 +32,12 @@ module.exports = function ( FlashErrorModalService ) { /** - * @summary Flash image to a drive + * @summary Flash image to drives * @function * @public * * @param {Object} image - image - * @param {Object} drive - drive + * @param {Array} drives - drives * * @example * FlashController.flashImageToDrive({ @@ -57,7 +57,7 @@ module.exports = function ( * system: false * }) */ - this.flashImageToDrive = (image, drive) => { + this.flashImageToDrive = (image, drives) => { if (flashState.isFlashing()) { return } @@ -72,17 +72,17 @@ module.exports = function ( const iconPath = '../../../assets/icon.png' - imageWriter.flash(image.path, [ drive.device ]).then(() => { + imageWriter.flash(image.path, drives).then(() => { if (!flashState.wasLastFlashCancelled()) { notification.send('Success!', { - body: messages.info.flashComplete(path.basename(image.path), drive), + body: messages.info.flashComplete(path.basename(image.path), drives), icon: iconPath }) $state.go('success') } }).catch((error) => { notification.send('Oops! Looks like the flash failed.', { - body: messages.error.flashFailure(path.basename(image.path), drive), + body: messages.error.flashFailure(path.basename(image.path), drives), icon: iconPath }) diff --git a/lib/gui/app/pages/main/styles/_main.scss b/lib/gui/app/pages/main/styles/_main.scss index f28ba2ae..8a00fa91 100644 --- a/lib/gui/app/pages/main/styles/_main.scss +++ b/lib/gui/app/pages/main/styles/_main.scss @@ -129,7 +129,7 @@ svg-icon > img[disabled] { &.target-status-flashing > .target-status-dot { background-color: $palette-theme-warning-background; } - &.target-status-validating > .target-status-dot { + &.target-status-verifying > .target-status-dot { background-color: $palette-theme-primary-background; } &.target-status-succeeded > .target-status-dot { @@ -149,3 +149,7 @@ svg-icon > img[disabled] { color: gray; } } + +.tooltip-inner { + white-space: pre-line; +} diff --git a/lib/gui/app/pages/main/templates/main.tpl.html b/lib/gui/app/pages/main/templates/main.tpl.html index da9ffb11..7b08b2e5 100644 --- a/lib/gui/app/pages/main/templates/main.tpl.html +++ b/lib/gui/app/pages/main/templates/main.tpl.html @@ -66,14 +66,14 @@ 'text-disabled': main.shouldDriveStepBeDisabled() }"> + uib-tooltip="{{ drive.getDriveListLabel() }}"> - {{ (main.selection.getCurrentDrive().description || "") | middleEllipses:11 }} + {{ drive.getDrivesTitle() | middleEllipses:20 }} {{ main.selection.getCurrentDrive().size | closestUnit }} + uib-tooltip="{{ main.constraints.getListDriveImageCompatibilityStatuses(main.selection.getSelectedDrives(), main.selection.getImage())[0].message }}" + ng-show="main.constraints.hasListDriveImageCompatibilityStatus(main.selection.getSelectedDrives(), main.selection.getImage())">