mirror of
https://github.com/balena-io/etcher.git
synced 2025-04-24 07:17:18 +00:00
Merge pull request #98 from resin-io/feature/step-reselection
Allow to re-select the first two step selections
This commit is contained in:
commit
cc7f6f2587
@ -93,6 +93,29 @@ app.controller('AppController', function($q, DriveScannerService, SelectionState
|
||||
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) {
|
||||
|
||||
// Stop scanning drives when burning
|
||||
@ -669,6 +692,30 @@ selectionState.service('SelectionStateService', function() {
|
||||
return !!self.getImage();
|
||||
};
|
||||
|
||||
/**
|
||||
* @summary Remove drive
|
||||
* @function
|
||||
* @public
|
||||
*
|
||||
* @example
|
||||
* SelectionStateService.removeDrive();
|
||||
*/
|
||||
this.removeDrive = function() {
|
||||
self.setDrive(undefined);
|
||||
};
|
||||
|
||||
/**
|
||||
* @summary Remove image
|
||||
* @function
|
||||
* @public
|
||||
*
|
||||
* @example
|
||||
* SelectionStateService.removeImage();
|
||||
*/
|
||||
this.removeImage = function() {
|
||||
self.setImage(undefined);
|
||||
};
|
||||
|
||||
/**
|
||||
* @summary Clear all selections
|
||||
* @function
|
||||
|
@ -92,6 +92,29 @@ app.controller('AppController', function($q, DriveScannerService, SelectionState
|
||||
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) {
|
||||
|
||||
// Stop scanning drives when burning
|
||||
|
@ -123,6 +123,30 @@ selectionState.service('SelectionStateService', function() {
|
||||
return !!self.getImage();
|
||||
};
|
||||
|
||||
/**
|
||||
* @summary Remove drive
|
||||
* @function
|
||||
* @public
|
||||
*
|
||||
* @example
|
||||
* SelectionStateService.removeDrive();
|
||||
*/
|
||||
this.removeDrive = function() {
|
||||
self.setDrive(undefined);
|
||||
};
|
||||
|
||||
/**
|
||||
* @summary Remove image
|
||||
* @function
|
||||
* @public
|
||||
*
|
||||
* @example
|
||||
* SelectionStateService.removeImage();
|
||||
*/
|
||||
this.removeImage = function() {
|
||||
self.setImage(undefined);
|
||||
};
|
||||
|
||||
/**
|
||||
* @summary Clear all selections
|
||||
* @function
|
||||
|
@ -30,7 +30,7 @@
|
||||
<hero-button ng-click="app.selectImage()">Select image</hero-button>
|
||||
</div>
|
||||
<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>
|
||||
|
||||
<p class="step-footer tiny">*supported files: .img, .iso</p>
|
||||
@ -67,7 +67,7 @@
|
||||
</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>
|
||||
|
@ -78,6 +78,17 @@ describe('Browser: SelectionState', function() {
|
||||
|
||||
});
|
||||
|
||||
describe('.removeDrive()', function() {
|
||||
|
||||
it('should clear the drive', function() {
|
||||
SelectionStateService.removeDrive();
|
||||
var drive = SelectionStateService.getDrive();
|
||||
m.chai.expect(drive).to.be.undefined;
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
describe('given no drive', function() {
|
||||
@ -128,6 +139,16 @@ describe('Browser: SelectionState', function() {
|
||||
|
||||
});
|
||||
|
||||
describe('.removeImage()', function() {
|
||||
|
||||
it('should clear the image', function() {
|
||||
SelectionStateService.removeImage();
|
||||
var image = SelectionStateService.getImage();
|
||||
m.chai.expect(image).to.be.undefined;
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('given no image', function() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user