Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add dev ui #1036

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

feat: add dev ui #1036

wants to merge 5 commits into from

Conversation

Dudeplayz
Copy link
Collaborator

Implements #33

@quarkus-hilla-bot
Copy link
Contributor

quarkus-hilla-bot bot commented Nov 3, 2024

Format Checker Report

There are 4 files with format errors.

  • To fix the build, please run mvn spotless:apply in your branch and commit the changes.
  • Alternatively, apply the auto-format label to the PR.
Files with format issues in this PR
commons/deployment/src/main/java/com/github/mcollovati/quarkus/hilla/deployment/devui/EndpointBuildItem.java
commons/deployment/src/main/java/com/github/mcollovati/quarkus/hilla/deployment/devui/QuarkusHillaDevUICommonsProcessor.java
lit/deployment/src/main/java/com/github/mcollovati/quarkus/hilla/devui/QuarkusHillaDevUIProcessor.java
react/deployment/src/main/java/com/github/mcollovati/quarkus/hilla/devui/QuarkusHillaDevUIProcessor.java
Full Diff
diff --git a/commons/deployment/src/main/java/com/github/mcollovati/quarkus/hilla/deployment/devui/EndpointBuildItem.java b/commons/deployment/src/main/java/com/github/mcollovati/quarkus/hilla/deployment/devui/EndpointBuildItem.java
index f73f2d1..32b0ace 100644
--- a/commons/deployment/src/main/java/com/github/mcollovati/quarkus/hilla/deployment/devui/EndpointBuildItem.java
+++ b/commons/deployment/src/main/java/com/github/mcollovati/quarkus/hilla/deployment/devui/EndpointBuildItem.java
@@ -32,8 +32,6 @@ public final class EndpointBuildItem extends SimpleBuildItem {
     }
 
     public int getEndpointMethodCount() {
-        return endpoints.stream()
-                .mapToInt(a -> a.children().size())
-                .sum();
+        return endpoints.stream().mapToInt(a -> a.children().size()).sum();
     }
 }
diff --git a/commons/deployment/src/main/java/com/github/mcollovati/quarkus/hilla/deployment/devui/QuarkusHillaDevUICommonsProcessor.java b/commons/deployment/src/main/java/com/github/mcollovati/quarkus/hilla/deployment/devui/QuarkusHillaDevUICommonsProcessor.java
index 54f144a..c062cfa 100644
--- a/commons/deployment/src/main/java/com/github/mcollovati/quarkus/hilla/deployment/devui/QuarkusHillaDevUICommonsProcessor.java
+++ b/commons/deployment/src/main/java/com/github/mcollovati/quarkus/hilla/deployment/devui/QuarkusHillaDevUICommonsProcessor.java
@@ -15,6 +15,12 @@
  */
 package com.github.mcollovati.quarkus.hilla.deployment.devui;
 
+import java.io.ByteArrayInputStream;
+import java.nio.charset.StandardCharsets;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.stream.Stream;
+
 import io.quarkus.deployment.IsDevelopment;
 import io.quarkus.deployment.annotations.BuildProducer;
 import io.quarkus.deployment.annotations.BuildStep;
@@ -28,15 +34,10 @@ import org.jboss.jandex.AnnotationInstance;
 import org.jboss.jandex.AnnotationTarget;
 import org.jboss.jandex.DotName;
 
