Revert "Display busy indicators in a much more consistent way. Fixes #1242"

This reverts commit 7fbefa507b which seems to be
missing things.
This commit is contained in:
Dave Page
2016-06-29 10:32:20 +01:00
parent 7fbefa507b
commit 1222681888
8 changed files with 60 additions and 115 deletions

View File

@@ -72,8 +72,8 @@ define(
*/
var appendGridToPanel = function(collection, panel, is_dependent) {
var $container = panel[0].layout().scene().find('.pg-panel-content'),
$gridContainer = $container.find('.pg-panel-depends-container');
self.grid = grid = new Backgrid.Grid({
$gridContainer = $container.find('.pg-panel-depends-container'),
grid = new Backgrid.Grid({
columns: [
{
name : 'type',
@@ -106,8 +106,6 @@ define(
className: "backgrid presentation table backgrid-striped table-bordered table-hover",
});
panel[0].startLoading();
// Condition is used to save grid object to change the label of the header.
if (is_dependent)
self.dependentGrid = grid;
@@ -115,9 +113,6 @@ define(
self.dependenciesGrid = grid;
$gridContainer.append(grid.render().el);
setTimeout(function() {
panel[0].finishLoading();
}, 1000);
return true;
};
@@ -180,30 +175,11 @@ define(
},
// Fetch the actual data and update the collection
__updateCollection: function(collection, panel, url, messages, node, item, type) {
__updateCollection: function(collection, panel, url, messages, node) {
var msg = messages[0],
$container = panel[0].layout().scene().find('.pg-panel-content'),
$msgContainer = $container.find('.pg-panel-depends-message'),
$gridContainer = $container.find('.pg-panel-depends-container');
treeHierarchy = node.getTreeNodeHierarchy(item),
n_value = -1,
n_type = type;
// Avoid unnecessary reloads
if (_.isUndefined(treeHierarchy[n_type]) ||
_.isUndefined(treeHierarchy[n_type]._id)) {
n_value = -1;
} else {
n_value = treeHierarchy[n_type]._id;
}
if (n_value == $(panel[0]).data(n_type)) {
return;
}
// Cache the current IDs for next time
$(panel[0]).data(n_type, n_value);
// Hide the grid container and show the default message container
if (!$gridContainer.hasClass('hidden'))
@@ -221,7 +197,7 @@ define(
*/
msg = messages[2];
$msgContainer.text(msg);
panel[0].startLoading();
/* Updating the label for the 'field' type of the backbone model.
* Label should be "Database" if the node type is tablespace or role
* and dependent tab is selected. For other nodes and dependencies tab
@@ -234,18 +210,15 @@ define(
this.dependentGrid.columns.models[2].set({'label': 'Restriction'});
}
// Hide the message container and show the grid container.
$msgContainer.addClass('hidden');
$gridContainer.removeClass('hidden');
// Set the url, fetch the data and update the collection
collection.url = url;
collection.fetch({
reset: true,
success: function(res) {
// Hide loading icons once collection is retrieved.
setTimeout(function() {
panel[0].finishLoading();
}, 1000);
// In case of success hide the message container and show the grid container.
$gridContainer.removeClass('hidden');
$msgContainer.addClass('hidden');
},
error: function() {
}
@@ -277,9 +250,7 @@ define(
node.generate_url(item, 'dependent', data, true),
['No object selected.', 'No dependent information is available for the current object.',
'Fetching dependent information from the server...'],
node,
item,
data._type
node
), 400
);
},
@@ -321,9 +292,7 @@ define(
node.generate_url(item, 'dependency', data, true),
['Please select an object in the tree view.', 'No dependency information is available for the current object.',
'Fetching dependency information from the server...'],
node,
item,
data._type
node
), 400
);
},