Package Products :: Package ZenModel :: Module UserInterfaceSettings
[hide private]
[frames] | no frames]

Source Code for Module Products.ZenModel.UserInterfaceSettings

 1  ############################################################################## 
 2  #  
 3  # Copyright (C) Zenoss, Inc. 2011, 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  from Products.ZenModel.ZenModelRM import ZenModelRM 
12  from Products.Zuul.utils import ZuulMessageFactory as _t 
13  from copy import deepcopy 
14   
15 -class UserInterfaceSettings(ZenModelRM):
16 """ 17 Container for various settings on the User Interface. This is 18 serialized and sent down to the server on every page request. Any 19 user configurable settings that apply to the user interface should 20 be added here 21 """ 22 23 _relations = () 24 25 _properties = ( 26 {'id': 'enableLiveSearch', 'type': 'boolean', 'mode': 'w'}, 27 {'id': 'incrementalTreeLoad', 'type': 'boolean', 'mode': 'w'}, 28 {'id': 'enableTreeFilters', 'type': 'boolean', 'mode': 'w'}, 29 {'id': 'deviceGridBufferSize', 'type': 'int', 'mode': 'w'}, 30 {'id': 'componentGridBufferSize', 'type': 'int', 'mode': 'w'}, 31 {'id': 'eventConsoleBufferSize', 'type': 'int', 'mode': 'w'}, 32 {'id': 'deviceMoveJobThreshold', 'type': 'int', 'mode': 'w'}, 33 {'id': 'zenjobsRefreshInterval', 'type' : 'int', 'mode':'w'}, 34 ) 35 36 # information about the properties that is used for the UI 37 _propertyMetaData = { 38 'enableLiveSearch': {'xtype': 'checkbox', 'name': _t('Enable Live Filters'), 'defaultValue': False}, 39 'incrementalTreeLoad': {'xtype': 'checkbox', 'name': _t('Enable Incremental Tree Loading on the Infrastructure Page'), 'defaultValue': True}, 40 'enableTreeFilters': {'xtype': 'checkbox', 'name': _t('Enable Tree Filters'), 'defaultValue': True}, 41 'deviceGridBufferSize': {'xtype': 'numberfield', 'name': _t('Device Grid Buffer Size'), 'defaultValue': 100, 'minValue': 50, 'maxValue': 1000, 'allowBlank': False}, 42 'componentGridBufferSize': {'xtype': 'numberfield', 'name': _t('Component Grid Buffer Size'), 'defaultValue': 50, 'minValue': 25, 'maxValue': 1000, 'allowBlank': False}, 43 'eventConsoleBufferSize': {'xtype': 'numberfield', 'name': _t('Event Console Buffer Size'), 'defaultValue': 200, 'minValue': 50, 'maxValue': 1000, 'allowBlank': False}, 44 'deviceMoveJobThreshold': {'xtype': 'numberfield', 'name': _t('Device Move Job Threshold'), 'defaultValue': 5, 'minValue': 0, 'allowBlank': False}, 45 'zenjobsRefreshInterval': {'xtype': 'numberfield', 'name': _t('Job Notification Refresh Interval (seconds)'), 'defaultValue' : 5, 'minValue' : 1, 'maxValue': 300, 'allowBlank': False}, 46 } 47
48 - def getInterfaceSettings(self):
49 """ 50 @rtype: Dictionary 51 @return Key/Value pair of all settings for the UserInterface 52 """ 53 settings = {} 54 for prop in self.getSettingsData(): 55 propId = prop['id'] 56 settings[propId] = prop['value'] 57 return settings
58
59 - def getSettingsData(self):
60 """ 61 @rtype: Dictionary 62 @return: The value of the settings along with some meta information 63 for display 64 """ 65 settings = deepcopy(self._properties) 66 for prop in settings: 67 prop.update(self._propertyMetaData[prop['id']]) 68 prop['value'] = getattr(self, prop['id'], prop['defaultValue']) 69 return settings
70