Prettier 2.0 (#393)

This commit is contained in:
Steve Faulkner
2021-01-20 09:15:01 -06:00
committed by GitHub
parent c1937ca464
commit 4be53284b5
500 changed files with 41927 additions and 41838 deletions

View File

@@ -9,7 +9,7 @@ import ko from "knockout";
import { TtlType, isDirty } from "./SettingsUtils";
import Explorer from "../../Explorer";
jest.mock("../../../Common/dataAccess/getIndexTransformationProgress", () => ({
getIndexTransformationProgress: jest.fn().mockReturnValue(undefined)
getIndexTransformationProgress: jest.fn().mockReturnValue(undefined),
}));
import { updateCollection, updateMongoDBCollectionThroughRP } from "../../../Common/dataAccess/updateCollection";
jest.mock("../../../Common/dataAccess/updateCollection", () => ({
@@ -20,20 +20,20 @@ jest.mock("../../../Common/dataAccess/updateCollection", () => ({
conflictResolutionPolicy: undefined,
changeFeedPolicy: undefined,
analyticalStorageTtl: undefined,
geospatialConfig: undefined
geospatialConfig: undefined,
} as DataModels.Collection),
updateMongoDBCollectionThroughRP: jest.fn().mockReturnValue({
id: undefined,
shardKey: undefined,
indexes: [],
analyticalStorageTtl: undefined
} as MongoDBCollectionResource)
analyticalStorageTtl: undefined,
} as MongoDBCollectionResource),
}));
import { updateOffer } from "../../../Common/dataAccess/updateOffer";
import { MongoDBCollectionResource } from "../../../Utils/arm/generatedClients/2020-04-01/types";
import Q from "q";
jest.mock("../../../Common/dataAccess/updateOffer", () => ({
updateOffer: jest.fn().mockReturnValue({} as DataModels.Offer)
updateOffer: jest.fn().mockReturnValue({} as DataModels.Offer),
}));
describe("SettingsComponent", () => {
@@ -49,8 +49,8 @@ describe("SettingsComponent", () => {
onUpdateTabsButtons: undefined,
getPendingNotification: Q.Promise<DataModels.Notification>(() => {
return;
})
})
}),
}),
};
it("renders", () => {
@@ -71,7 +71,7 @@ describe("SettingsComponent", () => {
isScaleSaveable: false,
isScaleDiscardable: false,
isSubSettingsSaveable: true,
isSubSettingsDiscardable: true
isSubSettingsDiscardable: true,
});
wrapper.update();
expect(settingsComponentInstance.isSaveSettingsButtonEnabled()).toEqual(true);
@@ -93,7 +93,7 @@ describe("SettingsComponent", () => {
manualThroughput: undefined,
minimumThroughput: 400,
id: "test",
offerReplacePending: false
offerReplacePending: false,
});
const props = { ...baseProps };
@@ -106,7 +106,7 @@ describe("SettingsComponent", () => {
userCanChangeProvisioningTypes: true,
isAutoPilotSelected: true,
wasAutopilotOriginallySet: false,
autoPilotThroughput: 1000
autoPilotThroughput: 1000,
});
wrapper.update();
expect(settingsComponentInstance.hasProvisioningTypeChanged()).toEqual(true);
@@ -141,7 +141,7 @@ describe("SettingsComponent", () => {
onDeleteDatabaseContextMenuClick: undefined,
readSettings: undefined,
onSettingsClick: undefined,
loadOffer: undefined
loadOffer: undefined,
} as ViewModels.Database;
newCollection.getDatabase = () => newDatabase;
newCollection.offer = ko.observable(undefined);
@@ -170,14 +170,14 @@ describe("SettingsComponent", () => {
tableEndpoint: undefined,
gremlinEndpoint: undefined,
cassandraEndpoint: undefined,
enableMultipleWriteLocations: true
}
enableMultipleWriteLocations: true,
},
});
const newCollection = { ...collection };
newCollection.container = newContainer;
newCollection.conflictResolutionPolicy = ko.observable({
mode: DataModels.ConflictResolutionMode.Custom,
conflictResolutionProcedure: undefined
conflictResolutionProcedure: undefined,
} as DataModels.ConflictResolutionPolicy);
const props = { ...baseProps };
@@ -193,7 +193,7 @@ describe("SettingsComponent", () => {
wrapper.update();
const settingsComponentInstance = wrapper.instance() as SettingsComponent;
settingsComponentInstance.mongoDBCollectionResource = {
id: "id"
id: "id",
};
await settingsComponentInstance.onSaveClick();
expect(updateCollection).toBeCalled();
@@ -238,7 +238,7 @@ describe("SettingsComponent", () => {
wrapper.setState({
conflictResolutionPolicyMode: DataModels.ConflictResolutionMode.LastWriterWins,
conflictResolutionPolicyPath: conflictResolutionPolicyPath
conflictResolutionPolicyPath: conflictResolutionPolicyPath,
});
wrapper.update();
const settingsComponentInstance = wrapper.instance() as SettingsComponent;
@@ -248,7 +248,7 @@ describe("SettingsComponent", () => {
wrapper.setState({
conflictResolutionPolicyMode: DataModels.ConflictResolutionMode.Custom,
conflictResolutionPolicyProcedure: conflictResolutionPolicyProcedure
conflictResolutionPolicyProcedure: conflictResolutionPolicyProcedure,
});
wrapper.update();
conflictResolutionPolicy = settingsComponentInstance.getUpdatedConflictResolutionPolicy();

View File

@@ -16,7 +16,7 @@ import { mongoIndexingPolicyAADError } from "./SettingsRenderUtils";
import { ScaleComponent, ScaleComponentProps } from "./SettingsSubComponents/ScaleComponent";
import {
MongoIndexingPolicyComponent,
MongoIndexingPolicyComponentProps
MongoIndexingPolicyComponentProps,
} from "./SettingsSubComponents/MongoIndexingPolicy/MongoIndexingPolicyComponent";
import {
hasDatabaseSharedThroughput,
@@ -30,11 +30,11 @@ import {
MongoIndexTypes,
parseConflictResolutionMode,
parseConflictResolutionProcedure,
getMongoNotification
getMongoNotification,
} from "./SettingsUtils";
import {
ConflictResolutionComponent,
ConflictResolutionComponentProps
ConflictResolutionComponentProps,
} from "./SettingsSubComponents/ConflictResolutionComponent";
import { SubSettingsComponent, SubSettingsComponentProps } from "./SettingsSubComponents/SubSettingsComponent";
import { Pivot, PivotItem, IPivotProps, IPivotItemProps } from "office-ui-fabric-react";
@@ -187,21 +187,21 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
isConflictResolutionDirty: false,
initialNotification: undefined,
selectedTab: SettingsV2TabTypes.ScaleTab
selectedTab: SettingsV2TabTypes.ScaleTab,
};
this.saveSettingsButton = {
isEnabled: this.isSaveSettingsButtonEnabled,
isVisible: () => {
return true;
}
},
};
this.discardSettingsChangesButton = {
isEnabled: this.isDiscardSettingsButtonEnabled,
isVisible: () => {
return true;
}
},
};
}
@@ -234,7 +234,7 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
if (this.mongoDBCollectionResource) {
this.setState({
currentMongoIndexes: [...this.mongoDBCollectionResource.indexes]
currentMongoIndexes: [...this.mongoDBCollectionResource.indexes],
});
}
}
@@ -277,7 +277,7 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
isAutoPilotSelected: true,
wasAutopilotOriginallySet: true,
autoPilotThroughput: autoscaleMaxThroughput,
autoPilotThroughputBaseline: autoscaleMaxThroughput
autoPilotThroughputBaseline: autoscaleMaxThroughput,
});
}
};
@@ -306,7 +306,7 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
databaseAccountName: this.container.databaseAccount()?.name,
defaultExperience: this.container.defaultExperience(),
dataExplorerArea: Constants.Areas.Tab,
tabTitle: this.props.settingsTab.tabTitle()
tabTitle: this.props.settingsTab.tabTitle(),
});
const newCollection: DataModels.Collection = { ...this.collection.rawDataModel };
@@ -339,14 +339,14 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
newCollection.changeFeedPolicy =
this.changeFeedPolicyVisible && this.state.changeFeedPolicy === ChangeFeedPolicyState.On
? {
retentionDuration: Constants.BackendDefaults.maxChangeFeedRetentionDuration
retentionDuration: Constants.BackendDefaults.maxChangeFeedRetentionDuration,
}
: undefined;
newCollection.analyticalStorageTtl = this.getAnalyticalStorageTtl();
newCollection.geospatialConfig = {
type: this.state.geospatialConfigType
type: this.state.geospatialConfigType,
};
const conflictResolutionChanges: DataModels.ConflictResolutionPolicy = this.getUpdatedConflictResolutionPolicy();
@@ -376,7 +376,7 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
isSubSettingsSaveable: false,
isSubSettingsDiscardable: false,
isIndexingPolicyDirty: false,
isConflictResolutionDirty: false
isConflictResolutionDirty: false,
});
}
@@ -385,7 +385,7 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
const newMongoIndexes = this.getMongoIndexesToSave();
const newMongoCollection: MongoDBCollectionResource = {
...this.mongoDBCollectionResource,
indexes: newMongoIndexes
indexes: newMongoIndexes,
};
this.mongoDBCollectionResource = await updateMongoDBCollectionThroughRP(
@@ -399,7 +399,7 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
isMongoIndexingPolicySaveable: false,
indexesToDrop: [],
indexesToAdd: [],
currentMongoIndexes: [...this.mongoDBCollectionResource.indexes]
currentMongoIndexes: [...this.mongoDBCollectionResource.indexes],
});
traceSuccess(
Action.MongoIndexUpdated,
@@ -409,7 +409,7 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
collectionName: this.collection?.id(),
defaultExperience: this.container.defaultExperience(),
dataExplorerArea: Constants.Areas.Tab,
tabTitle: this.props.settingsTab.tabTitle()
tabTitle: this.props.settingsTab.tabTitle(),
},
startKey
);
@@ -424,7 +424,7 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
dataExplorerArea: Constants.Areas.Tab,
tabTitle: this.props.settingsTab.tabTitle(),
error: getErrorMessage(error),
errorStack: getErrorStack(error)
errorStack: getErrorStack(error),
},
startKey
);
@@ -438,7 +438,7 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
collectionId: this.collection.id(),
currentOffer: this.collection.offer(),
autopilotThroughput: this.state.isAutoPilotSelected ? this.state.autoPilotThroughput : undefined,
manualThroughput: this.state.isAutoPilotSelected ? undefined : this.state.throughput
manualThroughput: this.state.isAutoPilotSelected ? undefined : this.state.throughput,
};
if (this.hasProvisioningTypeChanged()) {
if (this.state.isAutoPilotSelected) {
@@ -453,12 +453,12 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
if (this.state.isAutoPilotSelected) {
this.setState({
autoPilotThroughput: updatedOffer.autoscaleMaxThroughput,
autoPilotThroughputBaseline: updatedOffer.autoscaleMaxThroughput
autoPilotThroughputBaseline: updatedOffer.autoscaleMaxThroughput,
});
} else {
this.setState({
throughput: updatedOffer.manualThroughput,
throughputBaseline: updatedOffer.manualThroughput
throughputBaseline: updatedOffer.manualThroughput,
});
}
}
@@ -473,7 +473,7 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
collectionName: this.collection?.id(),
defaultExperience: this.container.defaultExperience(),
dataExplorerArea: Constants.Areas.Tab,
tabTitle: this.props.settingsTab.tabTitle()
tabTitle: this.props.settingsTab.tabTitle(),
},
startKey
);
@@ -491,7 +491,7 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
dataExplorerArea: Constants.Areas.Tab,
tabTitle: this.props.settingsTab.tabTitle(),
error: getErrorMessage(error),
errorStack: getErrorStack(error)
errorStack: getErrorStack(error),
},
startKey
);
@@ -501,7 +501,7 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
public onRevertClick = (): void => {
trace(Action.SettingsV2Discarded, ActionModifiers.Mark, {
message: "Settings Discarded"
message: "Settings Discarded",
});
this.setState({
@@ -528,7 +528,7 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
isIndexingPolicyDirty: false,
isMongoIndexingPolicySaveable: false,
isMongoIndexingPolicyDiscardable: false,
isConflictResolutionDirty: false
isConflictResolutionDirty: false,
});
};
@@ -564,7 +564,7 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
collectionName: this.collection.id(),
defaultExperience: this.container.defaultExperience(),
dataExplorerArea: Constants.Areas.Tab,
tabTitle: this.props.settingsTab.tabTitle()
tabTitle: this.props.settingsTab.tabTitle(),
},
this.props.settingsTab.onLoadStartKey
);
@@ -592,7 +592,7 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
const newMongoIndexWithType: AddMongoIndexProps = {
mongoIndex: { key: { keys: [description] } } as MongoIndex,
type: type,
notification: notification
notification: notification,
};
if (index === newIndexesToAdd.length) {
newIndexesToAdd.push(newMongoIndexWithType);
@@ -667,7 +667,7 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
}
const policy: DataModels.ConflictResolutionPolicy = {
mode: parseConflictResolutionMode(this.state.conflictResolutionPolicyMode)
mode: parseConflictResolutionMode(this.state.conflictResolutionPolicyMode),
};
if (
@@ -764,7 +764,7 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
conflictResolutionPolicyProcedure: conflictResolutionPolicyProcedure,
conflictResolutionPolicyProcedureBaseline: conflictResolutionPolicyProcedure,
geospatialConfigType: geoSpatialConfigType,
geospatialConfigTypeBaseline: geoSpatialConfigType
geospatialConfigTypeBaseline: geoSpatialConfigType,
});
};
@@ -779,7 +779,7 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
commandButtonLabel: label,
ariaLabel: label,
hasPopup: false,
disabled: !this.saveSettingsButton.isEnabled()
disabled: !this.saveSettingsButton.isEnabled(),
});
}
@@ -792,7 +792,7 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
commandButtonLabel: label,
ariaLabel: label,
hasPopup: false,
disabled: !this.discardSettingsChangesButton.isEnabled()
disabled: !this.discardSettingsChangesButton.isEnabled(),
});
}
return buttons;
@@ -827,7 +827,7 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
onMaxAutoPilotThroughputChange: this.onMaxAutoPilotThroughputChange,
onScaleSaveableChange: this.onScaleSaveableChange,
onScaleDiscardableChange: this.onScaleDiscardableChange,
initialNotification: this.props.settingsTab.pendingNotification()
initialNotification: this.props.settingsTab.pendingNotification(),
};
const subSettingsComponentProps: SubSettingsComponentProps = {
@@ -854,7 +854,7 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
changeFeedPolicyBaseline: this.state.changeFeedPolicyBaseline,
onChangeFeedPolicyChange: this.onChangeFeedPolicyChange,
onSubSettingsSaveableChange: this.onSubSettingsSaveableChange,
onSubSettingsDiscardableChange: this.onSubSettingsDiscardableChange
onSubSettingsDiscardableChange: this.onSubSettingsDiscardableChange,
};
const indexingPolicyComponentProps: IndexingPolicyComponentProps = {
@@ -866,7 +866,7 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
logIndexingPolicySuccessMessage: this.logIndexingPolicySuccessMessage,
indexTransformationProgress: this.state.indexTransformationProgress,
refreshIndexTransformationProgress: this.refreshIndexTransformationProgress,
onIndexingPolicyDirtyChange: this.onIndexingPolicyDirtyChange
onIndexingPolicyDirtyChange: this.onIndexingPolicyDirtyChange,
};
const mongoIndexingPolicyComponentProps: MongoIndexingPolicyComponentProps = {
@@ -880,7 +880,7 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
indexTransformationProgress: this.state.indexTransformationProgress,
refreshIndexTransformationProgress: this.refreshIndexTransformationProgress,
onMongoIndexingPolicySaveableChange: this.onMongoIndexingPolicySaveableChange,
onMongoIndexingPolicyDiscardableChange: this.onMongoIndexingPolicyDiscardableChange
onMongoIndexingPolicyDiscardableChange: this.onMongoIndexingPolicyDiscardableChange,
};
const conflictResolutionPolicyComponentProps: ConflictResolutionComponentProps = {
@@ -895,37 +895,37 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
conflictResolutionPolicyProcedure: this.state.conflictResolutionPolicyProcedure,
conflictResolutionPolicyProcedureBaseline: this.state.conflictResolutionPolicyProcedureBaseline,
onConflictResolutionPolicyProcedureChange: this.onConflictResolutionPolicyProcedureChange,
onConflictResolutionDirtyChange: this.onConflictResolutionDirtyChange
onConflictResolutionDirtyChange: this.onConflictResolutionDirtyChange,
};
const tabs: SettingsV2TabInfo[] = [];
if (!hasDatabaseSharedThroughput(this.collection) && this.collection.offer()) {
tabs.push({
tab: SettingsV2TabTypes.ScaleTab,
content: <ScaleComponent {...scaleComponentProps} />
content: <ScaleComponent {...scaleComponentProps} />,
});
}
tabs.push({
tab: SettingsV2TabTypes.SubSettingsTab,
content: <SubSettingsComponent {...subSettingsComponentProps} />
content: <SubSettingsComponent {...subSettingsComponentProps} />,
});
if (this.shouldShowIndexingPolicyEditor) {
tabs.push({
tab: SettingsV2TabTypes.IndexingPolicyTab,
content: <IndexingPolicyComponent {...indexingPolicyComponentProps} />
content: <IndexingPolicyComponent {...indexingPolicyComponentProps} />,
});
} else if (this.container.isPreferredApiMongoDB()) {
if (isEmpty(this.container.features())) {
tabs.push({
tab: SettingsV2TabTypes.IndexingPolicyTab,
content: mongoIndexingPolicyAADError
content: mongoIndexingPolicyAADError,
});
} else if (this.container.isEnableMongoCapabilityPresent()) {
tabs.push({
tab: SettingsV2TabTypes.IndexingPolicyTab,
content: <MongoIndexingPolicyComponent {...mongoIndexingPolicyComponentProps} />
content: <MongoIndexingPolicyComponent {...mongoIndexingPolicyComponentProps} />,
});
}
}
@@ -933,20 +933,20 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
if (this.hasConflictResolution()) {
tabs.push({
tab: SettingsV2TabTypes.ConflictResolutionTab,
content: <ConflictResolutionComponent {...conflictResolutionPolicyComponentProps} />
content: <ConflictResolutionComponent {...conflictResolutionPolicyComponentProps} />,
});
}
const pivotProps: IPivotProps = {
onLinkClick: this.onPivotChange,
selectedKey: SettingsV2TabTypes[this.state.selectedTab]
selectedKey: SettingsV2TabTypes[this.state.selectedTab],
};
const pivotItems = tabs.map(tab => {
const pivotItems = tabs.map((tab) => {
const pivotItemProps: IPivotItemProps = {
itemKey: SettingsV2TabTypes[tab.tab],
style: { marginTop: 20 },
headerText: getTabTitle(tab.tab)
headerText: getTabTitle(tab.tab),
};
return (

View File

@@ -22,7 +22,7 @@ import {
renderMongoIndexTransformationRefreshMessage,
ManualEstimatedSpendingDisplayProps,
PriceBreakdown,
getRuPriceBreakdown
getRuPriceBreakdown,
} from "./SettingsRenderUtils";
class SettingsRenderUtilsTestComponent extends React.Component {
@@ -31,15 +31,15 @@ class SettingsRenderUtilsTestComponent extends React.Component {
{ key: "costType", name: "", fieldName: "costType", minWidth: 100, maxWidth: 200, isResizable: true },
{ key: "hourly", name: "Hourly", fieldName: "hourly", minWidth: 100, maxWidth: 200, isResizable: true },
{ key: "daily", name: "Daily", fieldName: "daily", minWidth: 100, maxWidth: 200, isResizable: true },
{ key: "monthly", name: "Monthly", fieldName: "monthly", minWidth: 100, maxWidth: 200, isResizable: true }
{ key: "monthly", name: "Monthly", fieldName: "monthly", minWidth: 100, maxWidth: 200, isResizable: true },
];
const estimatedSpendingItems: ManualEstimatedSpendingDisplayProps[] = [
{
costType: <Text>Current Cost</Text>,
hourly: <Text>$ 1.02</Text>,
daily: <Text>$ 24.48</Text>,
monthly: <Text>$ 744.6</Text>
}
monthly: <Text>$ 744.6</Text>,
},
];
const priceBreakdown: PriceBreakdown = {
hourlyPrice: 1.02,
@@ -47,7 +47,7 @@ class SettingsRenderUtilsTestComponent extends React.Component {
monthlyPrice: 744.6,
pricePerRu: 0.00051,
currency: "RMB",
currencySign: "¥"
currencySign: "¥",
};
return (

View File

@@ -9,7 +9,7 @@ import {
getMultimasterMultiplier,
computeRUUsagePriceHourly,
getPricePerRu,
estimatedCostDisclaimer
estimatedCostDisclaimer,
} from "../../../Utils/PricingUtils";
import {
ITextFieldStyles,
@@ -38,7 +38,7 @@ import {
DetailsListLayoutMode,
IDetailsRowProps,
DetailsRow,
IDetailsColumnStyles
IDetailsColumnStyles,
} from "office-ui-fabric-react";
import { isDirtyTypes, isDirty } from "./SettingsUtils";
@@ -71,49 +71,49 @@ export const infoAndToolTipTextStyle: ITextStyles = { root: { fontSize: 14 } };
export const noLeftPaddingCheckBoxStyle: ICheckboxStyles = {
label: {
margin: 0,
padding: "2 0 2 0"
padding: "2 0 2 0",
},
text: {
fontSize: 12
}
fontSize: 12,
},
};
export const subComponentStackProps: Partial<IStackProps> = {
tokens: { childrenGap: 20 }
tokens: { childrenGap: 20 },
};
export const titleAndInputStackProps: Partial<IStackProps> = {
tokens: { childrenGap: 5 }
tokens: { childrenGap: 5 },
};
export const mongoWarningStackProps: Partial<IStackProps> = {
tokens: { childrenGap: 5 }
tokens: { childrenGap: 5 },
};
export const mongoErrorMessageStyles: Partial<IMessageBarStyles> = { root: { marginLeft: 10 } };
export const createAndAddMongoIndexStackProps: Partial<IStackProps> = {
tokens: { childrenGap: 5 }
tokens: { childrenGap: 5 },
};
export const addMongoIndexStackProps: Partial<IStackProps> = {
tokens: { childrenGap: 10 }
tokens: { childrenGap: 10 },
};
export const checkBoxAndInputStackProps: Partial<IStackProps> = {
tokens: { childrenGap: 10 }
tokens: { childrenGap: 10 },
};
export const toolTipLabelStackTokens: IStackTokens = {
childrenGap: 6
childrenGap: 6,
};
export const accordionStackTokens: IStackTokens = {
childrenGap: 10
childrenGap: 10,
};
export const addMongoIndexSubElementsTokens: IStackTokens = {
childrenGap: 20
childrenGap: 20,
};
export const accordionIconStyles: IIconStyles = { root: { paddingTop: 7 } };
@@ -128,30 +128,30 @@ export const transparentDetailsRowStyles: Partial<IDetailsRowStyles> = {
root: {
selectors: {
":hover": {
background: "transparent"
}
}
}
background: "transparent",
},
},
},
};
export const transparentDetailsHeaderStyle: Partial<IDetailsColumnStyles> = {
root: {
selectors: {
":hover": {
background: "transparent"
}
}
}
background: "transparent",
},
},
},
};
export const customDetailsListStyles: Partial<IDetailsListStyles> = {
root: {
selectors: {
".ms-FocusZone": {
paddingTop: 0
}
}
}
paddingTop: 0,
},
},
},
};
export const separatorStyles: Partial<ISeparatorStyles> = {
@@ -159,16 +159,16 @@ export const separatorStyles: Partial<ISeparatorStyles> = {
{
selectors: {
"::before": {
background: StyleConstants.BaseMedium
}
}
}
]
background: StyleConstants.BaseMedium,
},
},
},
],
};
export const messageBarStyles: Partial<IMessageBarStyles> = {
root: { marginTop: "5px", backgroundColor: "white" },
text: { fontSize: 14 }
text: { fontSize: 14 },
};
export const throughputUnit = "RU/s";
@@ -224,7 +224,7 @@ export const getRuPriceBreakdown = (
requestUnits: throughput,
numberOfRegions: numberOfRegions,
multimasterEnabled: isMultimaster,
isAutoscale: isAutoscale
isAutoscale: isAutoscale,
});
const basePricePerRu: number = isAutoscale
? getAutoscalePricePerRu(serverId, getMultimasterMultiplier(numberOfRegions, isMultimaster))
@@ -235,7 +235,7 @@ export const getRuPriceBreakdown = (
monthlyPrice: hourlyPrice * hoursInAMonth,
pricePerRu: basePricePerRu * getMultimasterMultiplier(numberOfRegions, isMultimaster),
currency: getPriceCurrency(serverId),
currencySign: getCurrencySign(serverId)
currencySign: getCurrencySign(serverId),
};
};
@@ -488,10 +488,10 @@ export const getTextFieldStyles = (current: isDirtyTypes, baseline: isDirtyTypes
selectors: {
":disabled": {
backgroundColor: StyleConstants.BaseMedium,
borderColor: StyleConstants.BaseMediumHigh
}
}
}
borderColor: StyleConstants.BaseMediumHigh,
},
},
},
});
export const getChoiceGroupStyles = (current: isDirtyTypes, baseline: isDirtyTypes): Partial<IChoiceGroupStyles> => ({
@@ -499,18 +499,18 @@ export const getChoiceGroupStyles = (current: isDirtyTypes, baseline: isDirtyTyp
{
selectors: {
".ms-ChoiceField-field.is-checked::before": {
borderColor: isDirty(current, baseline) ? StyleConstants.Dirty : ""
borderColor: isDirty(current, baseline) ? StyleConstants.Dirty : "",
},
".ms-ChoiceField-field.is-checked::after": {
borderColor: isDirty(current, baseline) ? StyleConstants.Dirty : ""
borderColor: isDirty(current, baseline) ? StyleConstants.Dirty : "",
},
".ms-ChoiceField-wrapper label": {
whiteSpace: "nowrap",
fontSize: 14,
fontFamily: StyleConstants.DataExplorerFont,
padding: "2px 5px"
}
}
}
]
padding: "2px 5px",
},
},
},
],
});

