Skip to content

Commit 94449f4

Browse files
authored
fix(topics): hide Infinite button for capped configs + fix Custom SELECT width (UX-1235) (#2418)
* fix(topics): hide Infinite button for capped config keys (UX-1222) The topic config editor showed an "Infinite" button for every config whose frontendFormat was BYTE_SIZE or DURATION. For configs that the broker hard-caps (e.g. max.message.bytes, segment.bytes), clicking it submitted -1, which the broker reinterpreted as 4294967295 and rejected with INVALID_CONFIG. Add an opt-out field `noInfiniteValue` to the config extension schema. Configs that do not accept an infinite sentinel declare it in JSON, and the frontend hides the Infinite button for them. BYTE_SIZE and DURATION configs continue to show the button by default. Apply the opt-out to max.message.bytes and segment.bytes. * fix(topics): force min width on Custom SELECT dropdown (UX-1235) chakra-react-select's container has an intrinsic maxWidth: fit-content, so even with a minW on the wrapping Box the SingleSelect collapses to the width of its current value. For message.timestamp.type with no initial value the whole control rendered at ~69px and option labels were truncated to "Creat" / "LogA". Override via chakraStyles on the SELECT case to set container minWidth: 240px directly. Keeps the Custom Box layout untouched for BYTE_SIZE / DURATION controls.
1 parent d65f80d commit 94449f4

4 files changed

Lines changed: 16 additions & 3 deletions

File tree

backend/pkg/console/config_extensions.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@ type ConfigEntryExtension struct {
5252
// the user the available compression methods for `compression.type`.
5353
// The presented values may be dependent on the target Kafka cluster version.
5454
EnumValues []string `json:"enumValues,omitempty"`
55+
56+
// NoInfiniteValue opts a config out of the "Infinite" button in the config
57+
// editor. BYTE_SIZE and DURATION configs show Infinite by default; set this
58+
// to true for configs where the broker rejects the infinite sentinel (e.g.
59+
// max.message.bytes, segment.bytes, which have hard server-side caps).
60+
NoInfiniteValue bool `json:"noInfiniteValue,omitempty"`
5561
}
5662

5763
func loadConfigExtensions() (map[string]ConfigEntryExtension, error) {

backend/pkg/embed/kafka/apache_kafka_configs.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@
6060
"type": "INT",
6161
"documentation": "This configuration controls the segment file size for the log. Retention and cleaning is always done a file at a time so a larger segment size means fewer files but less granular control over retention.",
6262
"category": "Storage Internals",
63-
"frontendFormat": "BYTE_SIZE"
63+
"frontendFormat": "BYTE_SIZE",
64+
"noInfiniteValue": true
6465
},
6566
{
6667
"name": "retention.ms",
@@ -102,7 +103,8 @@
102103
"type": "INT",
103104
"documentation": "The largest record batch size allowed by Kafka (after compression if compression is enabled). If this is increased and there are consumers older than 0.10.2, the consumers' fetch size must also be increased so that they can fetch record batches this large. In the latest message format version, records are always grouped into batches for efficiency. In previous message format versions, uncompressed records are not grouped into batches and this limit only applies to a single record in that case.",
104105
"category": "Message Handling",
105-
"frontendFormat": "BYTE_SIZE"
106+
"frontendFormat": "BYTE_SIZE",
107+
"noInfiniteValue": true
106108
},
107109
{
108110
"name": "min.compaction.lag.ms",

frontend/src/components/pages/topics/topic-configuration.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,10 @@ const ConfigEditorForm: FC<{
7979
},
8080
});
8181

82-
const hasInfiniteValue = editedEntry.frontendFormat && ['BYTE_SIZE', 'DURATION'].includes(editedEntry.frontendFormat);
82+
const hasInfiniteValue =
83+
editedEntry.frontendFormat &&
84+
['BYTE_SIZE', 'DURATION'].includes(editedEntry.frontendFormat) &&
85+
!editedEntry.noInfiniteValue;
8386
const valueTypeOptions: Array<{
8487
label: string;
8588
value: Inputs['valueType'];
@@ -439,6 +442,7 @@ export const ConfigEntryEditorController = <T extends string | number>(p: {
439442
case 'SELECT':
440443
return (
441444
<SingleSelect
445+
chakraStyles={{ container: (base) => ({ ...base, minWidth: '240px' }) }}
442446
className={p.className}
443447
onChange={onChange}
444448
options={

frontend/src/state/rest-interfaces.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,7 @@ export type ConfigEntryExtended = ConfigEntry & {
277277
| 'DECIMAL'
278278
| 'INTEGER';
279279
enumValues?: string[];
280+
noInfiniteValue?: boolean;
280281

281282
// added by frontend
282283
currentValue: string | number | null | undefined;

0 commit comments

Comments
 (0)