|
@@ -36,6 +36,7 @@ interface Props extends Topic, TopicDetails {
|
|
isDeleted: boolean;
|
|
isDeleted: boolean;
|
|
isDeletePolicy: boolean;
|
|
isDeletePolicy: boolean;
|
|
deleteTopic: (clusterName: ClusterName, topicName: TopicName) => void;
|
|
deleteTopic: (clusterName: ClusterName, topicName: TopicName) => void;
|
|
|
|
+ recreateTopic: (clusterName: ClusterName, topicName: TopicName) => void;
|
|
clearTopicMessages(clusterName: ClusterName, topicName: TopicName): void;
|
|
clearTopicMessages(clusterName: ClusterName, topicName: TopicName): void;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -53,6 +54,7 @@ const Details: React.FC<Props> = ({
|
|
isDeleted,
|
|
isDeleted,
|
|
isDeletePolicy,
|
|
isDeletePolicy,
|
|
deleteTopic,
|
|
deleteTopic,
|
|
|
|
+ recreateTopic,
|
|
clearTopicMessages,
|
|
clearTopicMessages,
|
|
}) => {
|
|
}) => {
|
|
const history = useHistory();
|
|
const history = useHistory();
|
|
@@ -63,6 +65,10 @@ const Details: React.FC<Props> = ({
|
|
React.useState(false);
|
|
React.useState(false);
|
|
const [isClearTopicConfirmationVisible, setClearTopicConfirmationVisible] =
|
|
const [isClearTopicConfirmationVisible, setClearTopicConfirmationVisible] =
|
|
React.useState(false);
|
|
React.useState(false);
|
|
|
|
+ const [
|
|
|
|
+ isRecreateTopicConfirmationVisible,
|
|
|
|
+ setRecreateTopicConfirmationVisible,
|
|
|
|
+ ] = React.useState(false);
|
|
const deleteTopicHandler = React.useCallback(() => {
|
|
const deleteTopicHandler = React.useCallback(() => {
|
|
deleteTopic(clusterName, topicName);
|
|
deleteTopic(clusterName, topicName);
|
|
}, [clusterName, topicName, deleteTopic]);
|
|
}, [clusterName, topicName, deleteTopic]);
|
|
@@ -79,6 +85,11 @@ const Details: React.FC<Props> = ({
|
|
setClearTopicConfirmationVisible(false);
|
|
setClearTopicConfirmationVisible(false);
|
|
}, [clusterName, topicName, clearTopicMessages]);
|
|
}, [clusterName, topicName, clearTopicMessages]);
|
|
|
|
|
|
|
|
+ const recreateTopicHandler = React.useCallback(() => {
|
|
|
|
+ recreateTopic(clusterName, topicName);
|
|
|
|
+ setRecreateTopicConfirmationVisible(false);
|
|
|
|
+ }, [recreateTopic, clusterName, topicName]);
|
|
|
|
+
|
|
return (
|
|
return (
|
|
<div>
|
|
<div>
|
|
<PageHeading text={topicName}>
|
|
<PageHeading text={topicName}>
|
|
@@ -116,6 +127,12 @@ const Details: React.FC<Props> = ({
|
|
Clear messages
|
|
Clear messages
|
|
</DropdownItem>
|
|
</DropdownItem>
|
|
)}
|
|
)}
|
|
|
|
+ <DropdownItem
|
|
|
|
+ onClick={() => setRecreateTopicConfirmationVisible(true)}
|
|
|
|
+ danger
|
|
|
|
+ >
|
|
|
|
+ Recreate Topic
|
|
|
|
+ </DropdownItem>
|
|
{isTopicDeletionAllowed && (
|
|
{isTopicDeletionAllowed && (
|
|
<DropdownItem
|
|
<DropdownItem
|
|
onClick={() => setDeleteTopicConfirmationVisible(true)}
|
|
onClick={() => setDeleteTopicConfirmationVisible(true)}
|
|
@@ -143,6 +160,13 @@ const Details: React.FC<Props> = ({
|
|
>
|
|
>
|
|
Are you sure want to clear topic messages?
|
|
Are you sure want to clear topic messages?
|
|
</ConfirmationModal>
|
|
</ConfirmationModal>
|
|
|
|
+ <ConfirmationModal
|
|
|
|
+ isOpen={isRecreateTopicConfirmationVisible}
|
|
|
|
+ onCancel={() => setRecreateTopicConfirmationVisible(false)}
|
|
|
|
+ onConfirm={recreateTopicHandler}
|
|
|
|
+ >
|
|
|
|
+ Are you sure want to recreate <b>{topicName}</b> topic?
|
|
|
|
+ </ConfirmationModal>
|
|
<Navbar role="navigation">
|
|
<Navbar role="navigation">
|
|
<NavLink
|
|
<NavLink
|
|
exact
|
|
exact
|