Skip to content

Commit

Permalink
Calculate Kafka dev ui RPC path from current window, for custom http …
Browse files Browse the repository at this point in the history
…root path

Fixes #30029
  • Loading branch information
ozangunalp committed Jan 3, 2023
1 parent 8c7d075 commit 5e311b2
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
export const api = '/q/dev/io.quarkus.quarkus-kafka-client/kafka-admin';
export const api = () => {
let path = window.location.pathname
return path.replace('/kafka-dev-ui', '/kafka-admin')
}
export const ui = 'kafka-ui';
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {api} from "../config.js"

export function doPost(data, successCallback, errorCallback) {
$.ajax({
url: api,
url: api(),
type: 'POST',
data: JSON.stringify(data),
contentType: "application/json; charset=utf-8",
Expand Down
5 changes: 5 additions & 0 deletions integration-tests/devmode/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@
<artifactId>quarkus-grpc-deployment</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-kafka-client-deployment</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy-reactive-qute-deployment</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package io.quarkus.test.devconsole;

import org.hamcrest.Matchers;
import org.jboss.shrinkwrap.api.asset.StringAsset;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;

import io.quarkus.test.QuarkusDevModeTest;
import io.restassured.RestAssured;

/**
* Note that this test cannot be placed under the relevant {@code -deployment} module because then the DEV UI processor would
* not be able to locate the template resources correctly.
*/
public class DevConsoleKafkaSmokeTest {

@RegisterExtension
static final QuarkusDevModeTest config = new QuarkusDevModeTest()
.withApplicationRoot(
(jar) -> jar.addAsResource(new StringAsset("quarkus.http.root-path=testing"), "application.properties"));

@Test
public void testServices() {
RestAssured.get("testing/q/dev/io.quarkus.quarkus-kafka-client/kafka-dev-ui")
.then()
.statusCode(200).body(Matchers.containsString("Kafka Dev UI"));
}

}

0 comments on commit 5e311b2

Please sign in to comment.