diff --git a/addon/components/document-view.hbs b/addon/components/document-view.hbs index a652caf7c..49b0bfc07 100644 --- a/addon/components/document-view.hbs +++ b/addon/components/document-view.hbs @@ -12,12 +12,17 @@ data-test-upload /> - + {{#if this.fetchedDocuments.isRunning}} + + {{else}} + + {{/if}}
{{! List & Grid View }} {{#if this.listView}} {{else}} diff --git a/addon/components/document-view.js b/addon/components/document-view.js index 8ef0d3d7d..06068d354 100644 --- a/addon/components/document-view.js +++ b/addon/components/document-view.js @@ -2,7 +2,8 @@ import { action } from "@ember/object"; import { inject as service } from "@ember/service"; import Component from "@glimmer/component"; import { tracked } from "@glimmer/tracking"; -import { dropTask, lastValue, task } from "ember-concurrency"; +import { dropTask, task } from "ember-concurrency"; +import { task as trackedTask } from "ember-resources/util/ember-concurrency"; import { ErrorHandler } from "ember-alexandria/helpers/error-handler"; @@ -47,10 +48,14 @@ export default class DocumentViewComponent extends Component { this.router.transitionTo(this.router.currentRouteName, { queryParams: { sort: this.sortDirection + this.sort }, }); - this.fetchDocuments.perform(); } - @lastValue("fetchDocuments") fetchedDocuments; + fetchedDocuments = trackedTask(this, this.fetchDocuments, () => [ + this.sort, + this.sortDirection, + this.args.filters, + ]); + @task *fetchDocuments() { const documents = yield this.store.query("document", { @@ -114,8 +119,6 @@ export default class DocumentViewComponent extends Component { count: files.length, }), ); - - await this.fetchDocuments.perform(); } catch (error) { new ErrorHandler(this, error).notify( "alexandria.errors.upload-document", diff --git a/addon/components/tag-filter.hbs b/addon/components/tag-filter.hbs index 3e6005542..8023dd592 100644 --- a/addon/components/tag-filter.hbs +++ b/addon/components/tag-filter.hbs @@ -2,23 +2,29 @@ class="uk-border uk-padding-small uk-width-expand uk-flex uk-flex-wrap uk-flex-middle" ...attributes > - {{#each this.activeMarks.value as |mark|}} - - {{/each}} + {{#if (or this.marks.marks.isLoading this.activeMarks.isLoading)}} + + {{else if this.activeMarks.value}} + {{#each this.activeMarks.value as |mark|}} + + {{/each}} + {{/if}} {{#if (and this.searchTags.isFinished (not this.searchTags.value))}} - {{t "alexandria.tag-filter.empty"}} + {{t + "alexandria.tag-filter.empty" + }} {{else}} - {{#each this.tags.fetchSearchTags.lastSuccessful.value as |tag|}} + {{#each this.searchTags.value as |tag|}}