Be case insenstitive

This commit is contained in:
Benjamin Drieu 2022-04-22 11:22:38 +02:00 committed by Benjamin Drieu
parent 51bfedd349
commit 5aee2cb9f2

View File

@ -164,6 +164,7 @@ class Indicator extends PanelMenu.Button {
}); });
this._searchField.connect('secondary-icon-clicked', Lang.bind(this, this._onSearchFieldActivate ) ); this._searchField.connect('secondary-icon-clicked', Lang.bind(this, this._onSearchFieldActivate ) );
this._searchField.clutter_text.connect('activate', Lang.bind(this, this._onSearchFieldActivate ) ); this._searchField.clutter_text.connect('activate', Lang.bind(this, this._onSearchFieldActivate ) );
this._searchField.clutter_text.connect('text-changed', Lang.bind(this, this._onSearchFieldActivate ) );
this._buttonMenu.actor.add_child (this._searchField); this._buttonMenu.actor.add_child (this._searchField);
@ -444,9 +445,9 @@ class Indicator extends PanelMenu.Button {
for ( let entry of processedStatus ) for ( let entry of processedStatus )
{ {
if ( this._searchString && if ( this._searchString &&
! ( entry [ 'host_name' ].includes ( this._searchString ) || ! ( entry [ 'host_name' ].toLowerCase().includes ( this._searchString ) ||
entry [ 'service_display_name' ].includes ( this._searchString ) || entry [ 'service_display_name' ].toLowerCase().includes ( this._searchString ) ||
entry [ 'status_information' ].includes ( this._searchString ) ) ) entry [ 'status_information' ].toLowerCase().includes ( this._searchString ) ) )
continue; continue;
if ( ( ! _status [ 'WARNING' ] && ! _status [ 'CRITICAL' ] && ! _status [ 'UNKNOWN' ] && entry.status == 'OK' ) || if ( ( ! _status [ 'WARNING' ] && ! _status [ 'CRITICAL' ] && ! _status [ 'UNKNOWN' ] && entry.status == 'OK' ) ||
@ -532,7 +533,7 @@ class Indicator extends PanelMenu.Button {
_onSearchFieldActivate ( e ) { _onSearchFieldActivate ( e ) {
monitoLog ( 'Search: ' + e.text ); monitoLog ( 'Search: ' + e.text );
this._searchString = e.text; this._searchString = e.text.toLowerCase();
this.refreshUI ( ); this.refreshUI ( );
return; return;
} }