Skip to content

Commit db88ca8

Browse files
committed
cleanup and ellipsis
1 parent 8b1df5a commit db88ca8

File tree

5 files changed

+21
-19
lines changed

5 files changed

+21
-19
lines changed

packages/compass-data-modeling/src/components/analysis-progress-status.spec.tsx

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ describe('AnalysisProgressStatus', () => {
3333

3434
it('Allows cancellation', async () => {
3535
const store = await renderAnalysisProgressStatus();
36-
expect(screen.getByText('Sampling collections..')).to.be.visible;
36+
expect(screen.getByText('Sampling collections')).to.be.visible;
3737
expect(screen.getByText('Cancel')).to.be.visible;
3838
screen.getByText('Cancel').click();
3939
await waitFor(() => {
@@ -47,7 +47,7 @@ describe('AnalysisProgressStatus', () => {
4747
const store = await renderAnalysisProgressStatus({
4848
automaticallyInferRelations: false,
4949
});
50-
expect(screen.getByText('Sampling collections..')).to.be.visible;
50+
expect(screen.getByText('Sampling collections')).to.be.visible;
5151
expect(screen.getByText('0/3')).to.be.visible;
5252

5353
// 2 out of 3 samples fetched, 1 analyzed
@@ -61,15 +61,15 @@ describe('AnalysisProgressStatus', () => {
6161
type: AnalysisProcessActionTypes.NAMESPACE_SCHEMA_ANALYZED,
6262
});
6363

64-
expect(screen.getByText('Sampling collections..')).to.be.visible;
64+
expect(screen.getByText('Sampling collections')).to.be.visible;
6565
expect(screen.getByText('2/3')).to.be.visible;
6666

6767
// Last sample fetched
6868
store.dispatch({
6969
type: AnalysisProcessActionTypes.NAMESPACE_SAMPLE_FETCHED,
7070
});
7171

72-
expect(screen.getByText('Analyzing collection schemas..')).to.be.visible;
72+
expect(screen.getByText('Analyzing collection schemas')).to.be.visible;
7373
expect(screen.getByText('1/3')).to.be.visible;
7474

7575
// Finish analyzing
@@ -80,17 +80,16 @@ describe('AnalysisProgressStatus', () => {
8080
type: AnalysisProcessActionTypes.NAMESPACE_SCHEMA_ANALYZED,
8181
});
8282

83-
expect(
84-
screen.queryByText('Inferring relationships between collections..')
85-
).not.to.exist;
86-
expect(screen.getByText('Preparing diagram..')).to.be.visible;
83+
expect(screen.queryByText('Inferring relationships between collections…'))
84+
.not.to.exist;
85+
expect(screen.getByText('Preparing diagram…')).to.be.visible;
8786
});
8887

8988
it('With relationship inferring', async () => {
9089
const store = await renderAnalysisProgressStatus({
9190
automaticallyInferRelations: true,
9291
});
93-
expect(screen.getByText('Sampling collections..')).to.be.visible;
92+
expect(screen.getByText('Sampling collections')).to.be.visible;
9493
expect(screen.getByText('0/3')).to.be.visible;
9594

9695
// Fetch and analyze all samples
@@ -113,7 +112,7 @@ describe('AnalysisProgressStatus', () => {
113112
type: AnalysisProcessActionTypes.NAMESPACE_SCHEMA_ANALYZED,
114113
});
115114

116-
expect(screen.getByText('Inferring relationships between collections..'))
115+
expect(screen.getByText('Inferring relationships between collections'))
117116
.to.be.visible;
118117
expect(screen.queryByText('0/3')).not.to.exist;
119118

@@ -125,7 +124,7 @@ describe('AnalysisProgressStatus', () => {
125124
type: AnalysisProcessActionTypes.NAMESPACE_RELATIONS_INFERRED,
126125
});
127126

128-
expect(screen.getByText('Inferring relationships between collections..'))
127+
expect(screen.getByText('Inferring relationships between collections'))
129128
.to.be.visible;
130129
expect(screen.queryByText('2/3')).not.to.exist;
131130

@@ -134,7 +133,7 @@ describe('AnalysisProgressStatus', () => {
134133
type: AnalysisProcessActionTypes.NAMESPACE_RELATIONS_INFERRED,
135134
});
136135

137-
expect(screen.getByText('Preparing diagram..')).to.be.visible;
136+
expect(screen.getByText('Preparing diagram')).to.be.visible;
138137
});
139138
});
140139
});

packages/compass-data-modeling/src/components/analysis-progress-status.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ function getProgressPropsFromStatus({
3535
if (step === 'SAMPLING') {
3636
return {
3737
isIndeterminate: false,
38-
label: `Sampling collections..`,
38+
label: 'Sampling collections…',
3939
maxValue: totalCollections,
4040
value: sampledCollections,
4141
formatValue: 'fraction',
@@ -44,7 +44,7 @@ function getProgressPropsFromStatus({
4444
if (step === 'ANALYZING_SCHEMA') {
4545
return {
4646
isIndeterminate: false,
47-
label: `Analyzing collection schemas..`,
47+
label: 'Analyzing collection schemas…',
4848
maxValue: totalCollections,
4949
value: analyzedCollections,
5050
formatValue: 'fraction',
@@ -53,15 +53,15 @@ function getProgressPropsFromStatus({
5353
if (step === 'INFERRING_RELATIONSHIPS') {
5454
return {
5555
isIndeterminate: false,
56-
label: 'Inferring relationships between collections..',
56+
label: 'Inferring relationships between collections',
5757
maxValue: totalCollections,
5858
value: collectionRelationsInferred,
5959
formatValue: undefined,
6060
};
6161
}
6262
return {
6363
isIndeterminate: true,
64-
label: 'Preparing diagram..',
64+
label: 'Preparing diagram',
6565
};
6666
}
6767

packages/compass-data-modeling/src/components/diagram-editor.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,6 @@ const DiagramEditor: React.FunctionComponent<{
551551
step: DataModelingState['step'];
552552
diagramId?: string;
553553
onRetryClick: () => void;
554-
onCancelClick: () => void;
555554
onAddCollectionClick: () => void;
556555
DiagramComponent?: typeof Diagram;
557556
}> = ({

packages/compass-data-modeling/src/components/new-diagram-form.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import {
3939
Checkbox,
4040
} from '@mongodb-js/compass-components';
4141
import { usePreference } from 'compass-preferences-model/provider';
42+
import { selectIsAnalysisInProgress } from '../store/analysis-process';
4243

4344
const footerStyles = css({
4445
flexDirection: 'row',
@@ -559,8 +560,7 @@ export default connect(
559560
collections: databaseCollections ?? [],
560561
selectedCollections: selectedCollections ?? [],
561562
error,
562-
analysisInProgress:
563-
state.analysisProgress.analysisProcessStatus === 'in-progress',
563+
analysisInProgress: selectIsAnalysisInProgress(state),
564564
automaticallyInferRelationships:
565565
state.generateDiagramWizard.automaticallyInferRelations,
566566
};

packages/compass-data-modeling/src/store/analysis-process.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,3 +417,7 @@ export function cancelAnalysis(): DataModelingThunkAction<void, never> {
417417
cancelAnalysisControllerRef.current = null;
418418
};
419419
}
420+
421+
export const selectIsAnalysisInProgress = (state: {
422+
analysisProgress: AnalysisProcessState;
423+
}): boolean => state.analysisProgress.step !== 'IDLE';

0 commit comments

Comments
 (0)