[CANVAS] Relax workpad schema to allow existing templates to work (#54019)

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
This commit is contained in:
Corey Robertson 2020-01-13 11:53:47 -05:00 committed by GitHub
parent f3cdbf20ce
commit 3ce2025c75
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 6 deletions

View file

@ -42,7 +42,7 @@ export const getTemplateStrings = (): TemplateStringDict => ({
defaultMessage: 'Pitch',
}),
help: i18n.translate('xpack.canvas.templates.pitchHelp', {
defaultMessage: 'Branded presentation with large photos"',
defaultMessage: 'Branded presentation with large photos',
}),
},
Status: {

View file

@ -24,7 +24,10 @@ export const WorkpadTemplates = compose(
cloneWorkpad: props => workpad => {
workpad.id = getId('workpad');
workpad.name = `My Canvas Workpad - ${workpad.name}`;
// Remove unneeded fields
workpad.tags = undefined;
workpad.displayName = undefined;
workpad.help = undefined;
return workpadService
.create(workpad)
.then(() => props.router.navigateTo('loadWorkpad', { id: workpad.id, page: 1 }))

View file

@ -24,11 +24,13 @@ export const WorkpadElementSchema = schema.object({
export const WorkpadPageSchema = schema.object({
elements: schema.arrayOf(WorkpadElementSchema),
groups: schema.arrayOf(
schema.object({
id: schema.string(),
position: PositionSchema,
})
groups: schema.maybe(
schema.arrayOf(
schema.object({
id: schema.string(),
position: PositionSchema,
})
)
),
id: schema.string(),
style: schema.recordOf(schema.string(), schema.string()),