Repository: provectus/kafka-ui
Issue: Support "compact,delete" cleanup policy
Labels: type/bug
type/enhancement
scope/frontend
status/confirmed

**Describe the bug**
That is one of the commonly used policies and it should be possible to create topic with this cleanup policy. It is not in the list of available policies (only "compact" and "delete" are available, not "compact,delete").


**Set up**
Docker from master tag `v0.2.2-SNAPSHOT(547863f)`


**Steps to Reproduce**
Steps to reproduce the behavior:

1. Go to Topics -> Create
2. Check available cleanup policies

**Expected behavior**
`compact,delete` is available


Issue comments:

Pull request review comments:

Patch that resolved the issue:
diff --git a/kafka-ui-react-app/src/components/Topics/Topic/Edit/Edit.tsx b/kafka-ui-react-app/src/components/Topics/Topic/Edit/Edit.tsx
index 50074edae1f..0f36612768f 100644
--- a/kafka-ui-react-app/src/components/Topics/Topic/Edit/Edit.tsx
+++ b/kafka-ui-react-app/src/components/Topics/Topic/Edit/Edit.tsx
@@ -13,6 +13,7 @@ import { camelCase } from 'lodash';
 import TopicForm from 'components/Topics/shared/Form/TopicForm';
 import { clusterTopicPath } from 'lib/paths';
 import { useHistory } from 'react-router';
+import { TOPIC_CUSTOM_PARAMS } from 'lib/constants';
 
 import DangerZoneContainer from './DangerZoneContainer';
 
@@ -65,7 +66,11 @@ const topicParams = (topic: TopicWithDetailedInfo | undefined) => {
     partitions: topic.partitionCount || DEFAULTS.partitions,
     replicationFactor,
     customParams: topic.config
-      ?.filter((el) => el.value !== el.defaultValue)
+      ?.filter(
+        (el) =>
+          el.value !== el.defaultValue &&
+          Object.keys(TOPIC_CUSTOM_PARAMS).includes(el.name)
+      )
       .map((el) => ({ name: el.name, value: el.value })),
     ...configs,
   };
diff --git a/kafka-ui-react-app/src/components/Topics/shared/Form/TopicForm.tsx b/kafka-ui-react-app/src/components/Topics/shared/Form/TopicForm.tsx
index 8435ea657ae..9ad5e0a60b9 100644
--- a/kafka-ui-react-app/src/components/Topics/shared/Form/TopicForm.tsx
+++ b/kafka-ui-react-app/src/components/Topics/shared/Form/TopicForm.tsx
@@ -98,7 +98,7 @@ const TopicForm: React.FC<Props> = ({
               type="number"
               placeholder="Min In Sync Replicas"
               defaultValue="1"
-              {...register('minInSyncReplicas', {
+              {...register('minInsyncReplicas', {
                 required: 'Min In Sync Replicas is required.',
               })}
             />
@@ -115,6 +115,7 @@ const TopicForm: React.FC<Props> = ({
               <select defaultValue="delete" {...register('cleanupPolicy')}>
                 <option value="delete">Delete</option>
                 <option value="compact">Compact</option>
+                <option value="compact,delete">Compact,Delete</option>
               </select>
             </div>
           </div>
diff --git a/kafka-ui-react-app/src/redux/actions/thunks/topics.ts b/kafka-ui-react-app/src/redux/actions/thunks/topics.ts
index b9f6206d8b4..6da2e433158 100644
--- a/kafka-ui-react-app/src/redux/actions/thunks/topics.ts
+++ b/kafka-ui-react-app/src/redux/actions/thunks/topics.ts
@@ -171,7 +171,7 @@ export const formatTopicCreation = (form: TopicFormData): TopicCreation => {
     retentionBytes,
     retentionMs,
     maxMessageBytes,
-    minInSyncReplicas,
+    minInsyncReplicas,
     customParams,
   } = form;
 
@@ -184,7 +184,7 @@ export const formatTopicCreation = (form: TopicFormData): TopicCreation => {
       'retention.ms': retentionMs.toString(),
       'retention.bytes': retentionBytes.toString(),
       'max.message.bytes': maxMessageBytes.toString(),
-      'min.insync.replicas': minInSyncReplicas.toString(),
+      'min.insync.replicas': minInsyncReplicas.toString(),
       ...Object.values(customParams || {}).reduce(topicReducer, {}),
     },
   };
@@ -196,7 +196,7 @@ const formatTopicUpdate = (form: TopicFormDataRaw): TopicUpdate => {
     retentionBytes,
     retentionMs,
     maxMessageBytes,
-    minInSyncReplicas,
+    minInsyncReplicas,
     customParams,
   } = form;
 
@@ -206,7 +206,7 @@ const formatTopicUpdate = (form: TopicFormDataRaw): TopicUpdate => {
       'retention.ms': retentionMs,
       'retention.bytes': retentionBytes,
       'max.message.bytes': maxMessageBytes,
-      'min.insync.replicas': minInSyncReplicas,
+      'min.insync.replicas': minInsyncReplicas,
       ...Object.values(customParams || {}).reduce(topicReducer, {}),
     },
   };
diff --git a/kafka-ui-react-app/src/redux/interfaces/topic.ts b/kafka-ui-react-app/src/redux/interfaces/topic.ts
index e9407f8ef99..168faca7643 100644
--- a/kafka-ui-react-app/src/redux/interfaces/topic.ts
+++ b/kafka-ui-react-app/src/redux/interfaces/topic.ts
@@ -62,7 +62,7 @@ export interface TopicFormDataRaw {
   name: string;
   partitions: number;
   replicationFactor: number;
-  minInSyncReplicas: number;
+  minInsyncReplicas: number;
   cleanupPolicy: string;
   retentionMs: number;
   retentionBytes: number;
@@ -74,7 +74,7 @@ export interface TopicFormData {
   name: string;
   partitions: number;
   replicationFactor: number;
-  minInSyncReplicas: number;
+  minInsyncReplicas: number;
   cleanupPolicy: string;
   retentionMs: number;
   retentionBytes: number;


Test patch: