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[Op#55967]: further extract outlettarget to reduce duplication

Kabiru Mwenjac0be3696ecdb
diff --git a/frontend/src/stimulus/controllers/dynamic/project-storage-form.controller.ts b/frontend/src/stimulus/controllers/dynamic/project-storage-form.controller.ts
index b78be7209a3..a1dc85e6a66 100644
--- a/frontend/src/stimulus/controllers/dynamic/project-storage-form.controller.ts
+++ b/frontend/src/stimulus/controllers/dynamic/project-storage-form.controller.ts
@@ -44,6 +44,7 @@ import {
import { IStorageFile } from 'core-app/core/state/storage-files/storage-file.model';
import { IStorage } from 'core-app/core/state/storages/storage.model';
import { OpModalService } from 'core-app/shared/components/modal/modal.service';
+import { PortalOutletTarget } from 'core-app/shared/components/modal/portal-outlet-target.enum';
import {
LocationPickerModalComponent,
} from 'core-app/shared/components/storages/location-picker-modal/location-picker-modal.component';
@@ -102,7 +103,7 @@ export default class ProjectStorageFormController extends Controller {
this.modalService
.pipe(
- switchMap((service) => service.show(LocationPickerModalComponent, 'global', locals)),
+ switchMap((service) => service.show(LocationPickerModalComponent, 'global', locals, false, false, this.OutletTarget)),
switchMap((modal) => modal.closingEvent),
filter((modal) => modal.submitted),
)
@@ -142,6 +143,10 @@ export default class ProjectStorageFormController extends Controller {
this.setProjectFolderModeQueryParam(mode);
}
+ protected get OutletTarget():PortalOutletTarget {
+ return PortalOutletTarget.Default;
+ }
+
protected get modalService():Observable<OpModalService> {
return from(window.OpenProject.getPluginContext())
.pipe(map((pluginContext) => pluginContext.services.opModalService));
diff --git a/frontend/src/stimulus/controllers/dynamic/storages/project-folder-mode-form.controller.ts b/frontend/src/stimulus/controllers/dynamic/storages/project-folder-mode-form.controller.ts
index 9c6d09ffbe9..e6f1bd75521 100644
--- a/frontend/src/stimulus/controllers/dynamic/storages/project-folder-mode-form.controller.ts
+++ b/frontend/src/stimulus/controllers/dynamic/storages/project-folder-mode-form.controller.ts
@@ -30,29 +30,11 @@
import { IStorageFile } from 'core-app/core/state/storage-files/storage-file.model';
import { PortalOutletTarget } from 'core-app/shared/components/modal/portal-outlet-target.enum';
-import {
- LocationPickerModalComponent,
-} from 'core-app/shared/components/storages/location-picker-modal/location-picker-modal.component';
-import { filter, switchMap } from 'rxjs/operators';
import ProjectStorageFormController from '../project-storage-form.controller';
-export default class ProjectFolderModeForm extends ProjectStorageFormController {
- selectProjectFolder(_evt:Event):void {
- const locals = {
- projectFolderHref: this.projectFolderHref,
- storage: this.storage,
- };
-
- this.modalService
- .pipe(
- switchMap((service) => service.show(LocationPickerModalComponent, 'global', locals, false, false, PortalOutletTarget.Custom)),
- switchMap((modal) => modal.closingEvent),
- filter((modal) => modal.submitted),
- )
- .subscribe((modal) => {
- this.selectedFolderTextTarget.innerText = modal.location.name;
- this.projectFolderIdInputTarget.value = modal.location.id as string;
- });
+export default class ProjectFolderModeFormController extends ProjectStorageFormController {
+ protected get OutletTarget():PortalOutletTarget {
+ return PortalOutletTarget.Custom;
}
protected displayFolderSelectionOrLoginButton(isConnected:boolean, projectFolder:IStorageFile|null):void {