Skip to content

Commit

Permalink
Merge pull request #256 from SEED-platform/dev-loading-indicator
Browse files Browse the repository at this point in the history
Manual merge of loading indicator patches
  • Loading branch information
mmclark committed May 20, 2015
2 parents f89ec38 + 9edbdbc commit 56185ee
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 10 deletions.
3 changes: 3 additions & 0 deletions seed/static/seed/js/controllers/menu_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,12 @@ angular.module('BE.seed.controller.menu', [])
$scope.menu.create_project_error = false;
$scope.menu.create_project_error_message = "";
$scope.saving_indicator = false;
$scope.menu.loading = false;
$scope.menu.route_load_error = false;
$scope.menu.user = {};

$scope.$on("$routeChangeError", function(event, current, previous, rejection) {
$scope.menu.loading = false;
$scope.menu.route_load_error = true;
if (rejection === "not authorized" || rejection === "Your page could not be located!") {
$scope.menu.error_message = rejection;
Expand All @@ -63,6 +65,7 @@ angular.module('BE.seed.controller.menu', [])
$scope.menu.loading = next.controller === "mapping_controller";
});
$scope.$on("$routeChangeSuccess", function() {
$scope.menu.loading = false;
$scope.menu.route_load_error = false;
});
$scope.$on('app_error', function(event, data){
Expand Down
3 changes: 2 additions & 1 deletion seed/templates/seed/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
{$ menu.error_message || 'There was an error loading the page' $}
</div>
</div>
<div data-ng-view="" id="ng-view"></div>
<div class="section_tab_container" ng-show="menu.loading"><p>Please wait while your data is loaded...</p></div>
<div ng-hide="menu.loading" data-ng-view="" id="ng-view"></div>
</div>

{% include "seed/_footer.html" %}
Expand Down
28 changes: 19 additions & 9 deletions seed/views/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -1152,15 +1152,25 @@ def get_column_mapping_suggestions(request):
field_mappings = get_mappable_types()
field_names = field_mappings.keys()
column_types = {}
for c in Column.objects.filter(
Q(mapped_mappings__super_organization=org_id) |
Q(organization__isnull=True)
).exclude(
# mappings get created to mappable types
# but we deal with them manually so don't
# include them here
column_name__in=field_names
):

# for c in Column.objects.filter(
# Q(mapped_mappings__super_organization=org_id) |
# Q(organization__isnull=True)
# ).exclude(
# # mappings get created to mappable types
# # but we deal with them manually so don't
# # include them here
# column_name__in=field_names
# ):

# Note on exclude:
# mappings get created to mappable types but we deal with them manually
# so don't include them here
columns = Column.objects.select_related('unit').prefetch_related('schemas') \
.filter(Q(mapped_mappings__super_organization=org_id) | Q(organization__isnull=True)) \
.exclude(column_name__in=field_names)

for c in columns:
if c.unit:
unit = c.unit.get_unit_type_display()
else:
Expand Down

0 comments on commit 56185ee

Please sign in to comment.