Browse Source

feat: prepare api for custom

Benedetto Marco Serinelli 1 year ago
parent
commit
6b8cf40ce2

+ 26 - 0
kafka-ui-api/src/main/java/com/provectus/kafka/ui/controller/PreferencesController.java

@@ -0,0 +1,26 @@
+package com.provectus.kafka.ui.controller;
+
+import com.provectus.kafka.ui.api.PreferenceseApi;
+import com.provectus.kafka.ui.model.ApplicationsPreferencesDTO;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.server.ServerWebExchange;
+import reactor.core.publisher.Mono;
+
+@RestController
+@RequiredArgsConstructor
+@Slf4j
+public class PreferencesController implements PreferenceseApi {
+
+  @Value("${kafka.ui.preferences.removegitlink}")
+  private String kafkaUiRemoveGitLink;
+
+
+  @Override
+  public Mono<ResponseEntity<ApplicationsPreferencesDTO>> getPreferences(ServerWebExchange exchange) {
+    return null;
+  }
+}

+ 4 - 0
kafka-ui-api/src/main/resources/application.yml

@@ -19,3 +19,7 @@ logging:
     reactor.netty.http.server.AccessLog: INFO
     reactor.netty.http.server.AccessLog: INFO
     org.hibernate.validator: WARN
     org.hibernate.validator: WARN
 
 
+kafka:
+  ui:
+    preferences:
+      removegitlink: ${OPENSHIFT_DIY_PORT:true}

+ 25 - 1
kafka-ui-contract/src/main/resources/swagger/kafka-ui-api.yaml

@@ -15,6 +15,19 @@ servers:
   - url: /localhost
   - url: /localhost
 
 
 paths:
 paths:
+  /api/preferences:
+    get:
+      tags:
+        - Preferencese
+      summary: getPreferences
+      operationId: getPreferences
+      responses:
+        200:
+          description: OK
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/ApplicationsPreferences'
   /api/clusters:
   /api/clusters:
     get:
     get:
       tags:
       tags:
@@ -2058,6 +2071,17 @@ paths:
 
 
 components:
 components:
   schemas:
   schemas:
+
+    ApplicationsPreferences:
+      type: object
+      properties:
+        removeGitLink:
+          type: boolean
+        removeDiscordLink:
+          type: boolean
+        appName:
+          type: string
+          example: "App Kafka UI My Preferences"
     TopicSerdeSuggestion:
     TopicSerdeSuggestion:
       type: object
       type: object
       properties:
       properties:
@@ -3968,7 +3992,7 @@ components:
                           keystoreLocation:
                           keystoreLocation:
                             type: string
                             type: string
                           keystorePassword:
                           keystorePassword:
-                              type: string
+                            type: string
                       ksqldbServerAuth:
                       ksqldbServerAuth:
                         type: object
                         type: object
                         properties:
                         properties: