Compare commits
No commits in common. "66f1deed14d04ded616923ea5063bf1e5199a53a" and "b8eba20b7cb7ebf2ff3e70d6064e95b107bba83f" have entirely different histories.
66f1deed14
...
b8eba20b7c
24
extension.js
24
extension.js
@ -39,7 +39,7 @@ const PopupMenu = imports.ui.popupMenu;
|
|||||||
const Gettext = imports.gettext.domain(GETTEXT_DOMAIN);
|
const Gettext = imports.gettext.domain(GETTEXT_DOMAIN);
|
||||||
const _ = Gettext.gettext;
|
const _ = Gettext.gettext;
|
||||||
|
|
||||||
const { GObject, St, Clutter, Gio, GLib, Pango } = imports.gi;
|
const { GObject, St, Clutter, Gio, GLib } = imports.gi;
|
||||||
|
|
||||||
const SETTINGS_SCHEMA = "org.gnome.shell.extensions.monito";
|
const SETTINGS_SCHEMA = "org.gnome.shell.extensions.monito";
|
||||||
const SETTINGS_SCHEMA_ACCOUNT = "org.gnome.shell.extensions.monito.account";
|
const SETTINGS_SCHEMA_ACCOUNT = "org.gnome.shell.extensions.monito.account";
|
||||||
@ -341,7 +341,7 @@ class Indicator extends PanelMenu.Button {
|
|||||||
style: ( col.style ? col.style : '' ) } );
|
style: ( col.style ? col.style : '' ) } );
|
||||||
_child.original_text = text.toString();
|
_child.original_text = text.toString();
|
||||||
_child.connect('button-press-event', Lang.bind(this, this._onExpandLabel ) );
|
_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' )
|
else if ( col.special == 'actions' )
|
||||||
{
|
{
|
||||||
@ -594,10 +594,10 @@ class Indicator extends PanelMenu.Button {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// _onEnterEvent ( e )
|
_onEnterEvent ( e )
|
||||||
// {
|
{
|
||||||
// log ( "Monito: enter");
|
log ( "Monito: enter");
|
||||||
// }
|
}
|
||||||
|
|
||||||
_onOpenInBrowser ( e )
|
_onOpenInBrowser ( e )
|
||||||
{
|
{
|
||||||
@ -616,20 +616,24 @@ class Indicator extends PanelMenu.Button {
|
|||||||
proc.wait_async(cancellable, (proc, result) => {
|
proc.wait_async(cancellable, (proc, result) => {
|
||||||
try {
|
try {
|
||||||
proc.wait_finish(result);
|
proc.wait_finish(result);
|
||||||
if ( ! proc.get_successful()) {
|
|
||||||
|
if (proc.get_successful()) {
|
||||||
|
log ( 'Monito: the process succeeded');
|
||||||
|
} else {
|
||||||
log ( 'Monito: the process failed' );
|
log ( 'Monito: the process failed' );
|
||||||
}
|
}
|
||||||
|
this.stopChildSpin ( e.service.button );
|
||||||
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
logError(e);
|
logError(e);
|
||||||
} finally {
|
} finally {
|
||||||
loop.quit();
|
loop.quit();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
log ( 'Monito: ' + proc );
|
||||||
} catch ( e ) {
|
} catch ( e ) {
|
||||||
log ( 'Monito err: ' + e.message );
|
log ( 'Monito: ' + e );
|
||||||
Main.notifyError ( _('Unable to execute command: %s').format ( e.message ) );
|
|
||||||
}
|
}
|
||||||
this.stopChildSpin ( e.service.button );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_createButton ( sizeName, icon, data, callback ) {
|
_createButton ( sizeName, icon, data, callback ) {
|
||||||
|
58
prefs.js
58
prefs.js
@ -24,7 +24,6 @@ const Gio = imports.gi.Gio;
|
|||||||
const GLib = imports.gi.GLib;
|
const GLib = imports.gi.GLib;
|
||||||
const Gtk = imports.gi.Gtk;
|
const Gtk = imports.gi.Gtk;
|
||||||
const Gdk = imports.gi.Gdk;
|
const Gdk = imports.gi.Gdk;
|
||||||
const GObject = imports.gi.GObject;
|
|
||||||
|
|
||||||
// It's common practice to keep GNOME API and JS imports in separate blocks
|
// It's common practice to keep GNOME API and JS imports in separate blocks
|
||||||
const Lang = imports.lang;
|
const Lang = imports.lang;
|
||||||
@ -246,12 +245,9 @@ function createAccountWidgets ( isActive )
|
|||||||
this._accountsWidget = new Gtk.Notebook( { } );
|
this._accountsWidget = new Gtk.Notebook( { } );
|
||||||
this._accountsWidgetContainer.pack_start(this._accountsWidget, true, true, 0);
|
this._accountsWidgetContainer.pack_start(this._accountsWidget, true, true, 0);
|
||||||
|
|
||||||
for ( var _tab of [ 'Settings', 'Columns', 'Colors', 'Filters', 'Replacements' ] )
|
for ( var _tab of [ 'Settings', 'Colors', 'Filters', 'Replacements' ] )
|
||||||
{
|
{
|
||||||
if ( _tab != 'Columns' )
|
this.createPrefWidgets ( _accountsWidget, _tab, isActive );
|
||||||
this.createPrefWidgets ( _accountsWidget, _tab, isActive );
|
|
||||||
else
|
|
||||||
this.createColumnsPrefTab ( _accountsWidget, _tab, isActive );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Settings
|
// Settings
|
||||||
@ -328,56 +324,6 @@ function createPrefWidgets ( noteBook, type, isActive )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function createColumnsPrefTab ( noteBook, type, isActive )
|
|
||||||
{
|
|
||||||
let grid = new Gtk.Grid ( {
|
|
||||||
halign: Gtk.Align.FILL,
|
|
||||||
margin: 18,
|
|
||||||
column_spacing: 12,
|
|
||||||
row_spacing: 12,
|
|
||||||
visible: true,
|
|
||||||
column_homogeneous: false,
|
|
||||||
});
|
|
||||||
noteBook.append_page ( grid, new Gtk.Label ( { label: _(type), } ) );
|
|
||||||
|
|
||||||
let _store = new Gtk.TreeStore();
|
|
||||||
_store.set_column_types([GObject.TYPE_STRING, GObject.TYPE_INT]);
|
|
||||||
_store.filter_new(null);
|
|
||||||
|
|
||||||
let _treeView = new Gtk.TreeView ( { model: _store,
|
|
||||||
headers_visible: true,
|
|
||||||
reorderable: true,
|
|
||||||
hexpand: true,
|
|
||||||
vexpand: true });
|
|
||||||
|
|
||||||
let columnNumbers = new Gtk.TreeViewColumn ( { title: _("Column") } );
|
|
||||||
let rendererNumbers = new Gtk.CellRendererText ( { editable: true } );
|
|
||||||
columnNumbers.pack_start(rendererNumbers, true);
|
|
||||||
columnNumbers.add_attribute(rendererNumbers, 'text', 0);
|
|
||||||
_treeView.append_column(columnNumbers);
|
|
||||||
|
|
||||||
let _colSize = new Gtk.TreeViewColumn ( { title: _("Size") } );
|
|
||||||
let _colRenderer = new Gtk.CellRendererText ( { editable: true } );
|
|
||||||
_colSize.pack_start(_colRenderer, true);
|
|
||||||
_colSize.add_attribute(_colRenderer, 'text', 1);
|
|
||||||
_treeView.append_column(_colSize);
|
|
||||||
|
|
||||||
let _item = _store.append(null);
|
|
||||||
_store.set_value(_item, 0, 'prout' );
|
|
||||||
_store.set_value(_item, 1, 2 );
|
|
||||||
|
|
||||||
_item = _store.append(null);
|
|
||||||
_store.set_value(_item, 0, 'bar' );
|
|
||||||
_store.set_value(_item, 1, 1 );
|
|
||||||
|
|
||||||
// _treeView.connect('row-activated', this._editPath.bind(this));
|
|
||||||
|
|
||||||
grid.attach ( _treeView, 0, 1, 1, 1 );
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function activateAccountRow ( ) {
|
function activateAccountRow ( ) {
|
||||||
|
|
||||||
if ( this._accountsWidget )
|
if ( this._accountsWidget )
|
||||||
|
@ -106,11 +106,4 @@ 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,11 +82,7 @@ class Icinga2 extends GenericServer {
|
|||||||
|
|
||||||
getUrlForService ( service )
|
getUrlForService ( service )
|
||||||
{
|
{
|
||||||
log ( service );
|
return this._settings.get_string ( 'url' ) ; // + monitoring/service/show?host=XXX&service=XXX
|
||||||
return '%s/monitoring/service/show?host=%s&service=%s'.format ( this._settings.get_string ( 'url' ),
|
}
|
||||||
service.host_name,
|
|
||||||
service.service_display_name );
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,7 +102,6 @@ class Icinga2API extends GenericServer {
|
|||||||
// log ( JSON.stringify(entry) );
|
// log ( JSON.stringify(entry) );
|
||||||
this.status.service_status.push ( {
|
this.status.service_status.push ( {
|
||||||
status: _statuses[entry.attrs.state],
|
status: _statuses[entry.attrs.state],
|
||||||
real_host_name: entry.attrs.host_name,
|
|
||||||
host_name: entry.attrs.host_name,
|
host_name: entry.attrs.host_name,
|
||||||
service_display_name: entry.attrs.display_name,
|
service_display_name: entry.attrs.display_name,
|
||||||
has_been_acknowledged: parseInt(entry.attrs.acknowledgement),
|
has_been_acknowledged: parseInt(entry.attrs.acknowledgement),
|
||||||
@ -125,9 +124,8 @@ class Icinga2API extends GenericServer {
|
|||||||
|
|
||||||
getUrlForService ( service )
|
getUrlForService ( service )
|
||||||
{
|
{
|
||||||
return '%s/monitoring/service/show?host=%s&service=%s'.format ( this._settings.get_string ( 'url' ),
|
return this._settings.get_string ( 'url' ) ;
|
||||||
encodeURI ( service.real_host_name ),
|
}
|
||||||
encodeURI ( service.service_display_name ) );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,3 +109,5 @@
|
|||||||
.small-button {
|
.small-button {
|
||||||
padding: 3px !important;
|
padding: 3px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user