Skip to content

Commit

Permalink
Merge pull request #475 from FlowFuse/ui-template-validate
Browse files Browse the repository at this point in the history
UI Template - Switch checks to validations, rather than required
  • Loading branch information
joepavitt authored Jan 5, 2024
2 parents f164074 + 71092d5 commit 3cf2c9f
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions nodes/widgets/ui_template.html
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,24 @@
category: RED._('@flowfuse/node-red-dashboard/ui-base:ui-base.label.category'),
color: RED._('@flowfuse/node-red-dashboard/ui-base:ui-base.colors.dark'),
defaults: {
group: { type: 'ui-group', required: true }, // for when template is scoped to 'local' (default)
page: { type: 'ui-page', required: false }, // for when template is scoped to 'page'
ui: { type: 'ui-base', required: false }, // for when template is scoped to 'site'
group: {
type: 'ui-group',
validate: function () {
return (this.templateScope === 'local' && !!this.group) || (this.templateScope !== 'local')
}
}, // for when template is scoped to 'local' (default)
page: {
type: 'ui-page',
validate: function () {
return (this.templateScope === 'widget:page' && !!this.page) || (this.templateScope !== 'widget:page')
}
}, // for when template is scoped to 'page'
ui: {
type: 'ui-base',
validate: function () {
return (this.templateScope === 'widget:ui' && !!this.ui) || (this.templateScope !== 'widget:ui')
}
}, // for when template is scoped to 'site'
name: { value: '' },
order: { value: 0 },
width: {
Expand Down

0 comments on commit 3cf2c9f

Please sign in to comment.