mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-12 07:39:00 +08:00
chore: address comments
This commit is contained in:
parent
715f8a2363
commit
b35b975798
@ -27,6 +27,7 @@ import { AxiosError } from 'axios';
|
|||||||
import cx from 'classnames';
|
import cx from 'classnames';
|
||||||
import { ENTITY_VERSION_V4 } from 'constants/app';
|
import { ENTITY_VERSION_V4 } from 'constants/app';
|
||||||
import ROUTES from 'constants/routes';
|
import ROUTES from 'constants/routes';
|
||||||
|
import { sanitizeDashboardData } from 'container/NewDashboard/DashboardDescription';
|
||||||
import { downloadObjectAsJson } from 'container/NewDashboard/DashboardDescription/utils';
|
import { downloadObjectAsJson } from 'container/NewDashboard/DashboardDescription/utils';
|
||||||
import { Base64Icons } from 'container/NewDashboard/DashboardSettings/General/utils';
|
import { Base64Icons } from 'container/NewDashboard/DashboardSettings/General/utils';
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
@ -68,12 +69,18 @@ import {
|
|||||||
useRef,
|
useRef,
|
||||||
useState,
|
useState,
|
||||||
} from 'react';
|
} from 'react';
|
||||||
|
import { Layout } from 'react-grid-layout';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { useSelector } from 'react-redux';
|
import { useSelector } from 'react-redux';
|
||||||
import { generatePath, Link } from 'react-router-dom';
|
import { generatePath, Link } from 'react-router-dom';
|
||||||
import { useCopyToClipboard } from 'react-use';
|
import { useCopyToClipboard } from 'react-use';
|
||||||
import { AppState } from 'store/reducers';
|
import { AppState } from 'store/reducers';
|
||||||
import { Dashboard } from 'types/api/dashboard/getAll';
|
import {
|
||||||
|
Dashboard,
|
||||||
|
IDashboardVariable,
|
||||||
|
WidgetRow,
|
||||||
|
Widgets,
|
||||||
|
} from 'types/api/dashboard/getAll';
|
||||||
import AppReducer from 'types/reducer/app';
|
import AppReducer from 'types/reducer/app';
|
||||||
import { isCloudUser } from 'utils/app';
|
import { isCloudUser } from 'utils/app';
|
||||||
|
|
||||||
@ -262,6 +269,11 @@ function DashboardsList(): JSX.Element {
|
|||||||
isLocked: !!e.isLocked || false,
|
isLocked: !!e.isLocked || false,
|
||||||
lastUpdatedBy: e.updated_by,
|
lastUpdatedBy: e.updated_by,
|
||||||
image: e.data.image || Base64Icons[0],
|
image: e.data.image || Base64Icons[0],
|
||||||
|
variables: e.data.variables,
|
||||||
|
widgets: e.data.widgets,
|
||||||
|
layout: e.data.layout,
|
||||||
|
panelMap: e.data.panelMap,
|
||||||
|
version: e.data.version,
|
||||||
refetchDashboardList,
|
refetchDashboardList,
|
||||||
})) || [];
|
})) || [];
|
||||||
|
|
||||||
@ -455,7 +467,10 @@ function DashboardsList(): JSX.Element {
|
|||||||
const handleJsonExport = (event: React.MouseEvent<HTMLElement>): void => {
|
const handleJsonExport = (event: React.MouseEvent<HTMLElement>): void => {
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
downloadObjectAsJson(dashboard, dashboard.name);
|
downloadObjectAsJson(
|
||||||
|
sanitizeDashboardData({ ...dashboard, title: dashboard.name }),
|
||||||
|
dashboard.name,
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -1121,6 +1136,11 @@ export interface Data {
|
|||||||
isLocked: boolean;
|
isLocked: boolean;
|
||||||
id: string;
|
id: string;
|
||||||
image?: string;
|
image?: string;
|
||||||
|
widgets?: Array<WidgetRow | Widgets>;
|
||||||
|
layout?: Layout[];
|
||||||
|
panelMap?: Record<string, { widgets: Layout[]; collapsed: boolean }>;
|
||||||
|
variables: Record<string, IDashboardVariable>;
|
||||||
|
version?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default DashboardsList;
|
export default DashboardsList;
|
||||||
|
@ -65,7 +65,7 @@ interface DashboardDescriptionProps {
|
|||||||
handle: FullScreenHandle;
|
handle: FullScreenHandle;
|
||||||
}
|
}
|
||||||
|
|
||||||
function sanitizeDashboardData(
|
export function sanitizeDashboardData(
|
||||||
selectedData: DashboardData,
|
selectedData: DashboardData,
|
||||||
): Omit<DashboardData, 'uuid'> {
|
): Omit<DashboardData, 'uuid'> {
|
||||||
if (!selectedData?.variables) {
|
if (!selectedData?.variables) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user