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
[#45963] Remove Select All and Open Storage interaction elements from file pickers
Eric Schubert4bb73add2a6f
diff --git a/frontend/src/app/shared/components/storages/file-picker-base-modal.component.ts/file-picker-base-modal.component.ts b/frontend/src/app/shared/components/storages/file-picker-base-modal.component.ts/file-picker-base-modal.component.tsindex db915f7b296..dade4df3203 100644--- a/frontend/src/app/shared/components/storages/file-picker-base-modal.component.ts/file-picker-base-modal.component.ts+++ b/frontend/src/app/shared/components/storages/file-picker-base-modal.component.ts/file-picker-base-modal.component.ts@@ -123,10 +123,6 @@ export abstract class FilePickerBaseModalComponent extends OpModalComponent implthis.storageFilesResourceService.reset();}- public openStorageLocation():void {- window.open(this.locals.storageLocation as string, '_blank');- }-protected abstract storageFileToListItem(file:IStorageFile, index:number):StorageFileListItem;protected enterDirectoryCallback(directory:IStorageFile):() => void {diff --git a/frontend/src/app/shared/components/storages/file-picker-modal/file-picker-modal.component.html b/frontend/src/app/shared/components/storages/file-picker-modal/file-picker-modal.component.htmlindex 801f5897fa6..66aeef9a641 100644--- a/frontend/src/app/shared/components/storages/file-picker-modal/file-picker-modal.component.html+++ b/frontend/src/app/shared/components/storages/file-picker-modal/file-picker-modal.component.html@@ -4,14 +4,6 @@><div class="spot-modal--header"><span class="spot-modal--header-title">{{text.header}}</span>- <button- type="button"- class="button button_no-margin spot-modal--header-button"- (click)="openStorageLocation()"- >- <span>{{text.buttons.openStorage()}}</span>- <span class="spot-icon spot-icon_external-link"></span>- </button></div><div class="spot-divider"></div>@@ -40,7 +32,10 @@</div><div class="spot-action-bar">- <div class="spot-action-bar--left">+ <div+ *ngIf="showSelectAll"+ class="spot-action-bar--left"+ ><buttontype="button"class="spot-link spot-action-bar--action"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.tsindex c0566809809..e61b7e7b3af 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@@ -36,15 +36,16 @@ import { TimezoneService } from 'core-app/core/datetime/timezone.service';import { IFileLink } from 'core-app/core/state/file-links/file-link.model';import { ToastService } from 'core-app/shared/components/toaster/toast.service';import { OpModalLocalsMap } from 'core-app/shared/components/modal/modal.types';+import { ConfigurationService } from 'core-app/core/config/configuration.service';import { IStorageFile } from 'core-app/core/state/storage-files/storage-file.model';import { OpModalLocalsToken } from 'core-app/shared/components/modal/modal.service';import { SortFilesPipe } from 'core-app/shared/components/storages/pipes/sort-files.pipe';-import { StorageFilesResourceService } from 'core-app/core/state/storage-files/storage-files.service';import { FileLinksResourceService } from 'core-app/core/state/file-links/file-links.service';+import { isDirectory } from 'core-app/shared/components/storages/functions/storages.functions';+import { StorageFilesResourceService } from 'core-app/core/state/storage-files/storage-files.service';import {StorageFileListItem,} from 'core-app/shared/components/storages/storage-file-list-item/storage-file-list-item';-import { isDirectory } from 'core-app/shared/components/storages/functions/storages.functions';import {FilePickerBaseModalComponent,} from 'core-app/shared/components/storages/file-picker-base-modal.component.ts/file-picker-base-modal.component';@@ -57,7 +58,6 @@ export class FilePickerModalComponent extends FilePickerBaseModalComponent {public readonly text = {header: this.i18n.t('js.storages.file_links.select'),buttons: {- openStorage: ():string => this.i18n.t('js.storages.open_storage', { storageType: this.locals.storageTypeName as string }),submit: (count:number):string => this.i18n.t('js.storages.file_links.selection', { count }),cancel: this.i18n.t('js.button_cancel'),selectAll: this.i18n.t('js.storages.file_links.select_all'),@@ -75,6 +75,8 @@ export class FilePickerModalComponent extends FilePickerBaseModalComponent {return this.selection.size;}+ public showSelectAll = false;+private readonly selection = new Set<string>();private readonly fileMap:Record<string, IStorageFile> = {};@@ -88,6 +90,7 @@ export class FilePickerModalComponent extends FilePickerBaseModalComponent {private readonly i18n:I18nService,private readonly toastService:ToastService,private readonly timezoneService:TimezoneService,+ private readonly configuration:ConfigurationService,private readonly fileLinksResourceService:FileLinksResourceService,) {super(@@ -97,6 +100,8 @@ export class FilePickerModalComponent extends FilePickerBaseModalComponent {sortFilesPipe,storageFilesResourceService,);++ this.showSelectAll = this.configuration.activeFeatureFlags.includes('storageFilePickingSelectAll');}public createSelectedFileLinks():void {@@ -108,7 +113,7 @@ export class FilePickerModalComponent extends FilePickerBaseModalComponent {files,).subscribe((fileLinks) => { this.toastService.addSuccess(this.text.toast.successFileLinksCreated(fileLinks.count)); },- (error) => { this.toastService.addError(error); },+ (error) => { this.toastService.addError(JSON.stringify(error)); },);this.service.close();diff --git a/frontend/src/app/shared/components/storages/location-picker-modal/location-picker-modal.component.html b/frontend/src/app/shared/components/storages/location-picker-modal/location-picker-modal.component.htmlindex 5eb9d152d75..b0a905e0604 100644--- a/frontend/src/app/shared/components/storages/location-picker-modal/location-picker-modal.component.html+++ b/frontend/src/app/shared/components/storages/location-picker-modal/location-picker-modal.component.html@@ -4,14 +4,6 @@><div class="spot-modal--header"><span class="spot-modal--header-title">{{text.header}}</span>- <button- type="button"- class="button button_no-margin spot-modal--header-button"- (click)="openStorageLocation()"- >- <span>{{text.buttons.openStorage()}}</span>- <span class="spot-icon spot-icon_external-link"></span>- </button></div><div class="spot-divider"></div>diff --git a/frontend/src/app/shared/components/storages/location-picker-modal/location-picker-modal.component.ts b/frontend/src/app/shared/components/storages/location-picker-modal/location-picker-modal.component.tsindex 66b17ca0987..55fde0ccd73 100644--- a/frontend/src/app/shared/components/storages/location-picker-modal/location-picker-modal.component.ts+++ b/frontend/src/app/shared/components/storages/location-picker-modal/location-picker-modal.component.ts@@ -59,7 +59,6 @@ export class LocationPickerModalComponent extends FilePickerBaseModalComponent {public readonly text = {header: this.i18n.t('js.storages.select_location'),buttons: {- openStorage: ():string => this.i18n.t('js.storages.open_storage', { storageType: this.locals.storageTypeName as string }),submit: this.i18n.t('js.storages.choose_location'),submitEmptySelection: this.i18n.t('js.storages.file_links.selection_none'),cancel: this.i18n.t('js.button_cancel'),diff --git a/frontend/src/app/shared/components/storages/storage/storage.component.ts b/frontend/src/app/shared/components/storages/storage/storage.component.tsindex 60fa9256a41..0d2d8d2f34a 100644--- a/frontend/src/app/shared/components/storages/storage/storage.component.ts+++ b/frontend/src/app/shared/components/storages/storage/storage.component.ts@@ -243,9 +243,7 @@ export class StorageComponent extends UntilDestroyedMixin implements OnInit, OnD.subscribe((fileLinks) => {const locals = {storageType: this.storage._links.type.href,- storageTypeName: this.storageType,storageName: this.storage.name,- storageLocation: this.storageFilesLocation,storageLink: this.storage._links.self,addFileLinksHref: this.addFileLinksHref,collectionKey: this.collectionKey,@@ -269,9 +267,7 @@ export class StorageComponent extends UntilDestroyedMixin implements OnInit, OnDprivate openSelectLocationDialog(files:FileList|null):void {const locals = {storageType: this.storage._links.type.href,- storageTypeName: this.storageType,storageName: this.storage.name,- storageLocation: this.storageFilesLocation,storageLink: this.storage._links.self,};this.opModalService.show<LocationPickerModalComponent>(LocationPickerModalComponent, 'global', locals)diff --git a/modules/storages/lib/open_project/storages/engine.rb b/modules/storages/lib/open_project/storages/engine.rbindex 20c40110dd0..48d743b3fba 100644--- a/modules/storages/lib/open_project/storages/engine.rb+++ b/modules/storages/lib/open_project/storages/engine.rb@@ -42,6 +42,7 @@ module OpenProject::Storagesinitializer 'openproject_storages.feature_decisions' doOpenProject::FeatureDecisions.add :storage_file_linking+ OpenProject::FeatureDecisions.add :storage_file_picking_select_allOpenProject::FeatureDecisions.add :storage_file_uploadOpenProject::FeatureDecisions.add :legacy_upload_preparationenddiff --git a/modules/storages/spec/features/create_file_links_spec.rb b/modules/storages/spec/features/create_file_links_spec.rbindex 2d88423eb4b..04061af6657 100644--- a/modules/storages/spec/features/create_file_links_spec.rb+++ b/modules/storages/spec/features/create_file_links_spec.rb@@ -80,7 +80,7 @@ describe 'Creating file links in work package', js: true, webmock: true, with_flwp_page.visit_tab! :filesend- describe 'with the file picker' do+ describe 'with the file picker', with_flag: { storage_file_picking_select_all: true, storage_file_linking: true } doit 'must enable the user to link existing files on the storage' doexpect(wp_page.all('[data-qa-selector="file-list--item"]').size).to eq 1expect(wp_page).to have_selector('[data-qa-selector="file-list--item"]', text: file_link.name)