Commit c620d4c0 authored by Jérémy Jaouen's avatar Jérémy Jaouen
Browse files

clean Wizard: Poller Front-End part

parent d83569f9
...@@ -31,12 +31,17 @@ class PollerStepOneRoute extends Component { ...@@ -31,12 +31,17 @@ class PollerStepOneRoute extends Component {
state = { state = {
error: null, error: null,
waitList: null, waitList: null,
defaultCentralIp: null,
}; };
wizardFormWaitListApi = axios( wizardFormWaitListApi = axios(
'internal.php?object=centreon_configuration_remote&action=getPollerWaitList', 'internal.php?object=centreon_configuration_remote&action=getPollerWaitList',
); );
wizardFormDefaultCentralApi = axios(
'internal.php?object=centreon_configuration_remote&action=getCentralDefaultIp',
);
getWaitList = () => { getWaitList = () => {
this.wizardFormWaitListApi this.wizardFormWaitListApi
.post() .post()
...@@ -48,8 +53,20 @@ class PollerStepOneRoute extends Component { ...@@ -48,8 +53,20 @@ class PollerStepOneRoute extends Component {
}); });
}; };
getDefaultCentralIp = () => {
this.wizardFormDefaultCentralApi
.post()
.then((response) => {
this.setState({ defaultCentralIp: response.data})
})
.catch(() => {
this.setState({ defaultCentralIp: null });
});
}
componentDidMount = () => { componentDidMount = () => {
this.getWaitList(); this.getWaitList();
this.getDefaultCentralIp();
}; };
handleSubmit = (data) => { handleSubmit = (data) => {
...@@ -60,12 +77,12 @@ class PollerStepOneRoute extends Component { ...@@ -60,12 +77,12 @@ class PollerStepOneRoute extends Component {
render() { render() {
const { links } = this; const { links } = this;
const { waitList } = this.state; const { waitList, defaultCentralIp } = this.state;
return ( return (
<BaseWizard> <BaseWizard>
<ProgressBar links={links} /> <ProgressBar links={links} />
<Form <Form
initialValues={{}} initialValues={{centreon_central_ip: defaultCentralIp}}
waitList={waitList} waitList={waitList}
onSubmit={this.handleSubmit.bind(this)} onSubmit={this.handleSubmit.bind(this)}
/> />
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment