Skip to content

Commit

Permalink
Merge pull request #3270 from FlowFuse/fix-3266-blueprint-validation
Browse files Browse the repository at this point in the history
Blueprint Admin: Fix form validation
  • Loading branch information
knolleary committed Dec 22, 2023
2 parents 0335c90 + 40d02b0 commit 14fbc5f
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export default {
},
computed: {
formValid () {
return this.input.name && this.input.flows && this.input.modules && !this.errors.name && !this.errors.flows && !this.errors.modules
return this.input.name && this.input.flows && this.input.modules
},
dialogTitle () {
return this.flowBlueprint?.id ? 'Edit Flow Blueprint' : 'Create Flow Blueprint'
Expand All @@ -131,6 +131,9 @@ export default {
return
}

this.error = null
this.errors = {}

const flowBlueprintProps = { ...this.input }
if (flowBlueprintProps.order === '') {
delete flowBlueprintProps.order
Expand Down Expand Up @@ -170,11 +173,11 @@ export default {
if (error.response?.data?.error) {
const errorResponse = error.response.data
this.error = errorResponse.error
if (errorResponse.message.includes('flows')) {
this.errors.flows = errorResponse.message
if (this.error.includes('flows')) {
this.errors.flows = this.error
}
if (errorResponse.message.includes('modules')) {
this.errors.modules = errorResponse.message
if (this.error.includes('modules')) {
this.errors.modules = this.error
}
} else {
this.error = 'Unknown error, please try again'
Expand Down

0 comments on commit 14fbc5f

Please sign in to comment.