Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
d8403ec1
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,发现更多精彩内容 >>
提交
d8403ec1
编写于
6月 06, 2017
作者:
A
Alfredo Sumaran
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Minor visual adjustments
上级
657bc805
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
80 addition
and
22 deletion
+80
-22
app/assets/javascripts/groups/components/group_folder.vue
app/assets/javascripts/groups/components/group_folder.vue
+1
-1
app/assets/javascripts/groups/components/group_item.vue
app/assets/javascripts/groups/components/group_item.vue
+7
-2
app/assets/javascripts/groups/index.js
app/assets/javascripts/groups/index.js
+48
-15
app/assets/javascripts/groups/stores/groups_store.js
app/assets/javascripts/groups/stores/groups_store.js
+7
-0
app/assets/stylesheets/framework/lists.scss
app/assets/stylesheets/framework/lists.scss
+7
-0
app/controllers/concerns/membership_actions.rb
app/controllers/concerns/membership_actions.rb
+1
-1
app/views/dashboard/groups/_groups.html.haml
app/views/dashboard/groups/_groups.html.haml
+7
-1
spec/javascripts/groups/group_item_spec.js
spec/javascripts/groups/group_item_spec.js
+1
-1
spec/javascripts/groups/groups_spec.js
spec/javascripts/groups/groups_spec.js
+1
-1
未找到文件。
app/assets/javascripts/groups/components/group_folder.vue
浏览文件 @
d8403ec1
...
...
@@ -15,6 +15,6 @@ export default {
<
template
>
<ul
class=
"content-list group-list-tree"
>
<group-item
v-for=
"(group, index) in groups"
:key=
"index"
:group=
"group"
:base
Group=
"baseGroup
"
/>
<group-item
v-for=
"(group, index) in groups"
:key=
"index"
:group=
"group"
:base
-group=
"baseGroup"
:collection=
"groups
"
/>
</ul>
</
template
>
app/assets/javascripts/groups/components/group_item.vue
浏览文件 @
d8403ec1
...
...
@@ -12,6 +12,11 @@ export default {
required
:
false
,
default
:
()
=>
({}),
},
collection
:
{
type
:
Object
,
required
:
false
,
default
:
()
=>
({}),
},
},
methods
:
{
onClickRowGroup
(
e
)
{
...
...
@@ -35,7 +40,7 @@ export default {
}
},
leaveGroup
()
{
eventHub
.
$emit
(
'
leaveGroup
'
,
this
.
group
.
leavePath
);
eventHub
.
$emit
(
'
leaveGroup
'
,
this
.
group
,
this
.
collection
);
},
},
computed
:
{
...
...
@@ -63,7 +68,7 @@ export default {
if
(
this
.
group
.
isOrphan
)
{
// check if current group is baseGroup
if
(
Object
.
keys
(
this
.
baseGroup
).
length
>
0
)
{
if
(
Object
.
keys
(
this
.
baseGroup
).
length
>
0
&&
this
.
baseGroup
!==
this
.
group
)
{
// Remove baseGroup prefix from our current group.fullName. e.g:
// baseGroup.fullName: `level1`
// group.fullName: `level1 / level2 / level3`
...
...
app/assets/javascripts/groups/index.js
浏览文件 @
d8403ec1
/* global Flash */
import
Vue
from
'
vue
'
;
import
GroupFilterableList
from
'
./groups_filterable_list
'
;
import
GroupsComponent
from
'
./components/groups.vue
'
;
...
...
@@ -29,9 +31,16 @@ document.addEventListener('DOMContentLoaded', () => {
return
{
store
:
this
.
store
,
isLoading
:
true
,
state
:
this
.
store
.
state
,
loading
:
true
,
};
},
computed
:
{
isEmpty
()
{
return
Object
.
keys
(
this
.
state
.
groups
).
length
===
0
;
},
},
methods
:
{
fetchGroups
(
parentGroup
)
{
let
parentId
=
null
;
...
...
@@ -43,6 +52,8 @@ document.addEventListener('DOMContentLoaded', () => {
let
filterGroups
=
null
;
let
filterGroupsParam
=
null
;
this
.
isLoading
=
true
;
if
(
parentGroup
)
{
parentId
=
parentGroup
.
id
;
}
...
...
@@ -66,22 +77,26 @@ document.addEventListener('DOMContentLoaded', () => {
getGroups
.
then
((
response
)
=>
{
this
.
updateGroups
(
response
.
json
(),
parentGroup
);
})
.
catch
(()
=>
{
// TODO: Handle error
});
.
finally
(()
=>
{
this
.
isLoading
=
false
;
})
.
catch
(
this
.
handleErrorResponse
);
return
getGroups
;
},
fetchPage
(
page
,
filterGroups
,
sort
)
{
this
.
isLoading
=
true
;
this
.
service
.
getGroups
(
null
,
page
,
filterGroups
,
sort
)
.
then
((
response
)
=>
{
this
.
updateGroups
(
response
.
json
());
this
.
updatePagination
(
response
.
headers
);
$
.
scrollTo
(
0
);
})
.
catch
(()
=>
{
// TODO: Handle error
});
.
finally
(()
=>
{
this
.
isLoading
=
false
;
})
.
catch
(
this
.
handleErrorResponse
);
},
toggleSubGroups
(
parentGroup
=
null
)
{
if
(
!
parentGroup
.
isOpen
)
{
...
...
@@ -91,13 +106,26 @@ document.addEventListener('DOMContentLoaded', () => {
GroupsStore
.
toggleSubGroups
(
parentGroup
);
},
leaveGroup
(
endpoint
)
{
this
.
service
.
leaveGroup
(
endpoint
)
.
then
(()
=>
{
// TODO: Refresh?
leaveGroup
(
group
,
collection
)
{
this
.
service
.
leaveGroup
(
group
.
leavePath
)
.
then
((
response
)
=>
{
this
.
store
.
removeGroup
(
group
,
collection
);
// eslint-disable-next-line no-new
new
Flash
(
response
.
json
().
notice
,
'
notice
'
);
})
.
finally
(()
=>
{
$
.
scrollTo
(
0
);
})
.
catch
(()
=>
{
// TODO: Handle error
.
catch
((
response
)
=>
{
let
message
=
'
An error occurred. Please try again.
'
;
if
(
response
.
status
===
403
)
{
message
=
'
Failed to leave the group. Please make sure you are not the only owner
'
;
}
// eslint-disable-next-line no-new
new
Flash
(
message
);
});
},
updateGroups
(
groups
,
parentGroup
)
{
...
...
@@ -106,6 +134,10 @@ document.addEventListener('DOMContentLoaded', () => {
updatePagination
(
headers
)
{
this
.
store
.
storePagination
(
headers
);
},
handleErrorResponse
()
{
// eslint-disable-next-line no-new
new
Flash
(
'
An error occurred. Please try again.
'
);
},
},
beforeMount
()
{
let
groupFilterList
=
null
;
...
...
@@ -135,9 +167,10 @@ document.addEventListener('DOMContentLoaded', () => {
.
then
((
response
)
=>
{
this
.
updatePagination
(
response
.
headers
);
})
.
catch
(()
=>
{
// TODO: Handle error
});
.
finally
(()
=>
{
this
.
isLoading
=
false
;
})
.
catch
(
this
.
handleErrorResponse
);
},
});
});
app/assets/javascripts/groups/stores/groups_store.js
浏览文件 @
d8403ec1
import
Vue
from
'
vue
'
;
export
default
class
GroupsStore
{
constructor
()
{
this
.
state
=
{};
...
...
@@ -131,6 +133,11 @@ export default class GroupsStore {
};
}
// eslint-disable-next-line class-methods-use-this
removeGroup
(
group
,
collection
)
{
Vue
.
delete
(
collection
,
group
.
id
);
}
// eslint-disable-next-line class-methods-use-this
static
toggleSubGroups
(
toggleGroup
)
{
const
group
=
toggleGroup
;
...
...
app/assets/stylesheets/framework/lists.scss
浏览文件 @
d8403ec1
...
...
@@ -342,3 +342,10 @@ ul.indent-list {
}
}
}
.js-groups-list-holder
{
.groups-list-loading
{
font-size
:
34px
;
text-align
:
center
;
}
}
app/controllers/concerns/membership_actions.rb
浏览文件 @
d8403ec1
...
...
@@ -57,7 +57,7 @@ module MembershipActions
redirect_to
redirect_path
,
notice:
notice
end
format
.
json
{
head
:ok
}
format
.
json
{
render
json:
{
notice:
notice
}
}
end
end
...
...
app/views/dashboard/groups/_groups.html.haml
浏览文件 @
d8403ec1
.js-groups-list-holder
#dashboard-group-app
{
data:
{
endpoint:
dashboard_groups_path
(
format: :json
),
path:
dashboard_groups_path
}
}
%groups-component
{
':groups'
=>
'state.groups'
,
':page-info'
=>
'state.pageInfo'
}
.groups-list-loading
=
icon
(
'spinner spin'
,
'v-show'
=>
'isLoading'
)
%template
{
'v-if'
=>
'!isLoading && isEmpty'
}
%div
{
'v-cloak'
=>
true
}
=
render
'empty_state'
%template
{
'v-else-if'
=>
'!isLoading && !isEmpty'
}
%groups-component
{
':groups'
=>
'state.groups'
,
':page-info'
=>
'state.pageInfo'
}
spec/javascripts/groups/group_item_spec.js
浏览文件 @
d8403ec1
...
...
@@ -3,7 +3,7 @@ import groupItemComponent from '~/groups/components/group_item.vue';
import
GroupsStore
from
'
~/groups/stores/groups_store
'
;
import
{
group1
}
from
'
./mock_data
'
;
describe
(
'
Groups Component
'
,
()
=>
{
f
describe
(
'
Groups Component
'
,
()
=>
{
let
GroupItemComponent
;
let
component
;
let
store
;
...
...
spec/javascripts/groups/groups_spec.js
浏览文件 @
d8403ec1
...
...
@@ -5,7 +5,7 @@ import groupsComponent from '~/groups/components/groups.vue';
import
GroupsStore
from
'
~/groups/stores/groups_store
'
;
import
{
groupsData
}
from
'
./mock_data
'
;
describe
(
'
Groups Component
'
,
()
=>
{
f
describe
(
'
Groups Component
'
,
()
=>
{
let
GroupsComponent
;
let
store
;
let
component
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录