Skip to content

Commit

Permalink
Update web-bundler
Browse files Browse the repository at this point in the history
  • Loading branch information
ia3andy committed Mar 8, 2024
1 parent b9c8d1c commit 0c84137
Show file tree
Hide file tree
Showing 21 changed files with 151,798 additions and 86 deletions.
2 changes: 1 addition & 1 deletion .mvn/extensions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
<extension>
<groupId>io.mvnpm</groupId>
<artifactId>locker-maven-plugin</artifactId>
<version>0.0.4</version>
<version>0.0.6</version>
</extension>
</extensions>
33 changes: 8 additions & 25 deletions dashboard/.locker/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,15 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.acme</groupId>
<artifactId>one-two-three-quarkus-parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

<groupId>org.acme</groupId>
<artifactId>one-two-three-quarkus-dashboard-locker</artifactId>
<version>1.0.0-SNAPSHOT</version>

<packaging>pom</packaging>
<dependencyManagement>
<dependencies>
Expand Down Expand Up @@ -109,30 +114,8 @@
<dependency>
<groupId>org.mvnpm</groupId>
<artifactId>terser</artifactId>
<version>5.24.0</version>
<version>5.26.0</version>
</dependency>
</dependencies>
</dependencyManagement>
<properties>
<lock-integrity-org.mvnpm.at.jridgewell--gen-mapping>sha512:IVgrb2S7ZxhiDH+As5YJ+YTfDnt2MWK2krup8iN5PCQTAKHJ/zRGosZbf+kzVGuHjI+MrUNZHz8rKyyOhPVa6A==</lock-integrity-org.mvnpm.at.jridgewell--gen-mapping>
<lock-integrity-org.mvnpm.at.jridgewell--resolve-uri>sha512:CXqWgWflcuv9Y1qAhz7J8LoCkPZtOBjviVpPS377uYY5MIAgkIjdsO7Ib39hIbPURbwnAz6SxxSgU5lQ77hj8g==</lock-integrity-org.mvnpm.at.jridgewell--resolve-uri>
<lock-integrity-org.mvnpm.at.jridgewell--set-array>sha512:yhwyMj9XKdeLpi7bMF4mepx0eZOCwnVg2oIIvnA3q89ta207Sj03MQRWUfW7il+DD3Dyby4N4PQayXd+yCzaFg==</lock-integrity-org.mvnpm.at.jridgewell--set-array>
<lock-integrity-org.mvnpm.at.jridgewell--source-map>sha512:sVipPE2jyEjmqwq+Im0nFIdux3pJjC+sSr/yVdh02YQbacHbCwOUVolXHEYkKwQMVQblbQy6k8hWScOES1EjPA==</lock-integrity-org.mvnpm.at.jridgewell--source-map>
<lock-integrity-org.mvnpm.at.jridgewell--sourcemap-codec>sha512:+7rdF9GTXEkVcotbukbAtO+rdBJD6LawsJRg7bXFfD4CZj++SOSbpE4LXSaQvxbrbvcnwUjw9Di/OOzaMHNNtw==</lock-integrity-org.mvnpm.at.jridgewell--sourcemap-codec>
<lock-integrity-org.mvnpm.at.jridgewell--trace-mapping>sha512:iSpECls7/XpvnSDg18gJ1oj6wHd+Kc3ddY/RcmPEX7JHB52C9PJHHTau9c/kIaYe0U4yaM5rUXCfHbATtr+KqA==</lock-integrity-org.mvnpm.at.jridgewell--trace-mapping>
<lock-integrity-org.mvnpm.at.popperjs--core>sha512:rFiv+Od7w2vTc35ym/2AcD8m1wkS2hU2U5JNECYcVR4oARsye2+yNqnAgHcvWNg9cSMTcJvcCavjn2YOHwJmJA==</lock-integrity-org.mvnpm.at.popperjs--core>
<lock-integrity-org.mvnpm--acorn>sha512:bYu42uizH6/w5jHVJll0bgS2XiuiLri1W8TFQkhfqa+5f/yFoilNcx9bE+Zust3N8KswSQzE0nEJYAZ/Fbhyzw==</lock-integrity-org.mvnpm--acorn>
<lock-integrity-org.mvnpm--bootstrap-icons>sha512:wIDLokpaDLkhUr8CUMja5yYsX42sqlW3Ff3TAFcOYO27ypdZDILbSh+8TvZ6HEUJNwVC+1DW/hcRVkmCsZsfNg==</lock-integrity-org.mvnpm--bootstrap-icons>
<lock-integrity-org.mvnpm--bootstrap>sha512:Qqyp/mSeoudkMV0cGOOD2EJGw0amStvbyibY0x7djm/zj8n8vB51XPEUR4+Cj93XHdnmc6uDT3/UG6P/neyreg==</lock-integrity-org.mvnpm--bootstrap>
<lock-integrity-org.mvnpm--buffer-from>sha512:nFhCbFXiM39KGJc7tZaj8UyREdWAtEbd2lCirSrhQhN2kUoKMGKJRq24SJB8RkpmL+R8QTv7l3RkEar61n/p9Q==</lock-integrity-org.mvnpm--buffer-from>
<lock-integrity-org.mvnpm--commander>sha512:wJu/3D2Zzgx7xxdmX/U76UpqQsSxlPEn5uteH7k63kay9hKYLsldU2461FViUozZ5iUgXy7MK4GrlH0pcxSbLg==</lock-integrity-org.mvnpm--commander>
<lock-integrity-org.mvnpm--howler>sha512:cYUCiVfW0gQhMvmq7chDEncJgVQAHQBenSxQOE1+DFUuy0z74qSdR2mjWLGdCW6Wa6sIQkshmrmLjiZBEiO5uw==</lock-integrity-org.mvnpm--howler>
<lock-integrity-org.mvnpm--htmx.org>sha512:CpFM1S1OrHFMzIewGskcFhyRJ0i69I8qALJ2lsHpF1aRk3PEXdXwGAl2Y7rnnWJ+9ZEYl2DJkRijAElZv32vnw==</lock-integrity-org.mvnpm--htmx.org>
<lock-integrity-org.mvnpm--hyperscript.org>sha512:5Qfwf+huDun3GdSIcuf2nm6VCGdWEuSbk2wQhK4ehSbHD/nApamFTkoymOmOtAz9CvsoZOq3Eu6pcGU/IKrg2w==</lock-integrity-org.mvnpm--hyperscript.org>
<lock-integrity-org.mvnpm--idiomorph>sha512:v0APsHxA1fTWm22qTZ7PZppyolk6zN35ZoOAP7Kyzz4AFbtjnGPiV3zhrP93aw9HUVDoY/Rj0iMWJlnD2tS+9A==</lock-integrity-org.mvnpm--idiomorph>
<lock-integrity-org.mvnpm--markdown-it-deflist>sha512:rbBde+TwRN2xrswnr6cXTj0wN5IolEy7Hud478lN89vCPtgdX0Vp6yBVVbI/Ur0KGaR5aI4k2aat+EY6zen+AA==</lock-integrity-org.mvnpm--markdown-it-deflist>
<lock-integrity-org.mvnpm--source-map-support>sha512:Ew20rR0uDBfKq5Luay8BzmxgHweldZhYA8UwZNLTvqvo4llKNfTh515UE/RlPICHlwDHU2VInAnwsZRfMS7FPw==</lock-integrity-org.mvnpm--source-map-support>
<lock-integrity-org.mvnpm--source-map>sha512:gUlFuBzdDFC66e11cr47JvxpKgvLZCM7AIUKrKwLLZfdpayVPvJtrRUXNPWhClTVuz2AccekVCJSHp2HcRG5FA==</lock-integrity-org.mvnpm--source-map>
<lock-integrity-org.mvnpm--terser>sha512:EMXvn9a331H+1q25gBspW8deNXW519ynMino96Xwv8YScIqscT+IggMesjmIiNWcdyM2DdPYKoS4QhGLcTSWLw==</lock-integrity-org.mvnpm--terser>
</properties>
</project>
7 changes: 7 additions & 0 deletions dashboard/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -65,36 +65,43 @@
<groupId>org.mvnpm</groupId>
<artifactId>htmx.org</artifactId>
<version>1.9.9</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.mvnpm</groupId>
<artifactId>idiomorph</artifactId>
<version>0.0.9</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.mvnpm</groupId>
<artifactId>hyperscript.org</artifactId>
<version>0.9.8</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.mvnpm</groupId>
<artifactId>bootstrap</artifactId>
<version>5.2.3</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.mvnpm</groupId>
<artifactId>bootstrap-icons</artifactId>
<version>1.11.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.mvnpm.at.popperjs</groupId>
<artifactId>core</artifactId>
<version>2.11.8</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.mvnpm</groupId>
<artifactId>howler</artifactId>
<version>2.2.3</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
Expand Down
17 changes: 13 additions & 4 deletions dashboard/src/main/java/service/GameService.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import model.GameEvent;
import model.GameEvent.GameEventType;
import org.eclipse.microprofile.config.inject.ConfigProperty;
import utils.NamesUtil;

