ManageEventIndexDialog: Show how many rooms are being currently crawled.

This commit is contained in:
Damir Jelić 2020-02-01 12:00:04 +01:00
parent 98c8986ead
commit 75fe3c2219
3 changed files with 40 additions and 3 deletions

View file

@ -38,6 +38,7 @@ export default class ManageEventIndexDialog extends React.Component {
this.state = {
eventIndexSize: 0,
eventCount: 0,
crawlingRoomsCount: 0,
roomCount: 0,
currentRoom: null,
crawlerSleepTime:
@ -51,11 +52,15 @@ export default class ManageEventIndexDialog extends React.Component {
let currentRoom = null;
if (room) currentRoom = room.name;
const roomStats = eventIndex.crawlingRooms();
const crawlingRoomsCount = roomStats.crawlingRooms.size;
const roomCount = roomStats.totalRooms.size;
this.setState({
eventIndexSize: stats.size,
roomCount: stats.roomCount,
eventCount: stats.eventCount,
crawlingRoomsCount: crawlingRoomsCount,
roomCount: roomCount,
currentRoom: currentRoom,
});
}
@ -70,6 +75,7 @@ export default class ManageEventIndexDialog extends React.Component {
async componentWillMount(): void {
let eventIndexSize = 0;
let crawlingRoomsCount = 0;
let roomCount = 0;
let eventCount = 0;
let currentRoom = null;
@ -80,8 +86,10 @@ export default class ManageEventIndexDialog extends React.Component {
eventIndex.on("changedCheckpoint", this.updateCurrentRoom.bind(this));
const stats = await eventIndex.getStats();
const roomStats = eventIndex.crawlingRooms();
eventIndexSize = stats.size;
roomCount = stats.roomCount;
crawlingRoomsCount = roomStats.crawlingRooms.size;
roomCount = roomStats.totalRooms.size;
eventCount = stats.eventCount;
const room = eventIndex.currentRoom();
@ -91,6 +99,7 @@ export default class ManageEventIndexDialog extends React.Component {
this.setState({
eventIndexSize,
eventCount,
crawlingRoomsCount,
roomCount,
currentRoom,
});
@ -135,7 +144,7 @@ export default class ManageEventIndexDialog extends React.Component {
<div className='mx_SettingsTab_subsectionText'>
{_t("Space used:")} {formatBytes(this.state.eventIndexSize, 0)}<br />
{_t("Indexed messages:")} {formatCountLong(this.state.eventCount)}<br />
{_t("Number of rooms:")} {formatCountLong(this.state.roomCount)}<br />
{_t("Number of rooms:")} {formatCountLong(this.state.crawlingRoomsCount)} {_t("of")} {formatCountLong(this.state.roomCount)}<br />
{crawlerState}<br />
<Field
id={"crawlerSleepTimeMs"}