From e8a3ad936a6d1296d92cb6ee6fb1d5ca3aa1ad6e Mon Sep 17 00:00:00 2001 From: Nico Braun Date: Tue, 31 May 2022 12:22:32 +0200 Subject: [PATCH] pre-select a descriptor file for a specific topic if available --- src/main/java/kafdrop/controller/MessageController.java | 3 +++ src/main/resources/templates/message-inspector.ftlh | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/kafdrop/controller/MessageController.java b/src/main/java/kafdrop/controller/MessageController.java index 949f47e0..d2470ec1 100644 --- a/src/main/java/kafdrop/controller/MessageController.java +++ b/src/main/java/kafdrop/controller/MessageController.java @@ -149,6 +149,9 @@ public String viewMessageForm(@PathVariable("name") String topicName, final TopicVO topic = kafkaMonitor.getTopic(topicName) .orElseThrow(() -> new TopicNotFoundException(topicName)); model.addAttribute("topic", topic); + // pre-select a descriptor file for a specific topic if available + model.addAttribute("defaultDescFile", protobufProperties.getDescFilesList().stream() + .filter(descFile -> descFile.replace(".desc", "").equals(topicName)).findFirst().orElse("")); model.addAttribute("defaultFormat", defaultFormat); model.addAttribute("messageFormats", MessageFormat.values()); diff --git a/src/main/resources/templates/message-inspector.ftlh b/src/main/resources/templates/message-inspector.ftlh index f5d50751..1de04cd6 100644 --- a/src/main/resources/templates/message-inspector.ftlh +++ b/src/main/resources/templates/message-inspector.ftlh @@ -134,7 +134,7 @@ <#else>