first commit

This commit is contained in:
Beyhan Oğur
2026-04-26 21:52:23 +03:00
commit 880f412e2c
2662 changed files with 866266 additions and 0 deletions

View File

@@ -0,0 +1,11 @@
import BigQueryConnectorView from "@enterprise/components/data-connectors/bigquery/bigqueryConnectorView";
export default function BigQueryView() {
return (
<div className="flex w-full flex-col gap-4">
<div className="flex w-full flex-col gap-3">
<BigQueryConnectorView />
</div>
</div>
);
}

View File

@@ -0,0 +1,11 @@
import DatadogConnectorView from "@enterprise/components/data-connectors/datadog/datadogConnectorView";
export default function DatadogView() {
return (
<div className="flex w-full flex-col gap-4">
<div className="flex w-full flex-col gap-3">
<DatadogConnectorView />
</div>
</div>
);
}

View File

@@ -0,0 +1,54 @@
import { getErrorMessage, useAppSelector, useUpdatePluginMutation } from "@/lib/store";
import { MaximConfigSchema, MaximFormSchema } from "@/lib/types/schemas";
import { useMemo } from "react";
import { toast } from "sonner";
import { MaximFormFragment } from "../../fragments/maximFormFragment";
interface MaximViewProps {
onDelete?: () => void;
isDeleting?: boolean;
}
export default function MaximView({ onDelete, isDeleting }: MaximViewProps) {
const selectedPlugin = useAppSelector((state) => state.plugin.selectedPlugin);
const [updatePlugin] = useUpdatePluginMutation();
const currentConfig = useMemo(
() => ({ ...((selectedPlugin?.config as MaximConfigSchema) ?? {}), enabled: selectedPlugin?.enabled }),
[selectedPlugin],
);
const handleMaximConfigSave = (config: MaximFormSchema): Promise<void> => {
return new Promise((resolve, reject) => {
updatePlugin({
name: "maxim",
data: {
enabled: config.enabled,
config: config.maxim_config,
},
})
.unwrap()
.then(() => {
toast.success("Maxim configuration updated successfully");
resolve();
})
.catch((err) => {
toast.error("Failed to update Maxim configuration", {
description: getErrorMessage(err),
});
reject(err);
});
});
};
return (
<div className="flex w-full flex-col gap-4">
<div className="flex w-full flex-col gap-2">
<div className="text-muted-foreground text-xs font-medium">Configuration</div>
<div className="text-muted-foreground mb-2 text-xs font-normal">
You can send in header <code>x-bf-log-repo-id</code> with a repository ID to log to a specific repository.
</div>
<MaximFormFragment onSave={handleMaximConfigSave} initialConfig={currentConfig} onDelete={onDelete} isDeleting={isDeleting} />
</div>
</div>
);
}

View File

@@ -0,0 +1,8 @@
export default function NewrelicView() {
return (
<div
style={{ display: "flex", justifyContent: "center", alignItems: "center", height: "30vh" }}
className="bg-zinc-100/10 dark:bg-zinc-800/20"
></div>
);
}

View File

@@ -0,0 +1,51 @@
import { getErrorMessage, useAppSelector, useUpdatePluginMutation } from "@/lib/store";
import { OtelConfigSchema, OtelFormSchema } from "@/lib/types/schemas";
import { useMemo } from "react";
import { toast } from "sonner";
import { OtelFormFragment } from "../../fragments/otelFormFragment";
interface OtelViewProps {
onDelete?: () => void;
isDeleting?: boolean;
}
export default function OtelView({ onDelete, isDeleting }: OtelViewProps) {
const selectedPlugin = useAppSelector((state) => state.plugin.selectedPlugin);
const currentConfig = useMemo(
() => ({ ...((selectedPlugin?.config as OtelConfigSchema) ?? {}), enabled: selectedPlugin?.enabled }),
[selectedPlugin],
);
const [updatePlugin] = useUpdatePluginMutation();
const baseUrl = `${window.location.protocol}//${window.location.host}`;
const handleOtelConfigSave = (config: OtelFormSchema): Promise<void> => {
return new Promise((resolve, reject) => {
updatePlugin({
name: "otel",
data: {
enabled: config.enabled,
config: config.otel_config,
},
})
.unwrap()
.then(() => {
resolve();
toast.success("OTEL configuration updated successfully");
})
.catch((err) => {
toast.error("Failed to update OTEL configuration", {
description: getErrorMessage(err),
});
reject(err);
});
});
};
return (
<div className="flex w-full flex-col gap-4">
<div className="flex w-full flex-col gap-3">
<OtelFormFragment onSave={handleOtelConfigSave} currentConfig={currentConfig} onDelete={onDelete} isDeleting={isDeleting} />
</div>
</div>
);
}

View File

@@ -0,0 +1,96 @@
import { getErrorMessage, useAppSelector, useUpdatePluginMutation } from "@/lib/store";
import { PrometheusFormSchema } from "@/lib/types/schemas";
import { useMemo } from "react";
import { toast } from "sonner";
import { PrometheusFormFragment } from "../../fragments/prometheusFormFragment";
interface PushGatewayConfig {
push_gateway_url?: string;
job_name?: string;
instance_id?: string;
push_interval?: number;
basic_auth?: {
username?: string;
password?: string;
};
}
interface TelemetryConfig {
push_gateway?: PushGatewayConfig;
}
interface PrometheusViewProps {
onDelete?: () => void;
isDeleting?: boolean;
}
export default function PrometheusView({ onDelete, isDeleting }: PrometheusViewProps) {
const selectedPlugin = useAppSelector((state) => state.plugin.selectedPlugin);
const currentConfig = useMemo(() => {
const telemetryConfig = (selectedPlugin?.config as TelemetryConfig) ?? {};
const pushGateway = telemetryConfig.push_gateway ?? {};
return {
...pushGateway,
enabled: selectedPlugin?.enabled,
};
}, [selectedPlugin]);
const [updatePlugin] = useUpdatePluginMutation();
const baseUrl = `${window.location.protocol}//${window.location.host}`;
const metricsEndpoint = `${baseUrl}/metrics`;
const handlePrometheusConfigSave = (config: PrometheusFormSchema): Promise<void> => {
return new Promise((resolve, reject) => {
// Transform the form data to the telemetry plugin's push_gateway config format
const pushGatewayConfig: PushGatewayConfig = {
push_gateway_url: config.prometheus_config.push_gateway_url,
job_name: config.prometheus_config.job_name,
instance_id: config.prometheus_config.instance_id || undefined,
push_interval: config.prometheus_config.push_interval,
};
// Add basic auth if both username and password are provided
if (config.prometheus_config.basic_auth_username?.trim() && config.prometheus_config.basic_auth_password?.trim()) {
pushGatewayConfig.basic_auth = {
username: config.prometheus_config.basic_auth_username,
password: config.prometheus_config.basic_auth_password,
};
}
updatePlugin({
name: "telemetry",
data: {
enabled: config.enabled,
config: {
push_gateway: pushGatewayConfig,
},
},
})
.unwrap()
.then(() => {
resolve();
toast.success("Prometheus configuration updated successfully");
})
.catch((err) => {
toast.error("Failed to update Prometheus configuration", {
description: getErrorMessage(err),
});
reject(err);
});
});
};
return (
<div className="flex w-full flex-col gap-4">
<div className="flex w-full flex-col gap-3">
<PrometheusFormFragment
onSave={handlePrometheusConfigSave}
currentConfig={currentConfig}
metricsEndpoint={metricsEndpoint}
onDelete={onDelete}
isDeleting={isDeleting}
/>
</div>
</div>
);
}