resolved conflicts

This commit is contained in:
Dhruwang
2026-02-18 16:04:39 +05:30
3 changed files with 25 additions and 3 deletions

View File

@@ -122,6 +122,7 @@
"activity": "Activity",
"add": "Add",
"add_action": "Add action",
"add_chart": "Add chart",
"add_filter": "Add filter",
"add_logo": "Add logo",
"add_member": "Add member",

View File

@@ -17,6 +17,7 @@ export interface UseCreateChartDialogProps {
onOpenChange: (open: boolean) => void;
environmentId: string;
chartId?: string;
defaultDashboardId?: string;
onSuccess?: () => void;
}
@@ -25,6 +26,7 @@ export function useCreateChartDialog({
onOpenChange,
environmentId,
chartId,
defaultDashboardId,
onSuccess,
}: UseCreateChartDialogProps) {
const [selectedChartType, setSelectedChartType] = useState<string>("");
@@ -33,7 +35,7 @@ export function useCreateChartDialog({
const [isAddToDashboardDialogOpen, setIsAddToDashboardDialogOpen] = useState(false);
const [chartName, setChartName] = useState("");
const [dashboards, setDashboards] = useState<Array<{ id: string; name: string }>>([]);
const [selectedDashboardId, setSelectedDashboardId] = useState<string>("");
const [selectedDashboardId, setSelectedDashboardId] = useState<string>(defaultDashboardId ?? "");
const [isSaving, setIsSaving] = useState(false);
const [isLoadingChart, setIsLoadingChart] = useState(false);
const [currentChartId, setCurrentChartId] = useState<string | undefined>(chartId);

View File

@@ -1,6 +1,6 @@
"use client";
import { CopyIcon, PencilIcon, TrashIcon } from "lucide-react";
import { CopyIcon, PencilIcon, PlusIcon, TrashIcon } from "lucide-react";
import { useRouter } from "next/navigation";
import { useState } from "react";
import toast from "react-hot-toast";
@@ -8,7 +8,8 @@ import { useTranslation } from "react-i18next";
import { DeleteDialog } from "@/modules/ui/components/delete-dialog";
import { IconBar } from "@/modules/ui/components/iconbar";
import { deleteDashboardAction } from "../actions";
import { TDashboard } from "../../types/analysis";
import { TDashboard } from "@/modules/ee/analysis/types/analysis";
import { CreateChartDialog } from "@/modules/ee/analysis/charts/components/create-chart-dialog";
import { EditDashboardDialog } from "./edit-dashboard-dialog";
interface DashboardControlBarProps {
@@ -27,6 +28,7 @@ export const DashboardControlBar = ({
const [isDeleteDialogOpen, setDeleteDialogOpen] = useState(false);
const [isDeleting, setIsDeleting] = useState(false);
const [isEditDialogOpen, setIsEditDialogOpen] = useState(false);
const [isAddChartDialogOpen, setIsAddChartDialogOpen] = useState(false);
const handleDeleteDashboard = async () => {
setIsDeleting(true);
@@ -52,6 +54,14 @@ export const DashboardControlBar = ({
};
const iconActions = [
{
icon: PlusIcon,
tooltip: t("common.add_chart"),
onClick: () => {
setIsAddChartDialogOpen(true);
},
isVisible: true,
},
{
icon: PencilIcon,
tooltip: t("common.edit"),
@@ -100,6 +110,15 @@ export const DashboardControlBar = ({
router.refresh();
}}
/>
<CreateChartDialog
open={isAddChartDialogOpen}
onOpenChange={setIsAddChartDialogOpen}
environmentId={environmentId}
onSuccess={() => {
setIsAddChartDialogOpen(false);
router.refresh();
}}
/>
</>
);
};