chagned rest

This commit is contained in:
snoop 2017-06-09 20:21:25 +09:00
parent 97e567bcd5
commit 4575b6c2e7

View File

@ -57,18 +57,26 @@ export class SensorConfigPopup extends React.Component<any, any> {
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<any, any> {
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<any, any> {
});
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<any, any> {
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);
});