diff --git a/src/ts/containers/config/SensorConfigPopup.tsx b/src/ts/containers/config/SensorConfigPopup.tsx index b1114c0..0a7f322 100644 --- a/src/ts/containers/config/SensorConfigPopup.tsx +++ b/src/ts/containers/config/SensorConfigPopup.tsx @@ -57,18 +57,26 @@ export class SensorConfigPopup extends React.Component { console.log("aaaaaaa"); let os: OFRest = new OFRest("SensorItem", "List", c); var that: any = this; - os.Call().then(function (res) { - return res.json(); - }).then(function (json) { + os.CallWithCB(function (json: any) { let list = JSON.parse(json.resultStr); console.log(list); that.setState({ crawler: c, sensorItems: list, }); - }).catch(function (err) { - console.log(err); }); + // os.Call().then(function (res) { + // return res.json(); + // }).then(function (json) { + // let list = JSON.parse(json.resultStr); + // console.log(list); + // that.setState({ + // crawler: c, + // sensorItems: list, + // }); + // }).catch(function (err) { + // console.log(err); + // }); } @@ -172,16 +180,22 @@ export class CrawlerSelector extends React.Component { componentWillMount() { let os: OFRest = new OFRest("Crawler", "List", null); var that: any = this; - os.Call().then(function (res) { - return res.json(); - }).then(function (json) { + os.CallWithCB(function (json: any) { let list = JSON.parse(json.resultStr); that.setState({ crawlers: list, }); - }).catch(function (err) { - console.log(err); - }); + }) + // os.Call().then(function (res) { + // return res.json(); + // }).then(function (json) { + // let list = JSON.parse(json.resultStr); + // that.setState({ + // crawlers: list, + // }); + // }).catch(function (err) { + // console.log(err); + // }); } handleCrawlerChange = (event: any, index: any, v: number) => { @@ -203,17 +217,23 @@ export class CrawlerSelector extends React.Component { }); let os: OFRest = new OFRest("CrawlerinputitemMapping", "List", c); var that: any = this; - os.Call().then(function (res) { - return res.json(); - }).then(function (json) { - + os.CallWithCB(function (json: any) { var list = JSON.parse(json.resultStr); that.setState({ authInputs: list, }); - }).catch(function (err) { - console.log(err); }); + // os.Call().then(function (res) { + // return res.json(); + // }).then(function (json) { + + // var list = JSON.parse(json.resultStr); + // that.setState({ + // authInputs: list, + // }); + // }).catch(function (err) { + // console.log(err); + // }); } @@ -375,27 +395,27 @@ export class ConfirmPopup extends React.Component { sensor = { "target": this.props.target, "notification": "", - "interval" : 10, - "crawler" : this.props.crawler, + "interval": 10, + "crawler": this.props.crawler, } let os: OFRest = new OFRest("Sensor", "Create", sensor); var that: any = this; os.CallWithCB(function (json: any) { let retSensor = JSON.parse(json.resultStr); - let smlist :any[] = []; + let smlist: any[] = []; that.props.items.map((data: any, index: number) => { - var sm :any; + var sm: any; sm = { - "sensor" : retSensor, - "sensorItem":data, + "sensor": retSensor, + "sensorItem": data, } smlist.push(sm); }); let os2: OFRest = new OFRest("SensorItemMapping", "CreateAll", smlist); - os2.CallWithCB(function(json2 :any) { + os2.CallWithCB(function (json2: any) { console.log(json2); });