Skip to content

Commit

Permalink
[ISSUE #4770] Beta publish: change the way of select betaIps, from in…
Browse files Browse the repository at this point in the history
…put to select (#5493)

* change the way of select betaIps, from input to select

* solve the conflict and change the Select from mutiple to tag
  • Loading branch information
brotherlu-xcq authored Apr 27, 2021
1 parent 81c1e53 commit 72e5da6
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ class ConfigEditor extends React.Component {
type: 'text', // 配置格式
},
tagDataSource: [],
subscriberDataSource: [],
openAdvancedSettings: false,
};
this.successDialog = React.createRef();
Expand Down Expand Up @@ -113,6 +114,7 @@ class ConfigEditor extends React.Component {
betaPublishSuccess: true,
});
});
this.getSubscribesByNamespace();
}
);
} else {
Expand Down Expand Up @@ -378,6 +380,28 @@ class ConfigEditor extends React.Component {
});
}

getSubscribesByNamespace() {
const namespace = getParams('namespace');
const { dataId, group } = this.state.form;
const params = {
dataId,
group,
namespaceId: namespace,
tenant: namespace,
};
// get subscribes of the namespace
return request.get('v1/cs/configs/listener', { params }).then(res => {
const { subscriberDataSource } = this.state;
const lisentersGroupkeyIpMap = res.lisentersGroupkeyStatus;
if (lisentersGroupkeyIpMap) {
this.setState({
subscriberDataSource: subscriberDataSource.concat(Object.keys(lisentersGroupkeyIpMap)),
});
}
return res;
});
}

validation() {
const { locale } = this.props;
const { form } = this.state;
Expand Down Expand Up @@ -416,6 +440,7 @@ class ConfigEditor extends React.Component {
tabActiveKey,
dataIdError = {},
groupError = {},
subscriberDataSource,
} = this.state;
const { locale = {} } = this.props;

Expand Down Expand Up @@ -502,11 +527,16 @@ class ConfigEditor extends React.Component {
</Checkbox>
)}
{isBeta && (
<Input.TextArea
aria-label="TextArea"
placeholder="127.0.0.1,127.0.0.2"
value={betaIps}
onChange={betaIps => this.setState({ betaIps })}
<Select
size="medium"
hasArrow
autoWidth
mode="tag"
filterLocal
dataSource={subscriberDataSource}
onChange={betaIps => this.setState({ betaIps: betaIps.join(',') })}
hasClear
value={betaIps ? betaIps.split(',') : []}
/>
)}
</Form.Item>
Expand Down
6 changes: 3 additions & 3 deletions console/src/main/resources/static/js/main.js

Large diffs are not rendered by default.

0 comments on commit 72e5da6

Please sign in to comment.