[UI] Add TopicDetails interface
This commit is contained in:
parent
ff6b28487a
commit
dbe497f0f2
5 changed files with 23 additions and 11 deletions
|
@ -1,10 +1,10 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { ClusterId, Topic } from 'types';
|
import { ClusterId, Topic, TopicDetails } from 'types';
|
||||||
import MetricsWrapper from 'components/common/Dashboard/MetricsWrapper';
|
import MetricsWrapper from 'components/common/Dashboard/MetricsWrapper';
|
||||||
import Indicator from 'components/common/Dashboard/Indicator';
|
import Indicator from 'components/common/Dashboard/Indicator';
|
||||||
import Breadcrumb from 'components/common/Breadcrumb/Breadcrumb';
|
import Breadcrumb from 'components/common/Breadcrumb/Breadcrumb';
|
||||||
|
|
||||||
interface Props extends Topic {
|
interface Props extends Topic, TopicDetails {
|
||||||
clusterId: ClusterId;
|
clusterId: ClusterId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Topic } from 'types';
|
import { Topic, TopicDetails } from 'types';
|
||||||
import ListItem from './ListItem';
|
import ListItem from './ListItem';
|
||||||
import Breadcrumb from 'components/common/Breadcrumb/Breadcrumb';
|
import Breadcrumb from 'components/common/Breadcrumb/Breadcrumb';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
topics: Topic[];
|
topics: (Topic & TopicDetails)[];
|
||||||
externalTopics: Topic[];
|
externalTopics: (Topic & TopicDetails)[];
|
||||||
}
|
}
|
||||||
|
|
||||||
const List: React.FC<Props> = ({
|
const List: React.FC<Props> = ({
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { NavLink } from 'react-router-dom';
|
import { NavLink } from 'react-router-dom';
|
||||||
import { Topic } from 'types';
|
import { Topic, TopicDetails } from 'types';
|
||||||
|
|
||||||
|
const ListItem: React.FC<Topic & TopicDetails> = ({
|
||||||
const ListItem: React.FC<Topic> = ({
|
|
||||||
name,
|
name,
|
||||||
partitions,
|
partitions,
|
||||||
}) => {
|
}) => {
|
||||||
|
|
|
@ -12,12 +12,15 @@ const reducer = (state = initialState, action: Action): TopicsState => {
|
||||||
return action.payload.reduce(
|
return action.payload.reduce(
|
||||||
(memo, topic) => {
|
(memo, topic) => {
|
||||||
const { name } = topic;
|
const { name } = topic;
|
||||||
memo.byName[name] = topic;
|
memo.byName[name] = {
|
||||||
|
...memo.byName[name],
|
||||||
|
...topic,
|
||||||
|
};
|
||||||
memo.allNames.push(name);
|
memo.allNames.push(name);
|
||||||
|
|
||||||
return memo;
|
return memo;
|
||||||
},
|
},
|
||||||
initialState,
|
state,
|
||||||
);
|
);
|
||||||
default:
|
default:
|
||||||
return state;
|
return state;
|
||||||
|
|
|
@ -15,6 +15,16 @@ export interface TopicPartition {
|
||||||
replicas: TopicReplica[];
|
replicas: TopicReplica[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface TopicDetails {
|
||||||
|
partitionCount?: number;
|
||||||
|
replicationFactor?: number;
|
||||||
|
replicas?: number;
|
||||||
|
segmentSize?: number;
|
||||||
|
inSyncReplicas?: number;
|
||||||
|
segmentCount?: number;
|
||||||
|
underReplicatedPartitions?: number;
|
||||||
|
}
|
||||||
|
|
||||||
export interface Topic {
|
export interface Topic {
|
||||||
name: TopicName;
|
name: TopicName;
|
||||||
internal: boolean;
|
internal: boolean;
|
||||||
|
@ -22,6 +32,6 @@ export interface Topic {
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface TopicsState {
|
export interface TopicsState {
|
||||||
byName: { [topicName: string]: Topic },
|
byName: { [topicName: string]: Topic & TopicDetails },
|
||||||
allNames: TopicName[],
|
allNames: TopicName[],
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue