Remove Explorer.collectionCreationDefaults (#840)
Co-authored-by: Steve Faulkner <southpolesteve@gmail.com>
This commit is contained in:
parent
6d03cec139
commit
50f83cde87
|
@ -15,6 +15,7 @@ import StoredProcedure from "../Explorer/Tree/StoredProcedure";
|
|||
import Trigger from "../Explorer/Tree/Trigger";
|
||||
import UserDefinedFunction from "../Explorer/Tree/UserDefinedFunction";
|
||||
import { SelfServeType } from "../SelfServe/SelfServeUtils";
|
||||
import { CollectionCreationDefaults } from "../UserContext";
|
||||
import { SqlTriggerResource } from "../Utils/arm/generatedClients/cosmos/types";
|
||||
import * as DataModels from "./DataModels";
|
||||
import { SubscriptionType } from "./SubscriptionType";
|
||||
|
@ -411,25 +412,6 @@ export interface SelfServeFrameInputs {
|
|||
flights?: readonly string[];
|
||||
}
|
||||
|
||||
export interface CollectionCreationDefaults {
|
||||
storage: string;
|
||||
throughput: ThroughputDefaults;
|
||||
}
|
||||
|
||||
export interface ThroughputDefaults {
|
||||
fixed: number;
|
||||
unlimited:
|
||||
| number
|
||||
| {
|
||||
collectionThreshold: number;
|
||||
lessThanOrEqualToThreshold: number;
|
||||
greatThanThreshold: number;
|
||||
};
|
||||
unlimitedmax: number;
|
||||
unlimitedmin: number;
|
||||
shared: number;
|
||||
}
|
||||
|
||||
export class MonacoEditorSettings {
|
||||
public readonly language: string;
|
||||
public readonly readOnly: boolean;
|
||||
|
|
|
@ -33,16 +33,6 @@ exports[`SettingsComponent renders 1`] = `
|
|||
"canSaveQueries": [Function],
|
||||
"closeSidePanel": undefined,
|
||||
"collapsedResourceTreeWidth": 36,
|
||||
"collectionCreationDefaults": Object {
|
||||
"storage": "100",
|
||||
"throughput": Object {
|
||||
"fixed": 400,
|
||||
"shared": 400,
|
||||
"unlimited": 400,
|
||||
"unlimitedmax": 1000000,
|
||||
"unlimitedmin": 400,
|
||||
},
|
||||
},
|
||||
"commandBarComponentAdapter": CommandBarComponentAdapter {
|
||||
"container": [Circular],
|
||||
"isNotebookTabActive": [Function],
|
||||
|
@ -136,16 +126,6 @@ exports[`SettingsComponent renders 1`] = `
|
|||
"canSaveQueries": [Function],
|
||||
"closeSidePanel": undefined,
|
||||
"collapsedResourceTreeWidth": 36,
|
||||
"collectionCreationDefaults": Object {
|
||||
"storage": "100",
|
||||
"throughput": Object {
|
||||
"fixed": 400,
|
||||
"shared": 400,
|
||||
"unlimited": 400,
|
||||
"unlimitedmax": 1000000,
|
||||
"unlimitedmin": 400,
|
||||
},
|
||||
},
|
||||
"commandBarComponentAdapter": CommandBarComponentAdapter {
|
||||
"container": [Circular],
|
||||
"isNotebookTabActive": [Function],
|
||||
|
@ -252,16 +232,6 @@ exports[`SettingsComponent renders 1`] = `
|
|||
"canSaveQueries": [Function],
|
||||
"closeSidePanel": undefined,
|
||||
"collapsedResourceTreeWidth": 36,
|
||||
"collectionCreationDefaults": Object {
|
||||
"storage": "100",
|
||||
"throughput": Object {
|
||||
"fixed": 400,
|
||||
"shared": 400,
|
||||
"unlimited": 400,
|
||||
"unlimitedmax": 1000000,
|
||||
"unlimitedmin": 400,
|
||||
},
|
||||
},
|
||||
"commandBarComponentAdapter": CommandBarComponentAdapter {
|
||||
"container": [Circular],
|
||||
"isNotebookTabActive": [Function],
|
||||
|
@ -355,16 +325,6 @@ exports[`SettingsComponent renders 1`] = `
|
|||
"canSaveQueries": [Function],
|
||||
"closeSidePanel": undefined,
|
||||
"collapsedResourceTreeWidth": 36,
|
||||
"collectionCreationDefaults": Object {
|
||||
"storage": "100",
|
||||
"throughput": Object {
|
||||
"fixed": 400,
|
||||
"shared": 400,
|
||||
"unlimited": 400,
|
||||
"unlimitedmax": 1000000,
|
||||
"unlimitedmin": 400,
|
||||
},
|
||||
},
|
||||
"commandBarComponentAdapter": CommandBarComponentAdapter {
|
||||
"container": [Circular],
|
||||
"isNotebookTabActive": [Function],
|
||||
|
|
|
@ -21,7 +21,6 @@ import { GitHubOAuthService } from "../GitHub/GitHubOAuthService";
|
|||
import { IGalleryItem, JunoClient } from "../Juno/JunoClient";
|
||||
import { NotebookWorkspaceManager } from "../NotebookWorkspaceManager/NotebookWorkspaceManager";
|
||||
import { RouteHandler } from "../RouteHandlers/RouteHandler";
|
||||
import * as SharedConstants from "../Shared/Constants";
|
||||
import { ExplorerSettings } from "../Shared/ExplorerSettings";
|
||||
import { Action, ActionModifiers } from "../Shared/Telemetry/TelemetryConstants";
|
||||
import * as TelemetryProcessor from "../Shared/Telemetry/TelemetryProcessor";
|
||||
|
@ -93,7 +92,6 @@ export interface ExplorerParams {
|
|||
export default class Explorer {
|
||||
public collapsedResourceTreeWidth: number = ExplorerMetrics.CollapsedResourceTreeWidth;
|
||||
|
||||
public collectionCreationDefaults: ViewModels.CollectionCreationDefaults = SharedConstants.CollectionCreationDefaults;
|
||||
public isFixedCollectionWithSharedThroughputSupported: ko.Computed<boolean>;
|
||||
public isServerlessEnabled: ko.Computed<boolean>;
|
||||
public isAccountReady: ko.Observable<boolean>;
|
||||
|
@ -790,9 +788,6 @@ export default class Explorer {
|
|||
if (process.env.NODE_ENV === "development") {
|
||||
sessionStorage.setItem("portalDataExplorerInitMessage", JSON.stringify(inputs));
|
||||
}
|
||||
if (inputs.defaultCollectionThroughput) {
|
||||
this.collectionCreationDefaults = inputs.defaultCollectionThroughput;
|
||||
}
|
||||
this.isAccountReady(true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,12 +28,12 @@ export const CassandraAddCollectionPane: FunctionComponent<CassandraAddCollectio
|
|||
closePanel,
|
||||
cassandraApiClient,
|
||||
}: CassandraAddCollectionPaneProps) => {
|
||||
const throughputDefaults = container.collectionCreationDefaults.throughput;
|
||||
const throughputDefaults = userContext.collectionCreationDefaults.throughput;
|
||||
const [createTableQuery, setCreateTableQuery] = useState<string>("CREATE TABLE ");
|
||||
const [keyspaceId, setKeyspaceId] = useState<string>("");
|
||||
const [tableId, setTableId] = useState<string>("");
|
||||
const [throughput, setThroughput] = useState<number>(
|
||||
AddCollectionUtility.getMaxThroughput(container.collectionCreationDefaults, container)
|
||||
AddCollectionUtility.getMaxThroughput(userContext.collectionCreationDefaults, container)
|
||||
);
|
||||
|
||||
const [isAutoPilotSelected, setIsAutoPilotSelected] = useState<boolean>(userContext.features.autoscaleDefault);
|
||||
|
|
|
@ -22,16 +22,6 @@ exports[`GitHub Repos Panel should render Default properly 1`] = `
|
|||
"canSaveQueries": [Function],
|
||||
"closeSidePanel": undefined,
|
||||
"collapsedResourceTreeWidth": 36,
|
||||
"collectionCreationDefaults": Object {
|
||||
"storage": "100",
|
||||
"throughput": Object {
|
||||
"fixed": 400,
|
||||
"shared": 400,
|
||||
"unlimited": 400,
|
||||
"unlimitedmax": 1000000,
|
||||
"unlimitedmin": 400,
|
||||
},
|
||||
},
|
||||
"commandBarComponentAdapter": CommandBarComponentAdapter {
|
||||
"container": [Circular],
|
||||
"isNotebookTabActive": [Function],
|
||||
|
|
|
@ -12,16 +12,6 @@ exports[`StringInput Pane should render Create new directory properly 1`] = `
|
|||
"canSaveQueries": [Function],
|
||||
"closeSidePanel": undefined,
|
||||
"collapsedResourceTreeWidth": 36,
|
||||
"collectionCreationDefaults": Object {
|
||||
"storage": "100",
|
||||
"throughput": Object {
|
||||
"fixed": 400,
|
||||
"shared": 400,
|
||||
"unlimited": 400,
|
||||
"unlimitedmax": 1000000,
|
||||
"unlimitedmin": 400,
|
||||
},
|
||||
},
|
||||
"commandBarComponentAdapter": CommandBarComponentAdapter {
|
||||
"container": [Circular],
|
||||
"isNotebookTabActive": [Function],
|
||||
|
|
|
@ -10,16 +10,6 @@ exports[`Delete Database Confirmation Pane submit() Should call delete database
|
|||
"canSaveQueries": [Function],
|
||||
"closeSidePanel": undefined,
|
||||
"collapsedResourceTreeWidth": 36,
|
||||
"collectionCreationDefaults": Object {
|
||||
"storage": "100",
|
||||
"throughput": Object {
|
||||
"fixed": 400,
|
||||
"shared": 400,
|
||||
"unlimited": 400,
|
||||
"unlimitedmax": 1000000,
|
||||
"unlimitedmin": 400,
|
||||
},
|
||||
},
|
||||
"commandBarComponentAdapter": CommandBarComponentAdapter {
|
||||
"container": [Circular],
|
||||
"isNotebookTabActive": [Function],
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { any } from "underscore";
|
||||
import { CollectionCreationDefaults } from "../Contracts/ViewModels";
|
||||
import Explorer from "../Explorer/Explorer";
|
||||
import { CollectionCreationDefaults } from "../UserContext";
|
||||
|
||||
export const getMaxThroughput = (defaults: CollectionCreationDefaults, container: Explorer): number => {
|
||||
const throughput = defaults.throughput.unlimited;
|
||||
|
|
|
@ -2,7 +2,25 @@ import { AuthType } from "./AuthType";
|
|||
import { DatabaseAccount } from "./Contracts/DataModels";
|
||||
import { SubscriptionType } from "./Contracts/SubscriptionType";
|
||||
import { extractFeatures, Features } from "./Platform/Hosted/extractFeatures";
|
||||
import { CollectionCreation } from "./Shared/Constants";
|
||||
import { CollectionCreation, CollectionCreationDefaults } from "./Shared/Constants";
|
||||
|
||||
interface ThroughputDefaults {
|
||||
fixed: number;
|
||||
unlimited:
|
||||
| number
|
||||
| {
|
||||
collectionThreshold: number;
|
||||
lessThanOrEqualToThreshold: number;
|
||||
greatThanThreshold: number;
|
||||
};
|
||||
unlimitedmax: number;
|
||||
unlimitedmin: number;
|
||||
shared: number;
|
||||
}
|
||||
export interface CollectionCreationDefaults {
|
||||
storage: string;
|
||||
throughput: ThroughputDefaults;
|
||||
}
|
||||
|
||||
interface UserContext {
|
||||
readonly authType?: AuthType;
|
||||
|
@ -26,6 +44,7 @@ interface UserContext {
|
|||
readonly features: Features;
|
||||
readonly addCollectionFlight: string;
|
||||
readonly hasWriteAccess: boolean;
|
||||
collectionCreationDefaults: CollectionCreationDefaults;
|
||||
}
|
||||
|
||||
export type ApiType = "SQL" | "Mongo" | "Gremlin" | "Tables" | "Cassandra";
|
||||
|
@ -43,6 +62,7 @@ const userContext: UserContext = {
|
|||
useSDKOperations,
|
||||
addCollectionFlight: CollectionCreation.DefaultAddCollectionDefaultFlight,
|
||||
subscriptionType: CollectionCreation.DefaultSubscriptionType,
|
||||
collectionCreationDefaults: CollectionCreationDefaults,
|
||||
};
|
||||
|
||||
function updateUserContext(newContext: Partial<UserContext>): void {
|
||||
|
|
|
@ -299,6 +299,7 @@ function updateContextsFromPortalMessage(inputs: DataExplorerInputsFrame) {
|
|||
portalEnv: inputs.serverId as PortalEnv,
|
||||
hasWriteAccess: inputs.hasWriteAccess ?? true,
|
||||
addCollectionFlight: inputs.addCollectionDefaultFlight || CollectionCreation.DefaultAddCollectionDefaultFlight,
|
||||
collectionCreationDefaults: inputs.defaultCollectionThroughput,
|
||||
});
|
||||
if (inputs.features) {
|
||||
Object.assign(userContext.features, extractFeatures(new URLSearchParams(inputs.features)));
|
||||
|
|
Loading…
Reference in New Issue