Commit 4f49b647 by OuiAtichat

update init data

parent 9a5bda28
...@@ -117,6 +117,11 @@ class Home extends Component { ...@@ -117,6 +117,11 @@ class Home extends Component {
isLoading: true, isLoading: true,
}; };
looper = null; looper = null;
startDate = moment()
.startOf('day')
.valueOf();
endDate = moment().valueOf();
componentDidMount = async () => { componentDidMount = async () => {
await this.getConfig(); await this.getConfig();
await this.getCurrentUser(); await this.getCurrentUser();
...@@ -183,17 +188,17 @@ class Home extends Component { ...@@ -183,17 +188,17 @@ class Home extends Component {
getFeedData = async ( getFeedData = async (
deviceId, deviceId,
selectedRange = { selectedRange = { startDate: this.startDate, endDate: this.endDate },
startDate: moment()
.subtract(1, 'days')
.valueOf(),
endDate: moment().valueOf(),
},
breakdown = 'minutes' breakdown = 'minutes'
) => { ) => {
const { kairosUrl, userToken } = this.state; const { kairosUrl, userToken } = this.state;
const { startDate, endDate } = selectedRange; const { startDate, endDate } = selectedRange;
const now = moment().valueOf(); const now = moment().valueOf();
// console.log('now', moment(now).format('D/M/YY HH:mm'));
// console.log('end', moment(endDate).format('D/M/YY HH:mm'));
// console.log('start', moment(startDate).format('D/M/YY HH:mm'));
// console.log(label);
let q_data = { let q_data = {
start_absolute: startDate || now, start_absolute: startDate || now,
end_absolute: endDate || now, end_absolute: endDate || now,
...@@ -331,7 +336,7 @@ class Home extends Component { ...@@ -331,7 +336,7 @@ class Home extends Component {
revenue: data[4].values[i][1], revenue: data[4].values[i][1],
remote: data[2].values[i][1], remote: data[2].values[i][1],
current: data[5].values[i][1], current: data[5].values[i][1],
timestamp: moment(data[1].values[i][0]).format('D/M/YY H:mm'), timestamp: moment(data[1].values[i][0]).format('D/M/YY HH:mm'),
}; };
table.unshift(v); table.unshift(v);
......
...@@ -20,6 +20,10 @@ class GetDataSelection extends PureComponent { ...@@ -20,6 +20,10 @@ class GetDataSelection extends PureComponent {
}; };
getSelectedRange = selectedRange => { getSelectedRange = selectedRange => {
// console.log('start', moment(selectedRange.startDate).format('D/M/YY HH:mm'));
// console.log('end', moment(selectedRange.endDate).format('D/M/YY HH:mm'));
// console.log('current', moment().format('D/M/YY HH:mm'));
this.setState({ range: selectedRange }); this.setState({ range: selectedRange });
}; };
......
Markdown is supported
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