diff --git a/apps/red-ui/src/app/modules/file-preview/dialogs/rss-dialog/rss-dialog.component.html b/apps/red-ui/src/app/modules/file-preview/dialogs/rss-dialog/rss-dialog.component.html index 7b6438719..b90e41afc 100644 --- a/apps/red-ui/src/app/modules/file-preview/dialogs/rss-dialog/rss-dialog.component.html +++ b/apps/red-ui/src/app/modules/file-preview/dialogs/rss-dialog/rss-dialog.component.html @@ -12,8 +12,11 @@
- +
diff --git a/apps/red-ui/src/app/modules/file-preview/dialogs/rss-dialog/rss-dialog.component.ts b/apps/red-ui/src/app/modules/file-preview/dialogs/rss-dialog/rss-dialog.component.ts index 79c839f1c..b574f660a 100644 --- a/apps/red-ui/src/app/modules/file-preview/dialogs/rss-dialog/rss-dialog.component.ts +++ b/apps/red-ui/src/app/modules/file-preview/dialogs/rss-dialog/rss-dialog.component.ts @@ -41,12 +41,19 @@ export class RssDialogComponent extends BaseDialogComponent { ); } - export() { + exportJSON() { const blob = new Blob([JSON.stringify(this.rssDataSubject$.value, null, 2)], { type: 'application/json' }); saveAs(blob, this.data.file.filename + '.rss.json'); } + exportXML() { + this._rssService.getRSSDataAsXML(this.data.file.dossierId, this.data.file.fileId).subscribe(data => { + const blob = new Blob([data], { type: 'application/xml' }); + saveAs(blob, this.data.file.filename + '.rss.xml'); + }); + } + save(options?: SaveOptions): void { - this.export(); + this.exportJSON(); } } diff --git a/apps/red-ui/src/app/services/files/rss.service.ts b/apps/red-ui/src/app/services/files/rss.service.ts index f8ba3030c..9a07798b7 100644 --- a/apps/red-ui/src/app/services/files/rss.service.ts +++ b/apps/red-ui/src/app/services/files/rss.service.ts @@ -1,8 +1,10 @@ import { Injectable } from '@angular/core'; -import { GenericService, HeadersConfiguration, QueryParam, RequiredParam, Validate } from '@iqser/common-ui'; -import { IRedactionLog, IRssData, IRssEntry } from '@red/domain'; -import { catchError, map, tap } from 'rxjs/operators'; +import { GenericService, QueryParam, RequiredParam, Validate } from '@iqser/common-ui'; +import { IRssData, IRssEntry } from '@red/domain'; +import { catchError, map } from 'rxjs/operators'; import { of } from 'rxjs'; +import { HttpHeaders } from '@angular/common/http'; +import { head } from 'lodash-es'; @Injectable({ providedIn: 'root' }) export class RssService extends GenericService { @@ -19,4 +21,23 @@ export class RssService extends GenericService { catchError(() => of({} as IRssEntry)), ); } + + @Validate() + getRSSDataAsXML(@RequiredParam() dossierId: string, @RequiredParam() fileId: string) { + const queryParams: QueryParam[] = []; + queryParams.push({ key: 'fileId', value: fileId }); + + const entityPath = [dossierId].map(item => encodeURIComponent(item)).join('/'); + + let headers = new HttpHeaders(); + headers = headers.set('accept', 'application/xml'); + + console.log('headers', headers); + return this._http.get(`/${encodeURI('rss')}/${entityPath}`, { + headers: headers, + params: this._queryParams(queryParams), + responseType: 'text', + observe: 'body', + }); + } } diff --git a/apps/red-ui/src/assets/config/config.json b/apps/red-ui/src/assets/config/config.json index 64bdac137..21d8480c2 100644 --- a/apps/red-ui/src/assets/config/config.json +++ b/apps/red-ui/src/assets/config/config.json @@ -1,7 +1,7 @@ { "ADMIN_CONTACT_NAME": null, "ADMIN_CONTACT_URL": null, - "API_URL": "https://dev-08.iqser.cloud/redaction-gateway-v1", + "API_URL": "https://scm.iqser.cloud/redaction-gateway-v1", "APP_NAME": "RedactManager", "AUTO_READ_TIME": 3, "BACKEND_APP_VERSION": "4.4.40", @@ -11,7 +11,7 @@ "MAX_RETRIES_ON_SERVER_ERROR": 3, "OAUTH_CLIENT_ID": "redaction", "OAUTH_IDP_HINT": null, - "OAUTH_URL": "https://dev-08.iqser.cloud/auth/realms/redaction", + "OAUTH_URL": "https://scm.iqser.cloud/auth/realms/redaction", "RECENT_PERIOD_IN_HOURS": 24, "SELECTION_MODE": "structural", "MANUAL_BASE_URL": "https://docs.redactmanager.com/preview", diff --git a/apps/red-ui/src/assets/i18n/en.json b/apps/red-ui/src/assets/i18n/en.json index 5fd3bf9a6..44c934957 100644 --- a/apps/red-ui/src/assets/i18n/en.json +++ b/apps/red-ui/src/assets/i18n/en.json @@ -1298,7 +1298,8 @@ "rss-dialog": { "title": "Structured Component Management", "actions": { - "export": "Export", + "export-json": "Export JSON", + "export-xml": "Export XML", "close": "Close" } },