-
Notifications
You must be signed in to change notification settings - Fork 291
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
96292a2
commit bacb5b3
Showing
10 changed files
with
158 additions
and
26 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import React from 'react'; | ||
import { | ||
BooleanField, | ||
Datagrid, | ||
DateField, | ||
List, | ||
ReferenceField, | ||
TextField, | ||
SearchInput, | ||
} from 'react-admin'; | ||
|
||
export const MessageList: React.FC = () => ( | ||
<List filters={[<SearchInput key="search" source="q" alwaysOn />]}> | ||
<Datagrid rowClick="show"> | ||
<TextField source="id" label="ID" sortable={true} sortByOrder="DESC" /> | ||
<TextField source="content" label="内容" /> | ||
<TextField source="author" label="作者" /> | ||
<ReferenceField source="groupId" reference="groups" label="群组ID" /> | ||
<TextField source="converseId" label="会话ID" /> | ||
<BooleanField source="hasRecall" label="撤回" /> | ||
<TextField source="reactions" label="消息反应" /> | ||
<DateField source="createdAt" label="创建时间" /> | ||
</Datagrid> | ||
</List> | ||
); | ||
MessageList.displayName = 'MessageList'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { | ||
Datagrid, | ||
DateField, | ||
List, | ||
TextField, | ||
ShowButton, | ||
EditButton, | ||
SearchInput, | ||
ArrayField, | ||
SingleFieldList, | ||
ChipField, | ||
} from 'react-admin'; | ||
import React from 'react'; | ||
import { Box } from '@mui/material'; | ||
|
||
const PostListActionToolbar = ({ children, ...props }) => ( | ||
<Box sx={{ alignItems: 'center', display: 'flex' }}>{children}</Box> | ||
); | ||
|
||
export const GroupList: React.FC = () => ( | ||
<List filters={[<SearchInput key="search" source="q" alwaysOn />]}> | ||
<Datagrid> | ||
<TextField | ||
source="id" | ||
label="群组ID" | ||
sortable={true} | ||
sortByOrder="DESC" | ||
/> | ||
<TextField source="name" label="群组名称" /> | ||
<TextField source="owner" label="管理员" /> | ||
<TextField source="members.length" label="成员数量" /> | ||
<ArrayField source="panels" label="面板"> | ||
<SingleFieldList> | ||
<ChipField source="name" /> | ||
</SingleFieldList> | ||
</ArrayField> | ||
<ArrayField source="roles" label="角色"> | ||
<SingleFieldList> | ||
<ChipField source="name" /> | ||
</SingleFieldList> | ||
</ArrayField> | ||
<TextField source="fallbackPermissions" label="默认权限" /> | ||
<DateField source="createdAt" label="创建时间" /> | ||
<PostListActionToolbar> | ||
<ShowButton /> | ||
<EditButton /> | ||
</PostListActionToolbar> | ||
</Datagrid> | ||
</List> | ||
); | ||
GroupList.displayName = 'GroupList'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { Router } from 'express'; | ||
import raExpressMongoose from 'express-mongoose-ra-json-server'; | ||
|
||
const router = Router(); | ||
|
||
router.use( | ||
'/users', | ||
raExpressMongoose(require('../../../models/user/user').default, { | ||
q: ['nickname', 'email'], | ||
}) | ||
); | ||
router.use( | ||
'/messages', | ||
raExpressMongoose(require('../../../models/chat/message').default, { | ||
q: ['content'], | ||
allowedRegexFields: ['content'], | ||
}) | ||
); | ||
router.use( | ||
'/groups', | ||
raExpressMongoose(require('../../../models/group/group').default, { | ||
q: ['name'], | ||
}) | ||
); | ||
router.use( | ||
'/file', | ||
raExpressMongoose(require('../../../models/file').default, { | ||
q: ['objectName'], | ||
}) | ||
); | ||
|
||
export { router }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters