elasticio / csv-component

CSV Reading and Writing component for elastic.io platform
Apache License 2.0
3 stars 7 forks source link

CSV component when displaying the header which contains number in the text. *(add _ between the text and number) #83

Closed shadyhsoliman closed 3 years ago

shadyhsoliman commented 3 years ago

The client is having trouble when configuring the Headers as a string the component automatically creates (_) space between the text and the number as an example

The CSV contains sch_h2 which in the sample data the header turns to "sch_h_2". When the user saves the sample with "sch_h_2". This confuses the user and also causes difficulty to map the correct header at any following steps.

here's a step for replication.

image image

shadyhsoliman commented 3 years ago

A sample data

Sample header:

sch_name,area_of_study,country,offered_int_dom,crs_title,crs_code,crs_level,domestic_type,sch_h2,sch_summary,sch_detailed,sch_about,sch_duration,sch_duration_detailed,award_value,award_benefit,criteria_eligibility,criteria_long,criteria_list,how_to_apply,how_to_apply_list,video_url,apply_url,date_application_close,date_result_release
denyshld commented 3 years ago

Looks like platform issue. Existing CSV view uses _.snakeCase(...) to generate header name:

Code:

const _ = require('lodash');
const property = _.snakeCase('sch_h2 ');
console.log(property);

Output: sch_h_2

Code line: https://github.com/elasticio/elasticio/blob/5d6117b21bb8e7443c0e7c75d96d4dd1a1ff30d1/src/frontend/src/modules/react/components/fields/csv-view.jsx#L61

jhorbulyk commented 3 years ago

Closing in favor of #96 & #97