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.

1 line
3.1 KiB

(window.webpackJsonp=window.webpackJsonp||[]).push([[16],{1520:function(e,t,n){"use strict";n.r(t),n.d(t,"default",(function(){return p}));var a=n(5),o=n.n(a),s=n(0),l=n.n(s),r=n(3),i=n(2),c=n.n(i),m=n(1),u=n(7),d=n(9),h=n(48),g=n(51);class p extends l.a.Component{constructor(e){super(e),o()(this,"updateCurrentRoom",async e=>{const t=g.a.get();let n;try{n=await t.getStats()}catch{return}let a=null;e&&(a=e.name);const o=t.crawlingRooms(),s=o.crawlingRooms.size,l=o.totalRooms.size;this.setState({eventIndexSize:n.size,eventCount:n.eventCount,crawlingRoomsCount:s,roomCount:l,currentRoom:a})}),o()(this,"_onDisable",async()=>{d.a.createTrackedDialogAsync("Disable message search","Disable message search",n.e(15).then(n.bind(null,1513)),null,null,!1,!0)}),o()(this,"_onDone",()=>{this.props.onFinished(!0)}),o()(this,"_onCrawlerSleepTimeChange",e=>{this.setState({crawlerSleepTime:e.target.value}),u.b.setValue("crawlerSleepTime",null,u.a.DEVICE,e.target.value)}),this.state={eventIndexSize:0,eventCount:0,crawlingRoomsCount:0,roomCount:0,currentRoom:null,crawlerSleepTime:u.b.getValueAt(u.a.DEVICE,"crawlerSleepTime")}}componentWillUnmount(){const e=g.a.get();null!==e&&e.removeListener("changedCheckpoint",this.updateCurrentRoom)}async componentWillMount(){let e=0,t=0,n=0,a=0,o=null;const s=g.a.get();if(null!==s){s.on("changedCheckpoint",this.updateCurrentRoom);try{const t=await s.getStats();e=t.size,a=t.eventCount}catch{}const l=s.crawlingRooms();t=l.crawlingRooms.size,n=l.totalRooms.size;const r=s.currentRoom();r&&(o=r.name)}this.setState({eventIndexSize:e,eventCount:a,crawlingRoomsCount:t,roomCount:n,currentRoom:o})}render(){let e;e=null===this.state.currentRoom?Object(m.a)("Not currently downloading messages for any room."):Object(m.a)("Downloading mesages for %(currentRoom)s.",{currentRoom:this.state.currentRoom});const t=r.a("views.elements.Field"),n=l.a.createElement("div",null,Object(m.a)("Riot is securely caching encrypted messages locally for them to appear in search results:"),l.a.createElement("div",{className:"mx_SettingsTab_subsectionText"},Object(m.a)("Space used:")," ",Object(h.a)(this.state.eventIndexSize,0),l.a.createElement("br",null),Object(m.a)("Indexed messages:")," ",Object(h.d)(this.state.eventCount),l.a.createElement("br",null),Object(m.a)("Indexed rooms:")," ",Object(m.a)("%(crawlingRooms)s out of %(totalRooms)s",{crawlingRooms:Object(h.d)(this.state.crawlingRoomsCount),totalRooms:Object(h.d)(this.state.roomCount)})," ",l.a.createElement("br",null),e,l.a.createElement("br",null),l.a.createElement(t,{id:"crawlerSleepTimeMs",label:Object(m.a)("Message downloading sleep time(ms)"),type:"number",value:this.state.crawlerSleepTime,onChange:this._onCrawlerSleepTimeChange}))),a=r.a("views.dialogs.BaseDialog"),o=r.a("views.elements.DialogButtons");return l.a.createElement(a,{className:"mx_ManageEventIndexDialog",onFinished:this.props.onFinished,title:Object(m.a)("Message search")},n,l.a.createElement(o,{primaryButton:Object(m.a)("Done"),onPrimaryButtonClick:this.props.onFinished,primaryButtonClass:"primary",cancelButton:Object(m.a)("Disable"),onCancel:this._onDisable,cancelButtonClass:"danger"}))}}o()(p,"propTypes",{onFinished:c.a.func.isRequired})}}]);