mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-28 09:10:31 +08:00
feat: complete group tree (#1967)
* feat: complete group tree * feat: ui * fix: i18n * refactor code * fix: support remove user from group * fix: format code * Update organization.go * Update organization.go * Update user_group.go --------- Co-authored-by: hsluoyz <hsluoyz@qq.com>
This commit is contained in:
@@ -56,7 +56,7 @@ class GroupListPage extends BaseListPage {
|
||||
updatedTime: moment().format(),
|
||||
displayName: `New Group - ${randomName}`,
|
||||
type: "Virtual",
|
||||
parentGroupId: this.props.account.owner,
|
||||
parentId: this.props.account.owner,
|
||||
isTopGroup: true,
|
||||
isEnabled: true,
|
||||
};
|
||||
@@ -96,7 +96,7 @@ class GroupListPage extends BaseListPage {
|
||||
});
|
||||
}
|
||||
|
||||
renderTable(groups) {
|
||||
renderTable(data) {
|
||||
const columns = [
|
||||
{
|
||||
title: i18next.t("general:Name"),
|
||||
@@ -174,15 +174,15 @@ class GroupListPage extends BaseListPage {
|
||||
},
|
||||
{
|
||||
title: i18next.t("group:Parent group"),
|
||||
dataIndex: "parentGroupId",
|
||||
key: "parentGroupId",
|
||||
dataIndex: "parentId",
|
||||
key: "parentId",
|
||||
width: "110px",
|
||||
sorter: true,
|
||||
...this.getColumnSearchProps("parentGroupId"),
|
||||
...this.getColumnSearchProps("parentId"),
|
||||
render: (text, record, index) => {
|
||||
if (record.isTopGroup) {
|
||||
return <Link to={`/organizations/${record.parentGroupId}`}>
|
||||
{record.parentGroupId}
|
||||
return <Link to={`/organizations/${record.parentId}`}>
|
||||
{record.parentId}
|
||||
</Link>;
|
||||
}
|
||||
const parentGroup = this.state.groups.find((group) => group.id === text);
|
||||
@@ -201,10 +201,12 @@ class GroupListPage extends BaseListPage {
|
||||
width: "170px",
|
||||
fixed: (Setting.isMobile()) ? "false" : "right",
|
||||
render: (text, record, index) => {
|
||||
const haveChildren = this.state.groups.find((group) => group.parentId === record.id) !== undefined;
|
||||
return (
|
||||
<div>
|
||||
<Button style={{marginTop: "10px", marginBottom: "10px", marginRight: "10px"}} type="primary" onClick={() => this.props.history.push(`/groups/${record.owner}/${record.name}`)}>{i18next.t("general:Edit")}</Button>
|
||||
<PopconfirmModal
|
||||
disabled={haveChildren}
|
||||
title={i18next.t("general:Sure to delete") + `: ${record.name} ?`}
|
||||
onConfirm={() => this.deleteGroup(index)}
|
||||
>
|
||||
@@ -224,7 +226,7 @@ class GroupListPage extends BaseListPage {
|
||||
|
||||
return (
|
||||
<div>
|
||||
<Table scroll={{x: "max-content"}} columns={columns} dataSource={groups} rowKey={(record) => `${record.owner}/${record.name}`} size="middle" bordered pagination={paginationProps}
|
||||
<Table scroll={{x: "max-content"}} columns={columns} dataSource={data} rowKey={(record) => `${record.owner}/${record.name}`} size="middle" bordered pagination={paginationProps}
|
||||
title={() => (
|
||||
<div>
|
||||
{i18next.t("general:Groups")}
|
||||
|
Reference in New Issue
Block a user