Преглед на файлове

Merge branch 'master' into checks/626-update-delete-topics

Anna Antipova преди 4 години
родител
ревизия
7e5d628f9f

+ 14 - 0
kafka-ui-api/src/main/java/com/provectus/kafka/ui/model/schemaregistry/ErrorResponse.java

@@ -0,0 +1,14 @@
+package com.provectus.kafka.ui.model.schemaregistry;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Data;
+
+@Data
+public class ErrorResponse {
+
+  @JsonProperty("error_code")
+  private int errorCode;
+
+  private String message;
+
+}

+ 5 - 2
kafka-ui-api/src/main/java/com/provectus/kafka/ui/service/SchemaRegistryService.java

@@ -14,6 +14,7 @@ import com.provectus.kafka.ui.model.KafkaCluster;
 import com.provectus.kafka.ui.model.NewSchemaSubject;
 import com.provectus.kafka.ui.model.SchemaSubject;
 import com.provectus.kafka.ui.model.SchemaType;
+import com.provectus.kafka.ui.model.schemaregistry.ErrorResponse;
 import com.provectus.kafka.ui.model.schemaregistry.InternalCompatibilityCheck;
 import com.provectus.kafka.ui.model.schemaregistry.InternalCompatibilityLevel;
 import com.provectus.kafka.ui.model.schemaregistry.InternalNewSchema;
@@ -195,7 +196,8 @@ public class SchemaRegistryService {
         .body(BodyInserters.fromPublisher(newSchemaSubject, InternalNewSchema.class))
         .retrieve()
         .onStatus(UNPROCESSABLE_ENTITY::equals,
-            r -> Mono.error(new UnprocessableEntityException("Invalid params")))
+            r -> r.bodyToMono(ErrorResponse.class)
+                .flatMap(x -> Mono.error(new UnprocessableEntityException(x.getMessage()))))
         .bodyToMono(SubjectIdResponse.class);
   }
 
@@ -210,7 +212,8 @@ public class SchemaRegistryService {
         .retrieve()
         .onStatus(NOT_FOUND::equals, res -> Mono.empty())
         .onStatus(UNPROCESSABLE_ENTITY::equals,
-            r -> Mono.error(new UnprocessableEntityException("Invalid params")))
+            r -> r.bodyToMono(ErrorResponse.class)
+                .flatMap(x -> Mono.error(new UnprocessableEntityException(x.getMessage()))))
         .bodyToMono(SchemaSubject.class)
         .filter(s -> Objects.isNull(s.getId()))
         .switchIfEmpty(Mono.error(new DuplicateEntityException("Such schema already exists")));

+ 1 - 0
kafka-ui-react-app/src/components/Topics/List/List.tsx

@@ -135,6 +135,7 @@ const List: React.FC<Props> = ({
                   orderBy={orderBy}
                   setOrderBy={setTopicsOrderBy}
                 />
+                <th>Replication Factor</th>
                 <th>Number of messages</th>
                 <th>Size</th>
                 <th>Type</th>

+ 2 - 1
kafka-ui-react-app/src/components/Topics/List/ListItem.tsx

@@ -20,7 +20,7 @@ export interface ListItemProps {
 }
 
 const ListItem: React.FC<ListItemProps> = ({
-  topic: { name, internal, partitions, segmentSize },
+  topic: { name, internal, partitions, segmentSize, replicationFactor },
   deleteTopic,
   clusterName,
   clearTopicMessages,
@@ -75,6 +75,7 @@ const ListItem: React.FC<ListItemProps> = ({
       </td>
       <td>{partitions?.length}</td>
       <td>{outOfSyncReplicas}</td>
+      <td>{replicationFactor}</td>
       <td>{numberOfMessages}</td>
       <td>
         <BytesFormatted value={segmentSize} />

+ 3 - 0
kafka-ui-react-app/src/components/Topics/List/__tests__/__snapshots__/List.spec.tsx.snap

@@ -205,6 +205,9 @@ exports[`List when it does not have readonly flag matches the snapshot 1`] = `
                     </span>
                   </th>
                 </ListHeaderCell>
+                <th>
+                  Replication Factor
+                </th>
                 <th>
                   Number of messages
                 </th>