mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-04 05:10:19 +08:00
Add chat and message pages
This commit is contained in:
@ -29,6 +29,7 @@ type Chat struct {
|
|||||||
|
|
||||||
Organization string `xorm:"varchar(100)" json:"organization"`
|
Organization string `xorm:"varchar(100)" json:"organization"`
|
||||||
DisplayName string `xorm:"varchar(100)" json:"displayName"`
|
DisplayName string `xorm:"varchar(100)" json:"displayName"`
|
||||||
|
Type string `xorm:"varchar(100)" json:"type"`
|
||||||
User1 string `xorm:"varchar(100)" json:"user1"`
|
User1 string `xorm:"varchar(100)" json:"user1"`
|
||||||
User2 string `xorm:"varchar(100)" json:"user2"`
|
User2 string `xorm:"varchar(100)" json:"user2"`
|
||||||
Users []string `xorm:"varchar(100)" json:"users"`
|
Users []string `xorm:"varchar(100)" json:"users"`
|
||||||
|
@ -126,7 +126,23 @@ class ChatEditPage extends React.Component {
|
|||||||
</Row>
|
</Row>
|
||||||
<Row style={{marginTop: "20px"}} >
|
<Row style={{marginTop: "20px"}} >
|
||||||
<Col style={{marginTop: "5px"}} span={(Setting.isMobile()) ? 22 : 2}>
|
<Col style={{marginTop: "5px"}} span={(Setting.isMobile()) ? 22 : 2}>
|
||||||
{Setting.getLabel(i18next.t("chat:User1"), i18next.t("general:User1 - Tooltip"))} :
|
{Setting.getLabel(i18next.t("provider:Type"), i18next.t("provider:Type - Tooltip"))} :
|
||||||
|
</Col>
|
||||||
|
<Col span={22} >
|
||||||
|
<Select virtual={false} style={{width: "100%"}} value={this.state.chat.type} onChange={(value => {
|
||||||
|
this.updateChatField("type", value);
|
||||||
|
})}
|
||||||
|
options={[
|
||||||
|
{value: "Single", name: i18next.t("chat:Single")},
|
||||||
|
{value: "Group", name: i18next.t("chat:Group")},
|
||||||
|
{value: "AI", name: i18next.t("chat:AI")},
|
||||||
|
].map((item) => Setting.getOption(item.name, item.value))}
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
<Row style={{marginTop: "20px"}} >
|
||||||
|
<Col style={{marginTop: "5px"}} span={(Setting.isMobile()) ? 22 : 2}>
|
||||||
|
{Setting.getLabel(i18next.t("chat:User1"), i18next.t("chat:User1 - Tooltip"))} :
|
||||||
</Col>
|
</Col>
|
||||||
<Col span={22} >
|
<Col span={22} >
|
||||||
<Select virtual={false} style={{width: "100%"}} value={this.state.chat.user1} onChange={(value => {this.updateChatField("user1", value);})}
|
<Select virtual={false} style={{width: "100%"}} value={this.state.chat.user1} onChange={(value => {this.updateChatField("user1", value);})}
|
||||||
@ -136,7 +152,7 @@ class ChatEditPage extends React.Component {
|
|||||||
</Row>
|
</Row>
|
||||||
<Row style={{marginTop: "20px"}} >
|
<Row style={{marginTop: "20px"}} >
|
||||||
<Col style={{marginTop: "5px"}} span={(Setting.isMobile()) ? 22 : 2}>
|
<Col style={{marginTop: "5px"}} span={(Setting.isMobile()) ? 22 : 2}>
|
||||||
{Setting.getLabel(i18next.t("chat:User2"), i18next.t("general:User2 - Tooltip"))} :
|
{Setting.getLabel(i18next.t("chat:User2"), i18next.t("chat:User2 - Tooltip"))} :
|
||||||
</Col>
|
</Col>
|
||||||
<Col span={22} >
|
<Col span={22} >
|
||||||
<Select virtual={false} style={{width: "100%"}} value={this.state.chat.user2} onChange={(value => {this.updateChatField("user2", value);})}
|
<Select virtual={false} style={{width: "100%"}} value={this.state.chat.user2} onChange={(value => {this.updateChatField("user2", value);})}
|
||||||
@ -146,7 +162,7 @@ class ChatEditPage extends React.Component {
|
|||||||
</Row>
|
</Row>
|
||||||
<Row style={{marginTop: "20px"}} >
|
<Row style={{marginTop: "20px"}} >
|
||||||
<Col style={{marginTop: "5px"}} span={(Setting.isMobile()) ? 22 : 2}>
|
<Col style={{marginTop: "5px"}} span={(Setting.isMobile()) ? 22 : 2}>
|
||||||
{Setting.getLabel(i18next.t("chat:Sub users"), i18next.t("chat:Sub users - Tooltip"))} :
|
{Setting.getLabel(i18next.t("general:Users"), i18next.t("chat:Users - Tooltip"))} :
|
||||||
</Col>
|
</Col>
|
||||||
<Col span={22} >
|
<Col span={22} >
|
||||||
<Select mode="tags" style={{width: "100%"}} value={this.state.chat.users}
|
<Select mode="tags" style={{width: "100%"}} value={this.state.chat.users}
|
||||||
|
@ -32,6 +32,7 @@ class ChatListPage extends BaseListPage {
|
|||||||
updatedTime: moment().format(),
|
updatedTime: moment().format(),
|
||||||
organization: this.props.account.owner,
|
organization: this.props.account.owner,
|
||||||
displayName: `New Chat - ${randomName}`,
|
displayName: `New Chat - ${randomName}`,
|
||||||
|
type: "Single",
|
||||||
user1: `${this.props.account.owner}/${this.props.account.name}`,
|
user1: `${this.props.account.owner}/${this.props.account.name}`,
|
||||||
user2: "",
|
user2: "",
|
||||||
users: [`${this.props.account.owner}/${this.props.account.name}`],
|
users: [`${this.props.account.owner}/${this.props.account.name}`],
|
||||||
@ -134,6 +135,22 @@ class ChatListPage extends BaseListPage {
|
|||||||
sorter: true,
|
sorter: true,
|
||||||
...this.getColumnSearchProps("displayName"),
|
...this.getColumnSearchProps("displayName"),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: i18next.t("provider:Type"),
|
||||||
|
dataIndex: "type",
|
||||||
|
key: "type",
|
||||||
|
width: "110px",
|
||||||
|
sorter: true,
|
||||||
|
filterMultiple: false,
|
||||||
|
filters: [
|
||||||
|
{text: "Single", value: "Single"},
|
||||||
|
{text: "Group", value: "Group"},
|
||||||
|
{text: "AI", value: "AI"},
|
||||||
|
],
|
||||||
|
render: (text, record, index) => {
|
||||||
|
return i18next.t(`chat:${text}`);
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: i18next.t("chat:User1"),
|
title: i18next.t("chat:User1"),
|
||||||
dataIndex: "user1",
|
dataIndex: "user1",
|
||||||
|
@ -140,7 +140,7 @@ class MessageEditPage extends React.Component {
|
|||||||
</Row>
|
</Row>
|
||||||
<Row style={{marginTop: "20px"}} >
|
<Row style={{marginTop: "20px"}} >
|
||||||
<Col style={{marginTop: "5px"}} span={(Setting.isMobile()) ? 22 : 2}>
|
<Col style={{marginTop: "5px"}} span={(Setting.isMobile()) ? 22 : 2}>
|
||||||
{Setting.getLabel(i18next.t("message:Author"), i18next.t("general:Author - Tooltip"))} :
|
{Setting.getLabel(i18next.t("message:Author"), i18next.t("message:Author - Tooltip"))} :
|
||||||
</Col>
|
</Col>
|
||||||
<Col span={22} >
|
<Col span={22} >
|
||||||
<Select virtual={false} style={{width: "100%"}} value={this.state.message.author} onChange={(value => {this.updateMessageField("author", value);})}
|
<Select virtual={false} style={{width: "100%"}} value={this.state.message.author} onChange={(value => {this.updateMessageField("author", value);})}
|
||||||
|
Reference in New Issue
Block a user