Compare commits

..

No commits in common. "0ab8b79ae150bb182565337c8eef698a33bbea1a" and "25a3f7a6e87c8d0c90d434b47a36aeb79cc71edc" have entirely different histories.

4 changed files with 36 additions and 47 deletions

View File

@ -53,15 +53,6 @@ const Preferences = Me.imports.prefs;
let settings = Convenience.getSettings(SETTINGS_SCHEMA); let settings = Convenience.getSettings(SETTINGS_SCHEMA);
let account_settings = [ ]; let account_settings = [ ];
const column_definitions = [
{ name: 'status', width: 50, expand: false, },
{ name: 'host_name', width: 300, expand: false, },
{ name: 'service_display_name', width: 300, expand: false, },
{ name: 'last_check', width: 200, expand: false, },
{ name: 'attempts', width: 50, expand: false, },
{ name: 'status_information', width: 600, expand: true, },
];
const Indicator = GObject.registerClass( const Indicator = GObject.registerClass(
class Indicator extends PanelMenu.Button { class Indicator extends PanelMenu.Button {
@ -221,29 +212,29 @@ class Indicator extends PanelMenu.Button {
let _widths = [ 300, 300, 200, 50, 600 ]; let _widths = [ 300, 300, 200, 50, 600 ];
let _bin = new St.Bin({ let _bin = new St.Bin({
style_class: 'monito-service-' + status, style_class: 'monito-service-' + status,
width: col.width, width: _widths[col],
x_expand: col.expand, x_expand: ( col == 4 ? true : false ),
child: new St.Button ( { child: new St.Button ( {
x_align: Clutter.ActorAlign.START, x_align: Clutter.ActorAlign.FILL,
y_align: Clutter.ActorAlign.CENTER, y_align: Clutter.ActorAlign.CENTER,
width: col.width,
reactive: true, reactive: true,
can_focus: true, can_focus: true,
track_hover: true, track_hover: true,
accessible_name: text, accessible_name: text,
style_class: 'button', style_class: 'button',
label: col.name, label: 'Foo',
}) })
}); });
return _bin; return _bin;
} }
createBin ( status, text, col ) { createBin ( status, text, col ) {
let _widths = [ 300, 300, 200, 50, 600 ];
let _bin = new St.Bin({ let _bin = new St.Bin({
style_class: 'monito-service-' + status, style_class: 'monito-service-' + status,
track_hover: true, track_hover: true,
width: col.width, width: _widths[col],
x_expand: col.expand, x_expand: ( col == 4 ? true : false ),
child: new St.Label({ style_class: 'monito-label', text: text }) child: new St.Label({ style_class: 'monito-label', text: text })
}); });
return _bin; return _bin;
@ -261,23 +252,17 @@ class Indicator extends PanelMenu.Button {
} }
let headerBox = new St.BoxLayout({ let headerBox = new St.BoxLayout({
style_class: 'monito-service-line',
hover: true, hover: true,
x_expand: true x_expand: true
}); });
this._box.add_child(headerBox); this._box.add_child(headerBox);
for ( let col of column_definitions )
headerBox.add_child ( this.createHeaderBin ( '', col.name, col ) );
let scrollBox = new St.ScrollView ( { hscrollbar_policy: St.PolicyType.NEVER, headerBox.add_child ( this.createHeaderBin ( '', 'Foo', 0 ) );
enable_mouse_scrolling: true, } ); headerBox.add_child ( this.createHeaderBin ( '', 'Foo', 1 ) );
this._box.add_child(scrollBox); headerBox.add_child ( this.createHeaderBin ( '', 'Foo', 2 ) );
headerBox.add_child ( this.createHeaderBin ( '', 'Foo', 3 ) );
let tableBox = new St.BoxLayout({ headerBox.add_child ( this.createHeaderBin ( '', 'Foo', 4 ) );
hover: true,
vertical: true,
x_expand: true,
});
scrollBox.add_actor(tableBox);
for ( let i = 0 ; i < serverLogic.status.service_status.length ; i ++ ) for ( let i = 0 ; i < serverLogic.status.service_status.length ; i ++ )
{ {
@ -286,17 +271,26 @@ class Indicator extends PanelMenu.Button {
{ {
let infoBox = new St.BoxLayout({ let infoBox = new St.BoxLayout({
style_class: 'monito-service-line monito-service-line-' + serverLogic.status.service_status[i].status, style_class: 'monito-service-line monito-service-line-' + serverLogic.status.service_status[i].status,
track_hover: true, hover: true,
x_expand: true, x_expand: true
}); });
tableBox.add_child(infoBox); this._box.add_child(infoBox);
for ( let col of column_definitions )
{
infoBox.add_child ( this.createBin ( serverLogic.status.service_status[i].status, infoBox.add_child ( this.createBin ( serverLogic.status.service_status[i].status,
serverLogic.status.service_status[i][col.name], serverLogic.status.service_status[i].host_name,
col ) ); 0 ) );
} infoBox.add_child ( this.createBin ( serverLogic.status.service_status[i].status,
serverLogic.status.service_status[i].service_display_name,
1 ) );
infoBox.add_child ( this.createBin ( serverLogic.status.service_status[i].status,
serverLogic.status.service_status[i].last_check,
2) );
infoBox.add_child ( this.createBin ( serverLogic.status.service_status[i].status,
serverLogic.status.service_status[i].attempts,
3 ) );
infoBox.add_child ( this.createBin ( serverLogic.status.service_status[i].status,
serverLogic.status.service_status[i].status_information,
4 ) );
} }
} }

View File

@ -92,13 +92,6 @@
<default>'#e496f5'</default> <default>'#e496f5'</default>
</key> </key>
<key name="columns" type="as">
<default>['service_description']</default>
</key>
<key name="columns-order" type="ai">
<default>[0]</default>
</key>
</schema> </schema>
</schemalist> </schemalist>

View File

@ -83,7 +83,7 @@ class Icinga {
} }
) )
); );
return this.status !== null; return this.status != null;
} }
catch (e) { catch (e) {
Main.notify(_('Zbeu!')); Main.notify(_('Zbeu!'));

View File

@ -30,7 +30,7 @@
} }
.monito-serverbox { .monito-serverbox {
padding-left: 1em;
} }
.monito-box { .monito-box {
@ -43,8 +43,10 @@
} }
.monito-namebox { .monito-namebox {
line-height: 20px;
vertical-align: baseline;
height: 100%;
margin-right: .5em; margin-right: .5em;
vertical-align: middle;
} }
.monito-critical-box, .monito-service-CRITICAL, .monito-service-line-CRITICAL { .monito-critical-box, .monito-service-CRITICAL, .monito-service-line-CRITICAL {