Skip to content

Commit ac864f4

Browse files
authored
refactor(app-stores): Decouple sidebar, databases/collections, and collection stats from instance refresh and use single source for coll stats COMPASS-5266 (#2574)
* feat(collection-model): Update collection model - Propagate CollectionCollection events to the state root - Derive all namespace values instead of expecting them to be present in listCollections return value - Add options to skip or require fetching of the collInfo returned by listCollection - Always serialize derived values when calling toJSON on the model or collection - Add fecthing status to the model * feat(database-model): Update database model - Propagate collection events to the state root - Add status for model update and collections fetching - Always serialize derived values by default * feat(data-service): Return collection_count from the dbStats Helpful so that we don't need to fetch collections before knowing how many are there * feat(instance-model): Update instance model - Move refresh logic to the model itself - Add database fetching status state - Add a better clean up listeners method * refactor(app-stores): Prepare instance-store for decoupling plugins from instance-refreshed event - Emit new events for the instance: created and destroyed - Move database details fetching logic to the instance-store - Introduce COMPASS_NO_GLOBAL_OVERLAY flag to allow for testing the new loading flow * refactor(compass-crud): Subscribe plugin to the instance changes that it requires * refactor(compass-home): Use created instead of refreshed to subscribe component to the status updates * refactor(server-version): Subscribe plugin to instance status changes instead of using refreshed event * refactor(compass-databases): Subscribe to instance changes instead of listening to refreshed event; Use collection_count in the db stats table * refactor(collections): Use instance collections info instead of fetching and retaining it in the plugin state - Remove dataService interactions from the plugin and only emit relevant event to activate instance-store logic - Subscribe to instance updates to propagate collections changes to the components * refactor(sidebar): Use collection_count instead of collections length in the instance info; Use isRefreshing to disable and spin the refresh button * refactor(sidebar): Decouple sidebar databases tree state - Separate namespace, filter and db change to separate actions - "Filter" databases only when dbs or filter changed - Make expand/collaps more consistent - Keep and restore expanded state before filtering - Do not collapse expanded items on namespace change - Subscribe plugin to all relevant changes in instance anddbs/colls instead of using refreshed event - Fix row height calculation and values * fix(sidebar): Fix sidebar database expand caret animation * chore: Clean-up global overlay usage from all the unrelevant places It's only isntance-store that now shows it * fix(app-stores): Try to fetch collection details even when collection names were fetched already * fix(home): Listen to databasesStatus in addition to instance status and only mark instance as loaded when dbs are loaded * chore(app-stores): Don't fetch collStats until db namespace is selected This aligns new flow with the current behavior * fix(collection-model, instance-model): Add missing collInfo props to the model; Allow to fetch collInfo separately from collStats during refresh * chore: Normalize event payloads on document add/remove and import finished * refactor(collection-stats): Align to a single source of truth for collection info in collection stats plugin - Add event listeners to instance store that will refresh collection when needed - Do not fetch collStats in plugin, instead listen to all collection status events and update when relevant collection was updated * fix(app-stores): Always fetch dbStats on refresh * chore(app-stores): Fetch info when listing collection when fetching database details * fix(app-stores, home, instance-model): Don't show databases until initial refresh is finished when global overlay is shown This preserves the current behavior, otherwise users might see dbs while we are still blocking the screen which might be a bit too annoying * refactor(instance-model, database-model, collection-model): debounce inflight async calls on models * chore(collection-stats): Clarify why we are storing references to the appRegistry and instance on the store * fix(home): Fix code formatting * fix(app-stores, sidebar, databases-collections): Fix depcheck issues * fix(instance, database, collection): Attach finally to returned promise to avoid forking the promise and uncaught exceptions * test(collection-stats, server-version, home, app-stores): Update and add new tests following the new instance fetching implementation * test(sidebar): Refactor tests to match new reducer data flow * test(databases-collections): Fix store tests * fix(compass): Remove unused dependency * test(e2e): Fix flaky database test * fix(e2e): Fix prettier formatting * fix(database-model): collectionsStatus is not derived from model.status
1 parent 0b2ce02 commit ac864f4

File tree

65 files changed

+1765
-1685
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+1765
-1685
lines changed

package-lock.json

Lines changed: 15 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)