Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
simasch committed Oct 12, 2022
2 parents 6f6e53b + 9ce708d commit 5ddce38
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 29 deletions.
42 changes: 16 additions & 26 deletions frontend/index.html
Original file line number Diff line number Diff line change
@@ -1,33 +1,23 @@
<!DOCTYPE html>
<!--
This file is auto-generated by Vaadin.
-->

<html lang="en">
<head>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<style>
body, #outlet {
height: 100vh;
width: 100%;
margin: 0;
}
</style>
<!-- index.ts is included here automatically (either by the dev server or during the build) -->
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style>
body, #outlet {
height: 100vh;
width: 100%;
margin: 0;
}
</style>
<!-- index.ts is included here automatically (either by the dev server or during the build) -->
</head>
<body>
<!-- This outlet div is where the views are rendered -->
<div id="outlet"></div>

<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-PH4RL4J6YT"></script>
<script>
window.dataLayer = window.dataLayer || [];

function gtag() {
dataLayer.push(arguments);
}

gtag('js', new Date());

gtag('config', 'G-PH4RL4J6YT');
</script>
<!-- This outlet div is where the views are rendered -->
<div id="outlet"></div>
</body>
</html>
7 changes: 6 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<groupId>ch.jtaf</groupId>
<artifactId>jtaf4</artifactId>
<version>4.4.1</version>
<version>4.4.2</version>

<name>JTAF 4</name>
<description>JTAF - Track And Field</description>
Expand Down Expand Up @@ -136,6 +136,11 @@
<artifactId>openpdf</artifactId>
<version>${openpdf.version}</version>
</dependency>
<dependency>
<groupId>org.vaadin.addons</groupId>
<artifactId>googleanalyticstracker</artifactId>
<version>4.0.2</version>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
Expand Down
12 changes: 11 additions & 1 deletion src/main/java/ch/jtaf/ui/layout/MainLayout.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,22 @@
import com.vaadin.flow.server.PWA;
import com.vaadin.flow.theme.Theme;
import org.springframework.beans.factory.annotation.Value;
import org.vaadin.googleanalytics.tracking.EnableGoogleAnalytics;
import org.vaadin.googleanalytics.tracking.TrackerConfiguration;
import org.vaadin.googleanalytics.tracking.TrackerConfigurator;

import javax.annotation.PostConstruct;
import java.io.Serial;
import java.util.ArrayList;
import java.util.List;

@EnableGoogleAnalytics(value = "336871986")
@Theme("jtaf")
@PWA(name = "JTAF 4", shortName = "JTAF 4", description = "JTAF - Track and Field")
@StyleSheet("https://fonts.googleapis.com/css2?family=Poppins")
@NpmPackage(value = "lumo-css-framework", version = "^4.0.10")
@NpmPackage(value = "line-awesome", version = "1.3.0")
public class MainLayout extends AppLayout implements BeforeEnterObserver, AppShellConfigurator {
public class MainLayout extends AppLayout implements BeforeEnterObserver, AppShellConfigurator, TrackerConfigurator {

@Serial
private static final long serialVersionUID = 1L;
Expand Down Expand Up @@ -243,6 +247,12 @@ private void setVisibilityOfLinks(boolean visible) {
athletesLink.setVisible(visible);
}

@Override
public void configureTracker(TrackerConfiguration configuration) {
configuration.setCreateField("allowAnchor", Boolean.FALSE);
configuration.setInitialValue("transport", "beacon");
}

public record MenuItemInfo(String text, String iconClass, Class<? extends Component> view) {
}
}
6 changes: 5 additions & 1 deletion src/test/java/ch/jtaf/ui/view/LoginViewTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@ class LoginViewTest extends KaribuTest {
void login_with_unknown_user() {
UI.getCurrent().navigate(LoginView.class);

_login(_get(LoginOverlay.class), "not.existing@user.com", "pass");
try {
_login(_get(LoginOverlay.class), "not.existing@user.com", "pass");
} catch (IllegalStateException e) {
// From GoogleAnalyticsTracker. Ignore
}

assertThat(_get(LoginOverlay.class).getElement().getOuterHTML()).isEqualTo("<vaadin-login-overlay></vaadin-login-overlay>");
}
Expand Down

0 comments on commit 5ddce38

Please sign in to comment.