From 0aee63109f9b1f190b9df45c862930b8aee8de9c Mon Sep 17 00:00:00 2001 From: Teale Fristoe Date: Tue, 24 Sep 2024 15:22:02 -0700 Subject: [PATCH] Fix name of imported dataset and title of get dataContextList requests. (#1511) --- .../data-interactive/handlers/data-context-list-handler.ts | 2 +- v3/src/utilities/csv-import.ts | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/v3/src/data-interactive/handlers/data-context-list-handler.ts b/v3/src/data-interactive/handlers/data-context-list-handler.ts index 7ac19a706d..4f45059679 100644 --- a/v3/src/data-interactive/handlers/data-context-list-handler.ts +++ b/v3/src/data-interactive/handlers/data-context-list-handler.ts @@ -16,7 +16,7 @@ export const diDataContextListHandler: DIHandler = { return { name: dataSet.name, guid: id, - title: dataSet._title, + title: dataSet.title, id } }) diff --git a/v3/src/utilities/csv-import.ts b/v3/src/utilities/csv-import.ts index 5701261611..6fe0450eb8 100644 --- a/v3/src/utilities/csv-import.ts +++ b/v3/src/utilities/csv-import.ts @@ -13,7 +13,10 @@ export function downloadCsvFile(dataUrl: string, onComplete: (results: CsvParseR } export function convertParsedCsvToDataSet(results: CsvParseResult, filename: string) { - const ds = DataSet.create({ name: filename }) + // Remove extension + // From https://stackoverflow.com/questions/4250364/how-to-trim-a-file-extension-from-a-string-in-javascript + const name = filename.replace(/\.[^/.]+$/, "") + const ds = DataSet.create({ name }) // add attributes (extracted from first case) for (const pName in results.data[0]) { ds.addAttribute({name: pName})