Skip to content

Commit

Permalink
Merge pull request quarkusio#31708 from phillip-kruger/dev-ui-small-e…
Browse files Browse the repository at this point in the history
…chart-fix
  • Loading branch information
cescoffier committed Mar 9, 2023
2 parents 7a14c02 + 1cbd390 commit 878643a
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 67 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export class QwcResteasyReactiveCard extends QwcHotReloadElement {
<echarts-gauge-grade
percentage="${this._latestScores.score}"
percentageFontSize="14"
sectionColors="--lumo-error-color,--lumo-warning-color,--lumo-success-color"
sectionColors="--lumo-error-color,--lumo-warning-color,--lumo-success-color">
</echarts-gauge-grade>
</div>
${this._renderPagesLinks()}`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export class QwcResteasyReactiveExceptionMappers extends LitElement {
.datatable {
height: 100%;
padding-bottom: 10px;
border: none;
}`;

static properties = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export class QwcResteasyReactiveParameterConverterProviders extends LitElement {
.datatable {
height: 100%;
padding-bottom: 10px;
border: none;
}`;

static properties = {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,42 +1,89 @@
package io.quarkus.resteasy.reactive.server.runtime.devui;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import java.util.stream.Collectors;

import jakarta.ws.rs.core.MediaType;

import org.jboss.resteasy.reactive.server.core.RuntimeExceptionMapper;
import org.jboss.resteasy.reactive.server.util.ScoreSystem;

import io.quarkus.resteasy.reactive.server.runtime.ResteasyReactiveRecorder;
import io.vertx.core.json.JsonArray;
import io.vertx.core.json.JsonObject;

public class ResteasyReactiveJsonRPCService {

public ScoreSystem.EndpointScores getEndpointScores() {
public JsonObject getEndpointScores() {
JsonObject endpointScore = new JsonObject();

ScoreSystem.EndpointScores result = ScoreSystem.latestScores;
if (result != null) {
return result;
endpointScore.put("score", result.score);
JsonArray endpoints = new JsonArray();
for (ScoreSystem.EndpointScore endpoint : result.endpoints) {
JsonObject e = new JsonObject();
e.put("className", endpoint.className);
e.put("httpMethod", endpoint.httpMethod);
e.put("fullPath", endpoint.fullPath);
e.put("producesHeaders", endpoint.produces.stream()
.map(MediaType::toString)
.collect(Collectors.toList()));
e.put("consumesHeaders", endpoint.consumes.stream()
.map(MediaType::toString)
.collect(Collectors.toList()));

JsonObject diagnostics = new JsonObject();
Map<ScoreSystem.Category, List<ScoreSystem.Diagnostic>> sortedDiagnostics = new TreeMap<>(endpoint.diagnostics);
for (Map.Entry<ScoreSystem.Category, List<ScoreSystem.Diagnostic>> diagnostic : sortedDiagnostics.entrySet()) {
JsonArray diagnosticValues = new JsonArray();
for (ScoreSystem.Diagnostic value : diagnostic.getValue()) {
JsonObject diagnosticValue = new JsonObject();
diagnosticValue.put("message", value.message);
diagnosticValue.put("score", value.score);
diagnosticValues.add(diagnosticValue);
}
diagnostics.put(diagnostic.getKey().name(), diagnosticValues);
}
e.put("diagnostics", diagnostics);
e.put("requestFilterEntries", endpoint.requestFilterEntries.stream()
.map(ScoreSystem.RequestFilterEntry::getName)
.collect(Collectors.toList()));
e.put("score", endpoint.score);
endpoints.add(e);
}
endpointScore.put("endpoints", endpoints);
} else {
endpointScore.put("score", 0);
}

return new ScoreSystem.EndpointScores(0, Collections.emptyList());
return endpointScore;
}

public List<ResteasyReactiveExceptionMapper> getExceptionMappers() {
List<ResteasyReactiveExceptionMapper> all = new ArrayList<>();
public JsonArray getExceptionMappers() {
JsonArray all = new JsonArray();
var mappers = RuntimeExceptionMapper.getMappers();
for (var entry : mappers.entrySet()) {
all.add(new ResteasyReactiveExceptionMapper(entry.getKey().getName(), entry.getValue().getClassName(),
entry.getValue().getPriority()));
JsonObject m = new JsonObject();
m.put("name", entry.getKey().getName());
m.put("className", entry.getValue().getClassName());
m.put("priority", entry.getValue().getPriority());
all.add(m);
}
return all;
}

public List<ResteasyReactiveParamConverterProvider> getParamConverterProviders() {
List<ResteasyReactiveParamConverterProvider> all = new ArrayList<>();
public JsonArray getParamConverterProviders() {
JsonArray all = new JsonArray();
var providers = ResteasyReactiveRecorder.getCurrentDeployment().getParamConverterProviders()
.getParamConverterProviders();
for (var provider : providers) {
all.add(new ResteasyReactiveParamConverterProvider(provider.getClassName(),
provider.getPriority()));
JsonObject m = new JsonObject();
m.put("className", provider.getClassName());
m.put("priority", provider.getPriority());
all.add(m);
}
return all;
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.stream.Collectors;

import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.ext.MessageBodyWriter;
Expand Down Expand Up @@ -36,9 +35,7 @@ public static class EndpointScore {
public final String httpMethod;
public final String fullPath;
public final List<MediaType> produces;
public final List<String> producesHeaders;
public final List<MediaType> consumes;
public final List<String> consumesHeaders;
public final Map<Category, List<Diagnostic>> diagnostics;
public final int score;
public final List<RequestFilterEntry> requestFilterEntries;
Expand All @@ -50,13 +47,7 @@ public EndpointScore(String className, String httpMethod, String fullPath, List<
this.httpMethod = httpMethod;
this.fullPath = fullPath;
this.produces = produces;
this.producesHeaders = produces.stream()
.map(MediaType::toString)
.collect(Collectors.toList());
this.consumes = consumes;
this.consumesHeaders = consumes.stream()
.map(MediaType::toString)
.collect(Collectors.toList());
this.diagnostics = diagnostics;
this.score = score;
this.requestFilterEntries = requestFilterEntries;
Expand Down

0 comments on commit 878643a

Please sign in to comment.