Commit fec7dcd3 by Chaiwith Santaweesuk

update

parent 7662e6f1
asset-manifest.json,1564974104591,cd45f738f838f8321d66c508e52d5d0c59ce0896834ef3813e076ddb4520b8c7
precache-manifest.c7c9d1b5803c6f75bfbaa605e09aa6c9.js,1564974104591,1fc02edaf24ae3e3052851aa8f32db7d2de4c7c687e2f51f75bddc93fe5588bc
index.html,1564974104591,e0656e15c59068d9c7223f859e392a1cbb4e47e89b78505d27edd86fb0fe42e5
service-worker.js,1564974104591,45367706a77845d69463e2148e2019f888dfd8ce62b5ccb98837396a840627d8
static/css/2.6edff5b1.chunk.css,1564974104632,d22696c87c057d6462105312ce53dc1dda6a6df0d2a5152df235b068360b1ed4
static/js/main.b843d545.chunk.js,1564974104636,b67ce359253a48f82a48fef6d4aec29d916d93c2f86ab2226303f1dc7e7355bd
favicon.ico,1564974088076,b72f7455f00e4e58792d2bca892abb068e2213838c0316d6b7a0d6d16acd1955
static/js/runtime~main.a8a9905a.js,1564974104597,e1af5f94fdd13901b2e433d0d7607e27c01458151c35b1fe4b7feda2a32b7aa9
static/js/runtime~main.a8a9905a.js.map,1564974104634,c337bf8b58896da637a6e50ab8cfc779eb1ec42c55f8ec429030a03454a549db
static/css/2.6edff5b1.chunk.css.map,1564974104637,756daca795dac6b39811b15d55bd0d5ed0c7b27f065fb9cff5d1b23504658401
manifest.json,1564974088078,6aaf3d87dd9bb1e96f9c691c50d0ed378ed98a120a76dea78291281834cd36e9
static/js/main.b843d545.chunk.js.map,1564974104637,9115c97454fbb9957d50f7dd48fc3be905abfb5610c1aca00065dcd88f8a2828
static/css/main.892270f9.chunk.css,1564974104592,9b1083842a65b521a1aacf4e2c412c9555e58ac8ebb0f7d668afb5567de2357a
static/css/main.892270f9.chunk.css.map,1564974104637,985b0f0a0430978ddc9ba1c30a63c13fa83de2bb7881256e38fb6d3eeb5d80f9
static/js/2.81563c8d.chunk.js,1564974104634,b94b181fb5a0decf36c638cdb49b0a55d41bbfb75065eab50799bd212be38cd6
static/js/2.81563c8d.chunk.js.map,1564974104636,f4a0c9323fbb5bafab9efb9d26875fd4ee5059aafe93c1333352d58280f2389a
asset-manifest.json,1565344495169,c63270c08eba4be0484ec9a4b25cd746d091e7931d223d4c79e28e7ccba869ad
precache-manifest.79673cc56ffe9bf510cd3226c11e6a2e.js,1565344495169,30aae92244ac6f06c0a17ba2124fd3f2445a2128c8b072b06604e473e665eb73
index.html,1565344495169,6ddf8aacbc057fb4f21b14bc29347da57dd482d371d46ed2031f7c77af76c9be
service-worker.js,1565344495169,1c44047994852433edf9d795700f03530d6fd84e3ac59b01dedc7e8c50da9c72
manifest.json,1564985950299,851311324495b7eadd44a9e70f013e60f6ac9965a5a155cb4734894fd0e7dd5f
home.png,1564985950298,d3b21fd280b3304b29b980aab96dce3fb728c5a6c31f04c8dcf94480770e19ef
static/css/2.38695c78.chunk.css,1565344495230,df7c74b70fea8b04fd0985d5d2a2a2e7d14eb9920dbd0f99d131abbaf3fd44ce
static/css/2.38695c78.chunk.css.map,1565344495231,aee7adea8d3da5aba91a0208f66abdbbfcad0c53c36e3e69a24c51de68e4f62d
static/js/runtime~main.a8a9905a.js,1565344495171,e1af5f94fdd13901b2e433d0d7607e27c01458151c35b1fe4b7feda2a32b7aa9
static/js/main.4716eef6.chunk.js,1565344495231,434b3574704533438d5036e0f5b60eea96f353fa0b3d34532b9dd729cf769e61
static/js/runtime~main.a8a9905a.js.map,1565344495231,c337bf8b58896da637a6e50ab8cfc779eb1ec42c55f8ec429030a03454a549db
static/css/main.c94301d0.chunk.css,1565344495235,00fbfa1817afa31b3a27f9eab05eae40122f5440989ea818626bec07a47ecc0f
static/js/main.4716eef6.chunk.js.map,1565344495231,e51217250853db537f46cf99f09e3738f91600da42722f6d7b375ac66c773836
static/css/main.c94301d0.chunk.css.map,1565344495231,a79f7122311c1133cf74cf1d451194d507ecc6a055db9e42ecaca05c74b3f6a7
static/js/2.b700a521.chunk.js,1565344495231,f0ab74577c3b1b1742426e216085da178ca07c3fbc823d1618eeb09223875cb4
static/js/2.b700a521.chunk.js.map,1565344495235,9b4bd93b2ff15b97b8fda6612b24a01871901e1a36f1914ec356d27d45065d45
......@@ -299,7 +299,7 @@ class Home extends Component {
},
],
tags: {
attr: ['Keycards'],
attr: ['Keycard'],
},
aggregators: [
{
......@@ -319,13 +319,14 @@ class Home extends Component {
axios.defaults.headers.common['Authorization'] = `Bearer ${userToken}`;
const response = await axios.post(kairosUrl, q_data);
const [currentFeed, revenueFeed, remoteFeed, peopleFeed, fingerPrintFeed, keycardFeed] = [
response.data.queries[0].results[0].values,
response.data.queries[1].results[0].values,
response.data.queries[2].results[0].values,
response.data.queries[3].results[0].values,
response.data.queries[4].results[0].values,
response.data.queries[4].results[0].values,
response.data.queries[0].results[0].values || [],
response.data.queries[1].results[0].values || [],
response.data.queries[2].results[0].values || [],
response.data.queries[3].results[0].values || [],
response.data.queries[4].results[0].values || [],
response.data.queries[5].results[0].values || [],
];
console.log(11111)
this.setState({
currentFeed,
......@@ -334,27 +335,27 @@ class Home extends Component {
remoteFeed,
keycardFeed,
revenueFeed,
currentLast: Math.round(currentFeed[currentFeed.length - 1][1] * 100) / 100,
revenueTotal: Math.round(this.getTotal(revenueFeed) * 100) / 100,
revenueMax: Math.round(this.getMax(revenueFeed) * 100) / 100,
revenueMin: Math.round(this.getMin(revenueFeed) * 100) / 100,
revenueAvg: Math.round(this.getAvg(revenueFeed) * 100) / 100,
peopleTotal: Math.round(this.getTotal(peopleFeed) * 100) / 100,
peopleMax: Math.round(this.getMax(peopleFeed) * 100) / 100,
peopleMin: Math.round(this.getMin(peopleFeed) * 100) / 100,
peopleAvg: Math.round(this.getAvg(peopleFeed) * 100) / 100,
remoteTotal: Math.round(this.getTotal(remoteFeed) * 100) / 100,
remoteMax: Math.round(this.getMax(remoteFeed) * 100) / 100,
remoteMin: Math.round(this.getMin(remoteFeed) * 100) / 100,
remoteAvg: Math.round(this.getAvg(remoteFeed) * 100) / 100,
fingerPrintTotal: Math.round(this.getTotal(fingerPrintFeed) * 100) / 100,
fingerPrintMax: Math.round(this.getMax(fingerPrintFeed) * 100) / 100,
fingerPrintMin: Math.round(this.getMin(fingerPrintFeed) * 100) / 100,
fingerPrintAvg: Math.round(this.getAvg(fingerPrintFeed) * 100) / 100,
keycardTotal: Math.round(this.getTotal(keycardFeed) * 100) / 100,
keycardMax: Math.round(this.getMax(keycardFeed) * 100) / 100,
keycardMin: Math.round(this.getMin(keycardFeed) * 100) / 100,
keycardAvg: Math.round(this.getAvg(keycardFeed) * 100) / 100,
currentLast: currentFeed.length >0 ? Math.round(currentFeed[currentFeed.length - 1][1] * 100) / 100 : "-",
revenueTotal: revenueFeed.length >0 ? Math.round(this.getTotal(revenueFeed) * 100) / 100 : "-",
revenueMax: revenueFeed.length >0 ? Math.round(this.getMax(revenueFeed) * 100) / 100 : "-",
revenueMin: revenueFeed.length >0 ? Math.round(this.getMin(revenueFeed) * 100) / 100 : "-",
revenueAvg: revenueFeed.length >0 ? Math.round(this.getAvg(revenueFeed) * 100) / 100 : "-",
peopleTotal: peopleFeed.length >0 ? Math.round(this.getTotal(peopleFeed) * 100) / 100 : "-",
peopleMax: peopleFeed.length >0 ? Math.round(this.getMax(peopleFeed) * 100) / 100 : "-",
peopleMin: peopleFeed.length >0 ? Math.round(this.getMin(peopleFeed) * 100) / 100 : "-",
peopleAvg: peopleFeed.length >0 ? Math.round(this.getAvg(peopleFeed) * 100) / 100 : "-",
remoteTotal: remoteFeed.length >0 ? Math.round(this.getTotal(remoteFeed) * 100) / 100 : "-",
remoteMax: remoteFeed.length >0 ? Math.round(this.getMax(remoteFeed) * 100) / 100 : "-",
remoteMin: remoteFeed.length >0 ? Math.round(this.getMin(remoteFeed) * 100) / 100 : "-",
remoteAvg: remoteFeed.length >0 ? Math.round(this.getAvg(remoteFeed) * 100) / 100 : "-",
fingerPrintTotal: fingerPrintFeed.length >0 ? Math.round(this.getTotal(fingerPrintFeed) * 100) / 100 : "-",
fingerPrintMax: fingerPrintFeed.length >0 ? Math.round(this.getMax(fingerPrintFeed) * 100) / 100 : "-",
fingerPrintMin: fingerPrintFeed.length >0 ? Math.round(this.getMin(fingerPrintFeed) * 100) / 100 : "-",
fingerPrintAvg: fingerPrintFeed.length >0 ? Math.round(this.getAvg(fingerPrintFeed) * 100) / 100 : "-",
keycardTotal: keycardFeed.length >0 ? Math.round(this.getTotal(keycardFeed) * 100) / 100 : "-",
keycardMax: keycardFeed.length >0 ? Math.round(this.getMax(keycardFeed) * 100) / 100 : "-",
keycardMin: keycardFeed.length >0 ? Math.round(this.getMin(keycardFeed) * 100) / 100 : "-",
keycardAvg: keycardFeed.length >0 ? Math.round(this.getAvg(keycardFeed) * 100) / 100 : "-",
table: this.getTable(
this.state.allDeviceInfo[this.state.allDevicesId.indexOf(deviceId || this.state.allDevicesId[0])]
.name,
......@@ -409,18 +410,19 @@ class Home extends Component {
return total;
};
getTable = (site, data) => {
let table = [];
for (let i = 0, len = data[1].length; i < len; i++) {
let v = {
site: site,
people: data[0][i][1],
revenue: data[1][i][1],
remote: data[2][i][1],
fingerPrint: data[3][i][1],
keycard: data[4][i][1],
current: data[5][i][1],
timestamp: moment(data[1][i][0]).format('D/M/YY HH:mm'),
people: data[0].length >0 ? data[0][i][1] : "",
revenue: data[1].length >0 ? data[1][i][1] : "",
remote: data[2].length >0 ? data[2][i][1] : "",
fingerPrint: data[3].length >0 ? data[3][i][1] : "",
keycard: data[4].length >0 ? data[4][i][1] : "",
current: data[5].length >0 ? data[5][i][1] : "",
timestamp: data[5].length >0 && moment(data[1][i][0]).format('D/M/YY HH:mm'),
};
table.unshift(v);
}
......
......@@ -46,11 +46,10 @@ export default class DataTable extends React.PureComponent {
</tr>
);
});
return (
<Col>
<Row style={{ marginLeft: 1 }}>
<CSVLink data={data} filename={'data-table'}>
<CSVLink data={data} filename={currentItem.length>0 && currentItem[0].site+".csv"}>
<Button variant="outline-dark" style={{ marginTop: '.5em' }}>
<FaFileCsv style={{ margin: '0 2 5 0' }} />
Export to CSV
......
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