Skip to content

Commit

Permalink
Refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
blafoo committed Oct 30, 2023
1 parent 997ad14 commit 89f2d2f
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 10 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ drivers/
# Error screenshots generated by TestBench for failed integration tests
error-screenshots/
webpack.generated.js
/.factorypath
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package de.blafoo.bkw;
package de.blafoo;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
Expand All @@ -17,10 +17,10 @@
@EnableFeignClients
@SpringBootApplication
@Theme(value = "bkw")
public class Application implements AppShellConfigurator {
public class BKWApplication implements AppShellConfigurator {

public static void main(String[] args) {
SpringApplication.run(Application.class, args);
SpringApplication.run(BKWApplication.class, args);
}

}
2 changes: 1 addition & 1 deletion src/main/java/de/blafoo/bkw/views/MainLayout.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ private SideNav createNavigation() {
SideNav nav = new SideNav();

nav.addItem(new SideNavItem("BKW (Feign)", BkwFeignView.class, LineAwesomeIcon.CHART_AREA_SOLID.create()));
nav.addItem(new SideNavItem("BKW (Growatt API)", BkwGrowattView.class, LineAwesomeIcon.CHART_AREA_SOLID.create()));
nav.addItem(new SideNavItem("BKW (Growatt)", BkwGrowattView.class, LineAwesomeIcon.CHART_AREA_SOLID.create()));
nav.addItem(new SideNavItem("About", AboutView.class, LineAwesomeIcon.FILE.create()));

return nav;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/de/blafoo/bkw/views/bkw/BkwFeignView.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
import com.vaadin.flow.router.PageTitle;
import com.vaadin.flow.router.Route;

import de.blafoo.bkw.growatt.feign.GrowattFeignClient;
import de.blafoo.bkw.growatt.feign.GrowattFeignCookieJar;
import de.blafoo.bkw.views.MainLayout;
import de.blafoo.growatt.entity.EnergyRequest;
import de.blafoo.growatt.entity.LoginRequest;
import de.blafoo.growatt.entity.TotalDataResponse;
import de.blafoo.growatt.feign.GrowattFeignClient;
import de.blafoo.growatt.feign.GrowattFeignCookieJar;

@PageTitle("BKW (Feign)")
@Route(value = "bkwfeign", layout = MainLayout.class)
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/de/blafoo/bkw/views/bkw/BkwView.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import java.util.List;
import java.util.stream.IntStream;

import org.apache.commons.lang3.StringUtils;
import org.springframework.lang.NonNull;

import com.vaadin.flow.component.Component;
Expand Down Expand Up @@ -51,6 +52,9 @@ abstract class BkwView extends Main {
private Chart monthChart;

public BkwView(String account, String password) {
if ( StringUtils.isBlank(account) || StringUtils.isBlank(password) )
throw new IllegalArgumentException("account and password must not be empty - add them to the application.properites");

this.account = account;
this.password = password;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package de.blafoo.bkw.growatt.feign;
package de.blafoo.growatt.feign;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package de.blafoo.bkw.growatt.feign;
package de.blafoo.growatt.feign;

import java.util.ArrayList;
import java.util.Collection;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package de.blafoo.bkw.growatt.feign;
package de.blafoo.growatt.feign;

import java.io.IOException;
import java.util.List;
Expand Down
5 changes: 4 additions & 1 deletion src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
server.port=${PORT:8080}
logging.level.org.atmosphere = warn
logging.level.de.blafoo = DEBUG
spring.mustache.check-template-location = false

# Launch the default browser when starting the application in development mode
vaadin.launch-browser=true
# To improve the performance during development.
# For more information https://vaadin.com/docs/flow/spring/tutorial-spring-configuration.html#special-configuration-parameters
vaadin.whitelisted-packages = com.vaadin,org.vaadin,dev.hilla,de.blafoo
vaadin.whitelisted-packages = com.vaadin,org.vaadin,dev.hilla,de.blafoo.bkw
spring.jpa.defer-datasource-initialization = true

growatt.account =
growatt.password =

spring.cloud.openfeign.client.config.growatt-client.loggerLevel = BASIC

0 comments on commit 89f2d2f

Please sign in to comment.