Get the sections to display based on dashboard
495735
def _get_allowed_sections(self, dashboard):
        

        allowed_titles = [x[0] for x in dashboard]
        allowed_sections = [x[2] for x in dashboard]
        return tuple(allowed_sections), tuple(allowed_titles)
1044598
protected function setDataContentIndexDashboard()
    {
        $columns = $this->config('dashboard_columns', 2);

        $this->setData('columns', $columns);
        $this->setData('dashboard', gplcart_array_split($this->data_dashboard['data'], $columns));

        $stores = $this->store->getList(array('status' => 1));
        $this->setData('no_enabled_stores', empty($stores));

        if ($this->config('intro', false) && $this->isSuperadmin()) {
            $this->setData('intro', $this->render('dashboard/intro'));
        }
    }
1024467
function widgetsLayout(): array
    {
        if(!$this->layoutBuilt) {
            $this->buildWidgetsLayout();
            $this->layoutBuilt = true;
        }

        return [
            "rows" => collect($this->rows)->map(function(DashboardLayoutRow $row) {
                return $row->toArray();
            })->all()
        ];
    }
734003
def get_mandatory_sections(self):
        """"""
        return [s for s in self.opt
                if s not in self.optional_sections and
                   s not in self.excluded_sections]
769798
public function sectionTemplatesAdd()
	{
		$form = array(
			'name' => 'addForm',
			'caption' => Eresus_Kernel::app()->getPage()->title.ADM_T_DIV.ADM_ADD,
			'width' => '100%',
			'fields' => array (
				array('type'=>'hidden','name'=>'action', 'value'=>'insert'),
				array('type'=>'hidden','name'=>'section', 'value'=>arg('section')),
				array('type'=>'edit','name'=>'name','label'=>ADM_THEMES_FILENAME_LABEL, 'width'=>'200px',
					'comment'=>'.html'),
				array('type'=>'edit','name'=>'desc','label'=>ADM_THEMES_DESC_LABEL, 'width'=>'100%'),
				array('type'=>'memo','name'=>'code', 'height'=>'30', 'syntax' => 'html'),
			),
			'buttons' => array('ok','cancel'),
		);
		/** @var TAdminUI $page */
		$page = Eresus_Kernel::app()->getPage();
		$result = $page->renderForm($form);
		return $result;
	}
228951
function getSections($, root, relative) {

  var items = [];

  var sections = root.children("section[data-type], div[data-type='part']");

  sections.each(function(index, el) {

    var jel = $(el);
    var header = jel.find("> header");

    // create section item
    var item = {
      id: jel.attr("id"),
      type: jel.attr("data-type")
    };

    // find title of section
    var title = header.length ? header.find("> h1, > h2, > h3, > h4, > h5") : jel.find("> h1, > h2, > h3, > h4, > h5");
    if(title.length) {
      item.label = title.first().text();
    }

    // find level of section
    var level;
    if(item.type in levels) {
      level = levels[item.type];
    } else {
      return;
    }

    // find href of section
    item.relative = relative;

    if(level <= maxLevel) {
      item.children = getSections($, jel, relative);
    }

    items.push(item);
  });

  return items;
}
522377
def horizon_main_nav(context):
    """"""
    if 'request' not in context:
        return {}
    current_dashboard = context['request'].horizon.get('dashboard', None)
    dashboards = []
    for dash in Horizon.get_dashboards():
        if dash.can_access(context):
            if callable(dash.nav) and dash.nav(context):
                dashboards.append(dash)
            elif dash.nav:
                dashboards.append(dash)
    return {'components': dashboards,
            'user': context['request'].user,
            'current': current_dashboard,
            'request': context['request']}
919385
public function index()
    {
        $stats     = $this->logViewer->statsTable();
        $chartData = $this->prepareChartData($stats);
        $percents  = $this->calcPercentages($stats->footer(), $stats->header());

        return $this->view('dashboard', compact('chartData', 'percents'));
    }
1043817
def _ensure_annotations(dashboard):
    ''''''
    if 'annotation_tags' not in dashboard:
        return
    tags = dashboard['annotation_tags']
    annotations = {
        'enable': True,
        'list': [],
    }
    for tag in tags:
        annotations['list'].append({
            'datasource': "graphite",
            'enable': False,
            'iconColor': "#C0C6BE",
            'iconSize': 13,
            'lineColor': "rgba(255, 96, 96, 0.592157)",
            'name': tag,
            'showLine': True,
            'tags': tag,
        })
    del dashboard['annotation_tags']
    dashboard['annotations'] = annotations
144317
def get_urls(self):
        
        urls = super(DashboardSite, self).get_urls()
        custom_urls = [
            url(r'^$',
                self.admin_view(HomeView.as_view()),
                name='index'),
            url(r'^logs/', include(logs_urlpatterns(self.admin_view))),
        ]

        custom_urls += get_realtime_urls(self.admin_view)

        del urls[0]
        return custom_urls + urls
