Revision d6de3c2f
Meilleure gestion de l'activation/désactivation des boutons de la toolbar en fonction des sélections.
git-svn-id: https://vigilo-dev.si.c-s.fr/svn@5143 b22e2e97-25c9-44ff-b637-2e5ceca36478
vigigraph/public/js/toolbar.js | ||
---|---|---|
12 | 12 |
this.tree.addEvent('select', this.selectItem.bind(this)); |
13 | 13 |
}, |
14 | 14 |
|
15 |
setItem: function (id, label) { |
|
16 |
this.idselection = id; |
|
15 |
setItem: function (idselection, label) {
|
|
16 |
this.idselection = idselection;
|
|
17 | 17 |
this.setLabel(label); |
18 |
this.fireEvent("select"); |
|
18 |
this.fireEvent("select", [idselection, label]);
|
|
19 | 19 |
}, |
20 | 20 |
|
21 | 21 |
selectItem: function (item) { |
... | ... | |
67 | 67 |
if (this.graph_picker.tree.options.hostid != idselection) { |
68 | 68 |
this.graph_picker.tree.options.hostid = idselection; |
69 | 69 |
this.graph_picker.tree.redraw(); |
70 |
this.graph_picker.setItem(0, this.graph_picker.options.label);
|
|
70 |
this.graph_picker.setItem(null, this.graph_picker.options.label);
|
|
71 | 71 |
} |
72 |
this.show_nagios.setEnabled(1); |
|
72 | 73 |
this.graph_picker.setEnabled(1); |
73 |
this.show_graph.setEnabled(1); |
|
74 | 74 |
}.bind(this)); |
75 | 75 |
|
76 | 76 |
this.show_nagios = new Jx.Button({ |
77 | 77 |
label: _('Nagios page'), |
78 | 78 |
tooltip: _('Display Nagios page for the selected host'), |
79 | 79 |
toggle: false, |
80 |
enabled: false, |
|
80 | 81 |
onClick: function () { |
81 | 82 |
var uri = new URI( |
82 | 83 |
app_path + 'nagios/' + |
... | ... | |
110 | 111 |
null |
111 | 112 |
); |
112 | 113 |
|
114 |
this.graph_picker.addEvent("select", function (idselection, label) { |
|
115 |
if (idselection !== null) |
|
116 |
this.show_graph.setEnabled(1); |
|
117 |
}.bind(this)); |
|
118 |
|
|
113 | 119 |
this.show_graph = new Jx.Button({ |
114 | 120 |
label: _('Graph'), |
115 | 121 |
tooltip: _('Display the contents of the selected graph'), |
Also available in: Unified diff