-
Notifications
You must be signed in to change notification settings - Fork 61
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
change samples to saved object #427
Changes from 6 commits
93c4283
94b2fab
cef3c71
d312c86
2cc1454
6b22110
d597aa6
c05ec9f
a48a8f0
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 | ||
---|---|---|---|---|
|
@@ -21,11 +21,12 @@ import { | |||
} from '../../../../common/types/custom_panels'; | ||||
import { coreRefs } from '../../../framework/core_refs'; | ||||
import { SavedObject, SimpleSavedObject } from '../../../../../../src/core/public'; | ||||
import { isNameValid } from '../helpers/utils'; | ||||
import { isNameValid, samplePanelName } from '../helpers/utils'; | ||||
import { | ||||
addMultipleVisualizations, | ||||
addVisualizationPanel, | ||||
} from '../helpers/add_visualization_helper'; | ||||
import { createDemoPanel } from '../../../../server/common/helpers/custom_panels/sample_panels'; | ||||
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. Should we move this to 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. Yes, +1, please relocate 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. It's also being used in server here:
|
||||
|
||||
interface InitialState { | ||||
id: string; | ||||
|
@@ -218,6 +219,19 @@ export const createPanel = (panel) => async (dispatch, getState) => { | |||
window.location.replace(`#/${newPanel.id}`); | ||||
}; | ||||
|
||||
export const createPanelSample = (vizIds) => async (dispatch, getState) => { | ||||
const samplePanel = { | ||||
...createDemoPanel(vizIds), | ||||
dateCreated: new Date().getTime(), | ||||
dateModified: new Date().getTime(), | ||||
title: samplePanelName, | ||||
}; | ||||
const newSOPanel = await savedObjectPanelsClient.create(samplePanel); | ||||
const newPanel = savedObjectToCustomPanel(newSOPanel); | ||||
const panelList = getState().customPanel.panelList; | ||||
dispatch(setPanelList([...panelList, newPanel])); | ||||
}; | ||||
|
||||
export const clonePanel = (panel, newPanelName) => async (dispatch, getState) => { | ||||
const { id, ...panelCopy } = { | ||||
...panel, | ||||
|
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.
minor: should we move this to common/constants?