mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-13 16:59:04 +08:00
fix: dashboard save layout (#1320)
Co-authored-by: Palash <palashgdev@gmail.com>
This commit is contained in:
parent
a25e7a64ce
commit
eeae71163c
@ -113,10 +113,8 @@ function GridGraph(props: Props): JSX.Element {
|
|||||||
errorMessage: '',
|
errorMessage: '',
|
||||||
loading: true,
|
loading: true,
|
||||||
}));
|
}));
|
||||||
|
const updatedDashboard: Dashboard = {
|
||||||
// Save layout only when users has the has the permission to do so.
|
...selectedDashboard,
|
||||||
if (saveLayoutPermission) {
|
|
||||||
const response = await updateDashboardApi({
|
|
||||||
data: {
|
data: {
|
||||||
title: data.title,
|
title: data.title,
|
||||||
description: data.description,
|
description: data.description,
|
||||||
@ -126,7 +124,10 @@ function GridGraph(props: Props): JSX.Element {
|
|||||||
layout,
|
layout,
|
||||||
},
|
},
|
||||||
uuid: selectedDashboard.uuid,
|
uuid: selectedDashboard.uuid,
|
||||||
});
|
};
|
||||||
|
// Save layout only when users has the has the permission to do so.
|
||||||
|
if (saveLayoutPermission) {
|
||||||
|
const response = await updateDashboardApi(updatedDashboard);
|
||||||
if (response.statusCode === 200) {
|
if (response.statusCode === 200) {
|
||||||
setSaveLayoutState((state) => ({
|
setSaveLayoutState((state) => ({
|
||||||
...state,
|
...state,
|
||||||
@ -134,6 +135,10 @@ function GridGraph(props: Props): JSX.Element {
|
|||||||
errorMessage: '',
|
errorMessage: '',
|
||||||
loading: false,
|
loading: false,
|
||||||
}));
|
}));
|
||||||
|
dispatch({
|
||||||
|
type: UPDATE_DASHBOARD,
|
||||||
|
payload: updatedDashboard,
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
setSaveLayoutState((state) => ({
|
setSaveLayoutState((state) => ({
|
||||||
...state,
|
...state,
|
||||||
@ -153,8 +158,9 @@ function GridGraph(props: Props): JSX.Element {
|
|||||||
data.tags,
|
data.tags,
|
||||||
data.title,
|
data.title,
|
||||||
data.widgets,
|
data.widgets,
|
||||||
|
dispatch,
|
||||||
saveLayoutPermission,
|
saveLayoutPermission,
|
||||||
selectedDashboard.uuid,
|
selectedDashboard,
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user