Skip to content

Commit

Permalink
[CANVAS] Relax workpad schema to allow existing templates to work (el…
Browse files Browse the repository at this point in the history
…astic#54019) (elastic#54643)

Co-authored-by: Elastic Machine <[email protected]>

Co-authored-by: Elastic Machine <[email protected]>
  • Loading branch information
Corey Robertson and elasticmachine authored Jan 13, 2020
1 parent 6ca9018 commit a1aa908
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 }))
Expand Down
12 changes: 7 additions & 5 deletions x-pack/plugins/canvas/server/routes/workpad/workpad_schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()),
Expand Down

0 comments on commit a1aa908

Please sign in to comment.