Skip to content

Commit

Permalink
add powerbi folder restore dashboard folder
Browse files Browse the repository at this point in the history
  • Loading branch information
rezart95 committed Feb 17, 2024
1 parent 96e28d8 commit d8dd0f6
Show file tree
Hide file tree
Showing 6 changed files with 77 additions and 132 deletions.
45 changes: 39 additions & 6 deletions frontend/src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@ import AIAnalystPage from "./pages/ai-analyst/AIAnalystPage";
import BlogPage from "./pages/blog/BlogPage";
import ChangePasswordPage from "./pages/change-password/ChangePasswordPage";
import CreateChartPage from "./pages/charts/CreateChartPage";
import CreatePowerBIDashboard from "./pages/powerbi/CreatePowerBIDashboard";
import CreateDashboardPage from "./pages/dashboards/CreateDashboard";
import Dashboard from "./pages/dashboards/Dashboard";
import DashboardMenuPage from "./pages/dashboards/DashboardsMenuPage";
import Dashboard from "./pages/dashboards/Dashboard";
import PowerBIDashboardTable from "./pages/powerbi/PowerBIDashboardTable";
import PowerBIDashboardsMenuPage from "./pages/powerbi/PowerBIDashboardsMenuPage";
import ForgotPasswordPage from "./pages/forgot-password/ForgotPasswordPage";
import LandingPage from "./pages/landing/LandingPage";
import LoginPage from "./pages/login/LoginPage";
Expand All @@ -25,7 +28,7 @@ import ResetPasswordPage from "./pages/reset-password/ResetPasswordPage";
import UploadPage from "./pages/upload/UploadPage";
import UserPage from "./pages/user/UserPage";
import VerifyEmailPage from "./pages/verify-email/VerifyEmailPage";
import ReportPage from "./pages/dashboards/ReportPage";
import PowerBIReportPage from "./pages/powerbi/PowerBIReportPage";
import { APP_ENV } from "./utils/constants";

