Compare commits

..

2 Commits

Author SHA1 Message Date
Victor Meng
66a00c67ca Turn on feature flag 2023-06-19 17:50:19 -07:00
Victor Meng
8eccbd2806 Comment change 2023-06-19 17:49:48 -07:00
15 changed files with 27 additions and 74 deletions

View File

@@ -650,4 +650,4 @@ tr:hover td.nameColumnText {
.context-menu-item.icon-customize-columns { .context-menu-item.icon-customize-columns {
background-image: url(../../images/Options.svg); background-image: url(../../images/Options.svg);
} }

View File

@@ -1,6 +1,5 @@
import { DatePicker, TextField } from "@fluentui/react"; import { DatePicker, TextField } from "@fluentui/react";
import React, { FunctionComponent } from "react"; import React, { FunctionComponent } from "react";
import { attributeValueLabel } from "../Explorer/Panes/Tables/Validators/EntityTableHelper";
export interface TableEntityProps { export interface TableEntityProps {
entityValueLabel?: string; entityValueLabel?: string;
@@ -61,7 +60,6 @@ export const EntityValue: FunctionComponent<TableEntityProps> = ({
placeholder={entityValuePlaceholder} placeholder={entityValuePlaceholder}
value={typeof entityValue === "string" ? entityValue : ""} value={typeof entityValue === "string" ? entityValue : ""}
onChange={onEntityValueChange} onChange={onEntityValueChange}
ariaLabel={attributeValueLabel}
/> />
); );
}; };

View File

@@ -12,7 +12,6 @@ import {
import React, { FunctionComponent } from "react"; import React, { FunctionComponent } from "react";
import DeleteIcon from "../../images/delete.svg"; import DeleteIcon from "../../images/delete.svg";
import EditIcon from "../../images/Edit_entity.svg"; import EditIcon from "../../images/Edit_entity.svg";
import { attributeNameLabel, dataTypeLabel } from "../Explorer/Panes/Tables/Validators/EntityTableHelper";
import { CassandraType, TableType } from "../Explorer/Tables/Constants"; import { CassandraType, TableType } from "../Explorer/Tables/Constants";
import { userContext } from "../UserContext"; import { userContext } from "../UserContext";
import { EntityValue } from "./EntityValue"; import { EntityValue } from "./EntityValue";
@@ -34,10 +33,10 @@ export interface TableEntityProps {
isPropertyTypeDisable: boolean; isPropertyTypeDisable: boolean;
entityTimeValue: string; entityTimeValue: string;
isEntityValueDisable?: boolean; isEntityValueDisable?: boolean;
onDeleteEntity: () => void; onDeleteEntity?: () => void;
onEditEntity: () => void; onEditEntity?: () => void;
onEntityPropertyChange: (event: React.FormEvent<HTMLElement>, newInput?: string) => void; onEntityPropertyChange: (event: React.FormEvent<HTMLElement>, newInput?: string) => void;
onEntityTypeChange: (event: React.FormEvent<HTMLDivElement>, option?: IDropdownOption<any> | undefined) => void; onEntityTypeChange: (event: React.FormEvent<HTMLElement>, selectedParam: IDropdownOption) => void;
onEntityValueChange: (event: React.FormEvent<HTMLElement>, newInput?: string) => void; onEntityValueChange: (event: React.FormEvent<HTMLElement>, newInput?: string) => void;
onSelectDate: (date: Date | null | undefined) => void; onSelectDate: (date: Date | null | undefined) => void;
onEntityTimeValueChange: (event: React.FormEvent<HTMLElement>, newInput?: string) => void; onEntityTimeValueChange: (event: React.FormEvent<HTMLElement>, newInput?: string) => void;
@@ -114,7 +113,6 @@ export const TableEntity: FunctionComponent<TableEntityProps> = ({
value={entityProperty} value={entityProperty}
onChange={onEntityPropertyChange} onChange={onEntityPropertyChange}
required required
ariaLabel={attributeNameLabel}
/> />
<Dropdown <Dropdown
label={entityTypeLabel && entityTypeLabel} label={entityTypeLabel && entityTypeLabel}
@@ -124,7 +122,6 @@ export const TableEntity: FunctionComponent<TableEntityProps> = ({
disabled={isPropertyTypeDisable} disabled={isPropertyTypeDisable}
id="entityTypeId" id="entityTypeId"
styles={dropdownStyles} styles={dropdownStyles}
ariaLabel={dataTypeLabel}
/> />
<EntityValue <EntityValue
entityValueLabel={entityValueLabel} entityValueLabel={entityValueLabel}

View File

@@ -133,10 +133,8 @@ export class ThroughputInputAutoPilotV3Component extends React.Component<
if (isDirty(this.props.maxAutoPilotThroughput, this.props.maxAutoPilotThroughputBaseline)) { if (isDirty(this.props.maxAutoPilotThroughput, this.props.maxAutoPilotThroughputBaseline)) {
isDiscardable = true; isDiscardable = true;
if ( if (
this.props.softAllowedMaximumThroughput this.props.maxAutoPilotThroughput <= this.props.softAllowedMaximumThroughput &&
? this.props.maxAutoPilotThroughput <= this.props.softAllowedMaximumThroughput && AutoPilotUtils.isValidAutoPilotThroughput(this.props.maxAutoPilotThroughput)
AutoPilotUtils.isValidAutoPilotThroughput(this.props.maxAutoPilotThroughput)
: AutoPilotUtils.isValidAutoPilotThroughput(this.props.maxAutoPilotThroughput)
) { ) {
isSaveable = true; isSaveable = true;
} }

View File

@@ -205,7 +205,6 @@ export const NewVertexComponent: FunctionComponent<INewVertexComponentProps> = (
role="button" role="button"
onClick={onAddNewProperty} onClick={onAddNewProperty}
onKeyPress={(event: React.KeyboardEvent<HTMLSpanElement>) => onAddNewPropertyKeyPress(event)} onKeyPress={(event: React.KeyboardEvent<HTMLSpanElement>) => onAddNewPropertyKeyPress(event)}
aria-label="Add property"
> >
<img className="refreshcol rightPaneAddPropertyImg" src={AddIcon} alt="Add property" /> Add Property <img className="refreshcol rightPaneAddPropertyImg" src={AddIcon} alt="Add property" /> Add Property
</span> </span>

View File

@@ -1,18 +1,18 @@
import { Text, TextField } from "@fluentui/react"; import { Text, TextField } from "@fluentui/react";
import { useBoolean } from "@fluentui/react-hooks"; import { useBoolean } from "@fluentui/react-hooks";
import { Areas } from "Common/Constants"; import { Areas } from "Common/Constants";
import { deleteDatabase } from "Common/dataAccess/deleteDatabase";
import DeleteFeedback from "Common/DeleteFeedback"; import DeleteFeedback from "Common/DeleteFeedback";
import { getErrorMessage, getErrorStack } from "Common/ErrorHandlingUtils"; import { getErrorMessage, getErrorStack } from "Common/ErrorHandlingUtils";
import { deleteDatabase } from "Common/dataAccess/deleteDatabase";
import { Collection, Database } from "Contracts/ViewModels"; import { Collection, Database } from "Contracts/ViewModels";
import { useSidePanel } from "hooks/useSidePanel";
import { useTabs } from "hooks/useTabs";
import React, { FunctionComponent, useState } from "react";
import { DefaultExperienceUtility } from "Shared/DefaultExperienceUtility"; import { DefaultExperienceUtility } from "Shared/DefaultExperienceUtility";
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";
import { userContext } from "UserContext"; import { userContext } from "UserContext";
import { logConsoleError } from "Utils/NotificationConsoleUtils"; import { logConsoleError } from "Utils/NotificationConsoleUtils";
import { useSidePanel } from "hooks/useSidePanel";
import { useTabs } from "hooks/useTabs";
import React, { FunctionComponent, useState } from "react";
import { useDatabases } from "../useDatabases"; import { useDatabases } from "../useDatabases";
import { useSelectedNode } from "../useSelectedNode"; import { useSelectedNode } from "../useSelectedNode";
import { PanelInfoErrorComponent, PanelInfoErrorProps } from "./PanelInfoErrorComponent"; import { PanelInfoErrorComponent, PanelInfoErrorProps } from "./PanelInfoErrorComponent";
@@ -36,13 +36,8 @@ export const DeleteDatabaseConfirmationPanel: FunctionComponent<DeleteDatabaseCo
const submit = async (): Promise<void> => { const submit = async (): Promise<void> => {
if (selectedDatabase?.id() && databaseInput !== selectedDatabase.id()) { if (selectedDatabase?.id() && databaseInput !== selectedDatabase.id()) {
setFormError( setFormError("Input database name does not match the selected database");
`Input database name "${databaseInput}" does not match the selected database "${selectedDatabase.id()}"`
);
logConsoleError(`Error while deleting collection ${selectedDatabase && selectedDatabase.id()}`); logConsoleError(`Error while deleting collection ${selectedDatabase && selectedDatabase.id()}`);
logConsoleError(
`Input database name "${databaseInput}" does not match the selected database "${selectedDatabase.id()}"`
);
return; return;
} }
setFormError(""); setFormError("");

View File

@@ -295,9 +295,8 @@ export const AddTableEntityPanel: FunctionComponent<AddTableEntityPanelProps> =
className="addButtonEntiy" className="addButtonEntiy"
tabIndex={0} tabIndex={0}
onKeyPress={handlekeypressaddentity} onKeyPress={handlekeypressaddentity}
aria-label="Add Property"
> >
<Image {...imageProps} src={AddPropertyIcon} alt="Add Property" /> <Image {...imageProps} src={AddPropertyIcon} alt="Add Entity" />
<Text className="addNewParamStyle">{getAddButtonLabel(userContext.apiType)}</Text> <Text className="addNewParamStyle">{getAddButtonLabel(userContext.apiType)}</Text>
</Stack> </Stack>
)} )}

View File

@@ -26,7 +26,6 @@ exports[`Excute Add Table Entity Pane should render Default properly 1`] = `
className="panelMainContent" className="panelMainContent"
> >
<Stack <Stack
aria-label="Add Property"
className="addButtonEntiy" className="addButtonEntiy"
horizontal={true} horizontal={true}
onClick={[Function]} onClick={[Function]}
@@ -34,21 +33,20 @@ exports[`Excute Add Table Entity Pane should render Default properly 1`] = `
tabIndex={0} tabIndex={0}
> >
<div <div
aria-label="Add Property"
className="ms-Stack addButtonEntiy css-53" className="ms-Stack addButtonEntiy css-53"
onClick={[Function]} onClick={[Function]}
onKeyPress={[Function]} onKeyPress={[Function]}
tabIndex={0} tabIndex={0}
> >
<StyledImageBase <StyledImageBase
alt="Add Property" alt="Add Entity"
height={30} height={30}
key=".0:$.0" key=".0:$.0"
src="" src=""
width={16} width={16}
> >
<ImageBase <ImageBase
alt="Add Property" alt="Add Entity"
height={30} height={30}
src="" src=""
styles={[Function]} styles={[Function]}
@@ -337,7 +335,7 @@ exports[`Excute Add Table Entity Pane should render Default properly 1`] = `
} }
> >
<img <img
alt="Add Property" alt="Add Entity"
className="ms-Image-image ms-Image-image--portrait is-notLoaded is-fadeIn image-55" className="ms-Image-image ms-Image-image--portrait is-notLoaded is-fadeIn image-55"
key="fabricImage" key="fabricImage"
onError={[Function]} onError={[Function]}

View File

@@ -39,7 +39,6 @@ import SplitterLayout from "react-splitter-layout";
import CopilotIcon from "../../../images/Copilot.svg"; import CopilotIcon from "../../../images/Copilot.svg";
import ExecuteQueryIcon from "../../../images/ExecuteQuery.svg"; import ExecuteQueryIcon from "../../../images/ExecuteQuery.svg";
import SaveQueryIcon from "../../../images/save-cosmos.svg"; import SaveQueryIcon from "../../../images/save-cosmos.svg";
import { useTabs } from "../../hooks/useTabs";
interface QueryCopilotTabProps { interface QueryCopilotTabProps {
initialInput: string; initialInput: string;
@@ -74,7 +73,6 @@ export const QueryCopilotTab: React.FC<QueryCopilotTabProps> = ({
const generateSQLQuery = async (): Promise<void> => { const generateSQLQuery = async (): Promise<void> => {
try { try {
setIsGeneratingQuery(true); setIsGeneratingQuery(true);
useTabs.getState().setIsTabExecuting(true);
const payload = { const payload = {
containerSchema: QueryCopilotSampleContainerSchema, containerSchema: QueryCopilotSampleContainerSchema,
userPrompt: userInput, userPrompt: userInput,
@@ -89,10 +87,9 @@ export const QueryCopilotTab: React.FC<QueryCopilotTabProps> = ({
const generateSQLQueryResponse: GenerateSQLQueryResponse = await response?.json(); const generateSQLQueryResponse: GenerateSQLQueryResponse = await response?.json();
if (generateSQLQueryResponse?.sql) { if (generateSQLQueryResponse?.sql) {
let query = `-- ${userInput}\r\n`; let query = `-- **Prompt:** ${userInput}\r\n`;
if (generateSQLQueryResponse.explanation) { if (generateSQLQueryResponse.explanation) {
query += "-- **Explanation of query**\r\n"; query += `-- **Explanation of query:** ${generateSQLQueryResponse.explanation}\r\n`;
query += `-- ${generateSQLQueryResponse.explanation}\r\n`;
} }
query += generateSQLQueryResponse.sql; query += generateSQLQueryResponse.sql;
setQuery(query); setQuery(query);
@@ -103,7 +100,6 @@ export const QueryCopilotTab: React.FC<QueryCopilotTabProps> = ({
throw error; throw error;
} finally { } finally {
setIsGeneratingQuery(false); setIsGeneratingQuery(false);
useTabs.getState().setIsTabExecuting(false);
} }
}; };
@@ -122,7 +118,6 @@ export const QueryCopilotTab: React.FC<QueryCopilotTabProps> = ({
const queryDocumentsPerPage = async (firstItemIndex: number, queryIterator: MinimalQueryIterator): Promise<void> => { const queryDocumentsPerPage = async (firstItemIndex: number, queryIterator: MinimalQueryIterator): Promise<void> => {
try { try {
setIsExecuting(true); setIsExecuting(true);
useTabs.getState().setIsTabExecuting(true);
const queryResults: QueryResults = await queryPagesUntilContentPresent( const queryResults: QueryResults = await queryPagesUntilContentPresent(
firstItemIndex, firstItemIndex,
async (firstItemIndex: number) => async (firstItemIndex: number) =>
@@ -137,7 +132,6 @@ export const QueryCopilotTab: React.FC<QueryCopilotTabProps> = ({
handleError(errorMessage, "executeQueryCopilotTab"); handleError(errorMessage, "executeQueryCopilotTab");
} finally { } finally {
setIsExecuting(false); setIsExecuting(false);
useTabs.getState().setIsTabExecuting(false);
} }
}; };

View File

@@ -1,10 +1,10 @@
import { DefaultButton, IconButton, Image, Modal, PrimaryButton, Stack, Text } from "@fluentui/react"; import { DefaultButton, IconButton, Image, Modal, PrimaryButton, Stack, Text } from "@fluentui/react";
import { Action } from "Shared/Telemetry/TelemetryConstants";
import { traceSuccess } from "Shared/Telemetry/TelemetryProcessor";
import { userContext } from "UserContext";
import { useCarousel } from "hooks/useCarousel"; import { useCarousel } from "hooks/useCarousel";
import React, { useState } from "react"; import React, { useState } from "react";
import Youtube from "react-youtube"; import Youtube from "react-youtube";
import { Action } from "Shared/Telemetry/TelemetryConstants";
import { traceSuccess } from "Shared/Telemetry/TelemetryProcessor";
import { userContext } from "UserContext";
import Image1 from "../../../images/CarouselImage1.svg"; import Image1 from "../../../images/CarouselImage1.svg";
import Image2 from "../../../images/CarouselImage2.svg"; import Image2 from "../../../images/CarouselImage2.svg";
@@ -25,7 +25,7 @@ export const QuickstartCarousel: React.FC<QuickstartCarouselProps> = ({
<Stack> <Stack>
<Stack horizontal horizontalAlign="space-between" style={{ padding: 16 }}> <Stack horizontal horizontalAlign="space-between" style={{ padding: 16 }}>
<Text variant="xLarge">{getHeaderText(page)}</Text> <Text variant="xLarge">{getHeaderText(page)}</Text>
<IconButton iconProps={{ iconName: "Cancel" }} onClick={() => setPage(4)} ariaLabel="Close" /> <IconButton iconProps={{ iconName: "Cancel" }} onClick={() => setPage(4)} />
</Stack> </Stack>
{getContent(page)} {getContent(page)}
<Text variant="medium" style={{ padding: "0 16px" }}> <Text variant="medium" style={{ padding: "0 16px" }}>

View File

@@ -220,7 +220,7 @@ export default class QueryTabComponent extends React.Component<IQueryTabComponen
firstItemIndex, firstItemIndex,
queryDocuments queryDocuments
); );
this.setState({ queryResults, error: "" }); this.setState({ queryResults });
} catch (error) { } catch (error) {
this.props.tabsBaseInstance.isExecutionError(true); this.props.tabsBaseInstance.isExecutionError(true);
this.setState({ this.setState({

View File

@@ -77,13 +77,7 @@
<div class="addClause" data-bind=" "> <div class="addClause" data-bind=" ">
<div class="addClause-heading"> <div class="addClause-heading">
<span class="clause-table addClause-title"> <span class="clause-table addClause-title">
<img <img class="addclauseProperty-Img" style="margin-bottom: 5px" src="/Add-property.svg" />
class="addclauseProperty-Img"
style="margin-bottom: 5px"
src="/Add-property.svg"
alt="Add new Clause"
role="presentation"
/>
<span style="margin-left: 5px" data-bind="text: addNewClauseLine"></span> <span style="margin-left: 5px" data-bind="text: addNewClauseLine"></span>
</span> </span>
</div> </div>
@@ -125,12 +119,7 @@
aria-label="Show top results" aria-label="Show top results"
/> />
<div role="alert" aria-atomic="true" class="inline-div" data-bind="visible: isExceedingLimit"> <div role="alert" aria-atomic="true" class="inline-div" data-bind="visible: isExceedingLimit">
<img <img class="advanced-options-icon" src="/QueryBuilder/StatusWarning_16x.png" />
class="advanced-options-icon"
src="/QueryBuilder/StatusWarning_16x.png"
alt="Warning"
role="presentation"
/>
<span data-bind="text: topValueLimitMessage"></span> <span data-bind="text: topValueLimitMessage"></span>
</div> </div>
</div> </div>

View File

@@ -113,7 +113,7 @@ function TabNav({ tab, active, tabKind }: { tab?: Tab; active: boolean; tabKind?
<div className="tab_Content"> <div className="tab_Content">
<span className="statusIconContainer" style={{ width: tabKind === ReactTabKind.Home ? 0 : 18 }}> <span className="statusIconContainer" style={{ width: tabKind === ReactTabKind.Home ? 0 : 18 }}>
{useObservable(tab?.isExecutionError || ko.observable(false)) && <ErrorIcon tab={tab} active={active} />} {useObservable(tab?.isExecutionError || ko.observable(false)) && <ErrorIcon tab={tab} active={active} />}
{isTabExecuting(tab, tabKind) && ( {useObservable(tab?.isExecuting || ko.observable(false)) && (
<img className="loadingIcon" title="Loading" src={loadingIcon} alt="Loading" /> <img className="loadingIcon" title="Loading" src={loadingIcon} alt="Loading" />
)} )}
</span> </span>
@@ -211,15 +211,6 @@ const onKeyPressReactTab = (e: KeyboardEvent, tabKind: ReactTabKind): void => {
} }
}; };
const isTabExecuting = (tab?: Tab, tabKind?: ReactTabKind): boolean => {
if (useObservable(tab?.isExecuting || ko.observable(false))) {
return true;
} else if (tabKind !== undefined && tabKind !== ReactTabKind.Home && useTabs.getState()?.isTabExecuting) {
return true;
}
return false;
};
const getReactTabContent = (activeReactTab: ReactTabKind, explorer: Explorer): JSX.Element => { const getReactTabContent = (activeReactTab: ReactTabKind, explorer: Explorer): JSX.Element => {
switch (activeReactTab) { switch (activeReactTab) {
case ReactTabKind.Connect: case ReactTabKind.Connect:

View File

@@ -103,7 +103,8 @@ export function extractFeatures(given = new URLSearchParams(window.location.sear
enableLegacyMongoShellV2: "true" === get("enablelegacymongoshellv2"), enableLegacyMongoShellV2: "true" === get("enablelegacymongoshellv2"),
enableLegacyMongoShellV2Debug: "true" === get("enablelegacymongoshellv2debug"), enableLegacyMongoShellV2Debug: "true" === get("enablelegacymongoshellv2debug"),
loadLegacyMongoShellFromBE: "true" === get("loadlegacymongoshellfrombe"), loadLegacyMongoShellFromBE: "true" === get("loadlegacymongoshellfrombe"),
enableCopilot: "true" === get("enablecopilot"), enableCopilot: true,
// enableCopilot: "true" === get("enablecopilot"),
}; };
} }

View File

@@ -11,7 +11,6 @@ interface TabsState {
activeReactTab: ReactTabKind | undefined; activeReactTab: ReactTabKind | undefined;
networkSettingsWarning: string; networkSettingsWarning: string;
queryCopilotTabInitialInput: string; queryCopilotTabInitialInput: string;
isTabExecuting: boolean;
activateTab: (tab: TabsBase) => void; activateTab: (tab: TabsBase) => void;
activateNewTab: (tab: TabsBase) => void; activateNewTab: (tab: TabsBase) => void;
activateReactTab: (tabkind: ReactTabKind) => void; activateReactTab: (tabkind: ReactTabKind) => void;
@@ -25,7 +24,6 @@ interface TabsState {
closeReactTab: (tabKind: ReactTabKind) => void; closeReactTab: (tabKind: ReactTabKind) => void;
setNetworkSettingsWarning: (warningMessage: string) => void; setNetworkSettingsWarning: (warningMessage: string) => void;
setQueryCopilotTabInitialInput: (input: string) => void; setQueryCopilotTabInitialInput: (input: string) => void;
setIsTabExecuting: (state: boolean) => void;
} }
export enum ReactTabKind { export enum ReactTabKind {
@@ -42,7 +40,6 @@ export const useTabs: UseStore<TabsState> = create((set, get) => ({
activeReactTab: ReactTabKind.Home, activeReactTab: ReactTabKind.Home,
networkSettingsWarning: "", networkSettingsWarning: "",
queryCopilotTabInitialInput: "", queryCopilotTabInitialInput: "",
isTabExecuting: false,
activateTab: (tab: TabsBase): void => { activateTab: (tab: TabsBase): void => {
if (get().openedTabs.some((openedTab) => openedTab.tabId === tab.tabId)) { if (get().openedTabs.some((openedTab) => openedTab.tabId === tab.tabId)) {
set({ activeTab: tab, activeReactTab: undefined }); set({ activeTab: tab, activeReactTab: undefined });
@@ -154,7 +151,4 @@ export const useTabs: UseStore<TabsState> = create((set, get) => ({
}, },
setNetworkSettingsWarning: (warningMessage: string) => set({ networkSettingsWarning: warningMessage }), setNetworkSettingsWarning: (warningMessage: string) => set({ networkSettingsWarning: warningMessage }),
setQueryCopilotTabInitialInput: (input: string) => set({ queryCopilotTabInitialInput: input }), setQueryCopilotTabInitialInput: (input: string) => set({ queryCopilotTabInitialInput: input }),
setIsTabExecuting: (state: boolean) => {
set({ isTabExecuting: state });
},
})); }));