Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
paula-stacho committed Oct 31, 2024
1 parent 7074f0f commit 06f311d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
8 changes: 8 additions & 0 deletions packages/compass-global-writes/src/components/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import ShardKeyCorrect from './states/shard-key-correct';
import ShardKeyInvalid from './states/shard-key-invalid';
import ShardKeyMismatch from './states/shard-key-mismatch';
import ShardingError from './states/sharding-error';
import IncompleteShardingSetup from './states/incomplete-sharding-setup';

const containerStyles = css({
paddingLeft: spacing[400],
Expand Down Expand Up @@ -93,6 +94,13 @@ function ShardingStateView({
return <ShardKeyMismatch />;
}

if (
shardingStatus === ShardingStatuses.INCOMPLETE_SHARDING_SETUP ||
shardingStatus === ShardingStatuses.SUBMITTING_FOR_SHARDING_INCOMPLETE
) {
return <IncompleteShardingSetup />;
}

return null;
}

Expand Down
8 changes: 4 additions & 4 deletions packages/compass-global-writes/src/store/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ describe('GlobalWritesStore Store', function () {
});
});

it('valid shard key -> not managed', async function () {
it('valid shard key -> incomplete', async function () {
// initial state === shard key correct
const store = createStore({
isNamespaceManaged: () => true,
Expand All @@ -356,7 +356,7 @@ describe('GlobalWritesStore Store', function () {
const promise = store.dispatch(unmanageNamespace());
expect(store.getState().status).to.equal('UNMANAGING_NAMESPACE');
await promise;
expect(store.getState().status).to.equal('UNSHARDED');
expect(store.getState().status).to.equal('INCOMPLETE_SHARDING_SETUP');
});

it('valid shard key -> valid shard key (failed unmanage attempt)', async function () {
Expand Down Expand Up @@ -452,7 +452,7 @@ describe('GlobalWritesStore Store', function () {
});
});

it('mismatch -> unmanaged', async function () {
it('mismatch -> incomplete sharding setup', async function () {
// initial state - mismatch
const store = createStore({
isNamespaceManaged: () => true,
Expand All @@ -475,7 +475,7 @@ describe('GlobalWritesStore Store', function () {
'UNMANAGING_NAMESPACE_MISMATCH'
);
await promise;
expect(store.getState().status).to.equal('UNSHARDED');
expect(store.getState().status).to.equal('INCOMPLETE_SHARDING_SETUP');
});
});

Expand Down
2 changes: 1 addition & 1 deletion packages/compass-global-writes/src/store/reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ const reducer: Reducer<RootState, Action> = (state = initialState, action) => {
return {
...state,
managedNamespace: undefined,
status: ShardingStatuses.UNSHARDED,
status: ShardingStatuses.INCOMPLETE_SHARDING_SETUP,
};
}

Expand Down

0 comments on commit 06f311d

Please sign in to comment.