mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-07-31 13:42:01 +08:00
fix: unsaved changes popping up for newly created dashboard in settings (#5182)
* fix: unsaved changes popping up for newly created dashboard in settings * fix: width changing of right bar when adding new queries * fix: address review comments
This commit is contained in:
parent
f2aba5035a
commit
a3e36cbac9
@ -71,24 +71,24 @@ function GeneralDashboardSettings(): JSX.Element {
|
||||
|
||||
useEffect(() => {
|
||||
let numberOfUnsavedChanges = 0;
|
||||
if (!isEqual(updatedTitle, selectedData?.title)) {
|
||||
numberOfUnsavedChanges += 1;
|
||||
}
|
||||
if (!isEqual(updatedDescription, selectedData?.description)) {
|
||||
numberOfUnsavedChanges += 1;
|
||||
}
|
||||
if (!isEqual(updatedTags, selectedData?.tags)) {
|
||||
numberOfUnsavedChanges += 1;
|
||||
}
|
||||
if (!isEqual(updatedImage, selectedData?.image)) {
|
||||
numberOfUnsavedChanges += 1;
|
||||
}
|
||||
const initialValues = [title, description, tags, image];
|
||||
const updatedValues = [
|
||||
updatedTitle,
|
||||
updatedDescription,
|
||||
updatedTags,
|
||||
updatedImage,
|
||||
];
|
||||
initialValues.forEach((val, index) => {
|
||||
if (!isEqual(val, updatedValues[index])) {
|
||||
numberOfUnsavedChanges += 1;
|
||||
}
|
||||
});
|
||||
setNumberOfUnsavedChanges(numberOfUnsavedChanges);
|
||||
}, [
|
||||
selectedData?.description,
|
||||
selectedData?.image,
|
||||
selectedData?.tags,
|
||||
selectedData?.title,
|
||||
description,
|
||||
image,
|
||||
tags,
|
||||
title,
|
||||
updatedDescription,
|
||||
updatedImage,
|
||||
updatedTags,
|
||||
@ -167,7 +167,8 @@ function GeneralDashboardSettings(): JSX.Element {
|
||||
<div className="unsaved">
|
||||
<div className="unsaved-dot" />
|
||||
<Typography.Text className="unsaved-changes">
|
||||
{numberOfUnsavedChanges} Unsaved change
|
||||
{numberOfUnsavedChanges} unsaved change
|
||||
{numberOfUnsavedChanges > 1 && 's'}
|
||||
</Typography.Text>
|
||||
</div>
|
||||
<div className="footer-action-btns">
|
||||
|
@ -10,10 +10,9 @@ export const Container = styled.div`
|
||||
|
||||
export const RightContainerWrapper = styled(Col)`
|
||||
&&& {
|
||||
min-width: 330px;
|
||||
overflow-y: auto;
|
||||
max-width: 400px;
|
||||
width: 30%;
|
||||
overflow-y: auto;
|
||||
}
|
||||
&::-webkit-scrollbar {
|
||||
width: 0rem;
|
||||
@ -26,7 +25,7 @@ interface LeftContainerWrapperProps {
|
||||
|
||||
export const LeftContainerWrapper = styled(Col)<LeftContainerWrapperProps>`
|
||||
&&& {
|
||||
min-width: 70%;
|
||||
width: 100%;
|
||||
overflow-y: auto;
|
||||
border-right: ${({ isDarkMode }): string =>
|
||||
isDarkMode
|
||||
|
Loading…
x
Reference in New Issue
Block a user