Search in sources :

Example 1 with LoggerSearchRequest

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 + "");
}
Also used : Pos(javafx.geometry.Pos) Assert(com.canoo.dp.impl.platform.core.Assert) ZonedDateTime(java.time.ZonedDateTime) LocalDateTime(java.time.LocalDateTime) LogMessage(com.canoo.platform.logging.spi.LogMessage) Insets(javafx.geometry.Insets) ComboBox(javafx.scene.control.ComboBox) Level(org.slf4j.event.Level) LocalTime(java.time.LocalTime) FontAwesomeIconView(de.jensd.fx.glyphs.fontawesome.FontAwesomeIconView) DatePicker(javafx.scene.control.DatePicker) PopOver(org.controlsfx.control.PopOver) HBox(javafx.scene.layout.HBox) Label(javafx.scene.control.Label) Property(javafx.beans.property.Property) Set(java.util.Set) Spinner(javafx.scene.control.Spinner) ZoneId(java.time.ZoneId) SimpleObjectProperty(javafx.beans.property.SimpleObjectProperty) LocalDate(java.time.LocalDate) DateTimeFormatter(java.time.format.DateTimeFormatter) LoggerSearchRequest(com.canoo.platform.logger.model.LoggerSearchRequest) FontAwesomeIcon(de.jensd.fx.glyphs.fontawesome.FontAwesomeIcon) Optional(java.util.Optional) CustomTextField(org.controlsfx.control.textfield.CustomTextField) Collections(java.util.Collections) LocalTime(java.time.LocalTime) ZonedDateTime(java.time.ZonedDateTime) LocalDate(java.time.LocalDate) LoggerSearchRequest(com.canoo.platform.logger.model.LoggerSearchRequest)

Example 2 with LoggerSearchRequest

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);
}
Also used : ZonedDateTime(java.time.ZonedDateTime) Level(org.slf4j.event.Level) LoggerSearchRequest(com.canoo.platform.logger.model.LoggerSearchRequest)

Example 3 with LoggerSearchRequest

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));
}
Also used : LoggerSearchRequest(com.canoo.platform.logger.model.LoggerSearchRequest) RemotingAction(com.canoo.platform.remoting.server.RemotingAction)

Example 4 with LoggerSearchRequest

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);
}
Also used : Pos(javafx.geometry.Pos) Assert(com.canoo.dp.impl.platform.core.Assert) ZonedDateTime(java.time.ZonedDateTime) LocalDateTime(java.time.LocalDateTime) LogMessage(com.canoo.platform.logging.spi.LogMessage) Insets(javafx.geometry.Insets) ComboBox(javafx.scene.control.ComboBox) Level(org.slf4j.event.Level) LocalTime(java.time.LocalTime) FontAwesomeIconView(de.jensd.fx.glyphs.fontawesome.FontAwesomeIconView) DatePicker(javafx.scene.control.DatePicker) PopOver(org.controlsfx.control.PopOver) HBox(javafx.scene.layout.HBox) Label(javafx.scene.control.Label) Property(javafx.beans.property.Property) Set(java.util.Set) Spinner(javafx.scene.control.Spinner) ZoneId(java.time.ZoneId) SimpleObjectProperty(javafx.beans.property.SimpleObjectProperty) LocalDate(java.time.LocalDate) DateTimeFormatter(java.time.format.DateTimeFormatter) LoggerSearchRequest(com.canoo.platform.logger.model.LoggerSearchRequest) FontAwesomeIcon(de.jensd.fx.glyphs.fontawesome.FontAwesomeIcon) Optional(java.util.Optional) CustomTextField(org.controlsfx.control.textfield.CustomTextField) Collections(java.util.Collections) LocalTime(java.time.LocalTime) ZonedDateTime(java.time.ZonedDateTime) Level(org.slf4j.event.Level) LocalDate(java.time.LocalDate) LoggerSearchRequest(com.canoo.platform.logger.model.LoggerSearchRequest)

Example 5 with LoggerSearchRequest

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);
}
Also used : ZonedDateTime(java.time.ZonedDateTime) Level(org.slf4j.event.Level) LoggerSearchRequest(com.canoo.platform.logger.model.LoggerSearchRequest) HashSet(java.util.HashSet) RemotingAction(com.canoo.platform.remoting.server.RemotingAction)

Aggregations

LoggerSearchRequest (com.canoo.platform.logger.model.LoggerSearchRequest)5 ZonedDateTime (java.time.ZonedDateTime)4 Level (org.slf4j.event.Level)4 Assert (com.canoo.dp.impl.platform.core.Assert)2 LogMessage (com.canoo.platform.logging.spi.LogMessage)2 RemotingAction (com.canoo.platform.remoting.server.RemotingAction)2 FontAwesomeIcon (de.jensd.fx.glyphs.fontawesome.FontAwesomeIcon)2 FontAwesomeIconView (de.jensd.fx.glyphs.fontawesome.FontAwesomeIconView)2 LocalDate (java.time.LocalDate)2 LocalDateTime (java.time.LocalDateTime)2 LocalTime (java.time.LocalTime)2 ZoneId (java.time.ZoneId)2 DateTimeFormatter (java.time.format.DateTimeFormatter)2 Collections (java.util.Collections)2 Optional (java.util.Optional)2 Set (java.util.Set)2 Property (javafx.beans.property.Property)2 SimpleObjectProperty (javafx.beans.property.SimpleObjectProperty)2 Insets (javafx.geometry.Insets)2 Pos (javafx.geometry.Pos)2