mirror of
https://github.com/casdoor/casdoor.git
synced 2025-05-24 08:20:31 +08:00
Add isKey to syncer's table
This commit is contained in:
parent
558bcf95d6
commit
3cb46c3628
@ -25,6 +25,7 @@ type TableColumn struct {
|
|||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Type string `json:"type"`
|
Type string `json:"type"`
|
||||||
CasdoorName string `json:"casdoorName"`
|
CasdoorName string `json:"casdoorName"`
|
||||||
|
IsKey bool `json:"isKey"`
|
||||||
IsHashed bool `json:"isHashed"`
|
IsHashed bool `json:"isHashed"`
|
||||||
Values []string `json:"values"`
|
Values []string `json:"values"`
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ class SyncerTableColumnTable extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
addRow(table) {
|
addRow(table) {
|
||||||
const row = {name: `column${table.length}`, type: "string", values: []};
|
const row = {name: `column${table.length}`, type: "string", values: [], isKey: table.filter(row => row.isKey).length === 0};
|
||||||
if (table === undefined) {
|
if (table === undefined) {
|
||||||
table = [];
|
table = [];
|
||||||
}
|
}
|
||||||
@ -107,6 +107,26 @@ class SyncerTableColumnTable extends React.Component {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: i18next.t("syncer:Is key"),
|
||||||
|
dataIndex: "isKey",
|
||||||
|
key: "isKey",
|
||||||
|
render: (text, record, index) => {
|
||||||
|
return (
|
||||||
|
<Switch checked={text} onChange={checked => {
|
||||||
|
if (!record.isKey && checked) {
|
||||||
|
table.forEach((row, i) => {
|
||||||
|
this.updateField(table, i, "isKey", false);
|
||||||
|
});
|
||||||
|
} else if (record.isKey && !checked) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.updateField(table, index, "isKey", checked);
|
||||||
|
}} />
|
||||||
|
);
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: i18next.t("syncer:Is hashed"),
|
title: i18next.t("syncer:Is hashed"),
|
||||||
dataIndex: "isHashed",
|
dataIndex: "isHashed",
|
||||||
@ -133,7 +153,7 @@ class SyncerTableColumnTable extends React.Component {
|
|||||||
<Button style={{marginRight: "5px"}} disabled={index === table.length - 1} icon={<DownOutlined />} size="small" onClick={() => this.downRow(table, index)} />
|
<Button style={{marginRight: "5px"}} disabled={index === table.length - 1} icon={<DownOutlined />} size="small" onClick={() => this.downRow(table, index)} />
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
<Tooltip placement="topLeft" title={i18next.t("general:Delete")}>
|
<Tooltip placement="topLeft" title={i18next.t("general:Delete")}>
|
||||||
<Button icon={<DeleteOutlined />} size="small" onClick={() => this.deleteRow(table, index)} />
|
<Button icon={<DeleteOutlined />} disabled={record.isKey && table.length > 1} size="small" onClick={() => this.deleteRow(table, index)} />
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user