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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
70ce1e9e
Commit
70ce1e9e
authored
Nov 27, 2018
by
Winnie Hellmann
Committed by
Phil Hughes
Nov 27, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add parseBoolean helper function (EE-port)
parent
9e99352e
Changes
44
Show whitespace changes
Inline
Side-by-side
Showing
44 changed files
with
141 additions
and
88 deletions
+141
-88
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/behaviors/shortcuts/shortcuts.js
app/assets/javascripts/behaviors/shortcuts/shortcuts.js
+2
-1
app/assets/javascripts/boards/index.js
app/assets/javascripts/boards/index.js
+6
-6
app/assets/javascripts/boards/stores/boards_store.js
app/assets/javascripts/boards/stores/boards_store.js
+2
-2
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/contextual_sidebar.js
app/assets/javascripts/contextual_sidebar.js
+2
-1
app/assets/javascripts/diffs/components/tree_list.vue
app/assets/javascripts/diffs/components/tree_list.vue
+2
-3
app/assets/javascripts/diffs/store/modules/diff_state.js
app/assets/javascripts/diffs/store/modules/diff_state.js
+2
-1
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/groups/index.js
app/assets/javascripts/groups/index.js
+2
-1
app/assets/javascripts/header.js
app/assets/javascripts/header.js
+2
-1
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/landing.js
app/assets/javascripts/landing.js
+2
-1
app/assets/javascripts/lib/utils/common_utils.js
app/assets/javascripts/lib/utils/common_utils.js
+17
-1
app/assets/javascripts/merge_request_tabs.js
app/assets/javascripts/merge_request_tabs.js
+7
-2
app/assets/javascripts/monitoring/monitoring_bundle.js
app/assets/javascripts/monitoring/monitoring_bundle.js
+2
-2
app/assets/javascripts/namespace_select.js
app/assets/javascripts/namespace_select.js
+2
-1
app/assets/javascripts/pages/admin/abuse_reports/abuse_reports.js
...ts/javascripts/pages/admin/abuse_reports/abuse_reports.js
+2
-1
app/assets/javascripts/pages/profiles/two_factor_auths/index.js
...sets/javascripts/pages/profiles/two_factor_auths/index.js
+2
-1
app/assets/javascripts/pages/projects/pipeline_schedules/shared/components/pipeline_schedules_callout.vue
...chedules/shared/components/pipeline_schedules_callout.vue
+2
-1
app/assets/javascripts/pages/projects/pipelines/index/index.js
...ssets/javascripts/pages/projects/pipelines/index/index.js
+3
-3
app/assets/javascripts/performance_bar/services/performance_bar_service.js
...ripts/performance_bar/services/performance_bar_service.js
+3
-1
app/assets/javascripts/profile/profile.js
app/assets/javascripts/profile/profile.js
+2
-1
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
ee/app/assets/javascripts/behaviors/shortcuts/shortcuts_epic.js
.../assets/javascripts/behaviors/shortcuts/shortcuts_epic.js
+2
-1
ee/app/assets/javascripts/boards/stores/boards_store_ee.js
ee/app/assets/javascripts/boards/stores/boards_store_ee.js
+3
-3
ee/app/assets/javascripts/ee_trial_banner/ee_trial_banner.js
ee/app/assets/javascripts/ee_trial_banner/ee_trial_banner.js
+2
-1
ee/app/assets/javascripts/epics/sidebar/components/sidebar_app.vue
...sets/javascripts/epics/sidebar/components/sidebar_app.vue
+2
-1
ee/app/assets/javascripts/geo_nodes/index.js
ee/app/assets/javascripts/geo_nodes/index.js
+3
-3
ee/app/assets/javascripts/pages/groups/epics/show/index.js
ee/app/assets/javascripts/pages/groups/epics/show/index.js
+2
-1
ee/app/assets/javascripts/pages/projects/pipelines/show/license_report.js
...vascripts/pages/projects/pipelines/show/license_report.js
+2
-2
ee/app/assets/javascripts/pages/projects/pipelines/show/security_report.js
...ascripts/pages/projects/pipelines/show/security_report.js
+3
-3
ee/app/assets/javascripts/pages/projects/security/dashboard/show/index.js
...vascripts/pages/projects/security/dashboard/show/index.js
+4
-3
ee/app/assets/javascripts/pages/projects/tree/show/index.js
ee/app/assets/javascripts/pages/projects/tree/show/index.js
+2
-1
ee/app/assets/javascripts/projects/settings_service_desk/index.js
...ssets/javascripts/projects/settings_service_desk/index.js
+2
-2
ee/app/assets/javascripts/related_issues/index.js
ee/app/assets/javascripts/related_issues/index.js
+2
-4
ee/app/assets/javascripts/roadmap/index.js
ee/app/assets/javascripts/roadmap/index.js
+2
-2
spec/javascripts/lib/utils/common_utils_spec.js
spec/javascripts/lib/utils/common_utils_spec.js
+18
-0
No files found.
app/assets/javascripts/behaviors/markdown/gfm_auto_complete.js
View file @
70ce1e9e
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 @
70ce1e9e
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/behaviors/shortcuts/shortcuts.js
View file @
70ce1e9e
...
@@ -4,6 +4,7 @@ import Mousetrap from 'mousetrap';
...
@@ -4,6 +4,7 @@ import Mousetrap from 'mousetrap';
import
axios
from
'
../../lib/utils/axios_utils
'
;
import
axios
from
'
../../lib/utils/axios_utils
'
;
import
{
refreshCurrentPage
,
visitUrl
}
from
'
../../lib/utils/url_utility
'
;
import
{
refreshCurrentPage
,
visitUrl
}
from
'
../../lib/utils/url_utility
'
;
import
findAndFollowLink
from
'
../../lib/utils/navigation_utility
'
;
import
findAndFollowLink
from
'
../../lib/utils/navigation_utility
'
;
import
{
parseBoolean
}
from
'
~/lib/utils/common_utils
'
;
const
defaultStopCallback
=
Mousetrap
.
stopCallback
;
const
defaultStopCallback
=
Mousetrap
.
stopCallback
;
Mousetrap
.
stopCallback
=
(
e
,
element
,
combo
)
=>
{
Mousetrap
.
stopCallback
=
(
e
,
element
,
combo
)
=>
{
...
@@ -61,7 +62,7 @@ export default class Shortcuts {
...
@@ -61,7 +62,7 @@ export default class Shortcuts {
static
onTogglePerfBar
(
e
)
{
static
onTogglePerfBar
(
e
)
{
e
.
preventDefault
();
e
.
preventDefault
();
const
performanceBarCookieName
=
'
perf_bar_enabled
'
;
const
performanceBarCookieName
=
'
perf_bar_enabled
'
;
if
(
Cookies
.
get
(
performanceBarCookieName
)
===
'
true
'
)
{
if
(
parseBoolean
(
Cookies
.
get
(
performanceBarCookieName
))
)
{
Cookies
.
set
(
performanceBarCookieName
,
'
false
'
,
{
path
:
'
/
'
});
Cookies
.
set
(
performanceBarCookieName
,
'
false
'
,
{
path
:
'
/
'
});
}
else
{
}
else
{
Cookies
.
set
(
performanceBarCookieName
,
'
true
'
,
{
path
:
'
/
'
});
Cookies
.
set
(
performanceBarCookieName
,
'
true
'
,
{
path
:
'
/
'
});
...
...
app/assets/javascripts/boards/index.js
View file @
70ce1e9e
...
@@ -21,7 +21,7 @@ import BoardSidebar from 'ee/boards/components/board_sidebar';
...
@@ -21,7 +21,7 @@ import BoardSidebar from 'ee/boards/components/board_sidebar';
import
initNewListDropdown
from
'
./components/new_list_dropdown
'
;
import
initNewListDropdown
from
'
./components/new_list_dropdown
'
;
import
BoardAddIssuesModal
from
'
ee/boards/components/modal/index
'
;
import
BoardAddIssuesModal
from
'
ee/boards/components/modal/index
'
;
import
'
~/vue_shared/vue_resource_interceptor
'
;
import
'
~/vue_shared/vue_resource_interceptor
'
;
import
{
NavigationType
}
from
'
~/lib/utils/common_utils
'
;
import
{
NavigationType
,
parseBoolean
}
from
'
~/lib/utils/common_utils
'
;
import
'
ee/boards/models/list
'
;
import
'
ee/boards/models/list
'
;
import
'
ee/boards/models/issue
'
;
import
'
ee/boards/models/issue
'
;
...
@@ -67,7 +67,7 @@ export default () => {
...
@@ -67,7 +67,7 @@ export default () => {
boardsEndpoint
:
$boardApp
.
dataset
.
boardsEndpoint
,
boardsEndpoint
:
$boardApp
.
dataset
.
boardsEndpoint
,
listsEndpoint
:
$boardApp
.
dataset
.
listsEndpoint
,
listsEndpoint
:
$boardApp
.
dataset
.
listsEndpoint
,
boardId
:
$boardApp
.
dataset
.
boardId
,
boardId
:
$boardApp
.
dataset
.
boardId
,
disabled
:
$boardApp
.
dataset
.
disabled
===
'
true
'
,
disabled
:
parseBoolean
(
$boardApp
.
dataset
.
disabled
)
,
issueLinkBase
:
$boardApp
.
dataset
.
issueLinkBase
,
issueLinkBase
:
$boardApp
.
dataset
.
issueLinkBase
,
rootPath
:
$boardApp
.
dataset
.
rootPath
,
rootPath
:
$boardApp
.
dataset
.
rootPath
,
bulkUpdatePath
:
$boardApp
.
dataset
.
bulkUpdatePath
,
bulkUpdatePath
:
$boardApp
.
dataset
.
bulkUpdatePath
,
...
@@ -369,12 +369,12 @@ export default () => {
...
@@ -369,12 +369,12 @@ export default () => {
const
boardsSelectorProps
=
{
const
boardsSelectorProps
=
{
...
dataset
,
...
dataset
,
currentBoard
:
JSON
.
parse
(
dataset
.
currentBoard
),
currentBoard
:
JSON
.
parse
(
dataset
.
currentBoard
),
hasMissingBoards
:
dataset
.
hasMissingBoards
===
'
true
'
,
hasMissingBoards
:
parseBoolean
(
dataset
.
hasMissingBoards
)
,
canAdminBoard
:
dataset
.
canAdminBoard
===
'
true
'
,
canAdminBoard
:
parseBoolean
(
dataset
.
canAdminBoard
)
,
multipleIssueBoardsAvailable
:
dataset
.
multipleIssueBoardsAvailable
===
'
true
'
,
multipleIssueBoardsAvailable
:
parseBoolean
(
dataset
.
multipleIssueBoardsAvailable
)
,
projectId
:
Number
(
dataset
.
projectId
),
projectId
:
Number
(
dataset
.
projectId
),
groupId
:
Number
(
dataset
.
groupId
),
groupId
:
Number
(
dataset
.
groupId
),
scopedIssueBoardFeatureEnabled
:
dataset
.
scopedIssueBoardFeatureEnabled
===
'
true
'
,
scopedIssueBoardFeatureEnabled
:
parseBoolean
(
dataset
.
scopedIssueBoardFeatureEnabled
)
,
weights
:
JSON
.
parse
(
dataset
.
weights
),
weights
:
JSON
.
parse
(
dataset
.
weights
),
};
};
...
...
app/assets/javascripts/boards/stores/boards_store.js
View file @
70ce1e9e
...
@@ -6,7 +6,7 @@ import _ from 'underscore';
...
@@ -6,7 +6,7 @@ import _ from 'underscore';
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
Cookies
from
'
js-cookie
'
;
import
Cookies
from
'
js-cookie
'
;
import
BoardsStoreEE
from
'
ee/boards/stores/boards_store_ee
'
;
import
BoardsStoreEE
from
'
ee/boards/stores/boards_store_ee
'
;
import
{
getUrlParamsArray
}
from
'
~/lib/utils/common_utils
'
;
import
{
getUrlParamsArray
,
parseBoolean
}
from
'
~/lib/utils/common_utils
'
;
const
boardsStore
=
{
const
boardsStore
=
{
disabled
:
false
,
disabled
:
false
,
...
@@ -96,7 +96,7 @@ const boardsStore = {
...
@@ -96,7 +96,7 @@ const boardsStore = {
});
});
},
},
welcomeIsHidden
()
{
welcomeIsHidden
()
{
return
Cookies
.
get
(
'
issue_board_welcome_hidden
'
)
===
'
true
'
;
return
parseBoolean
(
Cookies
.
get
(
'
issue_board_welcome_hidden
'
))
;
},
},
removeList
(
id
,
type
=
'
blank
'
)
{
removeList
(
id
,
type
=
'
blank
'
)
{
const
list
=
this
.
findList
(
'
id
'
,
id
,
type
);
const
list
=
this
.
findList
(
'
id
'
,
id
,
type
);
...
...
app/assets/javascripts/build_artifacts.js
View file @
70ce1e9e
...
@@ -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 @
70ce1e9e
...
@@ -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 @
70ce1e9e
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/contextual_sidebar.js
View file @
70ce1e9e
...
@@ -2,6 +2,7 @@ import $ from 'jquery';
...
@@ -2,6 +2,7 @@ import $ from 'jquery';
import
Cookies
from
'
js-cookie
'
;
import
Cookies
from
'
js-cookie
'
;
import
_
from
'
underscore
'
;
import
_
from
'
underscore
'
;
import
bp
from
'
./breakpoints
'
;
import
bp
from
'
./breakpoints
'
;
import
{
parseBoolean
}
from
'
~/lib/utils/common_utils
'
;
export
default
class
ContextualSidebar
{
export
default
class
ContextualSidebar
{
constructor
()
{
constructor
()
{
...
@@ -78,7 +79,7 @@ export default class ContextualSidebar {
...
@@ -78,7 +79,7 @@ export default class ContextualSidebar {
if
(
breakpoint
===
'
sm
'
||
breakpoint
===
'
md
'
)
{
if
(
breakpoint
===
'
sm
'
||
breakpoint
===
'
md
'
)
{
this
.
toggleCollapsedSidebar
(
true
);
this
.
toggleCollapsedSidebar
(
true
);
}
else
if
(
breakpoint
===
'
lg
'
)
{
}
else
if
(
breakpoint
===
'
lg
'
)
{
const
collapse
=
Cookies
.
get
(
'
sidebar_collapsed
'
)
===
'
true
'
;
const
collapse
=
parseBoolean
(
Cookies
.
get
(
'
sidebar_collapsed
'
))
;
this
.
toggleCollapsedSidebar
(
collapse
);
this
.
toggleCollapsedSidebar
(
collapse
);
}
}
}
}
...
...
app/assets/javascripts/diffs/components/tree_list.vue
View file @
70ce1e9e
<
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/diffs/store/modules/diff_state.js
View file @
70ce1e9e
import
Cookies
from
'
js-cookie
'
;
import
Cookies
from
'
js-cookie
'
;
import
{
getParameterValues
}
from
'
~/lib/utils/url_utility
'
;
import
{
getParameterValues
}
from
'
~/lib/utils/url_utility
'
;
import
bp
from
'
~/breakpoints
'
;
import
bp
from
'
~/breakpoints
'
;
import
{
parseBoolean
}
from
'
~/lib/utils/common_utils
'
;
import
{
INLINE_DIFF_VIEW_TYPE
,
DIFF_VIEW_COOKIE_NAME
,
MR_TREE_SHOW_KEY
}
from
'
../../constants
'
;
import
{
INLINE_DIFF_VIEW_TYPE
,
DIFF_VIEW_COOKIE_NAME
,
MR_TREE_SHOW_KEY
}
from
'
../../constants
'
;
const
viewTypeFromQueryString
=
getParameterValues
(
'
view
'
)[
0
];
const
viewTypeFromQueryString
=
getParameterValues
(
'
view
'
)[
0
];
...
@@ -22,7 +23,7 @@ export default () => ({
...
@@ -22,7 +23,7 @@ export default () => ({
tree
:
[],
tree
:
[],
treeEntries
:
{},
treeEntries
:
{},
showTreeList
:
showTreeList
:
storedTreeShow
===
null
?
bp
.
getBreakpointSize
()
!==
'
xs
'
:
storedTreeShow
===
'
true
'
,
storedTreeShow
===
null
?
bp
.
getBreakpointSize
()
!==
'
xs
'
:
parseBoolean
(
storedTreeShow
)
,
currentDiffFileId
:
''
,
currentDiffFileId
:
''
,
projectPath
:
''
,
projectPath
:
''
,
commentForms
:
[],
commentForms
:
[],
...
...
app/assets/javascripts/environments/folder/environments_folder_bundle.js
View file @
70ce1e9e
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 @
70ce1e9e
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/groups/index.js
View file @
70ce1e9e
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
{
parseBoolean
}
from
'
~/lib/utils/common_utils
'
;
import
Translate
from
'
../vue_shared/translate
'
;
import
Translate
from
'
../vue_shared/translate
'
;
import
GroupFilterableList
from
'
./groups_filterable_list
'
;
import
GroupFilterableList
from
'
./groups_filterable_list
'
;
import
GroupsStore
from
'
./store/groups_store
'
;
import
GroupsStore
from
'
./store/groups_store
'
;
...
@@ -38,7 +39,7 @@ export default (containerId = 'js-groups-tree', endpoint, action = '') => {
...
@@ -38,7 +39,7 @@ export default (containerId = 'js-groups-tree', endpoint, action = '') => {
},
},
data
()
{
data
()
{
const
{
dataset
}
=
dataEl
||
this
.
$options
.
el
;
const
{
dataset
}
=
dataEl
||
this
.
$options
.
el
;
const
hideProjects
=
dataset
.
hideProjects
===
'
true
'
;
const
hideProjects
=
parseBoolean
(
dataset
.
hideProjects
)
;
const
service
=
new
GroupsService
(
endpoint
||
dataset
.
endpoint
);
const
service
=
new
GroupsService
(
endpoint
||
dataset
.
endpoint
);
const
store
=
new
GroupsStore
(
hideProjects
);
const
store
=
new
GroupsStore
(
hideProjects
);
...
...
app/assets/javascripts/header.js
View file @
70ce1e9e
...
@@ -4,6 +4,7 @@ import Translate from '~/vue_shared/translate';
...
@@ -4,6 +4,7 @@ import Translate from '~/vue_shared/translate';
import
{
highCountTrim
}
from
'
~/lib/utils/text_utility
'
;
import
{
highCountTrim
}
from
'
~/lib/utils/text_utility
'
;
import
SetStatusModalTrigger
from
'
./set_status_modal/set_status_modal_trigger.vue
'
;
import
SetStatusModalTrigger
from
'
./set_status_modal/set_status_modal_trigger.vue
'
;
import
SetStatusModalWrapper
from
'
./set_status_modal/set_status_modal_wrapper.vue
'
;
import
SetStatusModalWrapper
from
'
./set_status_modal/set_status_modal_wrapper.vue
'
;
import
{
parseBoolean
}
from
'
~/lib/utils/common_utils
'
;
/**
/**
* Updates todo counter when todos are toggled.
* Updates todo counter when todos are toggled.
...
@@ -36,7 +37,7 @@ document.addEventListener('DOMContentLoaded', () => {
...
@@ -36,7 +37,7 @@ document.addEventListener('DOMContentLoaded', () => {
const
{
hasStatus
}
=
this
.
$options
.
el
.
dataset
;
const
{
hasStatus
}
=
this
.
$options
.
el
.
dataset
;
return
{
return
{
hasStatus
:
hasStatus
===
'
true
'
,
hasStatus
:
parseBoolean
(
hasStatus
)
,
};
};
},
},
render
(
createElement
)
{
render
(
createElement
)
{
...
...
app/assets/javascripts/ide/index.js
View file @
70ce1e9e
...
@@ -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 @
70ce1e9e
...
@@ -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/landing.js
View file @
70ce1e9e
import
Cookies
from
'
js-cookie
'
;
import
Cookies
from
'
js-cookie
'
;
import
{
parseBoolean
}
from
'
~/lib/utils/common_utils
'
;
class
Landing
{
class
Landing
{
constructor
(
landingElement
,
dismissButton
,
cookieName
)
{
constructor
(
landingElement
,
dismissButton
,
cookieName
)
{
...
@@ -30,7 +31,7 @@ class Landing {
...
@@ -30,7 +31,7 @@ class Landing {
}
}
isDismissed
()
{
isDismissed
()
{
return
Cookies
.
get
(
this
.
cookieName
)
===
'
true
'
;
return
parseBoolean
(
Cookies
.
get
(
this
.
cookieName
))
;
}
}
}
}
...
...
app/assets/javascripts/lib/utils/common_utils.js
View file @
70ce1e9e
...
@@ -420,13 +420,29 @@ export const historyPushState = newUrl => {
...
@@ -420,13 +420,29 @@ export const historyPushState = newUrl => {
window
.
history
.
pushState
({},
document
.
title
,
newUrl
);
window
.
history
.
pushState
({},
document
.
title
,
newUrl
);
};
};
/**
* Returns true for a String "true" and false otherwise.
* This is the opposite of Boolean(...).toString()
*
* @param {String} value
* @returns {Boolean}
*/
export
const
parseBoolean
=
value
=>
value
===
'
true
'
;
/**
/**
* Converts permission provided as strings to booleans.
* Converts permission provided as strings to booleans.
*
*
* @param {String} string
* @param {String} string
* @returns {Boolean}
* @returns {Boolean}
*/
*/
export
const
convertPermissionToBoolean
=
permission
=>
permission
===
'
true
'
;
export
const
convertPermissionToBoolean
=
permission
=>
{
if
(
process
.
env
.
NODE_ENV
!==
'
production
'
)
{
// eslint-disable-next-line no-console
console
.
warn
(
'
convertPermissionToBoolean is deprecated! Please use parseBoolean instead.
'
);
}
return
parseBoolean
(
permission
);
};
/**
/**
* Back Off exponential algorithm
* Back Off exponential algorithm
...
...
app/assets/javascripts/merge_request_tabs.js
View file @
70ce1e9e
...
@@ -8,7 +8,12 @@ import flash from './flash';
...
@@ -8,7 +8,12 @@ import flash from './flash';
import
BlobForkSuggestion
from
'
./blob/blob_fork_suggestion
'
;
import
BlobForkSuggestion
from
'
./blob/blob_fork_suggestion
'
;
import
initChangesDropdown
from
'
./init_changes_dropdown
'
;
import
initChangesDropdown
from
'
./init_changes_dropdown
'
;
import
bp
from
'
./breakpoints
'
;
import
bp
from
'
./breakpoints
'
;
import
{
parseUrlPathname
,
handleLocationHash
,
isMetaClick
}
from
'
./lib/utils/common_utils
'
;
import
{
parseUrlPathname
,
handleLocationHash
,
isMetaClick
,
parseBoolean
,
}
from
'
./lib/utils/common_utils
'
;
import
{
isInVueNoteablePage
}
from
'
./lib/utils/dom_utils
'
;
import
{
isInVueNoteablePage
}
from
'
./lib/utils/dom_utils
'
;
import
{
getLocationHash
}
from
'
./lib/utils/url_utility
'
;
import
{
getLocationHash
}
from
'
./lib/utils/url_utility
'
;
import
Diff
from
'
./diff
'
;
import
Diff
from
'
./diff
'
;
...
@@ -440,7 +445,7 @@ export default class MergeRequestTabs {
...
@@ -440,7 +445,7 @@ export default class MergeRequestTabs {
// Expand the issuable sidebar unless the user explicitly collapsed it
// Expand the issuable sidebar unless the user explicitly collapsed it
expandView
()
{
expandView
()
{
if
(
Cookies
.
get
(
'
collapsed_gutter
'
)
===
'
true
'
)
{
if
(
parseBoolean
(
Cookies
.
get
(
'
collapsed_gutter
'
))
)
{
return
;
return
;
}
}
const
$gutterIcon
=
$
(
'
.js-sidebar-toggle i:visible
'
);
const
$gutterIcon
=
$
(
'
.js-sidebar-toggle i:visible
'
);
...
...
app/assets/javascripts/monitoring/monitoring_bundle.js
View file @
70ce1e9e
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/namespace_select.js
View file @
70ce1e9e
...
@@ -3,10 +3,11 @@
...
@@ -3,10 +3,11 @@
import
$
from
'
jquery
'
;
import
$
from
'
jquery
'
;
import
Api
from
'
./api
'
;
import
Api
from
'
./api
'
;
import
{
mergeUrlParams
}
from
'
./lib/utils/url_utility
'
;
import
{
mergeUrlParams
}
from
'
./lib/utils/url_utility
'
;
import
{
parseBoolean
}
from
'
~/lib/utils/common_utils
'
;
export
default
class
NamespaceSelect
{
export
default
class
NamespaceSelect
{
constructor
(
opts
)
{
constructor
(
opts
)
{
const
isFilter
=
opts
.
dropdown
.
dataset
.
isFilter
===
'
true
'
;
const
isFilter
=
parseBoolean
(
opts
.
dropdown
.
dataset
.
isFilter
)
;
const
fieldName
=
opts
.
dropdown
.
dataset
.
fieldName
||
'
namespace_id
'
;
const
fieldName
=
opts
.
dropdown
.
dataset
.
fieldName
||
'
namespace_id
'
;
$
(
opts
.
dropdown
).
glDropdown
({
$
(
opts
.
dropdown
).
glDropdown
({
...
...
app/assets/javascripts/pages/admin/abuse_reports/abuse_reports.js
View file @
70ce1e9e
import
$
from
'
jquery
'
;
import
$
from
'
jquery
'
;
import
{
truncate
}
from
'
../../../lib/utils/text_utility
'
;
import
{
truncate
}
from
'
../../../lib/utils/text_utility
'
;
import
{
parseBoolean
}
from
'
~/lib/utils/common_utils
'
;
const
MAX_MESSAGE_LENGTH
=
500
;
const
MAX_MESSAGE_LENGTH
=
500
;
const
MESSAGE_CELL_SELECTOR
=
'
.abuse-reports .message
'
;
const
MESSAGE_CELL_SELECTOR
=
'
.abuse-reports .message
'
;
...
@@ -26,7 +27,7 @@ export default class AbuseReports {
...
@@ -26,7 +27,7 @@ export default class AbuseReports {
const
$messageCellElement
=
$
(
this
);
const
$messageCellElement
=
$
(
this
);
const
originalMessage
=
$messageCellElement
.
data
(
'
originalMessage
'
);
const
originalMessage
=
$messageCellElement
.
data
(
'
originalMessage
'
);
if
(
!
originalMessage
)
return
;
if
(
!
originalMessage
)
return
;
if
(
$messageCellElement
.
data
(
'
messageTruncated
'
)
===
'
true
'
)
{
if
(
parseBoolean
(
$messageCellElement
.
data
(
'
messageTruncated
'
))
)
{
$messageCellElement
.
data
(
'
messageTruncated
'
,
'
false
'
);
$messageCellElement
.
data
(
'
messageTruncated
'
,
'
false
'
);
$messageCellElement
.
text
(
originalMessage
);
$messageCellElement
.
text
(
originalMessage
);
}
else
{
}
else
{
...
...
app/assets/javascripts/pages/profiles/two_factor_auths/index.js
View file @
70ce1e9e
import
$
from
'
jquery
'
;
import
$
from
'
jquery
'
;
import
U2FRegister
from
'
~/u2f/register
'
;
import
U2FRegister
from
'
~/u2f/register
'
;
import
{
parseBoolean
}
from
'
~/lib/utils/common_utils
'
;
document
.
addEventListener
(
'
DOMContentLoaded
'
,
()
=>
{
document
.
addEventListener
(
'
DOMContentLoaded
'
,
()
=>
{
const
twoFactorNode
=
document
.
querySelector
(
'
.js-two-factor-auth
'
);
const
twoFactorNode
=
document
.
querySelector
(
'
.js-two-factor-auth
'
);
const
skippable
=
twoFactorNode
.
dataset
.
twoFactorSkippable
===
'
true
'
;
const
skippable
=
parseBoolean
(
twoFactorNode
.
dataset
.
twoFactorSkippable
)
;
if
(
skippable
)
{
if
(
skippable
)
{
const
button
=
`<a class="btn btn-sm btn-warning float-right" data-method="patch" href="
${
const
button
=
`<a class="btn btn-sm btn-warning float-right" data-method="patch" href="
${
twoFactorNode
.
dataset
.
two_factor_skip_url
twoFactorNode
.
dataset
.
two_factor_skip_url
...
...
app/assets/javascripts/pages/projects/pipeline_schedules/shared/components/pipeline_schedules_callout.vue
View file @
70ce1e9e
...
@@ -3,6 +3,7 @@ import Vue from 'vue';
...
@@ -3,6 +3,7 @@ import Vue from 'vue';
import
Cookies
from
'
js-cookie
'
;
import
Cookies
from
'
js-cookie
'
;
import
Translate
from
'
../../../../../vue_shared/translate
'
;
import
Translate
from
'
../../../../../vue_shared/translate
'
;
import
illustrationSvg
from
'
../icons/intro_illustration.svg
'
;
import
illustrationSvg
from
'
../icons/intro_illustration.svg
'
;
import
{
parseBoolean
}
from
'
~/lib/utils/common_utils
'
;
Vue
.
use
(
Translate
);
Vue
.
use
(
Translate
);
...
@@ -13,7 +14,7 @@ export default {
...
@@ -13,7 +14,7 @@ export default {
data
()
{
data
()
{
return
{
return
{
docsUrl
:
document
.
getElementById
(
'
pipeline-schedules-callout
'
).
dataset
.
docsUrl
,
docsUrl
:
document
.
getElementById
(
'
pipeline-schedules-callout
'
).
dataset
.
docsUrl
,
calloutDismissed
:
Cookies
.
get
(
cookieKey
)
===
'
true
'
,
calloutDismissed
:
parseBoolean
(
Cookies
.
get
(
cookieKey
))
,
};
};
},
},
created
()
{
created
()
{
...
...
app/assets/javascripts/pages/projects/pipelines/index/index.js
View file @
70ce1e9e
...
@@ -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/performance_bar/services/performance_bar_service.js
View file @
70ce1e9e
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
_
from
'
underscore
'
;
import
_
from
'
underscore
'
;
import
axios
from
'
../../lib/utils/axios_utils
'
;
import
axios
from
'
../../lib/utils/axios_utils
'
;
import
{
parseBoolean
}
from
'
~/lib/utils/common_utils
'
;
let
vueResourceInterceptor
;
let
vueResourceInterceptor
;
...
@@ -41,7 +42,8 @@ export default class PerformanceBarService {
...
@@ -41,7 +42,8 @@ export default class PerformanceBarService {
// Vue Resource.
// Vue Resource.
const
requestUrl
=
(
response
.
config
||
response
).
url
;
const
requestUrl
=
(
response
.
config
||
response
).
url
;
const
apiRequest
=
requestUrl
&&
requestUrl
.
match
(
/^
\/
api
\/
/
);
const
apiRequest
=
requestUrl
&&
requestUrl
.
match
(
/^
\/
api
\/
/
);
const
cachedResponse
=
response
.
headers
&&
response
.
headers
[
'
x-gitlab-from-cache
'
]
===
'
true
'
;
const
cachedResponse
=
response
.
headers
&&
parseBoolean
(
response
.
headers
[
'
x-gitlab-from-cache
'
]);
const
fireCallback
=
requestUrl
!==
peekUrl
&&
requestId
&&
!
apiRequest
&&
!
cachedResponse
;
const
fireCallback
=
requestUrl
!==
peekUrl
&&
requestId
&&
!
apiRequest
&&
!
cachedResponse
;
return
[
fireCallback
,
requestId
,
requestUrl
];
return
[
fireCallback
,
requestId
,
requestUrl
];
...
...
app/assets/javascripts/profile/profile.js
View file @
70ce1e9e
import
$
from
'
jquery
'
;
import
$
from
'
jquery
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
flash
from
'
../flash
'
;
import
flash
from
'
../flash
'
;
import
{
parseBoolean
}
from
'
~/lib/utils/common_utils
'
;
export
default
class
Profile
{
export
default
class
Profile
{
constructor
({
form
}
=
{})
{
constructor
({
form
}
=
{})
{
...
@@ -80,7 +81,7 @@ export default class Profile {
...
@@ -80,7 +81,7 @@ export default class Profile {
setRepoRadio
()
{
setRepoRadio
()
{
const
multiEditRadios
=
$
(
'
input[name="user[multi_file]"]
'
);
const
multiEditRadios
=
$
(
'
input[name="user[multi_file]"]
'
);
if
(
this
.
newRepoActivated
||
this
.
newRepoActivated
===
'
true
'
)
{
if
(
parseBoolean
(
this
.
newRepoActivated
)
)
{
multiEditRadios
.
filter
(
'
[value=on]
'
).
prop
(
'
checked
'
,
true
);
multiEditRadios
.
filter
(
'
[value=on]
'
).
prop
(
'
checked
'
,
true
);
}
else
{
}
else
{
multiEditRadios
.
filter
(
'
[value=off]
'
).
prop
(
'
checked
'
,
true
);
multiEditRadios
.
filter
(
'
[value=off]
'
).
prop
(
'
checked
'
,
true
);
...
...
app/assets/javascripts/toggle_buttons.js
View file @
70ce1e9e
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 @
70ce1e9e
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
),
},
},
};
};
...
...
ee/app/assets/javascripts/behaviors/shortcuts/shortcuts_epic.js
View file @
70ce1e9e
...
@@ -2,6 +2,7 @@ import $ from 'jquery';
...
@@ -2,6 +2,7 @@ import $ from 'jquery';
import
Mousetrap
from
'
mousetrap
'
;
import
Mousetrap
from
'
mousetrap
'
;
import
Cookies
from
'
js-cookie
'
;
import
Cookies
from
'
js-cookie
'
;
import
ShortcutsIssuable
from
'
~/behaviors/shortcuts/shortcuts_issuable
'
;
import
ShortcutsIssuable
from
'
~/behaviors/shortcuts/shortcuts_issuable
'
;
import
{
parseBoolean
}
from
'
~/lib/utils/common_utils
'
;
export
default
class
ShortcutsEpic
extends
ShortcutsIssuable
{
export
default
class
ShortcutsEpic
extends
ShortcutsIssuable
{
constructor
()
{
constructor
()
{
...
@@ -17,7 +18,7 @@ export default class ShortcutsEpic extends ShortcutsIssuable {
...
@@ -17,7 +18,7 @@ export default class ShortcutsEpic extends ShortcutsIssuable {
}
}
static
openSidebarDropdown
(
$block
)
{
static
openSidebarDropdown
(
$block
)
{
if
(
Cookies
.
get
(
'
collapsed_gutter
'
)
===
'
true
'
)
{
if
(
parseBoolean
(
Cookies
.
get
(
'
collapsed_gutter
'
))
)
{
document
.
dispatchEvent
(
new
Event
(
'
toggleSidebarRevealLabelsDropdown
'
));
document
.
dispatchEvent
(
new
Event
(
'
toggleSidebarRevealLabelsDropdown
'
));
}
else
{
}
else
{
$block
.
find
(
'
.js-sidebar-dropdown-toggle
'
).
trigger
(
'
click
'
);
$block
.
find
(
'
.js-sidebar-dropdown-toggle
'
).
trigger
(
'
click
'
);
...
...
ee/app/assets/javascripts/boards/stores/boards_store_ee.js
View file @
70ce1e9e
...
@@ -5,7 +5,7 @@ import { __ } from '~/locale';
...
@@ -5,7 +5,7 @@ import { __ } from '~/locale';
import
BoardService
from
'
ee/boards/services/board_service
'
;
import
BoardService
from
'
ee/boards/services/board_service
'
;
import
sidebarEventHub
from
'
~/sidebar/event_hub
'
;
import
sidebarEventHub
from
'
~/sidebar/event_hub
'
;
import
createFlash
from
'
~/flash
'
;
import
createFlash
from
'
~/flash
'
;
import
{
convertPermissionTo
Boolean
}
from
'
~/lib/utils/common_utils
'
;
import
{
parse
Boolean
}
from
'
~/lib/utils/common_utils
'
;
class
BoardsStoreEE
{
class
BoardsStoreEE
{
initEESpecific
(
boardsStore
)
{
initEESpecific
(
boardsStore
)
{
...
@@ -30,7 +30,7 @@ class BoardsStoreEE {
...
@@ -30,7 +30,7 @@ class BoardsStoreEE {
weight
:
parseInt
(
this
.
$boardApp
.
dataset
.
boardWeight
,
10
),
weight
:
parseInt
(
this
.
$boardApp
.
dataset
.
boardWeight
,
10
),
};
};
this
.
store
.
cantEdit
=
[];
this
.
store
.
cantEdit
=
[];
this
.
store
.
weightFeatureAvailable
=
convertPermissionTo
Boolean
(
this
.
store
.
weightFeatureAvailable
=
parse
Boolean
(
this
.
$boardApp
.
dataset
.
weightFeatureAvailable
,
this
.
$boardApp
.
dataset
.
weightFeatureAvailable
,
);
);
this
.
initBoardFilters
();
this
.
initBoardFilters
();
...
@@ -137,7 +137,7 @@ class BoardsStoreEE {
...
@@ -137,7 +137,7 @@ class BoardsStoreEE {
}
}
promotionIsHidden
()
{
promotionIsHidden
()
{
return
Cookies
.
get
(
'
promotion_issue_board_hidden
'
)
===
'
true
'
;
return
parseBoolean
(
Cookies
.
get
(
'
promotion_issue_board_hidden
'
))
;
}
}
updateWeight
(
newWeight
,
id
)
{
updateWeight
(
newWeight
,
id
)
{
...
...
ee/app/assets/javascripts/ee_trial_banner/ee_trial_banner.js
View file @
70ce1e9e
import
Cookies
from
'
js-cookie
'
;
import
Cookies
from
'
js-cookie
'
;
import
{
parseBoolean
}
from
'
~/lib/utils/common_utils
'
;
export
default
class
EETrialBanner
{
export
default
class
EETrialBanner
{
constructor
(
$trialBanner
)
{
constructor
(
$trialBanner
)
{
...
@@ -70,7 +71,7 @@ export default class EETrialBanner {
...
@@ -70,7 +71,7 @@ export default class EETrialBanner {
this
.
toggleBanner
(
true
);
this
.
toggleBanner
(
true
);
}
else
{
}
else
{
// Cookie was defined, let's read value and show/hide banner
// Cookie was defined, let's read value and show/hide banner
this
.
toggleBanner
(
Cookies
.
get
(
this
.
COOKIE_KEY
)
===
'
true
'
);
this
.
toggleBanner
(
parseBoolean
(
Cookies
.
get
(
this
.
COOKIE_KEY
))
);
}
}
}
}
...
...
ee/app/assets/javascripts/epics/sidebar/components/sidebar_app.vue
View file @
70ce1e9e
...
@@ -12,6 +12,7 @@ import SidebarTodo from '~/sidebar/components/todo_toggle/todo.vue';
...
@@ -12,6 +12,7 @@ import SidebarTodo from '~/sidebar/components/todo_toggle/todo.vue';
import
SidebarCollapsedGroupedDatePicker
from
'
~/vue_shared/components/sidebar/collapsed_grouped_date_picker.vue
'
;
import
SidebarCollapsedGroupedDatePicker
from
'
~/vue_shared/components/sidebar/collapsed_grouped_date_picker.vue
'
;
import
ToggleSidebar
from
'
~/vue_shared/components/sidebar/toggle_sidebar.vue
'
;
import
ToggleSidebar
from
'
~/vue_shared/components/sidebar/toggle_sidebar.vue
'
;
import
SidebarLabelsSelect
from
'
~/vue_shared/components/sidebar/labels_select/base.vue
'
;
import
SidebarLabelsSelect
from
'
~/vue_shared/components/sidebar/labels_select/base.vue
'
;
import
{
parseBoolean
}
from
'
~/lib/utils/common_utils
'
;
import
eventHub
from
'
../../event_hub
'
;
import
eventHub
from
'
../../event_hub
'
;
import
SidebarDatePicker
from
'
./sidebar_date_picker.vue
'
;
import
SidebarDatePicker
from
'
./sidebar_date_picker.vue
'
;
import
SidebarParticipants
from
'
./sidebar_participants.vue
'
;
import
SidebarParticipants
from
'
./sidebar_participants.vue
'
;
...
@@ -167,7 +168,7 @@ export default {
...
@@ -167,7 +168,7 @@ export default {
return
{
return
{
store
,
store
,
// Backend will pass the appropriate css class for the contentContainer
// Backend will pass the appropriate css class for the contentContainer
collapsed
:
Cookies
.
get
(
'
collapsed_gutter
'
)
===
'
true
'
,
collapsed
:
parseBoolean
(
Cookies
.
get
(
'
collapsed_gutter
'
))
,
isUserSignedIn
:
!!
gon
.
current_user_id
,
isUserSignedIn
:
!!
gon
.
current_user_id
,
autoExpanded
:
false
,
autoExpanded
:
false
,
savingStartDate
:
false
,
savingStartDate
:
false
,
...
...
ee/app/assets/javascripts/geo_nodes/index.js
View file @
70ce1e9e
import
Vue
from
'
vue
'
;
import
Vue
from
'
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
'
;
import
GeoNodesStore
from
'
./store/geo_nodes_store
'
;
import
GeoNodesStore
from
'
./store/geo_nodes_store
'
;
import
GeoNodesService
from
'
./service/geo_nodes_service
'
;
import
GeoNodesService
from
'
./service/geo_nodes_service
'
;
...
@@ -24,8 +24,8 @@ export default () => {
...
@@ -24,8 +24,8 @@ export default () => {
},
},
data
()
{
data
()
{
const
{
dataset
}
=
this
.
$options
.
el
;
const
{
dataset
}
=
this
.
$options
.
el
;
const
nodeActionsAllowed
=
convertPermissionTo
Boolean
(
dataset
.
nodeActionsAllowed
);
const
nodeActionsAllowed
=
parse
Boolean
(
dataset
.
nodeActionsAllowed
);
const
nodeEditAllowed
=
convertPermissionTo
Boolean
(
dataset
.
nodeEditAllowed
);
const
nodeEditAllowed
=
parse
Boolean
(
dataset
.
nodeEditAllowed
);
const
store
=
new
GeoNodesStore
(
dataset
.
primaryVersion
,
dataset
.
primaryRevision
);
const
store
=
new
GeoNodesStore
(
dataset
.
primaryVersion
,
dataset
.
primaryRevision
);
const
service
=
new
GeoNodesService
();
const
service
=
new
GeoNodesService
();
...
...
ee/app/assets/javascripts/pages/groups/epics/show/index.js
View file @
70ce1e9e
...
@@ -4,10 +4,11 @@ import initEpicShow from 'ee/epics/epic_show/epic_show_bundle';
...
@@ -4,10 +4,11 @@ import initEpicShow from 'ee/epics/epic_show/epic_show_bundle';
import
ShortcutsEpic
from
'
ee/behaviors/shortcuts/shortcuts_epic
'
;
import
ShortcutsEpic
from
'
ee/behaviors/shortcuts/shortcuts_epic
'
;
import
initEpicApp
from
'
ee/epic/epic_bundle
'
;
import
initEpicApp
from
'
ee/epic/epic_bundle
'
;
import
'
~/notes/index
'
;
import
'
~/notes/index
'
;
import
{
parseBoolean
}
from
'
~/lib/utils/common_utils
'
;
document
.
addEventListener
(
'
DOMContentLoaded
'
,
()
=>
{
document
.
addEventListener
(
'
DOMContentLoaded
'
,
()
=>
{
new
ZenMode
();
// eslint-disable-line no-new
new
ZenMode
();
// eslint-disable-line no-new
if
(
Cookies
.
get
(
'
load_new_epic_app
'
)
===
'
true
'
)
{
if
(
parseBoolean
(
Cookies
.
get
(
'
load_new_epic_app
'
))
)
{
initEpicApp
();
initEpicApp
();
}
else
{
}
else
{
initEpicShow
();
initEpicShow
();
...
...
ee/app/assets/javascripts/pages/projects/pipelines/show/license_report.js
View file @
70ce1e9e
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
Translate
from
'
~/vue_shared/translate
'
;
import
Translate
from
'
~/vue_shared/translate
'
;
import
LicenseReportApp
from
'
ee/vue_shared/license_management/mr_widget_license_report.vue
'
;
import
LicenseReportApp
from
'
ee/vue_shared/license_management/mr_widget_license_report.vue
'
;
import
{
convertPermissionTo
Boolean
}
from
'
~/lib/utils/common_utils
'
;
import
{
parse
Boolean
}
from
'
~/lib/utils/common_utils
'
;
import
{
updateBadgeCount
}
from
'
./utils
'
;
import
{
updateBadgeCount
}
from
'
./utils
'
;
Vue
.
use
(
Translate
);
Vue
.
use
(
Translate
);
...
@@ -29,7 +29,7 @@ export default () => {
...
@@ -29,7 +29,7 @@ export default () => {
apiUrl
,
apiUrl
,
licenseManagementSettingsPath
,
licenseManagementSettingsPath
,
headPath
:
licenseHeadPath
,
headPath
:
licenseHeadPath
,
canManageLicenses
:
convertPermissionTo
Boolean
(
canManageLicenses
),
canManageLicenses
:
parse
Boolean
(
canManageLicenses
),
alwaysOpen
:
true
,
alwaysOpen
:
true
,
reportSectionClass
:
'
split-report-section
'
,
reportSectionClass
:
'
split-report-section
'
,
},
},
...
...
ee/app/assets/javascripts/pages/projects/pipelines/show/security_report.js
View file @
70ce1e9e
...
@@ -2,7 +2,7 @@ import Vue from 'vue';
...
@@ -2,7 +2,7 @@ import Vue from 'vue';
import
Translate
from
'
~/vue_shared/translate
'
;
import
Translate
from
'
~/vue_shared/translate
'
;
import
SecurityReportApp
from
'
ee/vue_shared/security_reports/split_security_reports_app.vue
'
;
import
SecurityReportApp
from
'
ee/vue_shared/security_reports/split_security_reports_app.vue
'
;
import
createStore
from
'
ee/vue_shared/security_reports/store
'
;
import
createStore
from
'
ee/vue_shared/security_reports/store
'
;
import
{
convertPermissionTo
Boolean
}
from
'
~/lib/utils/common_utils
'
;
import
{
parse
Boolean
}
from
'
~/lib/utils/common_utils
'
;
import
{
updateBadgeCount
}
from
'
./utils
'
;
import
{
updateBadgeCount
}
from
'
./utils
'
;
Vue
.
use
(
Translate
);
Vue
.
use
(
Translate
);
...
@@ -55,8 +55,8 @@ export default () => {
...
@@ -55,8 +55,8 @@ export default () => {
sastContainerHeadPath
,
sastContainerHeadPath
,
dastHelpPath
,
dastHelpPath
,
sastContainerHelpPath
,
sastContainerHelpPath
,
canCreateFeedback
:
convertPermissionTo
Boolean
(
canCreateFeedback
),
canCreateFeedback
:
parse
Boolean
(
canCreateFeedback
),
canCreateIssue
:
convertPermissionTo
Boolean
(
canCreateIssue
),
canCreateIssue
:
parse
Boolean
(
canCreateIssue
),
},
},
on
:
{
on
:
{
updateBadgeCount
:
count
=>
{
updateBadgeCount
:
count
=>
{
...
...
ee/app/assets/javascripts/pages/projects/security/dashboard/show/index.js
View file @
70ce1e9e
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
createStore
from
'
ee/vue_shared/security_reports/store
'
;
import
createStore
from
'
ee/vue_shared/security_reports/store
'
;
import
SecurityReportApp
from
'
ee/vue_shared/security_reports/card_security_reports_app.vue
'
;
import
SecurityReportApp
from
'
ee/vue_shared/security_reports/card_security_reports_app.vue
'
;
import
{
parseBoolean
}
from
'
~/lib/utils/common_utils
'
;
document
.
addEventListener
(
'
DOMContentLoaded
'
,
()
=>
{
document
.
addEventListener
(
'
DOMContentLoaded
'
,
()
=>
{
const
securityTab
=
document
.
getElementById
(
'
js-security-report-app
'
);
const
securityTab
=
document
.
getElementById
(
'
js-security-report-app
'
);
...
@@ -37,9 +38,9 @@ document.addEventListener('DOMContentLoaded', () => {
...
@@ -37,9 +38,9 @@ document.addEventListener('DOMContentLoaded', () => {
return
createElement
(
'
security-report-app
'
,
{
return
createElement
(
'
security-report-app
'
,
{
props
:
{
props
:
{
pipelineId
:
parsedPipelineId
,
pipelineId
:
parsedPipelineId
,
hasPipelineData
:
hasPipelineData
===
'
true
'
,
hasPipelineData
:
parseBoolean
(
hasPipelineData
)
,
canCreateIssue
:
canCreateIssue
===
'
true
'
,
canCreateIssue
:
parseBoolean
(
canCreateIssue
)
,
canCreateFeedback
:
canCreateFeedback
===
'
true
'
,
canCreateFeedback
:
parseBoolean
(
canCreateFeedback
)
,
triggeredBy
:
{
triggeredBy
:
{
avatarPath
:
userAvatarPath
,
avatarPath
:
userAvatarPath
,
name
:
userName
,
name
:
userName
,
...
...
ee/app/assets/javascripts/pages/projects/tree/show/index.js
View file @
70ce1e9e
import
'
~/pages/projects/tree/show/index
'
;
import
'
~/pages/projects/tree/show/index
'
;
import
{
parseBoolean
}
from
'
~/lib/utils/common_utils
'
;
import
initPathLocks
from
'
ee/path_locks
'
;
import
initPathLocks
from
'
ee/path_locks
'
;
document
.
addEventListener
(
'
DOMContentLoaded
'
,
()
=>
{
document
.
addEventListener
(
'
DOMContentLoaded
'
,
()
=>
{
if
(
document
.
querySelector
(
'
.js-tree-content
'
).
dataset
.
pathLocksAvailable
===
'
true
'
)
{
if
(
parseBoolean
(
document
.
querySelector
(
'
.js-tree-content
'
).
dataset
.
pathLocksAvailable
)
)
{
initPathLocks
(
initPathLocks
(
document
.
querySelector
(
'
.js-tree-content
'
).
dataset
.
pathLocksToggle
,
document
.
querySelector
(
'
.js-tree-content
'
).
dataset
.
pathLocksToggle
,
document
.
querySelector
(
'
.js-tree-content
'
).
dataset
.
pathLocksPath
,
document
.
querySelector
(
'
.js-tree-content
'
).
dataset
.
pathLocksPath
,
...
...
ee/app/assets/javascripts/projects/settings_service_desk/index.js
View file @
70ce1e9e
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
serviceDeskRoot
from
'
./components/service_desk_root.vue
'
;
import
serviceDeskRoot
from
'
./components/service_desk_root.vue
'
;
export
default
()
=>
{
export
default
()
=>
{
...
@@ -14,7 +14,7 @@ export default () => {
...
@@ -14,7 +14,7 @@ export default () => {
data
()
{
data
()
{
const
{
dataset
}
=
serviceDeskRootElement
;
const
{
dataset
}
=
serviceDeskRootElement
;
return
{
return
{
initialIsEnabled
:
convertPermissionTo
Boolean
(
dataset
.
enabled
),
initialIsEnabled
:
parse
Boolean
(
dataset
.
enabled
),
endpoint
:
dataset
.
endpoint
,
endpoint
:
dataset
.
endpoint
,
incomingEmail
:
dataset
.
incomingEmail
,
incomingEmail
:
dataset
.
incomingEmail
,
};
};
...
...
ee/app/assets/javascripts/related_issues/index.js
View file @
70ce1e9e
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
RelatedIssuesRoot
from
'
./components/related_issues_root.vue
'
;
import
RelatedIssuesRoot
from
'
./components/related_issues_root.vue
'
;
export
default
function
initRelatedIssues
()
{
export
default
function
initRelatedIssues
()
{
...
@@ -15,9 +15,7 @@ export default function initRelatedIssues() {
...
@@ -15,9 +15,7 @@ export default function initRelatedIssues() {
createElement
(
'
related-issues-root
'
,
{
createElement
(
'
related-issues-root
'
,
{
props
:
{
props
:
{
endpoint
:
relatedIssuesRootElement
.
dataset
.
endpoint
,
endpoint
:
relatedIssuesRootElement
.
dataset
.
endpoint
,
canAdmin
:
convertPermissionToBoolean
(
canAdmin
:
parseBoolean
(
relatedIssuesRootElement
.
dataset
.
canAddRelatedIssues
),
relatedIssuesRootElement
.
dataset
.
canAddRelatedIssues
,
),
helpPath
:
relatedIssuesRootElement
.
dataset
.
helpPath
,
helpPath
:
relatedIssuesRootElement
.
dataset
.
helpPath
,
},
},
}),
}),
...
...
ee/app/assets/javascripts/roadmap/index.js
View file @
70ce1e9e
...
@@ -2,7 +2,7 @@ import Vue from 'vue';
...
@@ -2,7 +2,7 @@ import Vue from '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
'
;
import
{
visitUrl
,
mergeUrlParams
}
from
'
~/lib/utils/url_utility
'
;
import
{
visitUrl
,
mergeUrlParams
}
from
'
~/lib/utils/url_utility
'
;
import
{
PRESET_TYPES
}
from
'
./constants
'
;
import
{
PRESET_TYPES
}
from
'
./constants
'
;
...
@@ -42,7 +42,7 @@ export default () => {
...
@@ -42,7 +42,7 @@ export default () => {
data
()
{
data
()
{
const
supportedPresetTypes
=
Object
.
keys
(
PRESET_TYPES
);
const
supportedPresetTypes
=
Object
.
keys
(
PRESET_TYPES
);
const
{
dataset
}
=
this
.
$options
.
el
;
const
{
dataset
}
=
this
.
$options
.
el
;
const
hasFiltersApplied
=
convertPermissionTo
Boolean
(
dataset
.
hasFiltersApplied
);
const
hasFiltersApplied
=
parse
Boolean
(
dataset
.
hasFiltersApplied
);
const
presetType
=
const
presetType
=
supportedPresetTypes
.
indexOf
(
dataset
.
presetType
)
>
-
1
supportedPresetTypes
.
indexOf
(
dataset
.
presetType
)
>
-
1
?
dataset
.
presetType
?
dataset
.
presetType
...
...
spec/javascripts/lib/utils/common_utils_spec.js
View file @
70ce1e9e
...
@@ -346,6 +346,24 @@ describe('common_utils', () => {
...
@@ -346,6 +346,24 @@ describe('common_utils', () => {
});
});
});
});
describe
(
'
parseBoolean
'
,
()
=>
{
it
(
'
returns true for "true"
'
,
()
=>
{
expect
(
commonUtils
.
parseBoolean
(
'
true
'
)).
toEqual
(
true
);
});
it
(
'
returns false for "false"
'
,
()
=>
{
expect
(
commonUtils
.
parseBoolean
(
'
false
'
)).
toEqual
(
false
);
});
it
(
'
returns false for "something"
'
,
()
=>
{
expect
(
commonUtils
.
parseBoolean
(
'
something
'
)).
toEqual
(
false
);
});
it
(
'
returns false for null
'
,
()
=>
{
expect
(
commonUtils
.
parseBoolean
(
null
)).
toEqual
(
false
);
});
});
describe
(
'
convertPermissionToBoolean
'
,
()
=>
{
describe
(
'
convertPermissionToBoolean
'
,
()
=>
{
it
(
'
should convert a boolean in a string to a boolean
'
,
()
=>
{
it
(
'
should convert a boolean in a string to a boolean
'
,
()
=>
{
expect
(
commonUtils
.
convertPermissionToBoolean
(
'
true
'
)).
toEqual
(
true
);
expect
(
commonUtils
.
convertPermissionToBoolean
(
'
true
'
)).
toEqual
(
true
);
...
...
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