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.2 KiB

(window.webpackJsonp=window.webpackJsonp||[]).push([[17],{1453: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),r=n.n(s),l=n(3),i=n(2),c=n.n(i),u=n(1),m=n(7),h=n(9),d=n(48),g=n(54);class p extends r.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,r=o.totalRooms.size;this.setState({eventIndexSize:n.size,eventCount:n.eventCount,crawlingRoomsCount:s,roomCount:r,currentRoom:a})}),o()(this,"_onDisable",async()=>{h.a.createTrackedDialogAsync("Disable message search","Disable message search",n.e(16).then(n.bind(null,1446)),null,null,!1,!0)}),o()(this,"_onDone",()=>{this.props.onFinished(!0)}),o()(this,"_onCrawlerSleepTimeChange",e=>{this.setState({crawlerSleepTime:e.target.value}),m.b.setValue("crawlerSleepTime",null,m.a.DEVICE,e.target.value)}),this.state={eventIndexSize:0,eventCount:0,crawlingRoomsCount:0,roomCount:0,currentRoom:null,crawlerSleepTime:m.b.getValueAt(m.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 r=s.crawlingRooms();t=r.crawlingRooms.size,n=r.totalRooms.size;const l=s.currentRoom();l&&(o=l.name)}this.setState({eventIndexSize:e,eventCount:a,crawlingRoomsCount:t,roomCount:n,currentRoom:o})}render(){let e;e=null===this.state.currentRoom?Object(u.a)("Not currently indexing messages for any room."):Object(u.a)("Currently indexing: %(currentRoom)s.",{currentRoom:this.state.currentRoom});const t=l.a("views.elements.Field"),n=Math.max(0,this.state.roomCount-this.state.crawlingRoomsCount),a=r.a.createElement("div",null,Object(u.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(u.a)("Space used:")," ",Object(d.a)(this.state.eventIndexSize,0),r.a.createElement("br",null),Object(u.a)("Indexed messages:")," ",Object(d.d)(this.state.eventCount),r.a.createElement("br",null),Object(u.a)("Indexed rooms:")," ",Object(u.a)("%(doneRooms)s out of %(totalRooms)s",{doneRooms:Object(d.d)(n),totalRooms:Object(d.d)(this.state.roomCount)})," ",r.a.createElement("br",null),r.a.createElement(t,{id:"crawlerSleepTimeMs",label:Object(u.a)("Message downloading sleep time(ms)"),type:"number",value:this.state.crawlerSleepTime,onChange:this._onCrawlerSleepTimeChange}))),o=l.a("views.dialogs.BaseDialog"),s=l.a("views.elements.DialogButtons");return r.a.createElement(o,{className:"mx_ManageEventIndexDialog",onFinished:this.props.onFinished,title:Object(u.a)("Message search")},a,r.a.createElement(s,{primaryButton:Object(u.a)("Done"),onPrimaryButtonClick:this.props.onFinished,primaryButtonClass:"primary",cancelButton:Object(u.a)("Disable"),onCancel:this._onDisable,cancelButtonClass:"danger"}))}}o()(p,"propTypes",{onFinished:c.a.func.isRequired})}}]);