Compare commits

..

2 Commits

Author SHA1 Message Date
5aee2cb9f2 Be case insenstitive 2022-04-22 11:22:38 +02:00
51bfedd349 Make specific recheck work again 2022-04-22 11:22:25 +02:00
2 changed files with 6 additions and 7 deletions

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;
} }

View File

@ -55,7 +55,7 @@ class Icinga2API extends GenericServer {
{ {
let message = Soup.form_request_new_from_hash ( 'POST', this.urlcgi + '/actions/reschedule-check', { } ); let message = Soup.form_request_new_from_hash ( 'POST', this.urlcgi + '/actions/reschedule-check', { } );
let params = '{ "type": "Service", "filter": "host.name==\\"%s\\" && service.name==\\"%s\\"", "force": true, "pretty": true }' . format ( encodeURI ( entry.real_host_name ), encodeURI ( entry.real_service_display_name ) ); let params = '{ "type": "Service", "filter": "host.name==\\"%s\\" && service.name==\\"%s\\"", "force": true, "pretty": true }' . format ( entry.real_host_name, entry.real_service_display_name );
message.request_body.truncate(); message.request_body.truncate();
message.request_body.append ( params ); message.request_body.append ( params );
@ -63,7 +63,6 @@ class Icinga2API extends GenericServer {
message.button = entry.button; message.button = entry.button;
message.request_headers.append ( 'Accept', 'application/json' ); message.request_headers.append ( 'Accept', 'application/json' );
// log ( message.request_headers );
this.authenticateAndSend ( message, this.handleCMDMessage ); this.authenticateAndSend ( message, this.handleCMDMessage );
} }
@ -80,7 +79,6 @@ class Icinga2API extends GenericServer {
message.button = button; message.button = button;
message.request_headers.append ( 'Accept', 'application/json' ); message.request_headers.append ( 'Accept', 'application/json' );
// log ( message.request_headers );
this.authenticateAndSend ( message, this.handleCMDMessage ); this.authenticateAndSend ( message, this.handleCMDMessage );
} }