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

[#44897] Fix QA issues in file picker

Eric Schubert6a1fd1f63506
diff --git a/frontend/src/app/shared/components/storages/file-picker-modal/file-picker-modal.component.ts b/frontend/src/app/shared/components/storages/file-picker-modal/file-picker-modal.component.ts
index e6227de2967..36ebad24007 100644
--- a/frontend/src/app/shared/components/storages/file-picker-modal/file-picker-modal.component.ts
+++ b/frontend/src/app/shared/components/storages/file-picker-modal/file-picker-modal.component.ts
@@ -53,6 +53,7 @@ import {
} from 'core-app/shared/components/storages/storage-file-list-item/storage-file-list-item';
import { FileLinksResourceService } from 'core-app/core/state/file-links/file-links.service';
import { isDirectory } from 'core-app/shared/components/storages/file-link-icons/file-icons.helper';
+import { SortFilesPipe } from 'core-app/shared/components/storages/file-picker-modal/sort-files.pipe';
import getIconForStorageType from 'core-app/shared/components/storages/storage-icons/get-icon-for-storage-type';
@Component({
@@ -99,6 +100,7 @@ export class FilePickerModalComponent extends OpModalComponent implements OnInit
readonly cdRef:ChangeDetectorRef,
private readonly i18n:I18nService,
private readonly timezoneService:TimezoneService,
+ private readonly sortFilesPipe:SortFilesPipe,
private readonly fileLinksResourceService:FileLinksResourceService,
private readonly storageFilesResourceService:StorageFilesResourceService,
) {
@@ -115,7 +117,11 @@ export class FilePickerModalComponent extends OpModalComponent implements OnInit
}]);
this.listItems$ = this.storageFiles$
- .pipe(map((files) => files.map((file, index) => this.storageFileToListItem(file, index))));
+ .pipe(
+ map((files) =>
+ this.sortFilesPipe.transform(files)
+ .map((file, index) => this.storageFileToListItem(file, index))),
+ );
this.storageFilesResourceService.files(this.makeFilesCollectionLink(null))
.pipe(take(1))
diff --git a/frontend/src/app/shared/components/storages/file-picker-modal/file-picker-modal.html b/frontend/src/app/shared/components/storages/file-picker-modal/file-picker-modal.html
index 9edcc64971c..565c9cee24c 100644
--- a/frontend/src/app/shared/components/storages/file-picker-modal/file-picker-modal.html
+++ b/frontend/src/app/shared/components/storages/file-picker-modal/file-picker-modal.html
@@ -1,12 +1,12 @@
<div
- class="spot-modal spot-modal_wide"
+ class="spot-modal spot-modal_wide op-file-picker"
data-qa-selector="op-files-picker-modal"
>
<div class="spot-modal--header">
<span class="spot-modal--header-title">{{text.header}}</span>
<button
type="button"
- class="button button_no-margin"
+ class="button button_no-margin spot-modal--header-button"
(click)="openStorageLocation()"
>
<span>{{text.buttons.openStorage()}}</span>
@@ -21,11 +21,11 @@
<ng-container *ngIf="(loading$ | async) === false; else loadingTemplate">
<ul
- class="spot-list spot-list_compact op-file-list"
+ class="spot-list spot-list_compact op-file-list op-file-picker--scrollable-content"
data-qa-selector="op-files-picker-modal--file-list"
>
<li
- *ngFor="let file of listItems$ | async | sortFiles; let i = index;"
+ *ngFor="let file of listItems$ | async; let i = index;"
class="spot-list--item op-file-list--item"
data-qa-selector="op-file-list--item"
op-storage-file-list-item
@@ -35,7 +35,7 @@
</ng-container>
<ng-template #loadingTemplate>
- <op-loading-file-list class="spot-list"></op-loading-file-list>
+ <op-loading-file-list class="spot-body-big"></op-loading-file-list>
</ng-template>
</div>
@@ -54,7 +54,7 @@
<div class="spot-action-bar--right">
<button
type="button"
- class="button spot-action-bar--action"
+ class="button spot-modal--cancel-button spot-action-bar--action"
[textContent]="text.buttons.cancel"
(click)="closeMe()"
></button>
diff --git a/frontend/src/app/shared/components/storages/loading-file-list/loading-file-list.html b/frontend/src/app/shared/components/storages/loading-file-list/loading-file-list.html
index babb0bbf221..2abd90e9be6 100644
--- a/frontend/src/app/shared/components/storages/loading-file-list/loading-file-list.html
+++ b/frontend/src/app/shared/components/storages/loading-file-list/loading-file-list.html
@@ -1,4 +1,4 @@
-<op-content-loader viewBox="0 0 960 186">
+<op-content-loader viewBox="0 0 928 186">
<svg:rect x="0" y="4" width="100%" height="32" rx="1" />
<svg:rect x="0" y="40" width="100%" height="32" rx="1" />
diff --git a/frontend/src/app/shared/components/storages/openproject-storages.module.ts b/frontend/src/app/shared/components/storages/openproject-storages.module.ts
index bbe9b82ebec..17f91552420 100644
--- a/frontend/src/app/shared/components/storages/openproject-storages.module.ts
+++ b/frontend/src/app/shared/components/storages/openproject-storages.module.ts
@@ -72,6 +72,7 @@ import {
StorageComponent,
],
providers: [
+ SortFilesPipe,
CookieService,
],
})
diff --git a/frontend/src/app/shared/components/storages/storage-information/storage-information.component.ts b/frontend/src/app/shared/components/storages/storage-information/storage-information.component.ts
index cbb7002c18f..ee9a9121c97 100644
--- a/frontend/src/app/shared/components/storages/storage-information/storage-information.component.ts
+++ b/frontend/src/app/shared/components/storages/storage-information/storage-information.component.ts
@@ -39,5 +39,5 @@ import {
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class StorageInformationComponent {
- @Input() viewModel:StorageInformationBox;
+ @Input() content:StorageInformationBox;
}
diff --git a/frontend/src/app/shared/components/storages/storage-information/storage-information.html b/frontend/src/app/shared/components/storages/storage-information/storage-information.html
index be201e0a2d6..2cb35c63008 100644
--- a/frontend/src/app/shared/components/storages/storage-information/storage-information.html
+++ b/frontend/src/app/shared/components/storages/storage-information/storage-information.html
@@ -1,4 +1,4 @@
-<span class="spot-icon spot-icon_{{viewModel.iconClass}} op-files-tab--storage-info-box-icon"></span>
+<span class="spot-icon spot-icon_{{content.iconClass}} op-files-tab--storage-info-box-icon"></span>
<div
class="text-box"
@@ -6,31 +6,23 @@
<div
class="text-box-header"
>
- <span [textContent]="viewModel.header"></span>
+ <span [textContent]="content.header"></span>
</div>
<div
class="text-box-content"
>
- <span [textContent]="viewModel.content"></span>
+ <span [textContent]="content.content"></span>
</div>
</div>
<div
class="button-box"
>
- <button *ngFor="let button of viewModel.buttons"
- class="button op-files-tab--storage-info-box-button"
- (click)="button.action()"
+ <button *ngFor="let button of content.buttons"
+ class="button op-files-tab--storage-info-box-button"
+ (click)="button.action()"
>
- <op-icon
- icon-classes="button--icon spot-icon spot-icon_external-link"
- class="op-icon--wrapper">
- <i
- class="button--icon spot-icon spot-icon_external-link"
- ></i>
- </op-icon>
- <span
- class="button--text"
- >{{button.label}}</span>
+ <span class="button--text">{{button.label}}</span>
+ <span class="spot-icon spot-icon_external-link"></span>
</button>
</div>
diff --git a/frontend/src/app/shared/components/storages/storage/storage.component.html b/frontend/src/app/shared/components/storages/storage/storage.component.html
index 57bc143fb4e..9b39f79d4d7 100644
--- a/frontend/src/app/shared/components/storages/storage/storage.component.html
+++ b/frontend/src/app/shared/components/storages/storage/storage.component.html
@@ -19,7 +19,7 @@
*ngFor="let infoBox of storageInformation | async"
class="op-files-tab--storage-info-box"
data-qa-selector="op-files-tab--storage-information"
- [viewModel]="infoBox"
+ [content]="infoBox"
></op-storage-information>
<ul
diff --git a/frontend/src/app/spot/styles/sass/components/list.sass b/frontend/src/app/spot/styles/sass/components/list.sass
index 2fcfd746dd3..4c2db9e6bca 100644
--- a/frontend/src/app/spot/styles/sass/components/list.sass
+++ b/frontend/src/app/spot/styles/sass/components/list.sass
@@ -25,9 +25,6 @@
cursor: pointer
scroll-margin-top: $spot-spacing-5
- > *:first-child
- flex-shrink: 0
-
&:focus
@include spot-focus
diff --git a/frontend/src/app/spot/styles/sass/components/modal-overrides.sass b/frontend/src/app/spot/styles/sass/components/modal-overrides.sass
index 7bcb16016d1..8ca16014673 100644
--- a/frontend/src/app/spot/styles/sass/components/modal-overrides.sass
+++ b/frontend/src/app/spot/styles/sass/components/modal-overrides.sass
@@ -8,3 +8,11 @@
.modal-delivery-element
display: none
+
+@media #{$spot-mq-desktop}
+ .spot-modal.op-file-picker
+ max-height: 40vh
+
+ .op-file-picker
+ &--scrollable-content
+ overflow-y: auto
diff --git a/frontend/src/app/spot/styles/sass/components/modal.sass b/frontend/src/app/spot/styles/sass/components/modal.sass
index 61665fec1c5..1abf7bb66e2 100644
--- a/frontend/src/app/spot/styles/sass/components/modal.sass
+++ b/frontend/src/app/spot/styles/sass/components/modal.sass
@@ -18,7 +18,7 @@
overflow-y: auto
- @media (max-width: 680px)
+ @media #{$spot-mq-mobile}
width: calc(100vw - 2rem)
max-height: calc(100vh - 5rem)
@@ -47,6 +47,9 @@
margin-right: $spot-spacing-0-5
font-size: 1rem
+ &-button
+ font-weight: normal
+
&-title
flex-grow: 1
@@ -71,5 +74,5 @@
outline-style: none
&--cancel-button
- @media (max-width: 680px)
+ @media #{$spot-mq-mobile}
display: none
diff --git a/frontend/src/app/spot/styles/tokens/dist/tokens.sass b/frontend/src/app/spot/styles/tokens/dist/tokens.sass
index f9fd3b6171a..481429b4cf0 100644
--- a/frontend/src/app/spot/styles/tokens/dist/tokens.sass
+++ b/frontend/src/app/spot/styles/tokens/dist/tokens.sass
@@ -58,3 +58,4 @@ $spot-mq-landscape: '(orientation: landscape)'
$spot-mq-drop-modal-in-context: '(min-width: 1000px) and (min-height: 500px)'
$spot-mq-action-bar-change: '(min-width: 600px)'
$spot-mq-mobile: '(max-width: 679px)'
+$spot-mq-desktop: '(min-width: 680px)'