(this["webpackJsonpgonzo-test-client"]=this["webpackJsonpgonzo-test-client"]||[]).push([[4],{"21n7":function(e,t,a){"use strict";a.r(t),a.d(t,"Login",(function(){return _}));var s,o=a("q1tI"),n=a.n(o),r=a("/MKj"),l=a("Akpi"),i=a("oX1l"),c=a("OSpX"),m=a("fz41"),d=a("xBvN"),h=a("bKmF"),u=a("Vj+B"),D=a("EO8k"),T=a("lPiR"),p=a.n(T),f=a("/kok"),g=a("GOuw"),E=a("MyKd"),S=a("PVpG"),b=a("LCzB"),y=a("udB/"),I=a("cr+I"),C=a.n(I),v=a("XzT5");let _=Object(r.connect)(e=>({user:e.user.user,isLoading:e.user.fetching,form:e.form,userStore:e.user}))(s=class extends o.Component{constructor(e){super(e),this.state={error:"",user:null,loading:!1,username:null,passwd:null},this.messageMap=e=>{switch(e){case"Username cannot be empty":this.setState({error:v.a.t("errors.noEmptyLogin")});break;case"Confirmation code cannot be empty":this.setState({error:v.a.t("errors.noEmptyVerificationCode")});break;case"Password cannot be empty":this.setState({error:v.a.t("errors.noEmptyPassword")});break;case"Password does not conform to policy: Password not long enough":this.setState({error:v.a.t("errors.passLognerThan")});break;case"Password does not conform to policy: Password must have uppercase characters":this.setState({error:v.a.t("errors.passMinOneBig")});break;case"Password attempts exceeded":this.setState({error:v.a.t("errors.passwordAttemptsExceeded")});break;default:return Object(S.a)(e)}},this.clearErrors=()=>{this.setState({error:""})},this.hubListener=async e=>{if(this.setState({error:""}),"signIn_failure"===e.payload.event&&"NetworkError"===e.payload.data.code){let e=document.getElementById("username").value,t=document.getElementById("password").value,a=p()(t).toString();await this.offlineLogin(e,a)}else"configured"===e.payload.event?this.setState({error:this.messageMap(e.payload.message)}):e.payload.data&&this.setState({error:this.messageMap(e.payload.data.message)})},this.onStateChange=async e=>{const{t:t}=this.props;switch(this.setState({error:""}),e){case"signedIn":this.props.dispatch(Object(l.h)(!0));break;case"confirmSignUp":this.setState({error:t("errors.UserNotConfirmed")})}},console.error("login constructor");let t=null;for(let a=0;a{this.setState({loading:!1}),localStorage.removeItem("".concat(e,".token")),localStorage.removeItem("".concat(e,".createTokenTime")),localStorage.removeItem("".concat(e,".localRefreshToken")),localStorage.removeItem("".concat(e,".createRefreshTokenTime"))}).catch(t=>{if(localStorage.getItem("".concat(e,".createRefreshTokenTime"))>(new Date).getTime()){let t=localStorage.getItem("".concat(e,".localRefreshToken"));this.offlineLogin(e,null,t)}})}g.f.listen("auth",this.hubListener)}async componentDidMount(){let e=await Object(m.b)();const{location:t}=this.props;let a=null,s=null;if("/login"===t.pathname){let e=C.a.parse(t.search);if(e){const{userName:t,pwd:o}=e;a=t,s=o}}this.setState({user:e||null,username:a,passwd:s})}async offlineLogin(e,t,a){this.props.dispatch(Object(E.a)(!0)),setTimeout(()=>{this.props.dispatch(Object(E.a)(!1))},2e4),setTimeout(()=>{this.setState({loading:!1})},300),await f.a.localAuthUser(e,t,a,t=>{this.props.dispatch({type:"USER_GET_ATTRIBUTES_FULFILLED",payload:{sub:t.CAnsw.user.sub}}),this.props.dispatch({type:"GET_USER_FULFILLED",payload:t.CAnsw.user}),this.props.dispatch({type:"MQTT_CONNECT_FULFILLED"}),Object(l.i)({value:t.CAnsw.user},this.props.dispatch,t.CAnsw.user.sub),localStorage.setItem("".concat(e,".token"),t.CAnsw.token),localStorage.setItem("".concat(e,".createTokenTime"),t.CAnsw.createTokenTime),localStorage.setItem("".concat(e,".localRefreshToken"),t.CAnsw.refreshToken),localStorage.setItem("".concat(e,".createRefreshTokenTime"),t.CAnsw.createRefreshTokenTime)},(t,a)=>{"task_timeout"===t?this.setState({error:this.messageMap("No connection to server")}):1===t.code?this.setState({error:this.messageMap("Incorrect username or password.")}):3===t.code?this.setState({error:this.messageMap("Session expired.")}):(this.setState({error:"???"}),console.error(t,a)),this.props.dispatch(Object(E.a)(!1)),f.a.endConnection(),localStorage.removeItem("".concat(e,".token")),localStorage.removeItem("".concat(e,".createTokenTime")),localStorage.removeItem("".concat(e,".localRefreshToken")),localStorage.removeItem("".concat(e,".createRefreshTokenTime"))})}componentWillUnmount(){g.f.remove("auth",this.hubListener)}render(){const{user:e,error:t,loading:a,username:s,passwd:o}=this.state;return n.a.createElement(n.a.Fragment,null,n.a.createElement(y.a,{isLoading:a}),n.a.createElement(i.a,{hide:[i.g,i.d,i.c,i.b,i.f,i.h,i.e],onStateChange:this.onStateChange,authData:e,errorMessage:this.messageMap,theme:{toast:{display:"none"}},ref:this.authenticator},n.a.createElement(c.a,{clear:this.clearErrors,log:s,pass:o,error:t}),n.a.createElement(d.a,{error:t}),n.a.createElement(h.a,{error:t}),n.a.createElement(u.a,{error:t}),n.a.createElement(D.a,{error:t})))}})||s;_=Object(b.a)()(_),t.default=_},"8oQF":function(e,t,a){"use strict";a.r(t),a.d(t,"farmDevices",(function(){return r})),a.d(t,"default",(function(){return l}));var s=a("q1tI"),o=a.n(s),n=(a("VyNe"),a("zTlQ"),a("uSQv"),a("B/gD"),a("vzZS"),a("S8cm"),a("Uh9e"),a("PjVZ"),a("0PSs"),a("Qvmw"),a("GQws"),a("Jxr4"),a("KVmA"),a("nPqS"),a("unVT"),a("HuqI"),a("feJH"),a("ZVDl"),a("pEX4"),a("Hlay"),a("9jj8"),a("0ajJ"),a("G7tO"),a("wd/R"),a("qWIT"),a("MUrI"),a("AAik"));const r={devices:[{DtaModTime:1550091878153,Ver:"1.01",GatewayID:"GW_DEMO_19_02_13_220252808",Settings:{SSHPublicKey:"none",SSHPrivateKey:"none",CertID:"7db5ce2ded8cf306b110445893f4c14b027cca2c35ac33e0cf5057e8186803d8"},VerHard:"0",CliIDFaID_C:"WesstronDemo+WesstronDemoFarm",DevType:"GW",FarmID:"WesstronDemoFarm",VerSoft:"0",DevID:"GW_DEMO_19_02_13_220252808",PlcmntID:"unbinded",Name:"?",$loki:1},{Address:2,DtaModTime:1550126830299,Settings:{},CliIDFaID_C:"WesstronDemo+WesstronDemoFarm",DevType:"CL",FarmID:"WesstronDemoFarm",Interface:4,ParentID:"mUf2v0qlSGAw-Dsl329E",DtaCrtTime:1550126830299,DevID:"GLRXWUUibL6h1ryjWAE2",Name:"Sterownik klimatu",$loki:2,GatewayID:"GW_DEMO_19_02_13_220252808"},{Address:10,DtaModTime:1550129563862,Settings:{},CliIDFaID_C:"WesstronDemo+WesstronDemoFarm",DevType:"SC",FarmID:"WesstronDemoFarm",Interface:4,ParentID:"mUf2v0qlSGAw-Dsl329E",DtaCrtTime:1550128489631,DevID:"V7A2jlnaA7A8Gb5Y2VtS",Siloses:[{Active:!0,Capacity:1e4,Adr:0,Name:"Silos 1"},{Active:!0,Capacity:1e4,Adr:1,Name:"Silos 2"},{Adr:2},{Adr:3},{Adr:4},{Adr:5},{Adr:6},{Adr:7}],Name:"Sterownik wag",$loki:3,GatewayID:"GW_DEMO_19_02_13_220252808"},{Address:1,DtaModTime:1550132294623,Interfaces:[null,"CAN","CAN","WST","WST","NRF","NRF","NRF",null,null,"LCD",null,null,null],VerHard:"0.1",CliIDFaID_C:"WesstronDemo+WesstronDemoFarm",DevType:"BR",FarmID:"WesstronDemoFarm",ParentID:"GW_DEMO_19_02_13_220252808",VerSoft:"0.1",DtaCrtTime:1550126726195,DevID:"mUf2v0qlSGAw-Dsl329E",Name:"Bridge",$loki:4,GatewayID:"GW_DEMO_19_02_13_220252808"},{Address:8961,DtaModTime:1550134181564,VerHard:"0.1",CliIDFaID_C:"WesstronDemo+WesstronDemoFarm",DevType:"DI_NRF",FarmID:"WesstronDemoFarm",Interface:5,ParentID:"mUf2v0qlSGAw-Dsl329E",VerSoft:"0.1",DtaCrtTime:1550134181564,DevID:"mUf2v0qlSGAw-Dsl329E_L_0x2301",Name:"Dispenser Nrf",$loki:5,GatewayID:"GW_DEMO_19_02_13_220252808"},{Address:9473,DtaModTime:1550134181622,VerHard:"0.1",CliIDFaID_C:"WesstronDemo+WesstronDemoFarm",DevType:"DI_NRF",FarmID:"WesstronDemoFarm",Interface:5,ParentID:"mUf2v0qlSGAw-Dsl329E",VerSoft:"0.1",DtaCrtTime:1550134181622,DevID:"mUf2v0qlSGAw-Dsl329E_L_0x2501",Name:"Dispenser Nrf",$loki:6,GatewayID:"GW_DEMO_19_02_13_220252808"},{Address:4865,DtaModTime:1550134183416,VerHard:"0.1",CliIDFaID_C:"WesstronDemo+WesstronDemoFarm",DevType:"DI_NRF",FarmID:"WesstronDemoFarm",Interface:7,ParentID:"mUf2v0qlSGAw-Dsl329E",VerSoft:"0.1",DtaCrtTime:1550134183416,DevID:"mUf2v0qlSGAw-Dsl329E_C_0x1301",Name:"Dispenser Nrf",$loki:7,GatewayID:"GW_DEMO_19_02_13_220252808"},{Address:5889,DtaModTime:1550134183419,VerHard:"0.1",CliIDFaID_C:"WesstronDemo+WesstronDemoFarm",DevType:"DI_NRF",FarmID:"WesstronDemoFarm",Interface:7,ParentID:"mUf2v0qlSGAw-Dsl329E",VerSoft:"0.1",DtaCrtTime:1550134183419,DevID:"mUf2v0qlSGAw-Dsl329E_C_0x1701",Name:"Dispenser Nrf",$loki:8,GatewayID:"GW_DEMO_19_02_13_220252808"},{Address:1,DtaModTime:1550231510053,Settings:{Insertions:[{Start:15501852e5,PigsInserted:400}]},CliIDFaID_C:"WesstronDemo+WesstronDemoFarm",DevType:"CA",FarmID:"WesstronDemoFarm",Interface:3,ParentID:"mUf2v0qlSGAw-Dsl329E",DtaCrtTime:1550126814760,DevID:"prGiB2NDvJ-3jF4qNXSc",Name:"Klatka separacyjna",$loki:9,GatewayID:"GW_DEMO_19_02_13_220252808"}],fetching:!1,fetched:!0,connected:!1,connectedDevices:{},pingedDevices:{},devicesSearch:!1,devicesFound:[],startedAddressing:!1,updateSend:{}};class l extends o.a.Component{constructor(e){super(e),this.hehe=({text:e,style:t})=>o.a.createElement("div",{style:t},e),this.state={itemPickerValue:1,rolePickerValue:0}}render(){const e=new Array(50).fill(1).map((e,t)=>({name1:"TestTestTestTestTestTestTestTestTestTestTestTestTestTest",name2:"TestTestTestTestTestTestTestTestTestTestTestTestTestTest",name3:"TestTestTestTestTestTestTestTestTestTestTestTestTestTest",name4:"TestTestTestTestTestTestTestTestTestTestTestTestTestTest",name5:"TestTestTestTestTestTestTestTestTestTestTestTestTestTest",name6:"TestTestTestTestTestTestTestTestTestTestTestTestTestTest",name7:"TestTestTestTestTestTestTestTestTestTestTestTestTestTest",name8:"TestTestTestTestTestTestTestTestTestTestTestTestTestTest"}));return o.a.createElement("div",null,o.a.createElement(n.a,{resizable:!0,data:e,headers:[{name:"Name 1",field:"name1"},{name:"Name 2",field:"name2"},{name:"Name 3",field:"name3"},{name:"Name 4",field:"name4"},{name:"Name 5",field:"name5"},{name:"Name 6",field:"name6"},{name:"Name 7",field:"name7"},{name:"Name 8",field:"name8"}]}))}}},DyQg:function(e,t,a){"use strict";a.r(t),a.d(t,"Home",(function(){return C}));var s,o=a("q1tI"),n=a.n(o),r=a("/MKj"),l=a("EE6H"),i=a("dxSB"),c=a("ANjH"),m=a("f0zD"),d=a("VfnB"),h=a("1EKS"),u=a.n(h),D=a("m9wQ"),T=a("zDJl"),p=a("5Z9N"),f=a("i8MS"),g=a("OwcS"),E=a("+t3Z"),S=a("10H7"),b=a("qx5e"),y=a("s506"),I=a("/kok");let C=Object(r.connect)(e=>({farms:e.farms.farms,devices:e.farmDevices.devices,user:e.user.user}))(s=class extends o.Component{constructor(e){super(e),this.getAnimal=async()=>{let e=await f.a.getAllAnimals(void 0,void 0,!0);console.log(e),this.setState({animal:e[0]})},this.changeAnimalWithoutCloning=()=>{let e=this.state.animal;e&&(e.AnmNo1=100*Math.random()+1+"",this.setState({animal:e}))},this.onGetAllAnimalsClick=()=>{f.a.getAllAnimals("WesstronNewiot1")},this.clone=()=>{let e=f.a._findOneAnimal({});console.log(e);let t=e.clone();console.log(t.equals(e)),t.setDthTime(),e.equals(t)?console.log("xD"):console.log("xD2"),t.isDead()?console.log("xD"):console.log("xD2"),console.log(t),t.removeDthTime(),console.log(t)},this.createEvent=()=>{let e=E.a.createEvent("qweqewqew",S.b.NO_PREGNANCY,1,+new Date,"qweqwqwe","ASDasdasd",{Reason:"qweqew"});console.log(e)},this.state={thingName:"",thingCommand:"",animal:void 0},this.handleChangeThing=this.handleChangeThing.bind(this),this.handleChangeCommand=this.handleChangeCommand.bind(this),this.handleSubmit=this.handleSubmit.bind(this),this.handleGetHelp=this.handleGetHelp.bind(this),this.onClick=this.onClick.bind(this)}handleChangeThing(e){this.setState({thingName:e.target.value})}handleChangeCommand(e){this.setState({thingCommand:e.target.value})}onClick(){this.props.devices.filter(e=>+e.DevType===+T.d.FEEDER).map((e,t)=>{})}handleSubmit(e){}handleGetHelp(e){console.log("HELP!")}async componentDidMount(){}async handleDeleteDatabase(){await l.f.deleteDatabase().then(e=>l.f.loadDatabase()),l.f.getDatabaseList()}getAllEvents(){this.props.farms.map(e=>{this.props.dispatch(Object(p.b)(e.FarmID))})}handleGetCageData(){this.props.dispatch(Object(i.a)("cageTest03"))}cTrans(){}onCommandHistoryClick(){}hancleOnClickGetFeedData(){I.a.createAndSendMessageObjectToStateTopic("TestNewRole","GW_DANB_PRIV_19_07_05_113809003","ServiceWesstronDB-12072019","GW_DANB_PRIV_19_07_05_113809003","GET_FEED_STATE",{DeviceIDs:["4AmHuHEjJobDmMArzxX4"]})}curve2(e){return e.map(e=>{let t={};t.dailyDose=e.dailyDose,t.scheduleNumber=e.scheduleNumber,t.foodType=e.foodType}),[]}getErrors(){}sendErrorsReport(){}render(){let e=[{foodType:0,scheduleNumber:1,dailyDose:100},{foodType:0,scheduleNumber:1,dailyDose:200},{foodType:0,scheduleNumber:1,dailyDose:300},{foodType:0,scheduleNumber:1,dailyDose:400},{foodType:0,scheduleNumber:1,dailyDose:500},{foodType:0,scheduleNumber:1,dailyDose:600},{foodType:0,scheduleNumber:1,dailyDose:700},{foodType:0,scheduleNumber:1,dailyDose:800},{foodType:0,scheduleNumber:1,dailyDose:900},{foodType:0,scheduleNumber:1,dailyDose:1e3}];return n.a.createElement("div",null,n.a.createElement("div",{className:"main-map"},n.a.createElement("button",{onClick:this.handleDeleteDatabase.bind(this)},"DROP DB LOKI JS"),n.a.createElement("button",{onClick:()=>this.getAllEvents()},"GET ALL EVENTS FOR ALL FARMS"),n.a.createElement("button",{onClick:()=>this.props.dispatch(Object(i.a)("CageTest02-biuro"))},"GET DATA CAGE"),n.a.createElement("button",{onClick:()=>this.cTrans()},"GET DATA CAGE")),n.a.createElement("button",{onClick:()=>this.onCommandHistoryClick()},"Pobierz command history"),n.a.createElement("button",{onClick:this.onClick},"WYSLIJ WIADOMOSC DO 5 STEROWNIKOW"),n.a.createElement("p",null,"Hash from ciesiu: 5fa769ee6426ef1267b28680575c5c8b9bd81f1d"),n.a.createElement("p",null,"Hash Ciesiu String: ",u()('[{"foodType":0,"scheduleNumber":1,"dailyDose":100},{"foodType":0,"scheduleNumber":1,"dailyDose":200},{"foodType":0,"scheduleNumber":1,"dailyDose":300},{"foodType":0,"scheduleNumber":1,"dailyDose":400},{"foodType":0,"scheduleNumber":1,"dailyDose":500},{"foodType":0,"scheduleNumber":1,"dailyDose":600},{"foodType":0,"scheduleNumber":1,"dailyDose":700},{"foodType":0,"scheduleNumber":1,"dailyDose":800},{"foodType":0,"scheduleNumber":1,"dailyDose":900},{"foodType":0,"scheduleNumber":1,"dailyDose":1000}]')),n.a.createElement("p",null,"Hash default: ",u()(e)),n.a.createElement("p",null,"Hash default dif order: ",u()(this.curve2(e))),n.a.createElement("p",null,"Hash toString: ",u()(e.toString())),n.a.createElement("p",null,"Hash Stringify: ",Object(D.b)(JSON.stringify(e))),n.a.createElement("p",null,"Hash Stringify remove whitespace: ",u()(JSON.stringify(e).replace(/\s/g,""))),n.a.createElement("button",{onClick:()=>this.getErrors()},"Pobierz b\u0142\u0119dy z urz\u0105dze\u0144"),n.a.createElement("button",{onClick:()=>this.sendErrorsReport()},"Wy\u015blij raport b\u0142\u0119d\xf3w"),n.a.createElement("button",{onClick:()=>console.log(Object(d.h)(this.props.devices,this.props.devices.filter(e=>e.DevType===T.d.GATEWAY)[0]))},"Generate dev tree"),n.a.createElement("div",null,n.a.createElement("h4",null,"LokiJS"),n.a.createElement("button",{onClick:this.getAnimal},"Pobierz warto\u015b\u0107 z animals"),n.a.createElement("button",{onClick:this.changeAnimalWithoutCloning},"Zmie\u0144 numer zwierz\u0119cia bez klonowania"),n.a.createElement("button",null,"Zmie\u0144 numer z klonowaniem"),n.a.createElement("div",null,this.state.animal&&JSON.stringify(this.state.animal))),n.a.createElement("div",null,n.a.createElement("button",{onClick:this.onGetAllAnimalsClick},"GET ALL ANIMALS")),n.a.createElement("div",null,n.a.createElement("button",{onClick:()=>this.setState({generatedID:Object(g.a)()})},"Generate id"),n.a.createElement("div",null,this.state.generatedID)),n.a.createElement("div",null,"test klas",n.a.createElement("button",{onClick:this.clone},"Klonowanie"),n.a.createElement("button",{onClick:this.createEvent},"Utworz event")),n.a.createElement("div",null,n.a.createElement("button",{onClick:()=>this.props.crash.me.please.xd},"crash")),n.a.createElement("div",null,n.a.createElement("button",{onClick:this.hancleOnClickGetFeedData},"getFeedData")))}})||s,v=Object(r.connect)(null,e=>Object(c.b)({show:m.d},e))(C);v=Object(b.a)({roles:[y.c._SERVICE],showComponent:!0})(v),t.default=v},SU1m:function(e,t,a){"use strict";a.r(t),a.d(t,"Home",(function(){return i}));var s,o=a("q1tI"),n=a.n(o),r=a("/MKj"),l=a("Ty5D");let i=Object(r.connect)(e=>({farm:e.location.farm}))(s=class extends o.Component{constructor(e){super(e);const{farm:t}=this.props;this.props.history.push("/".concat(t,"/farm"))}render(){return n.a.createElement("div",null)}})||s;t.default=Object(l.o)(i)},kYAI:function(e,t,a){"use strict";a.r(t);var s,o=a("q1tI"),n=a.n(o),r=(a("puDK"),a("3Z9Z")),l=a("JI6e"),i=a("VyNe"),c=a("uSQv"),m=a("+PoS"),d=a("LCzB"),h=a("/MKj");let u=Object(h.connect)()(s=class extends n.a.Component{constructor(...e){super(...e),this.onBack=()=>{const{dispatch:e}=this.props;e(Object(m.a)("/"))}}render(){const{t:e}=this.props;return n.a.createElement("div",{className:"not-found-component"},n.a.createElement(r.a,{bsPrefix:"row h-100 justify-content-center align-items-center w-100 mx-auto"},n.a.createElement(l.a,{lg:6},n.a.createElement(i.a,null,n.a.createElement("h4",null,e("pageNotFound.title")+" :("),n.a.createElement("p",null,e("pageNotFound.message")," ",n.a.createElement(c.a,{type:"button",onClick:this.onBack},e("here")))))))}})||s;t.default=Object(d.a)()(u)},puDK:function(e,t,a){}}]); //# sourceMappingURL=main~0c5477f6.77eee645.chunk.js.map