[O2B-1534] Migrate log overview to use filtering model pattern#2083
[O2B-1534] Migrate log overview to use filtering model pattern#2083NarrowsProjects wants to merge 58 commits intomainfrom
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #2083 +/- ##
==========================================
+ Coverage 43.78% 45.76% +1.97%
==========================================
Files 1044 1042 -2
Lines 17353 17213 -140
Branches 3149 3119 -30
==========================================
+ Hits 7598 7877 +279
+ Misses 9755 9336 -419 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
07567e2 to
114285d
Compare
a936a03 to
5500b3e
Compare
3cd62d0 to
370c475
Compare
…FilteringModel-pattern
| * @param {FilteringModel} logOverviewModel.filteringModel filtering model | ||
| * @return {Component} the filter component | ||
| */ | ||
| filter: ({ filteringModel }) => rawTextFilter( |
There was a problem hiding this comment.
What about re-using the runNumbersFilter in this case?
There was a problem hiding this comment.
I don't see much use in making or using individual components for each filter that uses rawTextFilter that are virtually Identical.
What I do think is a good idea now that you mention it is to make a new component that would cover most of these usecases and change it for special cases such as authorFilter. Something like
export const textInputFilter =
(filteringModel, identifier, placeholder) => rawTextFilter(filteringModel.get(identifier), { classes: ['w-100', identifier], placeholder });Which would then shorten these filter creations to:
filter: ({ filteringModel }) => textInputFilter(filteringModel, 'runNumbers', 'e.g. 553203, 553221, ...'),| * @return {Component} the filter component | ||
| */ | ||
| filter: ({ filteringModel }) => rawTextFilter( | ||
| filteringModel.get('environmentIds'), |
There was a problem hiding this comment.
Similar question, I see that runsActiveColumns also has the environmentIds as rawtextFilter
Could we perhaps extract as a reusable component similar to runNumbersFilter?
There was a problem hiding this comment.
As above
| * @param {FilteringModel} logOverviewModel.filteringModel filtering model | ||
| * @return {Component} the filter component | ||
| */ | ||
| filter: ({ filteringModel }) => rawTextFilter( |
There was a problem hiding this comment.
As above
| } | ||
|
|
||
| if (filter.run?.values?.length > 0) { | ||
| if (runNumbers) { |
There was a problem hiding this comment.
Should we not still check if array is not empty?
There was a problem hiding this comment.
From what I can remember, there is no way for runNumber to arrive here as an empty array.
The joy DTO requires it to be a string of numbers, and an empty string will be rejected
There was a problem hiding this comment.
I've done some manual tests, and I can't find a way to reach that line as an empty array
| } | ||
|
|
||
| if (filter.lhcFills?.values?.length > 0) { | ||
| if (fillNumbers) { |
There was a problem hiding this comment.
Should we not still check if array is not empty?
We could define on L54 as fillNumbers = [] and straight away check length perhaps?
There was a problem hiding this comment.
As above
|
|
||
| if (filter.environments?.values?.length > 0) { | ||
| const validEnvironments = await EnvironmentRepository.findAll({ where: { id: { [Op.in]: filter.environments.values } } }); | ||
| if (environmentIds) { |
There was a problem hiding this comment.
As above
| values: CustomJoi.stringArray().items(EntityIdDto).single().required(), | ||
| operation: Joi.string().valid('and', 'or').required(), | ||
| }); | ||
| const RunFilterDto = CustomJoi.stringArray().items(EntityIdDto).single(); |
There was a problem hiding this comment.
I see these RunFilter, Environment, LHC being used across DTOs with different matching criterias.
What about extracting this in its own DTO and reuse across DTOs?
There was a problem hiding this comment.
I will have a look to see if they can be standardised
I have a JIRA ticket
Notable changes for users:
Notable changes for developers:
filteringModelinlogsOverviewModelChanges made to the database: