(this["webpackJsonpgonzo-test-client"]=this["webpackJsonpgonzo-test-client"]||[]).push([[11],{"4mNT":function(e,t,a){"use strict";var n=a("q1tI"),s=a.n(n),r=a("VyNe"),l=a("zTlQ"),o=a("RFJ0"),i=a("/MKj"),c=a("zDJl"),m=a("dxSB"),u=a("wd/R"),d=a.n(u),h=a("qx5e"),f=a("s506");class g extends s.a.Component{constructor(e){super(e),this.onCageChange=e=>{this.setState({cage:e})},this.onDaysChange=e=>{this.setState({days:+e})},this.state={cage:this.props.devices.filter(e=>e.DevType===c.d.CAGE)[0],days:7}}getAggData(){this.state.cage&&this.props.dispatch(Object(m.a)(this.state.cage,{AggDataTimeFrom:d.a.utc().startOf("day").subtract(90,"days").toDate().getTime(),AggDataTimeTo:d.a.utc().startOf("day").toDate().getTime()}))}componentDidMount(){this.getAggData()}calculateGain(){try{let e=this.props.aggregatedData.get(this.state.cage.DevID);e.sort((e,t)=>e.AggTi-t.AggTi);let t=d.a.utc().startOf("day"),a=t.clone().subtract(this.state.days,"days"),n=e.filter(e=>e.AggTi>=a.toDate().getTime()&&e.AggTi<=t.toDate().getTime());if(n.length>1){let e=n[0],t=n[n.length-1],a=e.AggDt.WeightsOnExits[0],s=t.AggDt.WeightsOnExits[0];return parseFloat(((s-a)/d.a.utc(t.AggTi).diff(e.AggTi,"days")/1e3).toFixed(1))}return null}catch(e){return null}}render(){const{cage:e,days:t}=this.state;let a=this.props.devices.filter(e=>e.DevType===c.d.CAGE).map(e=>({name:e.getSelectName(),value:e})),n=this.calculateGain();return s.a.createElement(r.a,null,s.a.createElement(o.a,{label:"Klatka separacyjna",options:a,value:e,onChange:this.onCageChange}),s.a.createElement(l.a,{label:"Ilo\u015b\u0107 dni",type:"number",value:t,onChange:this.onDaysChange}),e&&s.a.createElement("h2",null,"Przyrost: ",n||"-"," kg"))}}let p=Object(i.connect)(e=>({devices:e.farmDevices.devices,aggregatedData:e.aggregatedData.data}))(g);t.a=Object(h.a)({roles:[f.c._SERVICE],showComponent:!0})(p)},"5U3c":function(e,t,a){"use strict";var n=a("BkRI"),s=a.n(n),r=a("mwIZ"),l=a.n(r),o=a("Y+p1"),i=a.n(o),c=a("q1tI"),m=a.n(c),u=a("VyNe"),d=a("kCmh"),h=a("/MKj"),f=a("zDJl"),g=a("RFJ0"),p=a("/kok"),E=a("udB/"),C=a("3Z9Z"),v=a("JI6e"),b=a("wd/R"),w=a.n(b),y=a("AAik"),D=a("AF5L"),S=a("uSQv"),k=a("nG5z");function O(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function _(e){for(var t=1;t{this.setState({loading:!1})},this.onGetNRFStatsSuccess=e=>{console.log("SUCCESS");try{this.setState({stats:e.CAnsw.stats})}catch(t){console.error(t)}},this.onGetNRFStatsFailure=()=>{this.setState({stats:[]})},this.onSelectChange=e=>{const{shadows:t}=this.props;this.setState({bridge:e,loading:!t.get(e.DevID)}),p.a.startSendingDeviceState(e,this.turnOffLoading,this.turnOffLoading),Object(D.g)(e.GatewayID,e.DevID,this.onGetNRFStatsSuccess,this.onGetNRFStatsFailure)},this.onGetBInfoSuccess=e=>{const{bridge:t}=this.state,a=e.CAnsw[t.DevID].b_info;this.setState(_({b_info:a},this.getTimer(a)))},this.getStandardInfo=()=>{const{bridge:e}=this.state;Object(k.d)(e,this.onGetBInfoSuccess)},this.onGetBBootInfoSuccess=e=>{const{bridge:t}=this.state;this.setState({boot_info:e.CAnsw[t.DevID].boot_info})},this.onGetBBootInfoNRFSuccess=e=>{const{bridge:t}=this.state;this.setState({boot_info_nrf:e.CAnsw[t.DevID].boot_info_nrf})},this.getProgrammInfo=()=>{const{bridge:e}=this.state;Object(k.b)(e,this.onGetBBootInfoSuccess),Object(k.c)(e,this.onGetBBootInfoNRFSuccess)},this.getBNRFStartSuccess=e=>{const{bridge:t}=this.state;this.setState({nrf_stat:e.CAnsw[t.DevID].nrf_stat})},this.getNRFInfo=()=>{const{bridge:e}=this.state;Object(k.e)(e,this.getBNRFStartSuccess)},this.onGetB485TourRSuccess=e=>{const{bridge:t}=this.state;let a=e.CData.nr,n=s()(e.CAnsw[t.DevID].rs485_tout[a]);const r=s()(this.state.rs485_tout)||[];r[a]=n,this.setState({rs485_tout:r})},this.getRSInfo=()=>{const{bridge:e}=this.state;Object(k.a)(e,0,this.onGetB485TourRSuccess),Object(k.a)(e,1,this.onGetB485TourRSuccess)},this.getNRFStatsButton=()=>{const{bridge:e}=this.state;Object(D.g)(e.GatewayID,e.DevID,this.onGetNRFStatsSuccess,this.onGetNRFStatsFailure)},this.onGetBScanAddrSuccess=e=>{const{bridge:t}=this.state;this.setState({scan_addr:e.CAnsw[t.DevID].scan_addr})},this.getScanAddresses=()=>{const{bridge:e}=this.state;Object(k.f)(e,0,this.onGetBScanAddrSuccess),Object(k.f)(e,1,this.onGetBScanAddrSuccess),Object(k.f)(e,2,this.onGetBScanAddrSuccess)},this.state={bridges:d.a.getDevices(e.farm).filter(e=>e.DevType===f.d.BRIDGE_CONF),bridge:null,loading:!1,worktime:0,interval:null,stats:[],b_info:null,boot_info:null,boot_info_nrf:null,nrf_stat:null,rs485_tout:[],scan_addr:[]}}UNSAFE_componentWillReceiveProps(e,t){const{bridge:a}=this.state;if(a){const{shadows:t}=e;let n=t.get(a.DevID),s=this.props.shadows.get(a.DevID);n&&!i()(n,s)&&this.setState(_({},n,{},this.getTimer(n.b_info)))}}getTimer(e){const{worktime:t}=this.state;let a=l()(e,"work_time");if(t!==a){clearInterval(this.state.interval);let e=setInterval(()=>{a+=1e3,this.setState({worktime:a})},1e3);return{worktime:a,interval:e}}}shouldComponentUpdate(e,t,a){return!i()(this.state,t)}componentWillUnmount(){clearInterval(this.state.interval)}getWorkTime(){try{const{worktime:e}=this.state;let t=Math.floor(e/1e3%60),a=Math.floor(e/6e4%60),n=Math.floor(e/36e5%24),s=Math.floor(e/864e5);return(s<10?"0"+s:s)+":"+(n<10?"0"+n:n)+":"+(a<10?"0"+a:a)+":"+(t<10?"0"+t:t)}catch(e){return"-"}}getNRFData(){const{nrf_stat:e}=this.state;try{return e.map((e,t)=>({name:0===t?"Lewy":1===t?"Centralny":"Prawy",channel:e.NRF24_nrch,power:e.NRF24_outPower,received:e.packets_RX,send:e.packets_ok,repetitions:e.packets_rep,lost:e.packets_lost,ready:0===e.nrf_ready}))}catch(t){return[]}}getNRFStats(){try{const{stats:e}=this.state;let t=[];for(let a of e)for(let e of a.devices)e.address&&t.push({address:"0x".concat(e.address.toString(16).toUpperCase(),"00"),received:e.counter_RX,send:e.counter_TX,repetitions:e.counter_rep,lost:e.counter_lost,status:e.stat});return t}catch(e){return[]}}getScanAddressData(){const{scan_addr:e}=this.state;try{let t=[],a=17;const n=e[0].addresses,s=e[1].addresses,r=e[2].addresses;for(let e=0;em.a.createElement("i",{className:e.value?"fas fa-check":"fas fa-times"})}];return m.a.createElement(m.a.Fragment,null,m.a.createElement(u.a,null,m.a.createElement(g.a,{label:"Bridge",options:e.map(e=>({name:e.Name,value:e})),value:t,onChange:this.onSelectChange,clearButton:!1})),t&&m.a.createElement(u.a,null,m.a.createElement(E.a,{isLoading:a}),m.a.createElement("h4",{className:"d-flex justify-content-between"},"Podstawowe informacje",m.a.createElement(S.a,{buttonStyle:"round",icon:m.a.createElement("i",{className:"fas fa-arrow-alt-circle-down"}),onClick:this.getStandardInfo})),m.a.createElement(C.a,null,m.a.createElement(v.a,{xl:6},m.a.createElement("div",null,m.a.createElement("strong",null,"Nazwa:")," ",l()(n,"name_prg_text","-")),m.a.createElement("div",null,m.a.createElement("strong",null,"Serial:")," ",l()(n,"serial","-")),m.a.createElement("div",null,m.a.createElement("strong",null,"Czas restartu:")," ",w()(l()(n,"Lstart_time",0)).format("DD.MM.YYYY HH:mm")),m.a.createElement("div",null,m.a.createElement("strong",null,"Czas pracy:")," ",this.getWorkTime())),m.a.createElement(v.a,{xl:6},m.a.createElement("div",null,m.a.createElement("strong",null,"Wersja:")," ",l()(n,"ver_prg","-")),m.a.createElement("div",null,m.a.createElement("strong",null,"Wersja HAL:")," ",l()(n,"HAL_VERSION","-")),m.a.createElement("div",null,m.a.createElement("strong",null,"Aktualny czas:")," ",w()(l()(n,"Lact_time",0)).format("DD.MM.YYYY HH:mm")),m.a.createElement("div",null,m.a.createElement("strong",null,"Flaga RCC:")," ",l()(n,"RCC_FLAG","-")))),m.a.createElement("hr",null),m.a.createElement("h4",{className:"d-flex justify-content-between"},"Informacje o programach",m.a.createElement(S.a,{buttonStyle:"round",icon:m.a.createElement("i",{className:"fas fa-arrow-alt-circle-down"}),onClick:this.getProgrammInfo})),m.a.createElement(C.a,null,m.a.createElement(v.a,{md:4},m.a.createElement("h6",null,"Program aktualny"),m.a.createElement("div",null,m.a.createElement("strong",null,"Stan:")," ",l()(s,"act_info.state_prg","-")),m.a.createElement("div",null,m.a.createElement("strong",null,"Wersja:")," ",l()(s,"act_info.ver_prg","-")),m.a.createElement("div",null,m.a.createElement("strong",null,"Rozmiar:")," ",l()(s,"act_info.prg_size","-")),m.a.createElement("div",null,m.a.createElement("strong",null,"Nazwa:")," ",l()(s,"act_info.name_prg","-"))),m.a.createElement(v.a,{md:4},m.a.createElement("h6",null,"Program w pami\u0119ci"),m.a.createElement("div",null,m.a.createElement("strong",null,"Stan:")," ",l()(s,"prg_info.state_prg","-")),m.a.createElement("div",null,m.a.createElement("strong",null,"Wersja:")," ",l()(s,"prg_info.ver_prg","-")),m.a.createElement("div",null,m.a.createElement("strong",null,"Rozmiar:")," ",l()(s,"prg_info.prg_size","-")),m.a.createElement("div",null,m.a.createElement("strong",null,"Nazwa:")," ",l()(s,"prg_info.name_prg","-"))),m.a.createElement(v.a,{md:4},m.a.createElement("h6",null,"Program NRF"),m.a.createElement("div",null,m.a.createElement("strong",null,"Stan:")," ",l()(r,"prg_info.state_prg","-")),m.a.createElement("div",null,m.a.createElement("strong",null,"Wersja:")," ",l()(r,"prg_info.ver_prg","-")),m.a.createElement("div",null,m.a.createElement("strong",null,"Rozmiar:")," ",l()(r,"prg_info.prg_size","-")),m.a.createElement("div",null,m.a.createElement("strong",null,"Nazwa:")," ",l()(r,"prg_info.name_prg","-")))),m.a.createElement("hr",null),m.a.createElement("h4",{className:"d-flex justify-content-between"},"Informacje o NRF",m.a.createElement(S.a,{buttonStyle:"round",icon:m.a.createElement("i",{className:"fas fa-arrow-alt-circle-down"}),onClick:this.getNRFInfo})),m.a.createElement(y.a,{data:this.getNRFData(),headers:i}),m.a.createElement("hr",null),m.a.createElement("h4",{className:"d-flex justify-content-between"},"Interfejsy RS",m.a.createElement(S.a,{buttonStyle:"round",icon:m.a.createElement("i",{className:"fas fa-arrow-alt-circle-down"}),onClick:this.getRSInfo})),(o||[]).map(e=>m.a.createElement(C.a,null,m.a.createElement(v.a,{md:4},m.a.createElement("strong",null,"Nr:")," ",e.rs),m.a.createElement(v.a,{md:4},m.a.createElement("strong",null,"tout:")," ",e.tout),m.a.createElement(v.a,{md:4},m.a.createElement("strong",null,"set:")," ",e.set))),m.a.createElement("hr",null),m.a.createElement("h4",{className:"d-flex justify-content-between"},"Skanowane adresy",m.a.createElement(S.a,{buttonStyle:"round",icon:m.a.createElement("i",{className:"fas fa-arrow-alt-circle-down"}),onClick:this.getScanAddresses})),m.a.createElement(y.a,{data:this.getScanAddressData(),headers:[{name:"Adres",field:"address"},{name:"Lewo",field:"nrf0"},{name:"\u015arodek",field:"nrf1"},{name:"Prawo",field:"nrf2"}]}),m.a.createElement("hr",null),m.a.createElement("h4",{className:"d-flex justify-content-between"},"Statystyki",m.a.createElement(S.a,{buttonStyle:"round",icon:m.a.createElement("i",{className:"fas fa-arrow-alt-circle-down"}),onClick:this.getNRFStatsButton})),m.a.createElement(y.a,{data:this.getNRFStats(),headers:[{name:"Adres",field:"address"},{name:"Odebrane",field:"received"},{name:"Wys\u0142ane",field:"send"},{name:"Powt\xf3rzenia",field:"repetitions"},{name:"Utracone",field:"lost"},{name:"Status",field:"status"}]})))}}I=Object(h.connect)(e=>({farm:e.location.farm,shadows:e.shadows.shadows}))(I),t.a=I},"5g3Z":function(e,t,a){},"7h6m":function(e,t,a){"use strict";var n=a("Y+p1"),s=a.n(n),r=a("mwIZ"),l=a.n(r),o=a("q1tI"),i=a.n(o),c=a("kCmh"),m=a("zDJl"),u=a("/MKj"),d=a("qzmO"),h=a("/kok"),f=a("VyNe"),g=a("AAik"),p=a("uSQv");class E extends i.a.Component{constructor(...e){super(...e),this.onButtonClick=()=>{const{value:e}=this.props;Object(d.q)(e.multi,2)}}render(){return i.a.createElement(p.a,{buttonStyle:"round",icon:i.a.createElement("i",{className:"fas fa-arrow-alt-circle-down"}),onClick:this.onButtonClick,style:{marginBottom:0}})}}var C=a("VfnB");class v extends i.a.Component{constructor(e){super(e),this.addressValueFormatter=e=>"0x".concat(e.toString(16).padStart(4,"0").toUpperCase()),this.onGetAllClick=()=>{const{multis:e}=this.state;for(let t of e)Object(d.q)(t,2)};const{farm:t}=this.props;let a=c.a.getDevices(t).filter(e=>e.DevType===m.d.DISPENSER_NRF_MULTI);console.log(a);let n=Object(C.r)(a);if(n)for(let s of[...n.values()])h.a.startSendingDeviceState(s[m.d.DISPENSER_NRF_MULTI]);for(let s of a)Object(d.q)(s,2);this.state={multis:a,data:this.createData(a,e)}}createData(e,t){const{shadows:a}=t;return e.map(e=>{let t=a.get(e.DevID);return{multi:e,programName:l()(t,"bootloader.name","")}})}UNSAFE_componentWillReceiveProps(e,t){s()(this.props.shadows,e.shadows)||this.setState({data:this.createData(this.state.multis,e)})}render(){const{data:e}=this.state,t=[{name:"Nazwa",field:"multi.Name"},{name:"Adres",field:"multi.Address",valueFormatter:this.addressValueFormatter},{name:"Nazwa programu",field:"programName"},{name:"",component:i.a.createElement(E,null),headerClassName:"index",itemClassName:"index"}];return i.a.createElement(f.a,null,i.a.createElement(p.a,{onClick:this.onGetAllClick},"Pobierz wszystkie"),i.a.createElement(g.a,{headers:t,data:e}))}}v=Object(u.connect)(e=>({farm:e.location.farm,shadows:e.shadows.shadows}))(v);t.a=v},"B46+":function(e,t,a){"use strict";var n=a("mwIZ"),s=a.n(n),r=a("Y+p1"),l=a.n(r),o=a("q1tI"),i=a.n(o),c=a("VyNe"),m=a("kCmh"),u=a("/MKj"),d=a("zDJl"),h=a("AAik"),f=a("/kok"),g=a("wd/R"),p=a.n(g),E=a("uSQv"),C=a("qzmO");class v extends i.a.Component{constructor(...e){super(...e),this.onButtonClick=()=>{const{value:e}=this.props;Object(C.i)(e),Object(C.b)(e),Object(C.c)(e),Object(C.h)(e),Object(C.e)(e),Object(C.d)(e),Object(C.a)(e)}}render(){return i.a.createElement("div",null,i.a.createElement(E.a,{buttonStyle:"round",icon:i.a.createElement("i",{className:"fas fa-arrow-alt-circle-down"}),style:{margin:0},onClick:this.onButtonClick}))}}a("eQLf");class b extends i.a.Component{getIcon(e){return e?i.a.createElement("i",{className:"fas fa-check fw-fw"}):i.a.createElement("i",{className:"fas fa-times fw-fw"})}render(){const{value:e}=this.props;return i.a.createElement("div",null,e.map(e=>i.a.createElement("div",{key:e.nr},e.nr,": ",e.feedOverImpulse," ",this.getIcon(e.setOverImpulse),"/",e.feedOverTime," ",this.getIcon(e.setOverTime))))}}class w extends i.a.Component{render(){console.log(this.props);const{value:e}=this.props;return i.a.createElement("div",null,e.status.map((t,a)=>i.a.createElement("div",null,a+1,": ",i.a.createElement("i",{className:t?"fas fa-check fa-fw":"fas fa-times fa-fw"})," ",e.time[a])))}}class y extends i.a.Component{constructor(...e){super(...e),this.onButtonClick=e=>{e.stopPropagation();const{onClick:t}=this.props;t()}}render(){const{name:e}=this.props;return i.a.createElement("div",{className:"nrf-data-header"},e," ",i.a.createElement(E.a,{buttonStyle:"round",icon:i.a.createElement("i",{className:"fas fa-arrow-alt-circle-down"}),onClick:this.onButtonClick}))}}function D(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function S(e){for(var t=1;t"0x"+e.toString(16).toUpperCase(),this.dateValueFormatter=e=>p()(e).format("DD.MM.YYYY HH:mm"),this.onGetAllClick=()=>{let e=m.a.getDevices(this.props.farm).filter(e=>e.DevType===d.d.DISPENSER_NRF_MULTI);for(let t of e)Object(C.i)(t),Object(C.b)(t),Object(C.c)(t),Object(C.h)(t),Object(C.e)(t),Object(C.d)(t),Object(C.a)(t)},this.arrayValueFormatter=e=>{try{return void 0!==e[0]&&void 0!==e[1]?"".concat(e[0],"/").concat(e[1]):""}catch(t){return""}},this.joinArrayValueFormatter=e=>{try{return e.join(", ")}catch(t){return""}},this.getCanStatusForAllDevices=()=>{const{devices:e}=this.state;for(let t of e)Object(C.a)(t)},this.getEfficiencyForAllDevices=()=>{const{devices:e}=this.state;for(let t of e)Object(C.e)(t),Object(C.d)(t)},this.getScheduleCRCForAllDevices=()=>{const{devices:e}=this.state;for(let t of e)Object(C.h)(t)},this.getCurveCRCForAllDevices=()=>{const{devices:e}=this.state;for(let t of e)Object(C.c)(t)},this.getUploadSoftwareStatusForAllDevices=()=>{const{devices:e}=this.state;for(let t of e)Object(C.i)(t)},this.getConfigurationForAllDevices=()=>{const{devices:e}=this.state;for(let t of e)Object(C.b)(t)};let t=m.a.getDevices(e.farm).filter(e=>e.DevType===d.d.DISPENSER_NRF_MULTI);for(let a of t)f.a.startSendingDeviceState(a);this.state={data:t.map(e=>({device:e,flags:[],counters:[],versions:[],startTime:0,curvesCRC:[],schedulesCRC:[],efficiency:[],statusCAN:{status:[],time:[]}})),devices:t}}UNSAFE_componentWillReceiveProps(e,t){if(!l()(this.props.shadows,e.shadows)){let t=[];for(let a of this.state.data){let n=e.shadows.get(a.device.DevID);t.push(S({},a,{flags:s()(n,"flags",[]),counters:s()(n,"counters",[]),versions:s()(n,"versions",[]),startTime:s()(n,"config.timeStart",0),curvesCRC:s()(n,"curveCRC",[]),schedulesCRC:s()(n,"scheduleCRC",[]),efficiency:s()(n,"efficiencies",[]).map(e=>{let t=s()(n,"efficiencyStatuses",[]).find(t=>t.nr===e.nr)||{};return S({},e,{},t)}),statusCAN:s()(n,"statusCAN",{status:[],time:[]})}))}this.setState({data:t})}}render(){const{data:e}=this.state,t=[{name:"Adres",field:"device.Address",valueFormatter:this.addressValueFormatter},{name:"Flagi",field:"flags",valueFormatter:this.arrayValueFormatter,headerComponent:i.a.createElement(y,{onClick:this.getUploadSoftwareStatusForAllDevices})},{name:"Liczniki",field:"counters",valueFormatter:this.arrayValueFormatter},{name:"Wersje",field:"versions",valueFormatter:this.arrayValueFormatter},{name:"Data uruchomienia",field:"startTime",valueFormatter:this.dateValueFormatter,headerComponent:i.a.createElement(y,{onClick:this.getConfigurationForAllDevices})},{name:"Krzywe CRC",field:"curvesCRC",valueFormatter:this.joinArrayValueFormatter,headerComponent:i.a.createElement(y,{onClick:this.getCurveCRCForAllDevices})},{name:"Harmonogramy CRC",field:"schedulesCRC",valueFormatter:this.joinArrayValueFormatter,headerComponent:i.a.createElement(y,{onClick:this.getScheduleCRCForAllDevices})},{name:"Wydajno\u015bci [impuls/czas]",field:"efficiency",component:i.a.createElement(b,null),headerComponent:i.a.createElement(y,{onClick:this.getEfficiencyForAllDevices})},{name:"Status CAN",field:"statusCAN",component:i.a.createElement(w,null),headerComponent:i.a.createElement(y,{onClick:this.getCanStatusForAllDevices})},{name:"",field:"device",component:i.a.createElement(v,null),headerClassName:"button",itemClassName:"button"}];return i.a.createElement(c.a,{className:"nrf-data"},i.a.createElement(E.a,{icon:i.a.createElement("i",{className:"fas fa-arrow-alt-circle-down"}),onClick:this.onGetAllClick},"Pobierz wszystkie"),i.a.createElement(h.a,{data:e,headers:t}))}}O=Object(u.connect)(e=>({farm:e.location.farm,shadows:e.shadows.shadows}))(O);t.a=O},DVKa:function(e,t,a){"use strict";var n=a("Y+p1"),s=a.n(n),r=a("q1tI"),l=a.n(r),o=a("VyNe"),i=a("/MKj"),c=a("zDJl"),m=a("AF5L"),u=a("wd/R"),d=a.n(u),h=a("AAik"),f=(a("OBwy"),a("G7tO")),g=a("uSQv"),p=a("3xDe"),E=a("IXwn"),C=a("ANjH"),v=a("f0zD"),b=a("4qqJ"),w=a("zTlQ"),y=a("3Z9Z"),D=a("JI6e");function S(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function k(e){for(var t=1;t{try{const{CAnsw:{data:{params:t,logs:a}}}=e;this.setState(k({params:t,logs:a},this.getChartData(t),{referenceLines:[]}))}catch(t){this.setState({params:[],logs:[],headers:[],chartData:[],referenceLines:[]})}},this.onRowClick=(e,t)=>{let a=this.state.referenceLines.slice(0);a.find(t=>t.InsertionTime===e.InsertionTime)?a=a.filter(t=>t.InsertionTime!==e.InsertionTime):a.push(k({},e,{index:t})),this.setState({referenceLines:a})},this.dateValueFormatter=e=>d()(e).format("DD.MM.YYYY HH:mm:ss"),this.onChartClick=e=>{if(e){let t=e.activePayload.find(t=>t.payload.name===e.activeLabel).payload;console.log(t);let a=this.getMoreInfo(t.name);this.setState({moreInfo:a,lastClickedTime:t.name})}},this.onShowCurrentValuesClick=()=>{this.props.show(b.a,{})},this.onLogsFileChange=e=>{const{start:t,stop:a}=this.state;let n=e.target.files[0];console.log(n);let s=new FileReader;s.onload=()=>{let e=s.result.split("\n");e.filter(e=>!!e);let n=e.slice(0,e.length-1).map(e=>JSON.parse(e)).sort((e,t)=>t.InsertionTime-e.InsertionTime),r={logsFile:n};if(t&&a){r=k({},r,{logs:n.filter(e=>e.InsertionTime>=d()(t).toDate().getTime()&&e.InsertionTime<=d()(a).toDate().getTime())})}console.log(r),this.setState(r)},s.readAsText(n)},this.onDataFileChange=e=>{const{start:t,stop:a}=this.state;let n=e.target.files[0],s=new FileReader;s.onload=()=>{let e=s.result.split("\n");e.filter(e=>!!e);let n=e.slice(0,e.length-1).map(e=>JSON.parse(e)).sort((e,t)=>e.InsertionTime-t.InsertionTime),r={dataFile:n};if(t&&a){let e=d()(a).diff(t,"seconds"),s=[];for(let a=0;ae.InsertionTime>=d()(t).toDate().getTime()&&e.InsertionTime<=d()(a).toDate().getTime());r=k({},r,{params:l},this.getChartData(l),{referenceLines:[],ticks:s,domain:[d()(t).toDate().getTime(),"dataMax"]})}this.setState(r)},s.readAsText(n)},this.onApplyFilter=()=>{const{start:e,stop:t,dataFile:a,logsFile:n}=this.state;if(e&&t){let s=d()(t).diff(e,"seconds"),r=[];for(let t=0;ta.InsertionTime>=d()(e).toDate().getTime()&&a.InsertionTime<=d()(t).toDate().getTime()),o=n.filter(a=>a.InsertionTime>=d()(e).toDate().getTime()&&a.InsertionTime<=d()(t).toDate().getTime());this.setState(k({params:l},this.getChartData(l),{referenceLines:[],logs:o,ticks:r,domain:[d()(e).toDate().getTime(),"dataMax"]}))}},this.state={gateway:null,start:d()().startOf("day").format(d.a.HTML5_FMT.DATETIME_LOCAL),stop:d()().endOf("day").format(d.a.HTML5_FMT.DATETIME_LOCAL),granularity:0,timeout:null,params:[],logs:[],headers:[],chartData:[],referenceLines:[],humidityOn:!1,ventilationOn:!1,ventilationSettingsOn:!1,heatersOn:!1,temperatureOn:!1,alarmsOn:!1,coolingOn:!1,notDeclaredOn:!1,moreInfo:[],lastClickedTime:null,sent:!1,logsFile:[],dataFile:[],notDeclared:[],ticks:[],domain:[d()().startOf("day").toDate().getTime(),"dataMax"]}}shouldComponentUpdate(e,t,a){return!s()(this.state,t)}isDark(e){let t=Object(p.a)(e);return.2126*t.r+.7152*t.g+.0722*t.b<50}lightenColor(e,t=30){let a=parseInt(e,16),n=Math.round(2.55*t),s=(a>>16)+n,r=(a>>8&255)+n,l=(255&a)+n;return(16777216+65536*(s<255?s<1?0:s:255)+256*(r<255?r<1?0:r:255)+(l<255?l<1?0:l:255)).toString(16).slice(1)}getCurrentChartStatusForKey(e){return _.includes(e)?this.state.humidityOn:j.includes(e)?this.state.ventilationOn:I.includes(e)?this.state.ventilationSettingsOn:T.includes(e)?this.state.heatersOn:z.includes(e)?this.state.temperatureOn:N.includes(e)?this.state.alarmsOn:!!F.includes(e)&&this.state.coolingOn}isInDeclaredKeys(e){return!!_.includes(e)||(!!j.includes(e)||(!!I.includes(e)||(!!T.includes(e)||(!!z.includes(e)||(!!N.includes(e)||F.includes(e))))))}getChartData(e){let t=[],a=[];for(let n of e){let e={name:n.InsertionTime,time:n.InsertionTime};for(let a in n.Data)this.isInDeclaredKeys(a)||t.includes(a)||t.push(a),e[a]=n.Data[a];a.push(e)}return{chartData:a,notDeclared:t}}setData(e,t){this.setState({[e]:t},()=>{this.sendData()})}sendData(){const{gateway:e,start:t,stop:a,granularity:n}=this.state;if(e&&t&&a&&void 0!==n){clearTimeout(this.state.timeout);let s=setTimeout(()=>{Object(m.e)(e,d()(t).toDate().getTime(),d()(a).toDate().getTime(),+n,this.onAsciiClimateTestingDataSuccess)},100);this.setState({timeout:s,sent:!0})}}getClosestTimestamp(e){const{chartData:t}=this.state;return t.reduce((t,a)=>Math.abs(a.time-e)e.dataKey!==s);else{let e=Object(p.d)(s),t=this.isDark(e);console.log(s,e,t),t&&(e=Object(p.d)(s+"123")),"went_zadana_przeliczona"===s&&(e=this.lightenColor(e)),console.log(e),a.push({dataKey:s,name:s,color:"#".concat(e),type:"stepAfter"})}this.setState({headers:a,[t]:!n},()=>{this.state.lastClickedTime&&this.setState({moreInfo:this.getMoreInfo(this.state.lastClickedTime)})})}getCurrentOnKeys(){let e=[];const{humidityOn:t,ventilationOn:a,ventilationSettingsOn:n,heatersOn:s,temperatureOn:r,alarmsOn:l,coolingOn:o}=this.state;return t&&(e=[...e,..._]),a&&(e=[...e,...j]),n&&(e=[...e,...I]),s&&(e=[...e,...T]),r&&(e=[...e,...z]),l&&(e=[...e,...N]),o&&(e=[...e,...F]),e}getLastValueForKey(e,t){const{params:a}=this.state;let n=a.filter(a=>a.InsertionTime<=t&&void 0!==a.Data[e]);n.sort((e,t)=>t.InsertionTime-e.InsertionTime);let s=n[0];return s?{time:s.InsertionTime,value:s.Data[e]}:{time:"-",value:"-"}}getMoreInfo(e){return this.getCurrentOnKeys().map(t=>k({key:t},this.getLastValueForKey(t,e)))}onChangeFilter(e,t){this.setState({[t]:e})}render(){const{start:e,stop:t,logs:a,headers:n,chartData:s,referenceLines:r,humidityOn:i,ventilationOn:c,ventilationSettingsOn:m,heatersOn:u,temperatureOn:p,alarmsOn:C,coolingOn:v,moreInfo:S,sent:k,notDeclared:O,notDeclaredOn:A,ticks:R,domain:B}=this.state,x=[{name:"Data",field:"InsertionTime",valueFormatter:this.dateValueFormatter,headerClassName:"index",itemClassName:"index"},{name:"Log",field:"Log"}];let L=[{name:"Klucz",field:"key"},{name:"Data",field:"time",valueFormatter:e=>"-"===e?e:d()(e).format("DD.MM.YYYY HH:mm:ss.SSS")},{name:"Warto\u015b\u0107",field:"value"}];return l.a.createElement("div",{className:"ascii-climate"},l.a.createElement(o.a,null,l.a.createElement(w.a,{label:"Plik logi (ASCIICLDebug)",type:"file",frName:"Za\u0142aduj",id:"logs",onChange:this.onLogsFileChange}),l.a.createElement(w.a,{label:"Plik dane (ASCIICLData)",type:"file",frName:"Za\u0142aduj",id:"data",onChange:this.onDataFileChange}),l.a.createElement(y.a,null,l.a.createElement(D.a,{lg:6},l.a.createElement(w.a,{label:"Od",type:"datetime-local",value:e,onChange:e=>this.onChangeFilter(e,"start")})),l.a.createElement(D.a,{lg:6},l.a.createElement(w.a,{label:"Do",type:"datetime-local",value:t,onChange:e=>this.onChangeFilter(e,"stop")}))),l.a.createElement(y.a,{className:"justify-content-end"},l.a.createElement(D.a,{lg:2,className:"d-flex justify-content-end"},l.a.createElement(g.a,{buttonColor:"success",onClick:this.onApplyFilter},"Zastosuj")))),l.a.createElement(o.a,null,l.a.createElement("h4",null,"#"),l.a.createElement(h.a,{data:a,headers:x,shouldIndex:!0,showPagination:!0,paginationItems:20,onRowClick:this.onRowClick}),l.a.createElement("h4",null,"$"),l.a.createElement(g.a,{onClick:()=>this.onTurnOnValues(_,"humidityOn"),buttonColor:i?"success":""},"Wilgotno\u015b\u0107"),l.a.createElement(g.a,{onClick:()=>this.onTurnOnValues(j,"ventilationOn"),buttonColor:c?"success":""},"Wentylacja"),l.a.createElement(g.a,{onClick:()=>this.onTurnOnValues(I,"ventilationSettingsOn"),buttonColor:m?"success":""},"Ustawienia wentylacji"),l.a.createElement(g.a,{onClick:()=>this.onTurnOnValues(T,"heatersOn"),buttonColor:u?"success":""},"Nagrzewnice"),l.a.createElement(g.a,{onClick:()=>this.onTurnOnValues(z,"temperatureOn"),buttonColor:p?"success":""},"Temperatura"),l.a.createElement(g.a,{onClick:()=>this.onTurnOnValues(N,"alarmsOn"),buttonColor:C?"success":""},"Alarmy"),l.a.createElement(g.a,{onClick:()=>this.onTurnOnValues(F,"coolingOn"),buttonColor:v?"success":""},"Ch\u0142odzenie"),O.length>0&&l.a.createElement(g.a,{buttonColor:A?"success":"",onClick:()=>this.onTurnOnValues(O,"notDeclaredOn")},"Brak grupy (",O.length,")"),l.a.createElement("div",{style:{height:"50rem"}},l.a.createElement(f.a,{refreshHideOnNewChartDef:!0,Yaxis:{name:"Warto\u015b\u0107"},Xaxis:{name:"Czas",dataKey:"name",formatter:this.dateValueFormatter,ticks:R,type:"number",domain:B},dataDef:n,data:s,legendHeight:null,referenceLines:r.map(e=>({x:this.getClosestTimestamp(e.InsertionTime),name:e.index+1})),tooltipLabelFormatter:this.dateValueFormatter,brush:{brushKey:"name",tickFormatter:this.dateValueFormatter},onChartClick:this.onChartClick})),l.a.createElement("h4",null,"Dodatkowe informacje"),l.a.createElement(h.a,{data:S,headers:L,shouldIndex:!0})),l.a.createElement(E.a,{fixed:!0},l.a.createElement(g.a,{buttonStyle:"round",icon:l.a.createElement("i",{className:"far fa-play-circle"}),onClick:this.onShowCurrentValuesClick}),k&&l.a.createElement(g.a,{buttonStyle:"round",buttonColor:"success",icon:l.a.createElement("i",{className:"fas fa-redo"}),onClick:()=>this.sendData()})),l.a.createElement(b.b,null))}}A=Object(i.connect)(e=>({gateways:e.farmDevices.devices.filter(e=>e.DevType===c.d.GATEWAY)}),e=>k({dispatch:e},Object(C.b)({show:v.d},e)))(A),t.a=A},OBwy:function(e,t,a){},Oslk:function(e,t,a){"use strict";var n=a("q1tI"),s=a.n(n),r=a("qx5e"),l=a("s506"),o=a("VyNe"),i=a("hw2D"),c=a("/MKj"),m=a("zDJl"),u=a("/kok"),d=a("ovOe"),h=a.n(d);class f extends s.a.Component{constructor(e){super(e),this.onChangeDevice=e=>{this.setState({selectValue:e}),u.a.startSendingDeviceState(e)},this.state={selectValue:void 0,options:e.devices.filter(e=>e.DevType!==m.d.GATEWAY&&e.DevType!==m.d.BRIDGE&&e.DevType!==m.d.SMALL_CAGE).map(e=>({name:e.getSelectName(),value:e}))}}getShadow(){const{shadows:e}=this.props,{selectValue:t}=this.state;try{return e.get(t.DevID)}catch(a){return null}}render(){const{selectValue:e,options:t}=this.state;let a=this.getShadow();return s.a.createElement(o.a,null,s.a.createElement(i.a,{value:e,options:t,onChange:this.onChangeDevice}),e&&s.a.createElement("div",null,s.a.createElement(h.a,{src:a,name:e.Name,collapsed:1,theme:{base00:"white",base01:"#000000",base02:"#000000",base03:"#000000",base04:"purple",base05:"#000000",base06:"#000000",base07:"#000000",base08:"#000000",base09:"#000000",base0A:"#000000",base0B:"#ffc007",base0C:"#000000",base0D:"#33cc33",base0E:"#fd3b60",base0F:"#00afff"}})))}}let g=Object(c.connect)(e=>({devices:e.farmDevices.devices,shadows:e.shadows.shadows}))(f);t.a=Object(r.a)({roles:[l.c._SERVICE],showComponent:!0})(g)},SSPK:function(e,t,a){"use strict";var n=a("mwIZ"),s=a.n(n),r=a("q1tI"),l=a.n(r),o=a("kCmh"),i=a("zDJl"),c=a("/kok"),m=a("VyNe"),u=a("uSQv"),d=a("nG5z"),h=a("AAik"),f=a("qzmO");class g extends l.a.Component{constructor(...e){super(...e),this.onClick=()=>{Object(f.i)(this.props.value)}}render(){return l.a.createElement(u.a,{buttonStyle:"round",icon:l.a.createElement("i",{className:"fas fa-arrow-alt-circle-down"}),onClick:this.onClick})}}a("5g3Z");var p=a("9D2Z"),E=a("kG49"),C=a("IXwn"),v=a("f0zD"),b=a("42VQ"),w=a("CuyV"),y=a("IBmF"),D=a("/MKj"),S=a("ANjH");class k extends l.a.Component{constructor(e){super(e),this.addressValueFormatter=e=>"0x".concat(e.toString(16).padStart(4,"0").toUpperCase()),this.restartByBroadcasts=()=>{const{farm:e}=this.props;let t=o.a.getDevices(e).filter(e=>e.DevType===i.d.BROADCAST);console.log(t);for(let a of t)Object(f.q)(a,3)},this.onRestartClick=()=>{const{data:e}=this.state,{shadows:t}=this.props;let a=[];for(let n of e){let e=t.get(n.bridgeConf.DevID),r=s()(e,"boot_info_nrf.prg_info.ver_prg");for(let l of n.multis){let e=t.get(l.DevID);s()(e,"versions[1]")!==r&&a.push(l)}}this.props.show(b.a,{title:"Restart dozownik\xf3w",text:"Czy na pewno chcesz zrestartowa\u0107 dozowniki?",confirmText:"Tak",onConfirmed:e=>{this.restartByBroadcasts(),e.handleHide()},children:l.a.createElement(l.a.Fragment,null,a.length>0&&l.a.createElement("div",null,"Nast\u0119puj\u0105ce dozowniki maj\u0105 niezaktualizowan\u0105 wersje oprogramowania:",a.map((e,t)=>l.a.createElement("div",{key:t},e.Name))))})};const{farm:t}=this.props;let a=o.a.getDevices(t),n=a.filter(e=>e.DevType===i.d.BRIDGE),r=a.filter(e=>e.DevType===i.d.DISPENSER_NRF_MULTI),m=a.filter(e=>e.DevType===i.d.BRIDGE_CONF),u=[];for(let s of n){let e=r.filter(e=>e.ParentID===s.DevID);if(e.length>0){let t=m.find(e=>e.ParentID===s.DevID);t&&u.push({bridgeConf:t,multis:e})}}let d=[];for(let s of u)d=[...d,s.bridgeConf,...s.multis];c.a.startSendingDeviceState(d),this.state={data:u,event:[],eventControlBootloader:[]}}shadowValueFormatter(e,t){const{shadows:a}=this.props;let n=a.get(e),r=s()(n,t,"");return Array.isArray(r)?r.join("/"):r}onSendDozoPrgClick(e,t){let a=this.state.event.slice(0);a[t]=e,this.setState({event:a})}onSetControlBootloader(e,t){let a=this.state.eventControlBootloader.slice(0);a[t]=e,this.setState({eventControlBootloader:a})}onSetControlBootloaderMenuClick(e,t){const{farm:a}=this.props;let n=o.a.getDevices(a).find(a=>a.DevType===i.d.BROADCAST&&a.ParentID===e.ParentID&&a.Interface===t);n&&Object(f.q)(n,3)}render(){console.log(this.state);const{shadows:e}=this.props,{data:t,event:a,eventControlBootloader:n}=this.state,r=[{name:"Nazwa",field:"Name"},{name:"Adres",field:"Address",valueFormatter:this.addressValueFormatter},{name:"Flaga",field:"DevID",valueFormatter:e=>this.shadowValueFormatter(e,"flags[1]")},{name:"Liczniki",field:"DevID",valueFormatter:e=>this.shadowValueFormatter(e,"counters")},{name:"Wersja",field:"DevID",valueFormatter:e=>this.shadowValueFormatter(e,"versions[1]")},{name:"",headerClassName:"index",itemClassName:"index",component:l.a.createElement(g,null)}];return l.a.createElement(m.a,{className:"programs"},t.map((t,o)=>{let i=e.get(t.bridgeConf.DevID);return l.a.createElement("div",{key:o},l.a.createElement("h2",null,t.bridgeConf.Name),l.a.createElement("h4",{className:"justify-content-between"},"Program NRF",l.a.createElement("div",null,l.a.createElement(w.a,{tooltipContent:y.a.B_BOOT_INFO_NRF},l.a.createElement("div",{className:"d-inline-block"},l.a.createElement(u.a,{buttonStyle:"round",icon:l.a.createElement("i",{className:"fas fa-arrow-alt-circle-down"}),onClick:()=>Object(d.c)(t.bridgeConf)}))),l.a.createElement(w.a,{tooltipContent:"".concat(y.g.SET_CONTROL_BOOTLOADER,"(3)")},l.a.createElement("div",{className:"d-inline-block"},l.a.createElement(u.a,{buttonStyle:"round",buttonColor:"error",icon:l.a.createElement("i",{className:"fas fa-redo"}),onClick:e=>this.onSetControlBootloader(e,o)}))),l.a.createElement(w.a,{tooltipContent:y.a.SET_B_SEND_DOZO_PRG},l.a.createElement("div",{className:"d-inline-block"},l.a.createElement(u.a,{buttonStyle:"round",buttonColor:"success",icon:l.a.createElement("i",{className:"fas fa-share"}),onClick:e=>this.onSendDozoPrgClick(e,o)})))),l.a.createElement(p.a,{event:a[o]},l.a.createElement(E.a,{onClick:()=>Object(d.g)(t.bridgeConf,0)},"Lewy"),l.a.createElement(E.a,{onClick:()=>Object(d.g)(t.bridgeConf,1)},"\u015arodkowy"),l.a.createElement(E.a,{onClick:()=>Object(d.g)(t.bridgeConf,2)},"Prawy")),l.a.createElement(p.a,{event:n[o]},l.a.createElement(E.a,{onClick:()=>this.onSetControlBootloaderMenuClick(t.bridgeConf,5)},"Lewy"),l.a.createElement(E.a,{onClick:()=>this.onSetControlBootloaderMenuClick(t.bridgeConf,7)},"\u015arodkowy"),l.a.createElement(E.a,{onClick:()=>this.onSetControlBootloaderMenuClick(t.bridgeConf,6)},"Prawy"))),l.a.createElement("div",null,l.a.createElement("strong",null,"Stan:")," ",s()(i,"boot_info_nrf.prg_info.state_prg","-")),l.a.createElement("div",null,l.a.createElement("strong",null,"Wersja:")," ",s()(i,"boot_info_nrf.prg_info.ver_prg","-")),l.a.createElement("div",null,l.a.createElement("strong",null,"Rozmiar:")," ",s()(i,"boot_info_nrf.prg_info.prg_size","-")),l.a.createElement("div",null,l.a.createElement("strong",null,"Nazwa:")," ",s()(i,"boot_info_nrf.prg_info.name_prg","-")),l.a.createElement(h.a,{data:t.multis,headers:r}),l.a.createElement("hr",null))}),l.a.createElement(C.a,{fixed:!0},l.a.createElement(w.a,{tooltipContent:"".concat(y.g.SET_CONTROL_BOOTLOADER,"(3)")},l.a.createElement("div",{className:"d-inline-block"},l.a.createElement(u.a,{buttonStyle:"round",buttonColor:"success",icon:l.a.createElement("i",{className:"fas fa-redo"}),onClick:this.onRestartClick})))))}}k=Object(D.connect)(e=>({farm:e.location.farm,shadows:e.shadows.shadows}),e=>Object(S.b)({show:v.d},e))(k);t.a=k},Wg2v:function(e,t,a){"use strict";var n=a("mwIZ"),s=a.n(n),r=a("q1tI"),l=a.n(r),o=a("kCmh"),i=a("/MKj"),c=a("zDJl"),m=a("qzmO"),u=a("uSQv"),d=a("/kok"),h=a("AAik"),f=a("VyNe");class g extends l.a.Component{render(){const{value:e}=this.props;return l.a.createElement("div",null,e.map((e,t)=>l.a.createElement("div",{key:t},t+1,": ",l.a.createElement("i",{className:"fas ".concat(e?"fa-check":"fa-times")}))))}}class p extends l.a.Component{constructor(...e){super(...e),this.onButtonClick=()=>{const{value:e}=this.props;Object(m.f)(e)}}render(){return l.a.createElement("div",null,l.a.createElement(u.a,{buttonStyle:"round",icon:l.a.createElement("i",{className:"fas fa-arrow-alt-circle-down"}),onClick:this.onButtonClick}))}}class E extends l.a.Component{constructor(e){super(e),this.getAllData=()=>{const{multis:e}=this.state;for(let t of e)Object(m.f)(t)},this.addressValueFormatter=e=>"0x".concat(e.toString(16).padStart(4,"0").toUpperCase());const{farm:t}=this.props;let a=o.a.getDevices(t).filter(e=>e.DevType===c.d.DISPENSER_NRF_MULTI);for(let n of a)Object(m.f)(n),d.a.startSendingDeviceState(n);this.state={multis:a}}shadowValueFormatter(e,t){const{shadows:a}=this.props;let n=a.get(e);return s()(n,t,[])}render(){const{multis:e}=this.state,t=[{name:"Nazwa",field:"Name"},{name:"Adres",field:"Address",valueFormatter:this.addressValueFormatter},{name:"Krzywe",field:"DevID",valueFormatter:e=>this.shadowValueFormatter(e,"arrCurveST"),component:l.a.createElement(g,null)},{name:"Harmonogramy",field:"DevID",valueFormatter:e=>this.shadowValueFormatter(e,"arrScheduleST"),component:l.a.createElement(g,null)},{name:"Konfiguracja",field:"DevID",valueFormatter:e=>this.shadowValueFormatter(e,"arrCurveConfigST"),component:l.a.createElement(g,null)},{name:"LED",field:"DevID",valueFormatter:e=>this.shadowValueFormatter(e,"arrLEDST"),component:l.a.createElement(g,null)},{name:"Status",field:"DevID",valueFormatter:e=>this.shadowValueFormatter(e,"arrStatusST"),component:l.a.createElement(g,null)},{name:"",itemClassName:"index",headerClassName:"index",component:l.a.createElement(p,null)}];return l.a.createElement(f.a,null,l.a.createElement(u.a,{onClick:this.getAllData},"Pobierz wszystkie"),l.a.createElement(h.a,{headers:t,data:e}))}}E=Object(i.connect)(e=>({farm:e.location.farm,shadows:e.shadows.shadows}))(E);t.a=E},Xpzc:function(e,t,a){"use strict";var n=a("q1tI"),s=a.n(n),r=a("VyNe"),l=a("RFJ0"),o=a("/MKj"),i=a("zDJl"),c=a("AF5L"),m=a("AAik"),u=a("wd/R"),d=a.n(u);class h extends s.a.Component{constructor(e){super(e),this.onGetQueuesSuccess=e=>{let t=[];for(let a in e.CAnsw.queues)t.push({name:a,value:e.CAnsw.queues[a]});this.setState({queues:t})},this.onGetQueuesFailed=()=>{this.setState({queues:[]})},this.onSelectChange=e=>{this.setState({gateway:e}),Object(c.i)(e,this.onGetQueuesSuccess,this.onGetQueuesFailed)},this.dateValueFormatter=e=>{if(e)return d()(e).format("DD.MM.YYYY HH:mm")},this.state={gateway:null,devices:e.devices.filter(e=>e.DevType===i.d.GATEWAY).map(e=>({name:e.Name,value:e})),queues:[]}}render(){const{gateway:e,devices:t,queues:a}=this.state,n=[{name:"Kolejka",field:"name"},{name:"Ostatni sukces",field:"value",valueFormatter:this.dateValueFormatter}];return s.a.createElement(r.a,null,s.a.createElement(l.a,{label:"Gateway",options:t,value:e,onChange:this.onSelectChange}),s.a.createElement(m.a,{data:a,headers:n}))}}h=Object(o.connect)(e=>({devices:e.farmDevices.devices}))(h),t.a=h},eQLf:function(e,t,a){},gtWs:function(e,t,a){"use strict";var n=a("q1tI"),s=a.n(n),r=a("/MKj"),l=a("VyNe"),o=a("zTlQ"),i=a("uSQv"),c=a("CX8Q"),m=a("iGTz"),u=a("IXwn"),d=a("3Z9Z"),h=a("JI6e"),f=a("EE6H");class g extends n.Component{constructor(...e){super(...e),this.state={amount:1e3,objects:[],generateTime:0,insertTime:0,lastInsertedObjectsAmount:0,insertTimeNoCheck:0,lastInsertedObjectsAmountNoCheck:0,getAllTime:0,objectsInLoki:m.a.getAll().length,currentLokiSize:[],overallLokiSize:0,indexedDBSize:0},this.onAmountChange=e=>{this.setState({amount:+e})},this.onGenerateClick=()=>{let e=(new Date).getTime();const{amount:t,objects:a}=this.state,{farm:n}=this.props;let s=[];for(let r=0;r{const{objects:e}=this.state;let t=(new Date).getTime();await m.a.insertIntoTest(e),this.setState({insertTime:(new Date).getTime()-t,lastInsertedObjectsAmount:e.length},()=>{this.setState({objectsInLoki:m.a.getAll().length})})},this.insertToLokiWithoutCheck=()=>{const{objects:e}=this.state;let t=(new Date).getTime();m.a.onlyInsert(e),this.setState({insertTimeNoCheck:(new Date).getTime()-t,lastInsertedObjectsAmountNoCheck:e.length},()=>{this.setState({objectsInLoki:m.a.getAll().length})})},this.clearMemoryObjects=()=>{this.setState({objects:[]})},this.getAllObjects=()=>{let e=(new Date).getTime();m.a.getAll(),this.setState({getAllTime:(new Date).getTime()-e})},this.clearLoki=()=>{m.a.clear(),this.setState({objectsInLoki:0})}}async componentDidMount(){let e=[];for(let a of f.e.collections){let t=this.getSize(a);e.push({name:a.name,count:a.count(),size:this.formatBytes(t)})}let t=await navigator.storage.estimate();this.setState({currentLokiSize:e,overallLokiSize:JSON.stringify(f.e).length,indexedDBSize:this.formatBytes(t.usageDetails.indexedDB)})}formatBytes(e,t=2){if(0===e)return"0 Bytes";const a=t<0?0:t,n=Math.floor(Math.log(e)/Math.log(1024));return parseFloat((e/Math.pow(1024,n)).toFixed(a))+" "+["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"][n]}getSize(e){let t=e.find();return JSON.stringify(t).length-2}renderLokiData(){const{currentLokiSize:e}=this.state;let t=[];for(let a=0;a({}))(m);t.a=Object(r.a)({roles:[l.c._SERVICE],showComponent:!0})(u)}}]); //# sourceMappingURL=main~1c2b3917.0413962e.chunk.js.map