Use new providerItem.

This commit is contained in:
Yang Luo
2021-06-14 21:35:19 +08:00
parent 9fe310f2b7
commit 5a852bfd1d
10 changed files with 132 additions and 82 deletions

View File

@ -38,7 +38,7 @@ class ProviderTable extends React.Component {
}
addRow(table) {
let row = {name: "", canSignUp: false, canSignIn: true, canUnbind: true};
let row = {name: "Please select a provider", canSignUp: false, canSignIn: true, canUnbind: true, alertType: "None"};
if (table === undefined) {
table = [];
}
@ -73,9 +73,11 @@ class ProviderTable extends React.Component {
value={text}
onChange={value => {
this.updateField(table, index, 'name', value);
const provider = this.props.providers.filter(provider => provider.name === value)[0];
this.updateField(table, index, 'provider', provider);
}} >
{
this.props.providers.map((provider, index) => <Option key={index} value={provider.name}>{provider.name}</Option>)
this.props.providers.filter(provider => table.filter(providerItem => providerItem.name === provider.name).length === 0).map((provider, index) => <Option key={index} value={provider.name}>{provider.name}</Option>)
}
</Select>
)
@ -125,6 +127,27 @@ class ProviderTable extends React.Component {
)
}
},
{
title: i18next.t("provider:alertType"),
dataIndex: 'alertType',
key: 'alertType',
width: '120px',
render: (text, record, index) => {
return (
<Select virtual={false} style={{width: '100%'}} value={text} onChange={(value => {
this.updateField(table, index, 'alertType', value);
})}>
{
[
{id: 'None', name: 'None'},
{id: 'Once', name: 'Once'},
{id: 'Always', name: 'Always'},
].map((item, index) => <Option key={index} value={item.id}>{item.name}</Option>)
}
</Select>
)
}
},
{
title: i18next.t("general:Action"),
key: 'action',