Prevent creation of FTS objects in catalogs. Fixes #1122
parent
6d839a2924
commit
67f481ab11
|
@ -436,19 +436,20 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
|||
module: this, category: 'create', priority: 4,
|
||||
applies: ['object', 'context'], callback: 'show_obj_properties',
|
||||
label: '{{_('FTS Configuration...')}}',
|
||||
icon: 'wcTabIcon icon-fts_configuration', data: {action: 'create'}
|
||||
icon: 'wcTabIcon icon-fts_configuration', data: {action: 'create'},
|
||||
enable: 'canCreate'
|
||||
},{
|
||||
name: 'create_fts_configuration_on_coll', module: this, priority: 4,
|
||||
node: 'coll-fts_configuration', applies: ['object', 'context'],
|
||||
callback: 'show_obj_properties', category: 'create',
|
||||
label: '{{ _('FTS Configuration...') }}', data: {action: 'create'},
|
||||
icon: 'wcTabIcon icon-fts_configuration'
|
||||
icon: 'wcTabIcon icon-fts_configuration', enable: 'canCreate'
|
||||
},{
|
||||
name: 'create_fts_configuration', node: 'fts_configuration',
|
||||
module: this, applies: ['object', 'context'],
|
||||
callback: 'show_obj_properties', category: 'create', priority: 4,
|
||||
label: '{{_('FTS Configuration...')}}', data: {action: 'create'},
|
||||
icon: 'wcTabIcon icon-fts_configuration'
|
||||
icon: 'wcTabIcon icon-fts_configuration', enable: 'canCreate'
|
||||
}]);
|
||||
},
|
||||
|
||||
|
@ -575,7 +576,35 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
|||
|
||||
return null;
|
||||
}
|
||||
})
|
||||
}),
|
||||
canCreate: function(itemData, item, data) {
|
||||
//If check is false then , we will allow create menu
|
||||
if (data && data.check == false)
|
||||
return true;
|
||||
|
||||
var t = pgBrowser.tree, i = item, d = itemData;
|
||||
// To iterate over tree to check parent node
|
||||
while (i) {
|
||||
// If it is schema then allow user to create fts configuration
|
||||
if (_.indexOf(['schema'], d._type) > -1)
|
||||
return true;
|
||||
|
||||
if ('coll-fts_configuration' == d._type) {
|
||||
//Check if we are not child of catalog
|
||||
prev_i = t.hasParent(i) ? t.parent(i) : null;
|
||||
prev_d = prev_i ? t.itemData(prev_i) : null;
|
||||
if( prev_d._type == 'catalog') {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
i = t.hasParent(i) ? t.parent(i) : null;
|
||||
d = i ? t.itemData(i) : null;
|
||||
}
|
||||
// by default we do not want to allow create menu
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -76,18 +76,20 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
|||
name: 'create_fts_dictionary_on_schema', node: 'schema', module: this,
|
||||
applies: ['object', 'context'], callback: 'show_obj_properties',
|
||||
category: 'create', priority: 4, label: '{{_('FTS Dictionary...')}}',
|
||||
icon: 'wcTabIcon icon-fts_dictionary', data: {action: 'create'}
|
||||
icon: 'wcTabIcon icon-fts_dictionary', data: {action: 'create'},
|
||||
enable: 'canCreate'
|
||||
},{
|
||||
name: 'create_fts_dictionary_on_coll', node: 'coll-fts_dictionary',
|
||||
module: this, applies: ['object', 'context'], priority: 4,
|
||||
callback: 'show_obj_properties', category: 'create',
|
||||
label: '{{ _('FTS Dictionary...') }}', data: {action: 'create'},
|
||||
icon: 'wcTabIcon icon-fts_dictionary'
|
||||
icon: 'wcTabIcon icon-fts_dictionary', enable: 'canCreate'
|
||||
},{
|
||||
name: 'create_fts_dictionary', node: 'fts_dictionary', module: this,
|
||||
applies: ['object', 'context'], callback: 'show_obj_properties',
|
||||
category: 'create', priority: 4, label: '{{_('FTS Dictionary...')}}',
|
||||
icon: 'wcTabIcon icon-fts_dictionary', data: {action: 'create'}
|
||||
icon: 'wcTabIcon icon-fts_dictionary', data: {action: 'create'},
|
||||
enable: 'canCreate'
|
||||
}]);
|
||||
},
|
||||
|
||||
|
@ -179,7 +181,35 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
|||
this.trigger('on-status-clear');
|
||||
return null;
|
||||
}
|
||||
})
|
||||
}),
|
||||
canCreate: function(itemData, item, data) {
|
||||
//If check is false then , we will allow create menu
|
||||
if (data && data.check == false)
|
||||
return true;
|
||||
|
||||
var t = pgBrowser.tree, i = item, d = itemData;
|
||||
// To iterate over tree to check parent node
|
||||
while (i) {
|
||||
// If it is schema then allow user to create fts dictionary
|
||||
if (_.indexOf(['schema'], d._type) > -1)
|
||||
return true;
|
||||
|
||||
if ('coll-fts_dictionary' == d._type) {
|
||||
//Check if we are not child of catalog
|
||||
prev_i = t.hasParent(i) ? t.parent(i) : null;
|
||||
prev_d = prev_i ? t.itemData(prev_i) : null;
|
||||
if( prev_d._type == 'catalog') {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
i = t.hasParent(i) ? t.parent(i) : null;
|
||||
d = i ? t.itemData(i) : null;
|
||||
}
|
||||
// by default we do not want to allow create menu
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -40,18 +40,20 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
|||
name: 'create_fts_parser_on_schema', node: 'schema', module: this,
|
||||
applies: ['object', 'context'], callback: 'show_obj_properties',
|
||||
category: 'create', priority: 4, label: '{{ _('FTS Parser...') }}',
|
||||
icon: 'wcTabIcon icon-fts_parser', data: {action: 'create'}
|
||||
icon: 'wcTabIcon icon-fts_parser', data: {action: 'create'},
|
||||
enable: 'canCreate'
|
||||
},{
|
||||
name: 'create_fts_parser_on_coll', node: 'coll-fts_parser',
|
||||
applies: ['object', 'context'], callback: 'show_obj_properties',
|
||||
category: 'create', priority: 4, label: '{{ _('FTS Parser...') }}',
|
||||
icon: 'wcTabIcon icon-fts_parser', data: {action: 'create'},
|
||||
module: this
|
||||
module: this, enable: 'canCreate'
|
||||
},{
|
||||
name: 'create_fts_parser', node: 'fts_parser', module: this,
|
||||
applies: ['object', 'context'], callback: 'show_obj_properties',
|
||||
category: 'create', priority: 4, label: '{{ _('FTS Parser...') }}',
|
||||
icon: 'wcTabIcon icon-fts_parser', data: {action: 'create'}
|
||||
icon: 'wcTabIcon icon-fts_parser', data: {action: 'create'},
|
||||
enable: 'canCreate'
|
||||
}]);
|
||||
|
||||
},
|
||||
|
@ -195,7 +197,35 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
|||
this.trigger('on-status-clear');
|
||||
return null;
|
||||
}
|
||||
})
|
||||
}),
|
||||
canCreate: function(itemData, item, data) {
|
||||
//If check is false then , we will allow create menu
|
||||
if (data && data.check == false)
|
||||
return true;
|
||||
|
||||
var t = pgBrowser.tree, i = item, d = itemData;
|
||||
// To iterate over tree to check parent node
|
||||
while (i) {
|
||||
// If it is schema then allow user to create fts parser
|
||||
if (_.indexOf(['schema'], d._type) > -1)
|
||||
return true;
|
||||
|
||||
if ('coll-fts_parser' == d._type) {
|
||||
//Check if we are not child of catalog
|
||||
prev_i = t.hasParent(i) ? t.parent(i) : null;
|
||||
prev_d = prev_i ? t.itemData(prev_i) : null;
|
||||
if( prev_d._type == 'catalog') {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
i = t.hasParent(i) ? t.parent(i) : null;
|
||||
d = i ? t.itemData(i) : null;
|
||||
}
|
||||
// by default we do not want to allow create menu
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -39,17 +39,20 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
|||
name: 'create_fts_template_on_schema', node: 'schema', module: this,
|
||||
applies: ['object', 'context'], callback: 'show_obj_properties',
|
||||
category: 'create', priority: 4, label: '{{ _('FTS Template...') }}',
|
||||
icon: 'wcTabIcon icon-fts_template', data: {action: 'create'}
|
||||
icon: 'wcTabIcon icon-fts_template', data: {action: 'create'},
|
||||
enable: 'canCreate'
|
||||
},{
|
||||
name: 'create_fts_template_on_coll', node: 'coll-fts_template', module: this,
|
||||
applies: ['object', 'context'], callback: 'show_obj_properties',
|
||||
category: 'create', priority: 4, label: '{{ _('FTS Template...') }}',
|
||||
icon: 'wcTabIcon icon-fts_template', data: {action: 'create'}
|
||||
icon: 'wcTabIcon icon-fts_template', data: {action: 'create'},
|
||||
enable: 'canCreate'
|
||||
},{
|
||||
name: 'create_fts_template', node: 'fts_template', module: this,
|
||||
applies: ['object', 'context'], callback: 'show_obj_properties',
|
||||
category: 'create', priority: 4, label: '{{ _('FTS Template...') }}',
|
||||
icon: 'wcTabIcon icon-fts_template', data: {action: 'create'}
|
||||
icon: 'wcTabIcon icon-fts_template', data: {action: 'create'},
|
||||
enable: 'canCreate'
|
||||
}]);
|
||||
|
||||
},
|
||||
|
@ -132,7 +135,35 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
|||
this.trigger('on-status-clear');
|
||||
return null;
|
||||
}
|
||||
})
|
||||
}),
|
||||
canCreate: function(itemData, item, data) {
|
||||
//If check is false then , we will allow create menu
|
||||
if (data && data.check == false)
|
||||
return true;
|
||||
|
||||
var t = pgBrowser.tree, i = item, d = itemData;
|
||||
// To iterate over tree to check parent node
|
||||
while (i) {
|
||||
// If it is schema then allow user to create fts fts_template
|
||||
if (_.indexOf(['schema'], d._type) > -1)
|
||||
return true;
|
||||
|
||||
if ('coll-fts_template' == d._type) {
|
||||
//Check if we are not child of catalog
|
||||
prev_i = t.hasParent(i) ? t.parent(i) : null;
|
||||
prev_d = prev_i ? t.itemData(prev_i) : null;
|
||||
if( prev_d._type == 'catalog') {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
i = t.hasParent(i) ? t.parent(i) : null;
|
||||
d = i ? t.itemData(i) : null;
|
||||
}
|
||||
// by default we do not want to allow create menu
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue