summaryrefslogtreecommitdiff
path: root/opendc-web
diff options
context:
space:
mode:
Diffstat (limited to 'opendc-web')
-rw-r--r--opendc-web/opendc-web-proto/src/main/kotlin/org/opendc/web/proto/Room.kt2
-rw-r--r--opendc-web/opendc-web-proto/src/main/kotlin/org/opendc/web/proto/RoomTile.kt2
-rw-r--r--opendc-web/opendc-web-proto/src/main/kotlin/org/opendc/web/proto/Trace.kt2
-rw-r--r--opendc-web/opendc-web-proto/src/main/kotlin/org/opendc/web/proto/runner/Portfolio.kt2
-rw-r--r--opendc-web/opendc-web-proto/src/main/kotlin/org/opendc/web/proto/runner/Topology.kt2
-rw-r--r--opendc-web/opendc-web-proto/src/main/kotlin/org/opendc/web/proto/user/Portfolio.kt2
-rw-r--r--opendc-web/opendc-web-proto/src/main/kotlin/org/opendc/web/proto/user/ProjectRole.kt2
-rw-r--r--opendc-web/opendc-web-proto/src/main/kotlin/org/opendc/web/proto/user/Scenario.kt2
-rw-r--r--opendc-web/opendc-web-proto/src/main/kotlin/org/opendc/web/proto/user/Topology.kt4
-rw-r--r--opendc-web/opendc-web-runner-quarkus-deployment/src/main/java/org/opendc/web/runner/deployment/OpenDCRunnerProcessor.java39
-rw-r--r--opendc-web/opendc-web-runner-quarkus/src/main/java/org/opendc/web/runner/runtime/OpenDCRunnerRecorder.java23
-rw-r--r--opendc-web/opendc-web-runner-quarkus/src/main/java/org/opendc/web/runner/runtime/OpenDCRunnerRuntimeConfig.java1
-rw-r--r--opendc-web/opendc-web-runner/src/cli/kotlin/org/opendc/web/runner/Main.kt2
-rw-r--r--opendc-web/opendc-web-runner/src/main/kotlin/org/opendc/web/runner/OpenDCRunner.kt7
-rw-r--r--opendc-web/opendc-web-runner/src/main/kotlin/org/opendc/web/runner/internal/WebComputeMonitor.kt6
-rw-r--r--opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/model/Portfolio.kt2
-rw-r--r--opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/model/Project.kt2
-rw-r--r--opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/model/Scenario.kt2
-rw-r--r--opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/model/Trace.kt4
-rw-r--r--opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/rest/user/PortfolioResource.kt2
-rw-r--r--opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/rest/user/PortfolioScenarioResource.kt2
-rw-r--r--opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/service/ScenarioService.kt2
-rw-r--r--opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/util/hibernate/json/JsonBinarySqlTypeDescriptor.kt22
-rw-r--r--opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/util/hibernate/json/JsonBytesSqlTypeDescriptor.kt10
-rw-r--r--opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/util/hibernate/json/JsonStringSqlTypeDescriptor.kt22
-rw-r--r--opendc-web/opendc-web-server/src/test/kotlin/org/opendc/web/server/rest/runner/JobResourceTest.kt2
-rw-r--r--opendc-web/opendc-web-ui-quarkus-deployment/src/main/java/org/opendc/web/ui/deployment/AuthConfiguration.java1
-rw-r--r--opendc-web/opendc-web-ui-quarkus-deployment/src/main/java/org/opendc/web/ui/deployment/OpenDCUiConfig.java1
-rw-r--r--opendc-web/opendc-web-ui-quarkus-deployment/src/main/java/org/opendc/web/ui/deployment/OpenDCUiProcessor.java115
-rw-r--r--opendc-web/opendc-web-ui-quarkus-deployment/src/main/java/org/opendc/web/ui/deployment/OpenDCUiRoutingBuildItem.java3
-rw-r--r--opendc-web/opendc-web-ui-quarkus/src/main/java/org/opendc/web/ui/runtime/OpenDCUiRecorder.java43
-rw-r--r--opendc-web/opendc-web-ui/build.gradle.kts4
32 files changed, 184 insertions, 153 deletions
diff --git a/opendc-web/opendc-web-proto/src/main/kotlin/org/opendc/web/proto/Room.kt b/opendc-web/opendc-web-proto/src/main/kotlin/org/opendc/web/proto/Room.kt
index 5b305168..c5499150 100644
--- a/opendc-web/opendc-web-proto/src/main/kotlin/org/opendc/web/proto/Room.kt
+++ b/opendc-web/opendc-web-proto/src/main/kotlin/org/opendc/web/proto/Room.kt
@@ -29,5 +29,5 @@ public data class Room(
val id: String,
val name: String,
val tiles: Set<RoomTile>,
- val topologyId: String? = null,
+ val topologyId: String? = null
)
diff --git a/opendc-web/opendc-web-proto/src/main/kotlin/org/opendc/web/proto/RoomTile.kt b/opendc-web/opendc-web-proto/src/main/kotlin/org/opendc/web/proto/RoomTile.kt
index 666d66ee..53cb53cd 100644
--- a/opendc-web/opendc-web-proto/src/main/kotlin/org/opendc/web/proto/RoomTile.kt
+++ b/opendc-web/opendc-web-proto/src/main/kotlin/org/opendc/web/proto/RoomTile.kt
@@ -30,5 +30,5 @@ public data class RoomTile(
val positionX: Double,
val positionY: Double,
val rack: Rack? = null,
- val roomId: String? = null,
+ val roomId: String? = null
)
diff --git a/opendc-web/opendc-web-proto/src/main/kotlin/org/opendc/web/proto/Trace.kt b/opendc-web/opendc-web-proto/src/main/kotlin/org/opendc/web/proto/Trace.kt
index 2952a273..1c086cd8 100644
--- a/opendc-web/opendc-web-proto/src/main/kotlin/org/opendc/web/proto/Trace.kt
+++ b/opendc-web/opendc-web-proto/src/main/kotlin/org/opendc/web/proto/Trace.kt
@@ -32,5 +32,5 @@ package org.opendc.web.proto
public data class Trace(
val id: String,
val name: String,
- val type: String,
+ val type: String
)
diff --git a/opendc-web/opendc-web-proto/src/main/kotlin/org/opendc/web/proto/runner/Portfolio.kt b/opendc-web/opendc-web-proto/src/main/kotlin/org/opendc/web/proto/runner/Portfolio.kt
index 916d8cf0..5faad5b3 100644
--- a/opendc-web/opendc-web-proto/src/main/kotlin/org/opendc/web/proto/runner/Portfolio.kt
+++ b/opendc-web/opendc-web-proto/src/main/kotlin/org/opendc/web/proto/runner/Portfolio.kt
@@ -39,5 +39,5 @@ public data class Portfolio(
val id: Long,
val number: Int,
val name: String,
- val targets: Targets,
+ val targets: Targets
)
diff --git a/opendc-web/opendc-web-proto/src/main/kotlin/org/opendc/web/proto/runner/Topology.kt b/opendc-web/opendc-web-proto/src/main/kotlin/org/opendc/web/proto/runner/Topology.kt
index 4bffdee9..bc185aea 100644
--- a/opendc-web/opendc-web-proto/src/main/kotlin/org/opendc/web/proto/runner/Topology.kt
+++ b/opendc-web/opendc-web-proto/src/main/kotlin/org/opendc/web/proto/runner/Topology.kt
@@ -36,5 +36,5 @@ public data class Topology(
val name: String,
val rooms: List<Room>,
val createdAt: Instant,
- val updatedAt: Instant,
+ val updatedAt: Instant
)
diff --git a/opendc-web/opendc-web-proto/src/main/kotlin/org/opendc/web/proto/user/Portfolio.kt b/opendc-web/opendc-web-proto/src/main/kotlin/org/opendc/web/proto/user/Portfolio.kt
index 6f468e79..99d0f65e 100644
--- a/opendc-web/opendc-web-proto/src/main/kotlin/org/opendc/web/proto/user/Portfolio.kt
+++ b/opendc-web/opendc-web-proto/src/main/kotlin/org/opendc/web/proto/user/Portfolio.kt
@@ -67,6 +67,6 @@ public data class Portfolio(
val id: Long,
val number: Int,
val name: String,
- val targets: Targets,
+ val targets: Targets
)
}
diff --git a/opendc-web/opendc-web-proto/src/main/kotlin/org/opendc/web/proto/user/ProjectRole.kt b/opendc-web/opendc-web-proto/src/main/kotlin/org/opendc/web/proto/user/ProjectRole.kt
index 0f6de1fc..ea6a30ab 100644
--- a/opendc-web/opendc-web-proto/src/main/kotlin/org/opendc/web/proto/user/ProjectRole.kt
+++ b/opendc-web/opendc-web-proto/src/main/kotlin/org/opendc/web/proto/user/ProjectRole.kt
@@ -39,5 +39,5 @@ public enum class ProjectRole {
/**
* The user owns the project (so he can delete it).
*/
- OWNER,
+ OWNER
}
diff --git a/opendc-web/opendc-web-proto/src/main/kotlin/org/opendc/web/proto/user/Scenario.kt b/opendc-web/opendc-web-proto/src/main/kotlin/org/opendc/web/proto/user/Scenario.kt
index 552a4912..ed77ef08 100644
--- a/opendc-web/opendc-web-proto/src/main/kotlin/org/opendc/web/proto/user/Scenario.kt
+++ b/opendc-web/opendc-web-proto/src/main/kotlin/org/opendc/web/proto/user/Scenario.kt
@@ -58,7 +58,7 @@ public data class Scenario(
val workload: Workload.Spec,
val topology: Long,
val phenomena: OperationalPhenomena,
- val schedulerName: String,
+ val schedulerName: String
)
/**
diff --git a/opendc-web/opendc-web-proto/src/main/kotlin/org/opendc/web/proto/user/Topology.kt b/opendc-web/opendc-web-proto/src/main/kotlin/org/opendc/web/proto/user/Topology.kt
index a144a2e6..73748bb9 100644
--- a/opendc-web/opendc-web-proto/src/main/kotlin/org/opendc/web/proto/user/Topology.kt
+++ b/opendc-web/opendc-web-proto/src/main/kotlin/org/opendc/web/proto/user/Topology.kt
@@ -37,7 +37,7 @@ public data class Topology(
val name: String,
val rooms: List<Room>,
val createdAt: Instant,
- val updatedAt: Instant,
+ val updatedAt: Instant
) {
/**
* Create a new topology for a project.
@@ -70,6 +70,6 @@ public data class Topology(
val number: Int,
val name: String,
val createdAt: Instant,
- val updatedAt: Instant,
+ val updatedAt: Instant
)
}
diff --git a/opendc-web/opendc-web-runner-quarkus-deployment/src/main/java/org/opendc/web/runner/deployment/OpenDCRunnerProcessor.java b/opendc-web/opendc-web-runner-quarkus-deployment/src/main/java/org/opendc/web/runner/deployment/OpenDCRunnerProcessor.java
index 94921454..85a973e7 100644
--- a/opendc-web/opendc-web-runner-quarkus-deployment/src/main/java/org/opendc/web/runner/deployment/OpenDCRunnerProcessor.java
+++ b/opendc-web/opendc-web-runner-quarkus-deployment/src/main/java/org/opendc/web/runner/deployment/OpenDCRunnerProcessor.java
@@ -22,6 +22,8 @@
package org.opendc.web.runner.deployment;
+import static io.quarkus.deployment.annotations.ExecutionTime.RUNTIME_INIT;
+
import io.quarkus.arc.deployment.UnremovableBeanBuildItem;
import io.quarkus.deployment.annotations.BuildProducer;
import io.quarkus.deployment.annotations.BuildStep;
@@ -30,19 +32,15 @@ import io.quarkus.deployment.builditem.*;
import io.quarkus.deployment.builditem.nativeimage.ServiceProviderBuildItem;
import io.quarkus.deployment.util.ServiceUtil;
import io.quarkus.runtime.RuntimeValue;
+import java.io.IOException;
+import java.util.Set;
+import java.util.function.BooleanSupplier;
import org.opendc.trace.spi.TraceFormat;
import org.opendc.web.runner.JobManager;
import org.opendc.web.runner.OpenDCRunner;
import org.opendc.web.runner.runtime.OpenDCRunnerRecorder;
import org.opendc.web.runner.runtime.OpenDCRunnerRuntimeConfig;
-import java.io.IOException;
-import java.util.Collections;
-import java.util.Set;
-import java.util.function.BooleanSupplier;
-
-import static io.quarkus.deployment.annotations.ExecutionTime.RUNTIME_INIT;
-
/**
* Build processor for the OpenDC web runner Quarkus extension.
*/
@@ -65,12 +63,11 @@ public class OpenDCRunnerProcessor {
void registerTraceFormats(BuildProducer<ServiceProviderBuildItem> services) throws IOException {
String service = "META-INF/services/" + TraceFormat.class.getName();
- Set<String> implementations = ServiceUtil.classNamesNamedIn(Thread.currentThread().getContextClassLoader(),
- service);
+ Set<String> implementations =
+ ServiceUtil.classNamesNamedIn(Thread.currentThread().getContextClassLoader(), service);
services.produce(
- new ServiceProviderBuildItem(TraceFormat.class.getName(),
- implementations.toArray(new String[0])));
+ new ServiceProviderBuildItem(TraceFormat.class.getName(), implementations.toArray(new String[0])));
}
/**
@@ -86,9 +83,10 @@ public class OpenDCRunnerProcessor {
*/
@BuildStep(onlyIf = IsIncluded.class)
@Record(RUNTIME_INIT)
- ServiceStartBuildItem createRunnerService(OpenDCRunnerRecorder recorder,
- OpenDCRunnerRuntimeConfig config,
- BuildProducer<OpenDCRunnerBuildItem> runnerBuildItem) {
+ ServiceStartBuildItem createRunnerService(
+ OpenDCRunnerRecorder recorder,
+ OpenDCRunnerRuntimeConfig config,
+ BuildProducer<OpenDCRunnerBuildItem> runnerBuildItem) {
RuntimeValue<OpenDCRunner> runner = recorder.createRunner(config);
runnerBuildItem.produce(new OpenDCRunnerBuildItem(runner));
return new ServiceStartBuildItem("OpenDCRunnerService");
@@ -99,12 +97,13 @@ public class OpenDCRunnerProcessor {
*/
@BuildStep(onlyIf = IsIncluded.class)
@Record(RUNTIME_INIT)
- void startRunnerService(ApplicationStartBuildItem start,
- OpenDCRunnerBuildItem runnerBuildItem,
- OpenDCRunnerRecorder recorder,
- OpenDCRunnerRuntimeConfig config,
- ShutdownContextBuildItem shutdownContextBuildItem) {
- recorder.startRunner(runnerBuildItem.getRunner(), config,shutdownContextBuildItem);
+ void startRunnerService(
+ ApplicationStartBuildItem start,
+ OpenDCRunnerBuildItem runnerBuildItem,
+ OpenDCRunnerRecorder recorder,
+ OpenDCRunnerRuntimeConfig config,
+ ShutdownContextBuildItem shutdownContextBuildItem) {
+ recorder.startRunner(runnerBuildItem.getRunner(), config, shutdownContextBuildItem);
}
/**
diff --git a/opendc-web/opendc-web-runner-quarkus/src/main/java/org/opendc/web/runner/runtime/OpenDCRunnerRecorder.java b/opendc-web/opendc-web-runner-quarkus/src/main/java/org/opendc/web/runner/runtime/OpenDCRunnerRecorder.java
index f5c056ef..76f2368f 100644
--- a/opendc-web/opendc-web-runner-quarkus/src/main/java/org/opendc/web/runner/runtime/OpenDCRunnerRecorder.java
+++ b/opendc-web/opendc-web-runner-quarkus/src/main/java/org/opendc/web/runner/runtime/OpenDCRunnerRecorder.java
@@ -25,13 +25,12 @@ package org.opendc.web.runner.runtime;
import io.quarkus.runtime.RuntimeValue;
import io.quarkus.runtime.ShutdownContext;
import io.quarkus.runtime.annotations.Recorder;
+import java.io.File;
+import javax.enterprise.inject.spi.CDI;
import org.jboss.logging.Logger;
import org.opendc.web.runner.JobManager;
import org.opendc.web.runner.OpenDCRunner;
-import javax.enterprise.inject.spi.CDI;
-import java.io.File;
-
/**
* Helper class for starting the OpenDC web runner.
*/
@@ -52,13 +51,12 @@ public class OpenDCRunnerRecorder {
JobManager manager = CDI.current().select(JobManager.class).get();
OpenDCRunner runner = new OpenDCRunner(
- manager,
- new File(config.tracePath),
- parallelism,
- config.jobTimeout,
- config.pollInterval,
- config.heartbeatInterval
- );
+ manager,
+ new File(config.tracePath),
+ parallelism,
+ config.jobTimeout,
+ config.pollInterval,
+ config.heartbeatInterval);
return new RuntimeValue<>(runner);
}
@@ -66,9 +64,8 @@ public class OpenDCRunnerRecorder {
/**
* Helper method to start the OpenDC runner service.
*/
- public void startRunner(RuntimeValue<OpenDCRunner> runner,
- OpenDCRunnerRuntimeConfig config,
- ShutdownContext shutdownContext) {
+ public void startRunner(
+ RuntimeValue<OpenDCRunner> runner, OpenDCRunnerRuntimeConfig config, ShutdownContext shutdownContext) {
if (config.enable) {
LOGGER.info("Starting OpenDC Runner in background (polling every " + config.pollInterval + ")");
diff --git a/opendc-web/opendc-web-runner-quarkus/src/main/java/org/opendc/web/runner/runtime/OpenDCRunnerRuntimeConfig.java b/opendc-web/opendc-web-runner-quarkus/src/main/java/org/opendc/web/runner/runtime/OpenDCRunnerRuntimeConfig.java
index e9258f06..61c07e48 100644
--- a/opendc-web/opendc-web-runner-quarkus/src/main/java/org/opendc/web/runner/runtime/OpenDCRunnerRuntimeConfig.java
+++ b/opendc-web/opendc-web-runner-quarkus/src/main/java/org/opendc/web/runner/runtime/OpenDCRunnerRuntimeConfig.java
@@ -25,7 +25,6 @@ package org.opendc.web.runner.runtime;
import io.quarkus.runtime.annotations.ConfigItem;
import io.quarkus.runtime.annotations.ConfigPhase;
import io.quarkus.runtime.annotations.ConfigRoot;
-
import java.time.Duration;
/**
diff --git a/opendc-web/opendc-web-runner/src/cli/kotlin/org/opendc/web/runner/Main.kt b/opendc-web/opendc-web-runner/src/cli/kotlin/org/opendc/web/runner/Main.kt
index 56fecf78..299c4d09 100644
--- a/opendc-web/opendc-web-runner/src/cli/kotlin/org/opendc/web/runner/Main.kt
+++ b/opendc-web/opendc-web-runner/src/cli/kotlin/org/opendc/web/runner/Main.kt
@@ -109,7 +109,7 @@ class RunnerCli : CliktCommand(name = "opendc-runner") {
*/
private val parallelism by option(
"--parallelism",
- help = "maximum number of threads for simulations",
+ help = "maximum number of threads for simulations"
)
.int()
.default(Runtime.getRuntime().availableProcessors() - 1)
diff --git a/opendc-web/opendc-web-runner/src/main/kotlin/org/opendc/web/runner/OpenDCRunner.kt b/opendc-web/opendc-web-runner/src/main/kotlin/org/opendc/web/runner/OpenDCRunner.kt
index b0f99084..226bad47 100644
--- a/opendc-web/opendc-web-runner/src/main/kotlin/org/opendc/web/runner/OpenDCRunner.kt
+++ b/opendc-web/opendc-web-runner/src/main/kotlin/org/opendc/web/runner/OpenDCRunner.kt
@@ -215,7 +215,7 @@ public class OpenDCRunner(
private inner class SimulationTask(
private val scenario: Scenario,
private val repeat: Int,
- private val topology: List<HostSpec>,
+ private val topology: List<HostSpec>
) : RecursiveTask<WebComputeMonitor.Results>() {
override fun compute(): WebComputeMonitor.Results {
val monitor = WebComputeMonitor()
@@ -261,10 +261,11 @@ public class OpenDCRunner(
val phenomena = scenario.phenomena
val failureModel =
- if (phenomena.failures)
+ if (phenomena.failures) {
grid5000(Duration.ofDays(7))
- else
+ } else {
null
+ }
// Run workload trace
service.replay(clock, vms, seed, failureModel = failureModel, interference = phenomena.interference)
diff --git a/opendc-web/opendc-web-runner/src/main/kotlin/org/opendc/web/runner/internal/WebComputeMonitor.kt b/opendc-web/opendc-web-runner/src/main/kotlin/org/opendc/web/runner/internal/WebComputeMonitor.kt
index 76377c08..4db70d3d 100644
--- a/opendc-web/opendc-web-runner/src/main/kotlin/org/opendc/web/runner/internal/WebComputeMonitor.kt
+++ b/opendc-web/opendc-web-runner/src/main/kotlin/org/opendc/web/runner/internal/WebComputeMonitor.kt
@@ -66,7 +66,7 @@ internal class WebComputeMonitor : ComputeMonitor {
val totalLostTime: Long = 0L,
val totalPowerDraw: Double = 0.0,
val totalFailureSlices: Double = 0.0,
- val totalFailureVmSlices: Double = 0.0,
+ val totalFailureVmSlices: Double = 0.0
)
private data class HostMetrics(
@@ -84,7 +84,7 @@ internal class WebComputeMonitor : ComputeMonitor {
max(reader.serversPending, serviceMetrics.vmWaitingCount),
max(reader.serversActive, serviceMetrics.vmActiveCount),
max(0, serviceMetrics.vmInactiveCount),
- max(reader.attemptsFailure, serviceMetrics.vmFailedCount),
+ max(reader.attemptsFailure, serviceMetrics.vmFailedCount)
)
}
@@ -115,7 +115,7 @@ internal class WebComputeMonitor : ComputeMonitor {
serviceMetrics.vmTotalCount,
serviceMetrics.vmWaitingCount,
serviceMetrics.vmInactiveCount,
- serviceMetrics.vmFailedCount,
+ serviceMetrics.vmFailedCount
)
}
diff --git a/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/model/Portfolio.kt b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/model/Portfolio.kt
index 5b686d5f..09437712 100644
--- a/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/model/Portfolio.kt
+++ b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/model/Portfolio.kt
@@ -87,7 +87,7 @@ class Portfolio(
*/
@Type(type = "json")
@Column(columnDefinition = "jsonb", nullable = false, updatable = false)
- val targets: Targets,
+ val targets: Targets
) {
/**
* The scenarios in this portfolio.
diff --git a/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/model/Project.kt b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/model/Project.kt
index 5eb925ea..41d1a786 100644
--- a/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/model/Project.kt
+++ b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/model/Project.kt
@@ -85,7 +85,7 @@ class Project(
var name: String,
@Column(name = "created_at", nullable = false, updatable = false)
- val createdAt: Instant,
+ val createdAt: Instant
) {
/**
* The instant at which the project was updated.
diff --git a/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/model/Scenario.kt b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/model/Scenario.kt
index a7258e7b..62adc9e2 100644
--- a/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/model/Scenario.kt
+++ b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/model/Scenario.kt
@@ -106,7 +106,7 @@ class Scenario(
val phenomena: OperationalPhenomena,
@Column(name = "scheduler_name", nullable = false, updatable = false)
- val schedulerName: String,
+ val schedulerName: String
) {
/**
* The [Job] associated with the scenario.
diff --git a/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/model/Trace.kt b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/model/Trace.kt
index 0fc79ca8..14a88c5a 100644
--- a/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/model/Trace.kt
+++ b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/model/Trace.kt
@@ -43,7 +43,7 @@ import javax.persistence.Table
NamedQuery(
name = "Trace.findAll",
query = "SELECT t FROM Trace t"
- ),
+ )
]
)
class Trace(
@@ -54,7 +54,7 @@ class Trace(
val name: String,
@Column(nullable = false, updatable = false)
- val type: String,
+ val type: String
) {
/**
* Return a string representation of this trace.
diff --git a/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/rest/user/PortfolioResource.kt b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/rest/user/PortfolioResource.kt
index da565fe4..ebe57ae2 100644
--- a/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/rest/user/PortfolioResource.kt
+++ b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/rest/user/PortfolioResource.kt
@@ -43,7 +43,7 @@ import javax.ws.rs.WebApplicationException
@RolesAllowed("openid")
class PortfolioResource @Inject constructor(
private val portfolioService: PortfolioService,
- private val identity: SecurityIdentity,
+ private val identity: SecurityIdentity
) {
/**
* Get all portfolios that belong to the specified project.
diff --git a/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/rest/user/PortfolioScenarioResource.kt b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/rest/user/PortfolioScenarioResource.kt
index 515f6be6..82f35127 100644
--- a/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/rest/user/PortfolioScenarioResource.kt
+++ b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/rest/user/PortfolioScenarioResource.kt
@@ -42,7 +42,7 @@ import javax.ws.rs.WebApplicationException
@RolesAllowed("openid")
class PortfolioScenarioResource @Inject constructor(
private val scenarioService: ScenarioService,
- private val identity: SecurityIdentity,
+ private val identity: SecurityIdentity
) {
/**
* Get all scenarios that belong to the specified portfolio.
diff --git a/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/service/ScenarioService.kt b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/service/ScenarioService.kt
index 1929f44b..fad4e56f 100644
--- a/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/service/ScenarioService.kt
+++ b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/service/ScenarioService.kt
@@ -44,7 +44,7 @@ class ScenarioService @Inject constructor(
private val portfolioRepository: PortfolioRepository,
private val topologyRepository: TopologyRepository,
private val traceRepository: TraceRepository,
- private val scenarioRepository: ScenarioRepository,
+ private val scenarioRepository: ScenarioRepository
) {
/**
* List all [Scenario]s that belong a certain portfolio.
diff --git a/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/util/hibernate/json/JsonBinarySqlTypeDescriptor.kt b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/util/hibernate/json/JsonBinarySqlTypeDescriptor.kt
index 45752d4e..df6a3013 100644
--- a/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/util/hibernate/json/JsonBinarySqlTypeDescriptor.kt
+++ b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/util/hibernate/json/JsonBinarySqlTypeDescriptor.kt
@@ -1,3 +1,25 @@
+/*
+ * Copyright (c) 2022 AtLarge Research
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
package org.opendc.web.server.util.hibernate.json
import com.fasterxml.jackson.databind.JsonNode
diff --git a/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/util/hibernate/json/JsonBytesSqlTypeDescriptor.kt b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/util/hibernate/json/JsonBytesSqlTypeDescriptor.kt
index cc8dad48..4924f586 100644
--- a/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/util/hibernate/json/JsonBytesSqlTypeDescriptor.kt
+++ b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/util/hibernate/json/JsonBytesSqlTypeDescriptor.kt
@@ -77,10 +77,12 @@ internal object JsonBytesSqlTypeDescriptor : AbstractJsonSqlTypeDescriptor() {
private fun fromJsonBytes(jsonBytes: ByteArray?): String? {
return if (jsonBytes == null) {
null
- } else try {
- String(jsonBytes, CHARSET)
- } catch (e: UnsupportedEncodingException) {
- throw IllegalStateException(e)
+ } else {
+ try {
+ String(jsonBytes, CHARSET)
+ } catch (e: UnsupportedEncodingException) {
+ throw IllegalStateException(e)
+ }
}
}
}
diff --git a/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/util/hibernate/json/JsonStringSqlTypeDescriptor.kt b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/util/hibernate/json/JsonStringSqlTypeDescriptor.kt
index 63f32849..6e015762 100644
--- a/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/util/hibernate/json/JsonStringSqlTypeDescriptor.kt
+++ b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/util/hibernate/json/JsonStringSqlTypeDescriptor.kt
@@ -1,3 +1,25 @@
+/*
+ * Copyright (c) 2022 AtLarge Research
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
package org.opendc.web.server.util.hibernate.json
import org.hibernate.type.descriptor.ValueBinder
diff --git a/opendc-web/opendc-web-server/src/test/kotlin/org/opendc/web/server/rest/runner/JobResourceTest.kt b/opendc-web/opendc-web-server/src/test/kotlin/org/opendc/web/server/rest/runner/JobResourceTest.kt
index 71aaa8a4..9aca58e9 100644
--- a/opendc-web/opendc-web-server/src/test/kotlin/org/opendc/web/server/rest/runner/JobResourceTest.kt
+++ b/opendc-web/opendc-web-server/src/test/kotlin/org/opendc/web/server/rest/runner/JobResourceTest.kt
@@ -62,7 +62,7 @@ class JobResourceTest {
private val dummyPortfolio = Portfolio(1, 1, "test", Targets(emptySet()))
private val dummyTopology = Topology(1, 1, "test", emptyList(), Instant.now(), Instant.now())
private val dummyTrace = Trace("bitbrains", "Bitbrains", "vm")
- private val dummyScenario = Scenario(1, 1, dummyPortfolio, "test", Workload(dummyTrace, 1.0), dummyTopology, OperationalPhenomena(false, false), "test",)
+ private val dummyScenario = Scenario(1, 1, dummyPortfolio, "test", Workload(dummyTrace, 1.0), dummyTopology, OperationalPhenomena(false, false), "test")
private val dummyJob = Job(1, dummyScenario, JobState.PENDING, Instant.now(), Instant.now())
@BeforeEach
diff --git a/opendc-web/opendc-web-ui-quarkus-deployment/src/main/java/org/opendc/web/ui/deployment/AuthConfiguration.java b/opendc-web/opendc-web-ui-quarkus-deployment/src/main/java/org/opendc/web/ui/deployment/AuthConfiguration.java
index 2e4d9198..82e02549 100644
--- a/opendc-web/opendc-web-ui-quarkus-deployment/src/main/java/org/opendc/web/ui/deployment/AuthConfiguration.java
+++ b/opendc-web/opendc-web-ui-quarkus-deployment/src/main/java/org/opendc/web/ui/deployment/AuthConfiguration.java
@@ -24,7 +24,6 @@ package org.opendc.web.ui.deployment;
import io.quarkus.runtime.annotations.ConfigGroup;
import io.quarkus.runtime.annotations.ConfigItem;
-
import java.util.Optional;
/**
diff --git a/opendc-web/opendc-web-ui-quarkus-deployment/src/main/java/org/opendc/web/ui/deployment/OpenDCUiConfig.java b/opendc-web/opendc-web-ui-quarkus-deployment/src/main/java/org/opendc/web/ui/deployment/OpenDCUiConfig.java
index 50c1fbe3..d630dbac 100644
--- a/opendc-web/opendc-web-ui-quarkus-deployment/src/main/java/org/opendc/web/ui/deployment/OpenDCUiConfig.java
+++ b/opendc-web/opendc-web-ui-quarkus-deployment/src/main/java/org/opendc/web/ui/deployment/OpenDCUiConfig.java
@@ -24,7 +24,6 @@ package org.opendc.web.ui.deployment;
import io.quarkus.runtime.annotations.ConfigItem;
import io.quarkus.runtime.annotations.ConfigRoot;
-
import java.util.Optional;
/**
diff --git a/opendc-web/opendc-web-ui-quarkus-deployment/src/main/java/org/opendc/web/ui/deployment/OpenDCUiProcessor.java b/opendc-web/opendc-web-ui-quarkus-deployment/src/main/java/org/opendc/web/ui/deployment/OpenDCUiProcessor.java
index 54782ace..093a9bfa 100644
--- a/opendc-web/opendc-web-ui-quarkus-deployment/src/main/java/org/opendc/web/ui/deployment/OpenDCUiProcessor.java
+++ b/opendc-web/opendc-web-ui-quarkus-deployment/src/main/java/org/opendc/web/ui/deployment/OpenDCUiProcessor.java
@@ -41,9 +41,6 @@ import io.quarkus.vertx.http.deployment.webjar.WebJarResourcesFilter;
import io.quarkus.vertx.http.deployment.webjar.WebJarResultsBuildItem;
import io.vertx.core.Handler;
import io.vertx.ext.web.RoutingContext;
-import org.opendc.web.ui.runtime.OpenDCUiRecorder;
-import org.opendc.web.ui.runtime.OpenDCUiRuntimeConfig;
-
import java.io.*;
import java.util.ArrayList;
import java.util.Iterator;
@@ -51,6 +48,8 @@ import java.util.function.BooleanSupplier;
import java.util.function.Function;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import org.opendc.web.ui.runtime.OpenDCUiRecorder;
+import org.opendc.web.ui.runtime.OpenDCUiRuntimeConfig;
/**
* Build processor for the OpenDC web UI Quarkus extension.
@@ -76,25 +75,25 @@ public class OpenDCUiProcessor {
* Build the WebJar that is used to serve the Next.js resources.
*/
@BuildStep(onlyIf = IsIncluded.class)
- public WebJarBuildItem buildWebJar(OpenDCUiConfig config,
- HttpRootPathBuildItem httpRootPathBuildItem) {
+ public WebJarBuildItem buildWebJar(OpenDCUiConfig config, HttpRootPathBuildItem httpRootPathBuildItem) {
return WebJarBuildItem.builder()
- .artifactKey(OPENDC_UI_WEBJAR_ARTIFACT_KEY)
- .root(OPENDC_UI_WEBJAR_STATIC_RESOURCES_PATH)
- .onlyCopyNonArtifactFiles(false)
- .useDefaultQuarkusBranding(false)
- .filter(new InsertVariablesResourcesFilter(config, httpRootPathBuildItem))
- .build();
+ .artifactKey(OPENDC_UI_WEBJAR_ARTIFACT_KEY)
+ .root(OPENDC_UI_WEBJAR_STATIC_RESOURCES_PATH)
+ .onlyCopyNonArtifactFiles(false)
+ .useDefaultQuarkusBranding(false)
+ .filter(new InsertVariablesResourcesFilter(config, httpRootPathBuildItem))
+ .build();
}
-
/**
* Build the Next.js routes based on the route manifest generated by it.
*/
@BuildStep(onlyIf = IsIncluded.class)
- public OpenDCUiRoutingBuildItem buildRoutes(CurateOutcomeBuildItem curateOutcomeBuildItem) throws IOException {
+ public OpenDCUiRoutingBuildItem buildRoutes(CurateOutcomeBuildItem curateOutcomeBuildItem) throws IOException {
ResolvedDependency dependency = getAppArtifact(curateOutcomeBuildItem, OPENDC_UI_WEBJAR_ARTIFACT_KEY);
- PathVisit visit = dependency.getContentTree().apply(OPENDC_UI_WEBJAR_STATIC_RESOURCES_PATH + "/routes-manifest.json", v -> v);
+ PathVisit visit = dependency
+ .getContentTree()
+ .apply(OPENDC_UI_WEBJAR_STATIC_RESOURCES_PATH + "/routes-manifest.json", v -> v);
if (visit == null) {
throw new FileNotFoundException("Cannot find routes-manifest.json");
@@ -103,7 +102,7 @@ public class OpenDCUiProcessor {
JsonNode routeManifest = objectMapper.readTree(visit.getUrl());
var pages = new ArrayList<OpenDCUiRoutingBuildItem.Page>();
- for (Iterator<JsonNode> it = routeManifest.get("staticRoutes").elements(); it.hasNext();) {
+ for (Iterator<JsonNode> it = routeManifest.get("staticRoutes").elements(); it.hasNext(); ) {
JsonNode route = it.next();
String page = route.get("page").asText();
@@ -112,7 +111,7 @@ public class OpenDCUiProcessor {
pages.add(new OpenDCUiRoutingBuildItem.Page(page, page));
}
- for (Iterator<JsonNode> it = routeManifest.get("dynamicRoutes").elements(); it.hasNext();) {
+ for (Iterator<JsonNode> it = routeManifest.get("dynamicRoutes").elements(); it.hasNext(); ) {
JsonNode route = it.next();
String page = route.get("page").asText();
@@ -122,7 +121,7 @@ public class OpenDCUiProcessor {
}
var redirects = new ArrayList<OpenDCUiRoutingBuildItem.Redirect>();
- for (Iterator<JsonNode> it = routeManifest.get("redirects").elements(); it.hasNext();) {
+ for (Iterator<JsonNode> it = routeManifest.get("redirects").elements(); it.hasNext(); ) {
JsonNode redirect = it.next();
if (redirect.has("internal")) {
continue;
@@ -148,16 +147,18 @@ public class OpenDCUiProcessor {
*/
@BuildStep(onlyIf = IsIncluded.class)
@Record(ExecutionTime.RUNTIME_INIT)
- public void registerOpenDCUiHandler(OpenDCUiRecorder recorder,
- BuildProducer<RouteBuildItem> routes,
- HttpRootPathBuildItem httpRootPathBuildItem,
- WebJarResultsBuildItem webJarResultsBuildItem,
- OpenDCUiRoutingBuildItem openDCUiBuildItem,
- OpenDCUiRuntimeConfig runtimeConfig,
- OpenDCUiConfig buildConfig,
- ShutdownContextBuildItem shutdownContext) {
-
- WebJarResultsBuildItem.WebJarResult result = webJarResultsBuildItem.byArtifactKey(OPENDC_UI_WEBJAR_ARTIFACT_KEY);
+ public void registerOpenDCUiHandler(
+ OpenDCUiRecorder recorder,
+ BuildProducer<RouteBuildItem> routes,
+ HttpRootPathBuildItem httpRootPathBuildItem,
+ WebJarResultsBuildItem webJarResultsBuildItem,
+ OpenDCUiRoutingBuildItem openDCUiBuildItem,
+ OpenDCUiRuntimeConfig runtimeConfig,
+ OpenDCUiConfig buildConfig,
+ ShutdownContextBuildItem shutdownContext) {
+
+ WebJarResultsBuildItem.WebJarResult result =
+ webJarResultsBuildItem.byArtifactKey(OPENDC_UI_WEBJAR_ARTIFACT_KEY);
if (result == null) {
return;
}
@@ -167,41 +168,41 @@ public class OpenDCUiProcessor {
/* Construct dynamic routes */
for (var redirect : openDCUiBuildItem.getRedirects()) {
- String destination = basePath.equals("/") ? redirect.getDestination() : basePath + redirect.getDestination();
-
- routes.produce(httpRootPathBuildItem.routeBuilder()
- .route(basePath + redirect.getPath())
- .handler(recorder.redirectHandler(destination, redirect.getStatusCode(), runtimeConfig))
- .build());
+ String destination =
+ basePath.equals("/") ? redirect.getDestination() : basePath + redirect.getDestination();
+
+ routes.produce(httpRootPathBuildItem
+ .routeBuilder()
+ .route(basePath + redirect.getPath())
+ .handler(recorder.redirectHandler(destination, redirect.getStatusCode(), runtimeConfig))
+ .build());
}
for (var page : openDCUiBuildItem.getPages()) {
- routes.produce(httpRootPathBuildItem.routeBuilder()
- .route(basePath + page.getPath())
- .handler(recorder.pageHandler(finalDestination, page.getName(), runtimeConfig))
- .build());
+ routes.produce(httpRootPathBuildItem
+ .routeBuilder()
+ .route(basePath + page.getPath())
+ .handler(recorder.pageHandler(finalDestination, page.getName(), runtimeConfig))
+ .build());
}
/* Construct static routes */
Handler<RoutingContext> staticHandler = recorder.staticHandler(
- finalDestination,
- basePath,
- result.getWebRootConfigurations(),
- runtimeConfig,
- shutdownContext
- );
-
- routes.produce(httpRootPathBuildItem.routeBuilder()
- .route(buildConfig.path)
- .displayOnNotFoundPage("OpenDC UI")
- .routeConfigKey("quarkus.opendc-ui.path")
- .handler(staticHandler)
- .build());
-
- routes.produce(httpRootPathBuildItem.routeBuilder()
- .route(buildConfig.path + "*")
- .handler(staticHandler)
- .build());
+ finalDestination, basePath, result.getWebRootConfigurations(), runtimeConfig, shutdownContext);
+
+ routes.produce(httpRootPathBuildItem
+ .routeBuilder()
+ .route(buildConfig.path)
+ .displayOnNotFoundPage("OpenDC UI")
+ .routeConfigKey("quarkus.opendc-ui.path")
+ .handler(staticHandler)
+ .build());
+
+ routes.produce(httpRootPathBuildItem
+ .routeBuilder()
+ .route(buildConfig.path + "*")
+ .handler(staticHandler)
+ .build());
}
/**
@@ -216,7 +217,6 @@ public class OpenDCUiProcessor {
private final OpenDCUiConfig config;
private final HttpRootPathBuildItem httpRootPathBuildItem;
-
public InsertVariablesResourcesFilter(OpenDCUiConfig config, HttpRootPathBuildItem httpRootPathBuildItem) {
this.config = config;
this.httpRootPathBuildItem = httpRootPathBuildItem;
@@ -304,7 +304,8 @@ public class OpenDCUiProcessor {
}
private static ResolvedDependency getAppArtifact(CurateOutcomeBuildItem curateOutcomeBuildItem, GACT artifactKey) {
- for (ResolvedDependency dep : curateOutcomeBuildItem.getApplicationModel().getDependencies()) {
+ for (ResolvedDependency dep :
+ curateOutcomeBuildItem.getApplicationModel().getDependencies()) {
if (dep.getKey().equals(artifactKey)) {
return dep;
}
diff --git a/opendc-web/opendc-web-ui-quarkus-deployment/src/main/java/org/opendc/web/ui/deployment/OpenDCUiRoutingBuildItem.java b/opendc-web/opendc-web-ui-quarkus-deployment/src/main/java/org/opendc/web/ui/deployment/OpenDCUiRoutingBuildItem.java
index 7e0f9408..6cf44893 100644
--- a/opendc-web/opendc-web-ui-quarkus-deployment/src/main/java/org/opendc/web/ui/deployment/OpenDCUiRoutingBuildItem.java
+++ b/opendc-web/opendc-web-ui-quarkus-deployment/src/main/java/org/opendc/web/ui/deployment/OpenDCUiRoutingBuildItem.java
@@ -23,7 +23,6 @@
package org.opendc.web.ui.deployment;
import io.quarkus.builder.item.SimpleBuildItem;
-
import java.util.List;
/**
@@ -57,7 +56,7 @@ public final class OpenDCUiRoutingBuildItem extends SimpleBuildItem {
}
public boolean hasCustom404() {
- return this.custom404;
+ return this.custom404;
}
/**
diff --git a/opendc-web/opendc-web-ui-quarkus/src/main/java/org/opendc/web/ui/runtime/OpenDCUiRecorder.java b/opendc-web/opendc-web-ui-quarkus/src/main/java/org/opendc/web/ui/runtime/OpenDCUiRecorder.java
index 026a9039..03fedd4f 100644
--- a/opendc-web/opendc-web-ui-quarkus/src/main/java/org/opendc/web/ui/runtime/OpenDCUiRecorder.java
+++ b/opendc-web/opendc-web-ui-quarkus/src/main/java/org/opendc/web/ui/runtime/OpenDCUiRecorder.java
@@ -29,7 +29,6 @@ import io.quarkus.vertx.http.runtime.webjar.WebJarNotFoundHandler;
import io.quarkus.vertx.http.runtime.webjar.WebJarStaticHandler;
import io.vertx.core.Handler;
import io.vertx.ext.web.RoutingContext;
-
import java.util.List;
import java.util.stream.Collectors;
@@ -42,16 +41,11 @@ public class OpenDCUiRecorder {
* Construct a {@link Handler} for serving a page of the OpenDC web interface.
*/
public Handler<RoutingContext> pageHandler(
- String finalDestination,
- String page,
- OpenDCUiRuntimeConfig runtimeConfig
- ) {
+ String finalDestination, String page, OpenDCUiRuntimeConfig runtimeConfig) {
if (runtimeConfig.enable) {
String pageDirectory = finalDestination + "/pages";
return (event) -> {
- event.response()
- .setStatusCode(200)
- .sendFile(pageDirectory + page + ".html");
+ event.response().setStatusCode(200).sendFile(pageDirectory + page + ".html");
};
}
@@ -62,19 +56,16 @@ public class OpenDCUiRecorder {
* Construct a {@link Handler} for handling redirects in the OpenDC web interface.
*/
public Handler<RoutingContext> redirectHandler(
- String destination,
- int statusCode,
- OpenDCUiRuntimeConfig runtimeConfig
- ) {
+ String destination, int statusCode, OpenDCUiRuntimeConfig runtimeConfig) {
if (runtimeConfig.enable) {
return (event) -> {
String query = event.request().query();
String fullDestination = query != null ? destination + "?" + query : destination;
event.response()
- .setStatusCode(statusCode)
- .putHeader("Location", fullDestination)
- .end();
+ .setStatusCode(statusCode)
+ .putHeader("Location", fullDestination)
+ .end();
};
}
@@ -85,19 +76,19 @@ public class OpenDCUiRecorder {
* Construct a {@link Handler} for serving the static files of the OpenDC web interface.
*/
public Handler<RoutingContext> staticHandler(
- String finalDestination,
- String path,
- List<FileSystemStaticHandler.StaticWebRootConfiguration> webRootConfigurations,
- OpenDCUiRuntimeConfig runtimeConfig,
- ShutdownContext shutdownContext
- ) {
+ String finalDestination,
+ String path,
+ List<FileSystemStaticHandler.StaticWebRootConfiguration> webRootConfigurations,
+ OpenDCUiRuntimeConfig runtimeConfig,
+ ShutdownContext shutdownContext) {
if (runtimeConfig.enable) {
- var augmentedWebRootConfigurations = webRootConfigurations
- .stream()
- .map(c -> new FileSystemStaticHandler.StaticWebRootConfiguration(c.getFileSystem(), c.getWebRoot().isEmpty() ? "static" : c.getWebRoot() + "/static"))
- .collect(Collectors.toList());
+ var augmentedWebRootConfigurations = webRootConfigurations.stream()
+ .map(c -> new FileSystemStaticHandler.StaticWebRootConfiguration(
+ c.getFileSystem(), c.getWebRoot().isEmpty() ? "static" : c.getWebRoot() + "/static"))
+ .collect(Collectors.toList());
- WebJarStaticHandler handler = new WebJarStaticHandler(finalDestination + "/static", path, augmentedWebRootConfigurations);
+ WebJarStaticHandler handler =
+ new WebJarStaticHandler(finalDestination + "/static", path, augmentedWebRootConfigurations);
shutdownContext.addShutdownTask(new ShutdownContext.CloseRunnable(handler));
return handler;
}
diff --git a/opendc-web/opendc-web-ui/build.gradle.kts b/opendc-web/opendc-web-ui/build.gradle.kts
index f8c0a45b..5e999359 100644
--- a/opendc-web/opendc-web-ui/build.gradle.kts
+++ b/opendc-web/opendc-web-ui/build.gradle.kts
@@ -76,10 +76,10 @@ val buildTask = tasks.register<NpmTask>("buildNext") {
"NEXT_PUBLIC_SENTRY_DSN",
"NEXT_PUBLIC_AUTH0_DOMAIN",
"NEXT_PUBLIC_AUTH0_CLIENT_ID",
- "NEXT_PUBLIC_AUTH0_AUDIENCE",
+ "NEXT_PUBLIC_AUTH0_AUDIENCE"
)
for (envvar in env) {
- environment.put(envvar, "%%${envvar}%%")
+ environment.put(envvar, "%%$envvar%%")
}
dependsOn(tasks.npmInstall)