Remove unmountOnSuccess setting

Changelog-entry: Remove unmountOnSuccess setting
Change-type: patch
This commit is contained in:
Alexis Svinartchouk 2020-12-10 15:28:54 +01:00
parent fe0b45cae6
commit 1f94f44b18
5 changed files with 9 additions and 79 deletions

View File

@ -16,7 +16,6 @@
import GithubSvg from '@fortawesome/fontawesome-free/svgs/brands/github.svg'; import GithubSvg from '@fortawesome/fontawesome-free/svgs/brands/github.svg';
import * as _ from 'lodash'; import * as _ from 'lodash';
import * as os from 'os';
import * as React from 'react'; import * as React from 'react';
import { Flex, Checkbox, Txt } from 'rendition'; import { Flex, Checkbox, Txt } from 'rendition';
@ -26,8 +25,6 @@ import * as analytics from '../../modules/analytics';
import { open as openExternal } from '../../os/open-external/services/open-external'; import { open as openExternal } from '../../os/open-external/services/open-external';
import { Modal } from '../../styled-components'; import { Modal } from '../../styled-components';
const platform = os.platform();
interface Setting { interface Setting {
name: string; name: string;
label: string | JSX.Element; label: string | JSX.Element;
@ -39,16 +36,6 @@ async function getSettingsList(): Promise<Setting[]> {
name: 'errorReporting', name: 'errorReporting',
label: 'Anonymously report errors and usage statistics to balena.io', label: 'Anonymously report errors and usage statistics to balena.io',
}, },
{
name: 'unmountOnSuccess',
/**
* On Windows, "Unmounting" basically means "ejecting".
* On top of that, Windows users are usually not even
* familiar with the meaning of "unmount", which comes
* from the UNIX world.
*/
label: `${platform === 'win32' ? 'Eject' : 'Auto-unmount'} on success`,
},
]; ];
if (['appimage', 'nsis', 'dmg'].includes(packageType)) { if (['appimage', 'nsis', 'dmg'].includes(packageType)) {
list.push({ list.push({

View File

@ -77,7 +77,6 @@ export async function writeConfigFile(
const DEFAULT_SETTINGS: _.Dictionary<any> = { const DEFAULT_SETTINGS: _.Dictionary<any> = {
errorReporting: true, errorReporting: true,
unmountOnSuccess: true,
updatesEnabled: ['appimage', 'nsis', 'dmg'].includes(packageJSON.packageType), updatesEnabled: ['appimage', 'nsis', 'dmg'].includes(packageJSON.packageType),
desktopNotifications: true, desktopNotifications: true,
autoBlockmapping: true, autoBlockmapping: true,

View File

@ -151,11 +151,7 @@ async function performWrite(
let cancelled = false; let cancelled = false;
let skip = false; let skip = false;
ipc.serve(); ipc.serve();
const { const { autoBlockmapping, decompressFirst } = await settings.getAll();
unmountOnSuccess,
autoBlockmapping,
decompressFirst,
} = await settings.getAll();
return await new Promise((resolve, reject) => { return await new Promise((resolve, reject) => {
ipc.server.on('error', (error) => { ipc.server.on('error', (error) => {
terminateServer(); terminateServer();
@ -174,7 +170,6 @@ async function performWrite(
driveCount: drives.length, driveCount: drives.length,
uuid: flashState.getFlashUuid(), uuid: flashState.getFlashUuid(),
flashInstanceUuid: flashState.getFlashUuid(), flashInstanceUuid: flashState.getFlashUuid(),
unmountOnSuccess,
}; };
ipc.server.on('fail', ({ device, error }) => { ipc.server.on('fail', ({ device, error }) => {
@ -211,7 +206,6 @@ async function performWrite(
destinations: drives, destinations: drives,
SourceType: image.SourceType.name, SourceType: image.SourceType.name,
autoBlockmapping, autoBlockmapping,
unmountOnSuccess,
decompressFirst, decompressFirst,
}); });
}); });
@ -290,7 +284,6 @@ export async function flash(
uuid: flashState.getFlashUuid(), uuid: flashState.getFlashUuid(),
status: 'started', status: 'started',
flashInstanceUuid: flashState.getFlashUuid(), flashInstanceUuid: flashState.getFlashUuid(),
unmountOnSuccess: await settings.get('unmountOnSuccess'),
}; };
analytics.logEvent('Flash', analyticsData); analytics.logEvent('Flash', analyticsData);
@ -345,7 +338,6 @@ export async function cancel(type: string) {
driveCount: drives.length, driveCount: drives.length,
uuid: flashState.getFlashUuid(), uuid: flashState.getFlashUuid(),
flashInstanceUuid: flashState.getFlashUuid(), flashInstanceUuid: flashState.getFlashUuid(),
unmountOnSuccess: await settings.get('unmountOnSuccess'),
status, status,
}; };
analytics.logEvent('Cancel', analyticsData); analytics.logEvent('Cancel', analyticsData);

View File

@ -167,7 +167,6 @@ async function writeAndValidate({
interface WriteOptions { interface WriteOptions {
image: SourceMetadata; image: SourceMetadata;
destinations: DrivelistDrive[]; destinations: DrivelistDrive[];
unmountOnSuccess: boolean;
autoBlockmapping: boolean; autoBlockmapping: boolean;
decompressFirst: boolean; decompressFirst: boolean;
SourceType: string; SourceType: string;
@ -257,13 +256,12 @@ ipc.connectTo(IPC_SERVER_ID, () => {
const imagePath = options.image.path; const imagePath = options.image.path;
log(`Image: ${imagePath}`); log(`Image: ${imagePath}`);
log(`Devices: ${destinations.join(', ')}`); log(`Devices: ${destinations.join(', ')}`);
log(`Umount on success: ${options.unmountOnSuccess}`);
log(`Auto blockmapping: ${options.autoBlockmapping}`); log(`Auto blockmapping: ${options.autoBlockmapping}`);
log(`Decompress first: ${options.decompressFirst}`); log(`Decompress first: ${options.decompressFirst}`);
const dests = options.destinations.map((destination) => { const dests = options.destinations.map((destination) => {
return new BlockDevice({ return new BlockDevice({
drive: destination, drive: destination,
unmountOnSuccess: options.unmountOnSuccess, unmountOnSuccess: true,
write: true, write: true,
direct: true, direct: true,
}); });

View File

@ -16,7 +16,6 @@
import { expect } from 'chai'; import { expect } from 'chai';
import * as settings from '../../../lib/gui/app/models/settings';
import * as progressStatus from '../../../lib/gui/app/modules/progress-status'; import * as progressStatus from '../../../lib/gui/app/modules/progress-status';
describe('Browser: progressStatus', function () { describe('Browser: progressStatus', function () {
@ -30,8 +29,6 @@ describe('Browser: progressStatus', function () {
eta: 15, eta: 15,
speed: 100000000000000, speed: 100000000000000,
}; };
settings.set('unmountOnSuccess', true);
}); });
it('should report 0% if percentage == 0 but speed != 0', function () { it('should report 0% if percentage == 0 but speed != 0', function () {
@ -40,22 +37,14 @@ describe('Browser: progressStatus', function () {
); );
}); });
it('should handle percentage == 0, flashing, unmountOnSuccess', function () { it('should handle percentage == 0, flashing', function () {
this.state.speed = 0; this.state.speed = 0;
expect(progressStatus.titleFromFlashState(this.state)).to.equal( expect(progressStatus.titleFromFlashState(this.state)).to.equal(
'0% Flashing...', '0% Flashing...',
); );
}); });
it('should handle percentage == 0, flashing, !unmountOnSuccess', function () { it('should handle percentage == 0, verifying', function () {
this.state.speed = 0;
settings.set('unmountOnSuccess', false);
expect(progressStatus.titleFromFlashState(this.state)).to.equal(
'0% Flashing...',
);
});
it('should handle percentage == 0, verifying, unmountOnSuccess', function () {
this.state.speed = 0; this.state.speed = 0;
this.state.type = 'verifying'; this.state.type = 'verifying';
expect(progressStatus.titleFromFlashState(this.state)).to.equal( expect(progressStatus.titleFromFlashState(this.state)).to.equal(
@ -63,31 +52,14 @@ describe('Browser: progressStatus', function () {
); );
}); });
it('should handle percentage == 0, verifying, !unmountOnSuccess', function () { it('should handle percentage == 50, flashing', function () {
this.state.speed = 0;
this.state.type = 'verifying';
settings.set('unmountOnSuccess', false);
expect(progressStatus.titleFromFlashState(this.state)).to.equal(
'0% Validating...',
);
});
it('should handle percentage == 50, flashing, unmountOnSuccess', function () {
this.state.percentage = 50; this.state.percentage = 50;
expect(progressStatus.titleFromFlashState(this.state)).to.equal( expect(progressStatus.titleFromFlashState(this.state)).to.equal(
'50% Flashing...', '50% Flashing...',
); );
}); });
it('should handle percentage == 50, flashing, !unmountOnSuccess', function () { it('should handle percentage == 50, verifying', function () {
this.state.percentage = 50;
settings.set('unmountOnSuccess', false);
expect(progressStatus.titleFromFlashState(this.state)).to.equal(
'50% Flashing...',
);
});
it('should handle percentage == 50, verifying, unmountOnSuccess', function () {
this.state.percentage = 50; this.state.percentage = 50;
this.state.type = 'verifying'; this.state.type = 'verifying';
expect(progressStatus.titleFromFlashState(this.state)).to.equal( expect(progressStatus.titleFromFlashState(this.state)).to.equal(
@ -95,31 +67,14 @@ describe('Browser: progressStatus', function () {
); );
}); });
it('should handle percentage == 50, verifying, !unmountOnSuccess', function () { it('should handle percentage == 100, flashing', function () {
this.state.percentage = 50;
this.state.type = 'verifying';
settings.set('unmountOnSuccess', false);
expect(progressStatus.titleFromFlashState(this.state)).to.equal(
'50% Validating...',
);
});
it('should handle percentage == 100, flashing, unmountOnSuccess', function () {
this.state.percentage = 100; this.state.percentage = 100;
expect(progressStatus.titleFromFlashState(this.state)).to.equal( expect(progressStatus.titleFromFlashState(this.state)).to.equal(
'Finishing...', 'Finishing...',
); );
}); });
it('should handle percentage == 100, flashing, !unmountOnSuccess', function () { it('should handle percentage == 100, verifying', function () {
this.state.percentage = 100;
settings.set('unmountOnSuccess', false);
expect(progressStatus.titleFromFlashState(this.state)).to.equal(
'Finishing...',
);
});
it('should handle percentage == 100, verifying, unmountOnSuccess', function () {
this.state.percentage = 100; this.state.percentage = 100;
this.state.type = 'verifying'; this.state.type = 'verifying';
expect(progressStatus.titleFromFlashState(this.state)).to.equal( expect(progressStatus.titleFromFlashState(this.state)).to.equal(
@ -127,9 +82,8 @@ describe('Browser: progressStatus', function () {
); );
}); });
it('should handle percentage == 100, validatinf, !unmountOnSuccess', function () { it('should handle percentage == 100, validating', function () {
this.state.percentage = 100; this.state.percentage = 100;
settings.set('unmountOnSuccess', false);
expect(progressStatus.titleFromFlashState(this.state)).to.equal( expect(progressStatus.titleFromFlashState(this.state)).to.equal(
'Finishing...', 'Finishing...',
); );