Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
d72b95cf
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
d72b95cf
编写于
10月 13, 2017
作者:
K
kushalpandya
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add support for `archived` param
上级
92ed1fec
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
22 addition
and
10 deletion
+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
未找到文件。
app/assets/javascripts/groups/components/app.vue
浏览文件 @
d72b95cf
...
...
@@ -43,8 +43,8 @@ export default {
},
},
methods
:
{
fetchGroups
({
parentId
,
page
,
filterGroupsBy
,
sortBy
,
updatePagination
})
{
return
this
.
service
.
getGroups
(
parentId
,
page
,
filterGroupsBy
,
sortBy
)
fetchGroups
({
parentId
,
page
,
filterGroupsBy
,
sortBy
,
archived
,
updatePagination
})
{
return
this
.
service
.
getGroups
(
parentId
,
page
,
filterGroupsBy
,
sortBy
,
archived
)
.
then
((
res
)
=>
{
if
(
updatePagination
)
{
this
.
updatePagination
(
res
.
headers
);
...
...
@@ -63,6 +63,7 @@ export default {
fetchAllGroups
()
{
const
page
=
getParameterByName
(
'
page
'
)
||
null
;
const
sortBy
=
getParameterByName
(
'
sort
'
)
||
null
;
const
archived
=
getParameterByName
(
'
archived
'
)
||
null
;
const
filterGroupsBy
=
getParameterByName
(
'
filter
'
)
||
null
;
this
.
isLoading
=
true
;
...
...
@@ -71,13 +72,14 @@ export default {
page
,
filterGroupsBy
,
sortBy
,
archived
,
updatePagination
:
true
,
}).
then
((
res
)
=>
{
this
.
isLoading
=
false
;
this
.
updateGroups
(
res
,
Boolean
(
filterGroupsBy
));
});
},
fetchPage
(
page
,
filterGroupsBy
,
sortBy
)
{
fetchPage
(
page
,
filterGroupsBy
,
sortBy
,
archived
)
{
this
.
isLoading
=
true
;
// eslint-disable-next-line promise/catch-or-return
...
...
@@ -85,6 +87,7 @@ export default {
page
,
filterGroupsBy
,
sortBy
,
archived
,
updatePagination
:
true
,
}).
then
((
res
)
=>
{
this
.
isLoading
=
false
;
...
...
app/assets/javascripts/groups/components/groups.vue
浏览文件 @
d72b95cf
...
...
@@ -29,7 +29,8 @@ export default {
change
(
page
)
{
const
filterGroupsParam
=
getParameterByName
(
'
filter_groups
'
);
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
浏览文件 @
d72b95cf
...
...
@@ -8,7 +8,7 @@ export default class GroupsService {
this
.
groups
=
Vue
.
resource
(
endpoint
);
}
getGroups
(
parentId
,
page
,
filterGroups
,
sort
)
{
getGroups
(
parentId
,
page
,
filterGroups
,
sort
,
archived
)
{
const
data
=
{};
if
(
parentId
)
{
...
...
@@ -26,6 +26,10 @@ export default class GroupsService {
if
(
sort
)
{
data
.
sort
=
sort
;
}
if
(
archived
)
{
data
.
archived
=
archived
;
}
}
return
this
.
groups
.
get
(
data
);
...
...
spec/javascripts/groups/components/app_spec.js
浏览文件 @
d72b95cf
...
...
@@ -102,9 +102,10 @@ describe('AppComponent', () => {
page
:
2
,
filterGroupsBy
:
'
git
'
,
sortBy
:
'
created_desc
'
,
archived
:
true
,
});
setTimeout
(()
=>
{
expect
(
vm
.
service
.
getGroups
).
toHaveBeenCalledWith
(
1
,
2
,
'
git
'
,
'
created_desc
'
);
expect
(
vm
.
service
.
getGroups
).
toHaveBeenCalledWith
(
1
,
2
,
'
git
'
,
'
created_desc
'
,
true
);
done
();
},
0
);
});
...
...
@@ -162,6 +163,7 @@ describe('AppComponent', () => {
filterGroupsBy
:
null
,
sortBy
:
null
,
updatePagination
:
true
,
archived
:
null
,
});
setTimeout
(()
=>
{
expect
(
vm
.
updateGroups
).
toHaveBeenCalled
();
...
...
@@ -178,13 +180,14 @@ describe('AppComponent', () => {
spyOn
(
window
.
history
,
'
replaceState
'
);
spyOn
(
$
,
'
scrollTo
'
);
vm
.
fetchPage
(
2
,
null
,
null
);
vm
.
fetchPage
(
2
,
null
,
null
,
true
);
expect
(
vm
.
isLoading
).
toBeTruthy
();
expect
(
vm
.
fetchGroups
).
toHaveBeenCalledWith
({
page
:
2
,
filterGroupsBy
:
null
,
sortBy
:
null
,
updatePagination
:
true
,
archived
:
true
,
});
setTimeout
(()
=>
{
expect
(
vm
.
isLoading
).
toBeFalsy
();
...
...
spec/javascripts/groups/components/groups_spec.js
浏览文件 @
d72b95cf
...
...
@@ -43,7 +43,7 @@ describe('GroupsComponent', () => {
spyOn
(
eventHub
,
'
$emit
'
).
and
.
stub
();
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
浏览文件 @
d72b95cf
...
...
@@ -20,12 +20,13 @@ describe('GroupsService', () => {
page
:
2
,
filter
:
'
git
'
,
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
});
service
.
getGroups
(
null
,
2
,
'
git
'
,
'
created_asc
'
);
service
.
getGroups
(
null
,
2
,
'
git
'
,
'
created_asc
'
,
true
);
expect
(
service
.
groups
.
get
).
toHaveBeenCalledWith
(
queryParams
);
});
});
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录