mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-04-21 17:17:49 +01:00
Reverse cross partition query behavior in DE Query settings pane (#1521)
Co-authored-by: Predrag Klepic <v-prklepic@microsoft.com>
This commit is contained in:
parent
e9ea887fe7
commit
ed9ee07e81
@ -141,14 +141,12 @@ export const createCollectionContextMenuButton = (
|
|||||||
return items;
|
return items;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const createSampleCollectionContextMenuButton = (
|
export const createSampleCollectionContextMenuButton = (): TreeNodeMenuItem[] => {
|
||||||
selectedCollection: ViewModels.CollectionBase
|
|
||||||
): TreeNodeMenuItem[] => {
|
|
||||||
const items: TreeNodeMenuItem[] = [];
|
const items: TreeNodeMenuItem[] = [];
|
||||||
if (userContext.apiType === "SQL") {
|
if (userContext.apiType === "SQL") {
|
||||||
items.push({
|
items.push({
|
||||||
iconSrc: AddSqlQueryIcon,
|
iconSrc: AddSqlQueryIcon,
|
||||||
onClick: () => selectedCollection && useTabs.getState().openAndActivateReactTab(ReactTabKind.QueryCopilot),
|
onClick: () => useTabs.getState().openAndActivateReactTab(ReactTabKind.QueryCopilot),
|
||||||
label: "New SQL Query",
|
label: "New SQL Query",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -2,12 +2,12 @@ import { Checkbox, ChoiceGroup, IChoiceGroupOption, SpinButton } from "@fluentui
|
|||||||
import * as Constants from "Common/Constants";
|
import * as Constants from "Common/Constants";
|
||||||
import { InfoTooltip } from "Common/Tooltip/InfoTooltip";
|
import { InfoTooltip } from "Common/Tooltip/InfoTooltip";
|
||||||
import { configContext } from "ConfigContext";
|
import { configContext } from "ConfigContext";
|
||||||
import { useSidePanel } from "hooks/useSidePanel";
|
|
||||||
import React, { FunctionComponent, MouseEvent, useState } from "react";
|
|
||||||
import { LocalStorageUtility, StorageKey } from "Shared/StorageUtility";
|
import { LocalStorageUtility, StorageKey } from "Shared/StorageUtility";
|
||||||
import * as StringUtility from "Shared/StringUtility";
|
import * as StringUtility from "Shared/StringUtility";
|
||||||
import { userContext } from "UserContext";
|
import { userContext } from "UserContext";
|
||||||
import { logConsoleInfo } from "Utils/NotificationConsoleUtils";
|
import { logConsoleInfo } from "Utils/NotificationConsoleUtils";
|
||||||
|
import { useSidePanel } from "hooks/useSidePanel";
|
||||||
|
import React, { FunctionComponent, MouseEvent, useState } from "react";
|
||||||
import { RightPaneForm, RightPaneFormProps } from "../RightPaneForm/RightPaneForm";
|
import { RightPaneForm, RightPaneFormProps } from "../RightPaneForm/RightPaneForm";
|
||||||
|
|
||||||
export const SettingsPane: FunctionComponent = () => {
|
export const SettingsPane: FunctionComponent = () => {
|
||||||
@ -29,7 +29,7 @@ export const SettingsPane: FunctionComponent = () => {
|
|||||||
const [crossPartitionQueryEnabled, setCrossPartitionQueryEnabled] = useState<boolean>(
|
const [crossPartitionQueryEnabled, setCrossPartitionQueryEnabled] = useState<boolean>(
|
||||||
LocalStorageUtility.hasItem(StorageKey.IsCrossPartitionQueryEnabled)
|
LocalStorageUtility.hasItem(StorageKey.IsCrossPartitionQueryEnabled)
|
||||||
? LocalStorageUtility.getEntryString(StorageKey.IsCrossPartitionQueryEnabled) === "true"
|
? LocalStorageUtility.getEntryString(StorageKey.IsCrossPartitionQueryEnabled) === "true"
|
||||||
: true
|
: false
|
||||||
);
|
);
|
||||||
const [graphAutoVizDisabled, setGraphAutoVizDisabled] = useState<string>(
|
const [graphAutoVizDisabled, setGraphAutoVizDisabled] = useState<string>(
|
||||||
LocalStorageUtility.hasItem(StorageKey.IsGraphAutoVizDisabled)
|
LocalStorageUtility.hasItem(StorageKey.IsGraphAutoVizDisabled)
|
||||||
|
@ -142,7 +142,7 @@ exports[`Settings Pane should render Default properly 1`] = `
|
|||||||
</div>
|
</div>
|
||||||
<StyledCheckboxBase
|
<StyledCheckboxBase
|
||||||
ariaLabel="Enable cross partition query"
|
ariaLabel="Enable cross partition query"
|
||||||
checked={true}
|
checked={false}
|
||||||
className="padding"
|
className="padding"
|
||||||
onChange={[Function]}
|
onChange={[Function]}
|
||||||
styles={
|
styles={
|
||||||
|
@ -18,7 +18,6 @@ export const WelcomeModal = ({ visible }: { visible: boolean }): JSX.Element =>
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
(
|
|
||||||
<Modal isOpen={isModalVisible} onDismiss={hideModal} isBlocking={false}>
|
<Modal isOpen={isModalVisible} onDismiss={hideModal} isBlocking={false}>
|
||||||
<Stack className="modalContentPadding">
|
<Stack className="modalContentPadding">
|
||||||
<Stack horizontal>
|
<Stack horizontal>
|
||||||
@ -110,7 +109,6 @@ export const WelcomeModal = ({ visible }: { visible: boolean }): JSX.Element =>
|
|||||||
</Stack>
|
</Stack>
|
||||||
</Stack>
|
</Stack>
|
||||||
</Modal>
|
</Modal>
|
||||||
)
|
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -294,6 +294,7 @@ export const QueryCopilotTab: React.FC<QueryCopilotTabProps> = ({
|
|||||||
generateSQLQuery();
|
generateSQLQuery();
|
||||||
}
|
}
|
||||||
showTeachingBubble();
|
showTeachingBubble();
|
||||||
|
useTabs.getState().setIsQueryErrorThrown(false);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -447,19 +448,17 @@ export const QueryCopilotTab: React.FC<QueryCopilotTabProps> = ({
|
|||||||
<Link href="" target="_blank">
|
<Link href="" target="_blank">
|
||||||
Read preview terms
|
Read preview terms
|
||||||
</Link>
|
</Link>
|
||||||
{showErrorMessageBar ? (
|
{showErrorMessageBar && (
|
||||||
<Stack style={{ backgroundColor: "#FEF0F1", padding: "4px 8px" }} horizontal verticalAlign="center">
|
<Stack style={{ backgroundColor: "#FEF0F1", padding: "4px 8px" }} horizontal verticalAlign="center">
|
||||||
<Image src={XErrorMessage} style={{ marginRight: "8px" }} />
|
<Image src={XErrorMessage} style={{ marginRight: "8px" }} />
|
||||||
<Text style={{ fontSize: 12 }}>
|
<Text style={{ fontSize: 12 }}>
|
||||||
We ran into an error and were not able to execute query. Please try again after sometime
|
We ran into an error and were not able to execute query. Please try again after sometime
|
||||||
</Text>
|
</Text>
|
||||||
</Stack>
|
</Stack>
|
||||||
) : (
|
|
||||||
<></>
|
|
||||||
)}
|
)}
|
||||||
</Text>
|
</Text>
|
||||||
|
|
||||||
{showFeedbackBar ? (
|
{showFeedbackBar && (
|
||||||
<Stack style={{ backgroundColor: "#FFF8F0", padding: "2px 8px" }} horizontal verticalAlign="center">
|
<Stack style={{ backgroundColor: "#FFF8F0", padding: "2px 8px" }} horizontal verticalAlign="center">
|
||||||
<Text style={{ fontWeight: 600, fontSize: 12 }}>Provide feedback on the query generated</Text>
|
<Text style={{ fontWeight: 600, fontSize: 12 }}>Provide feedback on the query generated</Text>
|
||||||
{showCallout && !hideFeedbackModalForLikedQueries && (
|
{showCallout && !hideFeedbackModalForLikedQueries && (
|
||||||
@ -527,8 +526,6 @@ export const QueryCopilotTab: React.FC<QueryCopilotTabProps> = ({
|
|||||||
Delete code
|
Delete code
|
||||||
</CommandBarButton>
|
</CommandBarButton>
|
||||||
</Stack>
|
</Stack>
|
||||||
) : (
|
|
||||||
<></>
|
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<Stack className="tabPaneContentContainer">
|
<Stack className="tabPaneContentContainer">
|
||||||
@ -552,9 +549,9 @@ export const QueryCopilotTab: React.FC<QueryCopilotTabProps> = ({
|
|||||||
/>
|
/>
|
||||||
</SplitterLayout>
|
</SplitterLayout>
|
||||||
</Stack>
|
</Stack>
|
||||||
<WelcomeModal visible={localStorage.getItem("hideWelcomeModal") !== "true"}></WelcomeModal>
|
<WelcomeModal visible={localStorage.getItem("hideWelcomeModal") !== "true"} />
|
||||||
{isSamplePromptsOpen ? <SamplePrompts sampleProps={sampleProps} /> : <></>}
|
{isSamplePromptsOpen && <SamplePrompts sampleProps={sampleProps} />}
|
||||||
{query !== "" && query.trim().length !== 0 ? (
|
{query !== "" && query.trim().length !== 0 && (
|
||||||
<DeletePopup
|
<DeletePopup
|
||||||
showDeletePopup={showDeletePopup}
|
showDeletePopup={showDeletePopup}
|
||||||
setShowDeletePopup={setShowDeletePopup}
|
setShowDeletePopup={setShowDeletePopup}
|
||||||
@ -562,8 +559,6 @@ export const QueryCopilotTab: React.FC<QueryCopilotTabProps> = ({
|
|||||||
clearFeedback={resetButtonState}
|
clearFeedback={resetButtonState}
|
||||||
showFeedbackBar={setShowFeedbackBar}
|
showFeedbackBar={setShowFeedbackBar}
|
||||||
/>
|
/>
|
||||||
) : (
|
|
||||||
<></>
|
|
||||||
)}
|
)}
|
||||||
<CopyPopup showCopyPopup={showCopyPopup} setShowCopyPopup={setshowCopyPopup} />
|
<CopyPopup showCopyPopup={showCopyPopup} setShowCopyPopup={setshowCopyPopup} />
|
||||||
</Stack>
|
</Stack>
|
||||||
|
@ -29,9 +29,7 @@ export const SampleDataTree = ({
|
|||||||
iconSrc: CollectionIcon,
|
iconSrc: CollectionIcon,
|
||||||
isExpanded: false,
|
isExpanded: false,
|
||||||
className: "dataResourceTree",
|
className: "dataResourceTree",
|
||||||
contextMenu: ResourceTreeContextMenuButtonFactory.createSampleCollectionContextMenuButton(
|
contextMenu: ResourceTreeContextMenuButtonFactory.createSampleCollectionContextMenuButton(),
|
||||||
sampleDataResourceTokenCollection
|
|
||||||
),
|
|
||||||
onClick: () => {
|
onClick: () => {
|
||||||
// Rewritten version of expandCollapseCollection
|
// Rewritten version of expandCollapseCollection
|
||||||
useSelectedNode.getState().setSelectedNode(sampleDataResourceTokenCollection);
|
useSelectedNode.getState().setSelectedNode(sampleDataResourceTokenCollection);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user