import java.nio.ByteBuffer;
import java.time.Duration;
Expand All @@ -21,12 +22,13 @@
import java.util.Random;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.atomic.AtomicReference;

import static java.util.Comparator.comparing;
import static model.GameEvent.GameEventType.*;
import static qute.RockingDukeExtensions.randomName;
import static utils.RockingDukeExtensions.randomName;
import static service.GameService.WatchStatus.OFF;
import static service.GameService.WatchStatus.ROCKING;
import static service.GameService.WatchStatus.WARNING;
Expand All @@ -42,6 +44,8 @@ public class GameService {
.<GameEvent>emitter(this.eventsEmitter::set).broadcast().toAllSubscribers();

// State

private final AtomicInteger runnersCount = new AtomicInteger();
private final Map<String, RunnerState> runners = new ConcurrentHashMap<>();
private final AtomicReference<Instant> started = new AtomicReference<>();
private final AtomicReference<List<Runner>> rank = new AtomicReference<>();
Expand Down Expand Up @@ -198,7 +202,8 @@ public Runner newRunner(String prevId) {
runners.put(runner.id(), runner.initialState());
}
} else {
runner = new Runner(runners.size() + 1);

runner = new Runner(runnersCount.incrementAndGet());
runners.put(runner.id(), runner.initialState());
}

