Project

General

Profile

Revision 20908c48

ID20908c48d367f3720b284054aa9e8a76da248c4a
Parent c765e251
Child 16a7bac7

Added by Francois POIROTTE over 14 years ago

Utilisation d'informations contextuelles (idhost) pour récupérer la liste des graphes dans VigiGraph.
Suppression du dossier des traductions JS (auto-généré par Qooxdoo).
Nettoyage du code pour pylint.

git-svn-id: https://vigilo-dev.si.c-s.fr/svn@2592 b22e2e97-25c9-44ff-b637-2e5ceca36478

View differences:

javascript/source/class/vigigraph/Application.js
557 557
        r5.setEnabled(false);
558 558
        b5.setEnabled(false);
559 559
      }
560
      function _updateGraphList(idgraphgroup)
560
      function _updateGraphList(idhost, idgraphgroup)
561 561
      {
562
        _genericListUpdater(urls.graphs+"?idgraphgroup="+idgraphgroup,combo5);
562
        _genericListUpdater(urls.graphs+"?idgraphgroup="+idgraphgroup+"&idhost="+idhost,combo5);
563 563
        r5.setEnabled(true);
564 564
        b5.setEnabled(false);
565 565
      }
566 566
      combo1.addEventListener("changeSelected", function(e) { if(e.getValue()) _updateHostGroupList(e.getValue().getValue()); });
567 567
      combo2.addEventListener("changeSelected", function(e) { if(e.getValue()) _updateHostList(e.getValue().getValue()); });
568 568
      combo3.addEventListener("changeSelected", function(e) { if(e.getValue()) { b3.setEnabled(true);_updateGraphGroupList(e.getValue().getValue());} });
569
      combo4.addEventListener("changeSelected", function(e) { if(e.getValue()) { _updateGraphList(e.getValue().getValue());} });
569
      combo4.addEventListener("changeSelected", function(e) { if(e.getValue()) { _updateGraphList(combo3.getSelected().getValue(),e.getValue().getValue());} });
570 570
      //combo4.addEventListener("changeSelected", function(e) { if(e.getValue()) { _updateGraphList(combo3.getSelected().getLabel(),e.getValue().getLabel());} });
571 571
      combo5.addEventListener("changeSelected", function(e) { if(e.getValue()) b5.setEnabled(true); });
572 572

  
vigigraph/config/__init__.py
1 1
# -*- coding: utf-8 -*-
2
"""
3
Fichiers en rapport avec la configuration de VigiGraph,
4
du point de vue de la programmation.
5
"""
2 6

  
vigigraph/controllers/nagiosproxy.py
4 4

  
5 5
import urllib
6 6
import urllib2
7
import os
8

  
9 7

  
10 8
class NagiosProxy(object):
11 9
    '''
vigigraph/controllers/root.py
4 4

  
5 5
import logging
6 6
from tg import expose, flash, require, request, redirect
7
from pylons.i18n import ugettext as _, lazy_ugettext as l_
7
from pylons.i18n import ugettext as _
8 8
from repoze.what.predicates import Any, not_anonymous
9 9

  
10 10
from vigigraph.lib.base import BaseController
vigigraph/controllers/rpc.py
33 33
import urllib2
34 34
import csv
35 35
import logging
36
import string
37 36

  
38 37
from searchhostform import SearchHostForm
39 38
from vigigraph.lib import graphs
......
155 154
        return dict(items=graphgroups)
156 155

  
157 156
    @expose('json')
158
    def graphs(self, idgraphgroup, nocache=None):
157
    def graphs(self, idgraphgroup, idhost, nocache=None):
159 158
        """
160 159
        Determination des graphes
161 160
        avec un service dont identificateur = argument
......
174 173
                    Graph.idgraph),
175 174
                (GraphGroup, GraphGroup.idgroup == \
176 175
                    GRAPH_GROUP_TABLE.c.idgroup),
177
            ).filter(
178
                GraphGroup.idgroup == idgraphgroup
176
                (GRAPH_PERFDATASOURCE_TABLE, \
177
                    GRAPH_PERFDATASOURCE_TABLE.c.idgraph == Graph.idgraph),
178
                (PerfDataSource, PerfDataSource.idperfdatasource == \
179
                    GRAPH_PERFDATASOURCE_TABLE.c.idperfdatasource),
180
                (LowLevelService, LowLevelService.idservice == \
181
                    PerfDataSource.idservice),
182
            ).filter(GraphGroup.idgroup == idgraphgroup
183
            ).filter(LowLevelService.idhost == idhost
179 184
            ).all()
180 185

  
181 186
        graphs_l = [(pds.name, str(pds.idgraph)) for pds in graphs_l]
vigigraph/lib/__init__.py
1 1
# -*- coding: utf-8 -*-
2
"""
3
Code annexe de VigiGraph, qui ne génère pas de contenu visible
4
par les utilisateurs.
5
"""
2 6

  
vigigraph/lib/graphs.py
3 3

  
4 4
from tg import config
5 5

  
6
import string
7 6
import urllib
8 7
import urllib2
9 8
from pylons.i18n import ugettext as _
......
69 68
    """
70 69

  
71 70
    delay = config.get('delay_refresh')
72
    delay = string.strip(delay)
71
    delay = delay.strip()
73 72

  
74 73
    b_evaluate = False
75 74
    if delay == '':
vigigraph/lib/helpers.py
2 2

  
3 3
"""WebHelpers used in vigigraph."""
4 4

  
5
from webhelpers import date, feedgenerator, html, number, misc, text
5
#from webhelpers import date, feedgenerator, html, number, misc, text
vigigraph/tests/functional/test_nagiosproxy.py
9 9
import transaction
10 10
import unittest
11 11

  
12
import urllib
13
import urllib2
14
import os
15 12
from tg import config
16 13
from nose.tools import eq_
17 14

  
......
59 56
def create_Ventilation(host, server, application):
60 57
    v = None
61 58
    h = DBSession.query(Host).filter(Host.name == host).first()
62
    s = DBSession.query(VigiloServer).filter(VigiloServer.name == server).first()
63
    a = DBSession.query(Application).filter(Application.name == application).first()
59
    s = DBSession.query(VigiloServer).filter(
60
            VigiloServer.name == server).first()
61
    a = DBSession.query(Application).filter(
62
            Application.name == application).first()
64 63
    if h and s:
65
        v = Ventilation(idhost=h.idhost, idvigiloserver=s.idvigiloserver, idapp=a.idapp)
64
        v = Ventilation(idhost=h.idhost,
65
            idvigiloserver=s.idvigiloserver, idapp=a.idapp)
66 66
        DBSession.add(v)
67 67
        DBSession.flush()
68 68
    return v
......
148 148

  
149 149
        # Host
150 150
        host = u'par.linux0'
151
        h = create_Host(host)
151
        create_Host(host)
152 152

  
153 153
        # Serveurs Vigilo
154 154
        sv1 = create_Server(u'http://localhost', u'RRD+Nagios')

Also available in: Unified diff