change(ui) - cards and dashboard

This commit is contained in:
Shekar Siri 2023-01-18 17:45:39 +01:00
parent b27095968a
commit c5f948d19d
7 changed files with 37 additions and 17 deletions

View file

@ -1,9 +1,9 @@
import React from 'react'; import React from 'react';
import { Button, PageTitle } from 'UI'; import { Button, PageTitle, Toggler, Icon } from 'UI';
import Select from 'Shared/Select'; import Select from 'Shared/Select';
import DashboardSearch from './DashboardSearch'; import DashboardSearch from './DashboardSearch';
import { useStore } from 'App/mstore'; import { useStore } from 'App/mstore';
import { useObserver } from 'mobx-react-lite'; import { observer, useObserver } from 'mobx-react-lite';
import { withSiteId } from 'App/routes'; import { withSiteId } from 'App/routes';
function Header({ history, siteId }: { history: any; siteId: string }) { function Header({ history, siteId }: { history: any; siteId: string }) {
@ -20,7 +20,7 @@ function Header({ history, siteId }: { history: any; siteId: string }) {
return ( return (
<> <>
<div className="flex items-center mb-4 justify-between px-6"> <div className="flex items-center justify-between px-6">
<div className="flex items-baseline mr-3"> <div className="flex items-baseline mr-3">
<PageTitle title="Dashboards" /> <PageTitle title="Dashboards" />
</div> </div>
@ -34,8 +34,24 @@ function Header({ history, siteId }: { history: any; siteId: string }) {
</div> </div>
</div> </div>
</div> </div>
<div className="text-base text-disabled-text flex items-center px-6">
<Icon name="info-circle-fill" className="mr-2" size={16} />
A Dashboard is a collection of Metrics that can be shared across teams.
</div>
<div className="border-y px-3 py-1 mt-2 flex items-center w-full justify-end gap-4"> <div className="border-y px-3 py-1 mt-2 flex items-center w-full justify-end gap-4">
<Select <Toggler
label="Private Dashboards"
checked={dashboardStore.filter.showMine}
name="test"
className="font-medium mr-2"
onChange={() =>
dashboardStore.updateKey('filter', {
...dashboardStore.filter,
showMine: !dashboardStore.filter.showMine,
})
}
/>
{/* <Select
options={[ options={[
{ label: 'Visibility - All', value: 'all' }, { label: 'Visibility - All', value: 'all' },
{ label: 'Visibility - Private', value: 'private' }, { label: 'Visibility - Private', value: 'private' },
@ -49,7 +65,7 @@ function Header({ history, siteId }: { history: any; siteId: string }) {
visibility: value.value, visibility: value.value,
}) })
} }
/> /> */}
<Select <Select
options={[ options={[
@ -65,4 +81,4 @@ function Header({ history, siteId }: { history: any; siteId: string }) {
); );
} }
export default Header; export default observer(Header);

View file

@ -39,7 +39,7 @@ function DashboardSideMenu(props: Props) {
active={isMetric} active={isMetric}
id="menu-manage-alerts" id="menu-manage-alerts"
title="Cards" title="Cards"
iconName="bar-chart-line" iconName="card-text"
onClick={() => redirect(withSiteId(metrics(), siteId))} onClick={() => redirect(withSiteId(metrics(), siteId))}
/> />
</div> </div>

View file

@ -12,7 +12,7 @@ function MetricViewHeader() {
return ( return (
<div> <div>
<div className="flex items-center mb-4 justify-between px-6"> <div className="flex items-center justify-between px-6">
<div className="flex items-baseline mr-3"> <div className="flex items-baseline mr-3">
<PageTitle title="Cards" className="" /> <PageTitle title="Cards" className="" />
</div> </div>

File diff suppressed because one or more lines are too long

View file

@ -120,9 +120,9 @@ export const issueOptions = [
export const issueCategories = [ export const issueCategories = [
{ label: 'Resources', value: IssueCategory.RESOURCES }, { label: 'Resources', value: IssueCategory.RESOURCES },
{ label: 'Network', value: IssueCategory.NETWORK }, { label: 'Network Request', value: IssueCategory.NETWORK },
{ label: 'Rage', value: IssueCategory.RAGE }, { label: 'Click Rage', value: IssueCategory.RAGE },
{ label: 'Errors', value: IssueCategory.ERRORS }, { label: 'JS Errors', value: IssueCategory.ERRORS },
] ]
export const issueCategoriesMap = issueCategories.reduce((acc, {value, label}) => { export const issueCategoriesMap = issueCategories.reduce((acc, {value, label}) => {

View file

@ -9,7 +9,7 @@ import { getRE } from 'App/utils';
interface DashboardFilter { interface DashboardFilter {
query?: string; query?: string;
visibility?: string; showMine?: boolean;
} }
export default class DashboardStore { export default class DashboardStore {
siteId: any = null; siteId: any = null;
@ -27,7 +27,7 @@ export default class DashboardStore {
endTimestamp: number = 0; endTimestamp: number = 0;
pendingRequests: number = 0; pendingRequests: number = 0;
filter: DashboardFilter = { visibility: 'all', query: '' }; filter: DashboardFilter = { showMine: false, query: '' };
// Metrics // Metrics
metricsPage: number = 1; metricsPage: number = 1;
@ -70,8 +70,7 @@ export default class DashboardStore {
return this.dashboards return this.dashboards
.filter( .filter(
(dashboard) => (dashboard) =>
(this.filter.visibility === 'all' || (this.filter.showMine ? !dashboard.isPublic : dashboard.isPublic) &&
(this.filter.visibility === 'team' ? dashboard.isPublic : !dashboard.isPublic)) &&
(!filterRE || (!filterRE ||
// @ts-ignore // @ts-ignore
['name', 'owner', 'description'].some((key) => filterRE.test(dashboard[key]))) ['name', 'owner', 'description'].some((key) => filterRE.test(dashboard[key])))
@ -394,7 +393,7 @@ export default class DashboardStore {
} }
toggleAlertModal(val: boolean) { toggleAlertModal(val: boolean) {
this.showAlertModal = val this.showAlertModal = val;
} }
fetchMetricChartData( fetchMetricChartData(

View file

@ -0,0 +1,4 @@
<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" class="bi bi-card-text" viewBox="0 0 16 16">
<path d="M14.5 3a.5.5 0 0 1 .5.5v9a.5.5 0 0 1-.5.5h-13a.5.5 0 0 1-.5-.5v-9a.5.5 0 0 1 .5-.5h13zm-13-1A1.5 1.5 0 0 0 0 3.5v9A1.5 1.5 0 0 0 1.5 14h13a1.5 1.5 0 0 0 1.5-1.5v-9A1.5 1.5 0 0 0 14.5 2h-13z"/>
<path d="M3 5.5a.5.5 0 0 1 .5-.5h9a.5.5 0 0 1 0 1h-9a.5.5 0 0 1-.5-.5zM3 8a.5.5 0 0 1 .5-.5h9a.5.5 0 0 1 0 1h-9A.5.5 0 0 1 3 8zm0 2.5a.5.5 0 0 1 .5-.5h6a.5.5 0 0 1 0 1h-6a.5.5 0 0 1-.5-.5z"/>
</svg>

After

Width:  |  Height:  |  Size: 509 B