Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce updates when showing item lists; add a waiting spinner #1653

Merged
merged 1 commit into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- Better handle images without enough tile layers ([#1648](../../pull/1648))
- Add users option to config files; have a default config file ([#1649](../../pull/1649))
- Remove no longer used code; adjust item list slightly ([#1651](../../pull/1651))
- Reduce updates when showing item lists; add a waiting spinner ([#1653](../../pull/1653))

### Bug Fixes

Expand Down
23 changes: 19 additions & 4 deletions girder/girder_large_image/web_client/views/itemList.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
});

wrap(ItemListWidget, 'initialize', function (initialize, settings) {
this._inInit = true;
const result = initialize.call(this, settings);
delete this._hasAnyLargeImage;

Expand All @@ -54,6 +55,8 @@
this._liconfig = val;
}
if (_.isEqual(val, this._liconfig) && !this._recurse) {
this._inInit = false;
this.render();

Check warning on line 59 in girder/girder_large_image/web_client/views/itemList.js

View check run for this annotation

Codecov / codecov/patch

girder/girder_large_image/web_client/views/itemList.js#L58-L59

Added lines #L58 - L59 were not covered by tests
return;
}
delete this._lastSort;
Expand All @@ -74,12 +77,14 @@
update = true;
} else if (this._confList() && this._confList().defaultSort && this._confList().defaultSort.length) {
this._lastSort = this._confList().defaultSort;
update = true;
}
if (query.filter || this._recurse) {
this._generalFilter = query.filter;
this._setFilter(false);
update = true;
}
this._inInit = false;
if (update) {
this._setSort();
} else {
Expand All @@ -104,6 +109,9 @@

wrap(ItemListWidget, 'render', function (render) {
this.$el.closest('.modal-dialog').addClass('li-item-list-dialog');
if (!this.$el.children().length) {
this.$el.html('<span class="icon-spin1 animate-spin" title="Loading item list"/>');
}

/* Chrome limits the number of connections to a single domain, which means
* that time-consuming requests for thumbnails can bind-up the web browser.
Expand Down Expand Up @@ -155,12 +163,16 @@
const pages = Math.ceil(this.collection.getTotalCount() / this.collection.pageLimit);
this._totalPages = pages;
this._inFetch = false;
if (this._needsFetch) {
this._setSort();
}
if (oldPages !== pages) {
itemListRender.apply(this, _.rest(arguments));
if (oldPages !== pages || this.collection.offset !== this.collection.size()) {
this.collection.offset = this.collection.size();

Check warning on line 168 in girder/girder_large_image/web_client/views/itemList.js

View check run for this annotation

Codecov / codecov/patch

girder/girder_large_image/web_client/views/itemList.js#L168

Added line #L168 was not covered by tests
this.trigger('g:paginated');
this.collection.trigger('g:changed');
} else {
itemListRender.apply(this, _.rest(arguments));
}
if (this._needsFetch) {
this._setSort();

Check warning on line 175 in girder/girder_large_image/web_client/views/itemList.js

View check run for this annotation

Codecov / codecov/patch

girder/girder_large_image/web_client/views/itemList.js#L175

Added line #L175 was not covered by tests
}
});
} else {
Expand Down Expand Up @@ -300,6 +312,9 @@
};

function itemListRender() {
if (this._inInit || this._inFetch) {
return;
}
const root = this.$el.closest('.g-hierarchy-widget');
if (!root.find('.li-item-list-filter').length) {
let base = root.find('.g-hierarchy-actions-header .g-folder-header-buttons').eq(0);
Expand Down