Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

fix: hide export button if insufficient access rights (#2572)

Hassieb Pakzad324d96fc2efc
diff --git a/web/src/components/BatchExportTableButton.tsx b/web/src/components/BatchExportTableButton.tsx
index 453b9c2b53..810ed6155e 100644
--- a/web/src/components/BatchExportTableButton.tsx
+++ b/web/src/components/BatchExportTableButton.tsx
@@ -15,6 +15,7 @@ import {
import React from "react";
import { api } from "@/src/utils/api";
import { showSuccessToast } from "@/src/features/notifications/showSuccessToast";
+import { useHasAccess } from "@/src/features/rbac/utils/checkAccess";
import { useIsEeEnabled } from "@/src/ee/utils/useIsEeEnabled";
export type BatchExportTableButtonProps = {
@@ -31,6 +32,10 @@ export const BatchExportTableButton: React.FC<BatchExportTableButtonProps> = (
const [isExporting, setIsExporting] = React.useState(false);
const createExport = api.batchExport.create.useMutation();
const isEeEnabled = useIsEeEnabled();
+ const hasAccess = useHasAccess({
+ projectId: props.projectId,
+ scope: "batchExport:create",
+ });
const handleExport = async (format: BatchExportFileFormat) => {
setIsExporting(true);
@@ -51,7 +56,7 @@ export const BatchExportTableButton: React.FC<BatchExportTableButtonProps> = (
});
};
- if (!isEeEnabled) return null;
+ if (!isEeEnabled || !hasAccess) return null;
return (
<DropdownMenu>
diff --git a/web/src/features/dashboard/components/MetricTable.tsx b/web/src/features/dashboard/components/MetricTable.tsx
index 07c45b41fd..4b66cc5e87 100644
--- a/web/src/features/dashboard/components/MetricTable.tsx
+++ b/web/src/features/dashboard/components/MetricTable.tsx
@@ -23,7 +23,7 @@ export const MetricTable = ({
{
projectId,
from: env.NEXT_PUBLIC_LANGFUSE_CLOUD_REGION // Langfuse Cloud has already completed the cost backfill job, thus cost can be pulled directly from obs. table
- ? "observations"
+ ? "traces_observations"
: "traces_observationsview",
select: [
{ column: "calculatedTotalCost", agg: "SUM" },
diff --git a/web/src/features/dashboard/components/ModelUsageChart.tsx b/web/src/features/dashboard/components/ModelUsageChart.tsx
index 24dd18738e..805b5fa8f8 100644
--- a/web/src/features/dashboard/components/ModelUsageChart.tsx
+++ b/web/src/features/dashboard/components/ModelUsageChart.tsx
@@ -37,7 +37,7 @@ export const ModelUsageChart = ({
{
projectId,
from: env.NEXT_PUBLIC_LANGFUSE_CLOUD_REGION // Langfuse Cloud has already completed the cost backfill job, thus cost can be pulled directly from obs. table
- ? "observations"
+ ? "traces_observations"
: "traces_observationsview",
select: [
{ column: "totalTokens", agg: "SUM" },