You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2 lines
3.2 KiB

(window.webpackJsonp=window.webpackJsonp||[]).push([[38],{1567:function(e,t,n){"use strict";n.r(t),n.d(t,"default",(function(){return C}));var o=n(13),a=n.n(o),s=n(120),r=n.n(s),l=n(121),i=n(131),c=n(125),u=n(127),m=n(211),d=n(316),h=n(137),g=n(139),b=n(135),p=n(145);class C extends r.a.Component{constructor(e){super(e),a()(this,"updateCurrentRoom",(async e=>{var t,n,o,a;const s=d.a.get();if(!s)return;let r;try{r=await s.getStats()}catch{return}let l=null;e&&(l=e.name);const i=s.crawlingRooms(),c=i.crawlingRooms.size,u=i.totalRooms.size;this.setState({eventIndexSize:null!==(t=null===(n=r)||void 0===n?void 0:n.size)&&void 0!==t?t:0,eventCount:null!==(o=null===(a=r)||void 0===a?void 0:a.eventCount)&&void 0!==o?o:0,crawlingRoomsCount:c,roomCount:u,currentRoom:l})})),a()(this,"onDisable",(async()=>{const e=(await n.e(37).then(n.bind(null,1543))).default;u.b.createDialog(e,void 0,void 0,!1,!0)})),a()(this,"onCrawlerSleepTimeChange",(e=>{this.setState({crawlerSleepTime:parseInt(e.target.value,10)}),c.b.setValue("crawlerSleepTime",null,h.a.DEVICE,e.target.value)})),this.state={eventIndexSize:0,eventCount:0,crawlingRoomsCount:0,roomCount:0,currentRoom:null,crawlerSleepTime:c.b.getValueAt(h.a.DEVICE,"crawlerSleepTime")}}componentWillUnmount(){const e=d.a.get();null!==e&&e.removeListener("changedCheckpoint",this.updateCurrentRoom)}async componentDidMount(){let e=0,t=0,n=0,o=0,a=null;const s=d.a.get();if(null!==s){s.on("changedCheckpoint",this.updateCurrentRoom);try{const t=await s.getStats();t&&(e=t.size,o=t.eventCount)}catch{}const r=s.crawlingRooms();t=r.crawlingRooms.size,n=r.totalRooms.size;const l=s.currentRoom();l&&(a=l.name)}this.setState({eventIndexSize:e,eventCount:o,crawlingRoomsCount:t,roomCount:n,currentRoom:a})}render(){const e=i.b.get().brand;let t;t=null===this.state.currentRoom?Object(l.a)("Not currently indexing messages for any room."):Object(l.a)("Currently indexing: %(currentRoom)s",{currentRoom:this.state.currentRoom});const n=Math.max(0,this.state.roomCount-this.state.crawlingRoomsCount),o=r.a.createElement("div",null,Object(l.a)("%(brand)s is securely caching encrypted messages locally for them to appear in search results:",{brand:e}),r.a.createElement("div",{className:"mx_SettingsTab_subsectionText"},t,r.a.createElement("br",null),Object(l.a)("Space used:")," ",Object(m.a)(this.state.eventIndexSize,0),r.a.createElement("br",null),Object(l.a)("Indexed messages:")," ",Object(m.d)(this.state.eventCount),r.a.createElement("br",null),Object(l.a)("Indexed rooms:")," ",Object(l.a)("%(doneRooms)s out of %(totalRooms)s",{doneRooms:Object(m.d)(n),totalRooms:Object(m.d)(this.state.roomCount)})," ",r.a.createElement("br",null),r.a.createElement(g.a,{label:Object(l.a)("Message downloading sleep time(ms)"),type:"number",value:this.state.crawlerSleepTime.toString(),onChange:this.onCrawlerSleepTimeChange})));return r.a.createElement(b.a,{className:"mx_ManageEventIndexDialog",onFinished:this.props.onFinished,title:Object(l.a)("Message search")},o,r.a.createElement(p.a,{primaryButton:Object(l.a)("Done"),onPrimaryButtonClick:this.props.onFinished,primaryButtonClass:"primary",cancelButton:Object(l.a)("Disable"),onCancel:this.onDisable,cancelButtonClass:"danger"}))}}}}]);
//# sourceMappingURL=38.js.map