feat: dashbaord error and loading state is removed from dashboard object

This commit is contained in:
Palash gupta 2022-05-13 12:59:35 +05:30
parent 53528f1045
commit 228fb66251
No known key found for this signature in database
GPG Key ID: 8FD05AE6F9150AD6
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();