mirror of
https://github.com/balena-io/etcher.git
synced 2025-07-22 18:56:31 +00:00
feat(GUI): link to drivers when clicking a driverless usbboot device
Step 2 until we support installing the drivers from within Etcher. This also introduces an "Open drive link" Mixpanel event. See: https://www.raspberrypi.org/documentation/hardware/computemodule/cm-emmc-flashing.md See: https://github.com/resin-io/etcher/pull/1892 Change-Type: patch Changelog-Entry: Download usbboot drivers installer when clicking a driverless usbboot device on Windows. Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
This commit is contained in:
parent
d7211b130b
commit
4c40c8ff30
@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
const angular = require('angular')
|
const angular = require('angular')
|
||||||
const _ = require('lodash')
|
const _ = require('lodash')
|
||||||
|
const Bluebird = require('bluebird')
|
||||||
const constraints = require('../../../../../shared/drive-constraints')
|
const constraints = require('../../../../../shared/drive-constraints')
|
||||||
const analytics = require('../../../modules/analytics')
|
const analytics = require('../../../modules/analytics')
|
||||||
const availableDrives = require('../../../../../shared/models/available-drives')
|
const availableDrives = require('../../../../../shared/models/available-drives')
|
||||||
@ -26,7 +27,9 @@ const utils = require('../../../../../shared/utils')
|
|||||||
|
|
||||||
module.exports = function (
|
module.exports = function (
|
||||||
$q,
|
$q,
|
||||||
$uibModalInstance
|
$uibModalInstance,
|
||||||
|
WarningModalService,
|
||||||
|
OSOpenExternalService
|
||||||
) {
|
) {
|
||||||
/**
|
/**
|
||||||
* @summary The drive selector state
|
* @summary The drive selector state
|
||||||
@ -97,10 +100,26 @@ module.exports = function (
|
|||||||
})
|
})
|
||||||
|
|
||||||
selectionState.toggleDrive(drive.device)
|
selectionState.toggleDrive(drive.device)
|
||||||
|
} else if (drive.link) {
|
||||||
|
analytics.logEvent('Open drive link modal', {
|
||||||
|
url: drive.link
|
||||||
|
})
|
||||||
|
|
||||||
|
const message = drive.message || `Etcher will open ${drive.link} in your browser`
|
||||||
|
return WarningModalService.display({
|
||||||
|
confirmationLabel: 'Yes, continue',
|
||||||
|
description: `${message}. Are you sure you want to continue?`
|
||||||
|
}).then((answer) => {
|
||||||
|
if (answer) {
|
||||||
|
OSOpenExternalService.open(drive.link)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return Bluebird.resolve()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @summary Close the modal and resolve the selected drive
|
* @summary Close the modal and resolve the selected drive
|
||||||
* @function
|
* @function
|
||||||
|
@ -24,7 +24,9 @@ const angular = require('angular')
|
|||||||
const MODULE_NAME = 'Etcher.Components.DriveSelector'
|
const MODULE_NAME = 'Etcher.Components.DriveSelector'
|
||||||
const DriveSelector = angular.module(MODULE_NAME, [
|
const DriveSelector = angular.module(MODULE_NAME, [
|
||||||
require('../modal/modal'),
|
require('../modal/modal'),
|
||||||
require('../../utils/byte-size/byte-size')
|
require('../warning-modal/warning-modal'),
|
||||||
|
require('../../utils/byte-size/byte-size'),
|
||||||
|
require('../../os/open-external/open-external')
|
||||||
])
|
])
|
||||||
|
|
||||||
DriveSelector.controller('DriveSelectorController', require('./controllers/drive-selector'))
|
DriveSelector.controller('DriveSelectorController', require('./controllers/drive-selector'))
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<ul class="list-group">
|
<ul class="list-group">
|
||||||
<li class="list-group-item" ng-repeat="drive in modal.getDrives() track by drive.device"
|
<li class="list-group-item" ng-repeat="drive in modal.getDrives() track by drive.device"
|
||||||
ng-disabled="!modal.constraints.isDriveValid(drive, modal.state.getImage())"
|
ng-disabled="!modal.constraints.isDriveValid(drive, modal.state.getImage()) && !drive.link"
|
||||||
ng-dblclick="modal.selectDriveAndClose(drive)"
|
ng-dblclick="modal.selectDriveAndClose(drive)"
|
||||||
ng-click="modal.toggleDrive(drive)">
|
ng-click="modal.toggleDrive(drive)">
|
||||||
<img class="list-group-item-section" alt="Drive device type logo"
|
<img class="list-group-item-section" alt="Drive device type logo"
|
||||||
|
@ -273,6 +273,8 @@ class USBBootAdapter extends EventEmitter {
|
|||||||
disabled: true,
|
disabled: true,
|
||||||
icon: 'warning',
|
icon: 'warning',
|
||||||
size: null,
|
size: null,
|
||||||
|
link: 'https://github.com/raspberrypi/usbboot/raw/master/win32/rpiboot_setup.exe',
|
||||||
|
message: 'Etcher will now download the necessary drivers from the Raspberry Pi Foundation',
|
||||||
adaptor: USBBootAdapter.id
|
adaptor: USBBootAdapter.id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user