Project

General

Profile

Revision 726122aa

ID726122aae3128b808a0ebd07dc63beda47458e43
Parent cac3d0e5
Child a128e1c2

Added by Aurelien BOMPARD over 13 years ago

Utilisation des labels pour le menu d'export CSV

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

View differences:

vigigraph/controllers/rpc.py
273 273
        """
274 274

  
275 275
        indicators = self.getListIndicators(host, graph)
276
        indicators = [ind.name for ind in indicators]
276
        indicators = [(ind.name, ind.label) for ind in indicators]
277 277
        return dict(items=indicators)
278 278

  
279
    class StartTimeSchema(schema.Schema):

280
        """Schéma de validation pour la méthode L{getIndicators}."""

281
        host = validators.String(not_empty=True)

282
        nocache = validators.String(if_missing=None)

283

  
284
    # @TODO définir un error_handler différent pour remonter l'erreur via JS.

285
    @validate(

286
        validators = StartTimeSchema(),

287
        error_handler = process_form_errors)

288
    @expose('json')

289
    def startTime(self, host, nocache):

290
        return get_through_proxy(

291
            'vigirrd', host,

292
            '/starttime?host=%s' % urllib2.quote(host, '')

293
        )

279
    class StartTimeSchema(schema.Schema):
280
        """Schéma de validation pour la méthode L{getIndicators}."""
281
        host = validators.String(not_empty=True)
282
        nocache = validators.String(if_missing=None)
283

  
284
    # @TODO définir un error_handler différent pour remonter l'erreur via JS.
285
    @validate(
286
        validators = StartTimeSchema(),
287
        error_handler = process_form_errors)
288
    @expose('json')
289
    def startTime(self, host, nocache):
290
        return get_through_proxy(
291
            'vigirrd', host,
292
            '/starttime?host=%s' % urllib2.quote(host, '')
293
        )
294 294

  
295 295
    class FullHostPageSchema(schema.Schema):
296 296
        """Schéma de validation pour la méthode L{fullHostPage}."""
......
712 712
        indicators = []
713 713
        if graph is not None:
714 714
            indicators = DBSession.query(
715
                    PerfDataSource.name
715
                    PerfDataSource.name, PerfDataSource.label
716 716
                ).distinct(
717 717
                ).join(
718 718
                    (GRAPH_PERFDATASOURCE_TABLE, \
vigigraph/public/js/graph.js
66 66
            onSuccess: function (data) {
67 67
                data.items.each(function (item) {
68 68
                    this.indicators.add(new Jx.Menu.Item({
69
                        label: item,
69
                        name: item[0],
70
                        label: item[1],
70 71
                        onClick: this.exportCSV.bind(this),
71 72
                        indicator: true
72 73
                    }));
......
265 266
        })
266 267

  
267 268
        if (menuItem.options.indicator)
268
            uri.setData({ds: menuItem.options.label}, true);
269
            uri.setData({ds: menuItem.options.name}, true);
269 270

  
270 271
        window.open(uri.toString());
271 272
    },

Also available in: Unified diff