Skip to content

Commit

Permalink
chore(indexes): add rollingIndexesService to indexes store (#6274)
Browse files Browse the repository at this point in the history
* chore(indexes): add rollingIndexesService to indexes store

* chore(indexes): fix linting issues
  • Loading branch information
gribnoysup authored Sep 24, 2024
1 parent cd91aec commit d146488
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 5 deletions.
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/compass-indexes/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
"reformat": "npm run eslint . -- --fix && npm run prettier -- --write ."
},
"devDependencies": {
"@mongodb-js/atlas-service": "^0.28.2",
"@mongodb-js/eslint-config-compass": "^1.1.7",
"@mongodb-js/mocha-config-compass": "^1.4.2",
"@mongodb-js/prettier-config-compass": "^1.0.2",
Expand All @@ -61,14 +60,14 @@
"electron-mocha": "^12.2.0",
"eslint": "^7.25.0",
"mocha": "^10.2.0",
"mongodb-ns": "^2.4.2",
"nyc": "^15.1.0",
"react-dom": "^17.0.2",
"sinon": "^9.2.3",
"typescript": "^5.0.4",
"xvfb-maybe": "^0.2.1"
},
"dependencies": {
"@mongodb-js/atlas-service": "^0.28.3",
"@mongodb-js/compass-app-stores": "^7.28.0",
"@mongodb-js/compass-components": "^1.29.4",
"@mongodb-js/compass-connections": "^1.42.0",
Expand All @@ -88,6 +87,7 @@
"mongodb-collection-model": "^5.23.3",
"mongodb-data-service": "^22.23.3",
"mongodb-query-parser": "^4.2.3",
"mongodb-ns": "^2.4.2",
"numeral": "^2.0.6",
"react": "^17.0.2",
"react-redux": "^8.1.3",
Expand Down
2 changes: 2 additions & 0 deletions packages/compass-indexes/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
import { createLoggerLocator } from '@mongodb-js/compass-logging/provider';
import { telemetryLocator } from '@mongodb-js/compass-telemetry/provider';
import { IndexesTabTitle } from './plugin-title';
import { atlasServiceLocator } from '@mongodb-js/atlas-service/provider';

const CompassIndexesHadronPlugin = registerHadronPlugin(
{
Expand All @@ -34,6 +35,7 @@ const CompassIndexesHadronPlugin = registerHadronPlugin(
logger: createLoggerLocator('COMPASS-INDEXES-UI'),
track: telemetryLocator,
collection: collectionModelLocator,
atlasService: atlasServiceLocator,
}
);

Expand Down
2 changes: 2 additions & 0 deletions packages/compass-indexes/src/modules/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import type { TrackFunction } from '@mongodb-js/compass-telemetry';
import type { ConnectionInfoRef } from '@mongodb-js/compass-connections/provider';
import type { IndexesDataServiceProps } from '../stores/store';
import type { Collection } from '@mongodb-js/compass-app-stores/provider';
import type { RollingIndexesService } from './rolling-indexes-service';
const reducer = combineReducers({
// From instance.isWritable. Used to know if the create button should be
// enabled.
Expand Down Expand Up @@ -70,6 +71,7 @@ export type IndexesExtraArgs = {
dataService: Pick<DataService, IndexesDataServiceProps>;
connectionInfoRef: ConnectionInfoRef;
collection: Collection;
rollingIndexesService: RollingIndexesService;
};
export type IndexesThunkDispatch<A extends Action = AnyAction> = ThunkDispatch<
RootState,
Expand Down
8 changes: 8 additions & 0 deletions packages/compass-indexes/src/stores/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ import {
collectionStatsFetched,
extractCollectionStats,
} from '../modules/collection-stats';
import type { AtlasService } from '@mongodb-js/atlas-service/provider';
import { RollingIndexesService } from '../modules/rolling-indexes-service';

export type IndexesDataServiceProps =
| 'indexes'
Expand Down Expand Up @@ -53,6 +55,7 @@ export type IndexesPluginServices = {
logger: Logger;
collection: Collection;
track: TrackFunction;
atlasService: AtlasService;
};

export type IndexesPluginOptions = {
Expand All @@ -77,6 +80,7 @@ export function activateIndexesPlugin(
track,
dataService,
collection: collectionModel,
atlasService,
}: IndexesPluginServices,
{ on, cleanup }: ActivateHelpers
) {
Expand All @@ -101,6 +105,10 @@ export function activateIndexesPlugin(
connectionInfoRef,
dataService,
collection: collectionModel,
rollingIndexesService: new RollingIndexesService(
atlasService,
connectionInfoRef
),
})
)
);
Expand Down
4 changes: 4 additions & 0 deletions packages/compass-indexes/test/setup-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { createNoopTrack } from '@mongodb-js/compass-telemetry/provider';
import type { ConnectionInfoRef } from '@mongodb-js/compass-connections/provider';
import { waitFor } from '@mongodb-js/testing-library-compass';
import { expect } from 'chai';
import type { AtlasService } from '@mongodb-js/atlas-service/provider';

const NOOP_DATA_PROVIDER: IndexesDataService = {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
Expand Down Expand Up @@ -139,6 +140,8 @@ export const setupStore = (
},
} as ConnectionInfoRef;

const atlasService = {} as AtlasService;

return activateIndexesPlugin(
{
namespace: 'citibike.trips',
Expand All @@ -156,6 +159,7 @@ export const setupStore = (
track: createNoopTrack(),
collection: createMockCollection(),
connectionInfoRef,
atlasService,
...services,
},
createActivateHelpers()
Expand Down

0 comments on commit d146488

Please sign in to comment.