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