diff options
author | ZhangZihao <zhangzihao@chinamobile.com> | 2019-12-19 11:18:09 +0800 |
---|---|---|
committer | ZhangZihao <zhangzihao@chinamobile.com> | 2019-12-19 11:18:25 +0800 |
commit | 92e8f1cbcc012db160e8f681e14710cc52149b2a (patch) | |
tree | 8f810099f9681c80c4c09bb218f2f366aa744315 /components/datalake-handler/feeder | |
parent | ab4c8376241c153e3f8ab986bd29a8baa8226450 (diff) |
Fixed kafka's ui and add getKafkaDetail()
Change-Id: I4f5b3c06feb19c39a7d67b678704f726c305e7c8
Issue-ID: DCAEGEN2-1877
Signed-off-by: ZhangZihao <zhangzihao@chinamobile.com>
Diffstat (limited to 'components/datalake-handler/feeder')
-rw-r--r-- | components/datalake-handler/feeder/src/main/java/org/onap/datalake/feeder/controller/KafkaController.java | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/components/datalake-handler/feeder/src/main/java/org/onap/datalake/feeder/controller/KafkaController.java b/components/datalake-handler/feeder/src/main/java/org/onap/datalake/feeder/controller/KafkaController.java index 41995e04..9865e0af 100644 --- a/components/datalake-handler/feeder/src/main/java/org/onap/datalake/feeder/controller/KafkaController.java +++ b/components/datalake-handler/feeder/src/main/java/org/onap/datalake/feeder/controller/KafkaController.java @@ -121,14 +121,14 @@ public class KafkaController { Kafka oldKafka = kafkaService.getKafkaById(id); if (oldKafka == null) { - sendError(response, 400, "kafka not found "+id); + sendError(response, 400, "kafka not found, ID: "+id); } else { kafkaRepository.delete(oldKafka); response.setStatus(204); } } - @GetMapping("") + /*@GetMapping("") @ResponseBody @ApiOperation(value="List all Kafka id") public List<Integer> list() { @@ -139,12 +139,30 @@ public class KafkaController { retString.add(k.getId()); } return retString; - } + }*/ + @GetMapping("") + @ResponseBody + @ApiOperation(value="List all Kafkas") public List<KafkaConfig> queryAllKafka(){ return kafkaService.getAllKafka(); } + @GetMapping("/{id}") + @ResponseBody + @ApiOperation(value="Get detail of kafka by id") + public KafkaConfig getKafkaDetail(@PathVariable int id, HttpServletResponse response) throws IOException { + log.info("Get detail of kafka, ID: " + id); + Kafka oldKafka = kafkaService.getKafkaById(id); + if (oldKafka == null) { + sendError(response, 400, "kafka not found, ID: "+id); + return null; + } else { + log.info("ResponseBody......" + oldKafka.getKafkaConfig()); + return oldKafka.getKafkaConfig(); + } + } + private PostReturnBody<KafkaConfig> mkPostReturnBody(int statusCode, Kafka kafka) { PostReturnBody<KafkaConfig> retBody = new PostReturnBody<>(); retBody.setStatusCode(statusCode); |