OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
[41923] Show loading during initial backend API request (#10558)
Oliver Günther53b72e2c9ed4
diff --git a/frontend/src/app/shared/components/project-include/project-include.component.html b/frontend/src/app/shared/components/project-include/project-include.component.htmlindex 6455c34435f..929e5742560 100644--- a/frontend/src/app/shared/components/project-include/project-include.component.html+++ b/frontend/src/app/shared/components/project-include/project-include.component.html@@ -32,7 +32,7 @@class="spot-container op-project-include--body"><spot-text-field- [disabled]="!(areProjectsLoaded$ | async)"+ [disabled]="(loading$ | async)"[placeholder]="text.search_placeholder"name="project-include-search"[(ngModel)]="searchText"@@ -45,7 +45,7 @@></span></spot-text-field>- <ng-container *ngIf="(areProjectsLoaded$ | async); else loadingTemplate">+ <ng-container *ngIf="(loading$ | async) === false; else loadingTemplate"><ulclass="op-project-include--list"op-project-list@@ -72,7 +72,7 @@</div><div class="spot-action-bar--right"><button- [disabled]="!(areProjectsLoaded$ | async)"+ [disabled]="(loading$ | async)"class="spot-button spot-button_outlined spot-button_main"type="button"(click)="clearSelection()"@@ -80,7 +80,7 @@{{ text.clear_selection }}</button><button- [disabled]="!(areProjectsLoaded$ | async)"+ [disabled]="(loading$ | async)"class="spot-button spot-button_main">{{ text.apply }}diff --git a/frontend/src/app/shared/components/project-include/project-include.component.sass b/frontend/src/app/shared/components/project-include/project-include.component.sassindex b23378c46b8..380128e0b6b 100644--- a/frontend/src/app/shared/components/project-include/project-include.component.sass+++ b/frontend/src/app/shared/components/project-include/project-include.component.sass@@ -31,7 +31,7 @@flex-basis: 100%&--loading- padding: 0 $spot-spacing-1 0 $spot-spacing-1+ padding: $spot-spacing-1&--include-alldisplay: flexdiff --git a/frontend/src/app/shared/components/project-include/project-include.component.ts b/frontend/src/app/shared/components/project-include/project-include.component.tsindex 2f2d682cc52..8671baedfe7 100644--- a/frontend/src/app/shared/components/project-include/project-include.component.ts+++ b/frontend/src/app/shared/components/project-include/project-include.component.ts@@ -13,10 +13,10 @@ import {import {debounceTime,distinctUntilChanged,+ finalize,map,mergeMap,take,- skip,} from 'rxjs/operators';import { ApiV3Service } from 'core-app/core/apiv3/api-v3.service';@@ -201,13 +201,7 @@ export class OpProjectIncludeComponent extends UntilDestroyedMixin implements Onmap((projects) => recursiveSort(projects)),);- public areProjectsLoaded$ = this- .projects$- .pipe(- distinctUntilChanged(),- skip(1),- map((items) => items.length >= 0),- );+ public loading$ = new BehaviorSubject(false);public get params():ApiV3ListParameters {const filters:ApiV3ListFilter[] = [@@ -263,7 +257,9 @@ export class OpProjectIncludeComponent extends UntilDestroyedMixin implements Onif (this.opened) {this.loadAllProjects();this.projectsInFilter$- .pipe(take(1))+ .pipe(+ take(1),+ ).subscribe((selectedProjects) => {this.displayMode = 'all';this.searchText = '';@@ -273,12 +269,17 @@ export class OpProjectIncludeComponent extends UntilDestroyedMixin implements On}public loadAllProjects():void {+ this.loading$.next(true);+getPaginatedResults<IProject>((params) => {const collectionURL = listParamsString({ ...this.params, ...params });return this.http.get<IHALCollection<IProject>>(this.apiV3Service.projects.path + collectionURL);},)+ .pipe(+ finalize(() => this.loading$.next(false)),+ ).subscribe((projects) => {this.allProjects$.next(projects);});diff --git a/spec/support/components/project_include_component.rb b/spec/support/components/project_include_component.rbindex 907c12d153c..a834de931ce 100644--- a/spec/support/components/project_include_component.rb+++ b/spec/support/components/project_include_component.rb@@ -95,7 +95,7 @@ module Componentsdef click_button(text)within_body do- page.find('button', text: text).click+ page.find('button:not([disabled])', text: text).clickendend