Skip to content
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-9526 - Ensures that the behaviorOnError flag is respected #128

Merged
merged 9 commits into from
Aug 1, 2024

Conversation

NZepeda
Copy link
Contributor

@NZepeda NZepeda commented Jul 29, 2024

Summary

This PR ensures that when a 4.3 widget is being migrated, if it throws an error, it is kept as is and that the remaining widgets are still migrated as expected.

Testing

All tests should pass.

@@ -68,7 +68,7 @@ export const getMigrateSavedWidgets =

for (const fileId in content.children) {
if (errorReport.widgets?.[fileId] && behaviorOnError !== "keep-going") {
return;
continue;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously, returning here would cause the entire script to "short-circuit" causing none of the remaining widgets to be migrated.

Copy link
Collaborator

@Nouzbe Nouzbe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a few questions:

@@ -434,19 +434,6 @@ export async function migrate_43_to_50(
});
counters.widgets.success++;
} catch (error) {
if (error instanceof PartialMigrationError) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it make a difference to move this block after the call to _addErrorToReport? I don't mind, but just trying to understand the change.

@@ -1336,7 +1336,7 @@ exports[`migrate_43_to_50 returns a valid ActiveUI5 /ui folder on a real life in
"entry": {
"canRead": true,
"canWrite": true,
"content": "{}",
"content": "{"name":"Page filters","type":"container","value":{"style":{},"showTitleBar":true,"body":{},"containerKey":"filters"}}",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you understand this change?

@@ -1608,7 +1608,7 @@ exports[`migrate_43_to_50 returns a valid ActiveUI5 /ui folder on a real life in
"entry": {
"canRead": true,
"canWrite": true,
"content": "{"name":"Page filters","widgetKey":"filters"}",
"content": "{"name":"Page filters"}",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same question here.

// The migration failed.
// The widget is kept as is.
migratedWidget = bookmark;
widgets[fileId] = migratedWidget;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to do this here? Isn't it already taken care of in

widgets[fileId] = migratedWidget;
?

Copy link
Contributor Author

@NZepeda NZepeda Jul 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Nouzbe I undid my changes within migrate_4.3_to_5.0 as indeed, preserving the bookmarks content was handled by this. There was a slight modification to one of the tests but all tests should still pass. This makes this PR more simple 👍

@NZepeda NZepeda assigned NZepeda and unassigned Nouzbe Jul 31, 2024
@NZepeda
Copy link
Contributor Author

NZepeda commented Jul 31, 2024

@Nouzbe I'm passing this back to you. In my latest commit, I undid the changes to migrate_43_to_50 because as you pointed out, the preservation of the original bookmark content was already being handled. The difference with my previous changes, was that I was keeping the entire 4.3 bookmarks value which looks like the following:

{
  "value": {
    "style": {},
    "showTitleBar": false,
    "containerKey": "invalid-container-key",
    "body": {
      "serverUrl": "",
      "mdx": "SELECT NON EMPTY [Measures].[contributors.COUNT] ON COLUMNS FROM [EquityDerivativesCube] WHERE [Geography].[City].[ALL].[AllMember].[New York] CELL PROPERTIES VALUE, FORMATTED_VALUE, BACK_COLOR, FORE_COLOR, FONT_FLAGS",
      "contextValues": {},
      "updateMode": "once",
      "ranges": {}
    }
  }
}

The existing changes were already valid though, just keeping the value.body portion of the bookmark. So I reverted my changes which allow the migrate_43_to_50.ts file to remain untouched and thus simplify this PR a bit more. Now the changes mostly revolve around the tests ensuring that the behaviorOnError flag is respected.

Please let me know if you have any other questions or concerns, I'm happy to address them.

@NZepeda NZepeda assigned Nouzbe and unassigned NZepeda Jul 31, 2024
Copy link
Collaborator

@Nouzbe Nouzbe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good 👍

@Nouzbe Nouzbe assigned NZepeda and unassigned Nouzbe Aug 1, 2024
@NZepeda NZepeda merged commit 5e3020e into main Aug 1, 2024
2 checks passed
@NZepeda NZepeda deleted the bugfix/nze/UI-9526 branch August 1, 2024 13:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants