Sorting the data during tree data loading using the natural sort

algorithm.

This patch takes care of:
* Consistent behaviour during create, update operation on any node.
  - It should return the node data during creating a new object, or
    updating the existing one.
* Now that - we have consistent behaviour during these operations, we
  can consistently move, update the tree item based the node data from
  the server.
* Implemented the methods for each node to get the information about
  that particular node only.
* Using the above changes to implement the 'refresh' operation on tree
  node properly.

I must thank Surinder, and Harshal for helping me implement the 'node'
method, and also changed the behaviour of create & update methods to
return the node data for most of the nodes.

Fixes #1244
This commit is contained in:
Ashesh Vashi
2016-08-29 20:06:48 +05:30
parent 2c6f6609bc
commit b6f307256b
156 changed files with 5299 additions and 3400 deletions

View File

@@ -123,6 +123,18 @@ define([
this.dependenciesPanelVisibilityChanged);
pgBrowser.Events.on('pgadmin-browser:panel-dependents:' + wcDocker.EVENT.VISIBILITY_CHANGED,
this.dependentsPanelVisibilityChanged);
pgBrowser.Events.on(
'pgadmin:browser:node:updated', function() {
if (this.dependenciesPanels && this.dependenciesPanels.length) {
$(this.dependenciesPanels[0]).data('node-prop', '');
this.dependenciesPanelVisibilityChanged(this.dependenciesPanels[0]);
}
if (this.dependentsPanels && this.dependentsPanels.length) {
$(this.dependentsPanels[0]).data('node-prop', '');
this.dependentsPanelVisibilityChanged(this.dependentsPanels[0]);
}
}, this
);
// We will render the grid objects in the panel after some time, because -
// it is possible, it is not yet available.
@@ -232,7 +244,7 @@ define([
error: function(coll, xhr, error, message) {
var _label = treeHierarchy[n_type].label;
pgBrowser.Events.trigger(
'pgadmin:node:retrieval:error', 'depends', xhr, status, error
'pgadmin:node:retrieval:error', 'depends', xhr, error, message
);
if (
!Alertify.pgHandleItemError(xhr, error, message, {
@@ -240,7 +252,7 @@ define([
})
) {
Alertify.pgNotifier(
status, xhr,
error, xhr,
S(
pgBrowser.messages['ERR_RETRIEVAL_INFO']
).sprintf(message || _label).value(),

View File

@@ -25,6 +25,15 @@ define([
this.sqlPanelVisibilityChanged
);
pgBrowser.Events.on(
'pgadmin:browser:node:updated', function() {
if (this.sqlPanels && this.sqlPanels.length) {
$(this.sqlPanels[0]).data('node-prop', '');
this.sqlPanelVisibilityChanged(this.sqlPanels[0]);
}
}, this
);
// Hmm.. Did we find the SQL panel, and is it visible (opened)?
// If that is the case - we need to listen the browser tree selection
// events.
@@ -88,7 +97,7 @@ define([
error: function(xhr, error, message) {
var _label = treeHierarchy[n_type].label;
pgBrowser.Events.trigger(
'pgadmin:node:retrieval:error', 'sql', xhr, status, error, item
'pgadmin:node:retrieval:error', 'sql', xhr, error, message, item
);
if (
!Alertify.pgHandleItemError(xhr, error, message, {
@@ -96,7 +105,7 @@ define([
})
) {
Alertify.pgNotifier(
status, xhr,
error, xhr,
S(
pgBrowser.messages['ERR_RETRIEVAL_INFO']
).sprintf(message || _label).value(),

View File

@@ -104,9 +104,19 @@ define([
// We will listen to the visibility change of the statistics panel
pgBrowser.Events.on(
'pgadmin-browser:panel-statistics:' +
wcDocker.EVENT.VISIBILITY_CHANGED,
this.panelVisibilityChanged);
'pgadmin-browser:panel-statistics:' +
wcDocker.EVENT.VISIBILITY_CHANGED,
this.panelVisibilityChanged
);
pgBrowser.Events.on(
'pgadmin:browser:node:updated', function() {
if (this.panel && this.panel.length) {
$(this.panel[0]).data('node-prop', '');
this.panelVisibilityChanged(this.panel[0]);
}
}, this
);
// Hmm.. Did we find the statistics panel, and is it visible (openned)?
// If that is the case - we need to listen the browser tree selection
@@ -214,7 +224,7 @@ define([
error: function(xhr, error, message) {
var _label = treeHierarchy[n_type].label;
pgBrowser.Events.trigger(
'pgadmin:node:retrieval:error', 'statistics', xhr, status, error, item
'pgadmin:node:retrieval:error', 'statistics', xhr, error, message, item
);
if (
!Alertify.pgHandleItemError(xhr, error, message, {
@@ -222,7 +232,7 @@ define([
})
) {
Alertify.pgNotifier(
status, xhr,
error, xhr,
S(
pgBrowser.messages['ERR_RETRIEVAL_INFO']
).sprintf(message || _label).value(),