Revision a4389258
VigiGraph: le nom de graphe n'est pas unique, on passe le nom d'hôte en plus pour récupérer les indicateurs adéquats.
git-svn-id: https://vigilo-dev.si.c-s.fr/svn@3347 b22e2e97-25c9-44ff-b637-2e5ceca36478
javascript/source/class/vigigraph/Application.js | ||
---|---|---|
749 | 749 |
}); |
750 | 750 |
r.send(); |
751 | 751 |
} |
752 |
function getIndicators(graph) |
|
752 |
function getIndicators(host, graph)
|
|
753 | 753 |
{ |
754 | 754 |
function addExportButton(label, ds) { |
755 | 755 |
var menu_bt = new qx.ui.menu.Button(label); |
... | ... | |
757 | 757 |
menu_bt.addEventListener("execute",function(e) { getExport(ds); }); |
758 | 758 |
indicator_menu.add(menu_bt); |
759 | 759 |
} |
760 |
var url= urls.getIndicators+"?graph="+graph; |
|
760 |
var url= urls.getIndicators+"?host"+host+"&graph="+graph;
|
|
761 | 761 |
var r = new qx.io.remote.Request(url,"GET","application/json"); |
762 | 762 |
r.addEventListener("completed", function(e) { |
763 | 763 |
r = e.getContent().items; |
... | ... | |
777 | 777 |
duration = 24 * 3600; |
778 | 778 |
setUrl(start, duration); |
779 | 779 |
loadImage(url,l); |
780 |
getIndicators(graph); |
|
780 |
getIndicators(host, graph);
|
|
781 | 781 |
|
782 | 782 |
// Events |
783 | 783 |
tempoDelayRefresh(); |
vigigraph/controllers/rpc.py | ||
---|---|---|
578 | 578 |
|
579 | 579 |
class GetIndicatorsSchema(schema.Schema): |
580 | 580 |
"""Schéma de validation pour la méthode L{getIndicators}.""" |
581 |
host = validators.String(not_empty=True) |
|
581 | 582 |
graph = validators.String(not_empty=True) |
582 | 583 |
nocache = validators.String(if_missing=None) |
583 | 584 |
|
... | ... | |
586 | 587 |
validators = GetIndicatorsSchema(), |
587 | 588 |
error_handler = process_form_errors) |
588 | 589 |
@expose('json') |
589 |
def getIndicators(self, graph, nocache): |
|
590 |
def getIndicators(self, host, graph, nocache):
|
|
590 | 591 |
""" |
591 | 592 |
Liste d indicateurs associes a un graphe |
592 | 593 |
|
... | ... | |
596 | 597 |
@return: dictionnaire des indicateurs d un graphe |
597 | 598 |
@rtype: document json (sous forme de dict) |
598 | 599 |
""" |
599 |
|
|
600 |
indicators = self.getListIndicators(graph) |
|
600 |
|
|
601 |
indicators = self.getListIndicators(host, graph)
|
|
601 | 602 |
indicators = [ind.name for ind in indicators] |
602 | 603 |
return dict(items=indicators) |
603 | 604 |
|
... | ... | |
781 | 782 |
""" |
782 | 783 |
return dict() |
783 | 784 |
|
784 |
def getListIndicators(self, graph=None):
|
|
785 |
def getListIndicators(self, host, graph):
|
|
785 | 786 |
""" |
786 | 787 |
Liste d indicateurs associes a un graphe |
787 | 788 |
|
... | ... | |
796 | 797 |
if graph is not None: |
797 | 798 |
indicators = DBSession.query( |
798 | 799 |
PerfDataSource.name |
800 |
).distinct( |
|
799 | 801 |
).join( |
800 | 802 |
(GRAPH_PERFDATASOURCE_TABLE, \ |
801 | 803 |
GRAPH_PERFDATASOURCE_TABLE.c.idperfdatasource == \ |
802 | 804 |
PerfDataSource.idperfdatasource), |
803 | 805 |
(Graph, Graph.idgraph == \ |
804 | 806 |
GRAPH_PERFDATASOURCE_TABLE.c.idgraph), |
807 |
(Host, Host.idhost == PerfDataSource.idhost), |
|
805 | 808 |
).filter(Graph.name == graph |
809 |
).filter(Host.name == host |
|
806 | 810 |
).all() |
807 | 811 |
return indicators |
808 | 812 |
|
Also available in: Unified diff