View File

@@ -25,7 +25,7 @@ describe("ConflictResolutionComponent", () => {
},
onConflictResolutionDirtyChange: () => {
return;
}
},
};
it("Sproc text field displayed", () => {

View File

@@ -7,7 +7,7 @@ import {
conflictResolutionLwwTooltip,
conflictResolutionCustomToolTip,
subComponentStackProps,
getChoiceGroupStyles
getChoiceGroupStyles,
} from "../SettingsRenderUtils";
import { TextField, ITextFieldProps, Stack, IChoiceGroupOption, ChoiceGroup } from "office-ui-fabric-react";
import { ToolTipLabelComponent } from "./ToolTipLabelComponent";
@@ -35,9 +35,9 @@ export class ConflictResolutionComponent extends React.Component<ConflictResolut
private conflictResolutionChoiceGroupOptions: IChoiceGroupOption[] = [
{
key: DataModels.ConflictResolutionMode.LastWriterWins,
text: "Last Write Wins (default)"
text: "Last Write Wins (default)",
},
{ key: DataModels.ConflictResolutionMode.Custom, text: "Merge Procedure (custom)" }
{ key: DataModels.ConflictResolutionMode.Custom, text: "Merge Procedure (custom)" },
];
componentDidMount(): void {

View File

@@ -8,7 +8,7 @@ describe("IndexingPolicyComponent", () => {
automatic: false,
indexingMode: "",
includedPaths: [],
excludedPaths: []
excludedPaths: [],
};
const baseProps: IndexingPolicyComponentProps = {
shouldDiscardIndexingPolicy: false,
@@ -27,7 +27,7 @@ describe("IndexingPolicyComponent", () => {
return;
},
indexTransformationProgress: undefined,
refreshIndexTransformationProgress: () => new Promise(jest.fn())
refreshIndexTransformationProgress: () => new Promise(jest.fn()),
};
it("renders", () => {

View File

@@ -33,7 +33,7 @@ export class IndexingPolicyComponent extends React.Component<
constructor(props: IndexingPolicyComponentProps) {
super(props);
this.state = {
indexingPolicyContentIsValid: true
indexingPolicyContentIsValid: true,
};
}
@@ -55,7 +55,7 @@ export class IndexingPolicyComponent extends React.Component<
this.createIndexingPolicyEditor();
} else {
this.indexingPolicyEditor.updateOptions({
readOnly: isIndexTransforming(this.props.indexTransformationProgress)
readOnly: isIndexTransforming(this.props.indexTransformationProgress),
});
const indexingPolicyEditorModel = this.indexingPolicyEditor.getModel();
const value: string = JSON.stringify(this.props.indexingPolicyContent, undefined, 4);
@@ -91,7 +91,7 @@ export class IndexingPolicyComponent extends React.Component<
value: value,
language: "json",
readOnly: isIndexTransforming(this.props.indexTransformationProgress),
ariaLabel: "Indexing Policy"
ariaLabel: "Indexing Policy",
});
if (this.indexingPolicyEditor) {
const indexingPolicyEditorModel = this.indexingPolicyEditor.getModel();

View File

@@ -6,7 +6,7 @@ describe("IndexingPolicyRefreshComponent", () => {
it("renders", () => {
const props: IndexingPolicyRefreshComponentProps = {
indexTransformationProgress: 90,
refreshIndexTransformationProgress: () => new Promise(jest.fn())
refreshIndexTransformationProgress: () => new Promise(jest.fn()),
};
const wrapper = shallow(<IndexingPolicyRefreshComponent {...props} />);

View File

@@ -2,7 +2,7 @@ import * as React from "react";
import { MessageBar, MessageBarType } from "office-ui-fabric-react";
import {
mongoIndexTransformationRefreshingMessage,
renderMongoIndexTransformationRefreshMessage
renderMongoIndexTransformationRefreshMessage,
} from "../../SettingsRenderUtils";
import { handleError } from "../../../../../Common/ErrorHandlingUtils";
import { isIndexTransforming } from "../../SettingsUtils";
@@ -23,7 +23,7 @@ export class IndexingPolicyRefreshComponent extends React.Component<
constructor(props: IndexingPolicyRefreshComponentProps) {
super(props);
this.state = {
isRefreshing: false
isRefreshing: false,
};
}

View File

@@ -15,7 +15,7 @@ describe("AddMongoIndexComponent", () => {
},
onDiscard: () => {
return;
}
},
};
const wrapper = shallow(<AddMongoIndexComponent {...props} />);

View File

@@ -7,21 +7,21 @@ import {
TextField,
Dropdown,
IDropdownOption,
ITextField
ITextField,
} from "office-ui-fabric-react";
import {
addMongoIndexSubElementsTokens,
mongoErrorMessageStyles,
mongoWarningStackProps,
shortWidthDropDownStyles,
shortWidthTextFieldStyles
shortWidthTextFieldStyles,
} from "../../SettingsRenderUtils";
import {
getMongoIndexTypeText,
MongoIndexTypes,
MongoNotificationMessage,
MongoNotificationType,
MongoWildcardPlaceHolder
MongoWildcardPlaceHolder,
} from "../../SettingsUtils";
export interface AddMongoIndexComponentProps {
@@ -39,7 +39,7 @@ export class AddMongoIndexComponent extends React.Component<AddMongoIndexCompone
private indexTypes: IDropdownOption[] = [MongoIndexTypes.Single, MongoIndexTypes.Wildcard].map(
(value: MongoIndexTypes) => ({
text: getMongoIndexTypeText(value),
key: value
key: value,
})
);

View File

@@ -28,7 +28,7 @@ describe("MongoIndexingPolicyComponent", () => {
},
onMongoIndexingPolicyDiscardableChange: () => {
return;
}
},
};
it("renders", () => {
@@ -55,24 +55,24 @@ describe("MongoIndexingPolicyComponent", () => {
false,
false,
true,
sampleWarning
sampleWarning,
],
[
{ type: MongoNotificationType.Error, message: sampleError } as MongoNotificationMessage,
false,
false,
true,
undefined
undefined,
],
[
{ type: MongoNotificationType.Error, message: sampleError } as MongoNotificationMessage,
true,
false,
true,
undefined
undefined,
],
[undefined, false, true, true, undefined],
[undefined, true, true, true, undefined]
[undefined, true, true, true, undefined],
];
test.each(cases)(
@@ -87,7 +87,7 @@ describe("MongoIndexingPolicyComponent", () => {
const addMongoIndexProps = {
mongoIndex: { key: { keys: ["sampleKey"] } },
type: MongoIndexTypes.Single,
notification: notification
notification: notification,
};
let indexesToDrop: number[] = [];

View File

@@ -11,7 +11,7 @@ import {
MessageBarType,
Spinner,
SpinnerSize,
Separator
Separator,
} from "office-ui-fabric-react";
import {
addMongoIndexStackProps,
@@ -23,7 +23,7 @@ import {
separatorStyles,
indexingPolicynUnsavedWarningMessage,
infoAndToolTipTextStyle,
onRenderRow
onRenderRow,
} from "../../SettingsRenderUtils";
import { MongoIndex } from "../../../../../Utils/arm/generatedClients/2020-04-01/types";
import {
@@ -33,7 +33,7 @@ import {
MongoNotificationType,
getMongoIndexType,
getMongoIndexTypeText,
isIndexTransforming
isIndexTransforming,
} from "../../SettingsUtils";
import { AddMongoIndexComponent } from "./AddMongoIndexComponent";
import { CollapsibleSectionComponent } from "../../../CollapsiblePanel/CollapsibleSectionComponent";
@@ -71,8 +71,8 @@ export class MongoIndexingPolicyComponent extends React.Component<MongoIndexingP
fieldName: "actionButton",
minWidth: 100,
maxWidth: 200,
isResizable: true
}
isResizable: true,
},
];
private indexesToBeDroppedColumns: IColumn[] = [
@@ -84,8 +84,8 @@ export class MongoIndexingPolicyComponent extends React.Component<MongoIndexingP
fieldName: "actionButton",
minWidth: 100,
maxWidth: 200,
isResizable: true
}
isResizable: true,
},
];
componentDidUpdate(prevProps: MongoIndexingPolicyComponentProps): void {
@@ -114,7 +114,7 @@ export class MongoIndexingPolicyComponent extends React.Component<MongoIndexingP
return false;
}
const addErrorsExist = !!this.props.indexesToAdd.find(addMongoIndexProps => addMongoIndexProps.notification);
const addErrorsExist = !!this.props.indexesToAdd.find((addMongoIndexProps) => addMongoIndexProps.notification);
if (addErrorsExist) {
return false;
@@ -129,7 +129,7 @@ export class MongoIndexingPolicyComponent extends React.Component<MongoIndexingP
public getMongoWarningNotificationMessage = (): JSX.Element => {
const warningMessage = this.props.indexesToAdd.find(
addMongoIndexProps => addMongoIndexProps.notification?.type === MongoNotificationType.Warning
(addMongoIndexProps) => addMongoIndexProps.notification?.type === MongoNotificationType.Warning
)?.notification.message;
if (warningMessage) {
@@ -172,7 +172,7 @@ export class MongoIndexingPolicyComponent extends React.Component<MongoIndexingP
mongoIndexDisplayProps = {
definition: <Text>{definition}</Text>,
type: <Text>{getMongoIndexTypeText(type)}</Text>,
actionButton: definition === MongoIndexIdField ? <></> : this.getActionButton(arrayPosition, isCurrentIndex)
actionButton: definition === MongoIndexIdField ? <></> : this.getActionButton(arrayPosition, isCurrentIndex),
};
}
return mongoIndexDisplayProps;

View File

@@ -40,8 +40,8 @@ describe("ScaleComponent", () => {
return;
},
initialNotification: {
description: `Throughput update for ${targetThroughput} ${throughputUnit}`
} as DataModels.Notification
description: `Throughput update for ${targetThroughput} ${throughputUnit}`,
} as DataModels.Notification,
};
it("renders with correct initial notification", () => {
@@ -59,12 +59,12 @@ describe("ScaleComponent", () => {
autoscaleMaxThroughput: maxThroughput,
minimumThroughput: 400,
id: "offer",
offerReplacePending: true
offerReplacePending: true,
});
const newProps = {
...baseProps,
initialNotification: undefined as DataModels.Notification,
collection: newCollection
collection: newCollection,
};
wrapper = shallow(<ScaleComponent {...newProps} />);
expect(wrapper.exists("#throughputApplyShortDelayMessage")).toEqual(true);
@@ -95,10 +95,10 @@ describe("ScaleComponent", () => {
capabilities: [
{
name: Constants.CapabilityNames.EnableAutoScale.toLowerCase(),
description: undefined
}
]
}
description: undefined,
},
],
},
});
const props = { ...baseProps, container: newContainer };
const scaleComponent = new ScaleComponent(props);

View File

@@ -12,7 +12,7 @@ import {
throughputUnit,
getThroughputApplyLongDelayMessage,
getThroughputApplyShortDelayMessage,
updateThroughputBeyondLimitWarningMessage
updateThroughputBeyondLimitWarningMessage,
} from "../SettingsRenderUtils";
import { hasDatabaseSharedThroughput } from "../SettingsUtils";
import * as AutoPilotUtils from "../../../../Utils/AutoPilotUtils";

View File

@@ -54,7 +54,7 @@ describe("SubSettingsComponent", () => {
},
onSubSettingsDiscardableChange: () => {
return;
}
},
};
it("renders", () => {

View File

@@ -9,7 +9,7 @@ import {
TtlOn,
TtlOff,
TtlOnNoDefault,
getSanitizedInputValue
getSanitizedInputValue,
} from "../SettingsUtils";
import Explorer from "../../../Explorer";
import { Int32 } from "../../../Panes/Tables/Validators/EntityPropertyValidationCommon";
@@ -21,7 +21,7 @@ import {
titleAndInputStackProps,
getChoiceGroupStyles,
ttlWarning,
messageBarStyles
messageBarStyles,
} from "../SettingsRenderUtils";
import { ToolTipLabelComponent } from "./ToolTipLabelComponent";
@@ -119,7 +119,7 @@ export class SubSettingsComponent extends React.Component<SubSettingsComponentPr
private ttlChoiceGroupOptions: IChoiceGroupOption[] = [
{ key: TtlType.Off, text: "Off" },
{ key: TtlType.OnNoDefault, text: "On (no default)" },
{ key: TtlType.On, text: "On" }
{ key: TtlType.On, text: "On" },
];
public getTtlValue = (value: string): TtlType => {
@@ -207,7 +207,7 @@ export class SubSettingsComponent extends React.Component<SubSettingsComponentPr
private analyticalTtlChoiceGroupOptions: IChoiceGroupOption[] = [
{ key: TtlType.Off, text: "Off", disabled: true },
{ key: TtlType.OnNoDefault, text: "On (no default)" },
{ key: TtlType.On, text: "On" }
{ key: TtlType.On, text: "On" },
];
private getAnalyticalStorageTtlComponent = (): JSX.Element => (
@@ -244,7 +244,7 @@ export class SubSettingsComponent extends React.Component<SubSettingsComponentPr
private geoSpatialConfigTypeChoiceGroupOptions: IChoiceGroupOption[] = [
{ key: GeospatialConfigType.Geography, text: "Geography" },
{ key: GeospatialConfigType.Geometry, text: "Geometry" }
{ key: GeospatialConfigType.Geometry, text: "Geometry" },
];
private getGeoSpatialComponent = (): JSX.Element => (
@@ -260,7 +260,7 @@ export class SubSettingsComponent extends React.Component<SubSettingsComponentPr
private changeFeedChoiceGroupOptions: IChoiceGroupOption[] = [
{ key: ChangeFeedPolicyState.Off, text: "Off" },
{ key: ChangeFeedPolicyState.On, text: "On" }
{ key: ChangeFeedPolicyState.On, text: "On" },
];
private getChangeFeedComponent = (): JSX.Element => {

View File

@@ -2,7 +2,7 @@ import { shallow } from "enzyme";
import React from "react";
import {
ThroughputInputAutoPilotV3Component,
ThroughputInputAutoPilotV3Props
ThroughputInputAutoPilotV3Props,
} from "./ThroughputInputAutoPilotV3Component";
import * as DataModels from "../../../../../Contracts/DataModels";
@@ -43,7 +43,7 @@ describe("ThroughputInputAutoPilotV3Component", () => {
onScaleDiscardableChange: () => {
return;
},
getThroughputWarningMessage: () => undefined
getThroughputWarningMessage: () => undefined,
};
it("throughput input visible", () => {

View File

@@ -16,7 +16,7 @@ import {
AutoscaleEstimatedSpendingDisplayProps,
PriceBreakdown,
getRuPriceBreakdown,
transparentDetailsHeaderStyle
transparentDetailsHeaderStyle,
} from "../../SettingsRenderUtils";
import {
Text,
@@ -29,7 +29,7 @@ import {
Link,
MessageBar,
FontIcon,
IColumn
IColumn,
} from "office-ui-fabric-react";
import { ToolTipLabelComponent } from "../ToolTipLabelComponent";
import { getSanitizedInputValue, IsComponentDirtyResult, isDirty } from "../../SettingsUtils";
@@ -95,7 +95,7 @@ export class ThroughputInputAutoPilotV3Component extends React.Component<
private autoPilotInputMaxValue: number;
private options: IChoiceGroupOption[] = [
{ key: "true", text: "Autoscale" },
{ key: "false", text: "Manual" }
{ key: "false", text: "Manual" },
];
componentDidMount(): void {
@@ -157,7 +157,7 @@ export class ThroughputInputAutoPilotV3Component extends React.Component<
this.state = {
spendAckChecked: this.props.spendAckChecked,
exceedFreeTierThroughput:
this.props.isFreeTierAccount && !this.props.isAutoPilotSelected && this.props.throughput > 400
this.props.isFreeTierAccount && !this.props.isAutoPilotSelected && this.props.throughput > 400,
};
this.step = this.props.step ?? ThroughputInputAutoPilotV3Component.defaultStep;
@@ -224,7 +224,7 @@ export class ThroughputInputAutoPilotV3Component extends React.Component<
minWidth: 100,
maxWidth: 200,
isResizable: true,
styles: transparentDetailsHeaderStyle
styles: transparentDetailsHeaderStyle,
},
{
key: "minPerMonth",
@@ -233,7 +233,7 @@ export class ThroughputInputAutoPilotV3Component extends React.Component<
minWidth: 100,
maxWidth: 200,
isResizable: true,
styles: transparentDetailsHeaderStyle
styles: transparentDetailsHeaderStyle,
},
{
key: "maxPerMonth",
@@ -242,8 +242,8 @@ export class ThroughputInputAutoPilotV3Component extends React.Component<
minWidth: 100,
maxWidth: 200,
isResizable: true,
styles: transparentDetailsHeaderStyle
}
styles: transparentDetailsHeaderStyle,
},
];
const estimatedSpendingItems: AutoscaleEstimatedSpendingDisplayProps[] = [
{
@@ -257,8 +257,8 @@ export class ThroughputInputAutoPilotV3Component extends React.Component<
<Text>
{prices.currencySign} {calculateEstimateNumber(prices.monthlyPrice)}
</Text>
)
}
),
},
];
if (newThroughput) {
@@ -288,7 +288,7 @@ export class ThroughputInputAutoPilotV3Component extends React.Component<
{newPrices.currencySign} {calculateEstimateNumber(newPrices.monthlyPrice)}
</b>
</Text>
)
),
});
}
@@ -318,7 +318,7 @@ export class ThroughputInputAutoPilotV3Component extends React.Component<
minWidth: 100,
maxWidth: 200,
isResizable: true,
styles: transparentDetailsHeaderStyle
styles: transparentDetailsHeaderStyle,
},
{
key: "hourly",
@@ -327,7 +327,7 @@ export class ThroughputInputAutoPilotV3Component extends React.Component<
minWidth: 100,
maxWidth: 200,
isResizable: true,
styles: transparentDetailsHeaderStyle
styles: transparentDetailsHeaderStyle,
},
{
key: "daily",
@@ -336,7 +336,7 @@ export class ThroughputInputAutoPilotV3Component extends React.Component<
minWidth: 100,
maxWidth: 200,
isResizable: true,
styles: transparentDetailsHeaderStyle
styles: transparentDetailsHeaderStyle,
},
{
key: "monthly",
@@ -345,8 +345,8 @@ export class ThroughputInputAutoPilotV3Component extends React.Component<
minWidth: 100,
maxWidth: 200,
isResizable: true,
styles: transparentDetailsHeaderStyle
}
styles: transparentDetailsHeaderStyle,
},
];
const estimatedSpendingItems: ManualEstimatedSpendingDisplayProps[] = [
{
@@ -365,8 +365,8 @@ export class ThroughputInputAutoPilotV3Component extends React.Component<
<Text>
{prices.currencySign} {calculateEstimateNumber(prices.monthlyPrice)}
</Text>
)
}
),
},
];
if (newThroughput) {
@@ -403,7 +403,7 @@ export class ThroughputInputAutoPilotV3Component extends React.Component<
{newPrices.currencySign} {calculateEstimateNumber(newPrices.monthlyPrice)}
</b>
</Text>
)
),
});
}
@@ -462,7 +462,7 @@ export class ThroughputInputAutoPilotV3Component extends React.Component<
databaseName: this.props.databaseName,
collectionName: this.props.collectionName,
apiKind: userContext.defaultExperience,
dataExplorerArea: "Scale Tab V2"
dataExplorerArea: "Scale Tab V2",
});
};

