Exemplo n.º 1
0
 def get_context_data(self, **kwargs):
     ret = super(Catalog, self).get_context_data(**kwargs)
     try:
         model_type_id = int(self.kwargs.get('type', ''))
     except ValueError:
         model_type_id = None
     kind = self.kwargs.get('kind')
     sidebar_items = (
         [
             MenuHeader('Component groups'),
         ] + [
             MenuItem(
                 label=t.raw.title(),
                 name='component-%d' % t.id,
                 fugue_icon=COMPONENT_ICONS.get(t.id),
                 view_name='catalog',
                 view_args=('component', t.id),
             ) for t in ComponentType(item=lambda t: t)
         ] + [
             MenuHeader('Device groups'),
         ] + [
             MenuItem(
                 label=t.raw.title(),
                 name='device-%d' % t.id,
                 fugue_icon=DEVICE_ICONS.get(t.id),
                 view_name='catalog',
                 view_args=('device', t.id),
             ) for t in DeviceType(item=lambda t: t)
         ] + [
             MenuHeader('Tools'),
             MenuItem(
                 'History',
                 name='history',
                 fugue_icon='fugue-hourglass',
                 view_name='catalog_history',
             ),
             MenuItem(
                 'Pricing groups',
                 name='pricing',
                 fugue_icon='fugue-shopping-basket',
                 view_name='catalog_pricing',
                 view_args=('pricing',),
             ),
         ]
     )
     selected = '%s-%d' % (kind, model_type_id) if model_type_id else ''
     ret.update({
         'component_model_types': ComponentType(item=lambda a: a),
         'details': self.kwargs.get('details', 'info'),
         'device_model_types': DeviceType(item=lambda a: a),
         'editable': True,
         'kind': kind,
         'model_type_id': model_type_id,
         'sidebar_items': sidebar_items,
         'sidebar_selected': selected,
         'subsection': model_type_id,
     })
     return ret
Exemplo n.º 2
0
 def get_sidebar_items(self):
     items = (('/assets/dc/add/device', 'Add device', 'fugue-block--plus'),
              ('/assets/dc/add/part', 'Add part', 'fugue-block--plus'),
              ('/assets/dc/search', 'Search', 'fugue-magnifier'),
              ('/admin/ralph_assets', 'Admin', 'fugue-toolbox'))
     sidebar_menu = (
         [MenuHeader('Data center actions')] +
         [MenuItem(label=t[1], fugue_icon=t[2], href=t[0]) for t in items])
     return sidebar_menu
Exemplo n.º 3
0
 def get_sidebar_items(self):
     preferences = ((reverse('user_home_page',
                             args=[]), _('Home Page'), 'fugue-home'), )
     sidebar_items = ([MenuHeader('Preferences')] + [
         MenuItem(label=preference[1],
                  fugue_icon=preference[2],
                  href=preference[0]) for preference in preferences
     ])
     return sidebar_items
Exemplo n.º 4
0
 def get_sidebar_items(self):
     items = (
         ('/assets/back_office/add/device/', 'Add device',
          'fugue-block--plus'),
         ('/assets/back_office/add/part/', 'Add part', 'fugue-block--plus'),
         ('/assets/back_office/search', 'Search', 'fugue-magnifier'),
     )
     sidebar_menu = (
         [MenuHeader('Back office actions')] +
         [MenuItem(label=t[1], fugue_icon=t[2], href=t[0]) for t in items])
     return sidebar_menu
