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

This commit is contained in:
Anna Antipova 2021-07-21 16:28:25 +03:00
commit 7e5d628f9f
5 changed files with 25 additions and 3 deletions

View file

@ -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;
}

View file

@ -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")));

View file

@ -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>

View file

@ -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} />

View file

@ -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>