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

[#44853] moved open storage to header

Eric Schubert5827c6277b4e
diff --git a/frontend/src/app/features/work-packages/components/wp-single-view-tabs/files-tab/op-files-tab.component.ts b/frontend/src/app/features/work-packages/components/wp-single-view-tabs/files-tab/op-files-tab.component.ts
index 6900966d9cf..f2872ed9e3a 100644
--- a/frontend/src/app/features/work-packages/components/wp-single-view-tabs/files-tab/op-files-tab.component.ts
+++ b/frontend/src/app/features/work-packages/components/wp-single-view-tabs/files-tab/op-files-tab.component.ts
@@ -41,6 +41,7 @@ import {
map,
} from 'rxjs/operators';
+import { nextcloud } from 'core-app/shared/components/file-links/file-links-constants.const';
import { WorkPackageResource } from 'core-app/features/hal/resources/work-package-resource';
import { I18nService } from 'core-app/core/i18n/i18n.service';
import { HookService } from 'core-app/features/plugins/hook-service';
@@ -64,8 +65,11 @@ export class WorkPackageFilesTabComponent implements OnInit {
attachments: {
label: this.i18n.t('js.label_attachments'),
},
- file_links: {
- label: this.i18n.t('js.label_nextcloud'),
+ storages: {
+ open: (storageType:string):string => this.i18n.t(
+ 'js.storages.open_storage',
+ { storageType: this.storageTypeMap[storageType] },
+ ),
},
};
@@ -73,6 +77,8 @@ export class WorkPackageFilesTabComponent implements OnInit {
storages$:Observable<IStorage[]>;
+ private readonly storageTypeMap:Record<string, string> = {};
+
constructor(
private readonly i18n:I18nService,
private readonly hook:HookService,
@@ -84,6 +90,8 @@ export class WorkPackageFilesTabComponent implements OnInit {
) { }
ngOnInit():void {
+ this.initializeStorageTypes();
+
const project = this.workPackage.project as HalResource;
if (project.id === null) {
return;
@@ -115,4 +123,12 @@ export class WorkPackageFilesTabComponent implements OnInit {
map(([storages, viewPermission]) => storages.length > 0 && viewPermission),
);
}
+
+ public openStorage(href:string):void {
+ window.open(href, '_blank');
+ }
+
+ private initializeStorageTypes() {
+ this.storageTypeMap[nextcloud] = this.i18n.t('js.storages.types.nextcloud');
+ }
}
diff --git a/frontend/src/app/features/work-packages/components/wp-single-view-tabs/files-tab/op-files-tab.html b/frontend/src/app/features/work-packages/components/wp-single-view-tabs/files-tab/op-files-tab.html
index a261799ee57..88531d6fb3b 100644
--- a/frontend/src/app/features/work-packages/components/wp-single-view-tabs/files-tab/op-files-tab.html
+++ b/frontend/src/app/features/work-packages/components/wp-single-view-tabs/files-tab/op-files-tab.html
@@ -25,8 +25,15 @@
class="op-tab-content--tab-section"
>
<div class=op-tab-content--header>
- <span class="spot-icon spot-icon_nextcloud-circle op-files-tab--icon op-files-tab--icon_nextcloud"></span>
+ <span class="op-tab-content--header-icon spot-icon spot-icon_nextcloud-circle op-files-tab--icon op-files-tab--icon_nextcloud"></span>
<span class="op-tab-content--header-text" [textContent]="storage.name"></span>
+ <button
+ class="op-tab-content--header-action spot-link"
+ [title]="text.storages.open(storage._links.type.href)"
+ (click)="openStorage(storage._links.open.href)"
+ >
+ <span class="spot-icon spot-icon_external-link"></span>
+ </button>
</div>
<op-file-link-list
diff --git a/frontend/src/app/shared/components/file-links/file-link-list/file-link-list.component.ts b/frontend/src/app/shared/components/file-links/file-link-list/file-link-list.component.ts
index 5db8439e8f1..f26674e26c0 100644
--- a/frontend/src/app/shared/components/file-links/file-link-list/file-link-list.component.ts
+++ b/frontend/src/app/shared/components/file-links/file-link-list/file-link-list.component.ts
@@ -106,7 +106,6 @@ export class FileLinkListComponent extends UntilDestroyedMixin implements OnInit
loginButton: (storageType:string):string => this.i18n.t('js.storages.login', { storageType }),
},
actions: {
- linkFile: (storageType:string):string => this.i18n.t('js.storages.link_files_in_storage', { storageType }),
linkExisting: this.i18n.t('js.storages.link_existing_files'),
},
};
@@ -163,10 +162,6 @@ export class FileLinkListComponent extends UntilDestroyedMixin implements OnInit
this.fileLinkResourceService.remove(this.collectionKey, fileLink);
}
- public openStorageLocation():void {
- window.open(this.storageFilesLocation, '_blank');
- }
-
public openLinkFilesDialog():void {
this.fileLinks$
.pipe(take(1))
diff --git a/frontend/src/app/shared/components/file-links/file-link-list/file-link-list.html b/frontend/src/app/shared/components/file-links/file-link-list/file-link-list.html
index 5d102714fb1..b78e93a01b8 100644
--- a/frontend/src/app/shared/components/file-links/file-link-list/file-link-list.html
+++ b/frontend/src/app/shared/components/file-links/file-link-list/file-link-list.html
@@ -28,14 +28,6 @@
*ngIf="(showLinkFilesAction | async) && (allowEditing$ | async)"
class="spot-body-small op-file-list--actions"
>
- <button
- type="button"
- class="spot-link op-file-list--action-button"
- (click)="openStorageLocation()"
- >
- <span class="spot-icon spot-icon_external-link"></span>
- <span [textContent]="text.actions.linkFile(storageType)"></span>
- </button>
<button
*ngIf="storageFileLinkingEnabled"
type="button"
diff --git a/frontend/src/global_styles/content/work_packages/tabs/_tab_content.sass b/frontend/src/global_styles/content/work_packages/tabs/_tab_content.sass
index 2134ebe8f56..cbdbd5a7342 100644
--- a/frontend/src/global_styles/content/work_packages/tabs/_tab_content.sass
+++ b/frontend/src/global_styles/content/work_packages/tabs/_tab_content.sass
@@ -54,7 +54,9 @@
font-weight: 700
text-transform: uppercase
- .spot-icon
- width: $spot-spacing-1_5
- height: $spot-spacing-1_5
+ &-icon
margin-right: $spot-spacing-0_5
+
+ &-action:not(:first-child)
+ @include spot-caption()
+ margin-left: $spot-spacing-0_25