-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Improve performance of JSON import and add progress bar #7654
Improve performance of JSON import and add progress bar #7654
Conversation
With this export (Big Test Folder (2).json.zip), the speed goes from > 5 minutes, to a few seconds: Screen.Recording.2024-03-29.at.4.27.54.PM.mov |
@@ -123,8 +122,6 @@ describe('The import JSON action', function () { | |||
Object.prototype.hasOwnProperty.call(newObject, '__proto__') || | |||
Object.prototype.hasOwnProperty.call(Object.getPrototypeOf(newObject), 'toString'); | |||
|
|||
// warning from openmct.objects.get | |||
expect(console.warn).not.toHaveBeenCalled(); |
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.
vue warnings were causing tests to fail here
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #7654 +/- ##
==========================================
- Coverage 54.95% 54.78% -0.17%
==========================================
Files 430 672 +242
Lines 13469 27183 +13714
Branches 0 2634 +2634
==========================================
+ Hits 7402 14893 +7491
- Misses 6067 11962 +5895
- Partials 0 328 +328
... and 394 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
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.
Nice work, this is awesome! I've got some comments-- nothing blocking but some readability improvements and other nitpicks before we merge
@@ -170,9 +276,16 @@ export default class ImportAsJSONAction { | |||
* @param {Object} objTree | |||
*/ | |||
async _importObjectTree(domainObject, objTree) { |
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 switch these to actual private methods without ruining the unit tests?
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.
Changing these to private methods cause issues with the way we're returning from _showForm
. E.g., changing to #importObjectTree
causes:
ImportFromJSONAction.js:77 Uncaught (in promise) TypeError: Receiver must be an instance of class ImportAsJSONAction
at ImportAsJSONAction.onSave (ImportFromJSONAction.js:77:1)
at eval (ImportFromJSONAction.js:376: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.
LGTM
Closes #7612
Describe your changes:
Instead of using
JSON.parse
,JSON.stringify
, and Regex, walk the tree instead. This speeds up the import considerably. I also added a progress bar so the user can see the status of the import.All Submissions:
Author Checklist
type:
label? Note: this is not necessarily the same as the original issue.Reviewer Checklist