Skip to content

SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.

fix: use correct keys in dashboard list (#7283)

Nityananda Gohain5dba1f3dbb52
diff --git a/frontend/src/container/ListOfDashboard/DashboardsList.tsx b/frontend/src/container/ListOfDashboard/DashboardsList.tsx
index 96fdff7116..af07d16444 100644
--- a/frontend/src/container/ListOfDashboard/DashboardsList.tsx
+++ b/frontend/src/container/ListOfDashboard/DashboardsList.tsx
@@ -186,16 +186,14 @@ function DashboardsList(): JSX.Element {
const sortDashboardsByCreatedAt = (dashboards: Dashboard[]): void => {
const sortedDashboards = dashboards.sort(
- (a, b) =>
- new Date(b.created_at).getTime() - new Date(a.created_at).getTime(),
+ (a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime(),
);
setDashboards(sortedDashboards);
};
const sortDashboardsByUpdatedAt = (dashboards: Dashboard[]): void => {
const sortedDashboards = dashboards.sort(
- (a, b) =>
- new Date(b.updated_at).getTime() - new Date(a.updated_at).getTime(),
+ (a, b) => new Date(b.updatedAt).getTime() - new Date(a.updatedAt).getTime(),
);
setDashboards(sortedDashboards);
};
@@ -260,16 +258,16 @@ function DashboardsList(): JSX.Element {
const data: Data[] =
dashboards?.map((e) => ({
- createdAt: e.created_at,
+ createdAt: e.createdAt,
description: e.data.description || '',
id: e.uuid,
- lastUpdatedTime: e.updated_at,
+ lastUpdatedTime: e.updatedAt,
name: e.data.title,
tags: e.data.tags || [],
key: e.uuid,
- createdBy: e.created_by,
+ createdBy: e.createdBy,
isLocked: !!e.isLocked || false,
- lastUpdatedBy: e.updated_by,
+ lastUpdatedBy: e.updatedBy,
image: e.data.image || Base64Icons[0],
variables: e.data.variables,
widgets: e.data.widgets,
@@ -978,10 +976,10 @@ function DashboardsList(): JSX.Element {
{visibleColumns.createdBy && (
<div className="user">
<Typography.Text className="user-tag">
- {dashboards?.[0]?.created_by?.substring(0, 1).toUpperCase()}
+ {dashboards?.[0]?.createdBy?.substring(0, 1).toUpperCase()}
</Typography.Text>
<Typography.Text className="dashboard-created-by">
- {dashboards?.[0]?.created_by}
+ {dashboards?.[0]?.createdBy}
</Typography.Text>
</div>
)}
@@ -990,16 +988,16 @@ function DashboardsList(): JSX.Element {
{visibleColumns.updatedAt && (
<Typography.Text className="formatted-time">
<CalendarClock size={14} />
- {onLastUpdated(dashboards?.[0]?.updated_at || '')}
+ {onLastUpdated(dashboards?.[0]?.updatedAt || '')}
</Typography.Text>
)}
{visibleColumns.updatedBy && (
<div className="user">
<Typography.Text className="user-tag">
- {dashboards?.[0]?.updated_by?.substring(0, 1).toUpperCase()}
+ {dashboards?.[0]?.updatedBy?.substring(0, 1).toUpperCase()}
</Typography.Text>
<Typography.Text className="dashboard-created-by">
- {dashboards?.[0]?.updated_by}
+ {dashboards?.[0]?.updatedBy}
</Typography.Text>
</div>
)}
diff --git a/frontend/src/container/NewDashboard/DashboardDescription/index.tsx b/frontend/src/container/NewDashboard/DashboardDescription/index.tsx
index 8e116522be..cf7263d04e 100644
--- a/frontend/src/container/NewDashboard/DashboardDescription/index.tsx
+++ b/frontend/src/container/NewDashboard/DashboardDescription/index.tsx
@@ -140,7 +140,7 @@ function DashboardDescription(props: DashboardDescriptionProps): JSX.Element {
let isAuthor = false;
if (selectedDashboard && user && user.email) {
- isAuthor = selectedDashboard?.created_by === user?.email;
+ isAuthor = selectedDashboard?.createdBy === user?.email;
}
let permissions: ComponentTypes[] = ['add_panel'];
@@ -152,7 +152,7 @@ function DashboardDescription(props: DashboardDescriptionProps): JSX.Element {
const { notifications } = useNotifications();
const userRole: ROLES | null =
- selectedDashboard?.created_by === user?.email
+ selectedDashboard?.createdBy === user?.email
? (USER_ROLES.AUTHOR as ROLES)
: user.role;
@@ -364,14 +364,14 @@ function DashboardDescription(props: DashboardDescriptionProps): JSX.Element {
{(isAuthor || user.role === USER_ROLES.ADMIN) && (
<Tooltip
title={
- selectedDashboard?.created_by === 'integration' &&
+ selectedDashboard?.createdBy === 'integration' &&
'Dashboards created by integrations cannot be unlocked'
}
>
<Button
type="text"
icon={<LockKeyhole size={14} />}
- disabled={selectedDashboard?.created_by === 'integration'}
+ disabled={selectedDashboard?.createdBy === 'integration'}
onClick={handleLockDashboardToggle}
data-testid="lock-unlock-dashboard"
>
@@ -443,7 +443,7 @@ function DashboardDescription(props: DashboardDescriptionProps): JSX.Element {
</section>
<section className="delete-dashboard">
<DeleteButton
- createdBy={selectedDashboard?.created_by || ''}
+ createdBy={selectedDashboard?.createdBy || ''}
name={selectedDashboard?.data.title || ''}
id={String(selectedDashboard?.uuid) || ''}
isLocked={isDashboardLocked}
diff --git a/frontend/src/hooks/dashboard/useUpdateDashboard.tsx b/frontend/src/hooks/dashboard/useUpdateDashboard.tsx
index cdab00bfb2..e8dbad4ae6 100644
--- a/frontend/src/hooks/dashboard/useUpdateDashboard.tsx
+++ b/frontend/src/hooks/dashboard/useUpdateDashboard.tsx
@@ -11,7 +11,7 @@ export const useUpdateDashboard = (): UseUpdateDashboard => {
return useMutation(update, {
onSuccess: (data) => {
if (data.payload) {
- updatedTimeRef.current = dayjs(data.payload.updated_at);
+ updatedTimeRef.current = dayjs(data.payload.updatedAt);
}
},
});
diff --git a/frontend/src/mocks-server/__mockdata__/dashboards.ts b/frontend/src/mocks-server/__mockdata__/dashboards.ts
index 40d9cb48d9..8987d0d8a2 100644
--- a/frontend/src/mocks-server/__mockdata__/dashboards.ts
+++ b/frontend/src/mocks-server/__mockdata__/dashboards.ts
@@ -5,10 +5,10 @@ export const dashboardSuccessResponse = {
{
id: 1,
uuid: '1',
- created_at: '2022-11-16T13:29:47.064874419Z',
- created_by: null,
- updated_at: '2024-05-21T06:41:30.546630961Z',
- updated_by: '[email protected]',
+ createdAt: '2022-11-16T13:29:47.064874419Z',
+ createdBy: null,
+ updatedAt: '2024-05-21T06:41:30.546630961Z',
+ updatedBy: '[email protected]',
isLocked: 0,
data: {
collapsableRowsMigrated: true,
@@ -25,10 +25,10 @@ export const dashboardSuccessResponse = {
{
id: 2,
uuid: '2',
- created_at: '2022-11-16T13:20:47.064874419Z',
- created_by: null,
- updated_at: '2024-05-21T06:42:30.546630961Z',
- updated_by: '[email protected]',
+ createdAt: '2022-11-16T13:20:47.064874419Z',
+ createdBy: null,
+ updatedAt: '2024-05-21T06:42:30.546630961Z',
+ updatedBy: '[email protected]',
isLocked: 0,
data: {
collapsableRowsMigrated: true,
@@ -55,10 +55,10 @@ export const getDashboardById = {
data: {
id: 1,
uuid: '1',
- created_at: '2022-11-16T13:29:47.064874419Z',
- created_by: 'integration',
- updated_at: '2024-05-21T06:41:30.546630961Z',
- updated_by: '[email protected]',
+ createdAt: '2022-11-16T13:29:47.064874419Z',
+ createdBy: 'integration',
+ updatedAt: '2024-05-21T06:41:30.546630961Z',
+ updatedBy: '[email protected]',
isLocked: true,
data: {
collapsableRowsMigrated: true,
@@ -80,10 +80,10 @@ export const getNonIntegrationDashboardById = {
data: {
id: 1,
uuid: '1',
- created_at: '2022-11-16T13:29:47.064874419Z',
- created_by: 'thor',
- updated_at: '2024-05-21T06:41:30.546630961Z',
- updated_by: '[email protected]',
+ createdAt: '2022-11-16T13:29:47.064874419Z',
+ createdBy: 'thor',
+ updatedAt: '2024-05-21T06:41:30.546630961Z',
+ updatedBy: '[email protected]',
isLocked: true,
data: {
collapsableRowsMigrated: true,