Commit 6411fe48 by chaiwith

edit

parent 9469f3eb
asset-manifest.json,1605243132440,d2f1e132508d7cdeebeaf4bc3b9787340f1d9dcc4ac14d73d877955c2844671c asset-manifest.json,1608201719983,4311bcfe157eca0e607d0b1b9a6c008458892a9ebb5c85c8ce933a1b92457a3d
index.html,1605243132440,2bcc37deeaee8b13d15b5aca518ec05bfb2d78f4dd81b6cb0f018674bec0516c index.html,1608201719983,ffb94fba807422de69124443a5f1ce0fd530152d0487ecd46e979ca75f53ff84
precache-manifest.58b2596f691c759411749af88323c226.js,1608201719983,645c897837ff7df88cff110500e4bde4ed97ec0f64838ecf411bd7555b3e9692
service-worker.js,1608201719983,ddda72dfd21b30811fa90070111738db19391cb7421c8db93124c65a7dcfd759
manifest.json,1581659498318,851311324495b7eadd44a9e70f013e60f6ac9965a5a155cb4734894fd0e7dd5f manifest.json,1581659498318,851311324495b7eadd44a9e70f013e60f6ac9965a5a155cb4734894fd0e7dd5f
precache-manifest.996ba568d32bddcfda581cd8f4947f6f.js,1605243132440,19a4943d4d8f7bbede7212ea0a241a9aeb1a29fc10f564b778db471d6aa1b02d
home.png,1581659498317,d3b21fd280b3304b29b980aab96dce3fb728c5a6c31f04c8dcf94480770e19ef home.png,1581659498317,d3b21fd280b3304b29b980aab96dce3fb728c5a6c31f04c8dcf94480770e19ef
service-worker.js,1605243132440,c1ee96658a04cee978337779d182cb6c2b09faa5f7e51e61ef23a7afb56d3dda static/css/2.38695c78.chunk.css,1608201720047,df7c74b70fea8b04fd0985d5d2a2a2e7d14eb9920dbd0f99d131abbaf3fd44ce
static/css/2.38695c78.chunk.css,1605243132446,df7c74b70fea8b04fd0985d5d2a2a2e7d14eb9920dbd0f99d131abbaf3fd44ce static/css/2.38695c78.chunk.css.map,1608201720046,aee7adea8d3da5aba91a0208f66abdbbfcad0c53c36e3e69a24c51de68e4f62d
static/css/2.38695c78.chunk.css.map,1605243132577,aee7adea8d3da5aba91a0208f66abdbbfcad0c53c36e3e69a24c51de68e4f62d static/js/main.89c989fc.chunk.js,1608201720043,ae09ce40418e14327143eb558d312ef38f2c7ddcac9c70352ba737c97eedfa64
static/js/main.263f7fb4.chunk.js,1605243132444,7a44b3a161a6c0007ef9d8ce39d4652f0f06660b73cf24192b076250baa003b2 static/js/runtime~main.a8a9905a.js,1608201720042,e1af5f94fdd13901b2e433d0d7607e27c01458151c35b1fe4b7feda2a32b7aa9
static/js/runtime~main.a8a9905a.js,1605243132569,e1af5f94fdd13901b2e433d0d7607e27c01458151c35b1fe4b7feda2a32b7aa9 static/js/runtime~main.a8a9905a.js.map,1608201720042,c337bf8b58896da637a6e50ab8cfc779eb1ec42c55f8ec429030a03454a549db
static/js/runtime~main.a8a9905a.js.map,1605243132577,c337bf8b58896da637a6e50ab8cfc779eb1ec42c55f8ec429030a03454a549db static/css/main.93c33a43.chunk.css,1608201719984,20bf61433c569ccd069908c4e498759cb46dfccb12d8bf1aba9ccb8e61bd8b86
static/css/main.93c33a43.chunk.css,1605243132577,20bf61433c569ccd069908c4e498759cb46dfccb12d8bf1aba9ccb8e61bd8b86 static/js/main.89c989fc.chunk.js.map,1608201720047,24da47be14a72c729eb2dbbd328692faa6145a4ed87e093a3c03f63e9e0df6af
static/js/main.263f7fb4.chunk.js.map,1605243132569,f8dc8cf94f4e21d902ef46311906b41ae209f1c4e5d12925c5b32add6edff523 static/css/main.93c33a43.chunk.css.map,1608201720047,a48d1e6da1a0ce76bde9786f2a1e10b880e0c11d0a38b09e296cfe0c4ac41c87
static/css/main.93c33a43.chunk.css.map,1605243132569,a48d1e6da1a0ce76bde9786f2a1e10b880e0c11d0a38b09e296cfe0c4ac41c87 static/js/2.7488e465.chunk.js,1608201720042,d47d11850f67a2ddbf32ab3dd3c8e0fc31473f9e8bfe26d96817584ed0b46da3
static/js/2.7488e465.chunk.js,1605243132580,d47d11850f67a2ddbf32ab3dd3c8e0fc31473f9e8bfe26d96817584ed0b46da3 static/js/2.7488e465.chunk.js.map,1608201720046,31668e9fd572484d3033bcf7d096193195126f438c3c88256d1a53cec52ddaf8
static/js/2.7488e465.chunk.js.map,1605243132576,31668e9fd572484d3033bcf7d096193195126f438c3c88256d1a53cec52ddaf8
...@@ -24,12 +24,19 @@ export const getFeedData = () => async (dispatch, getState) => { ...@@ -24,12 +24,19 @@ export const getFeedData = () => async (dispatch, getState) => {
const { fireStoreReducer, selectedFeedReducer } = getState(); const { fireStoreReducer, selectedFeedReducer } = getState();
const { kairosUrl, userToken } = fireStoreReducer.fireStoreConfig; const { kairosUrl, userToken } = fireStoreReducer.fireStoreConfig;
const { devices, range, breakdown, location } = selectedFeedReducer.selectedFeed; const { devices, range, breakdown, location } = selectedFeedReducer.selectedFeed;
const optiontimestamp = {
minutes:1000*60*5,
hours:1000*60*60,
days:1000*60*60*24,
weeks:1000*60*60*24*7,
months:1000*60*60*24*31,
}
// let momentRange = extendMoment(moment); // let momentRange = extendMoment(moment);
let attrList; let attrList;
let metrics = []; let metrics = [];
let oldBreakdown = breakdown;
devices.forEach(device => { devices.forEach(device => {
if (location == "eLNvYvm6YT8LTHrCA7Ne" || location == "fKtBvZyBArnTdlMRXOY0" || location == "yb1udKQSTGBFHKn1m5MQ" || location == "rJLbWBPZoJof30KCE07h" || location == "ZMfFDqiAJhXDqRVopTCT" || location == "hWHZMc1dbzjxDuNeIMYf" || location == "sfE95i3WDGy7W4k5pc9T" || location == "uX8Cq15AkjWgVXqWCbdf" || location == "yILqREcDQu85AD1wGyBP" || location == "1ppp1nJuBlNLOpl67dtZ" || location == "9u2ATildmRThi3eA5zMz" || location == "MIenGAtMgckindwrPE6A" || location == "vP59HiIEhvDooBSV1klc" || location == "mcE8DirvsQhUMdL09nNb" || location == "yXjV2x9uKgYa0DpQHRJ3" || location == "yXQPQvuL64vlD0TfJ3lE" || location == "ue2AxjvfFh7IxeV3iOXS" || location == "n0rIiEhHx7Hd9R3N5abU" || location == "RogL7WhBNwkwSNAlPt8X" || location == "FLDNnlycMGBW9ndP84DP" || location == "fRQvPi3NknMcT7o4LefP" || location == "WsDBpCKW0SJThukN1HvE" || location == "T9sfsC0PdX1E5qm32zxV" || location == "bts8v0Sw9nH6DrY1rDqu" if (location == "eLNvYvm6YT8LTHrCA7Ne" || location == "fKtBvZyBArnTdlMRXOY0" || location == "yb1udKQSTGBFHKn1m5MQ" || location == "rJLbWBPZoJof30KCE07h" || location == "ZMfFDqiAJhXDqRVopTCT" || location == "hWHZMc1dbzjxDuNeIMYf" || location == "sfE95i3WDGy7W4k5pc9T" || location == "uX8Cq15AkjWgVXqWCbdf" || location == "yILqREcDQu85AD1wGyBP" || location == "1ppp1nJuBlNLOpl67dtZ" || location == "9u2ATildmRThi3eA5zMz" || location == "MIenGAtMgckindwrPE6A" || location == "vP59HiIEhvDooBSV1klc" || location == "mcE8DirvsQhUMdL09nNb" || location == "yXjV2x9uKgYa0DpQHRJ3" || location == "yXQPQvuL64vlD0TfJ3lE" || location == "ue2AxjvfFh7IxeV3iOXS" || location == "n0rIiEhHx7Hd9R3N5abU" || location == "RogL7WhBNwkwSNAlPt8X" || location == "FLDNnlycMGBW9ndP84DP" || location == "fRQvPi3NknMcT7o4LefP" || location == "WsDBpCKW0SJThukN1HvE" || location == "T9sfsC0PdX1E5qm32zxV" || location == "bts8v0Sw9nH6DrY1rDqu" || location == "1IKI77wv6ZK6ptRUR9nQ"
) { ) {
attrList = [ attrList = [
// { tag: "['Current Cash']", aggregator: 'last' }, // { tag: "['Current Cash']", aggregator: 'last' },
...@@ -53,8 +60,9 @@ export const getFeedData = () => async (dispatch, getState) => { ...@@ -53,8 +60,9 @@ export const getFeedData = () => async (dispatch, getState) => {
{ tag: 'Keycard', aggregator: 'sum' } { tag: 'Keycard', aggregator: 'sum' }
] ]
} }
let newBreakdown = breakdown != "minutes" ? "hours" : breakdown let newBreakdown = breakdown != "minutes" ? "hours" : breakdown
console.log("newBreakdown", newBreakdown) // console.log("newBreakdown", newBreakdown)
attrList.forEach(element => { attrList.forEach(element => {
const metric = { const metric = {
name: device, name: device,
...@@ -80,9 +88,17 @@ export const getFeedData = () => async (dispatch, getState) => { ...@@ -80,9 +88,17 @@ export const getFeedData = () => async (dispatch, getState) => {
metrics.push(metric); metrics.push(metric);
}); });
}); });
let start =range.startDate-optiontimestamp[oldBreakdown]
let end = range.endDate
// console.log("oldBreakdown",oldBreakdown)
// console.log("optiontimestamp[oldBreakdown]",optiontimestamp[oldBreakdown])
// console.log("range.startDate",range.startDate)
// console.log("start",start)
// console.log("end",end)
const q_data = { const q_data = {
start_absolute: range.startDate, start_absolute: start,
end_absolute: range.endDate, end_absolute: end,
metrics: metrics metrics: metrics
}; };
try { try {
...@@ -101,10 +117,10 @@ export const getFeedData = () => async (dispatch, getState) => { ...@@ -101,10 +117,10 @@ export const getFeedData = () => async (dispatch, getState) => {
let keycardFeedList = []; let keycardFeedList = [];
// console.log(response) // console.log(response)
response.data.queries.forEach(query => { response.data.queries.forEach(query => {
if (location == "eLNvYvm6YT8LTHrCA7Ne" || location == "fKtBvZyBArnTdlMRXOY0" || location == "yb1udKQSTGBFHKn1m5MQ" || location == "rJLbWBPZoJof30KCE07h" || location == "ZMfFDqiAJhXDqRVopTCT" || location == "hWHZMc1dbzjxDuNeIMYf" || location == "sfE95i3WDGy7W4k5pc9T" || location == "uX8Cq15AkjWgVXqWCbdf" || location == "yILqREcDQu85AD1wGyBP" || location == "1ppp1nJuBlNLOpl67dtZ" || location == "9u2ATildmRThi3eA5zMz" || location == "MIenGAtMgckindwrPE6A" || location == "vP59HiIEhvDooBSV1klc" || location == "mcE8DirvsQhUMdL09nNb" || location == "yXjV2x9uKgYa0DpQHRJ3" || location == "yXQPQvuL64vlD0TfJ3lE" || location == "ue2AxjvfFh7IxeV3iOXS" || location == "n0rIiEhHx7Hd9R3N5abU" || location == "RogL7WhBNwkwSNAlPt8X" || location == "FLDNnlycMGBW9ndP84DP" || location == "fRQvPi3NknMcT7o4LefP" || location == "WsDBpCKW0SJThukN1HvE" || location == "T9sfsC0PdX1E5qm32zxV" || location == "bts8v0Sw9nH6DrY1rDqu" if (location == "eLNvYvm6YT8LTHrCA7Ne" || location == "fKtBvZyBArnTdlMRXOY0" || location == "yb1udKQSTGBFHKn1m5MQ" || location == "rJLbWBPZoJof30KCE07h" || location == "ZMfFDqiAJhXDqRVopTCT" || location == "hWHZMc1dbzjxDuNeIMYf" || location == "sfE95i3WDGy7W4k5pc9T" || location == "uX8Cq15AkjWgVXqWCbdf" || location == "yILqREcDQu85AD1wGyBP" || location == "1ppp1nJuBlNLOpl67dtZ" || location == "9u2ATildmRThi3eA5zMz" || location == "MIenGAtMgckindwrPE6A" || location == "vP59HiIEhvDooBSV1klc" || location == "mcE8DirvsQhUMdL09nNb" || location == "yXjV2x9uKgYa0DpQHRJ3" || location == "yXQPQvuL64vlD0TfJ3lE" || location == "ue2AxjvfFh7IxeV3iOXS" || location == "n0rIiEhHx7Hd9R3N5abU" || location == "RogL7WhBNwkwSNAlPt8X" || location == "FLDNnlycMGBW9ndP84DP" || location == "fRQvPi3NknMcT7o4LefP" || location == "WsDBpCKW0SJThukN1HvE" || location == "T9sfsC0PdX1E5qm32zxV" || location == "bts8v0Sw9nH6DrY1rDqu" || location == "1IKI77wv6ZK6ptRUR9nQ"
) { ) {
if (query.results[0].tags.attr == "['Current Cash']") { if (query.results[0].tags.attr == "['Current Cash']") {
currentFeedList.push({ deviceId: query.results[0].name, value: query.results[0].values }); let currentFeed = { deviceId: query.results[0].name, value: query.results[0].values }
let revenueFeed = { deviceId: query.results[0].name, value: [[query.results[0].values[0][0], 0]] } let revenueFeed = { deviceId: query.results[0].name, value: [[query.results[0].values[0][0], 0]] }
for (let index = 1; index < query.results[0].values.length; index++) { for (let index = 1; index < query.results[0].values.length; index++) {
const current = query.results[0].values[index][1]; const current = query.results[0].values[index][1];
...@@ -117,9 +133,35 @@ export const getFeedData = () => async (dispatch, getState) => { ...@@ -117,9 +133,35 @@ export const getFeedData = () => async (dispatch, getState) => {
} }
if (index == query.results[0].values.length - 1) { if (index == query.results[0].values.length - 1) {
let i = 0;
let lengthFeedi = currentFeed.value.length-1;
while (i<lengthFeedi) {
if(currentFeed.value[0][0] >= range.startDate){
i += 1;
break
}
else {
currentFeed.value.shift();
lengthFeedi -= 1
}
}
currentFeedList.push(currentFeed);
let j = 0;
let lengthFeedj = revenueFeed.value.length-1;
while (i<lengthFeedj) {
if(revenueFeed.value[0][0] >= range.startDate){
i += 1;
break
}
else {
revenueFeed.value.shift();
lengthFeedj -= 1
}
}
revenueFeedList.push(revenueFeed); revenueFeedList.push(revenueFeed);
} }
} }
} }
else if (query.results[0].tags.attr == "Remote") { else if (query.results[0].tags.attr == "Remote") {
let remoteFeed = { deviceId: query.results[0].name, value: [[query.results[0].values[0][0], 0]] } let remoteFeed = { deviceId: query.results[0].name, value: [[query.results[0].values[0][0], 0]] }
...@@ -133,6 +175,18 @@ export const getFeedData = () => async (dispatch, getState) => { ...@@ -133,6 +175,18 @@ export const getFeedData = () => async (dispatch, getState) => {
remoteFeed.value[remoteFeed.value.length] = [query.results[0].values[index][0], current] remoteFeed.value[remoteFeed.value.length] = [query.results[0].values[index][0], current]
} }
if (index == query.results[0].values.length - 1) { if (index == query.results[0].values.length - 1) {
let i = 0;
let lengthFeed = remoteFeed.value.length-1;
while (i<lengthFeed) {
if(remoteFeed.value[0][0] >= range.startDate){
i += 1;
break
}
else {
remoteFeed.value.shift();
lengthFeed -= 1
}
}
remoteFeedList.push(remoteFeed); remoteFeedList.push(remoteFeed);
} }
} }
...@@ -149,6 +203,18 @@ export const getFeedData = () => async (dispatch, getState) => { ...@@ -149,6 +203,18 @@ export const getFeedData = () => async (dispatch, getState) => {
peopleFeed.value[peopleFeed.value.length] = [query.results[0].values[index][0], current] peopleFeed.value[peopleFeed.value.length] = [query.results[0].values[index][0], current]
} }
if (index == query.results[0].values.length - 1) { if (index == query.results[0].values.length - 1) {
let i = 0;
let lengthFeed = peopleFeed.value.length-1;
while (i<lengthFeed) {
if(peopleFeed.value[0][0] >= range.startDate){
i += 1;
break
}
else {
peopleFeed.value.shift();
lengthFeed -= 1
}
}
peopleFeedList.push(peopleFeed); peopleFeedList.push(peopleFeed);
} }
} }
...@@ -165,7 +231,20 @@ export const getFeedData = () => async (dispatch, getState) => { ...@@ -165,7 +231,20 @@ export const getFeedData = () => async (dispatch, getState) => {
fingerPrintFeed.value[fingerPrintFeed.value.length] = [query.results[0].values[index][0], current] fingerPrintFeed.value[fingerPrintFeed.value.length] = [query.results[0].values[index][0], current]
} }
if (index == query.results[0].values.length - 1) { if (index == query.results[0].values.length - 1) {
let i = 0;
let lengthFeed = fingerPrintFeed.value.length-1;
while (i<lengthFeed) {
if(fingerPrintFeed.value[0][0] >= range.startDate){
i += 1;
break
}
else {
fingerPrintFeed.value.shift();
lengthFeed -= 1
}
}
fingerPrintFeedList.push(fingerPrintFeed); fingerPrintFeedList.push(fingerPrintFeed);
} }
} }
} }
...@@ -181,6 +260,18 @@ export const getFeedData = () => async (dispatch, getState) => { ...@@ -181,6 +260,18 @@ export const getFeedData = () => async (dispatch, getState) => {
keycardFeed.value[keycardFeed.value.length] = [query.results[0].values[index][0], current] keycardFeed.value[keycardFeed.value.length] = [query.results[0].values[index][0], current]
} }
if (index == query.results[0].values.length - 1) { if (index == query.results[0].values.length - 1) {
let i = 0;
let lengthFeed = keycardFeed.value.length-1;
while (i<lengthFeed) {
if(keycardFeed.value[0][0] >= range.startDate){
i += 1;
break
}
else {
keycardFeed.value.shift();
lengthFeed -= 1
}
}
keycardFeedList.push(keycardFeed); keycardFeedList.push(keycardFeed);
} }
} }
......
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