Fix scale component not showing in settings tab (#926)
This commit is contained in:
parent
db34024259
commit
c486c1193e
|
@ -16,7 +16,6 @@ import { trace, traceFailure, traceStart, traceSuccess } from "../../../Shared/T
|
||||||
import { userContext } from "../../../UserContext";
|
import { userContext } from "../../../UserContext";
|
||||||
import { MongoDBCollectionResource, MongoIndex } from "../../../Utils/arm/generatedClients/cosmos/types";
|
import { MongoDBCollectionResource, MongoIndex } from "../../../Utils/arm/generatedClients/cosmos/types";
|
||||||
import * as AutoPilotUtils from "../../../Utils/AutoPilotUtils";
|
import * as AutoPilotUtils from "../../../Utils/AutoPilotUtils";
|
||||||
import { logConsoleError } from "../../../Utils/NotificationConsoleUtils";
|
|
||||||
import { CommandButtonComponentProps } from "../../Controls/CommandButton/CommandButtonComponent";
|
import { CommandButtonComponentProps } from "../../Controls/CommandButton/CommandButtonComponent";
|
||||||
import { useCommandBar } from "../../Menus/CommandBar/CommandBarComponentAdapter";
|
import { useCommandBar } from "../../Menus/CommandBar/CommandBarComponentAdapter";
|
||||||
import { SettingsTabV2 } from "../../Tabs/SettingsTabV2";
|
import { SettingsTabV2 } from "../../Tabs/SettingsTabV2";
|
||||||
|
@ -110,7 +109,6 @@ export interface SettingsComponentState {
|
||||||
|
|
||||||
initialNotification: DataModels.Notification;
|
initialNotification: DataModels.Notification;
|
||||||
selectedTab: SettingsV2TabTypes;
|
selectedTab: SettingsV2TabTypes;
|
||||||
offerLoaded: boolean;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class SettingsComponent extends React.Component<SettingsComponentProps, SettingsComponentState> {
|
export class SettingsComponent extends React.Component<SettingsComponentProps, SettingsComponentState> {
|
||||||
|
@ -195,7 +193,6 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
|
||||||
|
|
||||||
initialNotification: undefined,
|
initialNotification: undefined,
|
||||||
selectedTab: SettingsV2TabTypes.ScaleTab,
|
selectedTab: SettingsV2TabTypes.ScaleTab,
|
||||||
offerLoaded: !!this.offer,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
this.saveSettingsButton = {
|
this.saveSettingsButton = {
|
||||||
|
@ -217,7 +214,6 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
|
||||||
if (this.isCollectionSettingsTab) {
|
if (this.isCollectionSettingsTab) {
|
||||||
this.refreshIndexTransformationProgress();
|
this.refreshIndexTransformationProgress();
|
||||||
this.loadMongoIndexes();
|
this.loadMongoIndexes();
|
||||||
this.loadCollectionOffer();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setAutoPilotStates();
|
this.setAutoPilotStates();
|
||||||
|
@ -372,34 +368,6 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
private async loadCollectionOffer() {
|
|
||||||
try {
|
|
||||||
this.props.settingsTab.isExecuting(true);
|
|
||||||
await this.collection.loadOffer();
|
|
||||||
this.props.settingsTab.tabTitle(this.collection.offer() ? "Settings" : "Scale & Settings");
|
|
||||||
this.setState({ offerLoaded: true });
|
|
||||||
} catch (error) {
|
|
||||||
this.props.settingsTab.isExecutionError(true);
|
|
||||||
const errorMessage = getErrorMessage(error);
|
|
||||||
traceFailure(
|
|
||||||
Action.Tab,
|
|
||||||
{
|
|
||||||
databaseName: this.collection.databaseId,
|
|
||||||
collectionName: this.collection.id(),
|
|
||||||
|
|
||||||
dataExplorerArea: Constants.Areas.Tab,
|
|
||||||
tabTitle: this.props.settingsTab.tabTitle,
|
|
||||||
error: errorMessage,
|
|
||||||
errorStack: getErrorStack(error),
|
|
||||||
},
|
|
||||||
this.props.settingsTab.onLoadStartKey
|
|
||||||
);
|
|
||||||
logConsoleError(`Error while fetching container settings for container ${this.collection.id()}: ${errorMessage}`);
|
|
||||||
} finally {
|
|
||||||
this.props.settingsTab.isExecuting(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private getMongoIndexesToSave = (): MongoIndex[] => {
|
private getMongoIndexesToSave = (): MongoIndex[] => {
|
||||||
let finalIndexes: MongoIndex[] = [];
|
let finalIndexes: MongoIndex[] = [];
|
||||||
this.state.currentMongoIndexes?.map((mongoIndex: MongoIndex, index: number) => {
|
this.state.currentMongoIndexes?.map((mongoIndex: MongoIndex, index: number) => {
|
||||||
|
@ -937,10 +905,6 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.state.offerLoaded) {
|
|
||||||
return <></>;
|
|
||||||
}
|
|
||||||
|
|
||||||
const subSettingsComponentProps: SubSettingsComponentProps = {
|
const subSettingsComponentProps: SubSettingsComponentProps = {
|
||||||
collection: this.collection,
|
collection: this.collection,
|
||||||
isAnalyticalStorageEnabled: this.isAnalyticalStorageEnabled,
|
isAnalyticalStorageEnabled: this.isAnalyticalStorageEnabled,
|
||||||
|
|
|
@ -558,6 +558,7 @@ export default class Collection implements ViewModels.Collection {
|
||||||
};
|
};
|
||||||
|
|
||||||
public onSettingsClick = async (): Promise<void> => {
|
public onSettingsClick = async (): Promise<void> => {
|
||||||
|
await this.loadOffer();
|
||||||
useSelectedNode.getState().setSelectedNode(this);
|
useSelectedNode.getState().setSelectedNode(this);
|
||||||
this.selectedSubnodeKind(ViewModels.CollectionTabKind.Settings);
|
this.selectedSubnodeKind(ViewModels.CollectionTabKind.Settings);
|
||||||
TelemetryProcessor.trace(Action.SelectItem, ActionModifiers.Mark, {
|
TelemetryProcessor.trace(Action.SelectItem, ActionModifiers.Mark, {
|
||||||
|
|
Loading…
Reference in New Issue