From b64b811b72c8d04d0bcdcbf986791369416c1c8c Mon Sep 17 00:00:00 2001 From: Chen Wang Date: Thu, 29 Aug 2024 12:31:59 -0500 Subject: [PATCH] further fix bugs and recommend correct category --- .../bootstrap/js/customized/analyses/view.js | 2 +- .../js/customized/view_helperFunc.js | 43 ++++++++++++++----- 2 files changed, 34 insertions(+), 11 deletions(-) diff --git a/www/public/bootstrap/js/customized/analyses/view.js b/www/public/bootstrap/js/customized/analyses/view.js index c0b5a14..db8346d 100644 --- a/www/public/bootstrap/js/customized/analyses/view.js +++ b/www/public/bootstrap/js/customized/analyses/view.js @@ -110,7 +110,7 @@ $.getScript("bootstrap/js/customized/view_helperFunc.js", function(){ // add preview and column $previewContent.append(arrayToTable(text_data.slice(0, 11), '#selectFileTable')); - $columnContent.append(extractHeader(text_data)); + $columnContent.append(extractHeaderRadio(text_data)); $preview.show(); $column.show(); diff --git a/www/public/bootstrap/js/customized/view_helperFunc.js b/www/public/bootstrap/js/customized/view_helperFunc.js index 647e0be..6a82ebe 100644 --- a/www/public/bootstrap/js/customized/view_helperFunc.js +++ b/www/public/bootstrap/js/customized/view_helperFunc.js @@ -102,19 +102,38 @@ function escapeHtml(str) { .replace(/'/g, '''); } -function extractHeader(array) { + +function extractHeaderRadio(array) { + var headerContent = ''; + var column_header = array[0]; + $.each(column_header, function (i, val) { + // Check the first item + if (i === 0) { + headerContent += ``; + } else { + headerContent += ``; + } + }); + return headerContent; +} + +function extractHeaderCheckBox(array) { var headerContent = ''; - column_header = array[0]; + var column_header = array[0]; $.each(column_header, function (i, val) { - //check the first item + // Check the first item if (i === 0) { - headerContent += ``; + headerContent += ``; } else { - headerContent += ``; + headerContent += ``; } }); return headerContent; @@ -174,6 +193,10 @@ function processData(csv) { $("#datasrc-criteria-hint").html("

Based on the column of your imported file, it is likely that you uploaded a " + "Reddit Comment dataset.

") } + else if (previewLinesWords[0].indexOf('snippet.title') > 0 || previewLinesWords[0].indexOf('snippet.description') > 0){ + $("#datasrc-criteria-hint").html("

Based on the column of your imported file, it is likely that you uploaded a " + + "YouTube video/channel/playlist search collection dataset.

") + } else{ $("#datasrc-criteria-hint").html("

We cannot detect the file category, make sure you choose Others in the category.

") } @@ -183,7 +206,7 @@ function processData(csv) { // set column headers for userspec-Others-metadata $("#column-header-selection").empty(); - $("#column-header-selection").append(extractHeader(previewLinesWords)); + $("#column-header-selection").append(extractHeaderCheckBox(previewLinesWords)); }