Fix URL stuff
This commit is contained in:
parent
f0e5d0ba3f
commit
3be7b5240d
24
extension.js
24
extension.js
@ -39,7 +39,7 @@ const PopupMenu = imports.ui.popupMenu;
|
||||
const Gettext = imports.gettext.domain(GETTEXT_DOMAIN);
|
||||
const _ = Gettext.gettext;
|
||||
|
||||
const { GObject, St, Clutter, Gio, GLib } = imports.gi;
|
||||
const { GObject, St, Clutter, Gio, GLib, Pango } = imports.gi;
|
||||
|
||||
const SETTINGS_SCHEMA = "org.gnome.shell.extensions.monito";
|
||||
const SETTINGS_SCHEMA_ACCOUNT = "org.gnome.shell.extensions.monito.account";
|
||||
@ -341,7 +341,7 @@ class Indicator extends PanelMenu.Button {
|
||||
style: ( col.style ? col.style : '' ) } );
|
||||
_child.original_text = text.toString();
|
||||
_child.connect('button-press-event', Lang.bind(this, this._onExpandLabel ) );
|
||||
_child.connect('notify::hover', Lang.bind(this, this._onEnterEvent ) );
|
||||
// _child.connect('notify::hover', Lang.bind(this, this._onEnterEvent ) );
|
||||
}
|
||||
else if ( col.special == 'actions' )
|
||||
{
|
||||
@ -594,10 +594,10 @@ class Indicator extends PanelMenu.Button {
|
||||
|
||||
}
|
||||
|
||||
_onEnterEvent ( e )
|
||||
{
|
||||
log ( "Monito: enter");
|
||||
}
|
||||
// _onEnterEvent ( e )
|
||||
// {
|
||||
// log ( "Monito: enter");
|
||||
// }
|
||||
|
||||
_onOpenInBrowser ( e )
|
||||
{
|
||||
@ -616,24 +616,20 @@ class Indicator extends PanelMenu.Button {
|
||||
proc.wait_async(cancellable, (proc, result) => {
|
||||
try {
|
||||
proc.wait_finish(result);
|
||||
|
||||
if (proc.get_successful()) {
|
||||
log ( 'Monito: the process succeeded');
|
||||
} else {
|
||||
if ( ! proc.get_successful()) {
|
||||
log ( 'Monito: the process failed' );
|
||||
}
|
||||
this.stopChildSpin ( e.service.button );
|
||||
|
||||
} catch (e) {
|
||||
logError(e);
|
||||
} finally {
|
||||
loop.quit();
|
||||
}
|
||||
});
|
||||
log ( 'Monito: ' + proc );
|
||||
} catch ( e ) {
|
||||
log ( 'Monito: ' + e );
|
||||
log ( 'Monito err: ' + e.message );
|
||||
Main.notifyError ( _('Unable to execute command: %s').format ( e.message ) );
|
||||
}
|
||||
this.stopChildSpin ( e.service.button );
|
||||
}
|
||||
|
||||
_createButton ( sizeName, icon, data, callback ) {
|
||||
|
@ -106,4 +106,11 @@ class Icinga extends GenericServer {
|
||||
}
|
||||
}
|
||||
|
||||
getUrlForService ( service )
|
||||
{
|
||||
return '%s/?type=2&host=%s&service=%s'.format ( this._settings.get_string ( 'urlcgi' ).replace ( /status.cgi/, 'extinfo.cgi' ),
|
||||
encodeURI ( service.real_host_name ),
|
||||
encodeURI ( service.service_display_name ) );
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -82,7 +82,11 @@ class Icinga2 extends GenericServer {
|
||||
|
||||
getUrlForService ( service )
|
||||
{
|
||||
return this._settings.get_string ( 'url' ) ; // + monitoring/service/show?host=XXX&service=XXX
|
||||
log ( service );
|
||||
return '%s/monitoring/service/show?host=%s&service=%s'.format ( this._settings.get_string ( 'url' ),
|
||||
service.host_name,
|
||||
service.service_display_name );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -102,6 +102,7 @@ class Icinga2API extends GenericServer {
|
||||
// log ( JSON.stringify(entry) );
|
||||
this.status.service_status.push ( {
|
||||
status: _statuses[entry.attrs.state],
|
||||
real_host_name: entry.attrs.host_name,
|
||||
host_name: entry.attrs.host_name,
|
||||
service_display_name: entry.attrs.display_name,
|
||||
has_been_acknowledged: parseInt(entry.attrs.acknowledgement),
|
||||
@ -124,8 +125,9 @@ class Icinga2API extends GenericServer {
|
||||
|
||||
getUrlForService ( service )
|
||||
{
|
||||
return this._settings.get_string ( 'url' ) ;
|
||||
return '%s/monitoring/service/show?host=%s&service=%s'.format ( this._settings.get_string ( 'url' ),
|
||||
encodeURI ( service.real_host_name ),
|
||||
encodeURI ( service.service_display_name ) );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -109,5 +109,3 @@
|
||||
.small-button {
|
||||
padding: 3px !important;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user