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
25ffe5ac
Commit
25ffe5ac
authored
Feb 15, 2021
by
Paul Slaughter
Committed by
Jose Vargas
Feb 16, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move max MR files to open count to constant
- Previously this was just a magic number - Now its encapsulated
parent
25d9884f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
6 deletions
+12
-6
app/assets/javascripts/ide/constants.js
app/assets/javascripts/ide/constants.js
+4
-0
app/assets/javascripts/ide/stores/actions/merge_request.js
app/assets/javascripts/ide/stores/actions/merge_request.js
+4
-2
spec/frontend/ide/stores/actions/merge_request_spec.js
spec/frontend/ide/stores/actions/merge_request_spec.js
+3
-3
spec/frontend_integration/ide/user_opens_mr_spec.js
spec/frontend_integration/ide/user_opens_mr_spec.js
+1
-1
No files found.
app/assets/javascripts/ide/constants.js
View file @
25ffe5ac
...
@@ -107,3 +107,7 @@ export const SIDE_RIGHT = 'right';
...
@@ -107,3 +107,7 @@ export const SIDE_RIGHT = 'right';
// Live Preview feature
// Live Preview feature
export
const
LIVE_PREVIEW_DEBOUNCE
=
2000
;
export
const
LIVE_PREVIEW_DEBOUNCE
=
2000
;
// This is the maximum number of files to auto open when opening the Web IDE
// from a Merge Request
export
const
MAX_MR_FILES_AUTO_OPEN
=
10
;
app/assets/javascripts/ide/stores/actions/merge_request.js
View file @
25ffe5ac
import
{
deprecatedCreateFlash
as
flash
}
from
'
~/flash
'
;
import
{
deprecatedCreateFlash
as
flash
}
from
'
~/flash
'
;
import
{
__
}
from
'
~/locale
'
;
import
{
__
}
from
'
~/locale
'
;
import
{
leftSidebarViews
,
PERMISSION_READ_MR
}
from
'
../../constants
'
;
import
{
leftSidebarViews
,
PERMISSION_READ_MR
,
MAX_MR_FILES_AUTO_OPEN
}
from
'
../../constants
'
;
import
service
from
'
../../services
'
;
import
service
from
'
../../services
'
;
import
*
as
types
from
'
../mutation_types
'
;
import
*
as
types
from
'
../mutation_types
'
;
...
@@ -152,7 +152,9 @@ export const openMergeRequestChanges = async ({ dispatch, getters, state, commit
...
@@ -152,7 +152,9 @@ export const openMergeRequestChanges = async ({ dispatch, getters, state, commit
.
map
((
change
)
=>
({
entry
:
state
.
entries
[
change
.
new_path
],
change
}))
.
map
((
change
)
=>
({
entry
:
state
.
entries
[
change
.
new_path
],
change
}))
.
filter
((
x
)
=>
x
.
entry
);
.
filter
((
x
)
=>
x
.
entry
);
const
pathsToOpen
=
entryChanges
.
slice
(
0
,
10
).
map
(({
change
})
=>
change
.
new_path
);
const
pathsToOpen
=
entryChanges
.
slice
(
0
,
MAX_MR_FILES_AUTO_OPEN
)
.
map
(({
change
})
=>
change
.
new_path
);
// If there are no changes with entries, do nothing.
// If there are no changes with entries, do nothing.
if
(
!
entryChanges
.
length
)
{
if
(
!
entryChanges
.
length
)
{
...
...
spec/frontend/ide/stores/actions/merge_request_spec.js
View file @
25ffe5ac
import
MockAdapter
from
'
axios-mock-adapter
'
;
import
MockAdapter
from
'
axios-mock-adapter
'
;
import
{
range
}
from
'
lodash
'
;
import
{
range
}
from
'
lodash
'
;
import
testAction
from
'
helpers/vuex_action_helper
'
;
import
{
TEST_HOST
}
from
'
helpers/test_constants
'
;
import
{
TEST_HOST
}
from
'
helpers/test_constants
'
;
import
testAction
from
'
helpers/vuex_action_helper
'
;
import
{
deprecatedCreateFlash
as
createFlash
}
from
'
~/flash
'
;
import
{
deprecatedCreateFlash
as
createFlash
}
from
'
~/flash
'
;
import
{
leftSidebarViews
,
PERMISSION_READ_MR
}
from
'
~/ide/constants
'
;
import
{
leftSidebarViews
,
PERMISSION_READ_MR
,
MAX_MR_FILES_AUTO_OPEN
}
from
'
~/ide/constants
'
;
import
service
from
'
~/ide/services
'
;
import
service
from
'
~/ide/services
'
;
import
{
createStore
}
from
'
~/ide/stores
'
;
import
{
createStore
}
from
'
~/ide/stores
'
;
import
{
import
{
...
@@ -395,7 +395,7 @@ describe('IDE store merge request actions', () => {
...
@@ -395,7 +395,7 @@ describe('IDE store merge request actions', () => {
(acc, { path }) => Object.assign(acc, { [path]: path, type: 'blob' }),
(acc, { path }) => Object.assign(acc, { [path]: path, type: 'blob' }),
{},
{},
);
);
const pathsToOpen = changes.slice(0,
10
).map((x) => x.new_path);
const pathsToOpen = changes.slice(0,
MAX_MR_FILES_AUTO_OPEN
).map((x) => x.new_path);
return testAction({
return testAction({
action: openMergeRequestChanges,
action: openMergeRequestChanges,
...
...
spec/frontend_integration/ide/user_opens_mr_spec.js
View file @
25ffe5ac
import
{
basename
}
from
'
path
'
;
import
{
basename
}
from
'
path
'
;
import
{
useOverclockTimers
}
from
'
test_helpers/utils/overclock_timers
'
;
import
{
getMergeRequests
,
getMergeRequestWithChanges
}
from
'
test_helpers/fixtures
'
;
import
{
getMergeRequests
,
getMergeRequestWithChanges
}
from
'
test_helpers/fixtures
'
;
import
{
useOverclockTimers
}
from
'
test_helpers/utils/overclock_timers
'
;
import
*
as
ideHelper
from
'
./helpers/ide_helper
'
;
import
*
as
ideHelper
from
'
./helpers/ide_helper
'
;
import
startWebIDE
from
'
./helpers/start
'
;
import
startWebIDE
from
'
./helpers/start
'
;
...
...
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