Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
8ef51157
Commit
8ef51157
authored
Nov 21, 2018
by
Winnie Hellmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace convertPermissionToBoolean with parseBoolean
parent
47fad335
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
35 additions
and
38 deletions
+35
-38
app/assets/javascripts/behaviors/markdown/gfm_auto_complete.js
...ssets/javascripts/behaviors/markdown/gfm_auto_complete.js
+2
-2
app/assets/javascripts/behaviors/secret_values.js
app/assets/javascripts/behaviors/secret_values.js
+3
-5
app/assets/javascripts/build_artifacts.js
app/assets/javascripts/build_artifacts.js
+2
-2
app/assets/javascripts/ci_variable_list/ajax_variable_list.js
...assets/javascripts/ci_variable_list/ajax_variable_list.js
+2
-2
app/assets/javascripts/ci_variable_list/ci_variable_list.js
app/assets/javascripts/ci_variable_list/ci_variable_list.js
+2
-2
app/assets/javascripts/diffs/components/tree_list.vue
app/assets/javascripts/diffs/components/tree_list.vue
+2
-3
app/assets/javascripts/environments/folder/environments_folder_bundle.js
...scripts/environments/folder/environments_folder_bundle.js
+3
-3
app/assets/javascripts/environments/index.js
app/assets/javascripts/environments/index.js
+4
-4
app/assets/javascripts/ide/index.js
app/assets/javascripts/ide/index.js
+2
-2
app/assets/javascripts/importer_status.js
app/assets/javascripts/importer_status.js
+2
-2
app/assets/javascripts/monitoring/monitoring_bundle.js
app/assets/javascripts/monitoring/monitoring_bundle.js
+2
-2
app/assets/javascripts/pages/projects/pipelines/index/index.js
...ssets/javascripts/pages/projects/pipelines/index/index.js
+3
-3
app/assets/javascripts/toggle_buttons.js
app/assets/javascripts/toggle_buttons.js
+3
-3
app/assets/javascripts/usage_ping_consent.js
app/assets/javascripts/usage_ping_consent.js
+3
-3
No files found.
app/assets/javascripts/behaviors/markdown/gfm_auto_complete.js
View file @
8ef51157
import
$
from
'
jquery
'
;
import
$
from
'
jquery
'
;
import
{
convertPermissionTo
Boolean
}
from
'
~/lib/utils/common_utils
'
;
import
{
parse
Boolean
}
from
'
~/lib/utils/common_utils
'
;
import
GfmAutoComplete
from
'
~/gfm_auto_complete
'
;
import
GfmAutoComplete
from
'
~/gfm_auto_complete
'
;
export
default
function
initGFMInput
()
{
export
default
function
initGFMInput
()
{
$
(
'
.js-gfm-input:not(.js-vue-textarea)
'
).
each
((
i
,
el
)
=>
{
$
(
'
.js-gfm-input:not(.js-vue-textarea)
'
).
each
((
i
,
el
)
=>
{
const
gfm
=
new
GfmAutoComplete
(
gl
.
GfmAutoComplete
&&
gl
.
GfmAutoComplete
.
dataSources
);
const
gfm
=
new
GfmAutoComplete
(
gl
.
GfmAutoComplete
&&
gl
.
GfmAutoComplete
.
dataSources
);
const
enableGFM
=
convertPermissionTo
Boolean
(
el
.
dataset
.
supportsAutocomplete
);
const
enableGFM
=
parse
Boolean
(
el
.
dataset
.
supportsAutocomplete
);
gfm
.
setup
(
$
(
el
),
{
gfm
.
setup
(
$
(
el
),
{
emojis
:
true
,
emojis
:
true
,
...
...
app/assets/javascripts/behaviors/secret_values.js
View file @
8ef51157
import
{
n__
}
from
'
../locale
'
;
import
{
n__
}
from
'
../locale
'
;
import
{
convertPermissionTo
Boolean
}
from
'
../lib/utils/common_utils
'
;
import
{
parse
Boolean
}
from
'
../lib/utils/common_utils
'
;
export
default
class
SecretValues
{
export
default
class
SecretValues
{
constructor
({
constructor
({
...
@@ -16,7 +16,7 @@ export default class SecretValues {
...
@@ -16,7 +16,7 @@ export default class SecretValues {
this
.
revealButton
=
this
.
container
.
querySelector
(
'
.js-secret-value-reveal-button
'
);
this
.
revealButton
=
this
.
container
.
querySelector
(
'
.js-secret-value-reveal-button
'
);
if
(
this
.
revealButton
)
{
if
(
this
.
revealButton
)
{
const
isRevealed
=
convertPermissionTo
Boolean
(
this
.
revealButton
.
dataset
.
secretRevealStatus
);
const
isRevealed
=
parse
Boolean
(
this
.
revealButton
.
dataset
.
secretRevealStatus
);
this
.
updateDom
(
isRevealed
);
this
.
updateDom
(
isRevealed
);
this
.
revealButton
.
addEventListener
(
'
click
'
,
this
.
onRevealButtonClicked
.
bind
(
this
));
this
.
revealButton
.
addEventListener
(
'
click
'
,
this
.
onRevealButtonClicked
.
bind
(
this
));
...
@@ -24,9 +24,7 @@ export default class SecretValues {
...
@@ -24,9 +24,7 @@ export default class SecretValues {
}
}
onRevealButtonClicked
()
{
onRevealButtonClicked
()
{
const
previousIsRevealed
=
convertPermissionToBoolean
(
const
previousIsRevealed
=
parseBoolean
(
this
.
revealButton
.
dataset
.
secretRevealStatus
);
this
.
revealButton
.
dataset
.
secretRevealStatus
,
);
this
.
updateDom
(
!
previousIsRevealed
);
this
.
updateDom
(
!
previousIsRevealed
);
}
}
...
...
app/assets/javascripts/build_artifacts.js
View file @
8ef51157
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
import
$
from
'
jquery
'
;
import
$
from
'
jquery
'
;
import
{
visitUrl
}
from
'
./lib/utils/url_utility
'
;
import
{
visitUrl
}
from
'
./lib/utils/url_utility
'
;
import
{
convertPermissionTo
Boolean
}
from
'
./lib/utils/common_utils
'
;
import
{
parse
Boolean
}
from
'
./lib/utils/common_utils
'
;
export
default
class
BuildArtifacts
{
export
default
class
BuildArtifacts
{
constructor
()
{
constructor
()
{
...
@@ -22,7 +22,7 @@ export default class BuildArtifacts {
...
@@ -22,7 +22,7 @@ export default class BuildArtifacts {
// eslint-disable-next-line class-methods-use-this
// eslint-disable-next-line class-methods-use-this
setupEntryClick
()
{
setupEntryClick
()
{
return
$
(
'
.tree-holder
'
).
on
(
'
click
'
,
'
tr[data-link]
'
,
function
()
{
return
$
(
'
.tree-holder
'
).
on
(
'
click
'
,
'
tr[data-link]
'
,
function
()
{
visitUrl
(
this
.
dataset
.
link
,
convertPermissionTo
Boolean
(
this
.
dataset
.
externalLink
));
visitUrl
(
this
.
dataset
.
link
,
parse
Boolean
(
this
.
dataset
.
externalLink
));
});
});
}
}
// eslint-disable-next-line class-methods-use-this
// eslint-disable-next-line class-methods-use-this
...
...
app/assets/javascripts/ci_variable_list/ajax_variable_list.js
View file @
8ef51157
...
@@ -2,7 +2,7 @@ import _ from 'underscore';
...
@@ -2,7 +2,7 @@ import _ from 'underscore';
import
axios
from
'
../lib/utils/axios_utils
'
;
import
axios
from
'
../lib/utils/axios_utils
'
;
import
{
s__
}
from
'
../locale
'
;
import
{
s__
}
from
'
../locale
'
;
import
Flash
from
'
../flash
'
;
import
Flash
from
'
../flash
'
;
import
{
convertPermissionTo
Boolean
}
from
'
../lib/utils/common_utils
'
;
import
{
parse
Boolean
}
from
'
../lib/utils/common_utils
'
;
import
statusCodes
from
'
../lib/utils/http_status
'
;
import
statusCodes
from
'
../lib/utils/http_status
'
;
import
VariableList
from
'
./ci_variable_list
'
;
import
VariableList
from
'
./ci_variable_list
'
;
...
@@ -101,7 +101,7 @@ export default class AjaxVariableList {
...
@@ -101,7 +101,7 @@ export default class AjaxVariableList {
// If we submitted a row that was destroyed, remove it so we don't try
// If we submitted a row that was destroyed, remove it so we don't try
// to destroy it again which would cause a BE error
// to destroy it again which would cause a BE error
const
destroyInput
=
row
.
querySelector
(
'
.js-ci-variable-input-destroy
'
);
const
destroyInput
=
row
.
querySelector
(
'
.js-ci-variable-input-destroy
'
);
if
(
convertPermissionTo
Boolean
(
destroyInput
.
value
))
{
if
(
parse
Boolean
(
destroyInput
.
value
))
{
row
.
remove
();
row
.
remove
();
// Update the ID input so any future edits and `_destroy` will apply on the BE
// Update the ID input so any future edits and `_destroy` will apply on the BE
}
else
{
}
else
{
...
...
app/assets/javascripts/ci_variable_list/ci_variable_list.js
View file @
8ef51157
import
$
from
'
jquery
'
;
import
$
from
'
jquery
'
;
import
{
convertPermissionTo
Boolean
}
from
'
../lib/utils/common_utils
'
;
import
{
parse
Boolean
}
from
'
../lib/utils/common_utils
'
;
import
{
s__
}
from
'
../locale
'
;
import
{
s__
}
from
'
../locale
'
;
import
setupToggleButtons
from
'
../toggle_buttons
'
;
import
setupToggleButtons
from
'
../toggle_buttons
'
;
import
CreateItemDropdown
from
'
../create_item_dropdown
'
;
import
CreateItemDropdown
from
'
../create_item_dropdown
'
;
...
@@ -150,7 +150,7 @@ export default class VariableList {
...
@@ -150,7 +150,7 @@ export default class VariableList {
removeRow
(
row
)
{
removeRow
(
row
)
{
const
$row
=
$
(
row
);
const
$row
=
$
(
row
);
const
isPersisted
=
convertPermissionTo
Boolean
(
$row
.
attr
(
'
data-is-persisted
'
));
const
isPersisted
=
parse
Boolean
(
$row
.
attr
(
'
data-is-persisted
'
));
if
(
isPersisted
)
{
if
(
isPersisted
)
{
$row
.
hide
();
$row
.
hide
();
...
...
app/assets/javascripts/diffs/components/tree_list.vue
View file @
8ef51157
<
script
>
<
script
>
import
{
mapActions
,
mapGetters
,
mapState
}
from
'
vuex
'
;
import
{
mapActions
,
mapGetters
,
mapState
}
from
'
vuex
'
;
import
{
GlTooltipDirective
}
from
'
@gitlab/ui
'
;
import
{
GlTooltipDirective
}
from
'
@gitlab/ui
'
;
import
{
convertPermissionTo
Boolean
}
from
'
~/lib/utils/common_utils
'
;
import
{
parse
Boolean
}
from
'
~/lib/utils/common_utils
'
;
import
Icon
from
'
~/vue_shared/components/icon.vue
'
;
import
Icon
from
'
~/vue_shared/components/icon.vue
'
;
import
FileRow
from
'
~/vue_shared/components/file_row.vue
'
;
import
FileRow
from
'
~/vue_shared/components/file_row.vue
'
;
import
FileRowStats
from
'
./file_row_stats.vue
'
;
import
FileRowStats
from
'
./file_row_stats.vue
'
;
...
@@ -18,8 +18,7 @@ export default {
...
@@ -18,8 +18,7 @@ export default {
},
},
data
()
{
data
()
{
const
treeListStored
=
localStorage
.
getItem
(
treeListStorageKey
);
const
treeListStored
=
localStorage
.
getItem
(
treeListStorageKey
);
const
renderTreeList
=
const
renderTreeList
=
treeListStored
!==
null
?
parseBoolean
(
treeListStored
)
:
true
;
treeListStored
!==
null
?
convertPermissionToBoolean
(
treeListStored
)
:
true
;
return
{
return
{
search
:
''
,
search
:
''
,
...
...
app/assets/javascripts/environments/folder/environments_folder_bundle.js
View file @
8ef51157
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
environmentsFolderApp
from
'
./environments_folder_view.vue
'
;
import
environmentsFolderApp
from
'
./environments_folder_view.vue
'
;
import
{
convertPermissionTo
Boolean
}
from
'
../../lib/utils/common_utils
'
;
import
{
parse
Boolean
}
from
'
../../lib/utils/common_utils
'
;
import
Translate
from
'
../../vue_shared/translate
'
;
import
Translate
from
'
../../vue_shared/translate
'
;
Vue
.
use
(
Translate
);
Vue
.
use
(
Translate
);
...
@@ -18,8 +18,8 @@ export default () =>
...
@@ -18,8 +18,8 @@ export default () =>
endpoint
:
environmentsData
.
endpoint
,
endpoint
:
environmentsData
.
endpoint
,
folderName
:
environmentsData
.
folderName
,
folderName
:
environmentsData
.
folderName
,
cssContainerClass
:
environmentsData
.
cssClass
,
cssContainerClass
:
environmentsData
.
cssClass
,
canCreateDeployment
:
convertPermissionTo
Boolean
(
environmentsData
.
canCreateDeployment
),
canCreateDeployment
:
parse
Boolean
(
environmentsData
.
canCreateDeployment
),
canReadEnvironment
:
convertPermissionTo
Boolean
(
environmentsData
.
canReadEnvironment
),
canReadEnvironment
:
parse
Boolean
(
environmentsData
.
canReadEnvironment
),
};
};
},
},
render
(
createElement
)
{
render
(
createElement
)
{
...
...
app/assets/javascripts/environments/index.js
View file @
8ef51157
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
environmentsComponent
from
'
./components/environments_app.vue
'
;
import
environmentsComponent
from
'
./components/environments_app.vue
'
;
import
{
convertPermissionTo
Boolean
}
from
'
../lib/utils/common_utils
'
;
import
{
parse
Boolean
}
from
'
../lib/utils/common_utils
'
;
import
Translate
from
'
../vue_shared/translate
'
;
import
Translate
from
'
../vue_shared/translate
'
;
Vue
.
use
(
Translate
);
Vue
.
use
(
Translate
);
...
@@ -19,9 +19,9 @@ export default () =>
...
@@ -19,9 +19,9 @@ export default () =>
newEnvironmentPath
:
environmentsData
.
newEnvironmentPath
,
newEnvironmentPath
:
environmentsData
.
newEnvironmentPath
,
helpPagePath
:
environmentsData
.
helpPagePath
,
helpPagePath
:
environmentsData
.
helpPagePath
,
cssContainerClass
:
environmentsData
.
cssClass
,
cssContainerClass
:
environmentsData
.
cssClass
,
canCreateEnvironment
:
convertPermissionTo
Boolean
(
environmentsData
.
canCreateEnvironment
),
canCreateEnvironment
:
parse
Boolean
(
environmentsData
.
canCreateEnvironment
),
canCreateDeployment
:
convertPermissionTo
Boolean
(
environmentsData
.
canCreateDeployment
),
canCreateDeployment
:
parse
Boolean
(
environmentsData
.
canCreateDeployment
),
canReadEnvironment
:
convertPermissionTo
Boolean
(
environmentsData
.
canReadEnvironment
),
canReadEnvironment
:
parse
Boolean
(
environmentsData
.
canReadEnvironment
),
};
};
},
},
render
(
createElement
)
{
render
(
createElement
)
{
...
...
app/assets/javascripts/ide/index.js
View file @
8ef51157
...
@@ -4,7 +4,7 @@ import Translate from '~/vue_shared/translate';
...
@@ -4,7 +4,7 @@ import Translate from '~/vue_shared/translate';
import
ide
from
'
./components/ide.vue
'
;
import
ide
from
'
./components/ide.vue
'
;
import
store
from
'
./stores
'
;
import
store
from
'
./stores
'
;
import
router
from
'
./ide_router
'
;
import
router
from
'
./ide_router
'
;
import
{
convertPermissionTo
Boolean
}
from
'
../lib/utils/common_utils
'
;
import
{
parse
Boolean
}
from
'
../lib/utils/common_utils
'
;
Vue
.
use
(
Translate
);
Vue
.
use
(
Translate
);
...
@@ -40,7 +40,7 @@ export function initIde(el, options = {}) {
...
@@ -40,7 +40,7 @@ export function initIde(el, options = {}) {
webIDEHelpPagePath
:
el
.
dataset
.
webIdeHelpPagePath
,
webIDEHelpPagePath
:
el
.
dataset
.
webIdeHelpPagePath
,
});
});
this
.
setInitialData
({
this
.
setInitialData
({
clientsidePreviewEnabled
:
convertPermissionTo
Boolean
(
el
.
dataset
.
clientsidePreviewEnabled
),
clientsidePreviewEnabled
:
parse
Boolean
(
el
.
dataset
.
clientsidePreviewEnabled
),
...
extraInitialData
(
el
),
...
extraInitialData
(
el
),
});
});
},
},
...
...
app/assets/javascripts/importer_status.js
View file @
8ef51157
...
@@ -3,7 +3,7 @@ import _ from 'underscore';
...
@@ -3,7 +3,7 @@ import _ from 'underscore';
import
{
__
,
sprintf
}
from
'
./locale
'
;
import
{
__
,
sprintf
}
from
'
./locale
'
;
import
axios
from
'
./lib/utils/axios_utils
'
;
import
axios
from
'
./lib/utils/axios_utils
'
;
import
flash
from
'
./flash
'
;
import
flash
from
'
./flash
'
;
import
{
convertPermissionTo
Boolean
}
from
'
./lib/utils/common_utils
'
;
import
{
parse
Boolean
}
from
'
./lib/utils/common_utils
'
;
class
ImporterStatus
{
class
ImporterStatus
{
constructor
({
jobsUrl
,
importUrl
,
ciCdOnly
})
{
constructor
({
jobsUrl
,
importUrl
,
ciCdOnly
})
{
...
@@ -141,7 +141,7 @@ function initImporterStatus() {
...
@@ -141,7 +141,7 @@ function initImporterStatus() {
return
new
ImporterStatus
({
return
new
ImporterStatus
({
jobsUrl
:
data
.
jobsImportPath
,
jobsUrl
:
data
.
jobsImportPath
,
importUrl
:
data
.
importPath
,
importUrl
:
data
.
importPath
,
ciCdOnly
:
convertPermissionTo
Boolean
(
data
.
ciCdOnly
),
ciCdOnly
:
parse
Boolean
(
data
.
ciCdOnly
),
});
});
}
}
}
}
...
...
app/assets/javascripts/monitoring/monitoring_bundle.js
View file @
8ef51157
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
{
convertPermissionTo
Boolean
}
from
'
~/lib/utils/common_utils
'
;
import
{
parse
Boolean
}
from
'
~/lib/utils/common_utils
'
;
import
Dashboard
from
'
./components/dashboard.vue
'
;
import
Dashboard
from
'
./components/dashboard.vue
'
;
export
default
()
=>
{
export
default
()
=>
{
...
@@ -13,7 +13,7 @@ export default () => {
...
@@ -13,7 +13,7 @@ export default () => {
return
createElement
(
Dashboard
,
{
return
createElement
(
Dashboard
,
{
props
:
{
props
:
{
...
el
.
dataset
,
...
el
.
dataset
,
hasMetrics
:
convertPermissionTo
Boolean
(
el
.
dataset
.
hasMetrics
),
hasMetrics
:
parse
Boolean
(
el
.
dataset
.
hasMetrics
),
},
},
});
});
},
},
...
...
app/assets/javascripts/pages/projects/pipelines/index/index.js
View file @
8ef51157
...
@@ -2,7 +2,7 @@ import Vue from 'vue';
...
@@ -2,7 +2,7 @@ import Vue from 'vue';
import
PipelinesStore
from
'
../../../../pipelines/stores/pipelines_store
'
;
import
PipelinesStore
from
'
../../../../pipelines/stores/pipelines_store
'
;
import
pipelinesComponent
from
'
../../../../pipelines/components/pipelines.vue
'
;
import
pipelinesComponent
from
'
../../../../pipelines/components/pipelines.vue
'
;
import
Translate
from
'
../../../../vue_shared/translate
'
;
import
Translate
from
'
../../../../vue_shared/translate
'
;
import
{
convertPermissionTo
Boolean
}
from
'
../../../../lib/utils/common_utils
'
;
import
{
parse
Boolean
}
from
'
../../../../lib/utils/common_utils
'
;
Vue
.
use
(
Translate
);
Vue
.
use
(
Translate
);
...
@@ -33,8 +33,8 @@ document.addEventListener(
...
@@ -33,8 +33,8 @@ document.addEventListener(
noPipelinesSvgPath
:
this
.
dataset
.
noPipelinesSvgPath
,
noPipelinesSvgPath
:
this
.
dataset
.
noPipelinesSvgPath
,
autoDevopsPath
:
this
.
dataset
.
helpAutoDevopsPath
,
autoDevopsPath
:
this
.
dataset
.
helpAutoDevopsPath
,
newPipelinePath
:
this
.
dataset
.
newPipelinePath
,
newPipelinePath
:
this
.
dataset
.
newPipelinePath
,
canCreatePipeline
:
convertPermissionTo
Boolean
(
this
.
dataset
.
canCreatePipeline
),
canCreatePipeline
:
parse
Boolean
(
this
.
dataset
.
canCreatePipeline
),
hasGitlabCi
:
convertPermissionTo
Boolean
(
this
.
dataset
.
hasGitlabCi
),
hasGitlabCi
:
parse
Boolean
(
this
.
dataset
.
hasGitlabCi
),
ciLintPath
:
this
.
dataset
.
ciLintPath
,
ciLintPath
:
this
.
dataset
.
ciLintPath
,
resetCachePath
:
this
.
dataset
.
resetCachePath
,
resetCachePath
:
this
.
dataset
.
resetCachePath
,
},
},
...
...
app/assets/javascripts/toggle_buttons.js
View file @
8ef51157
import
$
from
'
jquery
'
;
import
$
from
'
jquery
'
;
import
Flash
from
'
./flash
'
;
import
Flash
from
'
./flash
'
;
import
{
__
}
from
'
./locale
'
;
import
{
__
}
from
'
./locale
'
;
import
{
convertPermissionTo
Boolean
}
from
'
./lib/utils/common_utils
'
;
import
{
parse
Boolean
}
from
'
./lib/utils/common_utils
'
;
/*
/*
example HAML:
example HAML:
...
@@ -18,7 +18,7 @@ function updateToggle(toggle, isOn) {
...
@@ -18,7 +18,7 @@ function updateToggle(toggle, isOn) {
}
}
function
onToggleClicked
(
toggle
,
input
,
clickCallback
)
{
function
onToggleClicked
(
toggle
,
input
,
clickCallback
)
{
const
previousIsOn
=
convertPermissionTo
Boolean
(
input
.
value
);
const
previousIsOn
=
parse
Boolean
(
input
.
value
);
// Visually change the toggle and start loading
// Visually change the toggle and start loading
updateToggle
(
toggle
,
!
previousIsOn
);
updateToggle
(
toggle
,
!
previousIsOn
);
...
@@ -51,7 +51,7 @@ export default function setupToggleButtons(container, clickCallback = () => {})
...
@@ -51,7 +51,7 @@ export default function setupToggleButtons(container, clickCallback = () => {})
toggles
.
forEach
(
toggle
=>
{
toggles
.
forEach
(
toggle
=>
{
const
input
=
toggle
.
querySelector
(
'
.js-project-feature-toggle-input
'
);
const
input
=
toggle
.
querySelector
(
'
.js-project-feature-toggle-input
'
);
const
isOn
=
convertPermissionTo
Boolean
(
input
.
value
);
const
isOn
=
parse
Boolean
(
input
.
value
);
// Get the visible toggle in sync with the hidden input
// Get the visible toggle in sync with the hidden input
updateToggle
(
toggle
,
isOn
);
updateToggle
(
toggle
,
isOn
);
...
...
app/assets/javascripts/usage_ping_consent.js
View file @
8ef51157
import
$
from
'
jquery
'
;
import
$
from
'
jquery
'
;
import
axios
from
'
./lib/utils/axios_utils
'
;
import
axios
from
'
./lib/utils/axios_utils
'
;
import
Flash
,
{
hideFlash
}
from
'
./flash
'
;
import
Flash
,
{
hideFlash
}
from
'
./flash
'
;
import
{
convertPermissionTo
Boolean
}
from
'
./lib/utils/common_utils
'
;
import
{
parse
Boolean
}
from
'
./lib/utils/common_utils
'
;
export
default
()
=>
{
export
default
()
=>
{
$
(
'
body
'
).
on
(
'
click
'
,
'
.js-usage-consent-action
'
,
e
=>
{
$
(
'
body
'
).
on
(
'
click
'
,
'
.js-usage-consent-action
'
,
e
=>
{
...
@@ -11,8 +11,8 @@ export default () => {
...
@@ -11,8 +11,8 @@ export default () => {
const
{
url
,
checkEnabled
,
pingEnabled
}
=
e
.
target
.
dataset
;
const
{
url
,
checkEnabled
,
pingEnabled
}
=
e
.
target
.
dataset
;
const
data
=
{
const
data
=
{
application_setting
:
{
application_setting
:
{
version_check_enabled
:
convertPermissionTo
Boolean
(
checkEnabled
),
version_check_enabled
:
parse
Boolean
(
checkEnabled
),
usage_ping_enabled
:
convertPermissionTo
Boolean
(
pingEnabled
),
usage_ping_enabled
:
parse
Boolean
(
pingEnabled
),
},
},
};
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment