+
+class MadDashView(FreeAccessView):
+ template_name = "view-unfold1.html"
+
+ def get_context_data(self, **kwargs):
+ page = Page(self.request)
+
+ # This will simulate fake records in order to test the plugin
+ fake_query = Query.get('ping').select('hrn', 'src_hostname', 'dst_hostname', 'delay')
+ fake_query_all = Query.get('ping').select('hrn', 'src_hostname', 'dst_hostname', 'delay')
+
+ generators = {
+ 'hrn': 'random_string',
+ 'src_hostname': 'random_string',
+ 'dst_hostname': 'random_string',
+ 'delay': 'random_int'
+ }
+ page.generate_records(fake_query, generators, 5)
+ page.generate_records(fake_query_all, generators, 20)
+
+ plugin = MadDash(query = fake_query, query_all = fake_query_all, page = page)
+ context = super(MadDashView, self).get_context_data(**kwargs)
+ context['unfold_main'] = plugin.render(self.request)
+ context['title'] = 'Sandbox for MadDash plugin'
+ context['topmenu_items'] = topmenu_items_live ('maddash', page)
+ context['username'] = the_user(self.request)
+
+ prelude_env = page.prelude_env()
+ context.update(prelude_env)
+
+ return context
+