diff --git a/src/hooks/useAlertsEditor.tsx b/src/hooks/useAlertsEditor.tsx
index 78a04042..a06f1d2e 100644
--- a/src/hooks/useAlertsEditor.tsx
+++ b/src/hooks/useAlertsEditor.tsx
@@ -4,17 +4,23 @@ import { notifyError, notifySuccess } from '@/utils/notification';
import { AxiosError, isAxiosError } from 'axios';
export const useAlertsEditor = (streamName: string) => {
- const { mutate: updateLogStreamAlerts } = useMutation((data: any) => putLogStreamAlerts(streamName, data), {
- onSuccess: () => notifySuccess({ message: 'Updated Successfully' }),
- onError: (data: AxiosError) => {
- if (isAxiosError(data) && data.response) {
- const error = data.response?.data as string;
- typeof error === 'string' && notifyError({ message: error });
- } else if (data.message && typeof data.message === 'string') {
- notifyError({ message: data.message });
- }
+ const { mutate: updateLogStreamAlerts } = useMutation(
+ (data: { config: any; onSuccess?: () => void }) => putLogStreamAlerts(streamName, data.config),
+ {
+ onSuccess: (_data, variables) => {
+ variables.onSuccess && variables.onSuccess();
+ notifySuccess({ message: 'Updated Successfully' });
+ },
+ onError: (data: AxiosError) => {
+ if (isAxiosError(data) && data.response) {
+ const error = data.response?.data as string;
+ typeof error === 'string' && notifyError({ message: error });
+ } else if (data.message && typeof data.message === 'string') {
+ notifyError({ message: data.message });
+ }
+ },
},
- });
+ );
return {
updateLogStreamAlerts,
diff --git a/src/hooks/useRetentionEditor.tsx b/src/hooks/useRetentionEditor.tsx
index 416e5d16..efce9861 100644
--- a/src/hooks/useRetentionEditor.tsx
+++ b/src/hooks/useRetentionEditor.tsx
@@ -4,17 +4,23 @@ import { notifyError, notifySuccess } from '@/utils/notification';
import { AxiosError, isAxiosError } from 'axios';
export const useRetentionEditor = (streamName: string) => {
- const { mutate: updateLogStreamRetention } = useMutation((data: any) => putLogStreamRetention(streamName, data), {
- onSuccess: () => notifySuccess({ message: 'Updated Successfully' }),
- onError: (data: AxiosError) => {
- if (isAxiosError(data) && data.response) {
- const error = data.response?.data as string;
- typeof error === 'string' && notifyError({ message: error });
- } else if (data.message && typeof data.message === 'string') {
- notifyError({ message: data.message });
- }
+ const { mutate: updateLogStreamRetention } = useMutation(
+ (data: { config: any; onSuccess?: () => void }) => putLogStreamRetention(streamName, data.config),
+ {
+ onSuccess: (_data, variables) => {
+ notifySuccess({ message: 'Updated Successfully' });
+ variables.onSuccess && variables.onSuccess();
+ },
+ onError: (data: AxiosError) => {
+ if (isAxiosError(data) && data.response) {
+ const error = data.response?.data as string;
+ typeof error === 'string' && notifyError({ message: error });
+ } else if (data.message && typeof data.message === 'string') {
+ notifyError({ message: data.message });
+ }
+ },
},
- });
+ );
return {
updateLogStreamRetention,
diff --git a/src/pages/Logs/AlertsModal.tsx b/src/pages/Logs/AlertsModal.tsx
index 285d221d..f4d4a0b6 100644
--- a/src/pages/Logs/AlertsModal.tsx
+++ b/src/pages/Logs/AlertsModal.tsx
@@ -29,7 +29,7 @@ const AlertsModal = () => {
} catch (e) {
return notifyError({ message: 'Unable to parse config' });
}
- updateLogStreamAlerts(parsedConfig);
+ updateLogStreamAlerts({config: parsedConfig, onSuccess: closeAlertsModal});
} else {
return notifyError({ message: 'Unable to parse config' });
}
diff --git a/src/pages/Logs/LogTable.tsx b/src/pages/Logs/LogTable.tsx
index db630d92..586a2bbf 100644
--- a/src/pages/Logs/LogTable.tsx
+++ b/src/pages/Logs/LogTable.tsx
@@ -73,7 +73,7 @@ const TotalLogsCount = (props: TotalLogsCountProps) => {
const renderTotalCount = useCallback(() => ({HumanizeNumber(totalCount)}), [totalCount]);
return (
-
+
{`Showing ${loadedCount < LOAD_LIMIT ? loadedCount : LOAD_LIMIT} out of`}
{renderTotalCount()}
@@ -498,57 +498,64 @@ const LogTable: FC = () => {
)}
-
- {!loading && !logsLoading ? (
- {
- goToPage(page, pageLogData?.limit || 1);
- pagination.setPage(page);
- }}>
-
- {
- if (pageOffset !== 0) setPageOffset((value) => value - loadLimit);
- }}
- disabled={pageOffset === 0}
- />
-
- {pagination.range.map((page) => {
- if (page === 'dots') {
- return ;
- } else {
- return (
- {
- goToPage(page);
- pagination.setPage(page);
- }}>
- {pageLogData?.limit ? page + pageOffset / pageLogData?.limit ?? 1 : page}
-
- );
- }
- })}
-
-
- {
- setPageOffset((value) => {
- return value + loadLimit;
- });
- }}
- disabled={false}
- />
-
-
- ) : (
-
- )}
-
+
+
+
+
+ {!loading && !logsLoading ? (
+ {
+ goToPage(page, pageLogData?.limit || 1);
+ pagination.setPage(page);
+ }}>
+
+ {
+ if (pageOffset !== 0) setPageOffset((value) => value - loadLimit);
+ }}
+ disabled={pageOffset === 0}
+ />
+
+ {pagination.range.map((page) => {
+ if (page === 'dots') {
+ return ;
+ } else {
+ return (
+ {
+ goToPage(page);
+ pagination.setPage(page);
+ }}>
+ {pageLogData?.limit ? page + pageOffset / pageLogData?.limit ?? 1 : page}
+
+ );
+ }
+ })}
+
+ {
+ setPageOffset((value) => {
+ return value + loadLimit;
+ });
+ }}
+ disabled={false}
+ />
+
+
+ ) : (
+
+
+
+ )}
+
+
+
+
);
diff --git a/src/pages/Logs/QueryCodeEditor.tsx b/src/pages/Logs/QueryCodeEditor.tsx
index ed841e42..d506f667 100644
--- a/src/pages/Logs/QueryCodeEditor.tsx
+++ b/src/pages/Logs/QueryCodeEditor.tsx
@@ -156,7 +156,7 @@ const QueryCodeEditor: FC = () => {
-