Allow to re-select the first two step selections

You can click on the selected image/drive label to select them again.

The re-selection is disabled if there is a burning in process.

Fixes: https://github.com/resin-io/resin-etcher/issues/90
This commit is contained in:
Juan Cruz Viotti 2016-01-19 09:44:48 -04:00
parent b3dde83083
commit 8026cef1df
3 changed files with 48 additions and 2 deletions

View File

@ -93,6 +93,29 @@ app.controller('AppController', function($q, DriveScannerService, SelectionState
console.debug('Drive selected: ' + drive.device); console.debug('Drive selected: ' + drive.device);
}; };
this.reselectImage = function() {
if (self.writer.isBurning()) {
return;
}
// Reselecting an image automatically
// de-selects the current drive, if any.
// This is made so the user effectively
// "returns" to the first step.
self.selection.clear();
console.debug('Reselecting image');
};
this.reselectDrive = function() {
if (self.writer.isBurning()) {
return;
}
self.selection.removeDrive();
console.debug('Reselecting drive');
};
this.burn = function(image, drive) { this.burn = function(image, drive) {
// Stop scanning drives when burning // Stop scanning drives when burning

View File

@ -92,6 +92,29 @@ app.controller('AppController', function($q, DriveScannerService, SelectionState
console.debug('Drive selected: ' + drive.device); console.debug('Drive selected: ' + drive.device);
}; };
this.reselectImage = function() {
if (self.writer.isBurning()) {
return;
}
// Reselecting an image automatically
// de-selects the current drive, if any.
// This is made so the user effectively
// "returns" to the first step.
self.selection.clear();
console.debug('Reselecting image');
};
this.reselectDrive = function() {
if (self.writer.isBurning()) {
return;
}
self.selection.removeDrive();
console.debug('Reselecting drive');
};
this.burn = function(image, drive) { this.burn = function(image, drive) {
// Stop scanning drives when burning // Stop scanning drives when burning

View File

@ -30,7 +30,7 @@
<hero-button ng-click="app.selectImage()">Select image</hero-button> <hero-button ng-click="app.selectImage()">Select image</hero-button>
</div> </div>
<div ng-show="app.selection.hasImage()"> <div ng-show="app.selection.hasImage()">
<span ng-bind="app.selection.getImage() | basename"></span> <span ng-bind="app.selection.getImage() | basename" ng-click="app.reselectImage()"></span>
</div> </div>
<p class="step-footer tiny">*supported files: .img, .iso</p> <p class="step-footer tiny">*supported files: .img, .iso</p>
@ -67,7 +67,7 @@
</div> </div>
</div> </div>
<div ng-show="app.selection.hasDrive()" ng-bind="app.selection.getDrive().name"></div> <div ng-show="app.selection.hasDrive()" ng-bind="app.selection.getDrive().name" ng-click="app.reselectDrive()"></div>
</div> </div>
</div> </div>
</div> </div>