Exemplo n.º 5
0
 def get_sidebar_items(self):
     ci = (
         ('/cmdb/search', 'All Cis', 'fugue-magnifier'),
         ('/cmdb/search?layer=7&top_level=1', 'Services',
          'fugue-disc-share'),
         ('/cmdb/add', 'Add CI', 'fugue-block--plus'),
         ('/cmdb/changes/dashboard', 'Dashboard', 'fugue-dashboard'),
         ('/cmdb/changes/timeline', 'Timeline View', 'fugue-dashboard'),
         ('/admin/cmdb', 'Admin', 'fugue-toolbox'),
     )
     reports = (
         ('/cmdb/changes/reports?kind=top_changes', 'Top CI changes',
          'fugue-reports'),
         ('/cmdb/changes/reports?kind=top_problems', 'Top CI problems',
          'fugue-reports'),
         ('/cmdb/changes/reports?kind=top_incidents', 'Top CI incidents',
          'fugue-reports'),
         ('/cmdb/changes/reports?kind=usage', 'Cis w/o changes',
          'fugue-reports'),
     )
     events = (('/cmdb/changes/changes', 'All Events', 'fugue-arrow'),
               ('/cmdb/changes/changes?type=3', 'Asset attr. changes',
                'fugue-wooden-box--arrow'),
               ('/cmdb/changes/changes?type=4', 'Monitoring events',
                'fugue-thermometer'), ('/cmdb/changes/changes?type=1',
                                       'Repo changes', 'fugue-git'),
               ('/cmdb/changes/changes?type=2', 'Agent events',
                'fugue-flask'), ('/cmdb/changes/changes?type=5',
                                 'Status Office events', 'fugue-plug'),
               ('/cmdb/changes/incidents', 'Incidents', 'fugue-question'),
               ('/cmdb/changes/problems', 'Problems', 'fugue-bomb'))
     sidebar_items = (
         [MenuHeader('Configuration Items')] +
         [MenuItem(label=t[1], fugue_icon=t[2], href=t[0])
          for t in ci] + [MenuHeader('Reports')] + [
              MenuItem(label=t[1], fugue_icon=t[2], href=t[0])
              for t in reports
          ] + [MenuHeader('Events and  Changes')] +
         [MenuItem(label=t[1], fugue_icon=t[2], href=t[0]) for t in events])
     return sidebar_items
Exemplo n.º 6
0
    def get_sidebar_items(self):
        has_perm = self.request.user.get_profile().has_perm
        preferences = [(reverse('user_api_key',
                                args=[]), _('API Key'), 'fugue-key')]
        if has_perm(Perm.has_core_access):
            preferences.insert(0, (reverse(
                'user_home_page', args=[]), _('Home Page'), 'fugue-home'))
        sidebar_items = ([MenuHeader('Preferences')] + [
            MenuItem(label=preference[1],
                     fugue_icon=preference[2],
                     href=preference[0]) for preference in preferences
        ])

        return sidebar_items
Exemplo n.º 7
0
 def get_sidebar_items(self, base_sidebar_caption):
     sidebar_menu = []
     sidebar_menu += [MenuHeader(_('Reports'))]
     sidebar_menu += [
         MenuItem(label=report.name,
                  href=reverse('report_detail',
                               kwargs={
                                   'mode': 'all',
                                   'slug': report.slug,
                               })) for report in self.reports
     ]
     sidebar_menu.extend(
         super(ReportViewBase,
               self).get_sidebar_items(base_sidebar_caption))
     return sidebar_menu
Exemplo n.º 8
0
 def get_sidebar_items(self):
     sidebar_items = (
         [MenuHeader('CMDB Archive')] +
         [
             MenuItem(
                 label='Asset attr. changes',
                 fugue_icon='fugue-wooden-box--arrow',
                 href='/cmdb/archive/assets/',
             ),
             MenuItem(
                 label='CI attributes changes',
                 fugue_icon='fugue-puzzle',
                 href='/cmdb/archive/cmdb/',
             ),
             MenuItem(
                 label='Monitoring events',
                 fugue_icon='fugue-thermometer',
                 href='/cmdb/archive/zabbix/',
             ),
             MenuItem(
                 label='Repo changes',
                 fugue_icon='fugue-git',
                 href='/cmdb/archive/git/',
             ),
             MenuItem(
                 label='Agent events',
                 fugue_icon='fugue-flask',
                 href='/cmdb/archive/puppet/',
             ),
             MenuItem(
                 label='Back to CMDB',
                 fugue_icon='fugue-arrow-return-180',
                 href='/cmdb/changes/timeline',
             )
         ]
     )
     return sidebar_items