From 171e18c8a984f1302703cf0241c6bf9ad4d223f6 Mon Sep 17 00:00:00 2001 From: Valentin Mihai Date: Mon, 29 Jul 2024 15:51:05 +0300 Subject: [PATCH] RED-8748 - update export button --- .../documine-export.component.html | 1 + .../file-actions/file-actions.component.html | 1 + .../expandable-file-actions.component.html | 16 ++++++++++++++++ .../expandable-file-actions.component.ts | 15 ++++++++++++++- 4 files changed, 32 insertions(+), 1 deletion(-) diff --git a/apps/red-ui/src/app/modules/file-preview/components/documine-export/documine-export.component.html b/apps/red-ui/src/app/modules/file-preview/components/documine-export/documine-export.component.html index 7dc0226f5..c54c1298b 100644 --- a/apps/red-ui/src/app/modules/file-preview/components/documine-export/documine-export.component.html +++ b/apps/red-ui/src/app/modules/file-preview/components/documine-export/documine-export.component.html @@ -6,6 +6,7 @@ [matMenuTriggerFor]="bulkComponentDownloadMenu" [matTooltipPosition]="'above'" [matTooltip]="'documine-export.export-tooltip' | translate" + [hidden]="true" class="red-tab" > {{ 'documine-export.export' | translate }} diff --git a/apps/red-ui/src/app/modules/shared-dossiers/components/file-actions/file-actions.component.html b/apps/red-ui/src/app/modules/shared-dossiers/components/file-actions/file-actions.component.html index 1f9e0bfc3..836273140 100644 --- a/apps/red-ui/src/app/modules/shared-dossiers/components/file-actions/file-actions.component.html +++ b/apps/red-ui/src/app/modules/shared-dossiers/components/file-actions/file-actions.component.html @@ -20,6 +20,7 @@ [tooltipPosition]="tooltipPosition" [helpModeKeyPrefix]="helpModeKeyPrefix" [isDossierOverviewWorkflow]="isDossierOverviewWorkflow" + [file]="file" > diff --git a/apps/red-ui/src/app/modules/shared/components/expandable-file-actions/expandable-file-actions.component.html b/apps/red-ui/src/app/modules/shared/components/expandable-file-actions/expandable-file-actions.component.html index 26cf74e17..b7e7f9e05 100644 --- a/apps/red-ui/src/app/modules/shared/components/expandable-file-actions/expandable-file-actions.component.html +++ b/apps/red-ui/src/app/modules/shared/components/expandable-file-actions/expandable-file-actions.component.html @@ -1,3 +1,14 @@ +@if (isDocumine) { + +} + + + + + + diff --git a/apps/red-ui/src/app/modules/shared/components/expandable-file-actions/expandable-file-actions.component.ts b/apps/red-ui/src/app/modules/shared/components/expandable-file-actions/expandable-file-actions.component.ts index 8f310dc0d..dc211ba1d 100644 --- a/apps/red-ui/src/app/modules/shared/components/expandable-file-actions/expandable-file-actions.component.ts +++ b/apps/red-ui/src/app/modules/shared/components/expandable-file-actions/expandable-file-actions.component.ts @@ -1,6 +1,6 @@ import { Component, inject, Input, OnChanges, SimpleChanges, ViewChild } from '@angular/core'; import { Action, ActionTypes, Dossier, File } from '@red/domain'; -import { CircleButtonComponent, CircleButtonType, IqserDialog, StopPropagationDirective, Toaster } from '@iqser/common-ui'; +import { CircleButtonComponent, CircleButtonType, getConfig, IqserDialog, StopPropagationDirective, Toaster } from '@iqser/common-ui'; import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker'; import { FileDownloadService } from '@upload-download/services/file-download.service'; import { PermissionsService } from '@services/permissions.service'; @@ -13,6 +13,8 @@ import { FileDownloadBtnComponent } from '@shared/components/buttons/file-downlo import { MatSlideToggle } from '@angular/material/slide-toggle'; import { MatTooltip } from '@angular/material/tooltip'; import { MatIcon } from '@angular/material/icon'; +import { firstValueFrom } from 'rxjs'; +import { ComponentLogService } from '@services/files/component-log.service'; @Component({ selector: 'redaction-expandable-file-actions', @@ -44,11 +46,13 @@ export class ExpandableFileActionsComponent implements OnChanges { @Input() tooltipPosition: IqserTooltipPosition; @Input() helpModeKeyPrefix: 'dossier' | 'editor'; @Input() isDossierOverviewWorkflow = false; + @Input() file: File; displayedButtons: Action[]; hiddenButtons: Action[]; expanded = false; @ViewChild(MatMenuTrigger) readonly matMenu: MatMenuTrigger; readonly trackBy = trackByFactory(); + readonly isDocumine = getConfig().IS_DOCUMINE; readonly #appBaseHref = inject(APP_BASE_HREF); constructor( @@ -56,6 +60,7 @@ export class ExpandableFileActionsComponent implements OnChanges { private readonly _toaster: Toaster, private readonly _permissionsService: PermissionsService, private readonly _dialog: IqserDialog, + private readonly _componentLogService: ComponentLogService, ) {} ngOnChanges(changes: SimpleChanges) { @@ -124,4 +129,12 @@ export class ExpandableFileActionsComponent implements OnChanges { params: { downloadHref: `${this.#appBaseHref}/main/downloads` }, }); } + + downloadComponentAsJSON() { + return firstValueFrom(this._componentLogService.exportJSON(this.file.dossierTemplateId, this.file.dossierId, this.file)); + } + + async downloadComponentAsXML() { + return firstValueFrom(this._componentLogService.exportXML(this.file.dossierTemplateId, this.file.dossierId, this.file)); + } }