Fixed an issue where Tablespace location shows error "Location cannot be empty".

pull/5656/head
Stranger10110 2022-12-19 08:24:30 +03:00 committed by GitHub
parent 1d4e7e2642
commit ffcf7ccbf9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 1 deletions

View File

@ -10,6 +10,7 @@
import gettext from 'sources/gettext';
import BaseUISchema from 'sources/SchemaView/base_schema.ui';
import SecLabelSchema from '../../../static/js/sec_label.ui';
import { isEmptyString } from '../../../../../../static/js/validators';
export default class TablespaceSchema extends BaseUISchema {
constructor(getVariableSchema, getPrivilegeRoleSchema, fieldOptions={}, initValues={}) {
@ -61,7 +62,6 @@ export default class TablespaceSchema extends BaseUISchema {
group: gettext('Definition'), type: 'text',
mode: ['properties', 'edit','create'],
readonly: function(state) {return !obj.isNew(state); },
noEmpty: true,
}, {
id: 'acl', label: gettext('Privileges'), type: 'text',
group: gettext('Security'), mode: ['properties'],
@ -88,4 +88,15 @@ export default class TablespaceSchema extends BaseUISchema {
}
];
}
validate(state, setError) {
let errmsg = null;
if (this.isNew() && isEmptyString(state.spclocation)) {
errmsg = gettext('\'Location\' cannot be empty.');
setError('spclocation', errmsg);
return true;
}
return null;
}
}