-
Notifications
You must be signed in to change notification settings - Fork 91
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
Core refactor #961
Core refactor #961
Commits on Jun 20, 2023
-
Eliminate global locationManager and prefs (now storageManager)
Trying to get to a place where all objects are just owned by context.
Configuration menu - View commit details
-
Copy full SHA for 4938075 - Browse repository at this point
Copy the full SHA 4938075View commit details -
Rename "WhateverManager" -> "WhateverSystem"
PixiJS uses this "system" naming convention so we will too
Configuration menu - View commit details
-
Copy full SHA for eaf9f76 - Browse repository at this point
Copy the full SHA eaf9f76View commit details -
Eliminate global presetManager (now presetSystem)
Trying to get to a place where all objects are just owned by context. This includes quite a lot of changes to the preset/field system: - All the preset related components are ES6 classes now - Stuff moved from modules/presets -> modules/core - Generally, tried to simplify the code as much as possible and avoid "magic" - Lots of changes around Collection, now it just contains an `array` property, no more pretending Collections is an Array or PresetIndex is a Collection - Some things that were functions before (setAddablePresetIDs) are just properties now - uiField -> UiField is now an ES6 class too - Most of the fields have been rewritten for ES6, many revisions and updates - The old way of converting a field -> presetfield -> uifield was pretty complicated, now I try to explicitly copy over properties from one component to another and call out places where a class property gets replaced by a class function Also fixed an unrelated bug in uiIcon / disclosure that was causing the hide/show toggle icons to not appear (because I removed third argument to UiIcon in 05f2f34)
Configuration menu - View commit details
-
Copy full SHA for 5c3d62d - Browse repository at this point
Copy the full SHA 5c3d62dView commit details -
WIP on modernizing services next
All will move to ES6 classes that have reference back to context and follow predictable setup and initialization flow. No more magic contextless globals.
Configuration menu - View commit details
-
Copy full SHA for c97dc2c - Browse repository at this point
Copy the full SHA c97dc2cView commit details -
WIP on modernizing services - Taginfo, Osmose, Nominatim
Also removing maprules - I dont think anyone uses it anymore.
Configuration menu - View commit details
-
Copy full SHA for 009e96f - Browse repository at this point
Copy the full SHA 009e96fView commit details -
Configuration menu - View commit details
-
Copy full SHA for 78eadc8 - Browse repository at this point
Copy the full SHA 78eadc8View commit details -
Configuration menu - View commit details
-
Copy full SHA for 0b7ec86 - Browse repository at this point
Copy the full SHA 0b7ec86View commit details -
Configuration menu - View commit details
-
Copy full SHA for f3a8913 - Browse repository at this point
Copy the full SHA f3a8913View commit details -
Configuration menu - View commit details
-
Copy full SHA for 83f9824 - Browse repository at this point
Copy the full SHA 83f9824View commit details -
WIP on modernizing services - NSI
Fixed the missing links to the preset and location systems now that NSI service has a reference back to context
Configuration menu - View commit details
-
Copy full SHA for 3bfa47f - Browse repository at this point
Copy the full SHA 3bfa47fView commit details -
WIP on modernizing services - Mapillary, Kartaview, Streetside
Still need to fix the show/hide viewer code
Configuration menu - View commit details
-
Copy full SHA for 06cd5b6 - Browse repository at this point
Copy the full SHA 06cd5b6View commit details -
WIP on modernizing services - ServiceOsm
This is all of them! Still need to restore some tests
Configuration menu - View commit details
-
Copy full SHA for fbf9253 - Browse repository at this point
Copy the full SHA fbf9253View commit details -
Improve use of
this
, avoid hacks like thiz/thatMostly this is just using fat arrow functions to preserve `this`
Configuration menu - View commit details
-
Copy full SHA for d29721f - Browse repository at this point
Copy the full SHA d29721fView commit details -
Configuration menu - View commit details
-
Copy full SHA for 96a3108 - Browse repository at this point
Copy the full SHA 96a3108View commit details -
Configuration menu - View commit details
-
Copy full SHA for 1f6047a - Browse repository at this point
Copy the full SHA 1f6047aView commit details -
Configuration menu - View commit details
-
Copy full SHA for 7972b04 - Browse repository at this point
Copy the full SHA 7972b04View commit details -
Configuration menu - View commit details
-
Copy full SHA for 3d79049 - Browse repository at this point
Copy the full SHA 3d79049View commit details -
Configuration menu - View commit details
-
Copy full SHA for e89ac19 - Browse repository at this point
Copy the full SHA e89ac19View commit details -
Configuration menu - View commit details
-
Copy full SHA for 5031e22 - Browse repository at this point
Copy the full SHA 5031e22View commit details -
Configuration menu - View commit details
-
Copy full SHA for e5a9eab - Browse repository at this point
Copy the full SHA e5a9eabView commit details -
Configuration menu - View commit details
-
Copy full SHA for 01ae920 - Browse repository at this point
Copy the full SHA 01ae920View commit details -
Configuration menu - View commit details
-
Copy full SHA for 82bcb63 - Browse repository at this point
Copy the full SHA 82bcb63View commit details -
fileFetcher -> DataLoaderSystem
Rapid does work, but now the tests are a mess. This is because the interactions between the localizer and everything else get complicated, as creating a context will start loading data and the fileFetcher isn't global anymore. The tests did have a lot of code in spec_helpers to prevent files from being fetched, that doesn't work now. This can start getting easier after we change the localizer similarly.
Configuration menu - View commit details
-
Copy full SHA for 8243099 - Browse repository at this point
Copy the full SHA 8243099View commit details -
localizer -> LocalizationSystem
This is a big change: - Eliminated the global `localizer` and `t()` functions - Added `context.t()` and `context.tHtml()` convenience functions - Some util functions relied on the global `t()` for localization (e.g. utilDisplayName, etc) these are moved into the LocalizationSystem now - Some more things need context now to avoid using the global `t()` - `ImagerySource` now passed a context - `ActionMergeRemoteChanges` rewritten to take an options param with the localizer - several more UI classes take context now - Reordered some arglists (e.g. for uiPane), context should always be the first one - Lots of changes to the tests. They were loading the general en locale strings before and they should not do this. - Still some more work to do on tests to be better at mocking context
Configuration menu - View commit details
-
Copy full SHA for ff26364 - Browse repository at this point
Copy the full SHA ff26364View commit details -
- Restored the service tests that I didn't do before (Osm, Kartaview, Mapillary, Streetside) - Fixed the other service tests that were failing because of missing fetch mock resets - Removed the sticky fetch mock routes (they were only needed by serviceosm capabilities test) - Also went through and simplified a bunch of the validator tests - We don't need to create a full context for these - We don't need to run them async to wait for data to load
Configuration menu - View commit details
-
Copy full SHA for 6d48e47 - Browse repository at this point
Copy the full SHA 6d48e47View commit details -
Make ValidationIssue and ValidationFix ES6 classes
This commit also moves a bunch of stuff from /core -> /core/lib for organization
Configuration menu - View commit details
-
Copy full SHA for 76a3ac9 - Browse repository at this point
Copy the full SHA 76a3ac9View commit details -
RendererMap -> MapSystem, 3dMap -> Map3dSystem
I also got the old RendererMap tests working again. These were skipped, but they can work now with some substantial mocking. Mostly because MapSystem listens to events emitted by many other things. It might make more sense to avoid these listeners and instead have the other systems tell them map to redraw as needed. We have map.deferredRedraw() now so this can be done in a less intrusive way. Also, we still have to sort out initialization of the map a bit better, but we're getting there.
Configuration menu - View commit details
-
Copy full SHA for 6f08290 - Browse repository at this point
Copy the full SHA 6f08290View commit details -
Rely less on event dispatching to trigger deferred rendering
Following up on an idea from 1d5e617, Just call `mapSystem.deferredRedraw()` or `mapSystem.immediateRedraw()` instead of listening to events from various places. This much simplifies the various Pixi layers that were registering listeners on the service objects. It also makes mocking mapSystem a little easier.
Configuration menu - View commit details
-
Copy full SHA for 69d29ed - Browse repository at this point
Copy the full SHA 69d29edView commit details -
Configuration menu - View commit details
-
Copy full SHA for c8b082c - Browse repository at this point
Copy the full SHA c8b082cView commit details -
Configuration menu - View commit details
-
Copy full SHA for b3a9dc0 - Browse repository at this point
Copy the full SHA b3a9dc0View commit details -
WIP: Modernize and ES6ify coreHistory -> EditSystem
This is a big change but will make the code easier to work with. Some linger issues: - Switching from d3_dispatch to EventEmitter means we have to change some of the listeners in the walkthrough - Some of the listeners seem to be firing too much - `reset` used to be used for both resetting but also returning to a saved checkpoint. I split these into two functions. - It used to dispatch a 'reset' event that was only used by the validator. The validator also has 2 resets, one that resets everything and one that preserves the user's ignored issues. This is also something we can clean up.
Configuration menu - View commit details
-
Copy full SHA for 858ec00 - Browse repository at this point
Copy the full SHA 858ec00View commit details -
Fix various event listeners d3_dispatch -> eventemitter style
Mostly in the walkthrough
Configuration menu - View commit details
-
Copy full SHA for 8f083b2 - Browse repository at this point
Copy the full SHA 8f083b2View commit details -
Moved stuff around, ditched some requestIdleCallbacks we didn't need
- It's pointless to requestIdleCallback the osm api calls that will be async anyway - We're at the point where we can get rid of the distinction between instantiate and initialize in the `.init()` function All core classes can be instantiated earlier now and in any order, as they have class constructors that don't depend on each other for anything.
Configuration menu - View commit details
-
Copy full SHA for 8683ea1 - Browse repository at this point
Copy the full SHA 8683ea1View commit details -
Configuration menu - View commit details
-
Copy full SHA for f0e7897 - Browse repository at this point
Copy the full SHA f0e7897View commit details -
Configuration menu - View commit details
-
Copy full SHA for c18443d - Browse repository at this point
Copy the full SHA c18443dView commit details -
Process smaller chunks in the validation queue
By using smaller chunks, we will block the main cpu for shorter amounts of time, allowing the browser to be more responsive. Eventually I'd like to move this to a worker, but we don't have a great way of sharing the context/graph/edits with worker processes yet.
Configuration menu - View commit details
-
Copy full SHA for 1138419 - Browse repository at this point
Copy the full SHA 1138419View commit details -
Standardize on
ThingCategory
, notCategoryThing
e.g. "MoveMode" not "ModeMove" The former is more how we would speak about and think about the thing. We already have the core systems named this way (e.g. "EditSystem") so we may as well do it for all the things.
Configuration menu - View commit details
-
Copy full SHA for e641a2f - Browse repository at this point
Copy the full SHA e641a2fView commit details -
More consistency in the class hierarchy
Behaviors -> AbstractBehavior -> EventEmitter Modes -> AbstractMode -> EventEmitter Services -> AbstractService -> EventEmitter Systems -> AbstractSystem -> EventEmitter
Configuration menu - View commit details
-
Copy full SHA for 29d4458 - Browse repository at this point
Copy the full SHA 29d4458View commit details -
Trying a more dynamic mapping for all the core components
This would allow a custom install of Rapid to add/replace/remove these components before context.init() is called. Maybe an early first step towards supporting plugins and other customization.
Configuration menu - View commit details
-
Copy full SHA for 7c9ba02 - Browse repository at this point
Copy the full SHA 7c9ba02View commit details -
Also replace the d3-dispatch('enter','exit') with EventEmitter and just emit 'modechange'
Configuration menu - View commit details
-
Copy full SHA for 9ce00cf - Browse repository at this point
Copy the full SHA 9ce00cfView commit details -
Systems should all have an id, like other classes
I thought about making these static. For modes it's easier for them to be class properties than static properties. (i.e. we need to get `mode.id` in several places)
Configuration menu - View commit details
-
Copy full SHA for b6f1ac8 - Browse repository at this point
Copy the full SHA b6f1ac8View commit details -
Replace legacy osm-only
modeSelect
with a more modern SelectOsmModeI'd still rather not have 2 select modes, but at least the modes are more standardized now.
Configuration menu - View commit details
-
Copy full SHA for 3a9e87f - Browse repository at this point
Copy the full SHA 3a9e87fView commit details -
- context, ui, validations all had a lot of work to do (many tests that were skipped before will now run!) - We avoid creating a new Context() now just to get unit tests to work Instead, mock out the systems that the unit tests need.
Configuration menu - View commit details
-
Copy full SHA for a6821ec - Browse repository at this point
Copy the full SHA a6821ecView commit details -
Avoid writing 'null' to the localstorage history key.
localStorage can only store strings, so before if we passed it a null, it stored 'null'. Then on a restart we'd see the 'null' there and think there were changes to restrore.
Configuration menu - View commit details
-
Copy full SHA for 6fe7e0d - Browse repository at this point
Copy the full SHA 6fe7e0dView commit details