diff --git a/frontend/app/components/Dashboard/components/MetricsList/MetricsList.tsx b/frontend/app/components/Dashboard/components/MetricsList/MetricsList.tsx new file mode 100644 index 000000000..5f7c19b17 --- /dev/null +++ b/frontend/app/components/Dashboard/components/MetricsList/MetricsList.tsx @@ -0,0 +1,55 @@ +import { useObserver } from 'mobx-react-lite'; +import React from 'react'; +import { Icon, NoContent, Label, Link } from 'UI'; +import { useDashboardStore } from '../../store/store'; + +interface Props { } +function MetricsList(props: Props) { + const store: any = useDashboardStore(); + const widgets = store.widgets; + const lenth = widgets.length; + + return useObserver(() => ( + +
+
+
Title
+
Type
+
Dashboards
+
Owner
+
Visibility & Edit Access
+
Last Modified
+
+ + {widgets.map((metric: any) => ( +
+
+ + {metric.name} + +
+
+
Dashboards
+
{metric.owner}
+
+ {metric.isPrivate ? ( +
+ + Private +
+ ) : ( +
+ + Team +
+ )} +
+
Last Modified
+
+ ))} +
+
+ )); +} + +export default MetricsList; \ No newline at end of file diff --git a/frontend/app/components/Dashboard/components/MetricsList/index.ts b/frontend/app/components/Dashboard/components/MetricsList/index.ts new file mode 100644 index 000000000..ad693888c --- /dev/null +++ b/frontend/app/components/Dashboard/components/MetricsList/index.ts @@ -0,0 +1 @@ +export { default } from './MetricsList'; \ No newline at end of file diff --git a/frontend/app/components/Dashboard/components/MetricsView/MetricsView.tsx b/frontend/app/components/Dashboard/components/MetricsView/MetricsView.tsx index d358075db..e00402d1f 100644 --- a/frontend/app/components/Dashboard/components/MetricsView/MetricsView.tsx +++ b/frontend/app/components/Dashboard/components/MetricsView/MetricsView.tsx @@ -1,14 +1,22 @@ import React from 'react'; -import { Button, PageTitle, Link } from 'UI'; +import { Button, PageTitle, Icon, Link } from 'UI'; import { withSiteId, dashboardMetricCreate } from 'App/routes'; +import MetricsList from '../MetricsList'; function MetricsView(props) { return (
-
+
{/* */} +
+ +
+
); } diff --git a/frontend/app/components/Dashboard/store/dashboardStore.ts b/frontend/app/components/Dashboard/store/dashboardStore.ts index 8f03c4e59..854565e1b 100644 --- a/frontend/app/components/Dashboard/store/dashboardStore.ts +++ b/frontend/app/components/Dashboard/store/dashboardStore.ts @@ -5,6 +5,7 @@ import Widget from "./widget"; export default class DashboardStore { dashboards: Dashboard[] = [] + widgets: Widget[] = [] selectedDashboard: Dashboard | null = new Dashboard() isLoading: boolean = false siteId: any = null @@ -48,6 +49,17 @@ export default class DashboardStore { // this.selectedDashboard?.widgets[4].update({ position: 2 }) // this.selectedDashboard?.swapWidgetPosition(2, 0) // }, 3000) + + for (let i = 0; i < 8; i++) { + const widget = getRandomWidget(); + widget.position = i; + widget.name = `Widget ${i}`; + widget.isPrivate = [true, false][Math.floor(Math.random() * 2)]; + widget.dashboardIds = [this.selectedDashboard?.dashboardId]; + widget.owner = ["John", "Jane", "Jack", "Jill"][i % 4]; + widget.metricType = ['timeseries', 'table'][Math.floor(Math.random() * 2)]; + this.widgets.push(widget); + } } resetCurrentWidget() { diff --git a/frontend/app/components/Dashboard/store/widget.ts b/frontend/app/components/Dashboard/store/widget.ts index 27f5dfd46..5b0329cab 100644 --- a/frontend/app/components/Dashboard/store/widget.ts +++ b/frontend/app/components/Dashboard/store/widget.ts @@ -11,6 +11,10 @@ export default class Widget { viewType: string = "lineChart" series: FilterSeries[] = [] sessions: [] = [] + isPrivate: boolean = false + owner: string = "" + lastModified: Date = new Date() + dashboardIds: any[] = [] position: number = 0 data: any = {} diff --git a/frontend/app/svg/icons/person-fill.svg b/frontend/app/svg/icons/person-fill.svg new file mode 100644 index 000000000..c9ef78372 --- /dev/null +++ b/frontend/app/svg/icons/person-fill.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file