Outputs all available dashboards for the current user as a JSON string
178135
public function getAllDashboards()
    {
        $this->checkTokenInUrl();

        if (Piwik::isUserIsAnonymous()) {
            Json::sendHeaderJSON();
            return '[]';
        }

        $login      = Piwik::getCurrentUserLogin();
        $dashboards = $this->dashboard->getAllDashboards($login);

        Json::sendHeaderJSON();
        return json_encode($dashboards);
    }
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
769303
def recent_activity(self, user_id):
        """"""
        M = models  # noqa

        if request.args.get('limit'):
            limit = int(request.args.get('limit'))
        else:
            limit = 1000

        qry = (
            db.session.query(M.Log, M.Dashboard, M.Slice)
            .outerjoin(
                M.Dashboard,
                M.Dashboard.id == M.Log.dashboard_id,
            )
            .outerjoin(
                M.Slice,
                M.Slice.id == M.Log.slice_id,
            )
            .filter(
                sqla.and_(
                    ~M.Log.action.in_(('queries', 'shortner', 'sql_json')),
                    M.Log.user_id == user_id,
                ),
            )
            .order_by(M.Log.dttm.desc())
            .limit(limit)
        )
        payload = []
        for log in qry.all():
            item_url = None
            item_title = None
            if log.Dashboard:
                item_url = log.Dashboard.url
                item_title = log.Dashboard.dashboard_title
            elif log.Slice:
                item_url = log.Slice.slice_url
                item_title = log.Slice.slice_name

            payload.append({
                'action': log.Log.action,
                'item_url': item_url,
                'item_title': item_title,
                'time': log.Log.dttm,
            })
        return json_success(
            json.dumps(payload, default=utils.json_int_dttm_ser))
493026
def get_urls(self):
        """"""
        from django.conf.urls import patterns, url
        from views import DashboardWelcomeView

        urls = super(AdminMixin, self).get_urls()
        del urls[0]
        custom_url = patterns(
            '',
            url(r'^$', self.admin_view(DashboardWelcomeView.as_view()), name="index")
        )

        return custom_url + urls
1034315
def get_users_list(options={})
      content_type = {'Content-Type' => 'application/json'}
      content_type.merge!(options[:headers]) if options[:headers]

      uri = build_uri("/accounts/#{@acct_id}/users?additional_info=true")

      request = Net::HTTP::Get.new(uri.request_uri, headers(options[:headers]))
      http = initialize_net_http_ssl(uri)
      response = http.request(request)
      generate_log(request, response, uri)

      parsed_response = JSON.parse(response.body)
      (parsed_response || {}).fetch("users", [])
    end
1359303
def json(self):
        
        data = super(CalTRACKHourlyModel, self).json()
        data.update(
            {
                "occupancy_lookup": self.occupancy_lookup.to_json(orient="split"),
                "temperature_bins": self.temperature_bins.to_json(orient="split"),
            }
        )
        return data
475129
def getJsonData(self, params):
        
        try:
            return eval("self." + str(params['output_id']) + "(params)")
        except AttributeError:
            df = self.getData(params)
            if df is None:
                return None
            return df.to_dict(orient='records')
971427
def save_dash(self, dashboard_id):
        """"""
        session = db.session()
        dash = (session
                .query(models.Dashboard)
                .filter_by(id=dashboard_id).first())
        check_ownership(dash, raise_if_false=True)
        data = json.loads(request.form.get('data'))
        self._set_dash_metadata(dash, data)
        session.merge(dash)
        session.commit()
        session.close()
        return json_success(json.dumps({'status': 'SUCCESS'}))
1316792
private function loadDashboardCards()
	{
		// Fetch all the dashboard cards for the current user
		$model = UserMetadata::model()->getPrototype('UserMetadata', array(
		             'user_id' => $this->user->id,
		             'key' => 'dashboard_cards'
		         ), array('value' => '{}'));

		$model->value = CJSON::decode($model->value);

		return $model;
	}
23883
public function dashboardCpts()
    {

        $args = array(
            'public' => true ,
            '_builtin' => false
        );

        $output = 'object';
        $operator = 'and';
        $post_types = get_post_types($args, $output, $operator);

        foreach ($post_types as $post_type) {
            $num_posts = wp_count_posts($post_type->name);
            $num = number_format_i18n($num_posts->publish);
            $text = _n($post_type->labels->singular_name, $post_type->labels->name, intval($num_posts->publish));

            if (current_user_can('edit_posts')) {
                $num = "<a href='edit.php?post_type=$post_type->name'>$num";
                $text = "$text</a>";
            }

            echo '<li class="post-count">' . $num . ' ' . $text . '</li>';
        }
    }
644543
public Optional<Dashboard> show(long dashboardId)
    {
        return HTTP.GET(String.format("/v2/dashboards/%d.json", dashboardId), DASHBOARD);
    }
614668
def export_dashboards(session):
    """"""
    logging.info('Starting export')
    dashboards = session.query(Dashboard)
    dashboard_ids = []
    for dashboard in dashboards:
        dashboard_ids.append(dashboard.id)
    data = Dashboard.export_dashboards(dashboard_ids)
    return data
258872
def output_to_json(sources):
    """"""
    results = OrderedDict()
    for source in sources:
        if source.get_is_available():
            source.update()
            source_name = source.get_source_name()
            results[source_name] = source.get_sensors_summary()
    print(json.dumps(results, indent=4))
    sys.exit()
968231
def user_show(self, id, **kwargs):
        ""
        api_path = "/api/v2/users/{id}.json"
        api_path = api_path.format(id=id)
        return self.call(api_path, **kwargs)
896539
@Override
    @Transactional
    public Dashboard findDashboardByNameAndOwner(String name, PrincipalUser owner) {
        requireNotDisposed();
        requireArgument(name != null && !name.isEmpty(), "Dashboard name cannot be null or empty");
        requireArgument(owner != null, "Owner of the dashboard cannot be null");
        _logger.debug("Querying Dashboard by name: {} and owned by: {}", name, owner);

        Dashboard dashboard = Dashboard.findByNameAndOwner(emf.get(), name, owner);

        _logger.debug("Found Dashboard: {}", dashboard);
        return dashboard;
    }
1077444
def create
      @dashboard_template = MnoEnterprise::Impac::Dashboard.new(dashboard_template_params.merge(dashboard_type: 'template'))

      # Abort on failure
      unless @dashboard_template.save
        return render json: { errors: dashboard_template.errors }, status: :bad_request
      end
        
      MnoEnterprise::EventLogger.info('dashboard_template_create', current_user.id, 'Dashboard Template Creation', dashboard_template)
      render 'show'
    end
285802
def get_dashboard(self, id, **kwargs):
        "
        resp = self._get_object_by_name(self._DASHBOARD_ENDPOINT_SUFFIX, id,
                                        **kwargs)
        return resp