Skip to content
This repository has been archived by the owner on Dec 28, 2021. It is now read-only.

Fix parsing of the {no-}data-gathering option #1831

Merged
merged 4 commits into from
Sep 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# Next Release

<br/>![New Features](/docs/assets/tags/new_features.svg)

<br/>![Bug Fixes](/docs/assets/tags/bug_fixes.svg)

#### Visual Environment

- [Fixed parsing of the `--no-data-gathering` command line option.][1831] Flag's
name has been changed to `--data-gathering`, so now `--data-gathering=false`
and `--data-gathering=true` are supported as well.

[1831]: https://github.com/enso-org/ide/pull/1831

# Enso 2.0.0-alpha.14 (2021-09-02)

<br/>![New Features](/docs/assets/tags/new_features.svg)
Expand All @@ -8,7 +20,7 @@

- [Visualization previews are disabled.][1817] Previously, hovering over a
node's output port for more than four seconds would temporarily reveal the
node's visualization. This behavior is disabled now.
node's visualization. This behavior is disabled now
mwu-tow marked this conversation as resolved.
Show resolved Hide resolved

[1817]: https://github.com/enso-org/ide/pull/1817

Expand Down
8 changes: 4 additions & 4 deletions src/js/lib/client/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,9 @@ optParser.options('crash-report-host', {
default : cfg.defaultLogServerHost
})

optParser.options('no-data-gathering', {
describe : 'Disable the sharing of any usage data',
default : false
optParser.options('data-gathering', {
describe : 'Enable the sharing of any usage data',
default : true
})


Expand Down Expand Up @@ -540,7 +540,7 @@ function createWindow() {
dark_theme : Electron.nativeTheme.shouldUseDarkColors,
high_contrast : Electron.nativeTheme.shouldUseHighContrastColors,
crash_report_host : args.crashReportHost,
no_data_gathering : args.noDataGathering,
data_gathering : args.dataGathering,
node_labels : args.nodeLabels,
verbose : args.verbose,
}
Expand Down
21 changes: 14 additions & 7 deletions src/js/lib/content/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ class ContentApi {
private logger: MixpanelLogger

initLogging(config: Config) {
assert(typeof config.no_data_gathering == 'boolean')
if (!config.no_data_gathering) {
if (config.data_gathering) {
this.logger = new MixpanelLogger()
if (ok(config.email)) {
this.logger.identify(config.email)
Expand Down Expand Up @@ -813,7 +812,7 @@ class Config {
public wasm_glue_url: string
public node_labels: boolean
public crash_report_host: string
public no_data_gathering: boolean
public data_gathering: boolean
public is_in_cloud: boolean
public verbose: boolean
public authentication_enabled: boolean
Expand All @@ -826,7 +825,7 @@ class Config {
config.wasm_url = '/assets/ide.wasm'
config.wasm_glue_url = '/assets/wasm_imports.js'
config.crash_report_host = cfg.defaultLogServerHost
config.no_data_gathering = false
config.data_gathering = true
config.is_in_cloud = false
config.entry = null
config.authentication_enabled = true
Expand Down Expand Up @@ -868,16 +867,24 @@ class Config {
this.crash_report_host = ok(other.crash_report_host)
? tryAsString(other.crash_report_host)
: this.crash_report_host
this.no_data_gathering = ok(other.no_data_gathering)
? tryAsBoolean(other.no_data_gathering)
: this.no_data_gathering
this.data_gathering = parseBoolean(other.data_gathering) ?? this.data_gathering
this.is_in_cloud = ok(other.is_in_cloud)
? tryAsBoolean(other.is_in_cloud)
: this.is_in_cloud
this.verbose = ok(other.verbose) ? tryAsBoolean(other.verbose) : this.verbose
}
}

function parseBoolean(value:any): boolean | null {
if (value === 'true' || value === true) {
return true
} else if (value === 'false' || value === false) {
return false
} else {
return null
}
}

/// Check whether the value is a string with value `"true"`/`"false"`, if so, return the
// appropriate boolean instead. Otherwise, return the original value.
function parseBooleanOrLeaveAsIs(value: any): any {
Expand Down
2 changes: 1 addition & 1 deletion src/rust/ide/lib/args/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ ensogl::read_args! {
wasm_glue_url : String,
node_labels : bool,
crash_report_host : String,
no_data_gathering : bool,
data_gathering : bool,
is_in_cloud : bool,
verbose : bool,
}
Expand Down