RED-5213 rss xml and json export
This commit is contained in:
parent
270e73d2d2
commit
ec1f09855f
@ -12,8 +12,11 @@
|
||||
</div>
|
||||
|
||||
<div class="dialog-actions">
|
||||
<button color="primary" mat-flat-button type="submit" (click)="export()">
|
||||
{{ 'rss-dialog.actions.export' | translate }}
|
||||
<button color="primary" mat-flat-button type="submit" (click)="exportJSON()">
|
||||
{{ 'rss-dialog.actions.export-json' | translate }}
|
||||
</button>
|
||||
<button color="primary" mat-flat-button type="submit" (click)="exportXML()">
|
||||
{{ 'rss-dialog.actions.export-xml' | translate }}
|
||||
</button>
|
||||
<div class="all-caps-label cancel" mat-dialog-close translate="rss-dialog.actions.close"></div>
|
||||
</div>
|
||||
|
||||
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@ -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<void> {
|
||||
@ -19,4 +21,23 @@ export class RssService extends GenericService<void> {
|
||||
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',
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -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",
|
||||
|
||||
@ -1298,7 +1298,8 @@
|
||||
"rss-dialog": {
|
||||
"title": "Structured Component Management",
|
||||
"actions": {
|
||||
"export": "Export",
|
||||
"export-json": "Export JSON",
|
||||
"export-xml": "Export XML",
|
||||
"close": "Close"
|
||||
}
|
||||
},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user