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

Remove angular export form

as-op22551769d535
diff --git a/frontend/src/app/features/work-packages/openproject-work-packages.module.ts b/frontend/src/app/features/work-packages/openproject-work-packages.module.ts
index 83cd6b9b9a1..03f4398e73d 100644
--- a/frontend/src/app/features/work-packages/openproject-work-packages.module.ts
+++ b/frontend/src/app/features/work-packages/openproject-work-packages.module.ts
@@ -270,7 +270,6 @@ import { OpWpTabsModule } from 'core-app/features/work-packages/components/wp-ta
import {
EditFieldControlsModule,
} from 'core-app/shared/components/fields/edit/field-controls/edit-field-controls.module';
-import { WpTableExportModalComponent } from 'core-app/shared/components/modals/export-modal/wp-table-export.modal';
import {
WpButtonMacroModalComponent,
} from 'core-app/shared/components/modals/editor/macro-wp-button-modal/wp-button-macro.modal';
@@ -628,7 +627,6 @@ import {
WpTableConfigurationTimelinesTabComponent,
WpTableConfigurationHighlightingTabComponent,
WpTableConfigurationRelationSelectorComponent,
- WpTableExportModalComponent,
QuerySharingFormComponent,
QuerySharingModalComponent,
SaveQueryModalComponent,
diff --git a/frontend/src/app/shared/components/modals/export-modal/wp-table-export.modal.html b/frontend/src/app/shared/components/modals/export-modal/wp-table-export.modal.html
deleted file mode 100644
index 3b7ab4fe554..00000000000
--- a/frontend/src/app/shared/components/modals/export-modal/wp-table-export.modal.html
+++ /dev/null
@@ -1,40 +0,0 @@
-<div class="spot-modal spot-modal_wide op-wp-table-export"
- tabindex="0"
- cdkFocusInitial
- cdkTrapFocus
- [cdkTrapFocusAutoCapture]="true">
-
- <div id="spotModalTitle" class="spot-modal--header">{{text.title}}</div>
-
- <div class="spot-divider"></div>
-
- <div class="spot-modal--body spot-container">
- <ul *ngIf="exportOptions" class="op-export-options op-export-options-grid" [ngClass]="{'-hidden': isLoading}">
- <li
- *ngFor="let option of exportOptions"
- class="op-export-options--option"
- >
- <a
- [attr.href]="option.url"
- class="op-export-options--option-link"
- (click)="triggerByOption(option, $event)"
- id="export-{{ option.identifier }}"
- >
- <op-icon icon-classes="icon-export-{{ option.identifier }} icon-big"></op-icon>
- <span class="op-export-options--option-label" [textContent]="option.label"></span>
- </a>
- </li>
- </ul>
- </div>
- <div class="spot-action-bar hidden-for-mobile">
- <div class="spot-action-bar--right">
- <button
- type="button"
- class="button button_no-margin spot-modal--cancel-button spot-action-bar--action"
- (click)="closeMe()"
- >
- {{ text.cancelButton }}
- </button>
- </div>
- </div>
-</div>
diff --git a/frontend/src/app/shared/components/modals/export-modal/wp-table-export.modal.sass b/frontend/src/app/shared/components/modals/export-modal/wp-table-export.modal.sass
deleted file mode 100644
index 5b5d49be610..00000000000
--- a/frontend/src/app/shared/components/modals/export-modal/wp-table-export.modal.sass
+++ /dev/null
@@ -1,14 +0,0 @@
-.op-wp-table-export
- #download-link
- display: none
-
- .loading-indicator--location
- height: 220px
-
- .export-options
- &.-hidden
- display: none
-
- .gantt-export-options
- display: flex
- justify-content: center
diff --git a/frontend/src/app/shared/components/modals/export-modal/wp-table-export.modal.ts b/frontend/src/app/shared/components/modals/export-modal/wp-table-export.modal.ts
deleted file mode 100644
index ad07e283cda..00000000000
--- a/frontend/src/app/shared/components/modals/export-modal/wp-table-export.modal.ts
+++ /dev/null
@@ -1,170 +0,0 @@
-import {
- ChangeDetectionStrategy, ChangeDetectorRef, Component, ElementRef, Inject, OnInit,
-} from '@angular/core';
-import { OpModalLocalsMap } from 'core-app/shared/components/modal/modal.types';
-import { OpModalComponent } from 'core-app/shared/components/modal/modal.component';
-import {
- WorkPackageViewColumnsService,
-} from 'core-app/features/work-packages/routing/wp-view-base/view-services/wp-view-columns.service';
-import { WorkPackageCollectionResource } from 'core-app/features/hal/resources/wp-collection-resource';
-import { HalLink } from 'core-app/features/hal/hal-link/hal-link';
-import { I18nService } from 'core-app/core/i18n/i18n.service';
-import * as URI from 'urijs';
-import { HttpClient, HttpErrorResponse } from '@angular/common/http';
-import { LoadingIndicatorService } from 'core-app/core/loading-indicator/loading-indicator.service';
-import { ToastService } from 'core-app/shared/components/toaster/toast.service';
-import { JobStatusModalComponent } from 'core-app/features/job-status/job-status-modal/job-status.modal';
-import { IsolatedQuerySpace } from 'core-app/features/work-packages/directives/query-space/isolated-query-space';
-import { OpModalLocalsToken } from 'core-app/shared/components/modal/modal.service';
-import { QueryResource } from 'core-app/features/hal/resources/query-resource';
-import { StaticQueriesService } from 'core-app/shared/components/op-view-select/op-static-queries.service';
-import isPersistedResource from 'core-app/features/hal/helpers/is-persisted-resource';
-
-interface ExportLink extends HalLink {
- identifier:string;
-}
-
-interface ExportOptions {
- identifier:string;
- label:string;
- url:string;
-}
-
-/**
- Modal for exporting work packages to different formats. The user may choose from a variety of formats (e.g. PDF and CSV).
- The modal might also be used to only display the progress of an export. This will happen if a link for exporting is provided via the locals.
- */
-@Component({
- templateUrl: './wp-table-export.modal.html',
- styleUrls: ['./wp-table-export.modal.sass'],
- changeDetection: ChangeDetectionStrategy.OnPush,
-})
-export class WpTableExportModalComponent extends OpModalComponent implements OnInit {
- public $element:HTMLElement;
-
- public exportOptions:ExportOptions[];
-
- public text = {
- title: this.I18n.t('js.label_export'),
- closePopup: this.I18n.t('js.close_popup_title'),
- exportPreparing: this.I18n.t('js.label_export_preparing'),
- cancelButton: this.I18n.t('js.button_cancel'),
- backButton: this.I18n.t('js.button_back'),
- };
-
- constructor(
- @Inject(OpModalLocalsToken) public locals:OpModalLocalsMap,
- readonly I18n:I18nService,
- readonly elementRef:ElementRef,
- readonly querySpace:IsolatedQuerySpace,
- readonly cdRef:ChangeDetectorRef,
- readonly httpClient:HttpClient,
- readonly wpTableColumns:WorkPackageViewColumnsService,
- readonly opStaticQueries:StaticQueriesService,
- readonly loadingIndicator:LoadingIndicatorService,
- readonly toastService:ToastService,
- ) {
- super(locals, cdRef, elementRef);
- }
-
- ngOnInit():void {
- super.ngOnInit();
-
- if (this.locals.link) {
- this.requestExport(this.locals.link);
- } else {
- void this.querySpace.results
- .valuesPromise()
- .then((results:WorkPackageCollectionResource) => {
- this.exportOptions = this.buildExportOptions(results);
- this.cdRef.detectChanges();
- });
- }
- }
-
- private buildExportOptions(results:WorkPackageCollectionResource) {
- let options = results.representations.map((format) => {
- const link = format.$link as ExportLink;
-
- return {
- identifier: link.identifier,
- label: link.title,
- url: this.addColumnsAndTitleToHref(format.href as string),
- };
- });
- return options;
- }
-
- triggerByOption(option:ExportOptions, event:MouseEvent):void {
- event.preventDefault();
- this.requestExport(option.url);
- }
-
- /**
- * Request the export link and return the job ID to observe
- *
- * @param url
- */
- private requestExport(url:string):void {
- this
- .httpClient
- .get(url, { observe: 'body', responseType: 'json' })
- .subscribe(
- (json:{ job_id:string }) => this.replaceWithJobModal(json.job_id),
- (error) => this.handleError(error),
- );
- }
-
- private replaceWithJobModal(jobId:string) {
- this.service.show(JobStatusModalComponent, 'global', { jobId });
- }
-
- private handleError(error:HttpErrorResponse) {
- // There was an error but the status code is actually a 200.
- // If that is the case the response's content-type probably does not match
- // the expected type (json).
- // Currently this happens e.g. when exporting Atom which actually is not an export
- // but rather a feed to follow.
- if (error.status === 200 && error.url) {
- window.open(error.url);
- } else {
- this.showError(error);
- }
- }
-
- private showError(error:HttpErrorResponse) {
- this.toastService.addError(error.message || this.I18n.t('js.error.internal'));
- }
-
- private addColumnsAndTitleToHref(href:string) {
- const columns = this.wpTableColumns.getColumns();
-
- const columnIds = columns.map((column) => column.id);
-
- const url = URI(href);
- // Remove current columns
- url.removeSearch('columns[]');
- url.addSearch('columns[]', columnIds);
-
- // Add the query title for the export
- const query = this.querySpace.query.value;
- if (query) {
- url.removeSearch('title');
- url.addSearch('title', this.queryTitle(query));
- }
-
- return url.toString();
- }
-
- private queryTitle(query:QueryResource):string {
- return isPersistedResource(query) ? query.name : this.staticQueryName(query);
- }
-
- protected staticQueryName(query:QueryResource):string {
- return this.opStaticQueries.getStaticName(query);
- }
-
- protected get afterFocusOn():HTMLElement {
- return document.getElementById('work-packages-settings-button') as HTMLElement;
- }
-}