use of org.graylog2.dashboards.events.DashboardDeletedEvent in project graylog2-server by Graylog2.
the class StartPageCleanupListener method removeStartpageReferencesIfDashboardDeleted.
@Subscribe
@SuppressWarnings("unused")
public void removeStartpageReferencesIfDashboardDeleted(DashboardDeletedEvent dashboardDeletedEvent) {
final Startpage deletedStartpage = Startpage.create("dashboard", dashboardDeletedEvent.dashboardId());
resetReferencesToStartpage(deletedStartpage);
}
use of org.graylog2.dashboards.events.DashboardDeletedEvent in project graylog2-server by Graylog2.
the class ViewsResourceTest method deletingDashboardTriggersEvent.
@Test
public void deletingDashboardTriggersEvent() {
final String viewId = "foobar";
when(searchUser.canDeleteView(view)).thenReturn(true);
when(view.type()).thenReturn(ViewDTO.Type.DASHBOARD);
when(view.id()).thenReturn(viewId);
when(viewService.get(viewId)).thenReturn(Optional.of(view));
when(userService.loadAll()).thenReturn(Collections.emptyList());
this.viewsResource.delete(viewId, searchUser);
final ArgumentCaptor<DashboardDeletedEvent> eventCaptor = ArgumentCaptor.forClass(DashboardDeletedEvent.class);
verify(clusterEventBus, times(1)).post(eventCaptor.capture());
final DashboardDeletedEvent dashboardDeletedEvent = eventCaptor.getValue();
assertThat(dashboardDeletedEvent.dashboardId()).isEqualTo("foobar");
}
use of org.graylog2.dashboards.events.DashboardDeletedEvent in project graylog2-server by Graylog2.
the class ViewsResource method triggerDeletedEvent.
private void triggerDeletedEvent(ViewDTO dto) {
if (dto != null && dto.type() != null && dto.type().equals(ViewDTO.Type.DASHBOARD)) {
final DashboardDeletedEvent dashboardDeletedEvent = DashboardDeletedEvent.create(dto.id());
// noinspection UnstableApiUsage
clusterEventBus.post(dashboardDeletedEvent);
}
}
Aggregations