Search in sources :

Example 16 with Dashboard

use of com.epam.ta.reportportal.entity.dashboard.Dashboard in project service-api by reportportal.

the class DemoDashboardsService method createDemoDashboard.

private Dashboard createDemoDashboard(List<Widget> widgets, ReportPortalUser user, Project project, String name) {
    Dashboard dashboard = new Dashboard();
    dashboard.setName(name);
    dashboard.setProject(project);
    dashboard.setCreationDate(LocalDateTime.now());
    dashboard.setOwner(user.getUsername());
    dashboard.setShared(SHARED);
    dashboardRepository.save(dashboard);
    dashboard.addWidget(createDashboardWidget(user.getUsername(), dashboard, widgets.get(0), 0, 0, 6, 5));
    dashboard.addWidget(createDashboardWidget(user.getUsername(), dashboard, widgets.get(1), 6, 0, 6, 5));
    dashboard.addWidget(createDashboardWidget(user.getUsername(), dashboard, widgets.get(2), 0, 5, 7, 5));
    dashboard.addWidget(createDashboardWidget(user.getUsername(), dashboard, widgets.get(3), 7, 5, 5, 5));
    dashboard.addWidget(createDashboardWidget(user.getUsername(), dashboard, widgets.get(4), 0, 10, 5, 5));
    dashboard.addWidget(createDashboardWidget(user.getUsername(), dashboard, widgets.get(5), 5, 10, 7, 5));
    dashboard.addWidget(createDashboardWidget(user.getUsername(), dashboard, widgets.get(6), 0, 15, 6, 5));
    dashboard.addWidget(createDashboardWidget(user.getUsername(), dashboard, widgets.get(7), 6, 15, 6, 5));
    dashboard.addWidget(createDashboardWidget(user.getUsername(), dashboard, widgets.get(8), 0, 20, 12, 4));
    dashboard.addWidget(createDashboardWidget(user.getUsername(), dashboard, widgets.get(9), 0, 24, 7, 5));
    dashboard.addWidget(createDashboardWidget(user.getUsername(), dashboard, widgets.get(10), 7, 24, 5, 5));
    dashboard.addWidget(createDashboardWidget(user.getUsername(), dashboard, widgets.get(11), 0, 29, 12, 4));
    aclHandler.initAcl(dashboard, user.getUsername(), project.getId(), SHARED);
    return dashboard;
}
Also used : Dashboard(com.epam.ta.reportportal.entity.dashboard.Dashboard)

Aggregations

Dashboard (com.epam.ta.reportportal.entity.dashboard.Dashboard)16 DashboardWidget (com.epam.ta.reportportal.entity.dashboard.DashboardWidget)8 Test (org.junit.jupiter.api.Test)8 Widget (com.epam.ta.reportportal.entity.widget.Widget)6 OperationCompletionRS (com.epam.ta.reportportal.ws.model.OperationCompletionRS)4 DashboardWidgetId (com.epam.ta.reportportal.entity.dashboard.DashboardWidgetId)3 DashboardBuilder (com.epam.ta.reportportal.ws.converter.builders.DashboardBuilder)3 DashboardActivityResource (com.epam.ta.reportportal.ws.model.activity.DashboardActivityResource)3 UpdateDashboardRQ (com.epam.ta.reportportal.ws.model.dashboard.UpdateDashboardRQ)3 ShareableObjectsHandler (com.epam.ta.reportportal.auth.acl.ShareableObjectsHandler)2 ReportPortalUser (com.epam.ta.reportportal.commons.ReportPortalUser)2 MessageBus (com.epam.ta.reportportal.core.events.MessageBus)2 DashboardUpdatedEvent (com.epam.ta.reportportal.core.events.activity.DashboardUpdatedEvent)2 WidgetDeletedEvent (com.epam.ta.reportportal.core.events.activity.WidgetDeletedEvent)2 GetShareableEntityHandler (com.epam.ta.reportportal.core.shareable.GetShareableEntityHandler)2 WidgetContentRemover (com.epam.ta.reportportal.core.widget.content.remover.WidgetContentRemover)2 DashboardRepository (com.epam.ta.reportportal.dao.DashboardRepository)2 DashboardWidgetRepository (com.epam.ta.reportportal.dao.DashboardWidgetRepository)2 WidgetRepository (com.epam.ta.reportportal.dao.WidgetRepository)2 ReportPortalException (com.epam.ta.reportportal.exception.ReportPortalException)2