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

[chore] fix loading skeleton in file picker

Eric Schubert84ae8d87fd35
diff --git a/frontend/src/app/shared/components/file-links/file-picker-modal/file-picker-modal.component.ts b/frontend/src/app/shared/components/file-links/file-picker-modal/file-picker-modal.component.ts
index bdc873f6ce8..de5629a86bc 100644
--- a/frontend/src/app/shared/components/file-links/file-picker-modal/file-picker-modal.component.ts
+++ b/frontend/src/app/shared/components/file-links/file-picker-modal/file-picker-modal.component.ts
@@ -35,7 +35,7 @@ import {
OnDestroy,
OnInit,
} from '@angular/core';
-import { BehaviorSubject, Observable } from 'rxjs';
+import { BehaviorSubject, Observable, Subscription } from 'rxjs';
import { map, take } from 'rxjs/operators';
import { I18nService } from 'core-app/core/i18n/i18n.service';
@@ -91,6 +91,8 @@ export class FilePickerModalComponent extends OpModalComponent implements OnInit
private readonly storageFiles$ = new BehaviorSubject<IStorageFile[]>([]);
+ private loadingSubscription:Subscription;
+
constructor(
@Inject(OpModalLocalsToken) public locals:OpModalLocalsMap,
readonly elementRef:ElementRef,
@@ -174,17 +176,24 @@ export class FilePickerModalComponent extends OpModalComponent implements OnInit
}
private changeLevel(parent:string|null, crumbs:Breadcrumb[]):void {
+ this.cancelCurrentLoading();
this.loading$.next(true);
+ this.breadcrumbs = new BreadcrumbsContent(crumbs);
- this.storageFilesResourceService.files(this.makeFilesCollectionLink(parent))
+ this.loadingSubscription = this.storageFilesResourceService.files(this.makeFilesCollectionLink(parent))
.pipe(take(1))
.subscribe((files) => {
this.storageFiles$.next(files);
this.loading$.next(false);
- this.breadcrumbs = new BreadcrumbsContent(crumbs);
});
}
+ private cancelCurrentLoading():void {
+ if (this.loadingSubscription) {
+ this.loadingSubscription.unsubscribe();
+ }
+ }
+
private makeFilesCollectionLink(parent:string|null):IHalResourceLink {
let query = '';
if (parent !== null) {
diff --git a/frontend/src/app/shared/components/file-links/file-picker-modal/file-picker-modal.html b/frontend/src/app/shared/components/file-links/file-picker-modal/file-picker-modal.html
index 67b4d4af9fd..9edcc64971c 100644
--- a/frontend/src/app/shared/components/file-links/file-picker-modal/file-picker-modal.html
+++ b/frontend/src/app/shared/components/file-links/file-picker-modal/file-picker-modal.html
@@ -17,9 +17,9 @@
<div class="spot-divider"></div>
<div class="spot-modal--body spot-container">
- <ng-container *ngIf="(loading$ | async) === false; else loadingTemplate">
- <spot-breadcrumbs [content]="breadcrumbs"></spot-breadcrumbs>
+ <spot-breadcrumbs [content]="breadcrumbs"></spot-breadcrumbs>
+ <ng-container *ngIf="(loading$ | async) === false; else loadingTemplate">
<ul
class="spot-list spot-list_compact op-file-list"
data-qa-selector="op-files-picker-modal--file-list"
@@ -35,7 +35,7 @@
</ng-container>
<ng-template #loadingTemplate>
- <op-loading-file-list></op-loading-file-list>
+ <op-loading-file-list class="spot-list"></op-loading-file-list>
</ng-template>
</div>
diff --git a/frontend/src/app/shared/components/file-links/loading-file-list/loading-file-list.html b/frontend/src/app/shared/components/file-links/loading-file-list/loading-file-list.html
index acda52a14cb..babb0bbf221 100644
--- a/frontend/src/app/shared/components/file-links/loading-file-list/loading-file-list.html
+++ b/frontend/src/app/shared/components/file-links/loading-file-list/loading-file-list.html
@@ -1,11 +1,11 @@
-<op-content-loader viewBox="0 0 1080 200">
- <svg:rect x="0" y="20" width="100%" height="32" rx="1" />
+<op-content-loader viewBox="0 0 960 186">
+ <svg:rect x="0" y="4" width="100%" height="32" rx="1" />
- <svg:rect x="0" y="56" width="100%" height="32" rx="1" />
+ <svg:rect x="0" y="40" width="100%" height="32" rx="1" />
- <svg:rect x="0" y="92" width="100%" height="32" rx="1" />
+ <svg:rect x="0" y="76" width="100%" height="32" rx="1" />
- <svg:rect x="0" y="128" width="100%" height="32" rx="1" />
+ <svg:rect x="0" y="112" width="100%" height="32" rx="1" />
- <svg:rect x="0" y="164" width="100%" height="32" rx="1" />
+ <svg:rect x="0" y="148" width="100%" height="32" rx="1" />
</op-content-loader>
diff --git a/frontend/src/app/shared/components/file-links/storage-file-list-item/storage-file-list-item.html b/frontend/src/app/shared/components/file-links/storage-file-list-item/storage-file-list-item.html
index 59b8d4f545a..b2ab41f2fbe 100644
--- a/frontend/src/app/shared/components/file-links/storage-file-list-item/storage-file-list-item.html
+++ b/frontend/src/app/shared/components/file-links/storage-file-list-item/storage-file-list-item.html
@@ -47,7 +47,7 @@
<button
*ngIf="content.isDirectory"
- class="spot-link"
+ class="spot-link op-file-list--item-button"
data-qa-selector="op-files-picker-modal--list-item-caret"
(click)="content.enterDirectory()"
>
diff --git a/frontend/src/global_styles/content/work_packages/shared/_file_list.sass b/frontend/src/global_styles/content/work_packages/shared/_file_list.sass
index 51272d6d555..35aa3949c5f 100644
--- a/frontend/src/global_styles/content/work_packages/shared/_file_list.sass
+++ b/frontend/src/global_styles/content/work_packages/shared/_file_list.sass
@@ -76,6 +76,13 @@
&-icon
margin-right: $spot-spacing-0_25
+ & &-button
+ display: flex
+
+ &:hover,
+ &:focus
+ text-decoration: none
+
& &--item &--item-floating-actions
padding-right: 0