Skip to content

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

add content loader to the modal while data is not loaded

bsatarnejadb3bc6cc84ffc
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.html
index 6ea532409db..6fc867fcaa2 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,6 +32,7 @@
class="spot-body"
>
<spot-text-field
+ [disabled]="!(hasProjects$ | async)"
[placeholder]="text.search_placeholder"
name="project-include-search"
[(ngModel)]="query"
@@ -44,13 +45,15 @@
></span>
</spot-text-field>
- <ul
- op-project-list
- [projects]="projects$ | async"
- [selected]="selectedProjects"
- (update)="selectedProjects = $event"
- data-qa-selector="project-include-list"
- ></ul>
+ <ng-container *ngIf="(hasProjects$ | async); else loadingTemplate">
+ <ul
+ op-project-list
+ [projects]="projects$ | async"
+ [selected]="selectedProjects"
+ (update)="selectedProjects = $event"
+ data-qa-selector="project-include-list"
+ ></ul>
+ </ng-container>
<div class="spot-action-bar">
<div class="spot-action-bar--left"></div>
@@ -67,6 +70,22 @@
</button>
</div>
</div>
+ <ng-template #loadingTemplate>
+ <op-content-loader
+ class="op-project-include--loading"
+ viewBox="0 0 200 140"
+ >
+ <svg:rect x="0" y="0" width="100%" height="12" rx="1" />
+ <svg:rect x="20" y="16" width="100%" height="12" rx="1" />
+ <svg:rect x="20" y="32" width="100%" height="12" rx="1" />
+ <svg:rect x="40" y="48" width="100%" height="12" rx="1" />
+ <svg:rect x="40" y="64" width="100%" height="12" rx="1" />
+ <svg:rect x="0" y="80" width="100%" height="12" rx="1" />
+ <svg:rect x="20" y="96" width="100%" height="12" rx="1" />
+ <svg:rect x="20" y="112" width="100%" height="12" rx="1" />
+ <svg:rect x="0" y="128" width="100%" height="12" rx="1" />
+ </op-content-loader>
+ </ng-template>
</form>
</ng-container>
</spot-drop-modal>
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.sass
index ec6218123b9..76ef2cdaa41 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
@@ -16,3 +16,6 @@
margin: 0
padding: 0
@include spot-subheader-big
+
+ &--loading
+ padding: 0 15px 0 15px
diff --git a/frontend/src/app/shared/components/project-include/project-include.component.ts b/frontend/src/app/shared/components/project-include/project-include.component.ts
index 0d326bfab5b..0fde74565bf 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
@@ -158,6 +158,14 @@ export class OpProjectIncludeComponent extends UntilDestroyedMixin {
map((projects) => recursiveSort(projects)),
);
+ hasProjects$ = this
+ .projects$
+ .pipe(
+ distinctUntilChanged(),
+ map((items) => items.length > 0),
+ distinctUntilChanged(),
+ );
+
public get params():ApiV3ListParameters {
const filters:ApiV3ListFilter[] = [
['active', '=', ['t']],
diff --git a/frontend/src/app/shared/shared.module.ts b/frontend/src/app/shared/shared.module.ts
index 6b52d521748..13a8dc43f6a 100644
--- a/frontend/src/app/shared/shared.module.ts
+++ b/frontend/src/app/shared/shared.module.ts
@@ -89,6 +89,7 @@ import { OpSidemenuComponent } from './components/sidemenu/sidemenu.component';
import { OpProjectIncludeComponent } from './components/project-include/project-include.component';
import { OpProjectListComponent } from './components/project-include/project-list.component';
import { ViewsResourceService } from 'core-app/core/state/views/views.service';
+import { OpenprojectContentLoaderModule } from 'core-app/shared/components/op-content-loader/openproject-content-loader.module';
export function bootstrapModule(injector:Injector) {
// Ensure error reporter is run
@@ -131,6 +132,7 @@ export function bootstrapModule(injector:Injector) {
DynamicBootstrapModule,
OpenprojectPrincipalRenderingModule,
+ OpenprojectContentLoaderModule,
DatePickerModule,
FocusModule,