-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fixes edit mode callback bug in Saved Object Panels #420
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,12 +38,13 @@ import { useDispatch, useSelector } from 'react-redux'; | |
import { CoreStart } from '../../../../../../../src/core/public'; | ||
import { SAVED_VISUALIZATION } from '../../../../../common/constants/explorer'; | ||
import { | ||
PplResponse, | ||
PPLResponse, | ||
SavedVisualizationType, | ||
VisualizationType, | ||
VizContainerError, | ||
} from '../../../../../common/types/custom_panels'; | ||
import { uiSettingsService } from '../../../../../common/utils'; | ||
|
||
import PPLService from '../../../../services/requests/ppl'; | ||
import { SavedObjectsActions } from '../../../../services/saved_objects/saved_object_client/saved_objects_actions'; | ||
import { ObservabilitySavedVisualization } from '../../../../services/saved_objects/saved_object_client/types'; | ||
|
@@ -121,7 +122,7 @@ export const VisaulizationFlyoutSO = ({ | |
const [newVisualizationTimeField, setNewVisualizationTimeField] = useState(''); | ||
const [previewMetaData, setPreviewMetaData] = useState<SavedVisualizationType>(); | ||
const [pplQuery, setPPLQuery] = useState(''); | ||
const [previewData, setPreviewData] = useState<PplResponse>({} as PplResponse); | ||
const [previewData, setPreviewData] = useState<PPLResponse>({} as PPLResponse); | ||
const [previewArea, setPreviewArea] = useState(<></>); | ||
const [previewLoading, setPreviewLoading] = useState(false); | ||
const [isPreviewError, setIsPreviewError] = useState({} as VizContainerError); | ||
|
@@ -182,43 +183,11 @@ export const VisaulizationFlyoutSO = ({ | |
if (!isInputValid()) return; | ||
|
||
if (isFlyoutReplacement) { | ||
// http | ||
// .post(`${CUSTOM_PANELS_API_PREFIX}/visualizations/replace`, { | ||
// body: JSON.stringify({ | ||
// panelId, | ||
// savedVisualizationId: selectValue, | ||
// oldVisualizationId: replaceVisualizationId, | ||
// }), | ||
// }) | ||
// .then(async (res) => { | ||
// setPanelVisualizations(res.visualizations); | ||
// setToast(`Visualization ${newVisualizationTitle} successfully added!`, 'success'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Now that the updated Toast is merged, these There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @pjfitzgibbons does your code re-instate the toast? If so we should get this once it is merged There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ideally, the toast reinstatement should go here: #415 |
||
// }) | ||
// .catch((err) => { | ||
// setToast(`Error in adding ${newVisualizationTitle} visualization to the panel`, 'danger'); | ||
ps48 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// console.error(err); | ||
// }); | ||
dispatch(replaceVizInPanel(panel, replaceVisualizationId, selectValue)); | ||
} else { | ||
const visualizationsWithNewPanel = addVisualizationPanel({ | ||
savedVisualizationId: selectValue, | ||
}); | ||
|
||
// http | ||
// .post(`${CUSTOM_PANELS_API_PREFIX}/visualizations`, { | ||
// body: JSON.stringify({ | ||
// panelId, | ||
// savedVisualizationId: selectValue, | ||
// }), | ||
// }) | ||
// .then(async (res) => { | ||
// setPanelVisualizations(res.visualizations); | ||
// setToast(`Visualization ${newVisualizationTitle} successfully added!`, 'success'); | ||
ps48 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// }) | ||
// .catch((err) => { | ||
// setToast(`Error in adding ${newVisualizationTitle} visualization to the panel`, 'danger'); | ||
ps48 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// console.error(err); | ||
// }); | ||
} | ||
closeFlyout(); | ||
}; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what exactly is this change doing/what bug?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.