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
64c7f99a
Commit
64c7f99a
authored
Dec 01, 2020
by
Thomas Randolph
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Respond to diffs app hub requests to change the fileByFile setting
parent
66e502c6
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
0 deletions
+34
-0
app/assets/javascripts/diffs/components/app.vue
app/assets/javascripts/diffs/components/app.vue
+10
-0
app/assets/javascripts/diffs/constants.js
app/assets/javascripts/diffs/constants.js
+1
-0
spec/frontend/diffs/components/app_spec.js
spec/frontend/diffs/components/app_spec.js
+23
-0
No files found.
app/assets/javascripts/diffs/components/app.vue
View file @
64c7f99a
...
@@ -12,6 +12,8 @@ import { isSingleViewStyle } from '~/helpers/diffs_helper';
...
@@ -12,6 +12,8 @@ import { isSingleViewStyle } from '~/helpers/diffs_helper';
import
{
updateHistory
}
from
'
~/lib/utils/url_utility
'
;
import
{
updateHistory
}
from
'
~/lib/utils/url_utility
'
;
import
notesEventHub
from
'
../../notes/event_hub
'
;
import
notesEventHub
from
'
../../notes/event_hub
'
;
import
eventHub
from
'
../event_hub
'
;
import
CompareVersions
from
'
./compare_versions.vue
'
;
import
CompareVersions
from
'
./compare_versions.vue
'
;
import
DiffFile
from
'
./diff_file.vue
'
;
import
DiffFile
from
'
./diff_file.vue
'
;
import
NoChanges
from
'
./no_changes.vue
'
;
import
NoChanges
from
'
./no_changes.vue
'
;
...
@@ -36,6 +38,7 @@ import {
...
@@ -36,6 +38,7 @@ import {
ALERT_OVERFLOW_HIDDEN
,
ALERT_OVERFLOW_HIDDEN
,
ALERT_MERGE_CONFLICT
,
ALERT_MERGE_CONFLICT
,
ALERT_COLLAPSED_FILES
,
ALERT_COLLAPSED_FILES
,
EVT_VIEW_FILE_BY_FILE
,
}
from
'
../constants
'
;
}
from
'
../constants
'
;
export
default
{
export
default
{
...
@@ -283,6 +286,8 @@ export default {
...
@@ -283,6 +286,8 @@ export default {
notesEventHub
.
$once
(
'
fetchDiffData
'
,
this
.
fetchData
);
notesEventHub
.
$once
(
'
fetchDiffData
'
,
this
.
fetchData
);
notesEventHub
.
$on
(
'
refetchDiffData
'
,
this
.
refetchDiffData
);
notesEventHub
.
$on
(
'
refetchDiffData
'
,
this
.
refetchDiffData
);
eventHub
.
$on
(
EVT_VIEW_FILE_BY_FILE
,
this
.
fileByFileListener
);
this
.
CENTERED_LIMITED_CONTAINER_CLASSES
=
CENTERED_LIMITED_CONTAINER_CLASSES
;
this
.
CENTERED_LIMITED_CONTAINER_CLASSES
=
CENTERED_LIMITED_CONTAINER_CLASSES
;
this
.
unwatchDiscussions
=
this
.
$watch
(
this
.
unwatchDiscussions
=
this
.
$watch
(
...
@@ -303,6 +308,7 @@ export default {
...
@@ -303,6 +308,7 @@ export default {
beforeDestroy
()
{
beforeDestroy
()
{
diffsApp
.
deinstrument
();
diffsApp
.
deinstrument
();
eventHub
.
$off
(
EVT_VIEW_FILE_BY_FILE
,
this
.
fileByFileListener
);
notesEventHub
.
$off
(
'
refetchDiffData
'
,
this
.
refetchDiffData
);
notesEventHub
.
$off
(
'
refetchDiffData
'
,
this
.
refetchDiffData
);
notesEventHub
.
$off
(
'
fetchDiffData
'
,
this
.
fetchData
);
notesEventHub
.
$off
(
'
fetchDiffData
'
,
this
.
fetchData
);
...
@@ -323,7 +329,11 @@ export default {
...
@@ -323,7 +329,11 @@ export default {
'
scrollToFile
'
,
'
scrollToFile
'
,
'
setShowTreeList
'
,
'
setShowTreeList
'
,
'
navigateToDiffFileIndex
'
,
'
navigateToDiffFileIndex
'
,
'
setFileByFile
'
,
]),
]),
fileByFileListener
({
setting
}
=
{})
{
this
.
setFileByFile
({
fileByFile
:
setting
});
},
navigateToDiffFileNumber
(
number
)
{
navigateToDiffFileNumber
(
number
)
{
this
.
navigateToDiffFileIndex
(
number
-
1
);
this
.
navigateToDiffFileIndex
(
number
-
1
);
},
},
...
...
app/assets/javascripts/diffs/constants.js
View file @
64c7f99a
...
@@ -103,6 +103,7 @@ export const RENAMED_DIFF_TRANSITIONS = {
...
@@ -103,6 +103,7 @@ export const RENAMED_DIFF_TRANSITIONS = {
// MR Diffs known events
// MR Diffs known events
export
const
EVT_EXPAND_ALL_FILES
=
'
mr:diffs:expandAllFiles
'
;
export
const
EVT_EXPAND_ALL_FILES
=
'
mr:diffs:expandAllFiles
'
;
export
const
EVT_VIEW_FILE_BY_FILE
=
'
mr:diffs:preference:fileByFile
'
;
export
const
EVT_PERF_MARK_FILE_TREE_START
=
'
mr:diffs:perf:fileTreeStart
'
;
export
const
EVT_PERF_MARK_FILE_TREE_START
=
'
mr:diffs:perf:fileTreeStart
'
;
export
const
EVT_PERF_MARK_FILE_TREE_END
=
'
mr:diffs:perf:fileTreeEnd
'
;
export
const
EVT_PERF_MARK_FILE_TREE_END
=
'
mr:diffs:perf:fileTreeEnd
'
;
export
const
EVT_PERF_MARK_DIFF_FILES_START
=
'
mr:diffs:perf:filesStart
'
;
export
const
EVT_PERF_MARK_DIFF_FILES_START
=
'
mr:diffs:perf:filesStart
'
;
...
...
spec/frontend/diffs/components/app_spec.js
View file @
64c7f99a
...
@@ -17,6 +17,10 @@ import axios from '~/lib/utils/axios_utils';
...
@@ -17,6 +17,10 @@ import axios from '~/lib/utils/axios_utils';
import
*
as
urlUtils
from
'
~/lib/utils/url_utility
'
;
import
*
as
urlUtils
from
'
~/lib/utils/url_utility
'
;
import
diffsMockData
from
'
../mock_data/merge_request_diffs
'
;
import
diffsMockData
from
'
../mock_data/merge_request_diffs
'
;
import
{
EVT_VIEW_FILE_BY_FILE
}
from
'
~/diffs/constants
'
;
import
eventHub
from
'
~/diffs/event_hub
'
;
const
mergeRequestDiff
=
{
version_index
:
1
};
const
mergeRequestDiff
=
{
version_index
:
1
};
const
TEST_ENDPOINT
=
`
${
TEST_HOST
}
/diff/endpoint`
;
const
TEST_ENDPOINT
=
`
${
TEST_HOST
}
/diff/endpoint`
;
const
COMMIT_URL
=
`
${
TEST_HOST
}
/COMMIT/OLD`
;
const
COMMIT_URL
=
`
${
TEST_HOST
}
/COMMIT/OLD`
;
...
@@ -773,5 +777,24 @@ describe('diffs/components/app', () => {
...
@@ -773,5 +777,24 @@ describe('diffs/components/app', () => {
},
},
);
);
});
});
describe
(
'
control via event stream
'
,
()
=>
{
it
.
each
`
setting
${
true
}
${
false
}
`
(
'
triggers the action with the new fileByFile setting - $setting - when the event with that setting is received
'
,
async
({
setting
})
=>
{
createComponent
();
await
wrapper
.
vm
.
$nextTick
();
eventHub
.
$emit
(
EVT_VIEW_FILE_BY_FILE
,
{
setting
});
await
wrapper
.
vm
.
$nextTick
();
expect
(
store
.
state
.
diffs
.
viewDiffsFileByFile
).
toBe
(
setting
);
},
);
});
});
});
});
});
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