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
67a6d75d
Commit
67a6d75d
authored
Sep 15, 2020
by
Thomas Randolph
Committed by
Himanshu Kapoor
Sep 17, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add component to warn when some diff files are collapsed
parent
4f028edc
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
111 additions
and
3 deletions
+111
-3
app/assets/javascripts/diffs/components/app.vue
app/assets/javascripts/diffs/components/app.vue
+31
-3
app/assets/javascripts/diffs/components/collapsed_files_warning.vue
.../javascripts/diffs/components/collapsed_files_warning.vue
+71
-0
locale/gitlab.pot
locale/gitlab.pot
+9
-0
No files found.
app/assets/javascripts/diffs/components/app.vue
View file @
67a6d75d
...
...
@@ -18,6 +18,7 @@ import TreeList from './tree_list.vue';
import
HiddenFilesWarning
from
'
./hidden_files_warning.vue
'
;
import
MergeConflictWarning
from
'
./merge_conflict_warning.vue
'
;
import
CollapsedFilesWarning
from
'
./collapsed_files_warning.vue
'
;
import
{
TREE_LIST_WIDTH_STORAGE_KEY
,
...
...
@@ -37,6 +38,7 @@ export default {
NoChanges
,
HiddenFilesWarning
,
MergeConflictWarning
,
CollapsedFilesWarning
,
CommitWidget
,
TreeList
,
GlLoadingIcon
,
...
...
@@ -114,6 +116,7 @@ export default {
return
{
treeWidth
,
diffFilesLength
:
0
,
collapsedWarningDismissed
:
false
,
};
},
computed
:
{
...
...
@@ -142,7 +145,7 @@ export default {
'
canMerge
'
,
'
hasConflicts
'
,
]),
...
mapGetters
(
'
diffs
'
,
[
'
isParallelView
'
,
'
currentDiffIndex
'
]),
...
mapGetters
(
'
diffs
'
,
[
'
hasCollapsedFile
'
,
'
isParallelView
'
,
'
currentDiffIndex
'
]),
...
mapGetters
([
'
isNotesFetched
'
,
'
getNoteableData
'
]),
diffs
()
{
if
(
!
this
.
viewDiffsFileByFile
)
{
...
...
@@ -188,6 +191,23 @@ export default {
return
currentFileNumber
<
diffFiles
.
length
?
currentFileNumber
+
1
:
null
;
},
visibleWarning
()
{
let
visible
=
false
;
if
(
this
.
renderOverflowWarning
)
{
visible
=
'
overflow
'
;
}
else
if
(
this
.
isDiffHead
&&
this
.
hasConflicts
)
{
visible
=
'
merge-conflict
'
;
}
else
if
(
this
.
hasCollapsedFile
&&
!
this
.
collapsedWarningDismissed
&&
!
this
.
viewDiffsFileByFile
)
{
visible
=
'
collapsed
'
;
}
return
visible
;
},
},
watch
:
{
commit
(
newCommit
,
oldCommit
)
{
...
...
@@ -401,6 +421,9 @@ export default {
this
.
toggleShowTreeList
(
false
);
}
},
dismissCollapsedWarning
()
{
this
.
collapsedWarningDismissed
=
true
;
},
},
minTreeWidth
:
MIN_TREE_WIDTH
,
maxTreeWidth
:
MAX_TREE_WIDTH
,
...
...
@@ -418,18 +441,23 @@ export default {
/>
<hidden-files-warning
v-if=
"
renderOverflowWarning
"
v-if=
"
visibleWarning == 'overflow'
"
:visible=
"numVisibleFiles"
:total=
"numTotalFiles"
:plain-diff-path=
"plainDiffPath"
:email-patch-path=
"emailPatchPath"
/>
<merge-conflict-warning
v-if=
"
isDiffHead && hasConflicts
"
v-if=
"
visibleWarning == 'merge-conflict'
"
:limited=
"isLimitedContainer"
:resolution-path=
"conflictResolutionPath"
:mergeable=
"canMerge"
/>
<collapsed-files-warning
v-if=
"visibleWarning == 'collapsed'"
:limited=
"isLimitedContainer"
@
dismiss=
"dismissCollapsedWarning"
/>
<div
:data-can-create-note=
"getNoteableData.current_user.can_create_note"
...
...
app/assets/javascripts/diffs/components/collapsed_files_warning.vue
0 → 100644
View file @
67a6d75d
<
script
>
import
{
mapActions
}
from
'
vuex
'
;
import
{
GlAlert
,
GlButton
}
from
'
@gitlab/ui
'
;
import
{
CENTERED_LIMITED_CONTAINER_CLASSES
}
from
'
../constants
'
;
export
default
{
components
:
{
GlAlert
,
GlButton
,
},
props
:
{
limited
:
{
type
:
Boolean
,
required
:
false
,
default
:
false
,
},
dismissed
:
{
type
:
Boolean
,
required
:
false
,
default
:
false
,
},
},
data
()
{
return
{
isDismissed
:
this
.
dismissed
,
};
},
computed
:
{
containerClasses
()
{
return
{
[
CENTERED_LIMITED_CONTAINER_CLASSES
]:
this
.
limited
,
};
},
},
methods
:
{
...
mapActions
(
'
diffs
'
,
[
'
expandAllFiles
'
]),
dismiss
()
{
this
.
isDismissed
=
true
;
this
.
$emit
(
'
dismiss
'
);
},
expand
()
{
this
.
expandAllFiles
();
this
.
dismiss
();
},
},
};
</
script
>
<
template
>
<div
v-if=
"!isDismissed"
data-testid=
"root"
:class=
"containerClasses"
>
<gl-alert
:dismissible=
"true"
:title=
"__('Some changes are not shown')"
variant=
"warning"
class=
"gl-mb-5"
@
dismiss=
"dismiss"
>
<p
class=
"gl-mb-0"
>
{{
__
(
'
For a faster browsing experience, some files are collapsed by default.
'
)
}}
</p>
<template
#actions
>
<gl-button
category=
"secondary"
variant=
"warning"
class=
"gl-alert-action"
@
click=
"expand"
>
{{
__
(
'
Expand all files
'
)
}}
</gl-button>
</
template
>
</gl-alert>
</div>
</template>
locale/gitlab.pot
View file @
67a6d75d
...
...
@@ -10374,6 +10374,9 @@ msgstr ""
msgid "Expand all"
msgstr ""
msgid "Expand all files"
msgstr ""
msgid "Expand approvers"
msgstr ""
...
...
@@ -11216,6 +11219,9 @@ msgstr ""
msgid "Footer message"
msgstr ""
msgid "For a faster browsing experience, some files are collapsed by default."
msgstr ""
msgid "For help setting up the Service Desk for your instance, please contact an administrator."
msgstr ""
...
...
@@ -23556,6 +23562,9 @@ msgstr ""
msgid "Solution"
msgstr ""
msgid "Some changes are not shown"
msgstr ""
msgid "Some child epics may be hidden due to applied filters"
msgstr ""
...
...
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