diff --git a/extensions/kafka-client/deployment/pom.xml b/extensions/kafka-client/deployment/pom.xml index a7da8dfa0277f..83ff1869de99b 100644 --- a/extensions/kafka-client/deployment/pom.xml +++ b/extensions/kafka-client/deployment/pom.xml @@ -44,10 +44,7 @@ io.quarkus quarkus-caffeine-deployment - - io.quarkus - quarkus-vertx-http-dev-console-spi - + org.testcontainers testcontainers diff --git a/extensions/kafka-client/deployment/src/main/java/io/quarkus/kafka/client/deployment/KafkaProcessor.java b/extensions/kafka-client/deployment/src/main/java/io/quarkus/kafka/client/deployment/KafkaProcessor.java index 6c65a0c64e0a2..625b9da04fced 100644 --- a/extensions/kafka-client/deployment/src/main/java/io/quarkus/kafka/client/deployment/KafkaProcessor.java +++ b/extensions/kafka-client/deployment/src/main/java/io/quarkus/kafka/client/deployment/KafkaProcessor.java @@ -72,7 +72,6 @@ import io.quarkus.deployment.builditem.ExtensionSslNativeSupportBuildItem; import io.quarkus.deployment.builditem.FeatureBuildItem; import io.quarkus.deployment.builditem.IndexDependencyBuildItem; -import io.quarkus.deployment.builditem.LaunchModeBuildItem; import io.quarkus.deployment.builditem.LogCategoryBuildItem; import io.quarkus.deployment.builditem.RunTimeConfigurationDefaultBuildItem; import io.quarkus.deployment.builditem.RuntimeConfigSetupCompleteBuildItem; @@ -87,17 +86,13 @@ import io.quarkus.deployment.pkg.builditem.CurateOutcomeBuildItem; import io.quarkus.deployment.pkg.builditem.NativeImageRunnerBuildItem; import io.quarkus.deployment.pkg.steps.NativeOrNativeSourcesBuild; -import io.quarkus.dev.spi.DevModeType; -import io.quarkus.devconsole.spi.DevConsoleRouteBuildItem; -import io.quarkus.devconsole.spi.DevConsoleWebjarBuildItem; import io.quarkus.kafka.client.runtime.KafkaAdminClient; import io.quarkus.kafka.client.runtime.KafkaBindingConverter; import io.quarkus.kafka.client.runtime.KafkaRecorder; import io.quarkus.kafka.client.runtime.KafkaRuntimeConfigProducer; import io.quarkus.kafka.client.runtime.SnappyRecorder; -import io.quarkus.kafka.client.runtime.ui.KafkaTopicClient; -import io.quarkus.kafka.client.runtime.ui.KafkaUiRecorder; -import io.quarkus.kafka.client.runtime.ui.KafkaUiUtils; +import io.quarkus.kafka.client.runtime.devui.KafkaTopicClient; +import io.quarkus.kafka.client.runtime.devui.KafkaUiUtils; import io.quarkus.kafka.client.serialization.BufferDeserializer; import io.quarkus.kafka.client.serialization.BufferSerializer; import io.quarkus.kafka.client.serialization.JsonArrayDeserializer; @@ -108,7 +103,6 @@ import io.quarkus.kafka.client.serialization.JsonbSerializer; import io.quarkus.kafka.client.serialization.ObjectMapperDeserializer; import io.quarkus.kafka.client.serialization.ObjectMapperSerializer; -import io.quarkus.maven.dependency.GACT; import io.quarkus.smallrye.health.deployment.spi.HealthBuildItem; public class KafkaProcessor { @@ -158,11 +152,6 @@ public class KafkaProcessor { static final DotName PARTITION_ASSIGNER = DotName .createSimple("org.apache.kafka.clients.consumer.internals.PartitionAssignor"); - private static final GACT DEVCONSOLE_WEBJAR_ARTIFACT_KEY = new GACT("io.quarkus", - "quarkus-kafka-client-deployment", null, "jar"); - private static final String DEVCONSOLE_WEBJAR_STATIC_RESOURCES_PATH = "dev-static/"; - public static final String KAFKA_ADMIN_PATH = "kafka-admin"; - public static final String KAFKA_RESOURCES_ROOT_PATH = "kafka-ui"; @BuildStep FeatureBuildItem feature() { @@ -556,33 +545,6 @@ public AdditionalBeanBuildItem kafkaClientBeans() { .build(); } - @BuildStep(onlyIf = IsDevelopment.class) - @Record(ExecutionTime.RUNTIME_INIT) - public void registerKafkaUiExecHandler( - Capabilities capabilities, - BuildProducer routeProducer, - KafkaUiRecorder recorder) { - if (capabilities.isPresent(Capability.VERTX_HTTP)) { - routeProducer.produce(DevConsoleRouteBuildItem.builder() - .method("POST") - .handler(recorder.kafkaControlHandler()) - .path(KAFKA_ADMIN_PATH) - .bodyHandlerRequired() - .build()); - } - } - - @BuildStep(onlyIf = IsDevelopment.class) - public DevConsoleWebjarBuildItem setupWebJar(LaunchModeBuildItem launchModeBuildItem) { - if (launchModeBuildItem.getDevModeType().orElse(null) != DevModeType.LOCAL) { - return null; - } - return DevConsoleWebjarBuildItem.builder().artifactKey(DEVCONSOLE_WEBJAR_ARTIFACT_KEY) - .root(DEVCONSOLE_WEBJAR_STATIC_RESOURCES_PATH) - .routeRoot(KAFKA_RESOURCES_ROOT_PATH) - .build(); - } - public static final class HasSnappy implements BooleanSupplier { private final KafkaBuildTimeConfig config; diff --git a/extensions/kafka-client/deployment/src/main/resources/dev-static/js/config.js b/extensions/kafka-client/deployment/src/main/resources/dev-static/js/config.js deleted file mode 100644 index 913a6d4f8fc73..0000000000000 --- a/extensions/kafka-client/deployment/src/main/resources/dev-static/js/config.js +++ /dev/null @@ -1,5 +0,0 @@ -export const api = () => { - let path = window.location.pathname - return path.replace('/kafka-dev-ui', '/kafka-admin') -} -export const ui = 'kafka-ui'; \ No newline at end of file diff --git a/extensions/kafka-client/deployment/src/main/resources/dev-static/js/kafka_ui.js b/extensions/kafka-client/deployment/src/main/resources/dev-static/js/kafka_ui.js deleted file mode 100644 index 36667854c1944..0000000000000 --- a/extensions/kafka-client/deployment/src/main/resources/dev-static/js/kafka_ui.js +++ /dev/null @@ -1,9 +0,0 @@ -import Navigator from './pages/navigator.js' - -const navigator = new Navigator(); -$(document).ready( - () => { - navigator.navigateToDefaultPage(); - } -); - diff --git a/extensions/kafka-client/deployment/src/main/resources/dev-static/js/pages/accessControlListPage.js b/extensions/kafka-client/deployment/src/main/resources/dev-static/js/pages/accessControlListPage.js deleted file mode 100644 index 1afb4964712d8..0000000000000 --- a/extensions/kafka-client/deployment/src/main/resources/dev-static/js/pages/accessControlListPage.js +++ /dev/null @@ -1,49 +0,0 @@ -import {doPost, errorPopUp} from "../web/web.js"; -import {createTableItem} from "../util/contentManagement.js"; -import {toggleSpinner} from "../util/spinner.js"; - -export default class AccessControlListPage { - constructor(containerId) { - this.containerId = containerId; - Object.getOwnPropertyNames(AccessControlListPage.prototype).forEach((key) => { - if (key !== 'constructor') { - this[key] = this[key].bind(this); - } - }); - } - - - open() { - const req = { - action: "getAclInfo" - }; - - toggleSpinner(this.containerId); - - doPost(req, (data) => { - this.updateInfo(data); - toggleSpinner(this.containerId); - }, data => { - errorPopUp("Error getting Kafka ACL info: ", data); - }); - } - - updateInfo(data) { - $('#acluster-id').html(data.clusterId); - $('#acluster-controller').html(data.broker); - $('#acluster-acl').html(data.aclOperations); - - const acls = data.entries; - let aclTable = $('#acl-table tbody'); - aclTable.empty(); - for (let i = 0; i < acls.length; i++) { - const e = acls[i]; - let tableRow = $(""); - tableRow.append(createTableItem(e.operation)); - tableRow.append(createTableItem(e.principal)); - tableRow.append(createTableItem(e.perm)); - tableRow.append(createTableItem(e.pattern)); - aclTable.append(tableRow); - } - } -} \ No newline at end of file diff --git a/extensions/kafka-client/deployment/src/main/resources/dev-static/js/pages/consumerGroupDetailsPage.js b/extensions/kafka-client/deployment/src/main/resources/dev-static/js/pages/consumerGroupDetailsPage.js deleted file mode 100644 index 3766588ce9292..0000000000000 --- a/extensions/kafka-client/deployment/src/main/resources/dev-static/js/pages/consumerGroupDetailsPage.js +++ /dev/null @@ -1,85 +0,0 @@ -import {CollapseRow, createTableHead, createTableItem, createTableItemHtml} from "../util/contentManagement.js"; - -export default class ConsumerGroupDetailsPage { - constructor(containerId) { - this.containerId = containerId; - Object.getOwnPropertyNames(ConsumerGroupDetailsPage.prototype).forEach((key) => { - if (key !== 'constructor') { - this[key] = this[key].bind(this); - } - }); - } - - open(params) { - const membersData = params[1]; - let consumerGroupsTable = $('#consumer-group-details-table tbody'); - consumerGroupsTable.empty(); - for (let i = 0; i < membersData.length; i++) { - const d = membersData[i]; - const groupId = "group-" + d.memberId; - - let tableRow = $(""); - let collapseRow; - if (d.partitions.length > 0) { - collapseRow = new CollapseRow(groupId); - tableRow.append(createTableItemHtml(collapseRow.arrow)); - } else { - tableRow.append(createTableItem("")); - } - - const memberId = $("") - .text(d.clientId); - const id = d.memberId.substring(d.clientId.length); - const text = $("

") - .append(memberId) - .append(id); - tableRow.append(createTableItemHtml(text)); - tableRow.append(createTableItem(d.host)); - tableRow.append(createTableItem("" + new Set(d.partitions.map(x => x.partition)).size)); - tableRow.append(createTableItem("" + d.partitions.map(x => x.lag).reduce((l, r) => l + r, 0))); - - if (d.partitions.length > 0) { - const content = this.createConsumerGroupCollapseInfo(d); - tableRow.addClass("pointer") - tableRow.click(() => collapseRow.collapse()); - consumerGroupsTable.append(tableRow); - consumerGroupsTable.append(collapseRow - .getCollapseContent(tableRow.children().length, content) - .addClass("no-hover")); - } else { - consumerGroupsTable.append(tableRow); - } - } - } - - createConsumerGroupCollapseInfo(dataItem) { - const collapseContent = $("") - .addClass("table") - .addClass("table-sm") - .addClass("no-hover"); - - const headers = $("") - .addClass("no-hover") - .append(createTableHead("Topic")) - .append(createTableHead("Partition")) - .append(createTableHead("Lag")); - const head = $("") - .append(headers); - - const body = $(""); - for (let partition of dataItem.partitions) { - const row = $("") - .addClass("no-hover"); - row.append(createTableItemHtml(partition.topic)) - row.append(createTableItemHtml(partition.partition)) - row.append(createTableItemHtml(partition.lag)) - body.append(row); - } - - collapseContent.append(head); - collapseContent.append(body); - - return collapseContent; - } - -} \ No newline at end of file diff --git a/extensions/kafka-client/deployment/src/main/resources/dev-static/js/pages/consumerGroupPage.js b/extensions/kafka-client/deployment/src/main/resources/dev-static/js/pages/consumerGroupPage.js deleted file mode 100644 index 51928af67a7e3..0000000000000 --- a/extensions/kafka-client/deployment/src/main/resources/dev-static/js/pages/consumerGroupPage.js +++ /dev/null @@ -1,47 +0,0 @@ -import {createTableItem} from "../util/contentManagement.js"; -import {doPost, errorPopUp} from "../web/web.js"; -import {pages} from "./navigator.js"; -import {toggleSpinner} from "../util/spinner.js"; - -export default class ConsumerGroupPage { - constructor(navigator, containerId) { - this.containerId = containerId; - this.navigator = navigator; - Object.getOwnPropertyNames(ConsumerGroupPage.prototype).forEach((key) => { - if (key !== 'constructor') { - this[key] = this[key].bind(this); - } - }); - } - - open() { - toggleSpinner(this.containerId); - const req = { - action: "getInfo", key: "0", value: "0" - }; - doPost(req, (data) => { - this.updateConsumerGroups(data.consumerGroups); - toggleSpinner(this.containerId); - }, data => { - errorPopUp("Error getting Kafka info: ", data); - toggleSpinner(this.containerId); - }); - } - - updateConsumerGroups(data) { - let consumerGroupsTable = $('#consumer-groups-table tbody'); - consumerGroupsTable.empty(); - for (let i = 0; i < data.length; i++) { - const d = data[i]; - let tableRow = $(""); - tableRow.append(createTableItem(d.state)); - tableRow.append(createTableItem(d.name)); - tableRow.append(createTableItem(d.coordinatorId)); - tableRow.append(createTableItem(d.protocol)); - tableRow.append(createTableItem(d.members.length)); - tableRow.append(createTableItem(d.lag)); - tableRow.click(() => this.navigator.navigateTo(pages.CONSUMER_GROUPS_DETAILS, [d.name, d.members])); - consumerGroupsTable.append(tableRow); - } - } -} \ No newline at end of file diff --git a/extensions/kafka-client/deployment/src/main/resources/dev-static/js/pages/messagesPage.js b/extensions/kafka-client/deployment/src/main/resources/dev-static/js/pages/messagesPage.js deleted file mode 100644 index d2857ee9526f5..0000000000000 --- a/extensions/kafka-client/deployment/src/main/resources/dev-static/js/pages/messagesPage.js +++ /dev/null @@ -1,512 +0,0 @@ -import {doPost, errorPopUp} from "../web/web.js"; -import timestampToFormattedString from "../util/datetimeUtil.js"; -import {CollapseRow, createTableItem, createTableItemHtml} from "../util/contentManagement.js"; -import {toggleSpinner} from "../util/spinner.js"; - -const MODAL_KEY_TAB = "header-key-tab-pane"; -const PAGE_SIZE = 20; -const NEW_FIRST = "NEW_FIRST"; -const OLD_FIRST = "OLD_FIRST"; -const MESSAGES_SPINNER = "message-load-spinner"; -const MESSAGES_TABLE_BODY = "msg-table-body"; -const MESSAGES_TABLE_HOLDER = "msg-table-holder"; - -export default class MessagesPage { - constructor(containerId) { - this.containerId = containerId; - this.registerButtonHandlers(); - Object.getOwnPropertyNames(MessagesPage.prototype).forEach((key) => { - if (key !== 'constructor') { - this[key] = this[key].bind(this); - } - }); - } - - registerButtonHandlers() { - $("#open-create-msg-modal-btn").click(() => { - $('#create-msg-modal').modal('show'); - this.setActiveTab(MODAL_KEY_TAB); - }); - - $('#send-msg-btn').click(this.createMessage.bind(this)); - - $('#add-msg-header-btn').click(() => { - const headersTab = document.querySelector('#headers-list-tab-pane'); - let blankHeader = document.createElement('div'); - blankHeader.className = 'input-group top-margin'; - blankHeader.innerHTML = ` - - - - - ` - - const addedHeader = headersTab.insertBefore(blankHeader, headersTab.lastElementChild); - addedHeader.querySelector('span.msg-header-delete').addEventListener('click', (e) => { - headersTab.removeChild(addedHeader); - e.stopPropagation(); - }); - }); - - $('.close-modal-btn').click(() => { - $('.modal').modal('hide'); - this.setActiveTab(MODAL_KEY_TAB); - }); - - $('#msg-page-partition-select').multiselect({ - buttonClass: 'thead-multiselect', - includeSelectAllOption: true, - filterPlaceholder: 'Partitions', - selectAllText: 'Select All', - nonSelectedText: 'Partitions', - buttonText: function () { - return 'Partitions'; - } - }); - - $("#timestamp-sort-header").click(() => { - this.toggleSorting(); - window.currentContext.currentPage = 1; - this.loadMessages(); - }); - - $("#msg-page-partition-select").change(() => { - window.currentContext.currentPage = 1; - this.loadMessages(); - }); - - $(".previous").click(() => { - if (window.currentContext.currentPage === 1) return; - window.currentContext.currentPage = window.currentContext.currentPage - 1; - this.loadMessages(); - }) - - $(".next").click(() => { - if (window.currentContext.currentPage === this.getMaxPageNumber()) return; - window.currentContext.currentPage = window.currentContext.currentPage + 1; - this.loadMessages(); - }) - - $("#reload-msg-btn").click(() => { - currentContext.pagesCache = new Map(); - this.loadMessages(); - }); - } - - toggleSorting() { - if (currentContext.currentSorting === NEW_FIRST) { - currentContext.currentSorting = OLD_FIRST; - $("#timestamp-sort-icon") - .removeClass("bi-chevron-double-down") - .addClass("bi-chevron-double-up"); - } else { - currentContext.currentSorting = NEW_FIRST; - $("#timestamp-sort-icon") - .addClass("bi-chevron-double-down") - .removeClass("bi-chevron-double-up"); - } - } - - loadMessages() { - toggleSpinner(MESSAGES_TABLE_HOLDER, MESSAGES_SPINNER); - this.getPage(currentContext.currentPage, this.onMessagesLoaded, this.onMessagesFailed); - this.redrawPageNav(); - } - - open(params) { - toggleSpinner(MESSAGES_TABLE_HOLDER, MESSAGES_SPINNER); - const topicName = params[0]; - window.currentContext = { - topicName: topicName, - currentPage: 1, //always start with first page - pagesCache: new Map(), - currentSorting: NEW_FIRST - }; - - this.clearMessageTable(); - - new Promise((resolve, reject) => { - this.requestPartitions(topicName, resolve, reject); - }).then((data) => { - this.onPartitionsLoaded(data); - return new Promise((resolve) => { - setTimeout(() => { - resolve(); - }, 1000); - }); - }).then(() => { - this.loadMaxPageNumber(); - return new Promise((resolve) => { - setTimeout(() => { - resolve(); - }, 1000); - }); - }).then(() => { - this.getPage(currentContext.currentPage, this.onMessagesLoaded, this.onMessagesFailed); - return new Promise((resolve) => { - setTimeout(() => { - resolve(); - }, 1000); - }); - }) - .catch(() => errorPopUp("Failed loading page.")); - } - - // Key format: ORDER-partition1-partition2-...-partitionN-pageNumber. Like: NEW_FIRST-0-1-17 - generateCacheKey(pageNumber) { - const order = this.getOrder(); - const partitions = this.getPartitions(); - const partitionsKeyPart = partitions.reduce((partialKey, str) => partialKey + "-" + str, 0); - - return order + partitionsKeyPart + "-" + pageNumber; - } - - requestPartitions(topicName, onPartitionsLoaded, onPartitionsFailed) { - const rq = { - action: "getPartitions", topicName: topicName - } - - doPost(rq, onPartitionsLoaded, onPartitionsFailed); - } - - onPartitionsLoaded(data) { - let msgModalPartitionSelect = $('#msg-modal-partition-select'); - let msgPagePartitionSelect = $('#msg-page-partition-select'); - msgModalPartitionSelect.empty(); - msgPagePartitionSelect.empty(); - - msgModalPartitionSelect.append($(""); - const groupId = "group-" + window.crypto.randomUUID(); - const collapseRow = new CollapseRow(groupId); - tableRow.append(createTableItemHtml(collapseRow.arrow)); - - tableRow.append(createTableItem(messages[i].offset)); - tableRow.append(createTableItem(messages[i].partition)); - tableRow.append(createTableItem(timestampToFormattedString(messages[i].timestamp))); - tableRow.append(createTableItemHtml(this.formatOrPlaceholder(messages[i].key))); - - const value = messages[i].value; - const maxMsgLength = 75; - if (value.length < maxMsgLength) { - tableRow.append(createTableItemHtml(this.formatOrPlaceholder(value))); - } else { - tableRow.append(createTableItemHtml(this.formatOrPlaceholder(value.slice(0, maxMsgLength) + "..."))); - } - tableRow.append(createTableItem()); - tableRow - .addClass("pointer") - .click(collapseRow.collapse); - msgTableBody.append(tableRow); - msgTableBody.append(collapseRow.getCollapseContent(tableRow.children().length, this.createMessageCollapseItem(value, messages[i].headers))); - } - - currentContext.lastOffset = data.partitionOffset; - toggleSpinner(MESSAGES_TABLE_HOLDER, MESSAGES_SPINNER); - } - - /** - * @param {string} value - */ - formatOrPlaceholder(value) { - if (value == null) { - return `null`; - } - if (value.length == 0) { - return `empty` - } - return `${value}`; - } - - createMessageCollapseItem(fullMessage, headers) { - let contents = ` -
Message Value
-
${this.formatOrPlaceholder(fullMessage)}
- `; - - for (const [key, value] of Object.entries(headers)) { - contents += ` -
Header: ${this.formatOrPlaceholder(key)}
-
${this.formatOrPlaceholder(value)}
- `; - } - - let item = document.createElement('dl'); - item.innerHTML = contents; - - return $(item); - } - - toggleContent() { - return (event) => { - const textBlock = $(event.target); - const dots = textBlock.find(".dots"); - const hiddenText = textBlock.find(".hidden-text"); - - if (dots.hasClass("hidden")) { - dots.removeClass("hidden"); - dots.addClass("text-shown"); - hiddenText.removeClass("text-shown"); - hiddenText.addClass("hidden"); - } else { - dots.removeClass("text-shown"); - dots.addClass("hidden"); - hiddenText.removeClass("hidden"); - hiddenText.addClass("text-shown"); - } - }; - } - - onMessagesFailed(data, errorType, error) { - console.error("Error getting topic messages"); - } - - requestCreateMessage() { - const topicName = currentContext.topicName; - let partition = $('#msg-modal-partition-select option:selected').val(); - if (partition === 'any') partition = null; - - let valueTextarea = $('#msg-value-textarea'); - let keyTextarea = $('#msg-key-textarea'); - let headers = {}; - - const headersTab = document.querySelector('#headers-list-tab-pane'); - const headerRows = headersTab.querySelectorAll('div.input-group'); - - headerRows.forEach((headerRow) => { - let headerKey = headerRow.querySelector('.msg-header-key'); - let headerValue = headerRow.querySelector('.msg-header-value'); - headers[headerKey.value] = headerValue.value; - }); - - const rq = { - action: "createMessage", - topic: topicName, - partition: partition, - value: valueTextarea.val(), - key: keyTextarea.val(), - headers: headers - }; - - // TODO: print out partitions count on topics page - doPost(rq, data => { - currentContext.pagesCache = new Map(); - new Promise(this.loadMaxPageNumber) - .then(this.loadMessages) - .catch(() => errorPopUp("Failed")); - }, (data, errorType, error) => { - errorPopUp("Failed to reload messages."); - }); - } - - setActiveTab(tab) { - $('.nav-tabs button[href="#' + tab + '"]').click(); - }; - - createMessage() { - this.requestCreateMessage(); - - // Clean inputs for future reuse of modal. - $('#create-msg-modal').modal('hide'); - $('#msg-value-textarea').val(""); - $('#msg-key-textarea').val(""); - $('#msg-modal-partition-select').val("any"); - $('#msg-modal-type-select').val("text"); - - const headersTab = document.querySelector('#headers-list-tab-pane'); - - headersTab.querySelectorAll('div.input-group').forEach((headerRow) => { - headersTab.removeChild(headerRow); - }); - - $('body').removeClass('modal-open'); - $('.modal-backdrop').remove(); - - this.setActiveTab(MODAL_KEY_TAB); - } - - clearMessageTable() { - $('#msg-table-body').empty(); - } - - redrawPageNav() { - //TODO: add GOTO page input - const previous = $(".previous"); - const next = $(".next"); - - previous.removeClass("disabled"); - next.removeClass("disabled"); - - const maxPageNumber = this.getMaxPageNumber(); - const currentPage = currentContext.currentPage; - let pages = [currentPage]; - - if (currentPage > 1) { - pages.unshift(currentPage - 1); - } - if (currentPage < maxPageNumber) { - pages.push(currentPage + 1); - } - - if (currentPage === 1) { - previous.addClass("disabled"); - if (maxPageNumber > 2) { - pages.push(currentPage + 2); - } - } - if (currentPage === maxPageNumber) { - next.addClass("disabled"); - if (maxPageNumber > 2) { - pages.unshift(currentPage - 2); - } - } - - const pagination = $("#msg-pagination"); - - // Remove all page children numbers. - while (pagination.children().length !== 2) { - pagination.children()[1].remove(); - } - - for (const p of pages) { - let a = $("") - .text("" + p) - .addClass("page-link"); - let li = $("
  • ") - .addClass("page-item") - .click(() => { - toggleSpinner(MESSAGES_TABLE_HOLDER, MESSAGES_SPINNER); - currentContext.currentPage = p; - this.getPage(p, this.onMessagesLoaded, this.onMessagesFailed); - this.redrawPageNav(); - }); - - if (p === currentPage) { - li.addClass("active"); - } - li.append(a); - - const lastPosition = pagination.children().length - 1; - li.insertBefore(".next"); - } - } - - requestOffset(topicName, order, onOffsetLoaded, onOffsetFailed, partitions) { - const req = { - action: "getOffset", - topicName: topicName, - order: order, - requestedPartitions: partitions === undefined ? this.getPartitions() : partitions - }; - doPost(req, onOffsetLoaded, onOffsetFailed); - } - - // TODO: add possibility to hide panel on the left - loadMaxPageNumber() { - const partitions = this.getPartitions(); - this.requestOffset( - currentContext.topicName, - NEW_FIRST, - (data) => { - currentContext.partitionOffset = new Map( - Object.entries(data).map(x => [parseInt(x[0]), x[1]]) - ); - this.redrawPageNav(); - }, - (data, errorType, error) => { - console.error("Error getting max page number."); - }, - partitions - ); - } - - getMaxPageNumber() { - const partitions = this.getPartitions(); - const totalElements = partitions.map(x => { - const a = currentContext.partitionOffset.get(x) - return a; - }) - .reduce((partialSum, a) => partialSum + a, 0); - return Math.max(Math.ceil(totalElements / PAGE_SIZE), 1); - } - - getOrder() { - return currentContext.currentSorting; - } - -} \ No newline at end of file diff --git a/extensions/kafka-client/deployment/src/main/resources/dev-static/js/pages/navigator.js b/extensions/kafka-client/deployment/src/main/resources/dev-static/js/pages/navigator.js deleted file mode 100644 index cd5e66615a4aa..0000000000000 --- a/extensions/kafka-client/deployment/src/main/resources/dev-static/js/pages/navigator.js +++ /dev/null @@ -1,175 +0,0 @@ -import MessagesPage from "./messagesPage.js"; -import TopicsPage from "./topicsPage.js"; -import ConsumerGroupPage from "./consumerGroupPage.js"; -import ConsumerGroupDetailsPage from "./consumerGroupDetailsPage.js"; -import AccessControlListPage from "./accessControlListPage.js"; -import NodesPage from "./nodesPage.js"; -import {createIcon} from "../util/contentManagement.js"; - -export const pages = { - TOPICS: "topics-page", - SCHEMA: "schema-page", - CONSUMER_GROUPS: "consumer-groups-page", - CONSUMER_GROUPS_DETAILS: "consumer-groups-details-page", - ACCESS_CONTROL_LIST: "access-control-list-page", - NODES: "nodes-page", - TOPIC_MESSAGES: "topic-messages-page", - DEFAULT: "topics-page" -} - -export default class Navigator { - constructor() { - this.registerNavbar(); - } - - allPages = { - [pages.TOPICS]: { - header: "Topics", - showInNavbar: true, - instance: new TopicsPage(this, pages.TOPICS), - icon: "bi-collection" - }, - [pages.SCHEMA]: { - header: "Schema registry", - showInNavbar: true, - icon: "bi-file-code" - }, - [pages.CONSUMER_GROUPS]: { - header: "Consumer groups", - showInNavbar: true, - instance: new ConsumerGroupPage(this, pages.CONSUMER_GROUPS), - icon: "bi-inboxes" - }, - [pages.ACCESS_CONTROL_LIST]: { - header: "Access control list", - showInNavbar: true, - instance: new AccessControlListPage(pages.ACCESS_CONTROL_LIST), - icon: "bi-shield-lock" - }, - [pages.NODES]: { - header: "Nodes", - showInNavbar: true, - instance: new NodesPage(pages.NODES), - icon: "bi-diagram-3" - }, - [pages.TOPIC_MESSAGES]: { - header: "Messages", - showInNavbar: false, - instance: new MessagesPage(pages.TOPIC_MESSAGES), - parent: pages.TOPICS - }, - [pages.CONSUMER_GROUPS_DETAILS]: { - header: "Consumer group details", - showInNavbar: false, - instance: new ConsumerGroupDetailsPage(pages.CONSUMER_GROUPS_DETAILS), - parent: pages.CONSUMER_GROUPS - } - }; - - registerNavbar() { - const keys = Object.keys(this.allPages); - const navbar = $("#navbar-list"); - navbar.empty(); - - for (let i = 0; i < keys.length; i++) { - const key = keys[i]; - const value = this.allPages[key]; - if (!value.showInNavbar) continue; - const navItem = $("
  • ") - .addClass("nav-item") - .addClass("left-padding") - .addClass("pointer"); - - const navHolder = $("
    ") - .addClass("d-flex") - .addClass("left-margin") - .addClass("nav-row") - .click(() => this.navigateTo(key)); - - const icon = createIcon(value.icon) - .addClass("align-self-center"); - const navLink = $("", { - text: value.header, - href: "#" - }) - .addClass("nav-link") - .addClass("active") - .addClass("link"); - navHolder.append(icon); - navHolder.append(navLink); - navItem.append(navHolder); - navbar.append(navItem); - } - } - - navigateTo(requestedPage, params) { - const keys = Object.keys(this.allPages); - for (let i = 0; i < keys.length; i++) { - const elementName = keys[i]; - const d = $("#" + elementName); - if (d !== null) { - if (elementName !== requestedPage) { - d.removeClass("shown") - .addClass("hidden"); - } else { - d.removeClass("hidden") - .addClass("shown"); - this.open(requestedPage, params); - } - } else { - console.error("Can not find page div: ", keys[i]); - } - } - - this.navigateBreadcrumb(requestedPage, params); - } - - navigateToDefaultPage() { - this.navigateTo(pages.DEFAULT); - } - - open(pageId, params) { - const value = this.allPages[pageId]; - value.instance.open(params); - } - - navigateBreadcrumb(page, params) { - const breadcrumb = $("#nav-breadcrumb"); - breadcrumb.empty(); - - let nextPage = this.allPages[page]; - let pageId = page; - - let i = 0; - while (nextPage !== undefined) { - let li; - // We only need to append possible params to the very first element. - if (i === 0) { - li = this.createBreadcrumbItem(nextPage.header, pageId, true, params); - } else { - li = this.createBreadcrumbItem(nextPage.header, pageId, false); - } - breadcrumb.prepend(li); - pageId = nextPage.parent; - nextPage = this.allPages[pageId]; - i++; - } - } - - createBreadcrumbItem(text, pageId, isActive, params) { - let breadcrumbText = text; - if (params !== undefined && params.length > 0 && (params[0] !== null && params[0] !== undefined)) { - breadcrumbText = text + " (" + params[0] + ")"; - } - const a = $("", {href: "#", text: breadcrumbText}) - .click(() => this.navigateTo(pageId, params)); - if (isActive) { - a.addClass("active"); - } - - const li = $("
  • ") - .addClass("breadcrumb-item"); - li.append(a); - return li; - } -} \ No newline at end of file diff --git a/extensions/kafka-client/deployment/src/main/resources/dev-static/js/pages/nodesPage.js b/extensions/kafka-client/deployment/src/main/resources/dev-static/js/pages/nodesPage.js deleted file mode 100644 index 471214e514133..0000000000000 --- a/extensions/kafka-client/deployment/src/main/resources/dev-static/js/pages/nodesPage.js +++ /dev/null @@ -1,47 +0,0 @@ -import {doPost, errorPopUp} from "../web/web.js"; -import {createTableItem} from "../util/contentManagement.js"; -import {toggleSpinner} from "../util/spinner.js"; - -export default class NodesPage { - constructor(containerId) { - this.containerId = containerId; - Object.getOwnPropertyNames(NodesPage.prototype).forEach((key) => { - if (key !== 'constructor') { - this[key] = this[key].bind(this); - } - }); - } - - open() { - const req = { - action: "getInfo" - }; - - toggleSpinner(this.containerId); - - doPost(req, (data) => { - this.updateInfo(data); - toggleSpinner(this.containerId); - }, data => { - errorPopUp("Error getting Kafka info: ", data); - }); - } - - updateInfo(data) { - $('#cluster-id').html(data.clusterInfo.id); - $('#cluster-controller').html(data.broker); - $('#cluster-acl').html(data.clusterInfo.aclOperations); - - const nodes = data.clusterInfo.nodes; - let clusterNodesTable = $('#cluster-table tbody'); - clusterNodesTable.empty(); - for (let i = 0; i < nodes.length; i++) { - const d = nodes[i]; - let tableRow = $("
  • "); - tableRow.append(createTableItem(d.id)); - tableRow.append(createTableItem(d.host)); - tableRow.append(createTableItem(d.port)); - clusterNodesTable.append(tableRow); - } - } -} \ No newline at end of file diff --git a/extensions/kafka-client/deployment/src/main/resources/dev-static/js/pages/schemaPage.js b/extensions/kafka-client/deployment/src/main/resources/dev-static/js/pages/schemaPage.js deleted file mode 100644 index 82b3f5f8d108c..0000000000000 --- a/extensions/kafka-client/deployment/src/main/resources/dev-static/js/pages/schemaPage.js +++ /dev/null @@ -1,16 +0,0 @@ -export default class SchemaPage{ - constructor(containerId) { - this.containerId = containerId; - Object.getOwnPropertyNames(SchemaPage.prototype).forEach((key) => { - if (key !== 'constructor') { - this[key] = this[key].bind(this); - } - }); - } - - // TODO: stub. must be implemented by all pages - open(){ - - } - -} \ No newline at end of file diff --git a/extensions/kafka-client/deployment/src/main/resources/dev-static/js/pages/topicsPage.js b/extensions/kafka-client/deployment/src/main/resources/dev-static/js/pages/topicsPage.js deleted file mode 100644 index 28156717578c8..0000000000000 --- a/extensions/kafka-client/deployment/src/main/resources/dev-static/js/pages/topicsPage.js +++ /dev/null @@ -1,188 +0,0 @@ -import {doPost, errorPopUp} from "../web/web.js"; -import {createIcon, createTableItem, createTableItemHtml, hideItem, showItem} from "../util/contentManagement.js"; -import {pages} from "./navigator.js"; - -export default class TopicsPage { - constructor(navigator, containerId) { - this.navigator = navigator; - this.containerId = containerId; - this.registerButtonHandlers(); - - // TODO: move to common function with comment - Object.getOwnPropertyNames(TopicsPage.prototype).forEach((key) => { - if (key !== 'constructor') { - this[key] = this[key].bind(this); - } - }); - } - - open() { - window.currentContext = {}; - this.requestTopics(this.onTopicsLoaded, this.onTopicsFailed); - } - - registerButtonHandlers() { - - const topicNameInput = $("#topic-name-modal-input"); - $("#create-topic-btn").click(() => { - if (!this.validateTopicName(topicNameInput.val())) { - this.showErrorIfInvalid(topicNameInput.val(), this.validateTopicName, topicNameValidationErrorBox); - return; - } - - this.createTopic(this.onTopicsLoaded, this.onTopicsFailed); - $('#create-topic-modal').modal('hide'); - $('#topic-name-modal-input').val(""); - $('#partitions-modal-input').val(""); - $('#replications-modal-input').val(""); - }) - - $("#open-create-topic-modal-btn").click(() => { - this.loadNodesCount(); - $('#create-topic-modal').modal('show'); - }); - - $('.close-modal-btn').click(() => { - hideItem($(".modal")); - hideItem($("#topic-creation-validation-msg-box")); - hideItem($("#topic-name-validation-msg")); - hideItem($("#replication-validation-msg")); - }); - - $("#delete-topic-btn").click(() => { - const currentTopic = window.currentContext.topicName; - this.deleteTopic(currentTopic, this.deleteTopicRow, this.onTopicsFailed) - $("#delete-topic-modal").modal("hide"); - }); - - const topicNameValidationErrorBox = $("#topic-name-validation-msg"); - topicNameInput.keyup(() => this.showErrorIfInvalid(topicNameInput.val(), this.validateTopicName, topicNameValidationErrorBox)); - topicNameInput.change(() => this.showErrorIfInvalid(topicNameInput.val(), this.validateTopicName, topicNameValidationErrorBox)); - - const replicationInput = $("#replications-modal-input"); - replicationInput.keyup(() => { - const value = replicationInput.val(); - this.showErrorIfInvalid(value, this.validateReplicationFactor, $("#replication-validation-msg")); - }); - } - - loadNodesCount() { - const req = { - action: "getInfo" - }; - doPost(req, (data) => { - window.currentContext.nodesCount = data.clusterInfo.nodes.length; - }, data => { - errorPopUp("Could not obtain nodes count."); - }); - } - - showErrorIfInvalid(value, validationFunction, errBoxSelector) { - const valid = validationFunction(value); - if (!valid) { - showItem($("#topic-creation-validation-msg-box")); - showItem(errBoxSelector); - $("#create-topic-btn") - .addClass("disabled") - .attr("disabled", true); - } else { - hideItem(errBoxSelector); - const topicMsgValidationBoxChildren = $("#topic-creation-validation-msg-box span"); - const allChildrenHidden = topicMsgValidationBoxChildren - .filter((x) => !$(x).hasClass("hidden")) - .length > 0; - if (allChildrenHidden) { - hideItem($("#topic-creation-validation-msg-box")); - $("#create-topic-btn") - .removeClass("disabled") - .attr("disabled", false); - } - } - } - - validateTopicName(name) { - const legalChars = /^[a-zA-Z\d\.\_]+$/; - const maxNameLength = 255; - return legalChars.test(name) && name.length < maxNameLength; - } - - validateReplicationFactor(replicationFactor) { - return currentContext.nodesCount >= replicationFactor; - } - - requestTopics(onTopicsLoaded, onTopicsFailed) { - const req = { - action: "getTopics" - }; - doPost(req, onTopicsLoaded, onTopicsFailed); - } - - onTopicsLoaded(data) { - let tableBody = $('#topics-table tbody'); - tableBody.empty(); - - for (let i = 0; i < data.length; i++) { - let tableRow = $(""); - let d = data[i]; - tableRow.append(createTableItem(d.name)); - tableRow.append(createTableItem(d.topicId)); - tableRow.append(createTableItem(d.partitionsCount)); - tableRow.append(createTableItem(("" + d.nmsg))); - - const deleteIcon = createIcon("bi-trash-fill"); - const deleteBtn = $("") - .addClass("btn") - .click((event) => { - window.currentContext.topicName = d.name; - $("#delete-topic-modal").modal("show"); - $("#delete-topic-name-span").text(d.name); - event.stopPropagation(); - }) - .append(deleteIcon); - - - tableRow.click(() => { - self.navigator.navigateTo(pages.TOPIC_MESSAGES, [d.name]); - }); - const controlHolder = $("
    ") - .append(deleteBtn); - tableRow.append(createTableItemHtml(controlHolder)); - - const self = this; - - tableBody.append(tableRow); - } - } - - onTopicsFailed(data) { - errorPopUp("Error getting topics: ", data); - } - - createTopic(onTopicsLoaded, onTopicsFailed) { - const topicName = $("#topic-name-modal-input").val(); - const partitions = $("#partitions-modal-input").val(); - const replications = $("#replications-modal-input").val(); - - const req = { - action: "createTopic", - topicName: topicName, - partitions: partitions, - replications: replications - }; - doPost(req, () => this.requestTopics(this.onTopicsLoaded, this.onTopicsFailed), onTopicsFailed); - } - - // TODO: add pagination here - deleteTopic(topicName, onTopicsDeleted, onTopicsFailed) { - const req = { - action: "deleteTopic", - key: topicName - }; - doPost(req, onTopicsDeleted, onTopicsFailed); - } - - deleteTopicRow(data) { - const topicName = window.currentContext.topicName; - $("#topics-table > tbody > tr > td:contains('" + topicName + "')").parent().remove() - } -} \ No newline at end of file diff --git a/extensions/kafka-client/deployment/src/main/resources/dev-static/js/util/contentManagement.js b/extensions/kafka-client/deployment/src/main/resources/dev-static/js/util/contentManagement.js deleted file mode 100644 index d9f87034ab8dd..0000000000000 --- a/extensions/kafka-client/deployment/src/main/resources/dev-static/js/util/contentManagement.js +++ /dev/null @@ -1,75 +0,0 @@ -export function createTableItem(text) { - return $("
    ").append(createTableItemHtml( - collapseContent - .addClass("collapse-content")) - .attr("colspan", tableWidth)) - .attr("id", this.collapseId) - .addClass("collapse"); - } - - collapse() { - $("#" + this.collapseId).toggle(); - if (this.arrow.hasClass("icon-rotated")) { - this.arrow.removeClass("icon-rotated"); - } else { - this.arrow.addClass("icon-rotated"); - } - } -} - -export function showItem(selector){ - selector.addClass("shown") - .removeClass("hidden"); -} - -export function hideItem(selector){ - selector.addClass("hidden") - .removeClass("shown"); -} - -export function toggleItem(selector) { - if (selector.hasClass("shown")) { - hideItem(selector); - } else { - showItem(selector); - } -} \ No newline at end of file diff --git a/extensions/kafka-client/deployment/src/main/resources/dev-static/js/util/datetimeUtil.js b/extensions/kafka-client/deployment/src/main/resources/dev-static/js/util/datetimeUtil.js deleted file mode 100644 index 384d693bde861..0000000000000 --- a/extensions/kafka-client/deployment/src/main/resources/dev-static/js/util/datetimeUtil.js +++ /dev/null @@ -1,17 +0,0 @@ -function addTrailingZero(data) { - if (data < 10) { - return "0" + data; - } - return data; -} - -export default function timestampToFormattedString(UNIX_timestamp) { - const a = new Date(UNIX_timestamp); - const year = a.getFullYear(); - const month = addTrailingZero(a.getMonth()); - const date = addTrailingZero(a.getDate()); - const hour = addTrailingZero(a.getHours()); - const min = addTrailingZero(a.getMinutes()); - const sec = addTrailingZero(a.getSeconds()); - return date + '/' + month + '/' + year + ' ' + hour + ':' + min + ':' + sec; -} \ No newline at end of file diff --git a/extensions/kafka-client/deployment/src/main/resources/dev-static/js/util/spinner.js b/extensions/kafka-client/deployment/src/main/resources/dev-static/js/util/spinner.js deleted file mode 100644 index a5ca80594e44f..0000000000000 --- a/extensions/kafka-client/deployment/src/main/resources/dev-static/js/util/spinner.js +++ /dev/null @@ -1,21 +0,0 @@ -export function toggleSpinner(containerId, spinnerContainerId) { - const spinnerId = spinnerContainerId === undefined ? "#page-load-spinner" : "#" + spinnerContainerId; - const toggleContainerId = "#" + containerId; - let first; - let second; - - if ($(spinnerId).hasClass("shown")) { - first = toggleContainerId; - second = spinnerId; - } else { - second = toggleContainerId; - first = spinnerId; - } - - $(first) - .removeClass("hidden") - .addClass("shown"); - $(second) - .addClass("hidden") - .removeClass("shown"); -} \ No newline at end of file diff --git a/extensions/kafka-client/deployment/src/main/resources/dev-static/js/web/web.js b/extensions/kafka-client/deployment/src/main/resources/dev-static/js/web/web.js deleted file mode 100644 index c981bf9e24a86..0000000000000 --- a/extensions/kafka-client/deployment/src/main/resources/dev-static/js/web/web.js +++ /dev/null @@ -1,22 +0,0 @@ -import {api} from "../config.js" - -export function doPost(data, successCallback, errorCallback) { - $.ajax({ - url: api(), - type: 'POST', - data: JSON.stringify(data), - contentType: "application/json; charset=utf-8", - dataType: 'json', - context: this, - success: (data) => successCallback(data), - error: (data, errorType, errorObj) => errorCallback(data, errorType, errorObj) - }); -} - -export function errorPopUp() { - let message = ""; - for (let i = 0; i < arguments.length; i++) { - message += arguments[i] + " "; - } - alert(message); -} diff --git a/extensions/kafka-client/deployment/src/main/resources/dev-templates/embedded.html b/extensions/kafka-client/deployment/src/main/resources/dev-templates/embedded.html deleted file mode 100644 index dac4cf81f4150..0000000000000 --- a/extensions/kafka-client/deployment/src/main/resources/dev-templates/embedded.html +++ /dev/null @@ -1,3 +0,0 @@ - - - Kafka UI diff --git a/extensions/kafka-client/deployment/src/main/resources/dev-templates/kafka-dev-ui.html b/extensions/kafka-client/deployment/src/main/resources/dev-templates/kafka-dev-ui.html deleted file mode 100644 index eba52a501669e..0000000000000 --- a/extensions/kafka-client/deployment/src/main/resources/dev-templates/kafka-dev-ui.html +++ /dev/null @@ -1,522 +0,0 @@ -{#include main fluid=true} -{#style} -html { -min-height: 90vh; -min-width: 100vh; -} - -body { -min-height: 90vh; -min-width: 100vh; -} - -.row-holder { -padding: 0; -margin: 0; - -} - -.row:after { -content: ""; -display: table; -clear: both; -} - -.content-holder { -height: auto; -min-height: 90vh; -} - -.link { -background: none; -border: none; -} - -.top-margin { -margin-top: 1em; -} - -.left-margin { -margin-left: 1em; -} - -.left-padding { -padding-left: 1em; -} - -.shown { -display: flex; -height: auto; -min-width: 100%; -} - -.text-shown { -display: inline; -} - -.hidden { -display: none -} - -.nav-item:hover > .nav-row > a { -background-color: #005fff; -color: #e9ecef; -} - -.nav-item:hover > .nav-row > i { -background-color: #005fff; -color: #e9ecef; -} - -#navbar-list > .nav-item:hover { -background-color: #005fff; -color: #e9ecef; -} - -.table-hover:hover { -cursor: pointer; -} - -.multiselect-container > li > a > label { -padding-left: 15px !important; -} - -.page { -min-height: calc(100vh - 135px); -} - -.table-hover:hover { -cursor: pointer; -} - -.pointer { -cursor: pointer; -} - -.no-hover { -background-color: white; -cursor: default; -} - -.no-hover:hover { -background-color: white !important; -cursor: default; -} - -.icon-rotated { -transform: rotate(90deg); -} - -.navbar-brand img { -border-right: 1px solid darkgrey; -padding-right: 10px; -margin-right: 5px; -} - -.navbar-brand { -padding: 0; -margin: 0; -} - -#nav-menu-panel { -padding: 0px; -} - -.float-plus-btn { -position: fixed; -bottom: 60px; -right: 60px; -border-radius: 100%; -height: 50px; -width: 50px; -} - -.breadcrumb-item::before { -float: left; -padding-right: 0.5rem; -color: #007bff; -content: "〉"; -} - -.breadcrumb-item + .breadcrumb-item::before { -float: left; -padding-right: 0.5rem; -color: #007bff; -content: "〉"; -} - -.breadcrumb { -background-color: #343a40; -margin-bottom: 0; -padding: 0 0 0 5px; -} - -.bi-trash-fill:hover { -color: #007bff; -} - -.collapse-content { -max-width: 1200px; -} - -.thead-multiselect { -background-color: #343a40; -color: white; -border: 0px; -font-weight: bold; -} - -.thead-text { -color: white; -} - -#msg-table-holder { -min-width: 100%; -} -{/style} -{#styleref} - - -{/styleref} -{#scriptref} - - -{/scriptref} -{#title}Kafka Dev UI{/title} -{#body} -
    - - - - - - -
    -
    -
    -
    ", { - text: text - }); -} - -export function createTableItemHtml(html) { - return $("").append(html); -} - -export function createTableHead(title) { - return $("") - .attr("scope", "col") - .text(title); -} - -export function createIcon(iconClass) { - return $("") - .addClass("bi") - .addClass(iconClass); -} - -export class CollapseRow { - constructor(collapseId) { - this.collapseId = collapseId; - const chevronIcon = createIcon("bi-chevron-right") - .addClass("rotate-icon"); - this.arrow = $("
    ") - .addClass("d-flex") - .addClass("justify-content-center") - .append(chevronIcon); - - Object.getOwnPropertyNames(CollapseRow.prototype).forEach((key) => { - if (key !== 'constructor') { - this[key] = this[key].bind(this); - } - }); - } - - getCollapseContent(tableWidth, collapseContent) { - return $("
    - - - - - - - - - - - -
    Topic NameIdPartitions countNumber of msg
    - - - -

    -
    -
    -
    - - - - - - - - - - - - - - -
    Offset - - Timestamp KeyValue
    -
    - -
    -
    - - -
    -
    -
    - - - - - - - - - - - - - -
    StateIdCoordinatorProtocolMembersLag(Sum)
    -
    -
    -
    -
    - - - - - - - - - - - - -
    Member IDHostPartitionsLag(Sum)
    -
    -
    -
    -
    - - - - - - - - - - - -
    OperationPrincipalPermissionResource Pattern
    -
    -
    -
    -
    -
    - Kafka cluster id: 
    - Controller node (broker): 
    - ACL operations: 
    -
    -
    -

    Cluster nodes

    -
    - - - - - - - - - - -
    IdHostPort
    -
    -
    - - - -{/body} -{/include} \ No newline at end of file diff --git a/extensions/kafka-client/runtime/pom.xml b/extensions/kafka-client/runtime/pom.xml index 95c012b382965..ab884b3a9d3a3 100644 --- a/extensions/kafka-client/runtime/pom.xml +++ b/extensions/kafka-client/runtime/pom.xml @@ -59,13 +59,6 @@ provided
    - - io.quarkus - quarkus-vertx-http-dev-console-runtime-spi - - true - - io.quarkus quarkus-junit5-internal diff --git a/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/KafkaAdminClient.java b/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/KafkaAdminClient.java index 7ccef1322f7ee..1600561f3f1ef 100644 --- a/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/KafkaAdminClient.java +++ b/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/KafkaAdminClient.java @@ -15,7 +15,7 @@ import org.apache.kafka.common.acl.AclBindingFilter; import org.apache.kafka.common.resource.ResourcePatternFilter; -import io.quarkus.kafka.client.runtime.ui.model.request.KafkaCreateTopicRequest; +import io.quarkus.kafka.client.runtime.devui.model.request.KafkaCreateTopicRequest; import io.smallrye.common.annotation.Identifier; @ApplicationScoped diff --git a/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/devui/KafkaJsonRPCService.java b/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/devui/KafkaJsonRPCService.java index c1d7a28fc801f..c9d37cbb001e4 100644 --- a/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/devui/KafkaJsonRPCService.java +++ b/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/devui/KafkaJsonRPCService.java @@ -8,16 +8,15 @@ import jakarta.inject.Inject; import io.quarkus.kafka.client.runtime.KafkaAdminClient; -import io.quarkus.kafka.client.runtime.ui.KafkaUiUtils; -import io.quarkus.kafka.client.runtime.ui.model.Order; -import io.quarkus.kafka.client.runtime.ui.model.request.KafkaCreateTopicRequest; -import io.quarkus.kafka.client.runtime.ui.model.request.KafkaMessageCreateRequest; -import io.quarkus.kafka.client.runtime.ui.model.request.KafkaMessagesRequest; -import io.quarkus.kafka.client.runtime.ui.model.request.KafkaOffsetRequest; -import io.quarkus.kafka.client.runtime.ui.model.response.KafkaAclInfo; -import io.quarkus.kafka.client.runtime.ui.model.response.KafkaInfo; -import io.quarkus.kafka.client.runtime.ui.model.response.KafkaMessagePage; -import io.quarkus.kafka.client.runtime.ui.model.response.KafkaTopic; +import io.quarkus.kafka.client.runtime.devui.model.Order; +import io.quarkus.kafka.client.runtime.devui.model.request.KafkaCreateTopicRequest; +import io.quarkus.kafka.client.runtime.devui.model.request.KafkaMessageCreateRequest; +import io.quarkus.kafka.client.runtime.devui.model.request.KafkaMessagesRequest; +import io.quarkus.kafka.client.runtime.devui.model.request.KafkaOffsetRequest; +import io.quarkus.kafka.client.runtime.devui.model.response.KafkaAclInfo; +import io.quarkus.kafka.client.runtime.devui.model.response.KafkaInfo; +import io.quarkus.kafka.client.runtime.devui.model.response.KafkaMessagePage; +import io.quarkus.kafka.client.runtime.devui.model.response.KafkaTopic; public class KafkaJsonRPCService { diff --git a/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/ui/KafkaTopicClient.java b/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/devui/KafkaTopicClient.java similarity index 96% rename from extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/ui/KafkaTopicClient.java rename to extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/devui/KafkaTopicClient.java index c22ab52b4d29d..85d672c2ea45f 100644 --- a/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/ui/KafkaTopicClient.java +++ b/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/devui/KafkaTopicClient.java @@ -1,6 +1,6 @@ -package io.quarkus.kafka.client.runtime.ui; +package io.quarkus.kafka.client.runtime.devui; -import static io.quarkus.kafka.client.runtime.ui.util.ConsumerFactory.createConsumer; +import static io.quarkus.kafka.client.runtime.devui.util.ConsumerFactory.createConsumer; import java.nio.charset.StandardCharsets; import java.time.Duration; @@ -35,10 +35,10 @@ import org.apache.kafka.common.utils.Bytes; import io.quarkus.kafka.client.runtime.KafkaAdminClient; -import io.quarkus.kafka.client.runtime.ui.model.Order; -import io.quarkus.kafka.client.runtime.ui.model.converter.KafkaModelConverter; -import io.quarkus.kafka.client.runtime.ui.model.request.KafkaMessageCreateRequest; -import io.quarkus.kafka.client.runtime.ui.model.response.KafkaMessagePage; +import io.quarkus.kafka.client.runtime.devui.model.Order; +import io.quarkus.kafka.client.runtime.devui.model.converter.KafkaModelConverter; +import io.quarkus.kafka.client.runtime.devui.model.request.KafkaMessageCreateRequest; +import io.quarkus.kafka.client.runtime.devui.model.response.KafkaMessagePage; import io.smallrye.common.annotation.Identifier; @ApplicationScoped diff --git a/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/ui/KafkaUiUtils.java b/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/devui/KafkaUiUtils.java similarity index 88% rename from extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/ui/KafkaUiUtils.java rename to extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/devui/KafkaUiUtils.java index 55d562a4023ac..f08702bc906a9 100644 --- a/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/ui/KafkaUiUtils.java +++ b/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/devui/KafkaUiUtils.java @@ -1,6 +1,6 @@ -package io.quarkus.kafka.client.runtime.ui; +package io.quarkus.kafka.client.runtime.devui; -import static io.quarkus.kafka.client.runtime.ui.util.ConsumerFactory.createConsumer; +import static io.quarkus.kafka.client.runtime.devui.util.ConsumerFactory.createConsumer; import java.io.IOException; import java.io.InputStream; @@ -32,11 +32,20 @@ import io.netty.buffer.ByteBufInputStream; import io.quarkus.kafka.client.runtime.KafkaAdminClient; -import io.quarkus.kafka.client.runtime.ui.model.Order; -import io.quarkus.kafka.client.runtime.ui.model.request.KafkaMessageCreateRequest; -import io.quarkus.kafka.client.runtime.ui.model.request.KafkaMessagesRequest; -import io.quarkus.kafka.client.runtime.ui.model.request.KafkaOffsetRequest; -import io.quarkus.kafka.client.runtime.ui.model.response.*; +import io.quarkus.kafka.client.runtime.devui.model.Order; +import io.quarkus.kafka.client.runtime.devui.model.request.KafkaMessageCreateRequest; +import io.quarkus.kafka.client.runtime.devui.model.request.KafkaMessagesRequest; +import io.quarkus.kafka.client.runtime.devui.model.request.KafkaOffsetRequest; +import io.quarkus.kafka.client.runtime.devui.model.response.KafkaAclEntry; +import io.quarkus.kafka.client.runtime.devui.model.response.KafkaAclInfo; +import io.quarkus.kafka.client.runtime.devui.model.response.KafkaClusterInfo; +import io.quarkus.kafka.client.runtime.devui.model.response.KafkaConsumerGroup; +import io.quarkus.kafka.client.runtime.devui.model.response.KafkaConsumerGroupMember; +import io.quarkus.kafka.client.runtime.devui.model.response.KafkaConsumerGroupMemberPartitionAssignment; +import io.quarkus.kafka.client.runtime.devui.model.response.KafkaInfo; +import io.quarkus.kafka.client.runtime.devui.model.response.KafkaMessagePage; +import io.quarkus.kafka.client.runtime.devui.model.response.KafkaNode; +import io.quarkus.kafka.client.runtime.devui.model.response.KafkaTopic; import io.smallrye.common.annotation.Identifier; import io.vertx.core.buffer.Buffer; import io.vertx.core.json.JsonObject; diff --git a/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/devui/model/Order.java b/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/devui/model/Order.java new file mode 100644 index 0000000000000..d3735ac00bcd8 --- /dev/null +++ b/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/devui/model/Order.java @@ -0,0 +1,6 @@ +package io.quarkus.kafka.client.runtime.devui.model; + +public enum Order { + OLD_FIRST, + NEW_FIRST +} diff --git a/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/ui/model/converter/KafkaModelConverter.java b/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/devui/model/converter/KafkaModelConverter.java similarity index 88% rename from extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/ui/model/converter/KafkaModelConverter.java rename to extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/devui/model/converter/KafkaModelConverter.java index a6fb1653e523d..59101e9c11d9e 100644 --- a/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/ui/model/converter/KafkaModelConverter.java +++ b/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/devui/model/converter/KafkaModelConverter.java @@ -1,4 +1,4 @@ -package io.quarkus.kafka.client.runtime.ui.model.converter; +package io.quarkus.kafka.client.runtime.devui.model.converter; import java.nio.charset.StandardCharsets; import java.util.Map; @@ -10,7 +10,7 @@ import org.apache.kafka.common.header.Header; import org.apache.kafka.common.utils.Bytes; -import io.quarkus.kafka.client.runtime.ui.model.response.KafkaMessage; +import io.quarkus.kafka.client.runtime.devui.model.response.KafkaMessage; public class KafkaModelConverter { public KafkaMessage convert(ConsumerRecord message) { diff --git a/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/ui/model/request/KafkaCreateTopicRequest.java b/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/devui/model/request/KafkaCreateTopicRequest.java similarity index 90% rename from extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/ui/model/request/KafkaCreateTopicRequest.java rename to extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/devui/model/request/KafkaCreateTopicRequest.java index 8fbe12f9c2500..b099bb06ca3e9 100644 --- a/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/ui/model/request/KafkaCreateTopicRequest.java +++ b/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/devui/model/request/KafkaCreateTopicRequest.java @@ -1,4 +1,4 @@ -package io.quarkus.kafka.client.runtime.ui.model.request; +package io.quarkus.kafka.client.runtime.devui.model.request; public class KafkaCreateTopicRequest { private String topicName; diff --git a/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/ui/model/request/KafkaMessageCreateRequest.java b/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/devui/model/request/KafkaMessageCreateRequest.java similarity index 94% rename from extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/ui/model/request/KafkaMessageCreateRequest.java rename to extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/devui/model/request/KafkaMessageCreateRequest.java index 1a442022a8c31..2ac7d67bd81c3 100644 --- a/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/ui/model/request/KafkaMessageCreateRequest.java +++ b/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/devui/model/request/KafkaMessageCreateRequest.java @@ -1,4 +1,4 @@ -package io.quarkus.kafka.client.runtime.ui.model.request; +package io.quarkus.kafka.client.runtime.devui.model.request; import java.util.Map; diff --git a/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/ui/model/request/KafkaMessagesRequest.java b/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/devui/model/request/KafkaMessagesRequest.java similarity index 90% rename from extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/ui/model/request/KafkaMessagesRequest.java rename to extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/devui/model/request/KafkaMessagesRequest.java index 71fda0e79d8a6..a171310df7046 100644 --- a/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/ui/model/request/KafkaMessagesRequest.java +++ b/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/devui/model/request/KafkaMessagesRequest.java @@ -1,8 +1,8 @@ -package io.quarkus.kafka.client.runtime.ui.model.request; +package io.quarkus.kafka.client.runtime.devui.model.request; import java.util.Map; -import io.quarkus.kafka.client.runtime.ui.model.Order; +import io.quarkus.kafka.client.runtime.devui.model.Order; public class KafkaMessagesRequest { private String topicName; diff --git a/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/ui/model/request/KafkaOffsetRequest.java b/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/devui/model/request/KafkaOffsetRequest.java similarity index 84% rename from extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/ui/model/request/KafkaOffsetRequest.java rename to extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/devui/model/request/KafkaOffsetRequest.java index f9fa52cdb7369..c7d988ce42da7 100644 --- a/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/ui/model/request/KafkaOffsetRequest.java +++ b/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/devui/model/request/KafkaOffsetRequest.java @@ -1,8 +1,8 @@ -package io.quarkus.kafka.client.runtime.ui.model.request; +package io.quarkus.kafka.client.runtime.devui.model.request; import java.util.List; -import io.quarkus.kafka.client.runtime.ui.model.Order; +import io.quarkus.kafka.client.runtime.devui.model.Order; public class KafkaOffsetRequest { private String topicName; diff --git a/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/ui/model/response/KafkaAclEntry.java b/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/devui/model/response/KafkaAclEntry.java similarity index 91% rename from extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/ui/model/response/KafkaAclEntry.java rename to extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/devui/model/response/KafkaAclEntry.java index b32a0d729f6b7..30fc05b5766c8 100644 --- a/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/ui/model/response/KafkaAclEntry.java +++ b/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/devui/model/response/KafkaAclEntry.java @@ -1,4 +1,4 @@ -package io.quarkus.kafka.client.runtime.ui.model.response; +package io.quarkus.kafka.client.runtime.devui.model.response; public class KafkaAclEntry { private String operation; diff --git a/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/ui/model/response/KafkaAclInfo.java b/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/devui/model/response/KafkaAclInfo.java similarity index 92% rename from extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/ui/model/response/KafkaAclInfo.java rename to extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/devui/model/response/KafkaAclInfo.java index 4e53287f220b7..baf26053f43fb 100644 --- a/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/ui/model/response/KafkaAclInfo.java +++ b/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/devui/model/response/KafkaAclInfo.java @@ -1,4 +1,4 @@ -package io.quarkus.kafka.client.runtime.ui.model.response; +package io.quarkus.kafka.client.runtime.devui.model.response; import java.util.ArrayList; import java.util.List; diff --git a/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/ui/model/response/KafkaClusterInfo.java b/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/devui/model/response/KafkaClusterInfo.java similarity index 92% rename from extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/ui/model/response/KafkaClusterInfo.java rename to extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/devui/model/response/KafkaClusterInfo.java index 71e8e67c69b11..f3d4265907ced 100644 --- a/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/ui/model/response/KafkaClusterInfo.java +++ b/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/devui/model/response/KafkaClusterInfo.java @@ -1,4 +1,4 @@ -package io.quarkus.kafka.client.runtime.ui.model.response; +package io.quarkus.kafka.client.runtime.devui.model.response; import java.util.ArrayList; import java.util.List; diff --git a/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/ui/model/response/KafkaConsumerGroup.java b/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/devui/model/response/KafkaConsumerGroup.java similarity index 95% rename from extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/ui/model/response/KafkaConsumerGroup.java rename to extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/devui/model/response/KafkaConsumerGroup.java index e6506837534eb..662129c167a57 100644 --- a/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/ui/model/response/KafkaConsumerGroup.java +++ b/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/devui/model/response/KafkaConsumerGroup.java @@ -1,4 +1,4 @@ -package io.quarkus.kafka.client.runtime.ui.model.response; +package io.quarkus.kafka.client.runtime.devui.model.response; import java.util.Collection; diff --git a/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/ui/model/response/KafkaConsumerGroupMember.java b/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/devui/model/response/KafkaConsumerGroupMember.java similarity index 93% rename from extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/ui/model/response/KafkaConsumerGroupMember.java rename to extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/devui/model/response/KafkaConsumerGroupMember.java index 338890414b702..75b06c1488cee 100644 --- a/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/ui/model/response/KafkaConsumerGroupMember.java +++ b/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/devui/model/response/KafkaConsumerGroupMember.java @@ -1,4 +1,4 @@ -package io.quarkus.kafka.client.runtime.ui.model.response; +package io.quarkus.kafka.client.runtime.devui.model.response; import java.util.Collection; diff --git a/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/ui/model/response/KafkaConsumerGroupMemberPartitionAssignment.java b/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/devui/model/response/KafkaConsumerGroupMemberPartitionAssignment.java similarity index 90% rename from extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/ui/model/response/KafkaConsumerGroupMemberPartitionAssignment.java rename to extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/devui/model/response/KafkaConsumerGroupMemberPartitionAssignment.java index 4a722e76d6385..adbbe43a28782 100644 --- a/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/ui/model/response/KafkaConsumerGroupMemberPartitionAssignment.java +++ b/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/devui/model/response/KafkaConsumerGroupMemberPartitionAssignment.java @@ -1,4 +1,4 @@ -package io.quarkus.kafka.client.runtime.ui.model.response; +package io.quarkus.kafka.client.runtime.devui.model.response; public class KafkaConsumerGroupMemberPartitionAssignment { diff --git a/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/ui/model/response/KafkaInfo.java b/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/devui/model/response/KafkaInfo.java similarity index 93% rename from extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/ui/model/response/KafkaInfo.java rename to extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/devui/model/response/KafkaInfo.java index f8a63d09638f5..b3c6f760a8009 100644 --- a/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/ui/model/response/KafkaInfo.java +++ b/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/devui/model/response/KafkaInfo.java @@ -1,4 +1,4 @@ -package io.quarkus.kafka.client.runtime.ui.model.response; +package io.quarkus.kafka.client.runtime.devui.model.response; import java.util.List; diff --git a/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/ui/model/response/KafkaMessage.java b/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/devui/model/response/KafkaMessage.java similarity index 94% rename from extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/ui/model/response/KafkaMessage.java rename to extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/devui/model/response/KafkaMessage.java index b49f5c94aee2f..4c6db12d37378 100644 --- a/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/ui/model/response/KafkaMessage.java +++ b/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/devui/model/response/KafkaMessage.java @@ -1,4 +1,4 @@ -package io.quarkus.kafka.client.runtime.ui.model.response; +package io.quarkus.kafka.client.runtime.devui.model.response; import java.util.Map; diff --git a/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/ui/model/response/KafkaMessagePage.java b/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/devui/model/response/KafkaMessagePage.java similarity index 89% rename from extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/ui/model/response/KafkaMessagePage.java rename to extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/devui/model/response/KafkaMessagePage.java index c57aaa6ce5178..5af77fa521f3c 100644 --- a/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/ui/model/response/KafkaMessagePage.java +++ b/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/devui/model/response/KafkaMessagePage.java @@ -1,4 +1,4 @@ -package io.quarkus.kafka.client.runtime.ui.model.response; +package io.quarkus.kafka.client.runtime.devui.model.response; import java.util.Collection; import java.util.Map; diff --git a/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/ui/model/response/KafkaNode.java b/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/devui/model/response/KafkaNode.java similarity index 89% rename from extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/ui/model/response/KafkaNode.java rename to extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/devui/model/response/KafkaNode.java index 137645a7c29ee..b69461f187a25 100644 --- a/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/ui/model/response/KafkaNode.java +++ b/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/devui/model/response/KafkaNode.java @@ -1,4 +1,4 @@ -package io.quarkus.kafka.client.runtime.ui.model.response; +package io.quarkus.kafka.client.runtime.devui.model.response; public class KafkaNode { private String host; diff --git a/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/ui/model/response/KafkaTopic.java b/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/devui/model/response/KafkaTopic.java similarity index 93% rename from extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/ui/model/response/KafkaTopic.java rename to extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/devui/model/response/KafkaTopic.java index ab5595d7a8488..a5ab3025ac7b3 100644 --- a/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/ui/model/response/KafkaTopic.java +++ b/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/devui/model/response/KafkaTopic.java @@ -1,4 +1,4 @@ -package io.quarkus.kafka.client.runtime.ui.model.response; +package io.quarkus.kafka.client.runtime.devui.model.response; public class KafkaTopic { private String name; diff --git a/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/ui/util/ConsumerFactory.java b/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/devui/util/ConsumerFactory.java similarity index 96% rename from extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/ui/util/ConsumerFactory.java rename to extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/devui/util/ConsumerFactory.java index be2c140530860..34a577ead19a9 100644 --- a/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/ui/util/ConsumerFactory.java +++ b/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/devui/util/ConsumerFactory.java @@ -1,4 +1,4 @@ -package io.quarkus.kafka.client.runtime.ui.util; +package io.quarkus.kafka.client.runtime.devui.util; import java.util.*; diff --git a/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/ui/AbstractHttpRequestHandler.java b/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/ui/AbstractHttpRequestHandler.java deleted file mode 100644 index ede6bc54f21f8..0000000000000 --- a/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/ui/AbstractHttpRequestHandler.java +++ /dev/null @@ -1,76 +0,0 @@ -package io.quarkus.kafka.client.runtime.ui; - -import io.quarkus.arc.Arc; -import io.quarkus.arc.ManagedContext; -import io.vertx.core.Handler; -import io.vertx.core.http.HttpServerRequest; -import io.vertx.ext.web.RoutingContext; - -public abstract class AbstractHttpRequestHandler implements Handler { - private final ManagedContext currentManagedContext; - private final Handler currentManagedContextTerminationHandler; - - public AbstractHttpRequestHandler() { - this.currentManagedContext = Arc.container().requestContext(); - this.currentManagedContextTerminationHandler = e -> currentManagedContext.terminate(); - } - - @Override - @SuppressWarnings("unchecked") // ignore currentManagedContextTerminationHandler types, just use Object - public void handle(final RoutingContext ctx) { - - if (currentManagedContext.isActive()) { - doHandle(ctx); - } else { - - currentManagedContext.activate(); - ctx.response() - .endHandler(currentManagedContextTerminationHandler) - .exceptionHandler(currentManagedContextTerminationHandler) - .closeHandler(currentManagedContextTerminationHandler); - - try { - doHandle(ctx); - } catch (Throwable t) { - currentManagedContext.terminate(); - throw t; - } - } - } - - public void doHandle(RoutingContext ctx) { - try { - HttpServerRequest request = ctx.request(); - - switch (request.method().name()) { - case "OPTIONS": - handleOptions(ctx); - break; - case "POST": - handlePost(ctx); - break; - case "GET": - handleGet(ctx); - break; - default: - ctx.next(); - break; - } - } catch (Exception e) { - ctx.fail(e); - } - } - - public abstract void handlePost(RoutingContext event); - - public abstract void handleGet(RoutingContext event); - - public abstract void handleOptions(RoutingContext event); - - protected String getRequestPath(RoutingContext event) { - HttpServerRequest request = event.request(); - return request.path(); - } - - //TODO: service methods for HTTP requests -} diff --git a/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/ui/KafkaUiHandler.java b/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/ui/KafkaUiHandler.java deleted file mode 100644 index 371c3360ac52d..0000000000000 --- a/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/ui/KafkaUiHandler.java +++ /dev/null @@ -1,133 +0,0 @@ - -package io.quarkus.kafka.client.runtime.ui; - -import static io.netty.handler.codec.http.HttpResponseStatus.BAD_REQUEST; -import static io.netty.handler.codec.http.HttpResponseStatus.OK; - -import java.util.concurrent.ExecutionException; - -import io.netty.handler.codec.http.HttpResponseStatus; -import io.quarkus.arc.Arc; -import io.quarkus.kafka.client.runtime.KafkaAdminClient; -import io.quarkus.kafka.client.runtime.ui.model.request.KafkaCreateTopicRequest; -import io.quarkus.kafka.client.runtime.ui.model.request.KafkaMessageCreateRequest; -import io.quarkus.kafka.client.runtime.ui.model.request.KafkaMessagesRequest; -import io.quarkus.kafka.client.runtime.ui.model.request.KafkaOffsetRequest; -import io.vertx.core.http.HttpHeaders; -import io.vertx.core.http.HttpServerRequest; -import io.vertx.ext.web.RoutingContext; - -public class KafkaUiHandler extends AbstractHttpRequestHandler { - - @Override - public void handlePost(RoutingContext event) { - if (event.body() == null) { - endResponse(event, BAD_REQUEST, "Request body is null"); - return; - } - var webUtils = kafkaWebUiUtils(); - var body = webUtils.fromJson(event.body().buffer()); - if (body == null) { - endResponse(event, BAD_REQUEST, "Request JSON body is null"); - return; - } - var action = body.getString("action"); - - var message = "OK"; - var error = ""; - - var adminClient = kafkaAdminClient(); - - boolean res = false; - if (null != action) { - try { - switch (action) { - case "getInfo": - message = webUtils.toJson(webUtils.getKafkaInfo()); - res = true; - break; - case "getAclInfo": - message = webUtils.toJson(webUtils.getAclInfo()); - res = true; - break; - case "createTopic": - var topicCreateRq = webUtils.fromJson(event.body().buffer(), KafkaCreateTopicRequest.class); - res = adminClient.createTopic(topicCreateRq); - message = webUtils.toJson(webUtils.getTopics()); - break; - case "deleteTopic": - adminClient.deleteTopic(body.getString("key")); - message = "{}"; - res = true; - break; - case "getTopics": - message = webUtils.toJson(webUtils.getTopics()); - res = true; - break; - case "topicMessages": - var msgRequest = webUtils.fromJson(event.body().buffer(), KafkaMessagesRequest.class); - message = webUtils.toJson(webUtils.getMessages(msgRequest)); - res = true; - break; - case "getOffset": - var request = webUtils.fromJson(event.body().buffer(), KafkaOffsetRequest.class); - message = webUtils.toJson(webUtils.getOffset(request)); - res = true; - break; - case "createMessage": - var rq = webUtils.fromJson(event.body().buffer(), KafkaMessageCreateRequest.class); - webUtils.createMessage(rq); - message = "{}"; - res = true; - break; - case "getPartitions": - var topicName = body.getString("topicName"); - message = webUtils.toJson(webUtils.partitions(topicName)); - res = true; - break; - default: - break; - } - } catch (InterruptedException ex) { - Thread.currentThread().interrupt(); - } catch (ExecutionException ex) { - throw new RuntimeException(ex); - } - } - - if (res) { - event.response().headers().set(HttpHeaders.CONTENT_TYPE, "application/json"); - endResponse(event, OK, message); - } else { - message = "ERROR: " + error; - endResponse(event, BAD_REQUEST, message); - } - } - - private void endResponse(RoutingContext event, HttpResponseStatus status, String message) { - event.response().setStatusCode(status.code()); - event.response().end(message); - } - - private KafkaUiUtils kafkaWebUiUtils() { - return Arc.container().instance(KafkaUiUtils.class).get(); - } - - @Override - public void handleGet(RoutingContext event) { - //TODO: move pure get requests processing here - HttpServerRequest request = event.request(); - String path = request.path(); - endResponse(event, OK, "GET method is not supported yet. Path is: " + path); - } - - @Override - public void handleOptions(RoutingContext event) { - endResponse(event, OK, "OPTION method is not supported yet"); - } - - private KafkaAdminClient kafkaAdminClient() { - return Arc.container().instance(KafkaAdminClient.class).get(); - } - -} diff --git a/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/ui/KafkaUiRecorder.java b/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/ui/KafkaUiRecorder.java deleted file mode 100644 index 90afe8521cc11..0000000000000 --- a/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/ui/KafkaUiRecorder.java +++ /dev/null @@ -1,17 +0,0 @@ -package io.quarkus.kafka.client.runtime.ui; - -import io.quarkus.runtime.annotations.Recorder; -import io.vertx.core.Handler; -import io.vertx.ext.web.RoutingContext; - -/** - * Handles requests from kafka UI and html/js of UI - */ -@Recorder -public class KafkaUiRecorder { - - public Handler kafkaControlHandler() { - return new KafkaUiHandler(); - } - -} diff --git a/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/ui/model/Order.java b/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/ui/model/Order.java deleted file mode 100644 index a94a5565c4a0f..0000000000000 --- a/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/ui/model/Order.java +++ /dev/null @@ -1,6 +0,0 @@ -package io.quarkus.kafka.client.runtime.ui.model; - -public enum Order { - OLD_FIRST, - NEW_FIRST -} diff --git a/integration-tests/devmode/src/test/java/io/quarkus/test/devconsole/DevConsoleKafkaSmokeTest.java b/integration-tests/devmode/src/test/java/io/quarkus/test/devconsole/DevConsoleKafkaSmokeTest.java deleted file mode 100644 index 0511bd34b5c47..0000000000000 --- a/integration-tests/devmode/src/test/java/io/quarkus/test/devconsole/DevConsoleKafkaSmokeTest.java +++ /dev/null @@ -1,29 +0,0 @@ -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-v1/io.quarkus.quarkus-kafka-client/kafka-dev-ui") - .then() - .statusCode(200).body(Matchers.containsString("Kafka Dev UI")); - } - -}