Skip to content

Commit

Permalink
🚧 #85 #70 test
Browse files Browse the repository at this point in the history
  • Loading branch information
rucko24 committed Dec 7, 2024
1 parent 64506cd commit d0e7f99
Show file tree
Hide file tree
Showing 15 changed files with 573 additions and 100 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ public String toString() {
return "{" +
"id=" + id +
", name='" + name + '\'' +
", isBundled=" + isBundled +
", absolutePathEsptool='" + absolutePathEsptool + '\'' +
", isBundled=" + isBundled +
", esptoolVersion='" + esptoolVersion + '\'' +
", isSelected=" + isSelected +
", sha256='" + sha256 + '\'' +
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.esp.espflow.service.respository.impl;

import com.esp.espflow.entity.EsptoolExecutableEntity;
import com.esp.espflow.entity.dto.EsptoolExecutableDto;
import com.esp.espflow.mappers.EsptoolExecutableMapper;
import com.esp.espflow.service.respository.EsptoolExecutableRepository;
Expand Down Expand Up @@ -32,11 +33,12 @@ public EsptoolExecutableDto save(EsptoolExecutableDto esptoolExecutableDto) {
var mappedEntity = EsptoolExecutableMapper.INSTANCE.dtoToEntity(esptoolExecutableDto);
this.esptoolExecutableRepository.findByEsptoolVersionWithBundle(mappedEntity.getEsptoolVersion(), mappedEntity.isBundled())
.ifPresentOrElse(entityIfPresent -> {
var entityToUpdate = EsptoolExecutableMapper.INSTANCE.fromEntityPresent(entityIfPresent.getId(), mappedEntity);
log.info("Entity updated {}", this.esptoolExecutableRepository.save(entityToUpdate));
final EsptoolExecutableEntity entityToUpdate = EsptoolExecutableMapper.INSTANCE.fromEntityPresent(entityIfPresent.getId(), mappedEntity);
final EsptoolExecutableEntity updatedEntity = this.esptoolExecutableRepository.save(entityToUpdate);
log.info("Entity updated {}", updatedEntity);
}, () -> {
this.esptoolExecutableRepository.save(mappedEntity);
log.info("Entity saved {}", mappedEntity);
final EsptoolExecutableEntity entitySaved = this.esptoolExecutableRepository.save(mappedEntity);
log.info("Entity saved {}", entitySaved);
});
return EsptoolExecutableMapper.INSTANCE.entityToDto(mappedEntity);
}
Expand Down
6 changes: 2 additions & 4 deletions src/main/java/com/esp/espflow/util/console/OutPutConsole.java
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,7 @@ protected void onDetach(DetachEvent detachEvent) {
@Override
protected void onAttach(AttachEvent attachEvent) {
super.onAttach(attachEvent);
//if (attachEvent.isInitialAttach()) {
this.getConsole();
this.xterm.getXTerm().fit();
//}
this.getConsole();
this.xterm.getXTerm().fit();
}
}
30 changes: 7 additions & 23 deletions src/main/java/com/esp/espflow/views/flashesp/FlashEspView.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@
import com.vaadin.flow.component.radiobutton.RadioButtonGroup;
import com.vaadin.flow.component.splitlayout.SplitLayout;
import com.vaadin.flow.component.splitlayout.SplitLayout.Orientation;
import com.vaadin.flow.router.AfterNavigationEvent;
import com.vaadin.flow.router.AfterNavigationObserver;
import com.vaadin.flow.router.PageTitle;
import com.vaadin.flow.router.Route;
import com.vaadin.flow.router.RouteAlias;
Expand All @@ -37,8 +35,6 @@
import com.vaadin.flow.theme.lumo.LumoUtility.Display;
import com.vaadin.flow.theme.lumo.LumoUtility.FlexDirection;
import com.vaadin.flow.theme.lumo.LumoUtility.JustifyContent;
import com.vaadin.flow.theme.lumo.LumoUtility.Margin.Left;
import com.vaadin.flow.theme.lumo.LumoUtility.Margin.Right;
import com.vaadin.flow.theme.lumo.LumoUtility.Overflow;
import jakarta.annotation.PostConstruct;
import jakarta.annotation.security.RolesAllowed;
Expand Down Expand Up @@ -80,7 +76,7 @@
@RolesAllowed("ADMIN")
@RequiredArgsConstructor
//@PreserveOnRefresh
public class FlashEspView extends Div implements AfterNavigationObserver, ResponsiveHeaderDiv {
public class FlashEspView extends Div implements ResponsiveHeaderDiv {

private final DivFlashUploader divFlashUploader;
private final DivHeaderPorts divHeaderPorts;
Expand All @@ -99,7 +95,6 @@ public class FlashEspView extends Div implements AfterNavigationObserver, Respon
/**
* OutputConsole
*/
private Div divColumnItems = new Div();
private final OutPutConsole outPutConsole = new OutPutConsole();

private String[] commands;
Expand Down Expand Up @@ -161,12 +156,12 @@ private SplitLayout getSplitLayout() {
divRowToSecondary.addClassNames(Display.FLEX, FlexDirection.ROW);
divRowToSecondary.getStyle().set(OVERFLOW_Y, HIDDEN);

// outPutConsole.getStyle().set("overflow-x", "hidden");
// outPutConsole.getDivTextArea().removeClassNames(Left.LARGE, Right.LARGE);
// outPutConsole.getButtonClear().addClassName(BOX_SHADOW_VAADIN_BUTTON);
// outPutConsole.getButtonDownScroll().addClassName(BOX_SHADOW_VAADIN_BUTTON);
// Div divColumnItems = new Div(outPutConsole.getButtonDownScroll(),
// outPutConsole.getButtonClear());
outPutConsole.getStyle().set("overflow-x", "hidden");
outPutConsole.getDivTextArea().removeClassNames(LumoUtility.Margin.Left.LARGE, LumoUtility.Margin.Minus.Right.LARGE);
outPutConsole.getButtonClear().addClassName(BOX_SHADOW_VAADIN_BUTTON);
outPutConsole.getButtonDownScroll().addClassName(BOX_SHADOW_VAADIN_BUTTON);
Div divColumnItems = new Div(outPutConsole.getButtonDownScroll(),
outPutConsole.getButtonClear());
divColumnItems.setId("divColumnItems");

divColumnItems.addClassNames(
Expand Down Expand Up @@ -426,15 +421,4 @@ protected void onAttach(AttachEvent attachEvent) {

}

@Override
public void afterNavigation(AfterNavigationEvent event) {
//Ignored listener invocation for terminal-initialized event from the client side for an inert fc-xterm element
if(outPutConsole.isAttached()) {
outPutConsole.getStyle().set("overflow-x", "hidden");
outPutConsole.getDivTextArea().removeClassNames(Left.LARGE, Right.LARGE);
outPutConsole.getButtonClear().addClassName(BOX_SHADOW_VAADIN_BUTTON);
outPutConsole.getButtonDownScroll().addClassName(BOX_SHADOW_VAADIN_BUTTON);
this.divColumnItems.add(outPutConsole.getButtonDownScroll(), outPutConsole.getButtonClear());
}
}
}
31 changes: 8 additions & 23 deletions src/main/java/com/esp/espflow/views/readflash/ReadFlashView.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@
import com.vaadin.flow.component.splitlayout.SplitLayout.Orientation;
import com.vaadin.flow.component.textfield.IntegerField;
import com.vaadin.flow.data.value.ValueChangeMode;
import com.vaadin.flow.router.AfterNavigationEvent;
import com.vaadin.flow.router.AfterNavigationObserver;
import com.vaadin.flow.router.BeforeEnterEvent;
import com.vaadin.flow.router.BeforeEnterObserver;
import com.vaadin.flow.router.PageTitle;
Expand Down Expand Up @@ -99,7 +97,7 @@
@Route(value = "read-flash", layout = MainLayout.class)
@RolesAllowed("ADMIN")
@RequiredArgsConstructor
public class ReadFlashView extends Div implements ResponsiveHeaderDiv, AfterNavigationObserver, BeforeEnterObserver {
public class ReadFlashView extends Div implements ResponsiveHeaderDiv, BeforeEnterObserver {

private final FlashDownloadButtonService flashDownloadButtonService;
private final EsptoolService esptoolService;
Expand All @@ -119,7 +117,6 @@ public class ReadFlashView extends Div implements ResponsiveHeaderDiv, AfterNavi
* Console output
*/
private final OutPutConsole outPutConsole = new OutPutConsole();
private final Div divColumnItems = new Div();
private final Span spanTotalDevices = new Span("Total devices:");
private final Span spanPortFailure = new Span(PORT_FAILURE);
private final Span spanTotalDevicesValue = new Span();
Expand Down Expand Up @@ -285,13 +282,13 @@ private Div divForConsoleOutput() {
divRowToSecondary.getStyle().set(OVERFLOW_Y, HIDDEN);
divRowToSecondary.getStyle().set("background", "linear-gradient(var(--lumo-shade-5pct), var(--lumo-shade-5pct))");

// outPutConsole.getStyle().set("overflow-x", "hidden");
// outPutConsole.getDivTextArea().removeClassNames(Left.LARGE, Right.LARGE);
// outPutConsole.getButtonClear().addClassName(BOX_SHADOW_VAADIN_BUTTON);
// outPutConsole.getButtonDownScroll().addClassName(BOX_SHADOW_VAADIN_BUTTON);
//
// Div divColumnItems = new Div(outPutConsole.getButtonDownScroll(),
// outPutConsole.getButtonClear());
outPutConsole.getStyle().set("overflow-x", "hidden");
outPutConsole.getDivTextArea().removeClassNames(Left.LARGE, Right.LARGE);
outPutConsole.getButtonClear().addClassName(BOX_SHADOW_VAADIN_BUTTON);
outPutConsole.getButtonDownScroll().addClassName(BOX_SHADOW_VAADIN_BUTTON);

Div divColumnItems = new Div(outPutConsole.getButtonDownScroll(),
outPutConsole.getButtonClear());
divColumnItems.setId("divColumnItems");

divColumnItems.addClassNames(
Expand Down Expand Up @@ -685,18 +682,6 @@ public void beforeEnter(BeforeEnterEvent event) {
});
}

@Override
public void afterNavigation(AfterNavigationEvent event) {
//Ignored listener invocation for terminal-initialized event from the client side for an inert fc-xterm element
if(outPutConsole.isAttached()) {
outPutConsole.getStyle().set("overflow-x", "hidden");
outPutConsole.getDivTextArea().removeClassNames(Left.LARGE, Right.LARGE);
outPutConsole.getButtonClear().addClassName(BOX_SHADOW_VAADIN_BUTTON);
outPutConsole.getButtonDownScroll().addClassName(BOX_SHADOW_VAADIN_BUTTON);
this.divColumnItems.add(outPutConsole.getButtonDownScroll(), outPutConsole.getButtonClear());
}
}

@Override
protected void onDetach(DetachEvent detachEvent) {
super.onDetach(detachEvent);
Expand Down
Loading

0 comments on commit d0e7f99

Please sign in to comment.