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([[21],{1462:function(e,t,n){"use strict";n.r(t),n.d(t,"default",(function(){return p}));var o=n(3),a=n.n(o),s=n(33),r=n.n(s),l=n(36),i=n(35),c=n.n(i),m=n(34),u=n(40),d=n(41),g=n(64),h=n(145);class p extends r.a.Component{constructor(e){super(e),a()(this,"updateCurrentRoom",async e=>{const t=h.a.get();let n;try{n=await t.getStats()}catch{return}let o=null;e&&(o=e.name);const a=t.crawlingRooms(),s=a.crawlingRooms.size,r=a.totalRooms.size;this.setState({eventIndexSize:n.size,eventCount:n.eventCount,crawlingRoomsCount:s,roomCount:r,currentRoom:o})}),a()(this,"_onDisable",async()=>{d.a.createTrackedDialogAsync("Disable message search","Disable message search",n.e(20).then(n.bind(null,1449)),null,null,!1,!0)}),a()(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=h.a.get();null!==e&&e.removeListener("changedCheckpoint",this.updateCurrentRoom)}async componentDidMount(){let e=0,t=0,n=0,o=0,a=null;const s=h.a.get();if(null!==s){s.on("changedCheckpoint",this.updateCurrentRoom);try{const t=await s.getStats();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(){let e;e=null===this.state.currentRoom?Object(m.a)("Not currently indexing messages for any room."):Object(m.a)("Currently indexing: %(currentRoom)s.",{currentRoom:this.state.currentRoom});const t=l.getComponent("views.elements.Field"),n=Math.max(0,this.state.roomCount-this.state.crawlingRoomsCount),o=r.a.createElement("div",null,Object(m.a)("Riot is securely caching encrypted messages locally for them to appear in search results:"),r.a.createElement("div",{className:"mx_SettingsTab_subsectionText"},e,r.a.createElement("br",null),Object(m.a)("Space used:")," ",Object(g.a)(this.state.eventIndexSize,0),r.a.createElement("br",null),Object(m.a)("Indexed messages:")," ",Object(g.d)(this.state.eventCount),r.a.createElement("br",null),Object(m.a)("Indexed rooms:")," ",Object(m.a)("%(doneRooms)s out of %(totalRooms)s",{doneRooms:Object(g.d)(n),totalRooms:Object(g.d)(this.state.roomCount)})," ",r.a.createElement("br",null),r.a.createElement(t,{label:Object(m.a)("Message downloading sleep time(ms)"),type:"number",value:this.state.crawlerSleepTime,onChange:this._onCrawlerSleepTimeChange}))),a=l.getComponent("views.dialogs.BaseDialog"),s=l.getComponent("views.elements.DialogButtons");return r.a.createElement(a,{className:"mx_ManageEventIndexDialog",onFinished:this.props.onFinished,title:Object(m.a)("Message search")},o,r.a.createElement(s,{primaryButton:Object(m.a)("Done"),onPrimaryButtonClick:this.props.onFinished,primaryButtonClass:"primary",cancelButton:Object(m.a)("Disable"),onCancel:this._onDisable,cancelButtonClass:"danger"}))}}a()(p,"propTypes",{onFinished:c.a.func.isRequired})}}]);