Merge pull request #1146 from palash-signoz/379-json-data

feat: dashboard error and loading state is removed from dashboard object
This commit is contained in:
palash-signoz 2022-05-19 15:29:45 +05:30 committed by GitHub
commit 03ef3d3bcd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 3 deletions

View File

@ -77,6 +77,9 @@ function ImportJSON({
...queryData,
queryData: [],
})),
error: false,
errorMessage: '',
loading: false,
},
})),
};

View File

@ -12,9 +12,23 @@ function ShareModal({
onToggleHandler,
selectedData,
}: ShareModalProps): JSX.Element {
const [jsonValue, setJSONValue] = useState<string>(
JSON.stringify(selectedData, null, 2),
);
const getParsedValue = (): string => {
const updatedData: DashboardData = {
...selectedData,
widgets: selectedData.widgets?.map((widget) => ({
...widget,
queryData: {
...widget.queryData,
loading: false,
error: false,
errorMessage: '',
},
})),
};
return JSON.stringify(updatedData, null, 2);
};
const [jsonValue, setJSONValue] = useState<string>(getParsedValue());
const [isViewJSON, setIsViewJSON] = useState<boolean>(false);
const { t } = useTranslation(['dashboard', 'common']);
const [state, setCopy] = useCopyToClipboard();