@messaia/cdk 22.0.0-rc.24 → 22.0.0-rc.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/fesm2022/messaia-cdk.mjs
CHANGED
|
@@ -15353,11 +15353,17 @@ class GenericService {
|
|
|
15353
15353
|
* Downloads a file from the server
|
|
15354
15354
|
* @param path Relative path to the download action
|
|
15355
15355
|
* @param params Optional query parameters
|
|
15356
|
+
* @param headers Optional HTTP headers
|
|
15356
15357
|
* @param handleError Whether to handle errors (default: true)
|
|
15357
15358
|
*/
|
|
15358
|
-
download(path, params, handleError = true) {
|
|
15359
|
+
download(path, params, headers, handleError = true) {
|
|
15359
15360
|
let request = this.http
|
|
15360
|
-
.get(`${this.endpoint}/${path ? path : 'download'}`, {
|
|
15361
|
+
.get(`${this.endpoint}/${path ? path : 'download'}`, {
|
|
15362
|
+
params: Utils.toHttpParams(params),
|
|
15363
|
+
responseType: 'arraybuffer',
|
|
15364
|
+
observe: 'response',
|
|
15365
|
+
headers: this.toHttpHeaders(headers)
|
|
15366
|
+
})
|
|
15361
15367
|
.pipe(map$1(x => { return { data: x.body, filename: this.getFileNameFromHeaders(x.headers) }; }));
|
|
15362
15368
|
/* Handle error */
|
|
15363
15369
|
if (handleError) {
|
|
@@ -15369,10 +15375,11 @@ class GenericService {
|
|
|
15369
15375
|
* Asynchronously downloads a file from the server
|
|
15370
15376
|
* @param path Relative path to the download action
|
|
15371
15377
|
* @param params Optional query parameters
|
|
15378
|
+
* @param headers Optional HTTP headers
|
|
15372
15379
|
* @returns Promise resolving to the download result
|
|
15373
15380
|
*/
|
|
15374
|
-
async downloadAsync(path, params) {
|
|
15375
|
-
return await firstValueFrom(this.download(path, params));
|
|
15381
|
+
async downloadAsync(path, params, headers) {
|
|
15382
|
+
return await firstValueFrom(this.download(path, params, headers));
|
|
15376
15383
|
}
|
|
15377
15384
|
/**
|
|
15378
15385
|
* Duplicates a record by ID
|
|
@@ -20074,17 +20081,18 @@ class GenericListComponent extends BaseComponent {
|
|
|
20074
20081
|
});
|
|
20075
20082
|
}
|
|
20076
20083
|
/**
|
|
20077
|
-
* Downloads a
|
|
20078
|
-
* @param entity
|
|
20084
|
+
* Downloads a file for the specified entity and path.
|
|
20085
|
+
* @param entity The entity to download
|
|
20086
|
+
* @param path The path to download
|
|
20079
20087
|
*/
|
|
20080
20088
|
download(entity, path = 'download') {
|
|
20081
|
-
this.service.download(`${path}/${entity.id}
|
|
20089
|
+
this.service.download(`${path}/${entity.id}`, {}, { 'Show-Message': 'Yes' }).subscribe(x => {
|
|
20082
20090
|
saveAs(new Blob([x.data], {}), x.filename);
|
|
20083
20091
|
});
|
|
20084
20092
|
}
|
|
20085
20093
|
/**
|
|
20086
|
-
* Duplicates
|
|
20087
|
-
* @param entity
|
|
20094
|
+
* Duplicates an entity by calling the duplicate method of the service and then reloads the list.
|
|
20095
|
+
* @param entity The entity to duplicate
|
|
20088
20096
|
*/
|
|
20089
20097
|
duplicate(entity) {
|
|
20090
20098
|
this.service.duplicate(entity.id).subscribe(_ => this.loadList());
|