function AppWrapper() {
Expand Down Expand Up @@ -138,21 +141,51 @@ function App() {
}
/>
<Route
path="/dashboards"
path="/powerbi"
element={
<RequireAuth>
<AppLayout>
<DashboardMenuPage />
<PowerBIDashboardsMenuPage />
</AppLayout>
</RequireAuth>
}
/>
<Route
path="/powerbi/:report_id"
element={
<RequireAuth>
<AppLayout>
<PowerBIReportPage />
</AppLayout>
</RequireAuth>
}
/>
<Route
path="/powerbi/create"
element={
<RequireAuth>
<AppLayout>
<CreatePowerBIDashboard />
</AppLayout>
</RequireAuth>
}
/>
<Route
path="/dashboards/:report_id"
path="/powerbi/:dashboardId"
element={
<RequireAuth>
<AppLayout>
<ReportPage />
<PowerBIDashboardTable />
</AppLayout>
</RequireAuth>
}
/>
<Route
path="/dashboards"
element={
<RequireAuth>
<AppLayout>
<DashboardMenuPage />
</AppLayout>
</RequireAuth>
}
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/components/navigation/Navigation.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import SmartToyIcon from "@mui/icons-material/SmartToy";
import ChevronLeftIcon from "@mui/icons-material/ChevronLeft";
import ChevronRightIcon from "@mui/icons-material/ChevronRight";
import DashboardIcon from "@mui/icons-material/Dashboard";
import TableChartIcon from "@mui/icons-material/TableChart";
import UploadFileIcon from "@mui/icons-material/UploadFile";

import AdminPanelSettingsIcon from "@mui/icons-material/AdminPanelSettings";
Expand All @@ -38,6 +39,7 @@ const Navigation = () => {
{ text: "Data Upload", icon: <UploadFileIcon />, path: "/upload" },
{ text: "AI Analyst", icon: <SmartToyIcon />, path: "/ai-analyst" },
{ text: "User Panel", icon: <AccountBoxIcon />, path: "/user" },
{ text: "PowerBI", icon: <TableChartIcon />, path: "/powerbi" },
// { text: 'Logout', icon: <LogoutIcon />, path: '/logout' }
];

Expand Down
9 changes: 5 additions & 4 deletions frontend/src/pages/dashboards/Dashboard.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import AddCircleOutlineIcon from "@mui/icons-material/AddCircleOutline";
import { Box, Grid, IconButton, Paper, Typography } from "@mui/material";
import React, { useEffect, useState } from "react";
import { useNavigate, useParams } from "react-router-dom";
import { API_URL } from "../../utils/constants";
import { useParams } from "react-router-dom";
import { Box, Grid, IconButton, Paper, Typography } from "@mui/material";
import AddCircleOutlineIcon from "@mui/icons-material/AddCircleOutline";
import { useNavigate } from "react-router-dom";
import ChartDisplay from "../charts/ChartDisplay";
import { API_URL } from "../../utils/constants";

function Dashboard() {
const { dashboardId } = useParams();
Expand Down
68 changes: 30 additions & 38 deletions frontend/src/pages/dashboards/DashboardTable.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React, { useState, useEffect } from "react";
import { Link } from "react-router-dom";
import {
Table,
TableBody,
Expand All @@ -8,20 +7,18 @@ import {
TableRow,
Tooltip,
} from "@mui/material";
import { Link } from "react-router-dom";
import { format } from "date-fns";
import { API_URL } from "../../utils/constants";
import axios from "axios";

function DashboardTable() {
const [reports, setReports] = useState([]);

console.log("reports", reports);
const [dashboards, setDashboards] = useState([]);

useEffect(() => {
axios
.get(`${API_URL}powerbi/reports/`)
.then((response) => setReports(response.data.reports.value))
.catch((error) => console.error("Error fetching reports:", error));
fetch(`${API_URL}/dashboards/`)
.then((response) => response.json())
.then((data) => setDashboards(data))
.catch((error) => console.error("Error fetching dashboards:", error));
}, []);

return (
Expand All @@ -35,35 +32,30 @@ function DashboardTable() {
</TableRow>
</TableHead>
<TableBody>
{reports.length > 0 &&
reports.map((report) => (
<TableRow key={report.name} hover>
<TableCell>
<Link to={`/dashboards/${report.id}`}>{report.name}</Link>
</TableCell>
<TableCell
style={{
overflow: "hidden",
textOverflow: "ellipsis",
whiteSpace: "nowrap",
}}
>
<Tooltip title={report.description} placement="top">
<div>{report.description}</div>
</Tooltip>
</TableCell>
<TableCell>
{report.created_at
? format(new Date(report.created_at), "yyyy-MM-dd")
: "N/A"}
</TableCell>
<TableCell>
{report.updated_at
? format(new Date(report.updated_at), "yyyy-MM-dd")
: "N/A"}
</TableCell>
</TableRow>
))}
{dashboards.map((dashboard) => (
<TableRow key={dashboard.name} hover>
<TableCell>
<Link to={`/dashboards/${dashboard.id}`}>{dashboard.name}</Link>
</TableCell>
<TableCell
style={{
overflow: "hidden",
textOverflow: "ellipsis",
whiteSpace: "nowrap",
}}
>
<Tooltip title={dashboard.description} placement="top">
<div>{dashboard.description}</div>
</Tooltip>
</TableCell>
<TableCell>
{format(new Date(dashboard.created_at), "yyyy-MM-dd")}
</TableCell>
<TableCell>
{format(new Date(dashboard.updated_at), "yyyy-MM-dd")}
</TableCell>
</TableRow>
))}
</TableBody>
</Table>
);
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/dashboards/DashboardsMenuPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function DashboardMenuPage() {
return (
<Box>
<Typography variant="h4" gutterBottom>
📊 Reports
📊 Dashboards
</Typography>
<Button
variant="contained"
Expand Down
83 changes: 0 additions & 83 deletions frontend/src/pages/dashboards/ReportPage.jsx

This file was deleted.

0 comments on commit d8dd0f6

Please sign in to comment.