Package Products :: Package Zuul :: Package routers :: Module template
[hide private]
[frames] | no frames]

Source Code for Module Products.Zuul.routers.template

  1  ############################################################################## 
  2  # 
  3  # Copyright (C) Zenoss, Inc. 2010, all rights reserved. 
  4  # 
  5  # This content is made available according to terms specified in 
  6  # License.zenoss under the directory where your Zenoss product is installed. 
  7  # 
  8  ############################################################################## 
  9   
 10   
 11  """ 
 12  Operations for Templates. 
 13   
 14  Available at:  /zport/dmd/template_router 
 15  """ 
 16   
 17  from Products import Zuul 
 18  from Products.ZenUtils.Ext import DirectResponse 
 19  from Products.ZenUtils.Utils import getDisplayType 
 20  from Products.Zuul.decorators import require 
 21  from Products.Zuul.form.interfaces import IFormBuilder 
 22  from Products.Zuul.routers import TreeRouter 
 23  from Products.ZenMessaging.audit import audit 
 24  from Products.ZenModel.ThresholdClass import ThresholdClass 
 25  from Products.Zuul.interfaces.info import IInfo 
26 27 28 -class TemplateRouter(TreeRouter):
29 """ 30 A JSON/ExtDirect interface to operations on templates 31 """ 32
33 - def _getFacade(self):
34 return Zuul.getFacade('template', self.context)
35
36 - def getTemplates(self, id):
37 """ 38 Get all templates. 39 40 @type id: string 41 @param id: not used 42 @rtype: [dictionary] 43 @return: List of objects representing the templates in tree hierarchy 44 """ 45 facade = self._getFacade() 46 templates = facade.getTemplates(id) 47 data = Zuul.marshal(templates) 48 return data
49
50 - def getDeviceClassTemplates(self, id):
51 """ 52 Get all templates by device class. This will return a tree where device 53 classes are nodes, and templates are leaves. 54 55 @type id: string 56 @param id: not used 57 @rtype: [dictionary] 58 @return: List of objects representing the templates in tree hierarchy 59 """ 60 facade = self._getFacade() 61 templates = facade.getTree(id) 62 return [Zuul.marshal(templates)]
63
64 - def getAddTemplateTargets(self, query=None):
65 """ 66 Get a list of available device classes where new templates can be added. 67 68 @type query: string 69 @param query: not used 70 @rtype: DirectResponse 71 @return: B{Properties}: 72 - data: ([dictionary]) List of objects containing an available device 73 class UID and a human-readable label for that class 74 75 """ 76 facade = self._getFacade() 77 data = facade.getAddTemplateTargets(query) 78 return DirectResponse.succeed(data=data)
79 80 @require('Manage DMD')
81 - def addTemplate(self, id, targetUid):
82 """ 83 Add a template to a device class. 84 85 @type id: string 86 @param id: Unique ID of the template to add 87 @type targetUid: string 88 @param targetUid: Unique ID of the device class to add template to 89 @rtype: DirectResponse 90 @return: B{Properties}: 91 - nodeConfig: (dictionary) Object representing the added template 92 """ 93 facade = self._getFacade() 94 templateNode = facade.addTemplate(id, targetUid) 95 audit('UI.Template.Add', templateNode, deviceclass=targetUid) 96 return DirectResponse.succeed(nodeConfig=Zuul.marshal(templateNode))
97 98 @require('Manage DMD')
99 - def deleteTemplate(self, uid):
100 """ 101 Delete a template. 102 103 @type uid: string 104 @param uid: Unique ID of the template to delete 105 @rtype: DirectResponse 106 @return: Success message 107 """ 108 facade = self._getFacade() 109 facade.deleteTemplate(uid) 110 msg = "Deleted node '%s'" % uid 111 audit('UI.Template.Delete', uid) 112 return DirectResponse.succeed(msg=msg)
113 114 @require('View')
115 - def getObjTemplates(self, uid):
116 """ 117 @type uid: string 118 @param uid: Identifier for the object we want templates on, must descend from MetricMixin 119 @rtype: DirectResponse 120 @return: List of templates 121 """ 122 facade = self._getFacade() 123 templates = facade.getObjTemplates(uid) 124 data = Zuul.marshal(templates) 125 return DirectResponse.succeed(data=data)
126 127 @require('Manage DMD')
128 - def makeLocalRRDTemplate(self, uid, templateName):
129 """ 130 @type uid: string 131 @param uid: Identifer of the obj we wish to make the template local for 132 @type templateName: string 133 @param templateName: identifier of the template 134 """ 135 facade = self._getFacade() 136 tplUid = facade.makeLocalRRDTemplate(uid, templateName) 137 audit('UI.Template.MakeLocal', templateName, target=uid) 138 return DirectResponse.succeed(tplUid=tplUid)
139 140 @require('Manage DMD')
141 - def removeLocalRRDTemplate(self, uid, templateName):
142 """ 143 @type uid: string 144 @param uid: Identifer of the obj we wish to remove the local template 145 @type templateName: string 146 @param templateName: identifier of the local template 147 """ 148 facade = self._getFacade() 149 tplUid = facade.removeLocalRRDTemplate(uid, templateName) 150 audit('UI.Template.RemoveLocal', templateName, target=uid) 151 return DirectResponse.succeed(tplUid=tplUid)
152
153 - def getThresholds(self, uid, query=''):
154 """ 155 Get the thresholds for a template. 156 157 @type uid: string 158 @param uid: Unique ID of a template 159 @type query: string 160 @param query: not used 161 @rtype: [dictionary] 162 @return: List of objects representing representing thresholds 163 """ 164 facade = self._getFacade() 165 thresholds = facade.getThresholds(uid) 166 return DirectResponse.succeed(data=Zuul.marshal(thresholds))
167
168 - def getThresholdDetails(self, uid):
169 """ 170 Get a threshold's details. 171 172 @type uid: string 173 @param uid: Unique ID of a threshold 174 @rtype: dictionary 175 @return: B{Properties}: 176 - record: (dictionary) Object representing the threshold 177 - form: (dictionary) Object representing an ExtJS form for the threshold 178 """ 179 facade = self._getFacade() 180 thresholdDetails = facade.getThresholdDetails(uid) 181 form = IFormBuilder(thresholdDetails).render() 182 # turn the threshold into a dictionary 183 data = Zuul.marshal(dict(record=thresholdDetails, form=form)) 184 return data
185
186 - def getDataPoints(self, uid, query=''):
187 """ 188 Get a list of available data points for a template. 189 190 @type query: string 191 @param query: not used 192 @type uid: string 193 @param uid: Unique ID of a template 194 @rtype: DirectResponse 195 @return: B{Properties}: 196 - data: ([dictionary]) List of objects representing data points 197 """ 198 datapoints = [] 199 facade = self._getFacade() 200 # go through each of our datasources and get all the data points 201 datasources = facade.getDataSources(uid) 202 for datasource in datasources: 203 for datapoint in facade.getDataSources(datasource.uid): 204 datapoints.append(datapoint) 205 data = Zuul.marshal(datapoints) 206 return DirectResponse.succeed(data=data)
207 208 @require('Manage DMD')
209 - def addDataPoint(self, dataSourceUid, name):
210 """ 211 Add a new data point to a data source. 212 213 @type dataSourceUid: string 214 @param dataSourceUid: Unique ID of the data source to add data point to 215 @type name: string 216 @param name: ID of the new data point 217 @rtype: DirectResponse 218 @return: Success message 219 """ 220 facade = self._getFacade() 221 facade.addDataPoint(dataSourceUid, name) 222 audit('UI.DataPoint.Add', name, datasource=dataSourceUid) 223 return DirectResponse.succeed()
224 225 @require('Manage DMD')
226 - def addDataSource(self, templateUid, name, type):
227 """ 228 Add a new data source to a template. 229 230 @type templateUid: string 231 @param templateUid: Unique ID of the template to add data source to 232 @type name: string 233 @param name: ID of the new data source 234 @type type: string 235 @param type: Type of the new data source. From getDataSourceTypes() 236 @rtype: DirectResponse 237 @return: Success message 238 """ 239 facade = self._getFacade() 240 ds = facade.addDataSource(templateUid, name, type) 241 audit('UI.DataSource.Add', ds.getPrimaryId(), name=name, dstype=type, 242 template=templateUid) 243 return DirectResponse.succeed()
244
245 - def getDataSources(self, uid):
246 """ 247 Get the data sources for a template. 248 249 @type id: string 250 @param id: Unique ID of a template 251 @rtype: [dictionary] 252 @return: List of objects representing representing data sources 253 """ 254 facade = self._getFacade() 255 dataSources = facade.getDataSources(uid) 256 return DirectResponse.succeed(data=Zuul.marshal(dataSources))
257
258 - def getDataSourceDetails(self, uid):
259 """ 260 Get a data source's details. 261 262 @type uid: string 263 @param uid: Unique ID of a data source 264 @rtype: dictionary 265 @return: B{Properties}: 266 - record: (dictionary) Object representing the data source 267 - form: (dictionary) Object representing an ExtJS form for the data 268 source 269 """ 270 facade = self._getFacade() 271 details = facade.getDataSourceDetails(uid) 272 form = IFormBuilder(details).render() 273 data = Zuul.marshal(dict(record=details, form=form)) 274 return data
275
276 - def getDataPointDetails(self, uid):
277 """ 278 Get a data point's details. 279 280 @type uid: string 281 @param uid: Unique ID of a data point 282 @rtype: dictionary 283 @return: B{Properties}: 284 - record: (dictionary) Object representing the data point 285 - form: (dictionary) Object representing an ExtJS form for the data 286 point 287 """ 288 facade = self._getFacade() 289 details = facade.getDataPointDetails(uid) 290 form = IFormBuilder(details).render(fieldsets=False) 291 data = Zuul.marshal(dict(record=details, form=form)) 292 return data
293
294 - def _getPasswordFields(self, obj):
295 """ 296 Return fields for obj if it has xtype and it is password. 297 """ 298 fields = IFormBuilder(IInfo(obj)).fields() 299 return [field for field in fields 300 if fields[field].get('xtype', None) 301 and fields[field].get('xtype') == 'password']
302 303 @require('Manage DMD')
304 - def setInfo(self, **data):
305 """ 306 Set attributes on an object. 307 This method accepts any keyword argument for the property that you wish 308 to set. The only required property is "uid". 309 310 @type uid: string 311 @keyword uid: Unique identifier of an object 312 @rtype: DirectResponse 313 @return: B{Properties}: 314 - data: (dictionary) The modified object 315 """ 316 uid = data['uid'] 317 del data['uid'] 318 obj = self._getFacade()._getObject(uid) 319 passwordFields = self._getPasswordFields(obj) 320 oldData = self._getInfoData(obj, data) 321 info = self._getFacade().setInfo(uid, data) 322 newData = self._getInfoData(obj, data) 323 # Trac #29376: Consistently show thresholdType with threshold operations. 324 thresholdType = obj.getTypeName() if isinstance(obj, ThresholdClass) else None 325 audit(['UI', getDisplayType(obj), 'Edit'], obj, thresholdType=thresholdType, 326 data_=newData, oldData_=oldData, 327 skipFields_=('newId',), # special case in TemplateFacade.setInfo() 328 maskFields_=passwordFields) 329 return DirectResponse.succeed(data=Zuul.marshal(info))
330
331 - def _getInfoData(self, obj, keys):
332 # TODO: generalize this code for all object types, if possible. 333 info = self._getFacade()._getDataSourceInfoFromObject(obj) 334 values = {} 335 for key in keys.keys(): 336 val = getattr(info, key, None) 337 if val is not None: 338 values[key] = str(val) # unmutable copy 339 # Special case: empty dsnames is sometimes '' and sometimes '[]' 340 if key == 'dsnames' and values[key] == '': 341 values[key] = '[]' 342 values['name'] = info.getName() 343 return values
344 345 @require('Manage DMD')
346 - def addThreshold(self, **data):
347 """ 348 Add a threshold. 349 350 @type uid: string 351 @keyword uid: Unique identifier of template to add threshold to 352 @type thresholdType: string 353 @keyword thresholdType: Type of the new threshold. From getThresholdTypes() 354 @type thresholdId: string 355 @keyword thresholdId: ID of the new threshold 356 @type dataPoints: [string] 357 @keyword dataPoints: List of data points to select for this threshold 358 @rtype: DirectResponse 359 @return: Success message 360 """ 361 uid = data['uid'] 362 thresholdType = data['thresholdType'] 363 thresholdId = data['thresholdId'] 364 dataPoints = data.get('dataPoints', None) 365 facade = self._getFacade() 366 facade.addThreshold(uid, thresholdType, thresholdId, dataPoints) 367 thresholdUid = uid + '/thresholds/' + thresholdId 368 audit('UI.Threshold.Add', thresholdUid, thresholdtype=thresholdType, 369 datapoints=dataPoints) 370 return DirectResponse.succeed()
371 372 @require('Manage DMD')
373 - def removeThreshold(self, uid):
374 """ 375 Remove a threshold. 376 377 @type uid: string 378 @param uid: Unique identifier of threshold to remove 379 @rtype: DirectResponse 380 @return: Success message 381 """ 382 facade = self._getFacade() 383 thresholdType = facade._getThresholdClass(uid).getTypeName() 384 facade.removeThreshold(uid) 385 audit('UI.Threshold.Delete', uid, thresholdType=thresholdType) 386 return DirectResponse.succeed()
387
388 - def getThresholdTypes(self, query=None):
389 """ 390 Get a list of available threshold types. 391 392 @type query: string 393 @param query: not used 394 @rtype: [dictionary] 395 @return: List of objects representing threshold types 396 """ 397 facade = self._getFacade() 398 data = facade.getThresholdTypes() 399 return DirectResponse.succeed(data=data)
400
401 - def getDataSourceTypes(self, query):
402 """ 403 Get a list of available data source types. 404 405 @type query: string 406 @param query: not used 407 @rtype: [dictionary] 408 @return: List of objects representing data source types 409 """ 410 facade = self._getFacade() 411 data = facade.getDataSourceTypes() 412 data = sorted(data, key=lambda row: row['type'].lower()) 413 return DirectResponse.succeed(data=data)
414
415 - def getGraphs(self, uid, query=None):
416 """ 417 Get the graph definitions for a template. 418 419 @type uid: string 420 @param uid: Unique ID of a template 421 @type query: string 422 @param query: not used 423 @rtype: [dictionary] 424 @return: List of objects representing representing graphs 425 """ 426 facade = self._getFacade() 427 graphs = facade.getGraphs(uid) 428 return Zuul.marshal(graphs)
429 430 @require('Manage DMD')
431 - def addDataPointToGraph(self, dataPointUid, graphUid, includeThresholds=False):
432 """ 433 Add a data point to a graph. 434 435 @type dataPointUid: string 436 @param dataPointUid: Unique ID of the data point to add to graph 437 @type graphUid: string 438 @param graphUid: Unique ID of the graph to add data point to 439 @type includeThresholds: boolean 440 @param includeThresholds: (optional) True to include related thresholds 441 (default: False) 442 @rtype: DirectResponse 443 @return: Success message 444 """ 445 facade = self._getFacade() 446 facade.addDataPointToGraph(dataPointUid, graphUid, includeThresholds) 447 audit('UI.Graph.AddDataPoint', graphUid, datapoint=dataPointUid, 448 includeThresholds=includeThresholds) 449 return DirectResponse.succeed()
450 451 @require('Manage DMD')
452 - def addDataSourcetoGraphDef(self, dataSourceUid, graphUid, includeThresholds=False):
453 """ 454 Add all the datapoints in a datasource to the graph definition. 455 456 @type dataSourceUid: string 457 @param dataSourceUid: Unique ID of the data source to add to graph 458 @type graphUid: string 459 @param graphUid: Unique ID of the graph to add data source to 460 @type includeThresholds: boolean 461 @param includeThresholds: (optional) True to include related thresholds 462 (default: False) 463 @rtype: DirectResponse 464 @return: Success message 465 """ 466 facade = self._getFacade() 467 facade.addDataSourceToGraph(dataSourceUid, graphUid, includeThresholds) 468 audit('UI.Graph.AddDataSource', graphUid, datapoint=dataSourceUid, 469 includeThresholds=includeThresholds) 470 return DirectResponse.succeed()
471
472 - def getCopyTargets(self, uid, query=''):
473 """ 474 Get a list of available device classes to copy a template to. 475 476 @type uid: string 477 @param uid: Unique ID of the template to copy 478 @type query: string 479 @param query: (optional) Filter the returned targets' names based on this 480 parameter (default: '') 481 @rtype: DirectResponse 482 @return: B{Properties}: 483 - data: ([dictionary]) List of objects containing an available device 484 class UID and a human-readable label for that class 485 """ 486 facade = self._getFacade() 487 data = Zuul.marshal( facade.getCopyTargets(uid, query) ) 488 return DirectResponse.succeed(data=data)
489 490 @require('Manage DMD')
491 - def copyTemplate(self, uid, targetUid):
492 """ 493 Copy a template to a device or device class. 494 495 @type uid: string 496 @param uid: Unique ID of the template to copy 497 @type targetUid: string 498 @param targetUid: Unique ID of the device or device class to bind to template 499 @rtype: DirectResponse 500 @return: Success message 501 """ 502 facade = self._getFacade() 503 facade.copyTemplate(uid, targetUid) 504 audit('UI.Template.Copy', uid, target=targetUid) 505 return DirectResponse.succeed()
506 507 @require('Manage DMD')
508 - def addGraphDefinition(self, templateUid, graphDefinitionId):
509 """ 510 Add a new graph definition to a template. 511 512 @type templateUid: string 513 @param templateUid: Unique ID of the template to add graph definition to 514 @type graphDefinitionId: string 515 @param graphDefinitionId: ID of the new graph definition 516 @rtype: DirectResponse 517 @return: Success message 518 """ 519 facade = self._getFacade() 520 facade.addGraphDefinition(templateUid, graphDefinitionId) 521 audit('UI.GraphDefinition.Add', graphDefinitionId, template=templateUid) 522 return DirectResponse.succeed()
523 524 @require('Manage DMD')
525 - def deleteDataSource(self, uid):
526 """ 527 Delete a data source. 528 529 @type uid: string 530 @param uid: Unique ID of the data source to delete 531 @rtype: DirectResponse 532 @return: Success message 533 """ 534 facade = self._getFacade() 535 facade.deleteDataSource(uid) 536 audit('UI.DataSource.Delete', uid) 537 return DirectResponse.succeed()
538 539 @require('Manage DMD')
540 - def deleteDataPoint(self, uid):
541 """ 542 Delete a data point. 543 544 @type uid: string 545 @param uid: Unique ID of the data point to delete 546 @rtype: DirectResponse 547 @return: Success message 548 """ 549 facade = self._getFacade() 550 facade.deleteDataPoint(uid) 551 audit('UI.DataPoint.Delete', uid) 552 return DirectResponse.succeed()
553 554 @require('Manage DMD')
555 - def deleteGraphDefinition(self, uid):
556 """ 557 Delete a graph definition. 558 559 @type uid: string 560 @param uid: Unique ID of the graph definition to delete 561 @rtype: DirectResponse 562 @return: Success message 563 """ 564 facade = self._getFacade() 565 facade.deleteGraphDefinition(uid) 566 audit('UI.GraphDefinition.Delete', uid) 567 return DirectResponse.succeed()
568 569 @require('Manage DMD')
570 - def deleteGraphPoint(self, uid):
571 """ 572 Delete a graph point. 573 574 @type uid: string 575 @param uid: Unique ID of the graph point to delete 576 @rtype: DirectResponse 577 @return: Success message 578 """ 579 facade = self._getFacade() 580 facade.deleteGraphPoint(uid) 581 audit('UI.GraphPoint.Remove', uid) 582 return DirectResponse.succeed()
583
584 - def getGraphPoints(self, uid):
585 """ 586 Get a list of graph points for a graph definition. 587 588 @type uid: string 589 @param uid: Unique ID of a graph definition 590 @rtype: DirectResponse 591 @return: B{Properties}: 592 - data: ([dictionary]) List of objects representing graph points 593 """ 594 facade = self._getFacade() 595 graphPoints = facade.getGraphPoints(uid) 596 return DirectResponse.succeed(data=Zuul.marshal(graphPoints))
597
598 - def getInfo(self, uid):
599 """ 600 Get the properties of an object. 601 602 @type uid: string 603 @param uid: Unique identifier of an object 604 @rtype: DirectResponse 605 @return: B{Properties} 606 - data: (dictionary) Object properties 607 - form: (dictionary) Object representing an ExtJS form for the object 608 """ 609 facade = self._getFacade() 610 info = facade.getInfo(uid) 611 form = IFormBuilder(info).render(fieldsets=False) 612 return DirectResponse(success=True, data=Zuul.marshal(info), form=form)
613 614 @require('Manage DMD')
615 - def addThresholdToGraph(self, graphUid, thresholdUid):
616 """ 617 Add a threshold to a graph definition. 618 619 @type graphUid: string 620 @param graphUid: Unique ID of the graph definition to add threshold to 621 @type thresholdUid: string 622 @param thresholdUid: Unique ID of the threshold to add 623 @rtype: DirectResponse 624 @return: Success message 625 """ 626 facade = self._getFacade() 627 facade.addThresholdToGraph(graphUid, thresholdUid) 628 audit('UI.Graph.AddThreshold', graphUid, thresholdclass=thresholdUid) 629 return DirectResponse.succeed()
630 631 @require('Manage DMD')
632 - def addCustomToGraph(self, graphUid, customId, customType):
633 """ 634 Add a custom graph point to a graph definition. 635 636 @type graphUid: string 637 @param graphUid: Unique ID of the graph definition to add graph point to 638 @type customId: string 639 @param customId: ID of the new custom graph point 640 @type customType: string 641 @param customType: Type of the new graph point. From getGraphInstructionTypes() 642 @rtype: DirectResponse 643 @return: Success message 644 """ 645 facade = self._getFacade() 646 facade.addCustomToGraph(graphUid, customId, customType) 647 audit('UI.Graph.AddCustomGraphPoint', graphUid, custom=customId) 648 return DirectResponse.succeed()
649
650 - def getGraphInstructionTypes(self, query=''):
651 """ 652 Get a list of available instruction types for graph points. 653 654 @type query: string 655 @param query: not used 656 @rtype: DirectResponse 657 @return: B{Properties}: 658 - data: ([dictionary]) List of objects representing instruction types 659 """ 660 facade = self._getFacade() 661 types = facade.getGraphInstructionTypes() 662 return DirectResponse.succeed(data=Zuul.marshal(types))
663 664 @require('Manage DMD')
665 - def setGraphPointSequence(self, uids):
666 """ 667 Sets the sequence of graph points in a graph definition. 668 669 @type uids: [string] 670 @param uids: List of graph point UID's in desired order 671 @rtype: DirectResponse 672 @return: Success message 673 """ 674 facade = self._getFacade() 675 facade.setGraphPointSequence(uids) 676 # TODO: Is it enforced that they're all in the same graph definition? 677 # If so: graphdefinition=/blah/uid sequence=[one,two,three] 678 audit('UI.GraphDefinition.SetGraphPointSequence', sequence=uids) 679 return DirectResponse.succeed()
680
681 - def getGraphDefinition(self, uid):
682 """ 683 Get a graph definition. 684 685 @type uid: string 686 @param uid: Unique ID of the graph definition to retrieve 687 @rtype: DirectResponse 688 @return: B{Properties}: 689 - data: (dictionary) Object representing a graph definition 690 """ 691 facade = self._getFacade() 692 graphDef = facade.getGraphDefinition(uid) 693 return DirectResponse.succeed(data=Zuul.marshal(graphDef))
694 695 @require('Manage DMD')
696 - def setGraphDefinition(self, **data):
697 """ 698 Set attributes on an graph definition. 699 This method accepts any keyword argument for the property that you wish 700 to set. Properties are enumerated via getGraphDefinition(). The only 701 required property is "uid". 702 703 @type uid: string 704 @keyword uid: Unique identifier of an object 705 @rtype: DirectResponse 706 @return: B{Properties}: 707 - data: (dictionary) The modified object 708 """ 709 uid = data['uid'] 710 del data['uid'] 711 for axis_vals in ('miny', 'maxy'): 712 try: 713 x = float(data[axis_vals]) 714 except (ValueError, KeyError): 715 x = -1 716 data[axis_vals] = x 717 obj = self._getFacade()._getObject(uid) 718 oldData = self._getInfoData(obj, data) 719 self._getFacade().setInfo(uid, data) 720 newData = self._getInfoData(obj, data) 721 audit(['UI', getDisplayType(obj), 'Edit'], data_=newData, oldData_=oldData, 722 skipFields_=('newId',)) # special case in TemplateFacade.setInfo() 723 return DirectResponse.succeed()
724 725 @require('Manage DMD')
726 - def setGraphDefinitionSequence(self, uids):
727 """ 728 Sets the sequence of graph definitions. 729 730 @type uids: [string] 731 @param uids: List of graph definition UID's in desired order 732 @rtype: DirectResponse 733 @return: Success message 734 """ 735 facade = self._getFacade() 736 facade._setGraphDefinitionSequence(uids) 737 # TODO: Is it enforced that they're all in the same template? 738 # If so: template=/blah/uid sequence=[one,two,three] 739 audit('UI.Template.SetGraphDefinitionSequence', sequence=uids) 740 return DirectResponse.succeed()
741 742 @require('Manage DMD')
743 - def getCollectorTemplate(self, id):
744 facade = self._getFacade() 745 templates = facade.getCollectorTemplate() 746 return Zuul.marshal(templates)
747
748 - def getDataPointsRPNValues(self, maxval, thuid, selecteddps, minval):
749 facade = self._getFacade() 750 dpRPN = facade.getDataPointsRPNValues(maxval, thuid, selecteddps, minval) 751 return DirectResponse.succeed(dpRPN=dpRPN)
752