-
Notifications
You must be signed in to change notification settings - Fork 1
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
UI-8056 - Introduce getMigrateFilters function #60
Conversation
This reverts commit ff031ad.
…unters and errorReport
…r-error-reports
Co-authored-by: Antoine Tissier <ati@activeviam.com>
Co-authored-by: Antoine Tissier <ati@activeviam.com>
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.
More arguments need to be passed to the callback (and therefore to the getMigrateXyz
function in the first place): dataModels
for all content types, and keysOfWidgetPluginsToRemove
for widgets.
Let's add dataModels
to getMigrateFilters
already.
src/getMigrateDashboards.ts
Outdated
@@ -56,6 +54,7 @@ export const getMigrateDashboards = | |||
// The dashboard could not be migrated at all. | |||
counters.dashboards.failed++; | |||
|
|||
const filesAncestry = _getFilesAncestry(dashboardsStructure); |
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.
Why this change ? It's more efficient to do the work only once outside the loop, and I don't see the potential mutations being a problem, since we're only mutating the content and the structure (and so not the files ancestry).
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.
Yeah, good point, it's more efficient outside the loop, my bad!
Okay, I'll add them. Can you explain why we need them? |
We need the You can see example in the migration from |
src/getMigrateFilters.ts
Outdated
// `dataModels` is not used yet, but needs to be in the function's signature. | ||
// eslint-disable-next-line |
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 point is to pass it to the callback: it wouldn't be useful if we just put it in the signature.
But if you want let's just merge without the dataModels
for now.
I have it ready on a subsequent branch, so we can add it from there.
I pushed a commit to leave adding the |
Description
Introduce a
getMigrateFilters
function, supposed to be generic, that:callback
argument. This callback function handles the actual migration of the filters, the logic in it depending on which migration is donecontentServer
andcounters
.errorReport
In
bin.ts
, a curriedmigrateFilters
function will be created thanks togetMigrateFilters
and passed tomigrate_fromVersion_to_toVersion
. The global variables meant to be mutated are also defined at the level ofbin.ts
and are passed tomigrate_fromVersion_to_toVersion
.In
migrate_fromVersion_to_toVersion
, the filters migration is handled in the callback passed tomigrateFilters
, passed in the arguments.migrate_fromVersion_to_toVersion
returns avoid
.