diff --git a/src/Explorer/Controls/Settings/SettingsUtils.tsx b/src/Explorer/Controls/Settings/SettingsUtils.tsx index 869ae323a..7ec16fd57 100644 --- a/src/Explorer/Controls/Settings/SettingsUtils.tsx +++ b/src/Explorer/Controls/Settings/SettingsUtils.tsx @@ -66,6 +66,7 @@ export interface MongoNotificationMessage { export const hasDatabaseSharedThroughput = (collection: ViewModels.Collection): boolean => { const database: ViewModels.Database = collection.getDatabase(); + console.log(database?.isDatabaseShared(), collection.offer()); return database?.isDatabaseShared() && !collection.offer(); }; diff --git a/src/Explorer/Controls/TreeComponent/TreeComponent.tsx b/src/Explorer/Controls/TreeComponent/TreeComponent.tsx index 4cf601047..2b473cf5d 100644 --- a/src/Explorer/Controls/TreeComponent/TreeComponent.tsx +++ b/src/Explorer/Controls/TreeComponent/TreeComponent.tsx @@ -98,7 +98,11 @@ export class TreeNodeComponent extends React.Component { + await this.props.node.onExpanded(); + }, TreeNodeComponent.callbackDelayMS); } else { this.props.node.onCollapsed && setTimeout(this.props.node.onCollapsed, TreeNodeComponent.callbackDelayMS); } diff --git a/src/Explorer/Panes/__snapshots__/AddCollectionPanel.test.tsx.snap b/src/Explorer/Panes/__snapshots__/AddCollectionPanel.test.tsx.snap index 79485d550..f529c5b92 100644 --- a/src/Explorer/Panes/__snapshots__/AddCollectionPanel.test.tsx.snap +++ b/src/Explorer/Panes/__snapshots__/AddCollectionPanel.test.tsx.snap @@ -336,7 +336,8 @@ exports[`AddCollectionPanel should render Default properly 1`] = ` directionalHint={4} > -`; \ No newline at end of file +`; diff --git a/src/Explorer/Tabs/QueryTab/QueryResultSection.tsx b/src/Explorer/Tabs/QueryTab/QueryResultSection.tsx index fc93d98a1..50af221fe 100644 --- a/src/Explorer/Tabs/QueryTab/QueryResultSection.tsx +++ b/src/Explorer/Tabs/QueryTab/QueryResultSection.tsx @@ -109,6 +109,8 @@ export const QueryResultSection: React.FC = ({ : JSON.stringify(queryResults.documents, undefined, 4) : ""; + console.log("QUERY RESULT: ", queryResultsString); + const onErrorDetailsClick = (): boolean => { useNotificationConsole.getState().expandConsole(); diff --git a/src/Explorer/Tabs/QueryTab/QueryTabComponent.tsx b/src/Explorer/Tabs/QueryTab/QueryTabComponent.tsx index fa849c212..62209978c 100644 --- a/src/Explorer/Tabs/QueryTab/QueryTabComponent.tsx +++ b/src/Explorer/Tabs/QueryTab/QueryTabComponent.tsx @@ -357,6 +357,7 @@ export default class QueryTabComponent extends React.Component { if (this.isCollectionExpanded()) { return; } + const throughputCap = userContext.databaseAccount?.properties.capacity?.totalThroughputLimit; + throughputCap && throughputCap !== -1 ? await useDatabases.getState().loadAllOffers() : await this.loadOffer(); + console.log("LOADED OFFERS", this.offer()); this.isCollectionExpanded(true); + TelemetryProcessor.trace(Action.ExpandTreeNode, ActionModifiers.Mark, { description: "Collection node", @@ -576,8 +580,8 @@ export default class Collection implements ViewModels.Collection { public onSettingsClick = async (): Promise => { useSelectedNode.getState().setSelectedNode(this); - const throughputCap = userContext.databaseAccount?.properties.capacity?.totalThroughputLimit; - throughputCap && throughputCap !== -1 ? await useDatabases.getState().loadAllOffers() : await this.loadOffer(); + // const throughputCap = userContext.databaseAccount?.properties.capacity?.totalThroughputLimit; + // throughputCap && throughputCap !== -1 ? await useDatabases.getState().loadAllOffers() : await this.loadOffer(); this.selectedSubnodeKind(ViewModels.CollectionTabKind.Settings); TelemetryProcessor.trace(Action.SelectItem, ActionModifiers.Mark, { description: "Settings node", diff --git a/src/Explorer/Tree/ResourceTree.tsx b/src/Explorer/Tree/ResourceTree.tsx index b5f759534..9fb4cefff 100644 --- a/src/Explorer/Tree/ResourceTree.tsx +++ b/src/Explorer/Tree/ResourceTree.tsx @@ -1,4 +1,5 @@ import { Callout, DirectionalHint, ICalloutProps, ILinkProps, Link, Stack, Text } from "@fluentui/react"; +import { hasDatabaseSharedThroughput } from "Explorer/Controls/Settings/SettingsUtils"; import { SampleDataTree } from "Explorer/Tree/SampleDataTree"; import { getItemName } from "Utils/APITypeUtils"; import { useQueryCopilot } from "hooks/useQueryCopilot"; @@ -548,9 +549,11 @@ export const ResourceTree: React.FC = ({ container }: Resourc id = database.isDatabaseShared() ? "sampleSettings" : "sampleScaleSettings"; } + console.log("RUNNING HERE", database.id(), database.offer(), collection.id(), collection.offer()); + children.push({ id, - label: database.isDatabaseShared() || isServerlessAccount() ? "Settings" : "Scale & Settings", + label: hasDatabaseSharedThroughput(collection) || isServerlessAccount() ? "Settings" : "Scale & Settings", onClick: collection.onSettingsClick.bind(collection), isSelected: () => useSelectedNode @@ -598,6 +601,7 @@ export const ResourceTree: React.FC = ({ container }: Resourc contextMenu: ResourceTreeContextMenuButtonFactory.createCollectionContextMenuButton(container, collection), onClick: () => { // Rewritten version of expandCollapseCollection + console.log("CLICKED onClick"); useSelectedNode.getState().setSelectedNode(collection); useCommandBar.getState().setContextButtons([]); refreshActiveTab( @@ -605,13 +609,18 @@ export const ResourceTree: React.FC = ({ container }: Resourc tab.collection?.id() === collection.id() && tab.collection.databaseId === collection.databaseId, ); }, - onExpanded: () => { + onExpanded: async () => { + console.log("CLICKED onExpanded"); + await collection.expandCollection(); if (showScriptNodes) { collection.loadStoredProcedures(); collection.loadUserDefinedFunctions(); collection.loadTriggers(); } }, + onCollapsed: () => { + collection.collapseCollection(); + }, isSelected: () => useSelectedNode.getState().isDataNodeSelected(collection.databaseId, collection.id()), onContextMenuOpen: () => useSelectedNode.getState().setSelectedNode(collection), };