Add more fields to syncer.

This commit is contained in:
Gucheng Wang
2021-12-17 20:33:03 +08:00
parent c2110ef59d
commit 07f9a9ee96
4 changed files with 84 additions and 21 deletions

View File

@ -13,7 +13,8 @@
// limitations under the License.
import React from "react";
import {Button, Card, Col, Input, InputNumber, Row, Select} from 'antd';
import {Button, Card, Col, Input, InputNumber, Row, Select, Switch} from 'antd';
import {LinkOutlined} from "@ant-design/icons";
import * as SyncerBackend from "./backend/SyncerBackend";
import * as OrganizationBackend from "./backend/OrganizationBackend";
import * as Setting from "./Setting";
@ -176,6 +177,26 @@ class SyncerEditPage extends React.Component {
}} />
</Col>
</Row>
<Row style={{marginTop: '20px'}} >
<Col style={{marginTop: '5px'}} span={(Setting.isMobile()) ? 22 : 2}>
{Setting.getLabel(i18next.t("syncer:Affiliation table"), i18next.t("syncer:Affiliation table - Tooltip"))} :
</Col>
<Col span={22} >
<Input value={this.state.syncer.affiliationTable} onChange={e => {
this.updateSyncerField('affiliationTable', e.target.value);
}} />
</Col>
</Row>
<Row style={{marginTop: '20px'}} >
<Col style={{marginTop: '5px'}} span={(Setting.isMobile()) ? 22 : 2}>
{Setting.getLabel(i18next.t("syncer:Avatar base URL"), i18next.t("syncer:Avatar base URL - Tooltip"))} :
</Col>
<Col span={22} >
<Input prefix={<LinkOutlined/>} value={this.state.syncer.avatarBaseUrl} onChange={e => {
this.updateSyncerField('avatarBaseUrl', e.target.value);
}} />
</Col>
</Row>
<Row style={{marginTop: '20px'}} >
<Col style={{marginTop: '5px'}} span={(Setting.isMobile()) ? 22 : 2}>
{Setting.getLabel(i18next.t("syncer:Sync interval"), i18next.t("syncer:Sync interval - Tooltip"))} :
@ -186,6 +207,16 @@ class SyncerEditPage extends React.Component {
}} />
</Col>
</Row>
<Row style={{marginTop: '20px'}} >
<Col style={{marginTop: '5px'}} span={(Setting.isMobile()) ? 19 : 2}>
{Setting.getLabel(i18next.t("syncer:Is enabled"), i18next.t("syncer:Is enabled - Tooltip"))} :
</Col>
<Col span={1} >
<Switch checked={this.state.syncer.isEnabled} onChange={checked => {
this.updateSyncerField('isEnabled', checked);
}} />
</Col>
</Row>
</Card>
)
}

View File

@ -14,7 +14,7 @@
import React from "react";
import {Link} from "react-router-dom";
import {Button, Popconfirm, Table} from 'antd';
import {Button, Popconfirm, Switch, Table} from 'antd';
import moment from "moment";
import * as Setting from "./Setting";
import * as SyncerBackend from "./backend/SyncerBackend";
@ -102,7 +102,7 @@ class SyncerListPage extends React.Component {
title: i18next.t("general:Organization"),
dataIndex: 'organization',
key: 'organization',
width: '80px',
width: '120px',
sorter: (a, b) => a.organization.localeCompare(b.organization),
render: (text, record, index) => {
return (
@ -141,58 +141,70 @@ class SyncerListPage extends React.Component {
title: i18next.t("provider:Type"),
dataIndex: 'type',
key: 'type',
width: '150px',
width: '100px',
sorter: (a, b) => a.type.localeCompare(b.type),
},
{
title: i18next.t("provider:Host"),
dataIndex: 'host',
key: 'host',
width: '150px',
width: '120px',
sorter: (a, b) => a.host.localeCompare(b.host),
},
{
title: i18next.t("provider:Port"),
dataIndex: 'port',
key: 'port',
width: '150px',
width: '100px',
sorter: (a, b) => a.port - b.port,
},
{
title: i18next.t("general:User"),
dataIndex: 'user',
key: 'user',
width: '150px',
width: '120px',
sorter: (a, b) => a.user.localeCompare(b.user),
},
{
title: i18next.t("general:Password"),
dataIndex: 'password',
key: 'password',
width: '150px',
width: '120px',
sorter: (a, b) => a.password.localeCompare(b.password),
},
{
title: i18next.t("syncer:Database"),
dataIndex: 'database',
key: 'database',
width: '150px',
width: '120px',
sorter: (a, b) => a.database.localeCompare(b.database),
},
{
title: i18next.t("syncer:Table"),
dataIndex: 'table',
key: 'table',
width: '150px',
width: '120px',
sorter: (a, b) => a.table.localeCompare(b.table),
},
{
title: i18next.t("syncer:Sync interval"),
dataIndex: 'syncInterval',
key: 'syncInterval',
width: '150px',
width: '120px',
sorter: (a, b) => a.syncInterval.localeCompare(b.syncInterval),
},
{
title: i18next.t("record:Is Enabled"),
dataIndex: 'isEnabled',
key: 'isEnabled',
width: '120px',
sorter: (a, b) => a.isEnabled - b.isEnabled,
render: (text, record, index) => {
return (
<Switch disabled checkedChildren="ON" unCheckedChildren="OFF" checked={text} />
)
}
},
{
title: i18next.t("general:Action"),
dataIndex: '',