Пример #1
0
    def _buildRelationships(self, dmd):
        log.info("Building dashboard relationships on user manager")
        # manager
        dmd.ZenUsers.buildRelations()
        # users
        settings = dmd.ZenUsers.getAllUserSettings()
        log.info("Building dashboard relationships on %s users ",
                 len(settings))
        for setting in settings:
            setting.buildRelations()

        # groups
        groups = dmd.ZenUsers.getAllGroupSettings()
        log.info("Building dashboard relationships on %s User Groups ",
                 len(groups))
        for group in groups:
            group.buildRelations()
        default = dmd.ZenUsers.dashboards._getOb('default', None)
        if not default:
            log.info("Creating the default Dashboard")
            site = {
                'core': 'core',
                'enterprise': 'commercial'
            }[dmd.getProductName()]
            dashboard = Dashboard('default')
            dashboard.columns = 2
            dashboard.owner = 'admin'
            dashboard.state = DEFAULT_DASHBOARD_STATE % site
            dmd.ZenUsers.dashboards._setObject('default', dashboard)
Пример #2
0
 def addDashboard(self, newId, uid, columns, state=None):
     """
     newId is the name of the dashboard
     uid is the context on which the dashboard appears. ZenUsers, UserSetings or GroupSettings
     """
     obj = self._getContext(uid)
     d = Dashboard(newId)
     d.columns = columns
     user = self._dmd.ZenUsers.getUserSettings()
     d.owner = user.id
     d.state = state
     obj.dashboards._setObject(newId, d)
 def addDashboard(self, newId, uid, columns, state=None):
     """
     newId is the name of the dashboard
     uid is the context on which the dashboard appears. ZenUsers, UserSetings or GroupSettings
     """
     obj = self._getContext(uid)
     d = Dashboard(newId)
     d.columns = columns
     user = self._dmd.ZenUsers.getUserSettings()
     d.owner = user.id
     d.state = state
     obj.dashboards._setObject(newId, d)
Пример #4
0
    def _buildRelationships(self, dmd):
        log.info("Building dashboard relationships on user manager")
        # manager
        dmd.ZenUsers.buildRelations()
        # users
        settings = dmd.ZenUsers.getAllUserSettings()
        log.info("Building dashboard relationships on %s users ", len(settings))
        for setting in settings:
            setting.buildRelations()

        # groups
        groups = dmd.ZenUsers.getAllGroupSettings()
        log.info("Building dashboard relationships on %s User Groups ", len(groups))
        for group in groups:
            group.buildRelations()
        default = dmd.ZenUsers.dashboards._getOb("default", None)
        if not default:
            log.info("Creating the default Dashboard")
            dashboard = Dashboard("default")
            dashboard.columns = 2
            dashboard.owner = "admin"
            dashboard.state = DEFAULT_DASHBOARD_STATE
            dmd.ZenUsers.dashboards._setObject("default", dashboard)