diff --git a/frontend/src/components/AnalyticsTab.jsx b/frontend/src/components/AnalyticsTab.jsx index 8938262e..c97560ed 100644 --- a/frontend/src/components/AnalyticsTab.jsx +++ b/frontend/src/components/AnalyticsTab.jsx @@ -1,275 +1,278 @@ -import React, { useEffect, useState } from 'react'; -import Switch from '@mui/material/Switch'; -import { Typography, Button } from '@mui/material'; -import { useNavigate, Link, useParams } from "react-router-dom"; -import { Bar } from 'react-chartjs-2'; -import Grid from '@mui/material/Grid'; -import SearchIcon from '@mui/icons-material/Search'; -import NewReleasesIcon from '@mui/icons-material/NewReleases'; -import MailOutlineIcon from '@mui/icons-material/MailOutline'; +// import React, { useEffect, useState } from 'react'; +// import Switch from '@mui/material/Switch'; +// import { Typography, Button } from '@mui/material'; +// import { useNavigate, Link, useParams } from "react-router-dom"; +// import { Bar } from 'react-chartjs-2'; +// import Grid from '@mui/material/Grid'; +// import SearchIcon from '@mui/icons-material/Search'; +// import NewReleasesIcon from '@mui/icons-material/NewReleases'; +// import MailOutlineIcon from '@mui/icons-material/MailOutline'; const AnalyticsTab = (props) => { const { userdata, globalUrl, serverside } = props; - const [checked, setChecked] = useState(false); - const [selectedOption, setSelectedOption] = useState('all'); - const [expand, setExpand] = useState(false) - const isCloud = (window.location.host === "localhost:3002" || window.location.host === "shuffler.io") ? true : (process.env.IS_SSR === "true"); + + console.log("if you need this, work without react-rechartjs-2") + + // const [checked, setChecked] = useState(false); + // const [selectedOption, setSelectedOption] = useState('all'); + // const [expand, setExpand] = useState(false) + // const isCloud = (window.location.host === "localhost:3002" || window.location.host === "shuffler.io") ? true : (process.env.IS_SSR === "true"); - const handleOptionChange = (option) => { - setSelectedOption(option); - // You can perform actions based on the selected option, such as filtering data - }; + // const handleOptionChange = (option) => { + // setSelectedOption(option); + // // You can perform actions based on the selected option, such as filtering data + // }; - const handleChange = (event) => { - setChecked(event.target.checked); - }; + // const handleChange = (event) => { + // setChecked(event.target.checked); + // }; - const allData = { - labels: ['Email analysis', 'Email Management', 'EDR to Ticket', 'Ticket Analysis'], - datasets: [ - { - label: 'Revisions', - data: [12, 19, 3, 5], // Data for revisions - backgroundColor: '#FF8444', - borderWidth: 1, - // borderRadius: 60, - barPercentage: 0.7, - categoryPercentage: 0.5, - }, - { - label: 'Runs', - data: [8, 15, 5, 8], // Data for runs - backgroundColor: '#9747FF', - borderWidth: 1, - // borderRadius: 60, - barPercentage: 0.7, - categoryPercentage: 0.5 - } - ] - }; + // const allData = { + // labels: ['Email analysis', 'Email Management', 'EDR to Ticket', 'Ticket Analysis'], + // datasets: [ + // { + // label: 'Revisions', + // data: [12, 19, 3, 5], // Data for revisions + // backgroundColor: '#FF8444', + // borderWidth: 1, + // // borderRadius: 60, + // barPercentage: 0.7, + // categoryPercentage: 0.5, + // }, + // { + // label: 'Runs', + // data: [8, 15, 5, 8], // Data for runs + // backgroundColor: '#9747FF', + // borderWidth: 1, + // // borderRadius: 60, + // barPercentage: 0.7, + // categoryPercentage: 0.5 + // } + // ] + // }; - let data; - if (selectedOption === 'all') { - data = allData; - } else if (selectedOption === 'revisions') { - data = { - labels: allData.labels, - datasets: [allData.datasets[0]] // Show only revisions data - }; - } else if (selectedOption === 'run') { - data = { - labels: allData.labels, - datasets: [allData.datasets[1]] // Show only runs data - }; - } + // let data; + // if (selectedOption === 'all') { + // data = allData; + // } else if (selectedOption === 'revisions') { + // data = { + // labels: allData.labels, + // datasets: [allData.datasets[0]] // Show only revisions data + // }; + // } else if (selectedOption === 'run') { + // data = { + // labels: allData.labels, + // datasets: [allData.datasets[1]] // Show only runs data + // }; + // } - // Options for the chart - const options = { - scales: { - yAxes: [ - { - ticks: { - beginAtZero: true - } - } - ] - }, - }; - return ( -
-
-
Timeline
-
-
-
-
-
-
Apps
- Category -
- { setExpand(prevExpand => !prevExpand); }} style={{ color: "#FF8444" }}>Expand -
- {expand ? null : -
-
- Onboarding - - -
- - {checked ? -
: - null - } -
-
- -
- - {checked ? -
: - null - } -
-
- -
- - {checked ? -
: - null - } -
-
-
-
-
-
- Other - - -
- - {checked ? -
: - null - } -
-
- -
- - {checked ? -
: - null - } -
-
- -
- - {checked ? -
: - null - } -
-
-
-
-
} -
-
-
Workflows
-
- - - -
- -
-
-
-
Insights
-
-
-
-
Sessions Overview
-
-
-
- 2.8 Hours -
-
- Avg. Activity per session -
-
-
-
- /usercases/edr to ticket -
-
- Last visited page -
-
-
-
- /workflow/email management -
-
- Most visited page -
-
-
-
-
- ); + // // Options for the chart + // const options = { + // scales: { + // yAxes: [ + // { + // ticks: { + // beginAtZero: true + // } + // } + // ] + // }, + // }; + // return ( + //
+ //
+ //
Timeline
+ //
+ //
+ //
+ //
+ //
+ //
Apps
+ // Category + //
+ // { setExpand(prevExpand => !prevExpand); }} style={{ color: "#FF8444" }}>Expand + //
+ // {expand ? null : + //
+ //
+ // Onboarding + // + // + //
+ // + // {checked ? + //
: + // null + // } + //
+ //
+ // + //
+ // + // {checked ? + //
: + // null + // } + //
+ //
+ // + //
+ // + // {checked ? + //
: + // null + // } + //
+ //
+ //
+ //
+ //
+ //
+ // Other + // + // + //
+ // + // {checked ? + //
: + // null + // } + //
+ //
+ // + //
+ // + // {checked ? + //
: + // null + // } + //
+ //
+ // + //
+ // + // {checked ? + //
: + // null + // } + //
+ //
+ //
+ //
+ //
} + //
+ //
+ //
Workflows
+ //
+ // + // + // + //
+ // + //
+ //
+ //
+ //
Insights
+ //
+ //
+ //
+ //
Sessions Overview
+ //
+ //
+ //
+ // 2.8 Hours + //
+ //
+ // Avg. Activity per session + //
+ //
+ //
+ //
+ // /usercases/edr to ticket + //
+ //
+ // Last visited page + //
+ //
+ //
+ //
+ // /workflow/email management + //
+ //
+ // Most visited page + //
+ //
+ //
+ //
+ //
+ // ); }; export default AnalyticsTab; diff --git a/frontend/src/components/DashboardBarchart.jsx b/frontend/src/components/DashboardBarchart.jsx index 58f20708..74970549 100644 --- a/frontend/src/components/DashboardBarchart.jsx +++ b/frontend/src/components/DashboardBarchart.jsx @@ -65,80 +65,83 @@ export const LoadStats = (globalUrl, cachekey) => { } const DashboardBarchart = (props) => { - const { timelineData, title, height, } = props; - var inputHeight = 15 - if (height !== undefined && height !== null) { - inputHeight = height - } + // this is clearly unfinished and not worth my time. + // refer to health page to see how i made it work there w/o using chartjs - const barOptions = { - plugins: { - tooltip: { - enabled: true, // Ensure tooltips are enabled - }, - }, - tooltips: { - mode: 'index', - intersect: false, - }, - legend: { - display: false - }, - layout: { - padding: { - top: 0, // Adjust the top padding as needed - bottom: -10, // Adjust the bottom padding as needed - left: 0, // Adjust the left padding as needed - right: 0, // Adjust the right padding as needed - }, - }, - scales: { - y: { - beginAtZero: false, - }, - yAxes: [{ - ticks: { - display: false - }, - beginAtZero: false, - }], - xAxes: [{ - ticks: { - display: false - }, - beginAtZero: false, - }] - }, - tooltips: { - callbacks: { - label: function (tooltipItem, data) { - const label = data.labels[tooltipItem.index] - return label.split('\n')[0] - }, - afterLabel: function (tooltipItem, data) { - const amount = tooltipItem.value === undefined || tooltipItem.value === null ? 0 : tooltipItem.value - return `Amount: ${amount}` - }, - title: function () { - return title === undefined ? '' : title - } - } - } - } + // const { timelineData, title, height, } = props; + // var inputHeight = 15 + // if (height !== undefined && height !== null) { + // inputHeight = height + // } - return ( - { - if (elements && elements.length > 0) { - //toast("Click event") - console.log("Clicked: ", elements) - } - }} - /> - ) + // const barOptions = { + // plugins: { + // tooltip: { + // enabled: true, // Ensure tooltips are enabled + // }, + // }, + // tooltips: { + // mode: 'index', + // intersect: false, + // }, + // legend: { + // display: false + // }, + // layout: { + // padding: { + // top: 0, // Adjust the top padding as needed + // bottom: -10, // Adjust the bottom padding as needed + // left: 0, // Adjust the left padding as needed + // right: 0, // Adjust the right padding as needed + // }, + // }, + // scales: { + // y: { + // beginAtZero: false, + // }, + // yAxes: [{ + // ticks: { + // display: false + // }, + // beginAtZero: false, + // }], + // xAxes: [{ + // ticks: { + // display: false + // }, + // beginAtZero: false, + // }] + // }, + // tooltips: { + // callbacks: { + // label: function (tooltipItem, data) { + // const label = data.labels[tooltipItem.index] + // return label.split('\n')[0] + // }, + // afterLabel: function (tooltipItem, data) { + // const amount = tooltipItem.value === undefined || tooltipItem.value === null ? 0 : tooltipItem.value + // return `Amount: ${amount}` + // }, + // title: function () { + // return title === undefined ? '' : title + // } + // } + // } + // } + + // return ( + // { + // if (elements && elements.length > 0) { + // //toast("Click event") + // console.log("Clicked: ", elements) + // } + // }} + // /> + // ) } export default DashboardBarchart; diff --git a/frontend/src/components/OrganizationTab.jsx b/frontend/src/components/OrganizationTab.jsx index 3fc2cbee..1911bfad 100644 --- a/frontend/src/components/OrganizationTab.jsx +++ b/frontend/src/components/OrganizationTab.jsx @@ -3,7 +3,6 @@ import { Link, useNavigate, useLocation } from "react-router-dom"; import Billing from "../components/Billing.jsx"; import Priorities from "../components/Priorities.jsx"; import Branding from "../components/Branding.jsx"; -import AnalyticsTab from '../components/AnalyticsTab.jsx'; import EditOrgTab from '../components/EditOrgTab.jsx'; import CloudSyncTab from '../components/CloudSyncTab.jsx'; import SSOTab from "../components/ssoTab.jsx" diff --git a/frontend/src/views/DashboardViews.jsx b/frontend/src/views/DashboardViews.jsx index 9f913261..4bf532a6 100644 --- a/frontend/src/views/DashboardViews.jsx +++ b/frontend/src/views/DashboardViews.jsx @@ -6,12 +6,9 @@ import classNames from "classnames"; import theme from '../theme.jsx'; import { useNavigate, Link, useParams } from "react-router-dom"; -// react plugin used to create charts -//import { Line, Bar } from "react-chartjs-2"; -//import { useAlert import { ToastContainer, toast } from "react-toastify" import Draggable from "react-draggable"; -import DashboardBarchart, { LoadStats } from '../components/DashboardBarchart.jsx'; +// import DashboardBarchart, { LoadStats } from '../components/DashboardBarchart.jsx'; import { Autocomplete, @@ -311,9 +308,13 @@ const RadialChart = ({keys, setSelectedCategory}) => { //axis={} } + +// 0x0elliot: not cleaning this up. this seems clearly experimental. not worth my time. + // This is the start of a dashboard that can be used. // What data do we fill in here? Idk const Dashboard = (props) => { + const { globalUrl, isLoggedIn } = props; //const alert = useAlert(); const [bigChartData, setBgChartData] = useState("data1");