mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2026-10-25 06:07:39 -05:00
Ensure that name can't be empty in edit mode for Primary Key and Index. #6204
This commit is contained in:
1 parent
6949b41fb9
commit
4baae7512b
3 files changed
+16
No files matched your search
+7
@@ -256,6 +256,13 @@ export default class PrimaryKeySchema extends BaseUISchema {
|
||||
}
|
||||
|
||||
validate(state, setError) {
|
||||
if (!this.isNew(state) && isEmptyString(state.name)) {
|
||||
setError('name', gettext('Name cannot be empty in edit mode.'));
|
||||
return true;
|
||||
} else {
|
||||
setError('name', null);
|
||||
}
|
||||
|
||||
if(isEmptyString(state.index)
|
||||
&& (_.isUndefined(state.columns) || _.isNull(state.columns) || state.columns.length < 1)) {
|
||||
setError('columns', gettext('Please specify columns for %s.', gettext('Primary key')));
|
||||
|
||||
+8
@@ -452,6 +452,14 @@ export default class IndexSchema extends BaseUISchema {
|
||||
validate(state, setError) {
|
||||
let msg;
|
||||
|
||||
if (!this.isNew(state) && isEmptyString(state.name)) {
|
||||
msg = gettext('Name cannot be empty in edit mode.');
|
||||
setError('name', msg);
|
||||
return true;
|
||||
} else {
|
||||
setError('name', null);
|
||||
}
|
||||
|
||||
// Checks if columns is empty
|
||||
let cols = state.columns;
|
||||
if(_.isArray(cols) && cols.length == 0){
|
||||
|
||||
Reference in new issue
Block a user