mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-03-06 18:07:11 +00:00
Disable query saving when read region is selected.
This commit is contained in:
parent
995917784b
commit
dc7f712636
@ -475,9 +475,6 @@ const getNewDocumentButtonState = (editorState: ViewModels.DocumentExplorerState
|
||||
switch (editorState) {
|
||||
case ViewModels.DocumentExplorerState.noDocumentSelected:
|
||||
case ViewModels.DocumentExplorerState.existingDocumentNoEdits:
|
||||
// if (!useClientWriteEnabled.getState().clientWriteEnabled) {
|
||||
// return false;
|
||||
// }
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
@ -629,7 +626,6 @@ export const DocumentsTabComponent: React.FunctionComponent<IDocumentsTabCompone
|
||||
);
|
||||
|
||||
// State
|
||||
// Subscribe to clientWriteEnabled at the component level
|
||||
const clientWriteEnabled = useClientWriteEnabled((state) => state.clientWriteEnabled);
|
||||
const [tabStateData, setTabStateData] = useState<TabDivider>(() =>
|
||||
readDocumentsTabSubComponentState<TabDivider>(SubComponentName.MainTabDivider, _collection, {
|
||||
|
@ -1,6 +1,7 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable no-console */
|
||||
import { FeedOptions, QueryOperationOptions } from "@azure/cosmos";
|
||||
import { AuthType } from "AuthType";
|
||||
import QueryError, { createMonacoErrorLocationResolver, createMonacoMarkersForQueryErrors } from "Common/QueryError";
|
||||
import { SplitterDirection } from "Common/Splitter";
|
||||
import { Platform, configContext } from "ConfigContext";
|
||||
@ -21,6 +22,7 @@ import { QueryConstants } from "Shared/Constants";
|
||||
import { LocalStorageUtility, StorageKey, getRUThreshold, ruThresholdEnabled } from "Shared/StorageUtility";
|
||||
import { Action } from "Shared/Telemetry/TelemetryConstants";
|
||||
import { Allotment } from "allotment";
|
||||
import { useClientWriteEnabled } from "hooks/useClientWriteEnabled";
|
||||
import { QueryCopilotState, useQueryCopilot } from "hooks/useQueryCopilot";
|
||||
import { TabsState, useTabs } from "hooks/useTabs";
|
||||
import React, { Fragment, createRef } from "react";
|
||||
@ -484,7 +486,9 @@ class QueryTabComponentImpl extends React.Component<QueryTabComponentImplProps,
|
||||
commandButtonLabel: label,
|
||||
ariaLabel: label,
|
||||
hasPopup: false,
|
||||
disabled: !this.saveQueryButton.enabled,
|
||||
disabled:
|
||||
!this.saveQueryButton.enabled ||
|
||||
(!useClientWriteEnabled.getState().clientWriteEnabled && userContext.authType === AuthType.AAD),
|
||||
});
|
||||
}
|
||||
|
||||
@ -696,6 +700,7 @@ class QueryTabComponentImpl extends React.Component<QueryTabComponentImplProps,
|
||||
}
|
||||
|
||||
private unsubscribeCopilotSidebar: () => void;
|
||||
private unsubscribeClientWriteEnabled: () => void;
|
||||
|
||||
componentDidMount(): void {
|
||||
useTabs.subscribe((state: TabsState) => {
|
||||
@ -712,10 +717,17 @@ class QueryTabComponentImpl extends React.Component<QueryTabComponentImplProps,
|
||||
|
||||
useCommandBar.getState().setContextButtons(this.getTabsButtons());
|
||||
document.addEventListener("keydown", this.handleCopilotKeyDown);
|
||||
|
||||
this.unsubscribeClientWriteEnabled = useClientWriteEnabled.subscribe(() => {
|
||||
useCommandBar.getState().setContextButtons(this.getTabsButtons());
|
||||
});
|
||||
}
|
||||
|
||||
componentWillUnmount(): void {
|
||||
document.removeEventListener("keydown", this.handleCopilotKeyDown);
|
||||
if (this.unsubscribeClientWriteEnabled) {
|
||||
this.unsubscribeClientWriteEnabled();
|
||||
}
|
||||
}
|
||||
|
||||
private getEditorAndQueryResult(): JSX.Element {
|
||||
|
Loading…
x
Reference in New Issue
Block a user