Examples of DashboardWidget


Examples of org.fluxtream.core.domain.DashboardWidget

                try {
                    manifestJSON = JSONObject.fromObject(manifestJSONString);
                } catch (Throwable t) {
                    throw new RuntimeException("Could not parse widget manifest (" + t.getMessage() + ")");
                }
                widgets.add(new DashboardWidget(manifestJSON, (local ? "/" : baseURL) + "widgets"));
            }
        } catch (IOException e) {
            throw new RuntimeException("Could not access widget manifest JSON URL: " + widgetUrl);
        }
        return widgets;
View Full Code Here

Examples of org.graylog2.dashboards.widgets.DashboardWidget

            Dashboard dashboard = new DashboardImpl((ObjectId) o.get("_id"), fields);

            // Add all widgets of this dashboard.
            if (fields.containsKey(DashboardImpl.EMBEDDED_WIDGETS)) {
                for (BasicDBObject widgetFields : (List<BasicDBObject>) fields.get(DashboardImpl.EMBEDDED_WIDGETS)) {
                    DashboardWidget widget = null;
                    try {
                        widget = DashboardWidget.fromPersisted(metricRegistry, searches, widgetFields);
                    } catch (DashboardWidget.NoSuchWidgetTypeException e) {
                        LOG.error("No such widget type: [" + widgetFields.get("type") + "] - Dashboard: [" + dashboard.getId() + "]", e);
                        continue;
View Full Code Here

Examples of org.graylog2.dashboards.widgets.DashboardWidget

            checkPermission(RestPermissions.SEARCHES_ABSOLUTE);
            checkPermission(RestPermissions.SEARCHES_RELATIVE);
            checkPermission(RestPermissions.SEARCHES_KEYWORD);
        }

        DashboardWidget widget;
        try {
            widget = DashboardWidget.fromRequest(metricRegistry, searches, awr, getCurrentUser().getName());

            Dashboard dashboard = dashboardRegistry.get(dashboardId);

            if (dashboard == null) {
                LOG.error("Dashboard [{}] not found.", dashboardId);
                throw new WebApplicationException(404);
            }

            dashboardService.addWidget(dashboard, widget);
        } catch (ValidationException e1) {
            LOG.error("Validation error.", e1);
            throw new WebApplicationException(e1, Response.Status.BAD_REQUEST);
        } catch (DashboardWidget.NoSuchWidgetTypeException e2) {
            LOG.error("No such widget type.", e2);
            throw new WebApplicationException(e2, Response.Status.BAD_REQUEST);
        } catch (InvalidRangeParametersException e3) {
            LOG.error("Invalid timerange parameters provided.", e3);
            throw new WebApplicationException(e3, Response.Status.BAD_REQUEST);
        } catch (InvalidWidgetConfigurationException e4) {
            LOG.error("Invalid widget configuration.", e4);
            throw new WebApplicationException(e4, Response.Status.BAD_REQUEST);
        }

        Map<String, Object> result = Maps.newHashMap();
        result.put("widget_id", widget.getId());

        return Response.status(Response.Status.CREATED).entity(json(result)).build();
    }
View Full Code Here

Examples of org.graylog2.dashboards.widgets.DashboardWidget

        if (dashboard == null) {
            LOG.error("Dashboard not found.");
            throw new WebApplicationException(404);
        }

        final DashboardWidget widget = dashboard.getWidget(widgetId);

        dashboardService.removeWidget(dashboard, widget);

        String msg = "Deleted widget <" + widgetId + "> from dashboard <" + dashboardId + ">. Reason: REST request.";
        LOG.info(msg);
View Full Code Here

Examples of org.graylog2.dashboards.widgets.DashboardWidget

        if (dashboard == null) {
            LOG.error("Dashboard not found.");
            throw new WebApplicationException(404);
        }

        DashboardWidget widget = dashboard.getWidget(widgetId);

        if (widget == null) {
            LOG.error("Widget not found.");
            throw new WebApplicationException(404);
        }

        try {
            return Response.status(Response.Status.OK).entity(json(widget.getComputationResult().asMap())).build();
        } catch (ExecutionException e) {
            LOG.error("Error while computing dashboard.", e);
            return Response.status(Response.Status.GATEWAY_TIMEOUT).build();
        }
    }
View Full Code Here

Examples of org.graylog2.dashboards.widgets.DashboardWidget

            if (dashboard == null) {
                LOG.error("Dashboard not found.");
                throw new WebApplicationException(404);
            }

            DashboardWidget widget = dashboard.getWidget(widgetId);

            if (widget == null) {
                LOG.error("Widget not found.");
                throw new WebApplicationException(404);
            }
View Full Code Here

Examples of org.graylog2.dashboards.widgets.DashboardWidget

            if (dashboard == null) {
                LOG.error("Dashboard not found.");
                throw new WebApplicationException(404);
            }

            DashboardWidget widget = dashboard.getWidget(widgetId);

            if (widget == null) {
                LOG.error("Widget not found.");
                throw new WebApplicationException(404);
            }
View Full Code Here

Examples of org.graylog2.restclient.models.dashboards.widgets.DashboardWidget

    }

    public Result widgetValue(String dashboardId, String widgetId, int resolution) {
        try {
            Dashboard dashboard = dashboardService.get(dashboardId);
            DashboardWidget widget = dashboard.getWidget(widgetId);
            DashboardWidgetValueResponse widgetValue = widget.getValue(api());

            Object resultValue = (widget instanceof SearchResultChartWidget) ? filterValuesByResolution(resolution, widgetValue.result) : widgetValue.result;
            Map<String, Object> result = Maps.newHashMap();
            result.put("result", resultValue);
            result.put("took_ms", widgetValue.tookMs);
View Full Code Here

Examples of org.graylog2.restclient.models.dashboards.widgets.DashboardWidget

                streamId = params.get("streamId");
            } else {
                streamId = params.get("streamid");
            }

            DashboardWidget widget;
            try {
                switch (DashboardWidget.Type.valueOf(params.get("widgetType"))) {
                    case SEARCH_RESULT_COUNT:
                        widget = new SearchResultCountWidget(dashboard, query, timerange, description);
                        break;
View Full Code Here

Examples of org.graylog2.restclient.models.dashboards.widgets.DashboardWidget

            return badRequest();
        }

        try {
            Dashboard dashboard = dashboardService.get(dashboardId);
            DashboardWidget widget = dashboard.getWidget(widgetId);

            widget.updateDescription(api(), newDescription.trim());

            return ok().as(Http.MimeTypes.JSON);
        } catch (APIException e) {
            String message = "Could not get widget. We expected HTTP 200, but got a HTTP " + e.getHttpCode() + ".";
            return status(504, views.html.errors.error.render(message, e, request()));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.