You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dlab.apache.org by an...@apache.org on 2019/02/15 15:27:11 UTC
[incubator-dlab] branch bugfix-DLAB-311 updated: [DLAB-373]: fixed
issue with dowmloading csv report and pem key
This is an automated email from the ASF dual-hosted git repository.
ankovalyshyn pushed a commit to branch bugfix-DLAB-311
in repository https://gitbox.apache.org/repos/asf/incubator-dlab.git
The following commit(s) were added to refs/heads/bugfix-DLAB-311 by this push:
new 6ae0a25 [DLAB-373]: fixed issue with dowmloading csv report and pem key
6ae0a25 is described below
commit 6ae0a25d196aef7e4e2223e7b93d5dd516bbd773
Author: Andriana Kovalyshyn <An...@epam.com>
AuthorDate: Fri Feb 15 17:26:53 2019 +0200
[DLAB-373]: fixed issue with dowmloading csv report and pem key
---
.../src/app/core/services/applicationServiceFacade.service.ts | 9 +++++----
.../src/main/resources/webapp/src/app/core/util/fileUtils.ts | 11 ++++-------
2 files changed, 9 insertions(+), 11 deletions(-)
diff --git a/services/self-service/src/main/resources/webapp/src/app/core/services/applicationServiceFacade.service.ts b/services/self-service/src/main/resources/webapp/src/app/core/services/applicationServiceFacade.service.ts
index 6aada7b..b2c7aec 100644
--- a/services/self-service/src/main/resources/webapp/src/app/core/services/applicationServiceFacade.service.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/core/services/applicationServiceFacade.service.ts
@@ -116,14 +116,14 @@ export class ApplicationServiceFacade {
return this.buildRequest(RequestMethod.Post,
this.requestRegistry.Item(ApplicationServiceFacade.ACCESS_KEY_GENERATE),
null,
- { observe: 'response'});
+ { observe: 'response', responseType: 'text' });
}
public buildRegenerateAccessKey(option): Observable<any> {
return this.buildRequest(RequestMethod.Post,
this.requestRegistry.Item(ApplicationServiceFacade.ACCESS_KEY_GENERATE) + option,
null,
- { observe: 'response'});
+ { observe: 'response', responseType: 'text' });
}
public buildUploadUserAccessKeyRequest(body: any): Observable<any> {
@@ -318,14 +318,15 @@ export class ApplicationServiceFacade {
public buildDownloadReportData(data): Observable<any> {
return this.buildRequest(RequestMethod.Post,
this.requestRegistry.Item(ApplicationServiceFacade.DOWNLOAD_REPORT),
- data);
+ data,
+ { observe: 'response', responseType: 'text' });
}
public buildCreateBackupRequest(data): Observable<any> {
return this.buildRequest(RequestMethod.Post,
this.requestRegistry.Item(ApplicationServiceFacade.BACKUP),
data,
- { observe: 'response' });
+ { observe: 'response' });
}
public buildGetBackupStatusRequest(uuid): Observable<any> {
return this.buildRequest(RequestMethod.Get,
diff --git a/services/self-service/src/main/resources/webapp/src/app/core/util/fileUtils.ts b/services/self-service/src/main/resources/webapp/src/app/core/util/fileUtils.ts
index fa6cdad..8e07b50 100644
--- a/services/self-service/src/main/resources/webapp/src/app/core/util/fileUtils.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/core/util/fileUtils.ts
@@ -17,18 +17,15 @@ limitations under the License.
****************************************************************************/
export class FileUtils {
-
public static downloadFile(data: any) {
const fileName = data.headers.get('content-disposition').match(/filename="(.+)"/)[1];
-
- let parsedResponse = data.text();
- let blob = new Blob([parsedResponse]);
- let url = window.URL.createObjectURL(blob);
+ const blob = new Blob([ data.body]);
+ const url = window.URL.createObjectURL(blob);
if (navigator.msSaveOrOpenBlob) {
navigator.msSaveBlob(blob, fileName);
} else {
- let a = document.createElement('a');
+ const a = document.createElement('a');
a.href = url;
a.download = fileName;
document.body.appendChild(a);
@@ -37,4 +34,4 @@ export class FileUtils {
}
window.URL.revokeObjectURL(url);
}
-}
\ No newline at end of file
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@dlab.apache.org
For additional commands, e-mail: commits-help@dlab.apache.org