diff --git a/lib/gui/app/components/settings/settings.tsx b/lib/gui/app/components/settings/settings.tsx index 70b8d996..d6ac584b 100644 --- a/lib/gui/app/components/settings/settings.tsx +++ b/lib/gui/app/components/settings/settings.tsx @@ -16,7 +16,6 @@ import GithubSvg from '@fortawesome/fontawesome-free/svgs/brands/github.svg'; import * as _ from 'lodash'; -import * as os from 'os'; import * as React from 'react'; 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 { Modal } from '../../styled-components'; -const platform = os.platform(); - interface Setting { name: string; label: string | JSX.Element; @@ -39,16 +36,6 @@ async function getSettingsList(): Promise { name: 'errorReporting', 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)) { list.push({ diff --git a/lib/gui/app/models/settings.ts b/lib/gui/app/models/settings.ts index 6d220fb9..25c9cd7a 100644 --- a/lib/gui/app/models/settings.ts +++ b/lib/gui/app/models/settings.ts @@ -77,7 +77,6 @@ export async function writeConfigFile( const DEFAULT_SETTINGS: _.Dictionary = { errorReporting: true, - unmountOnSuccess: true, updatesEnabled: ['appimage', 'nsis', 'dmg'].includes(packageJSON.packageType), desktopNotifications: true, autoBlockmapping: true, diff --git a/lib/gui/app/modules/image-writer.ts b/lib/gui/app/modules/image-writer.ts index 09a78e2d..220fe64a 100644 --- a/lib/gui/app/modules/image-writer.ts +++ b/lib/gui/app/modules/image-writer.ts @@ -151,11 +151,7 @@ async function performWrite( let cancelled = false; let skip = false; ipc.serve(); - const { - unmountOnSuccess, - autoBlockmapping, - decompressFirst, - } = await settings.getAll(); + const { autoBlockmapping, decompressFirst } = await settings.getAll(); return await new Promise((resolve, reject) => { ipc.server.on('error', (error) => { terminateServer(); @@ -174,7 +170,6 @@ async function performWrite( driveCount: drives.length, uuid: flashState.getFlashUuid(), flashInstanceUuid: flashState.getFlashUuid(), - unmountOnSuccess, }; ipc.server.on('fail', ({ device, error }) => { @@ -211,7 +206,6 @@ async function performWrite( destinations: drives, SourceType: image.SourceType.name, autoBlockmapping, - unmountOnSuccess, decompressFirst, }); }); @@ -290,7 +284,6 @@ export async function flash( uuid: flashState.getFlashUuid(), status: 'started', flashInstanceUuid: flashState.getFlashUuid(), - unmountOnSuccess: await settings.get('unmountOnSuccess'), }; analytics.logEvent('Flash', analyticsData); @@ -345,7 +338,6 @@ export async function cancel(type: string) { driveCount: drives.length, uuid: flashState.getFlashUuid(), flashInstanceUuid: flashState.getFlashUuid(), - unmountOnSuccess: await settings.get('unmountOnSuccess'), status, }; analytics.logEvent('Cancel', analyticsData); diff --git a/lib/gui/modules/child-writer.ts b/lib/gui/modules/child-writer.ts index 713151ba..dec36144 100644 --- a/lib/gui/modules/child-writer.ts +++ b/lib/gui/modules/child-writer.ts @@ -167,7 +167,6 @@ async function writeAndValidate({ interface WriteOptions { image: SourceMetadata; destinations: DrivelistDrive[]; - unmountOnSuccess: boolean; autoBlockmapping: boolean; decompressFirst: boolean; SourceType: string; @@ -257,13 +256,12 @@ ipc.connectTo(IPC_SERVER_ID, () => { const imagePath = options.image.path; log(`Image: ${imagePath}`); log(`Devices: ${destinations.join(', ')}`); - log(`Umount on success: ${options.unmountOnSuccess}`); log(`Auto blockmapping: ${options.autoBlockmapping}`); log(`Decompress first: ${options.decompressFirst}`); const dests = options.destinations.map((destination) => { return new BlockDevice({ drive: destination, - unmountOnSuccess: options.unmountOnSuccess, + unmountOnSuccess: true, write: true, direct: true, }); diff --git a/tests/gui/modules/progress-status.spec.ts b/tests/gui/modules/progress-status.spec.ts index b892904b..f3621855 100644 --- a/tests/gui/modules/progress-status.spec.ts +++ b/tests/gui/modules/progress-status.spec.ts @@ -16,7 +16,6 @@ import { expect } from 'chai'; -import * as settings from '../../../lib/gui/app/models/settings'; import * as progressStatus from '../../../lib/gui/app/modules/progress-status'; describe('Browser: progressStatus', function () { @@ -30,8 +29,6 @@ describe('Browser: progressStatus', function () { eta: 15, speed: 100000000000000, }; - - settings.set('unmountOnSuccess', true); }); 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; expect(progressStatus.titleFromFlashState(this.state)).to.equal( '0% Flashing...', ); }); - it('should handle percentage == 0, flashing, !unmountOnSuccess', 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 () { + it('should handle percentage == 0, verifying', function () { this.state.speed = 0; this.state.type = 'verifying'; expect(progressStatus.titleFromFlashState(this.state)).to.equal( @@ -63,31 +52,14 @@ describe('Browser: progressStatus', function () { ); }); - it('should handle percentage == 0, verifying, !unmountOnSuccess', 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 () { + it('should handle percentage == 50, flashing', function () { this.state.percentage = 50; expect(progressStatus.titleFromFlashState(this.state)).to.equal( '50% Flashing...', ); }); - it('should handle percentage == 50, flashing, !unmountOnSuccess', 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 () { + it('should handle percentage == 50, verifying', function () { this.state.percentage = 50; this.state.type = 'verifying'; expect(progressStatus.titleFromFlashState(this.state)).to.equal( @@ -95,31 +67,14 @@ describe('Browser: progressStatus', function () { ); }); - it('should handle percentage == 50, verifying, !unmountOnSuccess', 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 () { + it('should handle percentage == 100, flashing', function () { this.state.percentage = 100; expect(progressStatus.titleFromFlashState(this.state)).to.equal( 'Finishing...', ); }); - it('should handle percentage == 100, flashing, !unmountOnSuccess', 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 () { + it('should handle percentage == 100, verifying', function () { this.state.percentage = 100; this.state.type = 'verifying'; 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; - settings.set('unmountOnSuccess', false); expect(progressStatus.titleFromFlashState(this.state)).to.equal( 'Finishing...', );