Skip to content

Commit

Permalink
🚧 #80
Browse files Browse the repository at this point in the history
  • Loading branch information
rucko24 committed Nov 17, 2024
1 parent 31b3211 commit 0ce7d23
Show file tree
Hide file tree
Showing 15 changed files with 182 additions and 237 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/main/java/com/esp/espflow/util/EspFlowConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public class EspFlowConstants {
public static final String DIALOG_DISABLED = "Hide";
public static final String INFORMATION = "Information";
public static final String WARNING = "Warning";

public static final String FRONTEND_ICON = "icons/icon.png";
public static final String FRONTEND_IMAGES_ESPDEVICES = "frontend/images/espdevices/";
public static final String FRONTEND_IMAGES_LOGO = "frontend/images/logo/";
public static final String FRONTEND_IMAGES_AVATAR_USER = "frontend/images/avatar-user/";
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/com/esp/espflow/views/MainLayout.java
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,6 @@ private Footer createFooter() {

MenuBar userMenu = new MenuBar();
userMenu.setThemeName("tertiary-inline contrast");
//userMenu.setThemeName("tertiary small contrast");

MenuItem userName = userMenu.addItem("");

userName.getStyle().setCursor(CURSOR_POINTER);
Expand Down
18 changes: 6 additions & 12 deletions src/main/java/com/esp/espflow/views/flashesp/FlashEspView.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import com.esp.espflow.util.console.OutPutConsole;
import com.esp.espflow.util.svgfactory.SvgFactory;
import com.esp.espflow.views.MainLayout;
import com.esp.espflow.views.readflash.WizardFlashEspView;
import com.infraleap.animatecss.Animated;
import com.infraleap.animatecss.Animated.Animation;
import com.vaadin.flow.component.AttachEvent;
Expand Down Expand Up @@ -102,9 +103,9 @@ public class FlashEspView extends Div implements ResponsiveHeaderDiv {
*/
private final Sinks.Many<EspMessageListItemEvent> publishMessageListItem;
/*
* Show initial information
* Show initial wizard information
*/
private final InitialInformationFlashEspViewDialog initialInformationFlashEspViewDialog;
private final WizardFlashEspView wizardFlashEspView;

@PostConstruct
public void init() {
Expand Down Expand Up @@ -386,25 +387,18 @@ protected void onAttach(AttachEvent attachEvent) {
super.onAttach(attachEvent);
final UI ui = attachEvent.getUI();
this.outputConsole(ui);
//super.add(initialInformationFlashEspViewDialog);
//super.add(settingsDialogView);
}

super.add(this.wizardFlashEspView);

getUI().ifPresent(ui -> {
ui.getPage().fetchCurrentURL(url -> {
if (Objects.nonNull(url)) {
String ref = url.getRef();
if (Objects.isNull(ref)) {
//this.initialInformationFlashEspViewDialog.open();
//this.settingsDialogViewCopy.open();
this.wizardFlashEspView.open();
}
if (url.toString().contains("setting")) {
//Abrir los settings aqui
//final SettingsDialogView settingsDialogView = new SettingsDialogView();
//super.add(settingsDialogView);
//settingsDialogView.open();

}
}
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,7 @@
/**
* @author rub`n
*/
@PageTitle("Step 5 - Wizard")
@Log4j2
@UIScope
@SpringComponent
@RolesAllowed("ADMIN")
public class InitialInformationFlashEspViewDialog extends Div {

Expand All @@ -41,21 +38,14 @@ public class InitialInformationFlashEspViewDialog extends Div {
private final H3 someFeatures = new H3("Some of the features:");

public InitialInformationFlashEspViewDialog() {
//super.setModal(true);

content.addClassNames(LumoUtility.Display.FLEX, LumoUtility.FlexDirection.COLUMN);
content.setWidth("500px");

var paragraphOverView = paragraphOverView();
var listItemsWithFeatures = createListItemsWithFeatures();

content.add(overView, paragraphOverView, someFeatures, listItemsWithFeatures);
super.add(content);

//final Button buttonOk = new Button(OK, (event -> super.close()));
//buttonOk.addThemeVariants(ButtonVariant.LUMO_PRIMARY);

//super.getFooter().add(buttonOk);
}

private Paragraph paragraphOverView() {
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/com/esp/espflow/views/login/LoginView.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
import com.vaadin.flow.router.PageTitle;
import com.vaadin.flow.router.Route;

import static com.esp.espflow.util.EspFlowConstants.FRONTEND_ICON;

@PageTitle("Login")
@Route(value = "login")
@CssImport(value = "./login-view-background.css", themeFor = "vaadin-login-overlay-wrapper")
Expand All @@ -23,7 +25,7 @@ public class LoginView extends LoginOverlay implements BeforeEnterObserver {
public LoginView(AuthenticatedUser authenticatedUser) {
this.authenticatedUser = authenticatedUser;
setAction("login");
var image = new Image("icons/icon.png", "icon");
var image = new Image(FRONTEND_ICON, "icon");
image.setWidth("100px");
image.setHeight("100px");
setTitle(new Span(image));
Expand Down
71 changes: 3 additions & 68 deletions src/main/java/com/esp/espflow/views/readflash/ReadFlashView.java
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ public class ReadFlashView extends Div implements ResponsiveHeaderDiv, BeforeEnt
* Show initial information
*/
private final InitialInformationReadFlashViewDialog initialInformationReadFlashViewDialog;
private final WizardFlashEspView wizardFlashEspView;

@PostConstruct
public void init() {
Expand Down Expand Up @@ -695,77 +696,11 @@ protected void onAttach(AttachEvent attachEvent) {
ui.access(() -> this.buttonRefreshDevices.setEnabled(value));
} catch (UIDetachedException ex) {}
});
super.add(this.initialInformationReadFlashViewDialog);


// RadioButtonGroup<String> mode = new RadioButtonGroup<>("Header theme");
// mode.setItems("Light", "Dark");
// mode.addValueChangeListener(e -> getChildren().forEach(component -> {
// if (component instanceof Sidebar) {
// if (e.getValue().equals("Dark")) {
// ((Sidebar) component).addHeaderThemeName(Lumo.DARK);
// } else {
// ((Sidebar) component).removeHeaderThemeName(Lumo.DARK);
// }
// }
// }));
//addComponentAsFirst(mode);

// Sidebar sidebar = new Sidebar(
// "New event",
// "Fill in the blibber-blabber below to create a sensational event that will leave everyone flibber-gasted!",
// createForm()
// );
// add(sidebar);

// Button button = new Button("Open sidebar", e -> {
// sidebar.open();
// Animated.animate(sidebar, Animation.FADE_IN);
// });
//addComponentAtIndex(1, button);
// sidebar.getCancelButton().addClickListener(event -> {
// sidebar.close();
// Animated.animate(sidebar, Animation.FADE_OUT);
// });
super.add(this.wizardFlashEspView);

}

getUI().ifPresent(ui -> {
ui.getPage().fetchCurrentURL(url -> {
if (Objects.nonNull(url)) {
String ref = url.getRef();
if (Objects.isNull(ref)) {
this.initialInformationReadFlashViewDialog.open();
}
if (url.toString().contains("setting")) {
//this.initialInformationFlashEspViewDialog.open();
//Abrir los settings aqui
//final SettingsDialogView settingsDialogView = new SettingsDialogView();
//super.add(settingsDialogView);
//settingsDialogView.open();
}
}
});
});

}

private Component[] createForm() {
TextField title = new TextField("Title");

TextArea description = new TextArea("Description");

MultiSelectComboBox<String> guests = new MultiSelectComboBox<>("Guests");
guests.setItems(
"JOHN_SMITH", "EMILY_JOHNSON", "MICHAEL_DAVIS", "SOPHIA_BROWN",
"DANIEL_WILSON", "OLIVIA_MARTINEZ", "DAVID_THOMPSON"
);

RadioButtonGroup<String> visibility = new RadioButtonGroup<>("Visibility");
visibility.setItems("Private", "Public");
visibility.setValue("Private");
}

return new Component[]{title, description, guests, visibility};
}

}
Loading

0 comments on commit 0ce7d23

Please sign in to comment.