feat(GUI): hide unsafe mode option with env var (#2347)

We hide the unsafe mode option toggle with an env var
`ETCHER_HIDE_UNSAFE_MODE` that also enables unsafe mode.

Closes: https://github.com/resin-io/etcher/issues/2243
Change-Type: patch
Changelog-Entry: Hide unsafe mode option toggle with an env var.
This commit is contained in:
Benedict Aas 2018-05-16 19:52:55 +01:00 committed by GitHub
parent e472fe0276
commit 34ce00e2d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 3 deletions

View File

@ -23,7 +23,7 @@ const permissions = require('../../../shared/permissions')
const scanner = SDK.createScanner({ const scanner = SDK.createScanner({
blockdevice: { blockdevice: {
get includeSystemDrives () { get includeSystemDrives () {
return settings.get('unsafeMode') return settings.get('unsafeMode') && !process.env.ETCHER_HIDE_UNSAFE_MODE
} }
}, },
usbboot: {} usbboot: {}

View File

@ -109,7 +109,7 @@ module.exports = function (DriveSelectorService) {
analytics.logEvent('Select drive', { analytics.logEvent('Select drive', {
device: drive.device, device: drive.device,
unsafeMode: settings.get('unsafeMode') unsafeMode: settings.get('unsafeMode') && !process.env.ETCHER_HIDE_UNSAFE_MODE
}) })
}).catch(exceptionReporter.report) }).catch(exceptionReporter.report)
} }

View File

@ -104,4 +104,18 @@ module.exports = function (WarningModalService) {
} }
}).catch(exceptionReporter.report) }).catch(exceptionReporter.report)
} }
/**
* @summary Show unsafe mode based on an env var
* @function
* @public
*
* @returns {Boolean}
*
* @example
* SettingsController.shouldShowUnsafeMode()
*/
this.shouldShowUnsafeMode = () => {
return !process.env.ETCHER_HIDE_UNSAFE_MODE
}
} }

View File

@ -54,7 +54,7 @@
</label> </label>
</div> </div>
<div class="checkbox"> <div class="checkbox" ng-if="settings.shouldShowUnsafeMode()">
<label> <label>
<input type="checkbox" <input type="checkbox"
tabindex="10" tabindex="10"