-import java.io.ByteArrayInputStream;
-import java.nio.charset.StandardCharsets;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.stream.Stream;
-
 public class QuarkusHillaDevUICommonsProcessor {
 
-    private static final GACT UI_JAR = new GACT("com.github.mcollovati", "quarkus-hilla-commons-deployment", null, "jar");
+    private static final GACT UI_JAR =
+            new GACT("com.github.mcollovati", "quarkus-hilla-commons-deployment", null, "jar");
     private static final String NAMESPACE = UI_JAR.getGroupId() + "." + UI_JAR.getArtifactId();
     private static final String DEV_UI = "dev-ui";
 
diff --git a/lit/deployment/src/main/java/com/github/mcollovati/quarkus/hilla/devui/QuarkusHillaDevUIProcessor.java b/lit/deployment/src/main/java/com/github/mcollovati/quarkus/hilla/devui/QuarkusHillaDevUIProcessor.java
index eded8a0..2efb618 100644
--- a/lit/deployment/src/main/java/com/github/mcollovati/quarkus/hilla/devui/QuarkusHillaDevUIProcessor.java
+++ b/lit/deployment/src/main/java/com/github/mcollovati/quarkus/hilla/devui/QuarkusHillaDevUIProcessor.java
@@ -1,18 +1,32 @@
+/*
+ * Copyright 2024 Marco Collovati, Dario Götze
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 package com.github.mcollovati.quarkus.hilla.devui;
 
-import com.github.mcollovati.quarkus.hilla.deployment.devui.EndpointBuildItem;
 import io.quarkus.deployment.IsDevelopment;
 import io.quarkus.deployment.annotations.BuildProducer;
 import io.quarkus.deployment.annotations.BuildStep;
 import io.quarkus.devui.spi.page.CardPageBuildItem;
 import io.quarkus.devui.spi.page.Page;
 
+import com.github.mcollovati.quarkus.hilla.deployment.devui.EndpointBuildItem;
+
 public class QuarkusHillaDevUIProcessor {
 
     @BuildStep(onlyIf = IsDevelopment.class)
-    public void pages(
-            BuildProducer<CardPageBuildItem> cardPageProducer,
-            EndpointBuildItem endpointBuildItem) {
+    public void pages(BuildProducer<CardPageBuildItem> cardPageProducer, EndpointBuildItem endpointBuildItem) {
         CardPageBuildItem cardPageBuildItem = new CardPageBuildItem();
         final var page = Page.webComponentPageBuilder()
                 .title("Browser callables")
diff --git a/react/deployment/src/main/java/com/github/mcollovati/quarkus/hilla/devui/QuarkusHillaDevUIProcessor.java b/react/deployment/src/main/java/com/github/mcollovati/quarkus/hilla/devui/QuarkusHillaDevUIProcessor.java
index 0db2ae7..2fd604a 100644
--- a/react/deployment/src/main/java/com/github/mcollovati/quarkus/hilla/devui/QuarkusHillaDevUIProcessor.java
+++ b/react/deployment/src/main/java/com/github/mcollovati/quarkus/hilla/devui/QuarkusHillaDevUIProcessor.java
@@ -1,18 +1,32 @@
+/*
+ * Copyright 2024 Marco Collovati, Dario Götze
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 package com.github.mcollovati.quarkus.hilla.devui;
 
-import com.github.mcollovati.quarkus.hilla.deployment.devui.EndpointBuildItem;
 import io.quarkus.deployment.IsDevelopment;
 import io.quarkus.deployment.annotations.BuildProducer;
 import io.quarkus.deployment.annotations.BuildStep;
 import io.quarkus.devui.spi.page.CardPageBuildItem;
 import io.quarkus.devui.spi.page.Page;
 
+import com.github.mcollovati.quarkus.hilla.deployment.devui.EndpointBuildItem;
+
 public class QuarkusHillaDevUIProcessor {
 
     @BuildStep(onlyIf = IsDevelopment.class)
-    public void pages(
-            BuildProducer<CardPageBuildItem> cardPageProducer,
-            EndpointBuildItem endpointBuildItem) {
+    public void pages(BuildProducer<CardPageBuildItem> cardPageProducer, EndpointBuildItem endpointBuildItem) {
         CardPageBuildItem cardPageBuildItem = new CardPageBuildItem();
         final var page = Page.webComponentPageBuilder()
                 .title("Browser callables")

@Dudeplayz Dudeplayz linked an issue Nov 3, 2024 that may be closed by this pull request
@Dudeplayz Dudeplayz force-pushed the issues/33-add-dev-ui branch from 44c7f5e to e25cc5a Compare November 3, 2024 13:22
Copy link

github-actions bot commented Nov 3, 2024

Test Results

 67 files  ±0   67 suites  ±0   14m 23s ⏱️ +30s
216 tests ±0  215 ✅ ±0  1 💤 ±0  0 ❌ ±0 
316 runs  ±0  315 ✅ ±0  1 💤 ±0  0 ❌ ±0 

Results for commit 1bcf13c. ± Comparison against base commit 2ec5b77.

♻️ This comment has been updated with latest results.

Copy link
Owner

@mcollovati mcollovati left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, looks excellent!
However, I noticed that methods defined in superclasses annotated with @EndpointExposed are not listed in the UI.
I guess this is because ClassInfo.methods() collects only method declared in the class and do not traverse the hierarchy

.map(DotName::withoutPackagePrefix)
.orElse(null),
accessAnnotation,
classInfo.methods().stream()
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would maybe use methodsInDeclarationOrder() to make the ordering consistent with the class definition.
Also, should collect methods from super classes annotated with @ExposedEndpoint

return html`
<vaadin-grid .dataProvider="${this._dataProvider}" .expandedItems="${this._expandedItems}"
class="datatable" theme="row-stripes">
<vaadin-grid-sort-column header="Class"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorting does not seem to work. Would it make sense to remove it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's true, didn't know how to correctly specify the sort parameter. If you can give me a hint, would be nice, otherwise we could remove it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 👀 In review
Development

Successfully merging this pull request may close these issues.

Add quarkus dev UI
2 participants