use of org.ovirt.engine.core.common.businessentities.AuditLog in project ovirt-engine by oVirt.
the class HeaderPresenterWidget method onBind.
@SuppressWarnings("unchecked")
@Override
protected void onBind() {
super.onBind();
registerHandler(getView().getLogoutLink().addClickHandler(event -> user.logout()));
registerHandler(getView().getGuideLink().addClickHandler(event -> WebUtils.openUrlInNewWindow(windowName, guideUrl)));
registerHandler(getView().getOptionsLink().addClickHandler(event -> {
OptionsModel model = optionsProvider.getModel();
model.executeCommand(model.getEditCommand());
}));
registerHandler(getView().getAboutLink().addClickHandler(event -> RevealRootPopupContentEvent.fire(HeaderPresenterWidget.this, aboutPopupProvider.get())));
registerHandler(getView().getTasksWidget().addClickHandler(event -> toggleOverlayPresenter(tasksPresenter)));
registerHandler(getView().getBookmarkLink().addClickHandler(event -> toggleOverlayPresenter(bookmarksPresenter)));
registerHandler(getView().getTagsLink().addClickHandler(event -> toggleOverlayPresenter(tagsPresenter)));
getView().getAlertActionWidget().addAction(constants.dismissAlert(), this.alertModelProvider.getModel().getDismissCommand(), (command, log) -> {
AlertListModel model = alertModelProvider.getModel();
if (log != null) {
model.setSelectedItem(log);
model.executeCommand(command);
}
});
getView().getAlertActionWidget().addClearAllAction(constants.clearAllDismissedAlerts(), this.alertModelProvider.getModel().getClearAllCommand(), (command, log) -> alertModelProvider.getModel().executeCommand(command));
getView().getAlertActionWidget().addRestoreAllAction(constants.displayAllDismissedAlerts(), this.alertModelProvider.getModel().getDisplayAllCommand(), (command, log) -> alertModelProvider.getModel().executeCommand(command));
getView().getEventActionWidget().addAction(constants.dismissEvent(), this.eventModelProvider.getModel().getDismissCommand(), (command, log) -> {
EventListModel<?> model = eventModelProvider.getModel();
if (log != null) {
model.setSelectedItem(log);
model.executeCommand(command);
}
});
getView().getEventActionWidget().addClearAllAction(constants.clearAllDismissedEvents(), this.eventModelProvider.getModel().getClearAllCommand(), (command, log) -> eventModelProvider.getModel().executeCommand(command));
getView().getEventActionWidget().addRestoreAllAction(constants.displayAllDismissedEvents(), this.eventModelProvider.getModel().getDisplayAllCommand(), (command, log) -> eventModelProvider.getModel().executeCommand(command));
taskModelProvider.getModel().getItemsChangedEvent().addListener(new IEventListener<EventArgs>() {
@Override
public void eventRaised(Event<? extends EventArgs> ev, Object sender, EventArgs args) {
Collection<Job> jobs = taskModelProvider.getModel().getItems();
long count = jobs.stream().filter(job -> JobExecutionStatus.STARTED.equals(job.getStatus())).count();
// I know I will never have more than 100 items, so I can cast to int.
getView().setRunningTaskCount((int) count);
}
});
alertModelProvider.getModel().getItemsChangedEvent().addListener(new IEventListener<EventArgs>() {
@Override
public void eventRaised(Event<? extends EventArgs> ev, Object sender, EventArgs args) {
Collection<AuditLog> alerts = alertModelProvider.getModel().getItems();
long count = alerts.stream().filter(alert -> AuditLogSeverity.ALERT.equals(alert.getSeverity())).count();
// I know I will never have more than 100 items, so I can cast to int.
getView().setAlertCount((int) count);
}
});
}
use of org.ovirt.engine.core.common.businessentities.AuditLog in project ovirt-engine by oVirt.
the class EventPopupView method edit.
@Override
public void edit(final EventModel eventModel) {
driver.edit(eventModel);
AuditLog event = eventModel.getEvent();
eventIdLabel.asValueBox().setValue(String.valueOf(event.getLogTypeValue()));
eventTimeLabel.asValueBox().setValue(new FullDateTimeRenderer().render(event.getLogTime()));
eventMessageTextArea.asValueBox().setValue(event.getMessage());
}
use of org.ovirt.engine.core.common.businessentities.AuditLog in project ovirt-engine by oVirt.
the class RemoveAuditLogByIdCommandTest method getEventWithExternalOrigin.
private AuditLog getEventWithExternalOrigin() {
AuditLog auditLog = new AuditLog();
auditLog.setAuditLogId(EVENT_ID_3);
auditLog.setOrigin(EXTERNAL_ORIGIN);
return auditLog;
}
use of org.ovirt.engine.core.common.businessentities.AuditLog in project ovirt-engine by oVirt.
the class GetAllAuditLogsByVMTemplateIdQueryTest method testExecuteQueryCommand.
@Test
public void testExecuteQueryCommand() {
// Mock the Query Parameters
Guid vmTemplateId = Guid.newGuid();
when(getQueryParameters().getId()).thenReturn(vmTemplateId);
// Set up the expected result
AuditLog expectedResult = new AuditLog();
expectedResult.setVmTemplateId(vmTemplateId);
// Mock the Daos
when(auditLogDaoMock.getAllByVMTemplateId(vmTemplateId, getUser().getId(), getQueryParameters().isFiltered())).thenReturn(Collections.singletonList(expectedResult));
getQuery().executeQueryCommand();
@SuppressWarnings("unchecked") List<AuditLog> result = getQuery().getQueryReturnValue().getReturnValue();
assertEquals("Wrong number of audit logs in result", 1, result.size());
assertEquals("Wrong audit log in result", expectedResult, result.get(0));
}
use of org.ovirt.engine.core.common.businessentities.AuditLog in project ovirt-engine by oVirt.
the class EventListModel method details.
private void details() {
AuditLog event = getSelectedItem();
if (getWindow() != null || event == null) {
return;
}
EventModel model = new EventModel();
model.setEvent(event);
model.setTitle(ConstantsManager.getInstance().getConstants().eventDetailsTitle());
model.setHelpTag(HelpTag.event_details);
// $NON-NLS-1$
model.setHashName("event_details");
setWindow(model);
// $NON-NLS-1$
UICommand command = new UICommand("Cancel", this);
command.setTitle(ConstantsManager.getInstance().getConstants().close());
command.setIsCancel(true);
model.getCommands().add(command);
}
Aggregations