chagned rest
This commit is contained in:
parent
97e567bcd5
commit
4575b6c2e7
@ -57,18 +57,26 @@ export class SensorConfigPopup extends React.Component<any, any> {
|
|||||||
console.log("aaaaaaa");
|
console.log("aaaaaaa");
|
||||||
let os: OFRest = new OFRest("SensorItem", "List", c);
|
let os: OFRest = new OFRest("SensorItem", "List", c);
|
||||||
var that: any = this;
|
var that: any = this;
|
||||||
os.Call().then(function (res) {
|
os.CallWithCB(function (json: any) {
|
||||||
return res.json();
|
|
||||||
}).then(function (json) {
|
|
||||||
let list = JSON.parse(json.resultStr);
|
let list = JSON.parse(json.resultStr);
|
||||||
console.log(list);
|
console.log(list);
|
||||||
that.setState({
|
that.setState({
|
||||||
crawler: c,
|
crawler: c,
|
||||||
sensorItems: list,
|
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() {
|
componentWillMount() {
|
||||||
let os: OFRest = new OFRest("Crawler", "List", null);
|
let os: OFRest = new OFRest("Crawler", "List", null);
|
||||||
var that: any = this;
|
var that: any = this;
|
||||||
os.Call().then(function (res) {
|
os.CallWithCB(function (json: any) {
|
||||||
return res.json();
|
|
||||||
}).then(function (json) {
|
|
||||||
let list = JSON.parse(json.resultStr);
|
let list = JSON.parse(json.resultStr);
|
||||||
that.setState({
|
that.setState({
|
||||||
crawlers: list,
|
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) => {
|
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);
|
let os: OFRest = new OFRest("CrawlerinputitemMapping", "List", c);
|
||||||
var that: any = this;
|
var that: any = this;
|
||||||
os.Call().then(function (res) {
|
os.CallWithCB(function (json: any) {
|
||||||
return res.json();
|
|
||||||
}).then(function (json) {
|
|
||||||
|
|
||||||
var list = JSON.parse(json.resultStr);
|
var list = JSON.parse(json.resultStr);
|
||||||
that.setState({
|
that.setState({
|
||||||
authInputs: list,
|
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 = {
|
sensor = {
|
||||||
"target": this.props.target,
|
"target": this.props.target,
|
||||||
"notification": "",
|
"notification": "",
|
||||||
"interval" : 10,
|
"interval": 10,
|
||||||
"crawler" : this.props.crawler,
|
"crawler": this.props.crawler,
|
||||||
}
|
}
|
||||||
|
|
||||||
let os: OFRest = new OFRest("Sensor", "Create", sensor);
|
let os: OFRest = new OFRest("Sensor", "Create", sensor);
|
||||||
var that: any = this;
|
var that: any = this;
|
||||||
os.CallWithCB(function (json: any) {
|
os.CallWithCB(function (json: any) {
|
||||||
let retSensor = JSON.parse(json.resultStr);
|
let retSensor = JSON.parse(json.resultStr);
|
||||||
let smlist :any[] = [];
|
let smlist: any[] = [];
|
||||||
that.props.items.map((data: any, index: number) => {
|
that.props.items.map((data: any, index: number) => {
|
||||||
var sm :any;
|
var sm: any;
|
||||||
sm = {
|
sm = {
|
||||||
"sensor" : retSensor,
|
"sensor": retSensor,
|
||||||
"sensorItem":data,
|
"sensorItem": data,
|
||||||
}
|
}
|
||||||
smlist.push(sm);
|
smlist.push(sm);
|
||||||
});
|
});
|
||||||
|
|
||||||
let os2: OFRest = new OFRest("SensorItemMapping", "CreateAll", smlist);
|
let os2: OFRest = new OFRest("SensorItemMapping", "CreateAll", smlist);
|
||||||
|
|
||||||
os2.CallWithCB(function(json2 :any) {
|
os2.CallWithCB(function (json2: any) {
|
||||||
console.log(json2);
|
console.log(json2);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user