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
5ceb3e6a
Commit
5ceb3e6a
authored
Jun 03, 2021
by
jerasmus
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move constants into constants.js
Moved the repository constants into constants.js
parent
4dbcd621
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
9 deletions
+11
-9
app/assets/javascripts/repository/components/tree_content.vue
...assets/javascripts/repository/components/tree_content.vue
+4
-7
app/assets/javascripts/repository/constants.js
app/assets/javascripts/repository/constants.js
+4
-0
spec/frontend/repository/components/tree_content_spec.js
spec/frontend/repository/components/tree_content_spec.js
+3
-2
No files found.
app/assets/javascripts/repository/components/tree_content.vue
View file @
5ceb3e6a
...
@@ -2,16 +2,13 @@
...
@@ -2,16 +2,13 @@
import
filesQuery
from
'
shared_queries/repository/files.query.graphql
'
;
import
filesQuery
from
'
shared_queries/repository/files.query.graphql
'
;
import
createFlash
from
'
~/flash
'
;
import
createFlash
from
'
~/flash
'
;
import
{
__
}
from
'
../../locale
'
;
import
{
__
}
from
'
../../locale
'
;
import
{
TREE_PAGE_SIZE
,
TREE_INITIAL_FETCH_COUNT
}
from
'
../constants
'
;
import
getRefMixin
from
'
../mixins/get_ref
'
;
import
getRefMixin
from
'
../mixins/get_ref
'
;
import
projectPathQuery
from
'
../queries/project_path.query.graphql
'
;
import
projectPathQuery
from
'
../queries/project_path.query.graphql
'
;
import
{
readmeFile
}
from
'
../utils/readme
'
;
import
{
readmeFile
}
from
'
../utils/readme
'
;
import
FilePreview
from
'
./preview/index.vue
'
;
import
FilePreview
from
'
./preview/index.vue
'
;
import
FileTable
from
'
./table/index.vue
'
;
import
FileTable
from
'
./table/index.vue
'
;
const
LIMIT
=
1000
;
const
PAGE_SIZE
=
100
;
export
const
INITIAL_FETCH_COUNT
=
LIMIT
/
PAGE_SIZE
;
export
default
{
export
default
{
components
:
{
components
:
{
FileTable
,
FileTable
,
...
@@ -47,7 +44,7 @@ export default {
...
@@ -47,7 +44,7 @@ export default {
isLoadingFiles
:
false
,
isLoadingFiles
:
false
,
isOverLimit
:
false
,
isOverLimit
:
false
,
clickedShowMore
:
false
,
clickedShowMore
:
false
,
pageSize
:
PAGE_SIZE
,
pageSize
:
TREE_
PAGE_SIZE
,
fetchCounter
:
0
,
fetchCounter
:
0
,
};
};
},
},
...
@@ -56,7 +53,7 @@ export default {
...
@@ -56,7 +53,7 @@ export default {
return
readmeFile
(
this
.
entries
.
blobs
);
return
readmeFile
(
this
.
entries
.
blobs
);
},
},
hasShowMore
()
{
hasShowMore
()
{
return
!
this
.
clickedShowMore
&&
this
.
fetchCounter
===
INITIAL_FETCH_COUNT
;
return
!
this
.
clickedShowMore
&&
this
.
fetchCounter
===
TREE_
INITIAL_FETCH_COUNT
;
},
},
},
},
...
@@ -107,7 +104,7 @@ export default {
...
@@ -107,7 +104,7 @@ export default {
if
(
pageInfo
?.
hasNextPage
)
{
if
(
pageInfo
?.
hasNextPage
)
{
this
.
nextPageCursor
=
pageInfo
.
endCursor
;
this
.
nextPageCursor
=
pageInfo
.
endCursor
;
this
.
fetchCounter
+=
1
;
this
.
fetchCounter
+=
1
;
if
(
this
.
fetchCounter
<
INITIAL_FETCH_COUNT
||
this
.
clickedShowMore
)
{
if
(
this
.
fetchCounter
<
TREE_
INITIAL_FETCH_COUNT
||
this
.
clickedShowMore
)
{
this
.
fetchFiles
();
this
.
fetchFiles
();
this
.
clickedShowMore
=
false
;
this
.
clickedShowMore
=
false
;
}
}
...
...
app/assets/javascripts/repository/constants.js
0 → 100644
View file @
5ceb3e6a
const
TREE_PAGE_LIMIT
=
1000
;
// the maximum amount of items per page
export
const
TREE_PAGE_SIZE
=
100
;
// the amount of items to be fetched per (batch) request
export
const
TREE_INITIAL_FETCH_COUNT
=
TREE_PAGE_LIMIT
/
TREE_PAGE_SIZE
;
// the amount of (batch) requests to make
spec/frontend/repository/components/tree_content_spec.js
View file @
5ceb3e6a
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
FilePreview
from
'
~/repository/components/preview/index.vue
'
;
import
FilePreview
from
'
~/repository/components/preview/index.vue
'
;
import
FileTable
from
'
~/repository/components/table/index.vue
'
;
import
FileTable
from
'
~/repository/components/table/index.vue
'
;
import
TreeContent
,
{
INITIAL_FETCH_COUNT
}
from
'
~/repository/components/tree_content.vue
'
;
import
TreeContent
from
'
~/repository/components/tree_content.vue
'
;
import
{
TREE_INITIAL_FETCH_COUNT
}
from
'
~/repository/constants
'
;
let
vm
;
let
vm
;
let
$apollo
;
let
$apollo
;
...
@@ -128,7 +129,7 @@ describe('Repository table component', () => {
...
@@ -128,7 +129,7 @@ describe('Repository table component', () => {
it
(
'
has limit of 1000 files on initial load
'
,
()
=>
{
it
(
'
has limit of 1000 files on initial load
'
,
()
=>
{
factory
(
'
/
'
);
factory
(
'
/
'
);
expect
(
INITIAL_FETCH_COUNT
*
vm
.
vm
.
pageSize
).
toBe
(
1000
);
expect
(
TREE_
INITIAL_FETCH_COUNT
*
vm
.
vm
.
pageSize
).
toBe
(
1000
);
});
});
});
});
});
});
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