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
d17cda1c
Commit
d17cda1c
authored
Jan 16, 2018
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
EE port of merge-request-target-branch-perf
parent
dd58b194
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
57 additions
and
9 deletions
+57
-9
app/assets/javascripts/dispatcher.js
app/assets/javascripts/dispatcher.js
+0
-2
app/assets/javascripts/issuable/auto_width_dropdown_select.js
...assets/javascripts/issuable/auto_width_dropdown_select.js
+9
-3
app/assets/javascripts/issuable_form.js
app/assets/javascripts/issuable_form.js
+40
-0
app/views/projects/merge_requests/creations/_new_submit.html.haml
...s/projects/merge_requests/creations/_new_submit.html.haml
+1
-1
app/views/shared/issuable/form/_branch_chooser.html.haml
app/views/shared/issuable/form/_branch_chooser.html.haml
+2
-3
changelogs/unreleased/merge-request-target-branch-perf.yml
changelogs/unreleased/merge-request-target-branch-perf.yml
+5
-0
No files found.
app/assets/javascripts/dispatcher.js
View file @
d17cda1c
...
...
@@ -31,7 +31,6 @@ import MiniPipelineGraph from './mini_pipeline_graph_dropdown';
import
UserCallout
from
'
./user_callout
'
;
import
ShortcutsWiki
from
'
./shortcuts_wiki
'
;
import
BlobViewer
from
'
./blob/viewer/index
'
;
import
AutoWidthDropdownSelect
from
'
./issuable/auto_width_dropdown_select
'
;
import
UsersSelect
from
'
./users_select
'
;
import
GfmAutoComplete
from
'
./gfm_auto_complete
'
;
import
Star
from
'
./star
'
;
...
...
@@ -289,7 +288,6 @@ import initLDAPGroupsSelect from 'ee/ldap_groups_select'; // eslint-disable-line
new
LabelsSelect
();
new
MilestoneSelect
();
new
IssuableTemplateSelectors
();
new
AutoWidthDropdownSelect
(
$
(
'
.js-target-branch-select
'
)).
init
();
initApprovals
();
break
;
...
...
app/assets/javascripts/issuable/auto_width_dropdown_select.js
View file @
d17cda1c
...
...
@@ -11,6 +11,14 @@ class AutoWidthDropdownSelect {
const
dropdownClass
=
this
.
dropdownClass
;
this
.
$selectElement
.
select2
({
dropdownCssClass
:
dropdownClass
,
...
AutoWidthDropdownSelect
.
selectOptions
(
this
.
dropdownClass
),
});
return
this
;
}
static
selectOptions
(
dropdownClass
)
{
return
{
dropdownCss
()
{
let
resultantWidth
=
'
auto
'
;
const
$dropdown
=
$
(
`.
${
dropdownClass
}
`
);
...
...
@@ -29,9 +37,7 @@ class AutoWidthDropdownSelect {
maxWidth
:
offsetParentWidth
,
};
},
});
return
this
;
};
}
}
...
...
app/assets/javascripts/issuable_form.js
View file @
d17cda1c
...
...
@@ -6,6 +6,7 @@ import Autosave from './autosave';
import
UsersSelect
from
'
./users_select
'
;
import
GfmAutoComplete
from
'
./gfm_auto_complete
'
;
import
ZenMode
from
'
./zen_mode
'
;
import
AutoWidthDropdownSelect
from
'
./issuable/auto_width_dropdown_select
'
;
import
{
parsePikadayDate
,
pikadayToString
}
from
'
./lib/utils/datefix
'
;
import
groupsSelect
from
'
./groups_select
'
;
...
...
@@ -48,6 +49,12 @@ export default class IssuableForm {
});
calendar
.
setDate
(
parsePikadayDate
(
$issuableDueDate
.
val
()));
}
this
.
$targetBranchSelect
=
$
(
'
.js-target-branch-select
'
,
this
.
form
);
if
(
this
.
$targetBranchSelect
.
length
)
{
this
.
initTargetBranchDropdown
();
}
}
initAutosave
()
{
...
...
@@ -106,4 +113,37 @@ export default class IssuableForm {
addWip
()
{
this
.
titleField
.
val
(
`WIP:
${(
this
.
titleField
.
val
())}
`
);
}
initTargetBranchDropdown
()
{
this
.
$targetBranchSelect
.
select2
({
...
AutoWidthDropdownSelect
.
selectOptions
(
'
js-target-branch-select
'
),
ajax
:
{
url
:
this
.
$targetBranchSelect
.
data
(
'
endpoint
'
),
dataType
:
'
JSON
'
,
quietMillis
:
250
,
data
(
search
)
{
return
{
search
,
};
},
results
(
data
)
{
return
{
// `data` keys are translated so we can't just access them with a string based key
results
:
data
[
Object
.
keys
(
data
)[
0
]].
map
(
name
=>
({
id
:
name
,
text
:
name
,
})),
};
},
},
initSelection
(
el
,
callback
)
{
const
val
=
el
.
val
();
callback
({
id
:
val
,
text
:
val
,
});
},
});
}
}
app/views/projects/merge_requests/creations/_new_submit.html.haml
View file @
d17cda1c
...
...
@@ -15,7 +15,7 @@
=
f
.
hidden_field
:source_project_id
=
f
.
hidden_field
:source_branch
=
f
.
hidden_field
:target_project_id
=
f
.
hidden_field
:target_branch
=
f
.
hidden_field
:target_branch
,
id:
''
.mr-compare.merge-request.js-merge-request-new-submit
{
'data-mr-submit-action'
:
"#{j params[:tab].presence || 'new'}"
}
-
if
@commits
.
empty?
...
...
app/views/shared/issuable/form/_branch_chooser.html.haml
View file @
d17cda1c
...
...
@@ -15,11 +15,10 @@
=
form
.
label
:target_branch
,
class:
'control-label'
.col-sm-10.target-branch-select-dropdown-container
.issuable-form-select-holder
=
form
.
select
(
:target_branch
,
issuable
.
target_branches
,
{
include_blank:
true
},
=
form
.
hidden_field
(
:target_branch
,
{
class:
'target_branch js-target-branch-select ref-name'
,
disabled:
issuable
.
new_record?
,
data:
{
placeholder:
"Select branch"
}})
data:
{
placeholder:
"Select branch"
,
endpoint:
refs_project_path
(
@project
,
sort:
'updated_desc'
,
find:
'branches'
)
}})
-
if
issuable
.
new_record?
=
link_to
'Change branches'
,
mr_change_branches_path
(
issuable
)
changelogs/unreleased/merge-request-target-branch-perf.yml
0 → 100644
View file @
d17cda1c
---
title
:
Improve performance of target branch dropdown
merge_request
:
author
:
type
:
performance
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