mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-20 09:20:16 +00:00
host fix
This commit is contained in:
@@ -58,18 +58,16 @@ export interface AddCollectionPanelState {
|
|||||||
errorMessage: string;
|
errorMessage: string;
|
||||||
showErrorDetails: boolean;
|
showErrorDetails: boolean;
|
||||||
isExecuting: boolean;
|
isExecuting: boolean;
|
||||||
|
newDatabaseThroughput: number;
|
||||||
|
isNewDatabaseAutoscale: boolean;
|
||||||
|
collectionThroughput: number;
|
||||||
|
isCollectionAutoscale: boolean;
|
||||||
|
isCostAcknowledged: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class AddCollectionPanel extends React.Component<AddCollectionPanelProps, AddCollectionPanelState> {
|
export class AddCollectionPanel extends React.Component<AddCollectionPanelProps, AddCollectionPanelState> {
|
||||||
private newDatabaseThroughput: number;
|
|
||||||
private isNewDatabaseAutoscale: boolean;
|
|
||||||
private collectionThroughput: number;
|
|
||||||
private isCollectionAutoscale: boolean;
|
|
||||||
private isCostAcknowledged: boolean;
|
|
||||||
|
|
||||||
constructor(props: AddCollectionPanelProps) {
|
constructor(props: AddCollectionPanelProps) {
|
||||||
super(props);
|
super(props);
|
||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
createNewDatabase: userContext.apiType !== "Tables" && !this.props.databaseId,
|
createNewDatabase: userContext.apiType !== "Tables" && !this.props.databaseId,
|
||||||
newDatabaseId: "",
|
newDatabaseId: "",
|
||||||
@@ -88,6 +86,11 @@ export class AddCollectionPanel extends React.Component<AddCollectionPanelProps,
|
|||||||
errorMessage: "",
|
errorMessage: "",
|
||||||
showErrorDetails: false,
|
showErrorDetails: false,
|
||||||
isExecuting: false,
|
isExecuting: false,
|
||||||
|
newDatabaseThroughput: undefined,
|
||||||
|
isNewDatabaseAutoscale: true,
|
||||||
|
collectionThroughput: undefined,
|
||||||
|
isCollectionAutoscale: true,
|
||||||
|
isCostAcknowledged: false,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -213,12 +216,14 @@ export class AddCollectionPanel extends React.Component<AddCollectionPanelProps,
|
|||||||
this.isFreeTierAccount() && !this.props.explorer.isFirstResourceCreated()
|
this.isFreeTierAccount() && !this.props.explorer.isFirstResourceCreated()
|
||||||
}
|
}
|
||||||
isDatabase={true}
|
isDatabase={true}
|
||||||
isAutoscaleSelected={this.isNewDatabaseAutoscale}
|
isAutoscaleSelected={this.state.isNewDatabaseAutoscale}
|
||||||
throughput={this.newDatabaseThroughput}
|
throughput={this.state.newDatabaseThroughput}
|
||||||
isSharded={this.state.isSharded}
|
isSharded={this.state.isSharded}
|
||||||
setThroughputValue={(throughput: number) => (this.newDatabaseThroughput = throughput)}
|
setThroughputValue={(throughput: number) => this.setState({ newDatabaseThroughput: throughput })}
|
||||||
setIsAutoscale={(isAutoscale: boolean) => (this.isNewDatabaseAutoscale = isAutoscale)}
|
setIsAutoscale={(isAutoscale: boolean) => this.setState({ isNewDatabaseAutoscale: isAutoscale })}
|
||||||
onCostAcknowledgeChange={(isAcknowledge: boolean) => (this.isCostAcknowledged = isAcknowledge)}
|
onCostAcknowledgeChange={(isAcknowledge: boolean) =>
|
||||||
|
this.setState({ isCostAcknowledged: isAcknowledge })
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</Stack>
|
</Stack>
|
||||||
@@ -444,13 +449,13 @@ export class AddCollectionPanel extends React.Component<AddCollectionPanelProps,
|
|||||||
this.isFreeTierAccount() && !this.props.explorer.isFirstResourceCreated()
|
this.isFreeTierAccount() && !this.props.explorer.isFirstResourceCreated()
|
||||||
}
|
}
|
||||||
isDatabase={false}
|
isDatabase={false}
|
||||||
isAutoscaleSelected={this.isCollectionAutoscale}
|
isAutoscaleSelected={this.state.isCollectionAutoscale}
|
||||||
throughput={this.collectionThroughput}
|
throughput={this.state.collectionThroughput}
|
||||||
isSharded={this.state.isSharded}
|
isSharded={this.state.isSharded}
|
||||||
setThroughputValue={(throughput: number) => (this.collectionThroughput = throughput)}
|
setThroughputValue={(throughput: number) => this.setState({ collectionThroughput: throughput })}
|
||||||
setIsAutoscale={(isAutoscale: boolean) => (this.isCollectionAutoscale = isAutoscale)}
|
setIsAutoscale={(isAutoscale: boolean) => this.setState({ isCollectionAutoscale: isAutoscale })}
|
||||||
onCostAcknowledgeChange={(isAcknowledged: boolean) => {
|
onCostAcknowledgeChange={(isAcknowledged: boolean) => {
|
||||||
this.isCostAcknowledged = isAcknowledged;
|
this.setState({ isCostAcknowledged: isAcknowledged });
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
@@ -895,9 +900,11 @@ export class AddCollectionPanel extends React.Component<AddCollectionPanelProps,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const throughput = this.state.createNewDatabase ? this.newDatabaseThroughput : this.collectionThroughput;
|
const throughput = this.state.createNewDatabase
|
||||||
if (throughput > CollectionCreation.DefaultCollectionRUs100K && !this.isCostAcknowledged) {
|
? this.state.newDatabaseThroughput
|
||||||
const errorMessage = this.isNewDatabaseAutoscale
|
: this.state.collectionThroughput;
|
||||||
|
if (throughput > CollectionCreation.DefaultCollectionRUs100K && !this.state.isCostAcknowledged) {
|
||||||
|
const errorMessage = this.state.isNewDatabaseAutoscale
|
||||||
? "Please acknowledge the estimated monthly spend."
|
? "Please acknowledge the estimated monthly spend."
|
||||||
: "Please acknowledge the estimated daily spend.";
|
: "Please acknowledge the estimated daily spend.";
|
||||||
this.setState({ errorMessage });
|
this.setState({ errorMessage });
|
||||||
@@ -980,8 +987,8 @@ export class AddCollectionPanel extends React.Component<AddCollectionPanelProps,
|
|||||||
},
|
},
|
||||||
collection: {
|
collection: {
|
||||||
id: this.state.collectionId,
|
id: this.state.collectionId,
|
||||||
throughput: this.collectionThroughput,
|
throughput: this.state.collectionThroughput,
|
||||||
isAutoscale: this.isCollectionAutoscale,
|
isAutoscale: this.state.isCollectionAutoscale,
|
||||||
partitionKey,
|
partitionKey,
|
||||||
uniqueKeyPolicy,
|
uniqueKeyPolicy,
|
||||||
collectionWithDedicatedThroughput: this.state.enableDedicatedThroughput,
|
collectionWithDedicatedThroughput: this.state.enableDedicatedThroughput,
|
||||||
@@ -999,16 +1006,16 @@ export class AddCollectionPanel extends React.Component<AddCollectionPanelProps,
|
|||||||
let offerThroughput: number;
|
let offerThroughput: number;
|
||||||
let autoPilotMaxThroughput: number;
|
let autoPilotMaxThroughput: number;
|
||||||
if (this.state.createNewDatabase) {
|
if (this.state.createNewDatabase) {
|
||||||
if (this.isNewDatabaseAutoscale) {
|
if (this.state.isNewDatabaseAutoscale) {
|
||||||
autoPilotMaxThroughput = this.newDatabaseThroughput;
|
autoPilotMaxThroughput = this.state.newDatabaseThroughput;
|
||||||
} else {
|
} else {
|
||||||
offerThroughput = this.newDatabaseThroughput;
|
offerThroughput = this.state.newDatabaseThroughput;
|
||||||
}
|
}
|
||||||
} else if (!databaseLevelThroughput) {
|
} else if (!databaseLevelThroughput) {
|
||||||
if (this.isCollectionAutoscale) {
|
if (this.state.isCollectionAutoscale) {
|
||||||
autoPilotMaxThroughput = this.collectionThroughput;
|
autoPilotMaxThroughput = this.state.collectionThroughput;
|
||||||
} else {
|
} else {
|
||||||
offerThroughput = this.collectionThroughput;
|
offerThroughput = this.state.collectionThroughput;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,9 +17,7 @@ exports[`Upload Items Pane should render Default properly 1`] = `
|
|||||||
multiple={true}
|
multiple={true}
|
||||||
onUpload={[Function]}
|
onUpload={[Function]}
|
||||||
tabIndex={0}
|
tabIndex={0}
|
||||||
tooltip="Select one or more JSON files to upload. Each file can contain a single JSON document or an array of JSON
|
tooltip="Select one or more JSON files to upload. Each file can contain a single JSON document or an array of JSON documents. The combined size of all files in an individual upload operation must be less than 2 MB. You can perform multiple upload operations for larger data sets."
|
||||||
documents. The combined size of all files in an individual upload operation must be less than 2 MB. You
|
|
||||||
can perform multiple upload operations for larger data sets."
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</RightPaneForm>
|
</RightPaneForm>
|
||||||
|
|||||||
Reference in New Issue
Block a user