[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 49 commits intomainfrom
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #2083 +/- ##
==========================================
+ Coverage 45.50% 45.75% +0.24%
==========================================
Files 1044 1042 -2
Lines 17353 17213 -140
Branches 3149 3119 -30
==========================================
- Hits 7897 7875 -22
+ Misses 9456 9338 -118 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
07567e2 to
114285d
Compare
a936a03 to
5500b3e
Compare
…FilteringModel-pattern
…FilteringModel-pattern
…FilteringModel-pattern
…FilteringModel-pattern
| * | ||
| * @param {LogModel} logModel the log model object | ||
| * @returns {Component} the author filter component | ||
| * @param {LogsOverviewModel} logsOverviewModel the log overview model |
There was a problem hiding this comment.
The overviewModel param doesn't exist in the func.
There was a problem hiding this comment.
Taken care of
| authorFilterTextInput(authorFilter), | ||
| resetAuthorFilterButton(authorFilter), | ||
| excludeAnonymousLogAuthorToggle(authorFilter), | ||
| export const authorFilter = ({ filteringModel }) => h('.flex-row.items-center.g3', [ |
There was a problem hiding this comment.
It would be more consistent with other ActiveColumns Filter setups to get the matching filter's model in ActiveColumns and pass only that to the Filter. And we sent the function only the specific data it needs.
There was a problem hiding this comment.
Taken care of
| const resetAuthorFilterButton = (authorFilterModel) => h( | ||
| '.btn.btn-pill.f7', | ||
| { disabled: authorFilterModel.isEmpty, onclick: () => authorFilterModel.clear() }, | ||
| { disabled: authorFilterModel.isEmpty, onclick: () => authorFilterModel.reset() }, |
There was a problem hiding this comment.
.clear() reloaded the table's items because it notified. This is not the case currently with .reset() of RawTextFilterModel thus, when you click the cross button, the author text is emptied, but the table remains the same, it is not refreshed as it should be.
There was a problem hiding this comment.
Taken care off
…nes if the reset function also notifies the observers
| * @inheritDoc | ||
| */ | ||
| reset() { | ||
| reset(notify = false) { |
There was a problem hiding this comment.
TBD offline with result commented here.
…and call notify there
| iconX(), | ||
| ); | ||
| const resetAuthorFilterButton = (authorFilterModel) => | ||
| h('.btn.btn-pill.f7', { disabled: authorFilterModel.isEmpty, onclick: () => authorFilterModel.reset(true) }, iconX()); |
There was a problem hiding this comment.
True is still being sent to the function here, we are now overwriting it so don't need the param.
There was a problem hiding this comment.
Thanks for the catch
| return; | ||
| } | ||
|
|
||
| reset() { |
There was a problem hiding this comment.
I think the clear method just needs reinstating because it handled the if empty and the notify. This will create a duplicate fetch because filteringModel will call reset on the model and it'll notify.
There was a problem hiding this comment.
Taken care of
| ), | ||
|
|
||
| /** | ||
| * Title filter component |
There was a problem hiding this comment.
Title, contend and author do not have placeholder text and I think it would be good and consistent for them to have.
There was a problem hiding this comment.
Taken care of
3cd62d0 to
370c475
Compare
| } | ||
|
|
||
| if (filter.run?.values?.length > 0) { | ||
| if (runNumbers?.length > 0) { |
There was a problem hiding this comment.
Can this just be if runNumbers? Check the other filter ifs.
There was a problem hiding this comment.
I suppose you are right, I just didn't question the original logic
test/public/logs/overview.test.js
Outdated
|
|
||
| await pressElement(page, '#reset-filters'); | ||
| await waitForTableLength(page, 1); | ||
| await openFilteringPanel(page); |
There was a problem hiding this comment.
Yes, but the line shouldn't be there, the next text needs the filteringpanel to be open
test/public/logs/overview.test.js
Outdated
| await pressElement(page, '#reset-filters'); | ||
| await waitForTableLength(page, 1); | ||
| await openFilteringPanel(page); | ||
| await resetFilters(page); |
There was a problem hiding this comment.
Could we make use of before/after each functions to handle resetting filters etc?
There was a problem hiding this comment.
Taken care of
test/public/logs/overview.test.js
Outdated
| await pressElement(page, '#openFilterToggle'); | ||
| await waitForTableTotalRowsCountToEqual(page, 119); | ||
|
|
||
| // await new Promise((res, _rej) => setTimeout(() => res(), 2000)) |
There was a problem hiding this comment.
I'm assuming leftover things here.
test/public/logs/overview.test.js
Outdated
| await waitForNavigation(page, () => pressElement(page, `${popoverSelector} a`)) | ||
| expectUrlParams(page, { page: 'run-detail', runNumber: 2 }) | ||
| }); | ||
| // it('can filter by creation date', async () => { |
There was a problem hiding this comment.
An accidental commit of commented out tests.
I have a JIRA ticket
Notable changes for users:
Notable changes for developers:
filteringModelinlogsOverviewModelChanges made to the database: