Added new loading modal window. Phase 1.
Phase 2 will include metadata, currently it needs to be rewritten to allow it.
Also removed some redundant loading animations.
Change-Id: I1dce75460a0d61d14ec1de43b250b1cb27801c65
diff --git a/client/catalog/js/catalog.js b/client/catalog/js/catalog.js
index 5203fdc..2dfb368 100644
--- a/client/catalog/js/catalog.js
+++ b/client/catalog/js/catalog.js
@@ -377,9 +377,9 @@
} else if (resultIndex === 1) {
this.resultMenu.find('.previous').removeClass('disabled');
}
- $.scrollTo("#results", 500, {
- interrupt: true
- });
+ $('body').animate({
+ scrollTop: $("#results").offset().top
+ }, 500);
}
Atmos.prototype.getResults = function(index) {
@@ -455,19 +455,29 @@
interest.setInterestLifetimeMilliseconds(500);
interest.setMustBeFresh(true);
const face = this.face;
- async.retry(4, function(done) {
- face.expressInterest(interest, function(interest, data) {
- done();
- success(interest, data);
- }, function(interest) {
- done("Interest timed out 4 times.", interest);
+ var cancelled = false;
+ var attempt = 0;
+ openLoadingOverlay(function(update){
+ async.retry(4, function(done) {
+ face.expressInterest(interest, function(interest, data) {
+ update(true, attempt, attempt);
+ done();
+ success(interest, data);
+ }, function(interest) {
+ update(false, attempt++, attempt);
+ done("Timeout", interest);
+ });
+ }, function(err, interest) {
+ update(true, attempt, attempt);
+ if (err) {
+ console.log(err, interest);
+ failure(interest);
+ }
});
- }, function(err, interest) {
- if (err) {
- console.log(err, interest);
- failure(interest);
- }
+ }, function(){
+ cancelled = true;
});
+
}
/**
@@ -673,7 +683,8 @@
var item = $('<li><a href="#">' + name + '</a></li>');
sub.append(item);
- item.click(function() {
+ item.find('a').click(function(e) {
+ e.preventDefault();
//Click on the side menu filters
if (item.hasClass('active')) {
//Does the filter already exist?
@@ -685,7 +696,7 @@
var filter = $('<span class="label label-default"></span>');
filter.text(category + ':' + name);
scope.filters.append(filter);
- filter.click(function() {
+ filter.click(function(e) {
//Click on a filter
filter.remove();
item.removeClass('active');
@@ -694,7 +705,8 @@
});
});
//Toggle the menus. (Only respond when the immediate tab is clicked.)
- e.find('> a').click(function() {
+ e.find('> a').click(function(e) {
+ e.preventDefault();
scope.categories.find('.subnav').slideUp();
var t = $(this).siblings('.subnav');
if (!t.is(':visible')) {