Compare commits
2 Commits
25a3f7a6e8
...
0ab8b79ae1
Author | SHA1 | Date | |
---|---|---|---|
0ab8b79ae1 | |||
378154a3b4 |
68
extension.js
68
extension.js
@ -53,6 +53,15 @@ 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 {
|
||||||
@ -212,29 +221,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: _widths[col],
|
width: col.width,
|
||||||
x_expand: ( col == 4 ? true : false ),
|
x_expand: col.expand,
|
||||||
child: new St.Button ( {
|
child: new St.Button ( {
|
||||||
x_align: Clutter.ActorAlign.FILL,
|
x_align: Clutter.ActorAlign.START,
|
||||||
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: 'Foo',
|
label: col.name,
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
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: _widths[col],
|
width: col.width,
|
||||||
x_expand: ( col == 4 ? true : false ),
|
x_expand: col.expand,
|
||||||
child: new St.Label({ style_class: 'monito-label', text: text })
|
child: new St.Label({ style_class: 'monito-label', text: text })
|
||||||
});
|
});
|
||||||
return _bin;
|
return _bin;
|
||||||
@ -252,17 +261,23 @@ 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 ) );
|
||||||
|
|
||||||
headerBox.add_child ( this.createHeaderBin ( '', 'Foo', 0 ) );
|
let scrollBox = new St.ScrollView ( { hscrollbar_policy: St.PolicyType.NEVER,
|
||||||
headerBox.add_child ( this.createHeaderBin ( '', 'Foo', 1 ) );
|
enable_mouse_scrolling: true, } );
|
||||||
headerBox.add_child ( this.createHeaderBin ( '', 'Foo', 2 ) );
|
this._box.add_child(scrollBox);
|
||||||
headerBox.add_child ( this.createHeaderBin ( '', 'Foo', 3 ) );
|
|
||||||
headerBox.add_child ( this.createHeaderBin ( '', 'Foo', 4 ) );
|
let tableBox = new St.BoxLayout({
|
||||||
|
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 ++ )
|
||||||
{
|
{
|
||||||
@ -271,26 +286,17 @@ 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,
|
||||||
hover: true,
|
track_hover: true,
|
||||||
x_expand: true
|
x_expand: true,
|
||||||
});
|
});
|
||||||
this._box.add_child(infoBox);
|
tableBox.add_child(infoBox);
|
||||||
|
|
||||||
infoBox.add_child ( this.createBin ( serverLogic.status.service_status[i].status,
|
for ( let col of column_definitions )
|
||||||
serverLogic.status.service_status[i].host_name,
|
{
|
||||||
0 ) );
|
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].service_display_name,
|
col ) );
|
||||||
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 ) );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,6 +92,13 @@
|
|||||||
<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>
|
||||||
|
@ -83,7 +83,7 @@ class Icinga {
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
return this.status != null;
|
return this.status !== null;
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
Main.notify(_('Zbeu!'));
|
Main.notify(_('Zbeu!'));
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.monito-serverbox {
|
.monito-serverbox {
|
||||||
padding-left: 1em;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.monito-box {
|
.monito-box {
|
||||||
@ -43,10 +43,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.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 {
|
||||||
|
Loading…
Reference in New Issue
Block a user