1205500
function() {

            var self = this;
            var $element = $(this.element);
            self.attrId = $element.attr('id');
            //$element.html("Here I am...");
            // This is associated with dataAnalyzer.
            self.analyzeData();
            // TODO: process data:
            //  - rule to group! generate the tree map data.
            //  - set up the sunburst data structure.
            //  - calculate sub total, total
            //  - sorting the data, group

            // build dashboard, which will refresh the page's HTML DOM object
            // This is associated with dashboardBuilder.
            self.buildDashboard();
            // once we have the dashboard we will build the summary for data
            // This is associated with summaryBuilder.
            self.buildSummary();
            // and feed the insights
            self.feedInsights();
            // draw chart at the end, so we could calculate
            // the correct position (top and left offset).
            // This is associated with chartPainter
            self.drawChart();
        }
1178359
public function showComponentGroups()
    {
        $this->subMenu['groups']['active'] = true;

        return View::make('dashboard.components.groups.index')
            ->withPageTitle(trans_choice('dashboard.components.groups.groups', 2).' - '.trans('dashboard.dashboard'))
            ->withGroups(ComponentGroup::orderBy('order')->get())
            ->withSubMenu($this->subMenu);
    }
1352708
public function dashboard()
    {
        //if the dev has chosen to use a dashboard
        if (config('administrator.use_dashboard')) {
            //set the layout dashboard
            $this->layout->dashboard = true;

            //set the layout content
            $this->layout->content = view(config('administrator.dashboard_view'));

            return $this->layout;
        }
        //else we should redirect to the menu item
        else {
            $configFactory = app('admin_config_factory');
            $home          = config('administrator.home_page');

            //first try to find it if it's a model config item
            $config = $configFactory->make($home);

            if (!$config) {
                throw new \InvalidArgumentException('Administrator: '.trans('administrator::administrator.valid_home_page'));
            } elseif ($config->getType() === 'model') {
                return redirect()->route('admin_index', array($config->getOption('name')));
            } elseif ($config->getType() === 'settings') {
                return redirect()->route('admin_settings', array($config->getOption('name')));
            }
        }
    }
488511
@Override
    public List<Dashboard> getDashboards() {
        
       
            JAXBContext context;
            try {
                context = JAXBContext.newInstance(Dashboard.class.getPackage().getName());
            } catch (JAXBException e) {
                throw new IllegalArgumentException("Could not create JAXBContext", e);
            }
            List<Dashboard> dashboards = new ArrayList<Dashboard>();
            try {
                Configuration config = (Configuration) context.createUnmarshaller().unmarshal(sourceXml.getInputStream());
                dashboards.addAll(config.getDashboard());
            } catch (Exception e) {
                throw new IllegalStateException("Could not load dashboards configuration from " + sourceXml.toString(), e);
            }
            /*
            if(additionalSourceXml != null) {
                if (additionalSourceXml.isReadable()) {
            
                    try {
                        Configuration config = (Configuration) context.createUnmarshaller().unmarshal(additionalSourceXml.getInputStream());
                        dashboards.addAll(config.getDashboard());
                    } catch (Exception e) {
                    throw new IllegalStateException("Could not load dashboards configuration from " + additionalSourceXml.toString(), e);
                    }
                } else {
                    throw new IllegalStateException("Could not read configuration from " + additionalSourceXml.toString());
                }
            }
            */
            Collections.sort(dashboards);
            return dashboards;
      
       
    }
614544
def dashboard(request):
    """"""
    sources = (models.Source.objects.all().prefetch_related('metric_set')
                                          .order_by('name'))
    metrics = SortedDict([(src, src.metric_set.all()) for src in sources])
    no_source_metrics = models.Metric.objects.filter(source__isnull=True)
    if no_source_metrics:
        metrics[''] = no_source_metrics

    if request.META.get('HTTP_X_PJAX', False):
        parent_template = 'pjax.html'
    else:
        parent_template = 'base.html'
    return render(request, 'metrics/dashboard.html', {
        'source_metrics': metrics,
        'parent_template': parent_template
    })
13004
public function panel_section() {
		$output = null;

		// render the section wrapper.
		$output .= '<div class="uix-' . esc_attr( $this->type ) . '-sections uix-sections">';

		$hidden = 'false';
		foreach ( $this->child as $section ) {

			if ( ! $this->is_section_object( $section ) && ! $this->is_control_object( $section ) ) {
				continue;
			}
			$section->struct['active'] = $hidden;
			$output                   .= $section->render();
			$hidden                    = 'true';
		}

		$output .= '</div>';

		return $output;
	}
292882
def horizon_dashboard_nav(context):
    """"""
    if 'request' not in context:
        return {}
    dashboard = context['request'].horizon['dashboard']
    panel_groups = dashboard.get_panel_groups()
    non_empty_groups = []

    for group in panel_groups.values():
        allowed_panels = []
        for panel in group:
            if (callable(panel.nav) and panel.nav(context) and
                    panel.can_access(context)):
                allowed_panels.append(panel)
            elif (not callable(panel.nav) and panel.nav and
                    panel.can_access(context)):
                allowed_panels.append(panel)
        if allowed_panels:
            if group.name is None:
                non_empty_groups.append((dashboard.name, allowed_panels))
            else:
                non_empty_groups.append((group.name, allowed_panels))

    return {'components': OrderedDict(non_empty_groups),
            'user': context['request'].user,
            'current': context['request'].horizon['panel'].slug,
            'request': context['request']}