From 4faeee90e82f68b84a9e6f94717e90e924c5d4f5 Mon Sep 17 00:00:00 2001 From: Guillaume Heurtier <guillaume.heurtier@maarch.org> Date: Fri, 15 Nov 2019 17:55:52 +0100 Subject: [PATCH] FEAT #11282 TIME 2:00 show custom fields in exports values list --- .../app/list/export/export.component.ts | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/frontend/app/list/export/export.component.ts b/src/frontend/app/list/export/export.component.ts index c3e7ccf5de9..f26c4047f64 100644 --- a/src/frontend/app/list/export/export.component.ts +++ b/src/frontend/app/list/export/export.component.ts @@ -5,6 +5,8 @@ import { NotificationService } from '../../notification.service'; import { CdkDragDrop, moveItemInArray, transferArrayItem } from '@angular/cdk/drag-drop'; import { MAT_DIALOG_DATA } from '@angular/material/dialog'; import { SortPipe } from '../../../plugins/sorting.pipe'; +import {catchError, map, tap} from "rxjs/operators"; +import {of} from "rxjs"; declare function $j(selector: any): any; @@ -231,6 +233,26 @@ export class ExportComponent implements OnInit { }, (err: any) => { this.notify.handleErrors(err); }); + + this.http.get("../../rest/customFields").pipe( + map((data: any) => { + data.customFields = data.customFields.map((custom: any) => { + return { + value: 'custom_' + custom.id, + label: custom.label, + isFunction: true + } + }); + return data; + }), + tap((data: any) => { + this.dataAvailable = this.dataAvailable.concat(data.customFields); + }), + catchError((err: any) => { + this.notify.handleErrors(err); + return of(false); + }) + ).subscribe(); } drop(event: CdkDragDrop<string[]>) { -- GitLab