From aa89448385adc8e200b5b5c5325e4e43330946ed Mon Sep 17 00:00:00 2001 From: elmiomar Date: Thu, 21 Nov 2024 19:43:44 -0500 Subject: [PATCH 1/2] Update zipfile naming logic --- .../app/datacart/bundleplan/bundleplan.component.ts | 13 +++++++------ .../download-service/download-service.service.ts | 4 ++++ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/angular/src/app/datacart/bundleplan/bundleplan.component.ts b/angular/src/app/datacart/bundleplan/bundleplan.component.ts index 6dfabb7bb..1cfa3ac7f 100644 --- a/angular/src/app/datacart/bundleplan/bundleplan.component.ts +++ b/angular/src/app/datacart/bundleplan/bundleplan.component.ts @@ -285,12 +285,13 @@ export class BundleplanComponent implements OnInit { this.downloadService.download(zip, this.zipData, this.dataCart); } - private generateZipFileName(base : string = null) : string { - const MIN : number = 0; - const MAX : number = 100000; - let suffix = Math.floor(Math.random() * (MAX - MIN + 1)) + MIN; - return base + suffix; - } + private generateZipFileName(base: string = "NIST-Data"): string { + // current timestamp + const now = new Date(); + const timestamp = now.toISOString().slice(0, 16).replace(":", "-"); + + return `${base}-${timestamp}`; + } /** * download the selected files from this cart. diff --git a/angular/src/app/shared/download-service/download-service.service.ts b/angular/src/app/shared/download-service/download-service.service.ts index 6b257a860..1f22956a5 100644 --- a/angular/src/app/shared/download-service/download-service.service.ts +++ b/angular/src/app/shared/download-service/download-service.service.ts @@ -159,6 +159,10 @@ export class DownloadService { // create the request body let reqfiles = []; for (let item of files) { + let resId = item.resId; + let filePath = item.filePath; + console.log(`resId: ${resId}, filePath: ${filePath}`); + reqfiles.push({ "filePath": item.resId + '/' + item.filePath, "downloadUrl": item.downloadURL From 1fb30d44b1bb5a90b4ad4f0496529fdcfd71fb5d Mon Sep 17 00:00:00 2001 From: elmiomar Date: Fri, 22 Nov 2024 10:06:28 -0500 Subject: [PATCH 2/2] Update zipfile naming logic --- angular/src/app/datacart/bundleplan/bundleplan.component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/angular/src/app/datacart/bundleplan/bundleplan.component.ts b/angular/src/app/datacart/bundleplan/bundleplan.component.ts index 1cfa3ac7f..96bd45352 100644 --- a/angular/src/app/datacart/bundleplan/bundleplan.component.ts +++ b/angular/src/app/datacart/bundleplan/bundleplan.component.ts @@ -307,7 +307,7 @@ export class BundleplanComponent implements OnInit { // Sending data to _bundle_plan and get back the plan this.downloadFiles = this.dataCart.getSelectedFiles(); - let bundleBaseName = this.generateZipFileName(this.dataCart.getName()); + let bundleBaseName = this.generateZipFileName("NIST-Data"); this.bundlePlanRef = this.downloadService.getBundlePlan(bundleBaseName, this.downloadFiles).subscribe( blob => {