Expand Down Expand Up @@ -324,15 +329,15 @@ public String getRockingDuke() {

public record Runner(String id, String name) {
public Runner(String id, int num) {
this(id, "#" + num);
this(id, NamesUtil.getNameById(num));
}

public Runner(String id) {
this(id, extractIndex(id));
}

public Runner(int num) {
this(shortId(num), num);
this(shortId(num), NamesUtil.getNameById(num));
}

public RunnerState newState(int distance, long duration, RunnerState.Status status) {
Expand All @@ -353,6 +358,10 @@ public int indexPercentage(int index, int max) {
return (int) Math.floor((index + 0.5) * 100 / max);
}

public String boxSize(int max) {
return max > 40 ? "small" : max > 12 ? "medium" : "large";
}

public record RunnerState(Runner runner, int distance, long duration, Status status) {
public int distancePercentage(int max) {
return distance * 100 / max;
Expand Down
43 changes: 43 additions & 0 deletions dashboard/src/main/java/utils/NamesUtil.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package utils;

import io.quarkus.logging.Log;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public final class NamesUtil {

private static final int MAX_NAME_LENGTH = 4;
public static final List<String> NAMES;

static {
try(final InputStream nameInputStream = NamesUtil.class.getClassLoader().getResourceAsStream("names.txt")) {
if (nameInputStream == null) {
throw new IOException("names list not found");
}
try(BufferedReader reader = new BufferedReader(new InputStreamReader(nameInputStream))) {
final List<String> names = new ArrayList<>();
while(reader.ready()) {
names.add(reader.readLine());
}
NAMES = names.stream().filter(s -> s.length() <= MAX_NAME_LENGTH).toList();
Log.infof("List of names initialized with %d items", NAMES.size());
}

} catch (IOException e) {
throw new IllegalStateException("Error while loading name list", e);
}
}

public static String getNameById(int id) {
if (id >= NAMES.size()) {
throw new IllegalArgumentException("This name id is too big: " + id + "/" + NAMES.size());
}
return NAMES.get(id);
}

}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package qute;
package utils;

import io.quarkus.qute.TemplateExtension;

Expand Down
Loading

0 comments on commit 0c84137

Please sign in to comment.