mirror of https://github.com/vector-im/riot-web
show result counts
parent
f38c71d34b
commit
af3c43ca76
|
@ -479,8 +479,10 @@ module.exports = React.createClass({
|
||||||
|
|
||||||
self.setState({
|
self.setState({
|
||||||
highlights: highlights,
|
highlights: highlights,
|
||||||
|
searchTerm: term,
|
||||||
searchResults: data,
|
searchResults: data,
|
||||||
searchScope: scope,
|
searchScope: scope,
|
||||||
|
searchCount: data.search_categories.room_events.count,
|
||||||
});
|
});
|
||||||
}, function(error) {
|
}, function(error) {
|
||||||
var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
|
var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
|
||||||
|
@ -505,10 +507,14 @@ module.exports = React.createClass({
|
||||||
var EventTile = sdk.getComponent('rooms.EventTile');
|
var EventTile = sdk.getComponent('rooms.EventTile');
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
if (this.state.searchResults &&
|
if (this.state.searchResults)
|
||||||
this.state.searchResults.search_categories.room_events.results &&
|
|
||||||
this.state.searchResults.search_categories.room_events.groups)
|
|
||||||
{
|
{
|
||||||
|
if (!this.state.searchResults.search_categories.room_events.results ||
|
||||||
|
!this.state.searchResults.search_categories.room_events.groups)
|
||||||
|
{
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
// XXX: this dance is foul, due to the results API not directly returning sorted results
|
// XXX: this dance is foul, due to the results API not directly returning sorted results
|
||||||
var results = this.state.searchResults.search_categories.room_events.results;
|
var results = this.state.searchResults.search_categories.room_events.results;
|
||||||
var roomIdGroups = this.state.searchResults.search_categories.room_events.groups.room_id;
|
var roomIdGroups = this.state.searchResults.search_categories.room_events.groups.room_id;
|
||||||
|
@ -985,15 +991,22 @@ module.exports = React.createClass({
|
||||||
</div>;
|
</div>;
|
||||||
}
|
}
|
||||||
|
|
||||||
var messageComposer;
|
var messageComposer, searchInfo;
|
||||||
if (!this.state.searchResults) {
|
if (!this.state.searchResults) {
|
||||||
messageComposer =
|
messageComposer =
|
||||||
<MessageComposer room={this.state.room} roomView={this} uploadFile={this.uploadFile} />
|
<MessageComposer room={this.state.room} roomView={this} uploadFile={this.uploadFile} />
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
searchInfo = {
|
||||||
|
searchTerm : this.state.searchTerm,
|
||||||
|
searchScope : this.state.searchScope,
|
||||||
|
searchCount : this.state.searchCount,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="mx_RoomView">
|
<div className="mx_RoomView">
|
||||||
<RoomHeader ref="header" room={this.state.room} editing={this.state.editingRoomSettings} onSearchClick={this.onSearchClick}
|
<RoomHeader ref="header" room={this.state.room} searchInfo={searchInfo} editing={this.state.editingRoomSettings} onSearchClick={this.onSearchClick}
|
||||||
onSettingsClick={this.onSettingsClick} onSaveClick={this.onSaveClick} onCancelClick={this.onCancelClick} />
|
onSettingsClick={this.onSettingsClick} onSaveClick={this.onSaveClick} onCancelClick={this.onCancelClick} />
|
||||||
<div className="mx_RoomView_auxPanel">
|
<div className="mx_RoomView_auxPanel">
|
||||||
<CallView room={this.state.room} ConferenceHandler={this.props.ConferenceHandler}/>
|
<CallView room={this.state.room} ConferenceHandler={this.props.ConferenceHandler}/>
|
||||||
|
|
|
@ -187,6 +187,7 @@ module.exports = React.createClass({
|
||||||
}
|
}
|
||||||
|
|
||||||
var name = null;
|
var name = null;
|
||||||
|
var searchStatus = null;
|
||||||
var topic_el = null;
|
var topic_el = null;
|
||||||
var cancel_button = null;
|
var cancel_button = null;
|
||||||
var save_button = null;
|
var save_button = null;
|
||||||
|
@ -203,9 +204,16 @@ module.exports = React.createClass({
|
||||||
save_button = <div className="mx_RoomHeader_textButton" onClick={this.props.onSaveClick}>Save Changes</div>
|
save_button = <div className="mx_RoomHeader_textButton" onClick={this.props.onSaveClick}>Save Changes</div>
|
||||||
} else {
|
} else {
|
||||||
// <EditableText label={this.props.room.name} initialValue={actual_name} placeHolder="Name" onValueChanged={this.onNameChange} />
|
// <EditableText label={this.props.room.name} initialValue={actual_name} placeHolder="Name" onValueChanged={this.onNameChange} />
|
||||||
|
|
||||||
|
var searchStatus;
|
||||||
|
if (this.props.searchInfo && this.props.searchInfo.searchTerm) {
|
||||||
|
searchStatus = <div className="mx_RoomHeader_searchStatus"> ({ this.props.searchInfo.searchCount } results)</div>;
|
||||||
|
}
|
||||||
|
|
||||||
name =
|
name =
|
||||||
<div className="mx_RoomHeader_name" onClick={this.props.onSettingsClick}>
|
<div className="mx_RoomHeader_name" onClick={this.props.onSettingsClick}>
|
||||||
<div className="mx_RoomHeader_nametext">{ this.props.room.name }</div>
|
<div className="mx_RoomHeader_nametext">{ this.props.room.name }</div>
|
||||||
|
{ searchStatus }
|
||||||
<div className="mx_RoomHeader_settingsButton">
|
<div className="mx_RoomHeader_settingsButton">
|
||||||
<img src="img/settings.svg" width="12" height="12"/>
|
<img src="img/settings.svg" width="12" height="12"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue