New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Frontend/Backend] Skip line when the config give a specific char (#4505) #4815
Conversation
e36764e
to
5423948
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #4815 +/- ##
==============================
==============================
☔ View full report in Codecov by Sentry. |
9629bcf
to
ab08c3c
Compare
opencti-platform/opencti-front/src/private/components/data/csvMapper/CsvMapperForm.tsx
Outdated
Show resolved
Hide resolved
opencti-platform/opencti-front/src/private/components/data/csvMapper/CsvMapperForm.tsx
Outdated
Show resolved
Hide resolved
opencti-platform/opencti-graphql/src/modules/internal/csvMapper/csvMapper.graphql
Outdated
Show resolved
Hide resolved
ab08c3c
to
c498156
Compare
opencti-platform/opencti-graphql/src/modules/internal/csvMapper/csvMapper.graphql
Outdated
Show resolved
Hide resolved
opencti-platform/opencti-graphql/src/modules/internal/csvMapper/csvMapper.ts
Outdated
Show resolved
Hide resolved
ec0397e
to
8229dff
Compare
I reviewed the code and it's good for me. I let other developers do the testing |
8229dff
to
fc148f5
Compare
opencti-platform/opencti-front/src/private/components/data/csvMapper/CsvMapperForm.tsx
Outdated
Show resolved
Hide resolved
opencti-platform/opencti-front/src/private/components/data/csvMapper/CsvMapperForm.tsx
Outdated
Show resolved
Hide resolved
opencti-platform/opencti-front/src/private/components/data/csvMapper/CsvMapperCreation.tsx
Outdated
Show resolved
Hide resolved
082b611
to
7519bdc
Compare
})); | ||
|
||
const csvMapperValidation = (t: (s: string) => string) => Yup.object().shape({ | ||
name: Yup.string().required(t('This field is required')), | ||
has_header: Yup.boolean().required(t('This field is required')), | ||
separator: Yup.string().required(t('This field is required')), | ||
skipLineChar: Yup.string(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we validate the char ? I guess it should be only one character or can it be more ? like this maybe :
Yup.string().max(1)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nino-filigran @Jipegien, what do you think ? should we restrict to one character ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok I saw with @Jipegien we will restrict to one character. Thanks @SouadHadjiat.
let records = await parsingProcess(content, mapper.separator); | ||
if (mapper.skipLineChar) { | ||
records = records.filter((record) => !record[0].startsWith(mapper.skipLineChar)); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what if records is not defined ? or record is empty ?
Maybe it could be done when we loop on records below ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did not try to send an empty CSV files. It worth to try the case.
In my opinion, I prefer to do it before the record because inside the records, we have an option to skip the line for the header. This will help separate the different use cases and improve readability. If we put it inside, we would need to check and manage if we are on the first line of the files or in a comment line, which would bring more complexity. What do you think?
opencti-platform/opencti-front/src/private/components/data/csvMapper/CsvMapperForm.tsx
Outdated
Show resolved
Hide resolved
7519bdc
to
9702d48
Compare
9702d48
to
f134256
Compare
csvMapper, | ||
onSubmit, | ||
}) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wow what happened here ? 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
66:1 error Expected indentation of 2 spaces but found 64 @typescript-eslint/indent
you have some lint errors in drone.
Beside that this PR seems good to me 🙌
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The format code align with the function argument position. Need to change some rules in the IDE I think.
f134256
to
d2f7fee
Compare
Proposed changes
Related issues
Checklist