Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
edit () {
if (this.resources.length !== 1) {
return
}
const resourceTitle = `${singularize(this.model.display_name)} #${this.resource.id}`
this.$Drawer.open(ResourceForm, {
resource: this.resource,
action: 'edit',
resourceName: this.resourceName,
onClose: () => {
this.$Drawer.remove()
},
onSuccess: (data) => {
this.$Drawer.remove()
this.$Message.info(`${resourceTitle} has been updated`)
this.$emit('finish-action', 'edit')
}
}, {
title: `Edit ${resourceTitle}`,
className: 'drawer-no-bottom-padding',
buildResourceSearchOptions (model) {
return {
type: 'resource_search',
slug: model.slug,
query: this.cleanedValue,
value: `${singularize(model.display_name)} "${this.cleanedValue}"`
}
},
onSelect (option) {
variables.forEach((variableName) => {
const variable = {
name: variableName,
display_name: titleize(variableName),
variable_type: 'text'
}
const model = modelNameMap[variableName.replace(/_id$/, '')]
if (model) {
Object.assign(variable, {
display_name: singularize(model.display_name),
reference_resource: model.name,
variable_type: 'reference'
})
}
this.dataQuery.preferences.variables.push(variable)
})
} else {
title () {
return `${singularize(this.model.display_name)} #${this.resource[this.model.primary_key]}`
},
model () {
resourceTitle () {
return singularize(this.model.display_name)
},
defaultValues () {