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
316d85c8
Commit
316d85c8
authored
Jul 14, 2020
by
Lukas Eipert
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Migrate away from gl.utils
This moves most remaining usages from gl.utils over to direct imports
parent
1e00a38d
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
21 additions
and
49 deletions
+21
-49
app/assets/javascripts/behaviors/markdown/copy_as_gfm.js
app/assets/javascripts/behaviors/markdown/copy_as_gfm.js
+2
-2
app/assets/javascripts/blob_edit/blob_bundle.js
app/assets/javascripts/blob_edit/blob_bundle.js
+2
-5
app/assets/javascripts/gl_form.js
app/assets/javascripts/gl_form.js
+2
-1
app/assets/javascripts/lib/utils/common_utils.js
app/assets/javascripts/lib/utils/common_utils.js
+0
-29
app/assets/javascripts/lib/utils/datetime_utility.js
app/assets/javascripts/lib/utils/datetime_utility.js
+0
-1
app/assets/javascripts/members.js
app/assets/javascripts/members.js
+2
-1
app/assets/javascripts/sidebar/mount_sidebar.js
app/assets/javascripts/sidebar/mount_sidebar.js
+3
-2
app/assets/javascripts/vue_shared/components/pagination/table_pagination.vue
...pts/vue_shared/components/pagination/table_pagination.vue
+1
-1
ee/app/assets/javascripts/add_gitlab_slack_application/components/add_gitlab_slack_application.vue
...k_application/components/add_gitlab_slack_application.vue
+3
-2
spec/frontend/behaviors/copy_as_gfm_spec.js
spec/frontend/behaviors/copy_as_gfm_spec.js
+3
-2
spec/frontend/behaviors/shortcuts/shortcuts_issuable_spec.js
spec/frontend/behaviors/shortcuts/shortcuts_issuable_spec.js
+1
-1
spec/frontend/filtered_search/filtered_search_manager_spec.js
.../frontend/filtered_search/filtered_search_manager_spec.js
+2
-2
No files found.
app/assets/javascripts/behaviors/markdown/copy_as_gfm.js
View file @
316d85c8
import
$
from
'
jquery
'
;
import
{
getSelectedFragment
}
from
'
~/lib/utils/common_utils
'
;
import
{
getSelectedFragment
,
insertText
}
from
'
~/lib/utils/common_utils
'
;
export
class
CopyAsGFM
{
constructor
()
{
...
...
@@ -79,7 +79,7 @@ export class CopyAsGFM {
}
static
insertPastedText
(
target
,
text
,
gfm
)
{
window
.
gl
.
utils
.
insertText
(
target
,
textBefore
=>
{
insertText
(
target
,
textBefore
=>
{
// If the text before the cursor contains an odd number of backticks,
// we are either inside an inline code span that starts with 1 backtick
// or a code block that starts with 3 backticks.
...
...
app/assets/javascripts/blob_edit/blob_bundle.js
View file @
316d85c8
...
...
@@ -5,7 +5,7 @@ import NewCommitForm from '../new_commit_form';
import
EditBlob
from
'
./edit_blob
'
;
import
BlobFileDropzone
from
'
../blob/blob_file_dropzone
'
;
import
initPopover
from
'
~/blob/suggest_gitlab_ci_yml
'
;
import
{
setCookie
}
from
'
~/lib/utils/common_utils
'
;
import
{
disableButtonIfEmptyField
,
setCookie
}
from
'
~/lib/utils/common_utils
'
;
import
Tracking
from
'
~/tracking
'
;
export
default
()
=>
{
...
...
@@ -51,10 +51,7 @@ export default () => {
new
BlobFileDropzone
(
uploadBlobForm
,
method
);
new
NewCommitForm
(
uploadBlobForm
);
window
.
gl
.
utils
.
disableButtonIfEmptyField
(
uploadBlobForm
.
find
(
'
.js-commit-message
'
),
'
.btn-upload-file
'
,
);
disableButtonIfEmptyField
(
uploadBlobForm
.
find
(
'
.js-commit-message
'
),
'
.btn-upload-file
'
);
}
if
(
deleteBlobForm
.
length
)
{
...
...
app/assets/javascripts/gl_form.js
View file @
316d85c8
...
...
@@ -3,6 +3,7 @@ import autosize from 'autosize';
import
GfmAutoComplete
,
{
defaultAutocompleteConfig
}
from
'
ee_else_ce/gfm_auto_complete
'
;
import
dropzoneInput
from
'
./dropzone_input
'
;
import
{
addMarkdownListeners
,
removeMarkdownListeners
}
from
'
./lib/utils/text_markdown
'
;
import
{
disableButtonIfEmptyField
}
from
'
~/lib/utils/common_utils
'
;
export
default
class
GLForm
{
constructor
(
form
,
enableGFM
=
{})
{
...
...
@@ -45,7 +46,7 @@ export default class GLForm {
this
.
form
.
find
(
'
.div-dropzone
'
).
remove
();
this
.
form
.
addClass
(
'
gfm-form
'
);
// remove notify commit author checkbox for non-commit notes
gl
.
utils
.
disableButtonIfEmptyField
(
disableButtonIfEmptyField
(
this
.
form
.
find
(
'
.js-note-text
'
),
this
.
form
.
find
(
'
.js-comment-button, .js-note-new-discussion
'
),
);
...
...
app/assets/javascripts/lib/utils/common_utils.js
View file @
316d85c8
...
...
@@ -888,35 +888,6 @@ export const searchBy = (query = '', searchSpace = {}) => {
*/
export
const
isScopedLabel
=
({
title
=
''
})
=>
title
.
indexOf
(
'
::
'
)
!==
-
1
;
window
.
gl
=
window
.
gl
||
{};
window
.
gl
.
utils
=
{
...(
window
.
gl
.
utils
||
{}),
getPagePath
,
isInGroupsPage
,
isInProjectPage
,
getProjectSlug
,
getGroupSlug
,
isInIssuePage
,
ajaxGet
,
rstrip
,
updateTooltipTitle
,
disableButtonIfEmptyField
,
handleLocationHash
,
isInViewport
,
parseUrl
,
parseUrlPathname
,
getUrlParamsArray
,
isMetaKey
,
isMetaClick
,
scrollToElement
,
getParameterByName
,
getSelectedFragment
,
insertText
,
nodeMatchesSelector
,
spriteIcon
,
imagePath
,
};
// Methods to set and get Cookie
export
const
setCookie
=
(
name
,
value
)
=>
Cookies
.
set
(
name
,
value
,
{
expires
:
365
});
...
...
app/assets/javascripts/lib/utils/datetime_utility.js
View file @
316d85c8
...
...
@@ -427,7 +427,6 @@ export const dayInQuarter = (date, quarter) => {
window
.
gl
=
window
.
gl
||
{};
window
.
gl
.
utils
=
{
...(
window
.
gl
.
utils
||
{}),
getTimeago
,
localTimeAgo
,
};
...
...
app/assets/javascripts/members.js
View file @
316d85c8
import
$
from
'
jquery
'
;
import
{
disableButtonIfEmptyField
}
from
'
~/lib/utils/common_utils
'
;
export
default
class
Members
{
constructor
()
{
...
...
@@ -13,7 +14,7 @@ export default class Members {
$
(
'
.js-edit-member-form
'
)
.
off
(
'
ajax:success
'
)
.
on
(
'
ajax:success
'
,
this
.
formSuccess
.
bind
(
this
));
gl
.
utils
.
disableButtonIfEmptyField
(
'
#user_ids
'
,
'
input[name=commit]
'
,
'
change
'
);
disableButtonIfEmptyField
(
'
#user_ids
'
,
'
input[name=commit]
'
,
'
change
'
);
}
dropdownClicked
(
options
)
{
...
...
app/assets/javascripts/sidebar/mount_sidebar.js
View file @
316d85c8
...
...
@@ -11,6 +11,7 @@ import sidebarSubscriptions from './components/subscriptions/sidebar_subscriptio
import
Translate
from
'
../vue_shared/translate
'
;
import
createDefaultClient
from
'
~/lib/graphql
'
;
import
{
store
}
from
'
~/notes/stores
'
;
import
{
isInIssuePage
}
from
'
~/lib/utils/common_utils
'
;
Vue
.
use
(
Translate
);
Vue
.
use
(
VueApollo
);
...
...
@@ -43,7 +44,7 @@ function mountAssigneesComponent(mediator) {
projectPath
:
fullPath
,
field
:
el
.
dataset
.
field
,
signedIn
:
el
.
hasAttribute
(
'
data-signed-in
'
),
issuableType
:
gl
.
utils
.
isInIssuePage
()
?
'
issue
'
:
'
merge_request
'
,
issuableType
:
isInIssuePage
()
?
'
issue
'
:
'
merge_request
'
,
},
}),
});
...
...
@@ -93,7 +94,7 @@ function mountLockComponent(mediator) {
isLocked
:
initialData
.
is_locked
,
isEditable
:
initialData
.
is_editable
,
mediator
,
issuableType
:
gl
.
utils
.
isInIssuePage
()
?
'
issue
'
:
'
merge_request
'
,
issuableType
:
isInIssuePage
()
?
'
issue
'
:
'
merge_request
'
,
},
}).
$mount
(
el
);
}
...
...
app/assets/javascripts/vue_shared/components/pagination/table_pagination.vue
View file @
316d85c8
...
...
@@ -20,7 +20,7 @@ export default {
Here is an example `change` method:
change(pagenum) {
gl.utils.
visitUrl(`?page=${pagenum}`);
visitUrl(`?page=${pagenum}`);
},
*/
change
:
{
...
...
ee/app/assets/javascripts/add_gitlab_slack_application/components/add_gitlab_slack_application.vue
View file @
316d85c8
...
...
@@ -3,6 +3,7 @@
import
{
__
}
from
'
~/locale
'
;
import
Flash
from
'
~/flash
'
;
import
{
redirectTo
}
from
'
~/lib/utils/url_utility
'
;
import
{
spriteIcon
}
from
'
~/lib/utils/common_utils
'
;
import
GitlabSlackService
from
'
../services/gitlab_slack_service
'
;
...
...
@@ -59,11 +60,11 @@ export default {
computed
:
{
doubleHeadedArrowSvg
()
{
return
gl
.
utils
.
spriteIcon
(
'
double-headed-arrow
'
);
return
spriteIcon
(
'
double-headed-arrow
'
);
},
arrowRightSvg
()
{
return
gl
.
utils
.
spriteIcon
(
'
arrow-right
'
);
return
spriteIcon
(
'
arrow-right
'
);
},
hasProjects
()
{
...
...
spec/frontend/behaviors/copy_as_gfm_spec.js
View file @
316d85c8
import
*
as
commonUtils
from
'
~/lib/utils/common_utils
'
;
import
initCopyAsGFM
,
{
CopyAsGFM
}
from
'
~/behaviors/markdown/copy_as_gfm
'
;
describe
(
'
CopyAsGFM
'
,
()
=>
{
...
...
@@ -27,7 +28,7 @@ describe('CopyAsGFM', () => {
}
it
(
'
wraps pasted code when not already in code tags
'
,
()
=>
{
jest
.
spyOn
(
window
.
gl
.
u
tils
,
'
insertText
'
).
mockImplementation
((
el
,
textFunc
)
=>
{
jest
.
spyOn
(
commonU
tils
,
'
insertText
'
).
mockImplementation
((
el
,
textFunc
)
=>
{
const
insertedText
=
textFunc
(
'
This is code:
'
,
''
);
expect
(
insertedText
).
toEqual
(
'
`code`
'
);
...
...
@@ -37,7 +38,7 @@ describe('CopyAsGFM', () => {
});
it
(
'
does not wrap pasted code when already in code tags
'
,
()
=>
{
jest
.
spyOn
(
window
.
gl
.
u
tils
,
'
insertText
'
).
mockImplementation
((
el
,
textFunc
)
=>
{
jest
.
spyOn
(
commonU
tils
,
'
insertText
'
).
mockImplementation
((
el
,
textFunc
)
=>
{
const
insertedText
=
textFunc
(
'
This is code: `
'
,
'
`
'
);
expect
(
insertedText
).
toEqual
(
'
code
'
);
...
...
spec/frontend/behaviors/shortcuts/shortcuts_issuable_spec.js
View file @
316d85c8
...
...
@@ -46,7 +46,7 @@ describe('ShortcutsIssuable', () => {
});
describe
(
'
replyWithSelectedText
'
,
()
=>
{
// Stub
window.gl.utils.
getSelectedFragment to return a node with the provided HTML.
// Stub getSelectedFragment to return a node with the provided HTML.
const
stubSelection
=
(
html
,
invalidNode
)
=>
{
getSelectedFragment
.
mockImplementation
(()
=>
{
const
documentFragment
=
document
.
createDocumentFragment
();
...
...
spec/frontend/filtered_search/filtered_search_manager_spec.js
View file @
316d85c8
...
...
@@ -2,7 +2,6 @@ import RecentSearchesService from '~/filtered_search/services/recent_searches_se
import
RecentSearchesServiceError
from
'
~/filtered_search/services/recent_searches_service_error
'
;
import
RecentSearchesRoot
from
'
~/filtered_search/recent_searches_root
'
;
import
IssuableFilteredSearchTokenKeys
from
'
~/filtered_search/issuable_filtered_search_token_keys
'
;
import
'
~/lib/utils/common_utils
'
;
import
DropdownUtils
from
'
~/filtered_search/dropdown_utils
'
;
import
FilteredSearchVisualTokens
from
'
~/filtered_search/filtered_search_visual_tokens
'
;
import
FilteredSearchDropdownManager
from
'
~/filtered_search/filtered_search_dropdown_manager
'
;
...
...
@@ -10,6 +9,7 @@ import FilteredSearchManager from '~/filtered_search/filtered_search_manager';
import
FilteredSearchSpecHelper
from
'
../helpers/filtered_search_spec_helper
'
;
import
{
BACKSPACE_KEY_CODE
,
DELETE_KEY_CODE
}
from
'
~/lib/utils/keycodes
'
;
import
{
visitUrl
}
from
'
~/lib/utils/url_utility
'
;
import
*
as
commonUtils
from
'
~/lib/utils/common_utils
'
;
jest
.
mock
(
'
~/lib/utils/url_utility
'
,
()
=>
({
...
jest
.
requireActual
(
'
~/lib/utils/url_utility
'
),
...
...
@@ -83,7 +83,7 @@ describe('Filtered Search Manager', () => {
jest
.
spyOn
(
FilteredSearchDropdownManager
.
prototype
,
'
updateDropdownOffset
'
)
.
mockImplementation
();
jest
.
spyOn
(
gl
.
u
tils
,
'
getParameterByName
'
).
mockReturnValue
(
null
);
jest
.
spyOn
(
commonU
tils
,
'
getParameterByName
'
).
mockReturnValue
(
null
);
jest
.
spyOn
(
FilteredSearchVisualTokens
,
'
unselectTokens
'
);
input
=
document
.
querySelector
(
'
.filtered-search
'
);
...
...
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