View File

@@ -5,7 +5,7 @@ import { ToolTipLabelComponent, ToolTipLabelComponentProps } from "./ToolTipLabe
describe("ToolTipLabelComponent", () => {
const props: ToolTipLabelComponentProps = {
label: "sample tool tip label",
toolTipElement: <span>sample tool tip text</span>
toolTipElement: <span>sample tool tip text</span>,
};
it("renders", () => {

View File

@@ -13,7 +13,7 @@ import {
getMongoIndexTypeText,
SingleFieldText,
WildcardText,
isIndexTransforming
isIndexTransforming,
} from "./SettingsUtils";
import * as DataModels from "../../../Contracts/DataModels";
import * as ViewModels from "../../../Contracts/ViewModels";
@@ -45,7 +45,7 @@ describe("SettingsUtils", () => {
onDeleteDatabaseContextMenuClick: undefined,
readSettings: undefined,
onSettingsClick: undefined,
loadOffer: undefined
loadOffer: undefined,
} as ViewModels.Database;
};
newCollection.offer(undefined);
@@ -67,7 +67,7 @@ describe("SettingsUtils", () => {
automatic: true,
indexingMode: "consistent",
includedPaths: [],
excludedPaths: []
excludedPaths: [],
} as DataModels.IndexingPolicy;
it("works on all types", () => {

View File

@@ -15,23 +15,23 @@ export const WildcardText = "Wildcard";
export enum ChangeFeedPolicyState {
Off = "Off",
On = "On"
On = "On",
}
export enum TtlType {
Off = "off",
On = "on",
OnNoDefault = "on-nodefault"
OnNoDefault = "on-nodefault",
}
export enum GeospatialConfigType {
Geography = "Geography",
Geometry = "Geometry"
Geometry = "Geometry",
}
export enum MongoIndexTypes {
Single = "Single",
Wildcard = "Wildcard"
Wildcard = "Wildcard",
}
export interface AddMongoIndexProps {
@@ -44,7 +44,7 @@ export enum SettingsV2TabTypes {
ScaleTab,
ConflictResolutionTab,
SubSettingsTab,
IndexingPolicyTab
IndexingPolicyTab,
}
export interface IsComponentDirtyResult {
@@ -54,7 +54,7 @@ export interface IsComponentDirtyResult {
export enum MongoNotificationType {
Warning = "Warning",
Error = "Error"
Error = "Error",
}
export interface MongoNotificationMessage {
@@ -155,19 +155,19 @@ export const getMongoNotification = (description: string, type: MongoIndexTypes)
if (description && !type) {
return {
type: MongoNotificationType.Warning,
message: "Please select a type for each index."
message: "Please select a type for each index.",
};
}
if (type && (!description || description.trim().length === 0)) {
return {
type: MongoNotificationType.Error,
message: "Please enter a field name."
message: "Please enter a field name.",
};
} else if (type === MongoIndexTypes.Wildcard && description?.indexOf("$**") === -1) {
return {
type: MongoNotificationType.Error,
message: "Wildcard path is not present in the field name. Use a pattern like " + MongoWildcardPlaceHolder
message: "Wildcard path is not present in the field name. Use a pattern like " + MongoWildcardPlaceHolder,
};
}

View File

@@ -15,7 +15,7 @@ export const collection = ({
automatic: true,
indexingMode: "default",
includedPaths: [],
excludedPaths: []
excludedPaths: [],
}),
uniqueKeyPolicy: {} as DataModels.UniqueKeyPolicy,
usageSizeInKB: ko.observable(100),
@@ -24,7 +24,7 @@ export const collection = ({
manualThroughput: 10000,
minimumThroughput: 6000,
id: "offer",
offerReplacePending: false
offerReplacePending: false,
}),
conflictResolutionPolicy: ko.observable<DataModels.ConflictResolutionPolicy>(
{} as DataModels.ConflictResolutionPolicy
@@ -37,10 +37,10 @@ export const collection = ({
partitionKey: {
paths: [],
kind: "hash",
version: 2
version: 2,
},
partitionKeyProperty: "partitionKey",
readSettings: () => {
return;
}
},
} as unknown) as ViewModels.Collection;