Better multi-server implementation
This commit is contained in:
parent
42d4537b23
commit
c4245fe199
@ -257,7 +257,7 @@ class Indicator extends PanelMenu.Button {
|
||||
|
||||
if ( ! col [ 'special' ] )
|
||||
_child = new St.Label({ style_class: 'monito-label', text: text.toString(), });
|
||||
else if ( col.special == 'actions' )
|
||||
else if ( col.special == 'actions' && this.serverLogic.canRecheck )
|
||||
{
|
||||
_child = new St.BoxLayout ( { x_expand: true,
|
||||
x_align: Clutter.ActorAlign.FILL,
|
||||
@ -389,7 +389,8 @@ class Indicator extends PanelMenu.Button {
|
||||
|
||||
infoBox.add_child ( this.createBin ( entry.status, entry [ _col ], column_definitions [ _col ] ) );
|
||||
}
|
||||
infoBox.add_child ( this.createBin ( entry.status, entry, column_definitions [ 'actions' ] ) );
|
||||
if ( this.serverLogic.canRecheck )
|
||||
infoBox.add_child ( this.createBin ( entry.status, entry, column_definitions [ 'actions' ] ) );
|
||||
|
||||
_row ++;
|
||||
}
|
||||
|
@ -29,7 +29,8 @@ const Me = ExtensionUtils.getCurrentExtension();
|
||||
const Preferences = Me.imports.prefs;
|
||||
|
||||
|
||||
class GenericServer {
|
||||
class GenericServer {
|
||||
|
||||
constructor ( _server, _serverType = 'Generic' )
|
||||
{
|
||||
log ( '>>> New %s server #%s'.format ( _serverType, _server ) );
|
||||
@ -38,6 +39,8 @@ class GenericServer {
|
||||
this._settings = Preferences.getAccountSettings ( this._server );
|
||||
this._httpSession = null;
|
||||
this._url = null;
|
||||
|
||||
this.canRecheck = true;
|
||||
}
|
||||
|
||||
getServer ( )
|
||||
@ -105,6 +108,27 @@ class GenericServer {
|
||||
}
|
||||
}
|
||||
|
||||
handleCMDMessage ( _httpSession, message )
|
||||
{
|
||||
let _data;
|
||||
try {
|
||||
_data = this.handleMessage ( _httpSession, message );
|
||||
if ( this.error )
|
||||
log ( 'Parent error ' + this.error );
|
||||
else
|
||||
{
|
||||
// if error, grep for class='errorMessage'
|
||||
// else grep for class='successBox'
|
||||
log ( 'Cmd output ' + _data );
|
||||
}
|
||||
}
|
||||
catch ( e )
|
||||
{
|
||||
log ( e );
|
||||
log ( _data );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
getProcessedStatus ( )
|
||||
{
|
||||
|
@ -104,26 +104,5 @@ class Icinga extends GenericServer {
|
||||
log ( _data );
|
||||
}
|
||||
}
|
||||
|
||||
handleCMDMessage ( _httpSession, message )
|
||||
{
|
||||
let _data;
|
||||
try {
|
||||
_data = super.handleMessage ( _httpSession, message );
|
||||
if ( this.error )
|
||||
log ( 'Parent error ' + this.error );
|
||||
else
|
||||
{
|
||||
// if error, grep for class='errorMessage'
|
||||
// else grep for class='successBox'
|
||||
log ( 'Cmd output ' + _data );
|
||||
}
|
||||
}
|
||||
catch ( e )
|
||||
{
|
||||
log ( e );
|
||||
log ( _data );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -33,6 +33,8 @@ const GenericServer = Me.imports.servers.genericserver.GenericServer;
|
||||
class Icinga2 extends GenericServer {
|
||||
constructor ( _server ) {
|
||||
super(_server, 'Icinga2');
|
||||
|
||||
this.canRecheck = false;
|
||||
}
|
||||
|
||||
refresh ( extension ) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user