Built motion from commit f651e4b0a7312c0adceb5e57d6684a801a3aaf0d. Version 3.0.0...
[motion-next.git] / server / api / dashboardItem / dashboardItem.controller.js
index 41c4f1e..eec5cf2 100644 (file)
@@ -1 +1 @@
-const a175_0x43c1=['https://','total','api','params','destroy','error','attrFontSize','intersection','attrUrl','attrHourFormat','json','DashboardItem','pie-chart','update','attrVoiceQueues','widgetAttributes:\x20%s','attrSerie3','attrs','options','attrPath','custom','merge','HH:mm:ss','attrReport','body','status','include','iframe','sendStatus','stringify','show','send','query','then','../../config/logger','../../mysqldb','includeAll','attrSerie1','value','attributes','keys','stack','name','./dashboardItem.socket','attrRefresh','attrSerie2','catch','model','end','type','attrMetric','0.00','clock','findOne','create','attrTimezone'];(function(_0x2f0b37,_0x43c16e){const _0x2f553b=function(_0x454656){while(--_0x454656){_0x2f0b37['push'](_0x2f0b37['shift']());}};_0x2f553b(++_0x43c16e);}(a175_0x43c1,0x84));const a175_0x2f55=function(_0x2f0b37,_0x43c16e){_0x2f0b37=_0x2f0b37-0x0;let _0x2f553b=a175_0x43c1[_0x2f0b37];return _0x2f553b;};const _0x953321=a175_0x2f55;'use strict';const _=require('lodash'),qs=require('../../components/parsers/qs'),logger=require(_0x953321('0xe'))(_0x953321('0x26')),{getSocket}=require('../../rediscache'),socket=getSocket(),db=require(_0x953321('0xf'))['db'];require(_0x953321('0x17'))['register'](socket);function respondWithResult(_0x454656,_0x7d3efe){return _0x7d3efe=_0x7d3efe||0xc8,function(_0x167a34){const _0x4584d3=a175_0x2f55;if(_0x167a34)return _0x454656['status'](_0x7d3efe)[_0x4584d3('0x2e')](_0x167a34);};}function saveUpdates(_0x552023){return function(_0x59d866){if(_0x59d866)return _0x59d866['update'](_0x552023)['then'](function(_0x179c59){return _0x179c59;});return null;};}function removeEntity(_0x1a5fc9){return function(_0x34c628){const _0x3df588=a175_0x2f55;if(_0x34c628)return _0x34c628[_0x3df588('0x28')]()[_0x3df588('0xd')](function(){const _0x3ea5dd=_0x3df588;_0x1a5fc9[_0x3ea5dd('0x5')](0xcc)[_0x3ea5dd('0x1c')]();});};}function handleEntityNotFound(_0x21dda8){return function(_0x134e2a){const _0x4d3813=a175_0x2f55;return!_0x134e2a&&_0x21dda8[_0x4d3813('0x8')](0x194),_0x134e2a;};}function handleError(_0x378825,_0x560645){return _0x560645=_0x560645||0x1f4,function(_0xdc964){const _0x5af656=a175_0x2f55;logger[_0x5af656('0x29')](_0xdc964[_0x5af656('0x15')]),_0xdc964['name']&&delete _0xdc964[_0x5af656('0x16')],_0x378825[_0x5af656('0x5')](_0x560645)[_0x5af656('0xb')](_0xdc964);};}exports[_0x953321('0xa')]=function(_0x3e5d65,_0x327293){const _0x5310cf=_0x953321;let _0x4b78d4={'raw':![],'where':{'id':_0x3e5d65[_0x5310cf('0x27')]['id']}};const _0x18dce1={};return _0x18dce1['model']=_[_0x5310cf('0x14')](db[_0x5310cf('0x2f')]['rawAttributes']),_0x18dce1[_0x5310cf('0xc')]=_[_0x5310cf('0x14')](_0x3e5d65[_0x5310cf('0xc')]),_0x18dce1['filters']=_[_0x5310cf('0x2b')](_0x18dce1['model'],_0x18dce1[_0x5310cf('0xc')]),_0x4b78d4[_0x5310cf('0x13')]=_[_0x5310cf('0x2b')](_0x18dce1['model'],qs['fields'](_0x3e5d65[_0x5310cf('0xc')]['fields'])),_0x4b78d4[_0x5310cf('0x13')]=_0x4b78d4[_0x5310cf('0x13')]['length']?_0x4b78d4[_0x5310cf('0x13')]:_0x18dce1[_0x5310cf('0x1b')],_0x3e5d65['query'][_0x5310cf('0x10')]&&(_0x4b78d4[_0x5310cf('0x6')]=[{'all':!![]}]),_0x4b78d4=_[_0x5310cf('0x1')]({},_0x4b78d4,_0x3e5d65[_0x5310cf('0x36')]),db[_0x5310cf('0x2f')]['findOne'](_0x4b78d4)[_0x5310cf('0xd')](handleEntityNotFound(_0x327293,null))[_0x5310cf('0xd')](respondWithResult(_0x327293,null))['catch'](handleError(_0x327293,null));},exports[_0x953321('0x28')]=function(_0xa0f667,_0x1f2820){const _0x36bad2=_0x953321;return db[_0x36bad2('0x2f')][_0x36bad2('0x21')]({'where':{'id':_0xa0f667[_0x36bad2('0x27')]['id']}})[_0x36bad2('0xd')](handleEntityNotFound(_0x1f2820,null))['then'](removeEntity(_0x1f2820,null))[_0x36bad2('0x1a')](handleError(_0x1f2820,null));};function widgetAttributes(_0x10acef){const _0x518f3c=_0x953321;try{switch(_0x10acef[_0x518f3c('0x1d')]){case _0x518f3c('0x7'):return[{'name':_0x518f3c('0x2c'),'value':_0x10acef[_0x518f3c('0x2c')]||(_0x10acef[_0x518f3c('0x35')]&&_0x10acef[_0x518f3c('0x35')][0x0]?_0x10acef[_0x518f3c('0x35')][0x0][_0x518f3c('0x12')]:undefined)||_0x518f3c('0x24')}];case _0x518f3c('0x0'):return[{'name':_0x518f3c('0x37'),'value':_0x10acef[_0x518f3c('0x37')]||(_0x10acef[_0x518f3c('0x35')]&&_0x10acef[_0x518f3c('0x35')][0x0]?_0x10acef[_0x518f3c('0x35')][0x0][_0x518f3c('0x12')]:undefined)||''}];case _0x518f3c('0x20'):return[{'name':_0x518f3c('0x2d'),'value':_0x10acef[_0x518f3c('0x2d')]||(_0x10acef[_0x518f3c('0x35')]&&_0x10acef['attrs'][0x0]?_0x10acef[_0x518f3c('0x35')][0x0][_0x518f3c('0x12')]:undefined)||_0x518f3c('0x2')},{'name':_0x518f3c('0x23'),'value':_0x10acef['attrTimezone']||(_0x10acef[_0x518f3c('0x35')]&&_0x10acef[_0x518f3c('0x35')][0x1]?_0x10acef[_0x518f3c('0x35')][0x1][_0x518f3c('0x12')]:undefined)||_0x518f3c('0x1f')},{'name':_0x518f3c('0x2a'),'value':_0x10acef['attrFontSize']||(_0x10acef[_0x518f3c('0x35')]&&_0x10acef[_0x518f3c('0x35')][0x2]?_0x10acef['attrs'][0x2]['value']:undefined)||0xc}];case'counter':return[{'name':_0x518f3c('0x1e'),'value':_0x10acef[_0x518f3c('0x1e')]||(_0x10acef[_0x518f3c('0x35')]&&_0x10acef[_0x518f3c('0x35')][0x0]?_0x10acef[_0x518f3c('0x35')][0x0][_0x518f3c('0x12')]:undefined)||'total'},{'name':_0x518f3c('0x32'),'value':_0x10acef[_0x518f3c('0x32')]||(_0x10acef[_0x518f3c('0x35')]&&_0x10acef[_0x518f3c('0x35')][0x1]?_0x10acef[_0x518f3c('0x35')][0x1][_0x518f3c('0x12')]:undefined)||[]},{'name':_0x518f3c('0x2a'),'value':_0x10acef[_0x518f3c('0x2a')]||(_0x10acef[_0x518f3c('0x35')]&&_0x10acef[_0x518f3c('0x35')][0x2]?_0x10acef[_0x518f3c('0x35')][0x2][_0x518f3c('0x12')]:undefined)||0x14}];case'multibar-chart':case _0x518f3c('0x30'):return[{'name':_0x518f3c('0x11'),'value':_0x10acef[_0x518f3c('0x11')]||(_0x10acef[_0x518f3c('0x35')]&&_0x10acef[_0x518f3c('0x35')][0x0]?_0x10acef[_0x518f3c('0x35')][0x0][_0x518f3c('0x12')]:undefined)||_0x518f3c('0x25')},{'name':_0x518f3c('0x19'),'value':_0x10acef['attrSerie2']||(_0x10acef[_0x518f3c('0x35')]&&_0x10acef[_0x518f3c('0x35')][0x1]?_0x10acef['attrs'][0x1][_0x518f3c('0x12')]:undefined)||null},{'name':_0x518f3c('0x34'),'value':_0x10acef[_0x518f3c('0x34')]||(_0x10acef[_0x518f3c('0x35')]&&_0x10acef[_0x518f3c('0x35')][0x2]?_0x10acef['attrs'][0x2]['value']:undefined)||null},{'name':_0x518f3c('0x32'),'value':_0x10acef[_0x518f3c('0x32')]||(_0x10acef['attrs']&&_0x10acef[_0x518f3c('0x35')][0x3]?_0x10acef['attrs'][0x3][_0x518f3c('0x12')]:undefined)||[]}];case'web-report':return[{'name':_0x518f3c('0x3'),'type':_0x10acef['reportType']||(_0x10acef[_0x518f3c('0x35')]&&_0x10acef[_0x518f3c('0x35')][0x0]?_0x10acef[_0x518f3c('0x35')][0x0][_0x518f3c('0x1d')]:undefined)||null,'value':_0x10acef['attrReport']||(_0x10acef[_0x518f3c('0x35')]&&_0x10acef[_0x518f3c('0x35')][0x0]?_0x10acef[_0x518f3c('0x35')][0x0][_0x518f3c('0x12')]:undefined)||null},{'name':_0x518f3c('0x18'),'value':_0x10acef[_0x518f3c('0x18')]||(_0x10acef[_0x518f3c('0x35')]&&_0x10acef[_0x518f3c('0x35')][0x1]?_0x10acef[_0x518f3c('0x35')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x421c5c){return logger[_0x518f3c('0x29')](_0x518f3c('0x33'),JSON[_0x518f3c('0x9')](_0x421c5c)),[];}}exports[_0x953321('0x22')]=function(_0x4b370a,_0x7f7ab8){const _0x3ccab1=_0x953321;return _0x4b370a[_0x3ccab1('0x4')]&&(_0x4b370a['body'][_0x3ccab1('0x35')]=widgetAttributes(_0x4b370a['body'])),db[_0x3ccab1('0x2f')][_0x3ccab1('0x22')](_0x4b370a['body'],{})[_0x3ccab1('0xd')](respondWithResult(_0x7f7ab8,0xc9))['catch'](handleError(_0x7f7ab8,null));},exports[_0x953321('0x31')]=function(_0x4c89cd,_0x186894){const _0x5aa586=_0x953321;return _0x4c89cd[_0x5aa586('0x4')]['id']&&delete _0x4c89cd[_0x5aa586('0x4')]['id'],_0x4c89cd[_0x5aa586('0x4')][_0x5aa586('0x35')]=widgetAttributes(_0x4c89cd['body']),db[_0x5aa586('0x2f')][_0x5aa586('0x21')]({'where':{'id':_0x4c89cd['params']['id']}})[_0x5aa586('0xd')](handleEntityNotFound(_0x186894,null))['then'](saveUpdates(_0x4c89cd[_0x5aa586('0x4')],null))[_0x5aa586('0xd')](respondWithResult(_0x186894,null))[_0x5aa586('0x1a')](handleError(_0x186894,null));};
\ No newline at end of file
+const a175_0x3246=['merge','total','attrReport','type','include','widgetAttributes:\x20%s','attrHourFormat','params','destroy','0.00','DashboardItem','attrRefresh','https://','then','attrMetric','iframe','query','intersection','keys','attrTimezone','./dashboardItem.socket','attrSerie1','web-report','../../components/parsers/qs','name','clock','stringify','error','update','../../rediscache','multibar-chart','body','attributes','catch','create','attrPath','lodash','sendStatus','includeAll','custom','attrFontSize','findOne','attrSerie2','show','options','../../mysqldb','attrVoiceQueues','HH:mm:ss','status','attrs','register','reportType','value','attrSerie3','api','send','model','attrUrl'];(function(_0x308787,_0x32468b){const _0x155a62=function(_0x27ad4f){while(--_0x27ad4f){_0x308787['push'](_0x308787['shift']());}};_0x155a62(++_0x32468b);}(a175_0x3246,0x7d));const a175_0x155a=function(_0x308787,_0x32468b){_0x308787=_0x308787-0x0;let _0x155a62=a175_0x3246[_0x308787];return _0x155a62;};const _0x2cb1d9=a175_0x155a;'use strict';const _=require(_0x2cb1d9('0x1b')),qs=require(_0x2cb1d9('0xe')),logger=require('../../config/logger')(_0x2cb1d9('0x2d')),{getSocket}=require(_0x2cb1d9('0x14')),socket=getSocket(),db=require(_0x2cb1d9('0x24'))['db'];require(_0x2cb1d9('0xb'))[_0x2cb1d9('0x29')](socket);function respondWithResult(_0x27ad4f,_0x2840de){return _0x2840de=_0x2840de||0xc8,function(_0x198f94){const _0x596135=a175_0x155a;if(_0x198f94)return _0x27ad4f[_0x596135('0x27')](_0x2840de)['json'](_0x198f94);};}function saveUpdates(_0x23f93a){return function(_0x23ce21){const _0xf1aaf6=a175_0x155a;if(_0x23ce21)return _0x23ce21[_0xf1aaf6('0x13')](_0x23f93a)[_0xf1aaf6('0x4')](function(_0x753c70){return _0x753c70;});return null;};}function removeEntity(_0x4e4e12){return function(_0x581f45){const _0x4368d6=a175_0x155a;if(_0x581f45)return _0x581f45[_0x4368d6('0x39')]()['then'](function(){const _0xb18173=_0x4368d6;_0x4e4e12[_0xb18173('0x27')](0xcc)['end']();});};}function handleEntityNotFound(_0x1c83a5){return function(_0x4da4d8){const _0x2e9418=a175_0x155a;return!_0x4da4d8&&_0x1c83a5[_0x2e9418('0x1c')](0x194),_0x4da4d8;};}function handleError(_0x17f3f2,_0x2d9f4d){return _0x2d9f4d=_0x2d9f4d||0x1f4,function(_0x389a49){const _0x2d54dc=a175_0x155a;logger[_0x2d54dc('0x12')](_0x389a49['stack']),_0x389a49[_0x2d54dc('0xf')]&&delete _0x389a49[_0x2d54dc('0xf')],_0x17f3f2['status'](_0x2d9f4d)[_0x2d54dc('0x2e')](_0x389a49);};}exports[_0x2cb1d9('0x22')]=function(_0x18ddae,_0xdae914){const _0x43b6d8=_0x2cb1d9;let _0x52a012={'raw':![],'where':{'id':_0x18ddae[_0x43b6d8('0x38')]['id']}};const _0x1c5588={};return _0x1c5588['model']=_[_0x43b6d8('0x9')](db[_0x43b6d8('0x1')]['rawAttributes']),_0x1c5588[_0x43b6d8('0x7')]=_[_0x43b6d8('0x9')](_0x18ddae[_0x43b6d8('0x7')]),_0x1c5588['filters']=_[_0x43b6d8('0x8')](_0x1c5588[_0x43b6d8('0x2f')],_0x1c5588[_0x43b6d8('0x7')]),_0x52a012[_0x43b6d8('0x17')]=_['intersection'](_0x1c5588[_0x43b6d8('0x2f')],qs['fields'](_0x18ddae[_0x43b6d8('0x7')]['fields'])),_0x52a012[_0x43b6d8('0x17')]=_0x52a012['attributes']['length']?_0x52a012[_0x43b6d8('0x17')]:_0x1c5588['model'],_0x18ddae[_0x43b6d8('0x7')][_0x43b6d8('0x1d')]&&(_0x52a012[_0x43b6d8('0x35')]=[{'all':!![]}]),_0x52a012=_[_0x43b6d8('0x31')]({},_0x52a012,_0x18ddae[_0x43b6d8('0x23')]),db[_0x43b6d8('0x1')][_0x43b6d8('0x20')](_0x52a012)[_0x43b6d8('0x4')](handleEntityNotFound(_0xdae914,null))['then'](respondWithResult(_0xdae914,null))[_0x43b6d8('0x18')](handleError(_0xdae914,null));},exports[_0x2cb1d9('0x39')]=function(_0x1d6320,_0x461f63){const _0x5d380c=_0x2cb1d9;return db[_0x5d380c('0x1')][_0x5d380c('0x20')]({'where':{'id':_0x1d6320['params']['id']}})[_0x5d380c('0x4')](handleEntityNotFound(_0x461f63,null))[_0x5d380c('0x4')](removeEntity(_0x461f63,null))[_0x5d380c('0x18')](handleError(_0x461f63,null));};function widgetAttributes(_0x25ffba){const _0x569693=_0x2cb1d9;try{switch(_0x25ffba[_0x569693('0x34')]){case _0x569693('0x6'):return[{'name':_0x569693('0x30'),'value':_0x25ffba['attrUrl']||(_0x25ffba[_0x569693('0x28')]&&_0x25ffba[_0x569693('0x28')][0x0]?_0x25ffba['attrs'][0x0]['value']:undefined)||_0x569693('0x3')}];case _0x569693('0x1e'):return[{'name':_0x569693('0x1a'),'value':_0x25ffba[_0x569693('0x1a')]||(_0x25ffba[_0x569693('0x28')]&&_0x25ffba[_0x569693('0x28')][0x0]?_0x25ffba['attrs'][0x0][_0x569693('0x2b')]:undefined)||''}];case _0x569693('0x10'):return[{'name':_0x569693('0x37'),'value':_0x25ffba[_0x569693('0x37')]||(_0x25ffba[_0x569693('0x28')]&&_0x25ffba[_0x569693('0x28')][0x0]?_0x25ffba[_0x569693('0x28')][0x0][_0x569693('0x2b')]:undefined)||_0x569693('0x26')},{'name':_0x569693('0xa'),'value':_0x25ffba[_0x569693('0xa')]||(_0x25ffba[_0x569693('0x28')]&&_0x25ffba[_0x569693('0x28')][0x1]?_0x25ffba['attrs'][0x1][_0x569693('0x2b')]:undefined)||_0x569693('0x0')},{'name':_0x569693('0x1f'),'value':_0x25ffba['attrFontSize']||(_0x25ffba[_0x569693('0x28')]&&_0x25ffba[_0x569693('0x28')][0x2]?_0x25ffba[_0x569693('0x28')][0x2]['value']:undefined)||0xc}];case'counter':return[{'name':'attrMetric','value':_0x25ffba[_0x569693('0x5')]||(_0x25ffba['attrs']&&_0x25ffba[_0x569693('0x28')][0x0]?_0x25ffba['attrs'][0x0][_0x569693('0x2b')]:undefined)||_0x569693('0x32')},{'name':_0x569693('0x25'),'value':_0x25ffba[_0x569693('0x25')]||(_0x25ffba['attrs']&&_0x25ffba[_0x569693('0x28')][0x1]?_0x25ffba[_0x569693('0x28')][0x1][_0x569693('0x2b')]:undefined)||[]},{'name':_0x569693('0x1f'),'value':_0x25ffba[_0x569693('0x1f')]||(_0x25ffba[_0x569693('0x28')]&&_0x25ffba[_0x569693('0x28')][0x2]?_0x25ffba[_0x569693('0x28')][0x2][_0x569693('0x2b')]:undefined)||0x14}];case _0x569693('0x15'):case'pie-chart':return[{'name':'attrSerie1','value':_0x25ffba[_0x569693('0xc')]||(_0x25ffba[_0x569693('0x28')]&&_0x25ffba[_0x569693('0x28')][0x0]?_0x25ffba[_0x569693('0x28')][0x0][_0x569693('0x2b')]:undefined)||_0x569693('0x32')},{'name':_0x569693('0x21'),'value':_0x25ffba[_0x569693('0x21')]||(_0x25ffba[_0x569693('0x28')]&&_0x25ffba[_0x569693('0x28')][0x1]?_0x25ffba[_0x569693('0x28')][0x1]['value']:undefined)||null},{'name':_0x569693('0x2c'),'value':_0x25ffba[_0x569693('0x2c')]||(_0x25ffba[_0x569693('0x28')]&&_0x25ffba[_0x569693('0x28')][0x2]?_0x25ffba['attrs'][0x2][_0x569693('0x2b')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x25ffba[_0x569693('0x25')]||(_0x25ffba['attrs']&&_0x25ffba[_0x569693('0x28')][0x3]?_0x25ffba[_0x569693('0x28')][0x3][_0x569693('0x2b')]:undefined)||[]}];case _0x569693('0xd'):return[{'name':_0x569693('0x33'),'type':_0x25ffba[_0x569693('0x2a')]||(_0x25ffba[_0x569693('0x28')]&&_0x25ffba[_0x569693('0x28')][0x0]?_0x25ffba[_0x569693('0x28')][0x0][_0x569693('0x34')]:undefined)||null,'value':_0x25ffba[_0x569693('0x33')]||(_0x25ffba[_0x569693('0x28')]&&_0x25ffba[_0x569693('0x28')][0x0]?_0x25ffba['attrs'][0x0]['value']:undefined)||null},{'name':_0x569693('0x2'),'value':_0x25ffba[_0x569693('0x2')]||(_0x25ffba['attrs']&&_0x25ffba['attrs'][0x1]?_0x25ffba['attrs'][0x1][_0x569693('0x2b')]:undefined)||0x0}];default:return[];}}catch(_0x3251fd){return logger[_0x569693('0x12')](_0x569693('0x36'),JSON[_0x569693('0x11')](_0x3251fd)),[];}}exports[_0x2cb1d9('0x19')]=function(_0x4f8ab8,_0x2a5d38){const _0x4f0444=_0x2cb1d9;return _0x4f8ab8['body']&&(_0x4f8ab8[_0x4f0444('0x16')]['attrs']=widgetAttributes(_0x4f8ab8['body'])),db['DashboardItem'][_0x4f0444('0x19')](_0x4f8ab8[_0x4f0444('0x16')],{})['then'](respondWithResult(_0x2a5d38,0xc9))[_0x4f0444('0x18')](handleError(_0x2a5d38,null));},exports[_0x2cb1d9('0x13')]=function(_0x17d47e,_0x373e31){const _0x471979=_0x2cb1d9;return _0x17d47e[_0x471979('0x16')]['id']&&delete _0x17d47e[_0x471979('0x16')]['id'],_0x17d47e[_0x471979('0x16')][_0x471979('0x28')]=widgetAttributes(_0x17d47e[_0x471979('0x16')]),db[_0x471979('0x1')][_0x471979('0x20')]({'where':{'id':_0x17d47e['params']['id']}})[_0x471979('0x4')](handleEntityNotFound(_0x373e31,null))[_0x471979('0x4')](saveUpdates(_0x17d47e[_0x471979('0x16')],null))['then'](respondWithResult(_0x373e31,null))['catch'](handleError(_0x373e31,null));};
\ No newline at end of file