Skip to content

Commit dccee6d

Browse files
committed
add ability to filter room state types/results
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
1 parent af450df commit dccee6d

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

‎src/components/views/dialogs/DevtoolsDialog.js‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,9 +175,11 @@ class RoomStateExplorer extends React.Component {
175175

176176
this.onBack = this.onBack.bind(this);
177177
this.editEv = this.editEv.bind(this);
178+
this.onQuery = this.onQuery.bind(this);
178179
}
179180

180181
state = {
182+
query: '',
181183
eventType: null,
182184
event: null,
183185
};
@@ -213,6 +215,10 @@ class RoomStateExplorer extends React.Component {
213215
});
214216
}
215217

218+
onQuery(ev) {
219+
this.setState({ query: ev.target.value });
220+
}
221+
216222
render() {
217223
if (this.state.event) {
218224
return <div className="mx_ViewSource">
@@ -230,6 +236,9 @@ class RoomStateExplorer extends React.Component {
230236

231237
if (this.state.eventType === null) {
232238
Object.keys(this.roomStateEvents).forEach((evType) => {
239+
// Skip this entry if does not contain search query
240+
if (this.state.query && !evType.includes(this.state.query)) return;
241+
233242
const stateGroup = this.roomStateEvents[evType];
234243
const stateKeys = Object.keys(stateGroup);
235244

@@ -248,6 +257,9 @@ class RoomStateExplorer extends React.Component {
248257
const evType = this.state.eventType;
249258
const stateGroup = this.roomStateEvents[evType];
250259
Object.keys(stateGroup).forEach((stateKey) => {
260+
// Skip this entry if does not contain search query
261+
if (this.state.query && !stateKey.includes(this.state.query)) return;
262+
251263
const ev = stateGroup[stateKey];
252264
rows.push(<button className="mx_DevTools_RoomStateExplorer_button" key={stateKey}
253265
onClick={this.onViewSourceClick(ev)}>
@@ -258,6 +270,7 @@ class RoomStateExplorer extends React.Component {
258270

259271
return <div>
260272
<div className="mx_Dialog_content">
273+
<input onChange={this.onQuery} placeholder={_t('Filter results')} size="64" className="mx_TextInputDialog_input mx_DevTools_RoomStateExplorer_query" value={this.state.query} />
261274
{rows}
262275
</div>
263276
<div className="mx_Dialog_buttons">

‎src/skins/vector/css/vector-web/views/dialogs/_DevtoolsDialog.scss‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
.mx_DevTools_RoomStateExplorer_button {
17+
.mx_DevTools_RoomStateExplorer_button, .mx_DevTools_RoomStateExplorer_query {
1818
margin-bottom: 10px;
1919
}

0 commit comments

Comments
 (0)