Changeset 117

Show
Ignore:
Timestamp:
03/25/08 13:06:39 (5 years ago)
Author:
divagater
Message:

Added graph icon and handling for mapped graphs. Only implemented on the service list so far

Location:
trunk
Files:
1 added
9 modified

Legend:

Unmodified
Added
Removed
  • trunk/controllers/services.php

    r113 r117  
    183183                        .'o.name1 AS host_name,' 
    184184                        .'o.name2 AS service_description,' 
     185                        .'g.local_graph_id,' 
    185186                        .'ss.*') 
    186187                ->from('NpcServicestatus ss') 
     
    188189                ->leftJoin('ss.Service s') 
    189190                ->leftJoin('ss.Instance i') 
     191                ->leftJoin('ss.Graph g') 
    190192                ->where("$where") 
    191193                ->orderby( 'i.instance_name ASC, host_name ASC, service_description ASC' ), 
  • trunk/js/src/monitoring/hosts/hostgroupGrid.js

    r107 r117  
    148148    tab.addListener(listeners); 
    149149 
    150     grid.on('rowclick', npc.hostGridClick); 
     150    // Double click action 
     151    grid.on('rowdblclick', npc.hostGridClick); 
    151152 
     153    // Right click action 
     154    grid.on('rowcontextmenu', npc.hostContextMenu); 
    152155}; 
  • trunk/js/src/monitoring/hosts/hostgroupOverview.js

    r107 r117  
    167167    tab.addListener(listeners); 
    168168 
    169     grid.on('rowclick', hgOverviewClick); 
     169    grid.on('rowdblclick', hgOverviewClick); 
     170 
     171    // Right click action 
     172    grid.on('rowcontextmenu', npc.hostContextMenu); 
    170173 
    171174    function hgOverviewClick(grid, rowIndex, e) { 
  • trunk/js/src/monitoring/services/servicegroupGrid.js

    r107 r117  
    161161    tab.addListener(listeners); 
    162162 
    163     grid.on('rowclick', npc.serviceGridClick); 
     163    // Double click action 
     164    grid.on('rowdblclick', npc.serviceGridClick); 
    164165 
     166    // Right click action 
     167    grid.on('rowcontextmenu', npc.serviceContextMenu); 
    165168}; 
  • trunk/js/src/monitoring/services/servicegroupOverview.js

    r107 r117  
    167167    tab.addListener(listeners); 
    168168 
    169     grid.on('rowclick', sgOverviewClick); 
     169    grid.on('rowdblclick', sgOverviewClick); 
     170 
     171    // Right click action 
     172    grid.on('rowcontextmenu', npc.serviceContextMenu); 
    170173 
    171174    function sgOverviewClick(grid, rowIndex, e) { 
  • trunk/js/src/monitoring/services/services.js

    r113 r117  
    4141    }; 
    4242 
     43    function renderGraphIcon(val, p, record){ 
     44        var icon = ''; 
     45        if (val) { 
     46            // <img id="graph'+val+'" src="/graph_image.php?action=view&local_graph_id='+val+'&rra_id=1" style="position:absolute;left:0;top:0;"/> 
     47            icon = '<img src="images/icons/chart_bar.png">'; 
     48        } 
     49        return String.format('{0}', icon); 
     50    }; 
     51 
    4352    var store = new Ext.data.GroupingStore({ 
    4453        url:url, 
     
    4958            root:'data' 
    5059        }, [ 
    51             'host_object_id', 
     60            'instance_name', 
     61            {name: 'host_object_id', type: 'int'}, 
    5262            'host_name', 
    53             'service_id', 
    54             'service_object_id', 
     63            {name: 'service_object_id', type: 'int'}, 
     64            {name: 'local_graph_id', type: 'int'}, 
    5565            'service_description', 
    5666            'acknowledgement', 
     
    8292        dataIndex:'current_state', 
    8393        renderer:npc.serviceStatusImage, 
     94        width:30 
     95    },{ 
     96        header:"Graph", 
     97        dataIndex:'local_graph_id', 
     98        renderer:renderGraphIcon, 
     99        width:30 
     100    },{ 
     101        header:"Instance", 
     102        dataIndex:'instance_name', 
     103        hidden:true, 
    84104        width:45 
    85105    },{ 
     
    87107        dataIndex:'last_check', 
    88108        renderer: npc.formatDate, 
    89         width:110 
     109        width:100 
    90110    },{ 
    91111        header:"Next Check", 
    92112        dataIndex:'next_check', 
    93113        renderer: npc.formatDate, 
    94         width:110 
     114        width:100 
    95115    },{ 
    96116        header:"Duration", 
     
    119139        id: id + '-grid', 
    120140        autoHeight:true, 
    121         autoExpandColumn: 'service_description', 
     141        autoExpandColumn: 'plugin_output', 
    122142        store:store, 
    123143        autoScroll: true, 
     
    184204    // Right click action 
    185205    grid.on('rowcontextmenu', npc.serviceContextMenu); 
     206 
     207    // If the graph icon is clicked popup the associated graph 
     208    grid.on('cellclick', function(grid, rowIndex, columnIndex) { 
     209        var record = grid.getStore().getAt(rowIndex); 
     210        var fieldName = grid.getColumnModel().getDataIndex(columnIndex); 
     211        var data = record.get(fieldName); 
     212 
     213        if (fieldName == 'local_graph_id' && !Ext.getCmp('serviceGraph'+data)) { 
     214            var win = new Ext.Window({ 
     215                title:record.data.host_name + ': ' + record.data.service_description, 
     216                id:'serviceGraph'+data, 
     217                layout:'fit', 
     218                modal:false, 
     219                closable: true, 
     220                html: '<img src="/graph_image.php?action=view&local_graph_id='+data+'&rra_id=1">', 
     221                width:600 
     222            }).show(); 
     223        } 
     224    }); 
    186225}; 
  • trunk/models/NpcServices.php

    r97 r117  
    3434        $this->hasOne('NpcHoststatus as Hoststatus', array('local' => 'host_object_id', 'foreign' => 'host_object_id')); 
    3535        $this->hasOne('NpcServicestatus as Status', array('local' => 'service_object_id', 'foreign' => 'service_object_id')); 
     36        $this->hasOne('NpcServiceGraphs as Graph', array('local' => 'service_object_id', 'foreign' => 'service_object_id')); 
    3637        $this->hasMany('NpcComments as Comment', array('local' => 'service_object_id', 'foreign' => 'object_id')); 
    3738        $this->hasMany('NpcServicechecks as Check', array('local' => 'service_object_id', 'foreign' => 'service_object_id')); 
  • trunk/models/NpcServicestatus.php

    r97 r117  
    88        $this->hasOne('NpcObjects as Object', array('local' => 'service_object_id', 'foreign' => 'object_id')); 
    99        $this->hasOne('NpcServices as Service', array('local' => 'service_object_id', 'foreign' => 'service_object_id')); 
    10         //$this->hasMany('NpcServicegroupMembers as ServicegroupMembers', array('local' => 'service_object_id', 'foreign' => 'service_object_id')); 
     10        $this->hasOne('NpcServiceGraphs as Graph', array('local' => 'service_object_id', 'foreign' => 'service_object_id')); 
    1111        $this->hasMany('NpcServicegroups as Servicegroups', array('local' => 'service_object_id', 'foreign' => 'servicegroup_id', 'refClass' => 'NpcServicegroupMembers')); 
    1212    }