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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
d72b95cf
Commit
d72b95cf
authored
Oct 13, 2017
by
kushalpandya
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for `archived` param
parent
92ed1fec
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
22 additions
and
10 deletions
+22
-10
app/assets/javascripts/groups/components/app.vue
app/assets/javascripts/groups/components/app.vue
+6
-3
app/assets/javascripts/groups/components/groups.vue
app/assets/javascripts/groups/components/groups.vue
+2
-1
app/assets/javascripts/groups/service/groups_service.js
app/assets/javascripts/groups/service/groups_service.js
+5
-1
spec/javascripts/groups/components/app_spec.js
spec/javascripts/groups/components/app_spec.js
+5
-2
spec/javascripts/groups/components/groups_spec.js
spec/javascripts/groups/components/groups_spec.js
+1
-1
spec/javascripts/groups/service/groups_service_spec.js
spec/javascripts/groups/service/groups_service_spec.js
+3
-2
No files found.
app/assets/javascripts/groups/components/app.vue
View file @
d72b95cf
...
@@ -43,8 +43,8 @@ export default {
...
@@ -43,8 +43,8 @@ export default {
},
},
},
},
methods
:
{
methods
:
{
fetchGroups
({
parentId
,
page
,
filterGroupsBy
,
sortBy
,
updatePagination
})
{
fetchGroups
({
parentId
,
page
,
filterGroupsBy
,
sortBy
,
archived
,
updatePagination
})
{
return
this
.
service
.
getGroups
(
parentId
,
page
,
filterGroupsBy
,
sortBy
)
return
this
.
service
.
getGroups
(
parentId
,
page
,
filterGroupsBy
,
sortBy
,
archived
)
.
then
((
res
)
=>
{
.
then
((
res
)
=>
{
if
(
updatePagination
)
{
if
(
updatePagination
)
{
this
.
updatePagination
(
res
.
headers
);
this
.
updatePagination
(
res
.
headers
);
...
@@ -63,6 +63,7 @@ export default {
...
@@ -63,6 +63,7 @@ export default {
fetchAllGroups
()
{
fetchAllGroups
()
{
const
page
=
getParameterByName
(
'
page
'
)
||
null
;
const
page
=
getParameterByName
(
'
page
'
)
||
null
;
const
sortBy
=
getParameterByName
(
'
sort
'
)
||
null
;
const
sortBy
=
getParameterByName
(
'
sort
'
)
||
null
;
const
archived
=
getParameterByName
(
'
archived
'
)
||
null
;
const
filterGroupsBy
=
getParameterByName
(
'
filter
'
)
||
null
;
const
filterGroupsBy
=
getParameterByName
(
'
filter
'
)
||
null
;
this
.
isLoading
=
true
;
this
.
isLoading
=
true
;
...
@@ -71,13 +72,14 @@ export default {
...
@@ -71,13 +72,14 @@ export default {
page
,
page
,
filterGroupsBy
,
filterGroupsBy
,
sortBy
,
sortBy
,
archived
,
updatePagination
:
true
,
updatePagination
:
true
,
}).
then
((
res
)
=>
{
}).
then
((
res
)
=>
{
this
.
isLoading
=
false
;
this
.
isLoading
=
false
;
this
.
updateGroups
(
res
,
Boolean
(
filterGroupsBy
));
this
.
updateGroups
(
res
,
Boolean
(
filterGroupsBy
));
});
});
},
},
fetchPage
(
page
,
filterGroupsBy
,
sortBy
)
{
fetchPage
(
page
,
filterGroupsBy
,
sortBy
,
archived
)
{
this
.
isLoading
=
true
;
this
.
isLoading
=
true
;
// eslint-disable-next-line promise/catch-or-return
// eslint-disable-next-line promise/catch-or-return
...
@@ -85,6 +87,7 @@ export default {
...
@@ -85,6 +87,7 @@ export default {
page
,
page
,
filterGroupsBy
,
filterGroupsBy
,
sortBy
,
sortBy
,
archived
,
updatePagination
:
true
,
updatePagination
:
true
,
}).
then
((
res
)
=>
{
}).
then
((
res
)
=>
{
this
.
isLoading
=
false
;
this
.
isLoading
=
false
;
...
...
app/assets/javascripts/groups/components/groups.vue
View file @
d72b95cf
...
@@ -29,7 +29,8 @@ export default {
...
@@ -29,7 +29,8 @@ export default {
change
(
page
)
{
change
(
page
)
{
const
filterGroupsParam
=
getParameterByName
(
'
filter_groups
'
);
const
filterGroupsParam
=
getParameterByName
(
'
filter_groups
'
);
const
sortParam
=
getParameterByName
(
'
sort
'
);
const
sortParam
=
getParameterByName
(
'
sort
'
);
eventHub
.
$emit
(
'
fetchPage
'
,
page
,
filterGroupsParam
,
sortParam
);
const
archivedParam
=
getParameterByName
(
'
archived
'
);
eventHub
.
$emit
(
'
fetchPage
'
,
page
,
filterGroupsParam
,
sortParam
,
archivedParam
);
},
},
},
},
};
};
...
...
app/assets/javascripts/groups/service/groups_service.js
View file @
d72b95cf
...
@@ -8,7 +8,7 @@ export default class GroupsService {
...
@@ -8,7 +8,7 @@ export default class GroupsService {
this
.
groups
=
Vue
.
resource
(
endpoint
);
this
.
groups
=
Vue
.
resource
(
endpoint
);
}
}
getGroups
(
parentId
,
page
,
filterGroups
,
sort
)
{
getGroups
(
parentId
,
page
,
filterGroups
,
sort
,
archived
)
{
const
data
=
{};
const
data
=
{};
if
(
parentId
)
{
if
(
parentId
)
{
...
@@ -26,6 +26,10 @@ export default class GroupsService {
...
@@ -26,6 +26,10 @@ export default class GroupsService {
if
(
sort
)
{
if
(
sort
)
{
data
.
sort
=
sort
;
data
.
sort
=
sort
;
}
}
if
(
archived
)
{
data
.
archived
=
archived
;
}
}
}
return
this
.
groups
.
get
(
data
);
return
this
.
groups
.
get
(
data
);
...
...
spec/javascripts/groups/components/app_spec.js
View file @
d72b95cf
...
@@ -102,9 +102,10 @@ describe('AppComponent', () => {
...
@@ -102,9 +102,10 @@ describe('AppComponent', () => {
page
:
2
,
page
:
2
,
filterGroupsBy
:
'
git
'
,
filterGroupsBy
:
'
git
'
,
sortBy
:
'
created_desc
'
,
sortBy
:
'
created_desc
'
,
archived
:
true
,
});
});
setTimeout
(()
=>
{
setTimeout
(()
=>
{
expect
(
vm
.
service
.
getGroups
).
toHaveBeenCalledWith
(
1
,
2
,
'
git
'
,
'
created_desc
'
);
expect
(
vm
.
service
.
getGroups
).
toHaveBeenCalledWith
(
1
,
2
,
'
git
'
,
'
created_desc
'
,
true
);
done
();
done
();
},
0
);
},
0
);
});
});
...
@@ -162,6 +163,7 @@ describe('AppComponent', () => {
...
@@ -162,6 +163,7 @@ describe('AppComponent', () => {
filterGroupsBy
:
null
,
filterGroupsBy
:
null
,
sortBy
:
null
,
sortBy
:
null
,
updatePagination
:
true
,
updatePagination
:
true
,
archived
:
null
,
});
});
setTimeout
(()
=>
{
setTimeout
(()
=>
{
expect
(
vm
.
updateGroups
).
toHaveBeenCalled
();
expect
(
vm
.
updateGroups
).
toHaveBeenCalled
();
...
@@ -178,13 +180,14 @@ describe('AppComponent', () => {
...
@@ -178,13 +180,14 @@ describe('AppComponent', () => {
spyOn
(
window
.
history
,
'
replaceState
'
);
spyOn
(
window
.
history
,
'
replaceState
'
);
spyOn
(
$
,
'
scrollTo
'
);
spyOn
(
$
,
'
scrollTo
'
);
vm
.
fetchPage
(
2
,
null
,
null
);
vm
.
fetchPage
(
2
,
null
,
null
,
true
);
expect
(
vm
.
isLoading
).
toBeTruthy
();
expect
(
vm
.
isLoading
).
toBeTruthy
();
expect
(
vm
.
fetchGroups
).
toHaveBeenCalledWith
({
expect
(
vm
.
fetchGroups
).
toHaveBeenCalledWith
({
page
:
2
,
page
:
2
,
filterGroupsBy
:
null
,
filterGroupsBy
:
null
,
sortBy
:
null
,
sortBy
:
null
,
updatePagination
:
true
,
updatePagination
:
true
,
archived
:
true
,
});
});
setTimeout
(()
=>
{
setTimeout
(()
=>
{
expect
(
vm
.
isLoading
).
toBeFalsy
();
expect
(
vm
.
isLoading
).
toBeFalsy
();
...
...
spec/javascripts/groups/components/groups_spec.js
View file @
d72b95cf
...
@@ -43,7 +43,7 @@ describe('GroupsComponent', () => {
...
@@ -43,7 +43,7 @@ describe('GroupsComponent', () => {
spyOn
(
eventHub
,
'
$emit
'
).
and
.
stub
();
spyOn
(
eventHub
,
'
$emit
'
).
and
.
stub
();
vm
.
change
(
2
);
vm
.
change
(
2
);
expect
(
eventHub
.
$emit
).
toHaveBeenCalledWith
(
'
fetchPage
'
,
2
,
jasmine
.
any
(
Object
),
jasmine
.
any
(
Object
));
expect
(
eventHub
.
$emit
).
toHaveBeenCalledWith
(
'
fetchPage
'
,
2
,
jasmine
.
any
(
Object
),
jasmine
.
any
(
Object
)
,
jasmine
.
any
(
Object
)
);
});
});
});
});
});
});
...
...
spec/javascripts/groups/service/groups_service_spec.js
View file @
d72b95cf
...
@@ -20,12 +20,13 @@ describe('GroupsService', () => {
...
@@ -20,12 +20,13 @@ describe('GroupsService', () => {
page
:
2
,
page
:
2
,
filter
:
'
git
'
,
filter
:
'
git
'
,
sort
:
'
created_asc
'
,
sort
:
'
created_asc
'
,
archived
:
true
,
};
};
service
.
getGroups
(
55
,
2
,
'
git
'
,
'
created_asc
'
);
service
.
getGroups
(
55
,
2
,
'
git
'
,
'
created_asc
'
,
true
);
expect
(
service
.
groups
.
get
).
toHaveBeenCalledWith
({
parent_id
:
55
});
expect
(
service
.
groups
.
get
).
toHaveBeenCalledWith
({
parent_id
:
55
});
service
.
getGroups
(
null
,
2
,
'
git
'
,
'
created_asc
'
);
service
.
getGroups
(
null
,
2
,
'
git
'
,
'
created_asc
'
,
true
);
expect
(
service
.
groups
.
get
).
toHaveBeenCalledWith
(
queryParams
);
expect
(
service
.
groups
.
get
).
toHaveBeenCalledWith
(
queryParams
);
});
});
});
});
...
...
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