From 4b10f84c45faea5bfe423aea421d9388484abdc7 Mon Sep 17 00:00:00 2001
From: jakub-tldr <78603704+jakub-tldr@users.noreply.github.com>
Date: Thu, 29 Jan 2026 16:43:17 +0100
Subject: [PATCH 1/7] Add upload certificate file button
---
.../AddLogStreamingModal.tsx | 20 +++++++++++++++----
.../modals/AddDestinationModal/style.scss | 11 ++++++++++
.../FormUploadField/FormUploadField.tsx | 9 ++++++++-
.../components/UploadField/UploadField.tsx | 3 ++-
.../shared/components/UploadField/types.ts | 1 +
5 files changed, 38 insertions(+), 6 deletions(-)
create mode 100644 web/src/pages/settings/SettingsActivityLogStreamingPage/modals/AddDestinationModal/style.scss
diff --git a/web/src/pages/settings/SettingsActivityLogStreamingPage/modals/AddDestinationModal/AddLogStreamingModal.tsx b/web/src/pages/settings/SettingsActivityLogStreamingPage/modals/AddDestinationModal/AddLogStreamingModal.tsx
index 8772a86e44..bdb818b07d 100644
--- a/web/src/pages/settings/SettingsActivityLogStreamingPage/modals/AddDestinationModal/AddLogStreamingModal.tsx
+++ b/web/src/pages/settings/SettingsActivityLogStreamingPage/modals/AddDestinationModal/AddLogStreamingModal.tsx
@@ -19,6 +19,7 @@ import {
subscribeOpenModal,
} from '../../../../../shared/hooks/modalControls/modalsSubjects';
import { ModalName } from '../../../../../shared/hooks/modalControls/modalTypes';
+import './style.scss';
const modalNameValue = ModalName.AddLogStreaming;
@@ -136,7 +137,7 @@ const FormStep = ({ destination, setOpen }: FormStepProps) => {
url: z.string().trim().min(1, m.form_error_required()),
username: z.string().optional(),
password: z.string().optional(),
- certificate: z.string().optional(),
+ certificate: z.file().nullable().optional(),
}),
[],
);
@@ -149,7 +150,7 @@ const FormStep = ({ destination, setOpen }: FormStepProps) => {
url: '',
username: '',
password: '',
- certificate: '',
+ certificate: null,
}),
[],
);
@@ -162,6 +163,17 @@ const FormStep = ({ destination, setOpen }: FormStepProps) => {
onChange: formSchema,
},
onSubmit: async ({ value }) => {
+ let certificateContent: string | undefined = undefined;
+
+ if (value.certificate) {
+ try {
+ certificateContent = await value.certificate.text();
+ } catch (error) {
+ console.error('Failed to read certificate file:', error);
+ }
+ }
+ console.log(certificateContent); // todo: delete
+
const requestData: CreateActivityLogStreamRequest = {
name: value.name,
stream_type:
@@ -172,7 +184,7 @@ const FormStep = ({ destination, setOpen }: FormStepProps) => {
url: value.url,
username: value.username || undefined,
password: value.password || undefined,
- cert: value.certificate || undefined,
+ cert: certificateContent,
},
};
@@ -216,7 +228,7 @@ const FormStep = ({ destination, setOpen }: FormStepProps) => {
- {(field) => }
+ {(field) => }
diff --git a/web/src/pages/settings/SettingsActivityLogStreamingPage/modals/AddDestinationModal/style.scss b/web/src/pages/settings/SettingsActivityLogStreamingPage/modals/AddDestinationModal/style.scss
new file mode 100644
index 0000000000..158760f2b1
--- /dev/null
+++ b/web/src/pages/settings/SettingsActivityLogStreamingPage/modals/AddDestinationModal/style.scss
@@ -0,0 +1,11 @@
+.upload-field {
+ width: 100%;
+
+ .inner-track {
+ width: 100%;
+
+ .file-row {
+ width: 100%;
+ }
+ }
+}
diff --git a/web/src/shared/components/FormUploadField/FormUploadField.tsx b/web/src/shared/components/FormUploadField/FormUploadField.tsx
index 1857f97c85..166fa11f92 100644
--- a/web/src/shared/components/FormUploadField/FormUploadField.tsx
+++ b/web/src/shared/components/FormUploadField/FormUploadField.tsx
@@ -9,5 +9,12 @@ export const FormUploadField = (
const field = useFieldContext();
const error = useFormFieldError();
- return ;
+ return (
+ field.handleChange(value)}
+ {...props}
+ />
+ );
};
diff --git a/web/src/shared/components/UploadField/UploadField.tsx b/web/src/shared/components/UploadField/UploadField.tsx
index 8396cb3381..d13de187b3 100644
--- a/web/src/shared/components/UploadField/UploadField.tsx
+++ b/web/src/shared/components/UploadField/UploadField.tsx
@@ -19,6 +19,7 @@ export const UploadField = ({
loading,
disabled,
testId,
+ title,
onChange,
}: UploadFieldProps) => {
const valuePresent = isPresent(value);
@@ -51,7 +52,7 @@ export const UploadField = ({