Skip to content

Commit a6d8f6b

Browse files
authored
Added Audit Kafka configuration panel (#2724)
1 parent fa1f84b commit a6d8f6b

File tree

5 files changed

+137
-3
lines changed

5 files changed

+137
-3
lines changed

portal-ui/src/screens/Console/Configurations/ConfigurationPanels/ConfigurationForm.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
import React from "react";
1818
import { useLocation } from "react-router-dom";
19-
import Grid from "@mui/material/Grid";
19+
import { Grid } from "mds";
2020
import { configurationElements } from "../utils";
2121
import EditConfiguration from "../../EventDestinations/CustomForms/EditConfiguration";
2222

portal-ui/src/screens/Console/Configurations/types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import { SelectorTypes } from "../Common/FormComponents/RadioGroupSelector/Radio
1818

1919
export type KVFieldType =
2020
| "string"
21+
| "password"
2122
| "number"
2223
| "on|off"
2324
| "enum"
@@ -41,6 +42,7 @@ export interface KVField {
4142
multiline?: boolean;
4243
placeholder?: string;
4344
withBorder?: boolean;
45+
customValueProcess?: (value: string) => string;
4446
}
4547

4648
export interface IConfigurationElement {

portal-ui/src/screens/Console/Configurations/utils.tsx

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import VpnKeyIcon from "@mui/icons-material/VpnKey";
2323
import PendingActionsIcon from "@mui/icons-material/PendingActions";
2424
import CallToActionIcon from "@mui/icons-material/CallToAction";
2525
import { IElement, IElementValue, IOverrideEnv, OverrideValue } from "./types";
26+
import { LogsIcon } from "mds";
2627

2728
export const configurationElements: IElement[] = [
2829
{
@@ -65,6 +66,17 @@ export const configurationElements: IElement[] = [
6566
configuration_id: "audit_webhook",
6667
configuration_label: "Audit Webhook",
6768
},
69+
{
70+
icon: (
71+
<LogsIcon
72+
className={
73+
"MuiSvgIcon-root MuiSvgIcon-fontSizeMedium MuiTab-iconWrapper css-i4bv87-MuiSvgIcon-root"
74+
}
75+
/>
76+
),
77+
configuration_id: "audit_kafka",
78+
configuration_label: "Audit Kafka",
79+
},
6880
];
6981

7082
export const fieldsConfigurations: any = {
@@ -281,6 +293,109 @@ export const fieldsConfigurations: any = {
281293
placeholder: "Enter Auth Token",
282294
},
283295
],
296+
audit_kafka: [
297+
{
298+
name: "enable",
299+
required: false,
300+
label: "Enable",
301+
tooltip: "Enable audit_kafka target",
302+
type: "on|off",
303+
customValueProcess: (origValue: string) => {
304+
return origValue === "" || origValue === "on" ? "on" : "off";
305+
},
306+
},
307+
{
308+
name: "brokers",
309+
required: true,
310+
label: "Brokers",
311+
type: "csv",
312+
placeholder: "Enter Kafka broker",
313+
},
314+
{
315+
name: "topic",
316+
required: false,
317+
label: "Topic",
318+
type: "string",
319+
placeholder: "Enter Kafka Topic",
320+
tooltip: "Kafka topic used for bucket notifications",
321+
},
322+
{
323+
name: "sasl",
324+
required: false,
325+
label: "Use SASL",
326+
tooltip: "Enable SASL authentication",
327+
type: "on|off",
328+
},
329+
{
330+
name: "sasl_username",
331+
required: false,
332+
label: "SASL Username",
333+
type: "string",
334+
placeholder: "Enter SASL Username",
335+
tooltip: "Username for SASL/PLAIN or SASL/SCRAM authentication",
336+
},
337+
{
338+
name: "sasl_password",
339+
required: false,
340+
label: "SASL Password",
341+
type: "password",
342+
placeholder: "Enter SASL Password",
343+
tooltip: "Password for SASL/PLAIN or SASL/SCRAM authentication",
344+
},
345+
{
346+
name: "sasl_mechanism",
347+
required: false,
348+
label: "SASL Mechanism",
349+
type: "string",
350+
placeholder: "Enter SASL Mechanism",
351+
tooltip: "SASL authentication mechanism",
352+
},
353+
{
354+
name: "tls",
355+
required: false,
356+
label: "Use TLS",
357+
tooltip: "Enable TLS",
358+
type: "on|off",
359+
},
360+
{
361+
name: "tls_skip_verify",
362+
required: false,
363+
label: "Skip TLS Verification",
364+
tooltip: "Trust server TLS without verification",
365+
type: "on|off",
366+
},
367+
{
368+
name: "client_tls_cert",
369+
required: false,
370+
label: "Client Cert",
371+
tooltip: "Client cert for mTLS authentication",
372+
type: "string",
373+
placeholder: "Enter Client Cert",
374+
},
375+
{
376+
name: "client_tls_key",
377+
required: false,
378+
label: "Client Cert Key",
379+
tooltip: "Client cert key for mTLS authentication",
380+
type: "string",
381+
placeholder: "Enter Client Cert Key",
382+
},
383+
{
384+
name: "tls_client_auth",
385+
required: false,
386+
label: "TLS Client Auth",
387+
tooltip:
388+
"ClientAuth determines the Kafka server's policy for TLS client auth",
389+
type: "string",
390+
},
391+
{
392+
name: "version",
393+
required: false,
394+
label: "Version",
395+
tooltip: "Specify the version of the Kafka cluster",
396+
type: "string",
397+
},
398+
],
284399
};
285400

286401
export const removeEmptyFields = (formFields: IElementValue[]) => {

portal-ui/src/screens/Console/EventDestinations/CustomForms/EditConfiguration.tsx

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ import {
4040
IConfigurationSys,
4141
IElementValue,
4242
IOverrideEnv,
43+
KVField,
4344
} from "../../Configurations/types";
4445
import { ErrorResponseHandler } from "../../../../common/types";
4546
import ResetConfigurationModal from "./ResetConfigurationModal";
@@ -110,7 +111,24 @@ const EditConfiguration = ({
110111
.invoke("GET", `/api/v1/configs/${configId}`)
111112
.then((res) => {
112113
setConfigSubsysList(res);
113-
const keyVals = get(res[0], "key_values", []);
114+
let values: IElementValue[] = get(res[0], "key_values", []);
115+
116+
const fieldsConfig: KVField[] = fieldsConfigurations[configId];
117+
118+
const keyVals = fieldsConfig.map((field) => {
119+
const includedValue = values.find(
120+
(element: IElementValue) => element.key === field.name
121+
);
122+
const customValue = includedValue?.value || "";
123+
124+
return {
125+
key: field.name,
126+
value: field.customValueProcess
127+
? field.customValueProcess(customValue)
128+
: customValue,
129+
};
130+
});
131+
114132
setConfigValues(keyVals);
115133
setOverrideEnvs(overrideFields(keyVals));
116134
dispatch(configurationIsLoading(false));

portal-ui/src/screens/Console/ObjectBrowser/OBHeader.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ const OBHeader = ({ bucketName }: IOBHeader) => {
115115
<BackLink
116116
label={"Object Browser"}
117117
onClick={() => {
118-
console.log("clicke");
119118
navigate(IAM_PAGES.OBJECT_BROWSER_VIEW);
120119
}}
121120
/>

0 commit comments

Comments
 (0)