use of com.canoo.platform.logger.model.LoggerSearchRequest in project dolphin-platform by canoo.
the class LogFilterView method updateUI.
private void updateUI() {
final LoggerSearchRequest currentValue = loggerSearchRequest.getValue();
// TODO: List instead of item
levelComboBox.setValue(Optional.ofNullable(currentValue).map(v -> Level.WARN).orElse(Level.TRACE));
maxResultsSpinner.getEditor().setText(Optional.ofNullable(currentValue).map(v -> v.getMaxResults()).orElse(0) + "");
// TODO: Handle null value
final ZonedDateTime startDateTime = Optional.ofNullable(currentValue).map(v -> v.getStartDate()).orElse(ZonedDateTime.now());
final LocalDate startLocalDate = startDateTime.toLocalDate();
final LocalTime startLocalTime = startDateTime.toLocalTime();
startDatePicker.setValue(startLocalDate);
startHourSpinner.getEditor().setText(startLocalTime.getHour() + "");
startMinuteSpinner.getEditor().setText(startLocalTime.getMinute() + "");
startSecondSpinner.getEditor().setText(startLocalTime.getSecond() + "");
startMilliSpinner.getEditor().setText(startLocalTime.getNano() / 1_000_000 + "");
// TODO: Handle null value
final ZonedDateTime endDateTime = Optional.ofNullable(currentValue).map(v -> v.getEndDateTime()).orElse(ZonedDateTime.now());
final LocalDate endLocalDate = endDateTime.toLocalDate();
final LocalTime endLocalTime = endDateTime.toLocalTime();
endDatePicker.setValue(endLocalDate);
endHourSpinner.getEditor().setText(endLocalTime.getHour() + "");
endMinuteSpinner.getEditor().setText(endLocalTime.getMinute() + "");
endSecondSpinner.getEditor().setText(endLocalTime.getSecond() + "");
endMilliSpinner.getEditor().setText(endLocalTime.getNano() / 1_000_000 + "");
}
use of com.canoo.platform.logger.model.LoggerSearchRequest in project dolphin-platform by canoo.
the class LogFilterController method getCurrentRequest.
public LoggerSearchRequest getCurrentRequest() {
final ZonedDateTime start = model.getStartDate();
final ZonedDateTime end = model.getEndDateTime();
final Set<Level> levels = Collections.unmodifiableSet(new HashSet<>(model.getLevel()));
final int maxResults = Optional.ofNullable(model.maxResultsProperty().get()).orElse(-1);
return new LoggerSearchRequest(start, end, levels, maxResults);
}
use of com.canoo.platform.logger.model.LoggerSearchRequest in project dolphin-platform by canoo.
the class LogFilterController method search.
@RemotingAction
public void search() {
final LoggerSearchRequest request = getCurrentRequest();
searchListener.forEach(l -> l.accept(request));
}
use of com.canoo.platform.logger.model.LoggerSearchRequest in project dolphin-platform by canoo.
the class LogFilterView method updateItem.
private void updateItem() {
// TODO: Handle null value
final LocalDate startDate = Optional.ofNullable(startDatePicker.getValue()).orElse(LocalDate.now());
final LocalTime startTime = LocalTime.of(startHourSpinner.getValue(), startMinuteSpinner.getValue(), startSecondSpinner.getValue(), startMilliSpinner.getValue() * 1_000_000);
final ZonedDateTime startDateTime = ZonedDateTime.of(LocalDateTime.of(startDate, startTime), ZoneId.systemDefault());
final LocalDate endDate = Optional.ofNullable(endDatePicker.getValue()).orElse(LocalDate.now());
final LocalTime endTime = LocalTime.of(endHourSpinner.getValue(), endMinuteSpinner.getValue(), endSecondSpinner.getValue(), endMilliSpinner.getValue() * 1_000_000);
final ZonedDateTime endDateTime = ZonedDateTime.of(LocalDateTime.of(endDate, endTime), ZoneId.systemDefault());
final Set<Level> selectedLevels = Optional.ofNullable(levelComboBox.getSelectionModel().getSelectedItem()).map(l -> Collections.singleton(l)).orElse(Collections.emptySet());
final int maxResults = maxResultsSpinner.getValue();
final LoggerSearchRequest newRequest = new LoggerSearchRequest(startDateTime, endDateTime, selectedLevels, maxResults);
loggerSearchRequest.setValue(newRequest);
}
use of com.canoo.platform.logger.model.LoggerSearchRequest in project dolphin-platform by canoo.
the class LogListController method update.
@RemotingAction(UPDATE_ACTION)
public void update() {
final ZonedDateTime startDate = ZonedDateTime.now().minusDays(1);
final ZonedDateTime endDateTime = ZonedDateTime.now();
final Set<Level> level = new HashSet<>(Arrays.asList(Level.values()));
final int maxResults = 100;
final LoggerSearchRequest request = new LoggerSearchRequest(startDate, endDateTime, level, maxResults);
update(request);
}
Aggregations