Disable function statistics on Greenplum. Fixes #3176
parent
06ff05762e
commit
d1ab47c10c
|
@ -92,7 +92,9 @@ define('pgadmin.node.function', [
|
||||||
collection_type: 'coll-function',
|
collection_type: 'coll-function',
|
||||||
hasSQL: true,
|
hasSQL: true,
|
||||||
hasDepends: true,
|
hasDepends: true,
|
||||||
hasStatistics: true,
|
hasStatistics: (treeInformation) => {
|
||||||
|
return treeInformation.server.server_type !== 'gpdb';
|
||||||
|
},
|
||||||
hasScriptTypes: ['create', 'select'],
|
hasScriptTypes: ['create', 'select'],
|
||||||
parent_type: ['schema', 'catalog'],
|
parent_type: ['schema', 'catalog'],
|
||||||
Init: function() {
|
Init: function() {
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
define('misc.statistics', [
|
define('misc.statistics', [
|
||||||
'sources/gettext', 'underscore', 'underscore.string', 'jquery', 'backbone',
|
'sources/gettext', 'underscore', 'underscore.string', 'jquery', 'backbone',
|
||||||
'pgadmin.browser', 'pgadmin.backgrid', 'alertify', 'sources/size_prettify',
|
'pgadmin.browser', 'pgadmin.backgrid', 'alertify', 'sources/size_prettify',
|
||||||
|
'sources/misc/statistics/statistics',
|
||||||
], function(
|
], function(
|
||||||
gettext, _, S, $, Backbone, pgBrowser, Backgrid, Alertify, sizePrettify
|
gettext, _, S, $, Backbone, pgBrowser, Backgrid, Alertify, sizePrettify,
|
||||||
|
statisticsHelper
|
||||||
) {
|
) {
|
||||||
|
|
||||||
if (pgBrowser.NodeStatistics)
|
if (pgBrowser.NodeStatistics)
|
||||||
|
@ -208,7 +210,7 @@ define('misc.statistics', [
|
||||||
// Cache the current IDs for next time
|
// Cache the current IDs for next time
|
||||||
$(panel[0]).data('node-prop', cache_flag);
|
$(panel[0]).data('node-prop', cache_flag);
|
||||||
|
|
||||||
if (node.hasStatistics) {
|
if (statisticsHelper.nodeHasStatistics(node, item)) {
|
||||||
msg = '';
|
msg = '';
|
||||||
var timer;
|
var timer;
|
||||||
// Set the url, fetch the data and update the collection
|
// Set the url, fetch the data and update the collection
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// pgAdmin 4 - PostgreSQL Tools
|
||||||
|
//
|
||||||
|
// Copyright (C) 2013 - 2018, The pgAdmin Development Team
|
||||||
|
// This software is released under the PostgreSQL Licence
|
||||||
|
//
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
export function nodeHasStatistics(node, item) {
|
||||||
|
if(typeof(node.hasStatistics) === 'function') {
|
||||||
|
const treeHierarchy = node.getTreeNodeHierarchy(item);
|
||||||
|
return node.hasStatistics(treeHierarchy);
|
||||||
|
}
|
||||||
|
return node.hasStatistics;
|
||||||
|
}
|
|
@ -0,0 +1,36 @@
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// pgAdmin 4 - PostgreSQL Tools
|
||||||
|
//
|
||||||
|
// Copyright (C) 2013 - 2018, The pgAdmin Development Team
|
||||||
|
// This software is released under the PostgreSQL Licence
|
||||||
|
//
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
import {nodeHasStatistics} from "../../../../pgadmin/static/js/misc/statistics/statistics";
|
||||||
|
|
||||||
|
describe('#nodeHasStatistics', () => {
|
||||||
|
describe('when node hasStatistics is not a function', () => {
|
||||||
|
it('return the value of hasStatistics', () => {
|
||||||
|
const node = {
|
||||||
|
hasStatistics: true,
|
||||||
|
};
|
||||||
|
expect(nodeHasStatistics(node, {})).toBe(true);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('when node hasStatistics is a function', () => {
|
||||||
|
describe('when the function returns true', () => {
|
||||||
|
it('returns true', () => {
|
||||||
|
const node = {
|
||||||
|
hasStatistics: () => true,
|
||||||
|
getTreeNodeHierarchy: jasmine.createSpy(),
|
||||||
|
};
|
||||||
|
const item = {};
|
||||||
|
|
||||||
|
expect(nodeHasStatistics(node, item)).toBe(true);
|
||||||
|
expect(node.getTreeNodeHierarchy).toHaveBeenCalledWith(item);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
Loading…
Reference in New Issue