Allow fetchMore to actually specify a 0 offset when intentional. This should fix the mysterious missing history in multiview bug.

This commit is contained in:
Dannon Baker
2017-09-14 11:53:25 -04:00
parent 140c570517
commit 7fdce2efd9
9 changed files with 15 additions and 10 deletions
@@ -279,7 +279,11 @@ var InfinitelyScrollingCollection = ControlledFetchCollection.extend({
// TODO: this fails in the edge case where
// the first fetch offset === limit (limit 4, offset 4, collection.length 4)
options.offset = options.reset? 0 : ( options.offset || collection.lastFetched );
if (options.reset){
options.offset = 0;
} else if (options.offset === undefined){
options.offset = collection.lastFetched;
}
var limit = options.limit = options.limit || collection.limitPerFetch || null;
// console.log( 'fetchMore, limit:', limit, 'offset:', options.offset );
+3 -2
View File
@@ -5,8 +5,9 @@
"keywords": [
"galaxy"
],
"repository": { "type": "git",
"url": "https://github.com/galaxyproject/galaxy.git"
"repository": {
"type": "git",
"url": "https://github.com/galaxyproject/galaxy.git"
},
"license": "AFL-3.0",
"dependencies": {
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -1,4 +1,4 @@
!function(t){function e(i){if(n[i])return n[i].exports;var o=n[i]={exports:{},id:i,loaded:!1};return t[i].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var i=window.webpackJsonp;window.webpackJsonp=function(r,s){for(var a,l,c=0,h=[];c<r.length;c++)l=r[c],o[l]&&h.push.apply(h,o[l]),o[l]=0;for(a in s)t[a]=s[a];for(i&&i(r,s);h.length;)h.shift().call(null,e);if(s[0])return n[0]=0,e(0)};var n={},o={2:0};return e.e=function(t,i){if(0===o[t])return i.call(null,e);if(void 0!==o[t])o[t].push(i);else{o[t]=[i];var n=document.getElementsByTagName("head")[0],r=document.createElement("script");r.type="text/javascript",r.charset="utf-8",r.async=!0,r.src=e.p+""+t+"."+({3:"analysis",4:"login"}[t]||t)+".bundled.js",n.appendChild(r)}},e.m=t,e.c=n,e.p="",e(0)}([function(t,e,i){i(127),i(1),i(105),i(66),i(63),i(64),i(65),i(103),i(62),i(100),i(61),i(102),i(2),i(3),i(84),i(59),i(10),t.exports=i(126)},function(t,e,i){var n,o;/*!
!function(t){function e(i){if(n[i])return n[i].exports;var o=n[i]={exports:{},id:i,loaded:!1};return t[i].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var i=window.webpackJsonp;window.webpackJsonp=function(r,s){for(var a,l,c=0,h=[];c<r.length;c++)l=r[c],o[l]&&h.push.apply(h,o[l]),o[l]=0;for(a in s)Object.prototype.hasOwnProperty.call(s,a)&&(t[a]=s[a]);for(i&&i(r,s);h.length;)h.shift().call(null,e);if(s[0])return n[0]=0,e(0)};var n={},o={2:0};return e.e=function(t,i){if(0===o[t])return i.call(null,e);if(void 0!==o[t])o[t].push(i);else{o[t]=[i];var n=document.getElementsByTagName("head")[0],r=document.createElement("script");r.type="text/javascript",r.charset="utf-8",r.async=!0,r.src=e.p+""+t+"."+({3:"analysis",4:"login"}[t]||t)+".bundled.js",n.appendChild(r)}},e.m=t,e.c=n,e.p="",e(0)}([function(t,e,i){i(127),i(1),i(105),i(66),i(63),i(64),i(65),i(103),i(62),i(100),i(61),i(102),i(2),i(3),i(84),i(59),i(10),t.exports=i(126)},function(t,e,i){var n,o;/*!
* jQuery JavaScript Library v1.12.4
* http://jquery.com/
*
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,2 +1,2 @@
define(["libs/underscore","libs/backbone","mvc/base-mvc"],function(a,b,c){"use strict";var d=b.Collection.extend({initialize:function(a,c){b.Collection.prototype.initialize.call(this,a,c),this.setOrder(c.order||this.order,{silent:!0})},_setUpListeners:function(){return this.on({"changed-order":this.sort})},fetch:function(a){return a=this._buildFetchOptions(a),b.Collection.prototype.fetch.call(this,a)},_buildFetchOptions:function(b){b=a.clone(b)||{};var c=this;b.traditional=!0,b.data=b.data||c._buildFetchData(b);var d=this._buildFetchFilters(b);return a.isEmpty(d)||a.extend(b.data,this._fetchFiltersToAjaxData(d)),b},_buildFetchData:function(b){var c={};return this.order&&(c.order=this.order),a.defaults(a.pick(b,this._fetchParams),c)},_fetchParams:["order","limit","offset","view","keys"],_buildFetchFilters:function(b){return a.clone(b.filters||{})},_fetchFiltersToAjaxData:function(b){var c={q:[],qv:[]};return a.each(b,function(a,b){void 0!==a&&""!==a&&(a===!0&&(a="True"),a===!1&&(a="False"),null===a&&(a="None"),c.q.push(b),c.qv.push(a))}),c},reset:function(a,c){return this.allFetched=!1,b.Collection.prototype.reset.call(this,a,c)},order:null,comparators:{update_time:c.buildComparator("update_time",{ascending:!1}),"update_time-asc":c.buildComparator("update_time",{ascending:!0}),create_time:c.buildComparator("create_time",{ascending:!1}),"create_time-asc":c.buildComparator("create_time",{ascending:!0})},setOrder:function(b,c){c=c||{};var d=this,e=d.comparators[b];if(a.isUndefined(e))throw new Error("unknown order: "+b);if(e!==d.comparator){{d.order}return d.order=b,d.comparator=e,c.silent||d.trigger("changed-order",c),d}}}),e=d.extend({limitPerPage:500,initialize:function(a,b){d.prototype.initialize.call(this,a,b),this.currentPage=b.currentPage||0},getTotalItemCount:function(){return this.length},shouldPaginate:function(){return this.getTotalItemCount()>=this.limitPerPage},getLastPage:function(){return Math.floor(this.getTotalItemCount()/this.limitPerPage)},getPageCount:function(){return this.getLastPage()+1},getPageLimitOffset:function(a){return a=this.constrainPageNum(a),{limit:this.limitPerPage,offset:a*this.limitPerPage}},constrainPageNum:function(a){return Math.max(0,Math.min(a,this.getLastPage()))},fetchPage:function(b,c){var d=this;return b=d.constrainPageNum(b),d.currentPage=b,c=a.defaults(c||{},d.getPageLimitOffset(b)),d.trigger("fetching-more"),d.fetch(c).always(function(){d.trigger("fetching-more-done")})},fetchCurrentPage:function(a){return this.fetchPage(this.currentPage,a)},fetchPrevPage:function(a){return this.fetchPage(this.currentPage-1,a)},fetchNextPage:function(a){return this.fetchPage(this.currentPage+1,a)}}),f=d.extend({limitOnFirstFetch:null,limitPerFetch:100,initialize:function(a,b){d.prototype.initialize.call(this,a,b),this.limitOnFirstFetch=b.limitOnFirstFetch||this.limitOnFirstFetch,this.limitPerFetch=b.limitPerFetch||this.limitPerFetch,this.allFetched=!1,this.lastFetched=b.lastFetched||0},_buildFetchOptions:function(a){return a.remove=a.remove||!1,d.prototype._buildFetchOptions.call(this,a)},fetchFirst:function(b){return b=b?a.clone(b):{},this.allFetched=!1,this.lastFetched=0,this.fetchMore(a.defaults(b,{reset:!0,limit:this.limitOnFirstFetch}))},fetchMore:function(b){b=a.clone(b||{});var c=this;if(!b.reset&&c.allFetched)return jQuery.when();b.offset=b.reset?0:b.offset||c.lastFetched;var d=b.limit=b.limit||c.limitPerFetch||null;return c.trigger("fetching-more"),c.fetch(b).always(function(){c.trigger("fetching-more-done")}).done(function(b){var e=a.isArray(b)?b.length:0;c.lastFetched+=e,(!d||d>e)&&(c.allFetched=!0,c.trigger("all-fetched",this))})},fetchAll:function(b){b=b||{};var c=this;return b=a.pick(b,"silent"),b.filters={},c.fetch(b).done(function(){c.allFetched=!0,c.trigger("all-fetched",c)})}});return{ControlledFetchCollection:d,PaginatedCollection:e,InfinitelyScrollingCollection:f}});
define(["libs/underscore","libs/backbone","mvc/base-mvc"],function(a,b,c){"use strict";var d=b.Collection.extend({initialize:function(a,c){b.Collection.prototype.initialize.call(this,a,c),this.setOrder(c.order||this.order,{silent:!0})},_setUpListeners:function(){return this.on({"changed-order":this.sort})},fetch:function(a){return a=this._buildFetchOptions(a),b.Collection.prototype.fetch.call(this,a)},_buildFetchOptions:function(b){b=a.clone(b)||{};var c=this;b.traditional=!0,b.data=b.data||c._buildFetchData(b);var d=this._buildFetchFilters(b);return a.isEmpty(d)||a.extend(b.data,this._fetchFiltersToAjaxData(d)),b},_buildFetchData:function(b){var c={};return this.order&&(c.order=this.order),a.defaults(a.pick(b,this._fetchParams),c)},_fetchParams:["order","limit","offset","view","keys"],_buildFetchFilters:function(b){return a.clone(b.filters||{})},_fetchFiltersToAjaxData:function(b){var c={q:[],qv:[]};return a.each(b,function(a,b){void 0!==a&&""!==a&&(a===!0&&(a="True"),a===!1&&(a="False"),null===a&&(a="None"),c.q.push(b),c.qv.push(a))}),c},reset:function(a,c){return this.allFetched=!1,b.Collection.prototype.reset.call(this,a,c)},order:null,comparators:{update_time:c.buildComparator("update_time",{ascending:!1}),"update_time-asc":c.buildComparator("update_time",{ascending:!0}),create_time:c.buildComparator("create_time",{ascending:!1}),"create_time-asc":c.buildComparator("create_time",{ascending:!0})},setOrder:function(b,c){c=c||{};var d=this,e=d.comparators[b];if(a.isUndefined(e))throw new Error("unknown order: "+b);if(e!==d.comparator){{d.order}return d.order=b,d.comparator=e,c.silent||d.trigger("changed-order",c),d}}}),e=d.extend({limitPerPage:500,initialize:function(a,b){d.prototype.initialize.call(this,a,b),this.currentPage=b.currentPage||0},getTotalItemCount:function(){return this.length},shouldPaginate:function(){return this.getTotalItemCount()>=this.limitPerPage},getLastPage:function(){return Math.floor(this.getTotalItemCount()/this.limitPerPage)},getPageCount:function(){return this.getLastPage()+1},getPageLimitOffset:function(a){return a=this.constrainPageNum(a),{limit:this.limitPerPage,offset:a*this.limitPerPage}},constrainPageNum:function(a){return Math.max(0,Math.min(a,this.getLastPage()))},fetchPage:function(b,c){var d=this;return b=d.constrainPageNum(b),d.currentPage=b,c=a.defaults(c||{},d.getPageLimitOffset(b)),d.trigger("fetching-more"),d.fetch(c).always(function(){d.trigger("fetching-more-done")})},fetchCurrentPage:function(a){return this.fetchPage(this.currentPage,a)},fetchPrevPage:function(a){return this.fetchPage(this.currentPage-1,a)},fetchNextPage:function(a){return this.fetchPage(this.currentPage+1,a)}}),f=d.extend({limitOnFirstFetch:null,limitPerFetch:100,initialize:function(a,b){d.prototype.initialize.call(this,a,b),this.limitOnFirstFetch=b.limitOnFirstFetch||this.limitOnFirstFetch,this.limitPerFetch=b.limitPerFetch||this.limitPerFetch,this.allFetched=!1,this.lastFetched=b.lastFetched||0},_buildFetchOptions:function(a){return a.remove=a.remove||!1,d.prototype._buildFetchOptions.call(this,a)},fetchFirst:function(b){return b=b?a.clone(b):{},this.allFetched=!1,this.lastFetched=0,this.fetchMore(a.defaults(b,{reset:!0,limit:this.limitOnFirstFetch}))},fetchMore:function(b){b=a.clone(b||{});var c=this;if(!b.reset&&c.allFetched)return jQuery.when();b.reset?b.offset=0:void 0===b.offset&&(b.offset=c.lastFetched);var d=b.limit=b.limit||c.limitPerFetch||null;return c.trigger("fetching-more"),c.fetch(b).always(function(){c.trigger("fetching-more-done")}).done(function(b){var e=a.isArray(b)?b.length:0;c.lastFetched+=e,(!d||d>e)&&(c.allFetched=!0,c.trigger("all-fetched",this))})},fetchAll:function(b){b=b||{};var c=this;return b=a.pick(b,"silent"),b.filters={},c.fetch(b).done(function(){c.allFetched=!0,c.trigger("all-fetched",c)})}});return{ControlledFetchCollection:d,PaginatedCollection:e,InfinitelyScrollingCollection:f}});
//# sourceMappingURL=../../../maps/mvc/base/controlled-fetch-collection.js.map