correct base on some suggestion

This commit is contained in:
hardiknai-techm
2021-05-07 12:51:53 +05:30
parent 0e0e6a2257
commit 8075072f76
24 changed files with 31698 additions and 2350 deletions

View File

@@ -1757,7 +1757,7 @@ input::-webkit-calendar-picker-indicator {
cursor: pointer; cursor: pointer;
} }
.contextual-pane .paneMainContent { .paneMainContent {
flex: 1; flex: 1;
padding-left: 34px; padding-left: 34px;
padding-right: 34px; padding-right: 34px;

30852
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,18 @@
import { IconButton, TooltipHost } from "@fluentui/react";
import * as React from "react";
export interface TooltipProps {
children: string;
}
const iconProps = { iconName: "Info" };
export const InfoTooltip: React.FunctionComponent = ({ children }: TooltipProps) => {
return (
<span>
<TooltipHost content={children}>
<IconButton iconProps={iconProps} ariaLabel="Info" vertical-align />
</TooltipHost>
</span>
);
};

View File

@@ -1,26 +0,0 @@
import { IButtonStyles, IconButton, ITooltipHostStyles, TooltipHost } from "@fluentui/react";
import { useId } from "@fluentui/react-hooks";
import * as React from "react";
const calloutProps = { gapSpace: 0 };
const hostStyles: Partial<ITooltipHostStyles> = { root: { display: "inline-block" } };
export interface TooltipProps {
children: string;
}
const iconButtonStyles: Partial<IButtonStyles> = { root: { marginBottom: -3 } };
const iconProps = { iconName: "Info" };
export const Tooltip: React.FunctionComponent = ({ children }: TooltipProps) => {
const tooltipId = useId("tooltip");
const iconButtonId: string = useId("iconButton");
return (
<span>
<TooltipHost content={children} id={tooltipId} calloutProps={calloutProps} styles={hostStyles}>
<IconButton id={iconButtonId} iconProps={iconProps} ariaLabel="Info" styles={iconButtonStyles} />
</TooltipHost>
</span>
);
};

View File

@@ -2,7 +2,7 @@ import { Image, Stack, TextField } from "@fluentui/react";
import React, { ChangeEvent, FunctionComponent, KeyboardEvent, useRef, useState } from "react"; import React, { ChangeEvent, FunctionComponent, KeyboardEvent, useRef, useState } from "react";
import FolderIcon from "../../../images/folder_16x16.svg"; import FolderIcon from "../../../images/folder_16x16.svg";
import * as Constants from "../Constants"; import * as Constants from "../Constants";
import { Tooltip } from "../Tooltip/Tooltip"; import { InfoTooltip } from "../Tooltip/InfoTooltip";
interface UploadProps { interface UploadProps {
label: string; label: string;
@@ -51,7 +51,7 @@ export const Upload: FunctionComponent<UploadProps> = ({
return ( return (
<div> <div>
<span className="renewUploadItemsHeader">{label}</span> <span className="renewUploadItemsHeader">{label}</span>
<Tooltip>{tooltip}</Tooltip> {tooltip && <InfoTooltip>{tooltip}</InfoTooltip>}
<Stack horizontal> <Stack horizontal>
<TextField styles={{ fieldGroup: { width: 300 } }} readOnly value={selectedFilesTitle.toString()} /> <TextField styles={{ fieldGroup: { width: 300 } }} readOnly value={selectedFilesTitle.toString()} />
<input <input

View File

@@ -1,6 +1,6 @@
import { Text } from "@fluentui/react"; import { Text } from "@fluentui/react";
import React, { FunctionComponent } from "react"; import React, { FunctionComponent } from "react";
import { Tooltip } from "../../../../Common/Tooltip/Tooltip"; import { InfoTooltip } from "../../../../Common/Tooltip/InfoTooltip";
import * as SharedConstants from "../../../../Shared/Constants"; import * as SharedConstants from "../../../../Shared/Constants";
import { userContext } from "../../../../UserContext"; import { userContext } from "../../../../UserContext";
import { import {
@@ -46,7 +46,7 @@ export const CostEstimateText: FunctionComponent<CostEstimateTextProps> = ({
? getAutoscalePricePerRu(serverId, multiplier) * multiplier ? getAutoscalePricePerRu(serverId, multiplier) * multiplier
: getPricePerRu(serverId) * multiplier; : getPricePerRu(serverId) * multiplier;
const iconWithEstimatedCostDisclaimer: JSX.Element = <Tooltip>PricingUtils.estimatedCostDisclaimer</Tooltip>; const iconWithEstimatedCostDisclaimer: JSX.Element = <InfoTooltip>PricingUtils.estimatedCostDisclaimer</InfoTooltip>;
if (isAutoscale) { if (isAutoscale) {
return ( return (

View File

@@ -11,7 +11,7 @@ import {
} from "@fluentui/react"; } from "@fluentui/react";
import React, { FunctionComponent, useState } from "react"; import React, { FunctionComponent, useState } from "react";
import * as Constants from "../../../Common/Constants"; import * as Constants from "../../../Common/Constants";
import { Tooltip } from "../../../Common/Tooltip/Tooltip"; import { InfoTooltip } from "../../../Common/Tooltip/InfoTooltip";
import * as SharedConstants from "../../../Shared/Constants"; import * as SharedConstants from "../../../Shared/Constants";
import { userContext } from "../../../UserContext"; import { userContext } from "../../../UserContext";
import { getCollectionName } from "../../../Utils/APITypeUtils"; import { getCollectionName } from "../../../Utils/APITypeUtils";
@@ -111,7 +111,7 @@ export const ThroughputInput: FunctionComponent<ThroughputInputProps> = ({
<Text variant="small" style={{ lineHeight: "20px", fontWeight: 600 }}> <Text variant="small" style={{ lineHeight: "20px", fontWeight: 600 }}>
{getThroughputLabelText()} {getThroughputLabelText()}
</Text> </Text>
<Tooltip>{PricingUtils.getRuToolTipText()}</Tooltip> <InfoTooltip>{PricingUtils.getRuToolTipText()}</InfoTooltip>
</Stack> </Stack>
<Stack horizontal verticalAlign="center"> <Stack horizontal verticalAlign="center">
@@ -137,7 +137,7 @@ export const ThroughputInput: FunctionComponent<ThroughputInputProps> = ({
<Text variant="small" style={{ lineHeight: "20px", fontWeight: 600 }} data-testid="maxRUDescription"> <Text variant="small" style={{ lineHeight: "20px", fontWeight: 600 }} data-testid="maxRUDescription">
{isDatabase ? "Database" : getCollectionName()} Max RU/s {isDatabase ? "Database" : getCollectionName()} Max RU/s
</Text> </Text>
<Tooltip>{getAutoScaleTooltip()}</Tooltip> <InfoTooltip>{getAutoScaleTooltip()}</InfoTooltip>
</Stack> </Stack>
<TextField <TextField

View File

@@ -46,35 +46,16 @@ exports[`ThroughputInput Pane should render Default properly 1`] = `
Container throughput (autoscale) Container throughput (autoscale)
</span> </span>
</Text> </Text>
<Tooltip <InfoTooltip
key=".0:$.2" key=".0:$.2"
> >
<span> <span>
<StyledTooltipHostBase <StyledTooltipHostBase
calloutProps={
Object {
"gapSpace": 0,
}
}
content="Set the throughput — Request Units per second (RU/s) — required for the workload. A read of a 1 KB document uses 1 RU. Select manual if you plan to scale RU/s yourself. Select autoscale to allow the system to scale RU/s based on usage." content="Set the throughput — Request Units per second (RU/s) — required for the workload. A read of a 1 KB document uses 1 RU. Select manual if you plan to scale RU/s yourself. Select autoscale to allow the system to scale RU/s based on usage."
id="tooltip0"
styles={
Object {
"root": Object {
"display": "inline-block",
},
}
}
> >
<TooltipHostBase <TooltipHostBase
calloutProps={
Object {
"gapSpace": 0,
}
}
content="Set the throughput — Request Units per second (RU/s) — required for the workload. A read of a 1 KB document uses 1 RU. Select manual if you plan to scale RU/s yourself. Select autoscale to allow the system to scale RU/s based on usage." content="Set the throughput — Request Units per second (RU/s) — required for the workload. A read of a 1 KB document uses 1 RU. Select manual if you plan to scale RU/s yourself. Select autoscale to allow the system to scale RU/s based on usage."
delay={1} delay={1}
id="tooltip0"
styles={[Function]} styles={[Function]}
theme={ theme={
Object { Object {
@@ -351,7 +332,7 @@ exports[`ThroughputInput Pane should render Default properly 1`] = `
} }
> >
<div <div
className="ms-TooltipHost root-37" className="ms-TooltipHost root-55"
onBlurCapture={[Function]} onBlurCapture={[Function]}
onFocusCapture={[Function]} onFocusCapture={[Function]}
onKeyDown={[Function]} onKeyDown={[Function]}
@@ -365,14 +346,7 @@ exports[`ThroughputInput Pane should render Default properly 1`] = `
"iconName": "Info", "iconName": "Info",
} }
} }
id="iconButton1" vertical-align={true}
styles={
Object {
"root": Object {
"marginBottom": -3,
},
}
}
> >
<IconButton <IconButton
ariaLabel="Info" ariaLabel="Info"
@@ -381,14 +355,6 @@ exports[`ThroughputInput Pane should render Default properly 1`] = `
"iconName": "Info", "iconName": "Info",
} }
} }
id="iconButton1"
styles={
Object {
"root": Object {
"marginBottom": -3,
},
}
}
theme={ theme={
Object { Object {
"disableGlobalClassNames": false, "disableGlobalClassNames": false,
@@ -662,6 +628,7 @@ exports[`ThroughputInput Pane should render Default properly 1`] = `
}, },
} }
} }
vertical-align={true}
> >
<BaseButton <BaseButton
ariaLabel="Info" ariaLabel="Info"
@@ -671,7 +638,6 @@ exports[`ThroughputInput Pane should render Default properly 1`] = `
"iconName": "Info", "iconName": "Info",
} }
} }
id="iconButton1"
onRenderDescription={[Function]} onRenderDescription={[Function]}
onRenderText={[Function]} onRenderText={[Function]}
split={false} split={false}
@@ -787,9 +753,6 @@ exports[`ThroughputInput Pane should render Default properly 1`] = `
"padding": "0 4px", "padding": "0 4px",
"width": "32px", "width": "32px",
}, },
Object {
"marginBottom": -3,
},
], ],
"rootChecked": Object { "rootChecked": Object {
"backgroundColor": "#edebe9", "backgroundColor": "#edebe9",
@@ -1405,12 +1368,12 @@ exports[`ThroughputInput Pane should render Default properly 1`] = `
} }
} }
variantClassName="ms-Button--icon" variantClassName="ms-Button--icon"
vertical-align={true}
> >
<button <button
aria-label="Info" aria-label="Info"
className="ms-Button ms-Button--icon root-55" className="ms-Button ms-Button--icon root-56"
data-is-focusable={true} data-is-focusable={true}
id="iconButton1"
onClick={[Function]} onClick={[Function]}
onKeyDown={[Function]} onKeyDown={[Function]}
onKeyPress={[Function]} onKeyPress={[Function]}
@@ -1420,16 +1383,16 @@ exports[`ThroughputInput Pane should render Default properly 1`] = `
type="button" type="button"
> >
<span <span
className="ms-Button-flexContainer flexContainer-56" className="ms-Button-flexContainer flexContainer-57"
data-automationid="splitbuttonprimary" data-automationid="splitbuttonprimary"
> >
<Component <Component
className="ms-Button-icon icon-58" className="ms-Button-icon icon-59"
iconName="Info" iconName="Info"
> >
<i <i
aria-hidden={true} aria-hidden={true}
className="ms-Icon root-37 css-63 ms-Button-icon icon-58" className="ms-Icon root-37 css-64 ms-Button-icon icon-59"
data-icon-name="Info" data-icon-name="Info"
style={ style={
Object { Object {
@@ -1450,7 +1413,7 @@ exports[`ThroughputInput Pane should render Default properly 1`] = `
</TooltipHostBase> </TooltipHostBase>
</StyledTooltipHostBase> </StyledTooltipHostBase>
</span> </span>
</Tooltip> </InfoTooltip>
</div> </div>
</Stack> </Stack>
<Stack <Stack
@@ -1458,7 +1421,7 @@ exports[`ThroughputInput Pane should render Default properly 1`] = `
verticalAlign="center" verticalAlign="center"
> >
<div <div
className="ms-Stack css-64" className="ms-Stack css-65"
> >
<StyledChoiceGroup <StyledChoiceGroup
aria-label="mode" aria-label="mode"
@@ -1771,7 +1734,7 @@ exports[`ThroughputInput Pane should render Default properly 1`] = `
> >
<div <div
aria-label="mode" aria-label="mode"
className="ms-ChoiceFieldGroup root-65" className="ms-ChoiceFieldGroup root-66"
> >
<div <div
role="radiogroup" role="radiogroup"
@@ -1782,11 +1745,11 @@ exports[`ThroughputInput Pane should render Default properly 1`] = `
<StyledChoiceGroupOption <StyledChoiceGroupOption
checked={true} checked={true}
focused={false} focused={false}
id="ChoiceGroup6-true" id="ChoiceGroup4-true"
itemKey="true" itemKey="true"
key="true" key="true"
labelId="ChoiceGroupLabel7-true" labelId="ChoiceGroupLabel5-true"
name="ChoiceGroup6" name="ChoiceGroup4"
onBlur={[Function]} onBlur={[Function]}
onChange={[Function]} onChange={[Function]}
onFocus={[Function]} onFocus={[Function]}
@@ -1795,10 +1758,10 @@ exports[`ThroughputInput Pane should render Default properly 1`] = `
<ChoiceGroupOption <ChoiceGroupOption
checked={true} checked={true}
focused={false} focused={false}
id="ChoiceGroup6-true" id="ChoiceGroup4-true"
itemKey="true" itemKey="true"
labelId="ChoiceGroupLabel7-true" labelId="ChoiceGroupLabel5-true"
name="ChoiceGroup6" name="ChoiceGroup4"
onBlur={[Function]} onBlur={[Function]}
onChange={[Function]} onChange={[Function]}
onFocus={[Function]} onFocus={[Function]}
@@ -2079,28 +2042,28 @@ exports[`ThroughputInput Pane should render Default properly 1`] = `
} }
> >
<div <div
className="ms-ChoiceField root-66" className="ms-ChoiceField root-67"
> >
<div <div
className="ms-ChoiceField-wrapper" className="ms-ChoiceField-wrapper"
> >
<input <input
checked={true} checked={true}
className="ms-ChoiceField-input input-67" className="ms-ChoiceField-input input-68"
id="ChoiceGroup6-true" id="ChoiceGroup4-true"
name="ChoiceGroup6" name="ChoiceGroup4"
onBlur={[Function]} onBlur={[Function]}
onChange={[Function]} onChange={[Function]}
onFocus={[Function]} onFocus={[Function]}
type="radio" type="radio"
/> />
<label <label
className="ms-ChoiceField-field is-checked field-68" className="ms-ChoiceField-field is-checked field-69"
htmlFor="ChoiceGroup6-true" htmlFor="ChoiceGroup4-true"
> >
<span <span
className="ms-ChoiceFieldLabel" className="ms-ChoiceFieldLabel"
id="ChoiceGroupLabel7-true" id="ChoiceGroupLabel5-true"
> >
Autoscale Autoscale
</span> </span>
@@ -2112,11 +2075,11 @@ exports[`ThroughputInput Pane should render Default properly 1`] = `
<StyledChoiceGroupOption <StyledChoiceGroupOption
checked={false} checked={false}
focused={false} focused={false}
id="ChoiceGroup6-false" id="ChoiceGroup4-false"
itemKey="false" itemKey="false"
key="false" key="false"
labelId="ChoiceGroupLabel7-false" labelId="ChoiceGroupLabel5-false"
name="ChoiceGroup6" name="ChoiceGroup4"
onBlur={[Function]} onBlur={[Function]}
onChange={[Function]} onChange={[Function]}
onFocus={[Function]} onFocus={[Function]}
@@ -2125,10 +2088,10 @@ exports[`ThroughputInput Pane should render Default properly 1`] = `
<ChoiceGroupOption <ChoiceGroupOption
checked={false} checked={false}
focused={false} focused={false}
id="ChoiceGroup6-false" id="ChoiceGroup4-false"
itemKey="false" itemKey="false"
labelId="ChoiceGroupLabel7-false" labelId="ChoiceGroupLabel5-false"
name="ChoiceGroup6" name="ChoiceGroup4"
onBlur={[Function]} onBlur={[Function]}
onChange={[Function]} onChange={[Function]}
onFocus={[Function]} onFocus={[Function]}
@@ -2409,28 +2372,28 @@ exports[`ThroughputInput Pane should render Default properly 1`] = `
} }
> >
<div <div
className="ms-ChoiceField root-66" className="ms-ChoiceField root-67"
> >
<div <div
className="ms-ChoiceField-wrapper" className="ms-ChoiceField-wrapper"
> >
<input <input
checked={false} checked={false}
className="ms-ChoiceField-input input-67" className="ms-ChoiceField-input input-68"
id="ChoiceGroup6-false" id="ChoiceGroup4-false"
name="ChoiceGroup6" name="ChoiceGroup4"
onBlur={[Function]} onBlur={[Function]}
onChange={[Function]} onChange={[Function]}
onFocus={[Function]} onFocus={[Function]}
type="radio" type="radio"
/> />
<label <label
className="ms-ChoiceField-field field-73" className="ms-ChoiceField-field field-74"
htmlFor="ChoiceGroup6-false" htmlFor="ChoiceGroup4-false"
> >
<span <span
className="ms-ChoiceFieldLabel" className="ms-ChoiceFieldLabel"
id="ChoiceGroupLabel7-false" id="ChoiceGroupLabel5-false"
> >
Manual Manual
</span> </span>
@@ -2450,7 +2413,7 @@ exports[`ThroughputInput Pane should render Default properly 1`] = `
className="throughputInputSpacing" className="throughputInputSpacing"
> >
<div <div
className="ms-Stack throughputInputSpacing css-76" className="ms-Stack throughputInputSpacing css-77"
> >
<Text <Text
data-testid="ruDescription" data-testid="ruDescription"
@@ -2748,7 +2711,7 @@ exports[`ThroughputInput Pane should render Default properly 1`] = `
} }
> >
<a <a
className="ms-Link root-77" className="ms-Link root-78"
data-testid="ruDescription" data-testid="ruDescription"
href="https://cosmos.azure.com/capacitycalculator/" href="https://cosmos.azure.com/capacitycalculator/"
onClick={[Function]} onClick={[Function]}
@@ -2793,35 +2756,16 @@ exports[`ThroughputInput Pane should render Default properly 1`] = `
Max RU/s Max RU/s
</span> </span>
</Text> </Text>
<Tooltip <InfoTooltip
key=".0:$.1" key=".0:$.1"
> >
<span> <span>
<StyledTooltipHostBase <StyledTooltipHostBase
calloutProps={
Object {
"gapSpace": 0,
}
}
content="Set the max RU/s to the highest RU/s you want your container to scale to. The container will scale between 10% of max RU/s to the max RU/s based on usage." content="Set the max RU/s to the highest RU/s you want your container to scale to. The container will scale between 10% of max RU/s to the max RU/s based on usage."
id="tooltip8"
styles={
Object {
"root": Object {
"display": "inline-block",
},
}
}
> >
<TooltipHostBase <TooltipHostBase
calloutProps={
Object {
"gapSpace": 0,
}
}
content="Set the max RU/s to the highest RU/s you want your container to scale to. The container will scale between 10% of max RU/s to the max RU/s based on usage." content="Set the max RU/s to the highest RU/s you want your container to scale to. The container will scale between 10% of max RU/s to the max RU/s based on usage."
delay={1} delay={1}
id="tooltip8"
styles={[Function]} styles={[Function]}
theme={ theme={
Object { Object {
@@ -3098,7 +3042,7 @@ exports[`ThroughputInput Pane should render Default properly 1`] = `
} }
> >
<div <div
className="ms-TooltipHost root-37" className="ms-TooltipHost root-55"
onBlurCapture={[Function]} onBlurCapture={[Function]}
onFocusCapture={[Function]} onFocusCapture={[Function]}
onKeyDown={[Function]} onKeyDown={[Function]}
@@ -3112,14 +3056,7 @@ exports[`ThroughputInput Pane should render Default properly 1`] = `
"iconName": "Info", "iconName": "Info",
} }
} }
id="iconButton9" vertical-align={true}
styles={
Object {
"root": Object {
"marginBottom": -3,
},
}
}
> >
<IconButton <IconButton
ariaLabel="Info" ariaLabel="Info"
@@ -3128,14 +3065,6 @@ exports[`ThroughputInput Pane should render Default properly 1`] = `
"iconName": "Info", "iconName": "Info",
} }
} }
id="iconButton9"
styles={
Object {
"root": Object {
"marginBottom": -3,
},
}
}
theme={ theme={
Object { Object {
"disableGlobalClassNames": false, "disableGlobalClassNames": false,
@@ -3409,6 +3338,7 @@ exports[`ThroughputInput Pane should render Default properly 1`] = `
}, },
} }
} }
vertical-align={true}
> >
<BaseButton <BaseButton
ariaLabel="Info" ariaLabel="Info"
@@ -3418,7 +3348,6 @@ exports[`ThroughputInput Pane should render Default properly 1`] = `
"iconName": "Info", "iconName": "Info",
} }
} }
id="iconButton9"
onRenderDescription={[Function]} onRenderDescription={[Function]}
onRenderText={[Function]} onRenderText={[Function]}
split={false} split={false}
@@ -3534,9 +3463,6 @@ exports[`ThroughputInput Pane should render Default properly 1`] = `
"padding": "0 4px", "padding": "0 4px",
"width": "32px", "width": "32px",
}, },
Object {
"marginBottom": -3,
},
], ],
"rootChecked": Object { "rootChecked": Object {
"backgroundColor": "#edebe9", "backgroundColor": "#edebe9",
@@ -4152,12 +4078,12 @@ exports[`ThroughputInput Pane should render Default properly 1`] = `
} }
} }
variantClassName="ms-Button--icon" variantClassName="ms-Button--icon"
vertical-align={true}
> >
<button <button
aria-label="Info" aria-label="Info"
className="ms-Button ms-Button--icon root-55" className="ms-Button ms-Button--icon root-56"
data-is-focusable={true} data-is-focusable={true}
id="iconButton9"
onClick={[Function]} onClick={[Function]}
onKeyDown={[Function]} onKeyDown={[Function]}
onKeyPress={[Function]} onKeyPress={[Function]}
@@ -4167,16 +4093,16 @@ exports[`ThroughputInput Pane should render Default properly 1`] = `
type="button" type="button"
> >
<span <span
className="ms-Button-flexContainer flexContainer-56" className="ms-Button-flexContainer flexContainer-57"
data-automationid="splitbuttonprimary" data-automationid="splitbuttonprimary"
> >
<Component <Component
className="ms-Button-icon icon-58" className="ms-Button-icon icon-59"
iconName="Info" iconName="Info"
> >
<i <i
aria-hidden={true} aria-hidden={true}
className="ms-Icon root-37 css-63 ms-Button-icon icon-58" className="ms-Icon root-37 css-64 ms-Button-icon icon-59"
data-icon-name="Info" data-icon-name="Info"
style={ style={
Object { Object {
@@ -4197,7 +4123,7 @@ exports[`ThroughputInput Pane should render Default properly 1`] = `
</TooltipHostBase> </TooltipHostBase>
</StyledTooltipHostBase> </StyledTooltipHostBase>
</span> </span>
</Tooltip> </InfoTooltip>
</div> </div>
</Stack> </Stack>
<StyledTextFieldBase <StyledTextFieldBase
@@ -4510,18 +4436,18 @@ exports[`ThroughputInput Pane should render Default properly 1`] = `
value="4000" value="4000"
> >
<div <div
className="ms-TextField is-required root-79" className="ms-TextField is-required root-80"
> >
<div <div
className="ms-TextField-wrapper" className="ms-TextField-wrapper"
> >
<div <div
className="ms-TextField-fieldGroup fieldGroup-80" className="ms-TextField-fieldGroup fieldGroup-81"
> >
<input <input
aria-invalid={false} aria-invalid={false}
className="ms-TextField-field field-81" className="ms-TextField-field field-82"
id="TextField14" id="TextField10"
min={4000} min={4000}
onBlur={[Function]} onBlur={[Function]}
onChange={[Function]} onChange={[Function]}

View File

@@ -32,7 +32,7 @@ import { Action, ActionModifiers } from "../Shared/Telemetry/TelemetryConstants"
import * as TelemetryProcessor from "../Shared/Telemetry/TelemetryProcessor"; import * as TelemetryProcessor from "../Shared/Telemetry/TelemetryProcessor";
import { ArcadiaResourceManager } from "../SparkClusterManager/ArcadiaResourceManager"; import { ArcadiaResourceManager } from "../SparkClusterManager/ArcadiaResourceManager";
import { updateUserContext, userContext } from "../UserContext"; import { updateUserContext, userContext } from "../UserContext";
import { getCollectionName } from "../Utils/APITypeUtils"; import { getCollectionName, getDatabaseName, getUploadName } from "../Utils/APITypeUtils";
import { decryptJWTToken, getAuthorizationHeader } from "../Utils/AuthorizationUtils"; import { decryptJWTToken, getAuthorizationHeader } from "../Utils/AuthorizationUtils";
import { stringToBlob } from "../Utils/BlobUtils"; import { stringToBlob } from "../Utils/BlobUtils";
import { fromContentUri, toRawContentUri } from "../Utils/GitHubUtils"; import { fromContentUri, toRawContentUri } from "../Utils/GitHubUtils";
@@ -1996,7 +1996,7 @@ export default class Explorer {
public openDeleteDatabaseConfirmationPane(): void { public openDeleteDatabaseConfirmationPane(): void {
this.openSidePanel( this.openSidePanel(
"Delete Database", "Delete " + getDatabaseName(),
<DeleteDatabaseConfirmationPanel <DeleteDatabaseConfirmationPanel
explorer={this} explorer={this}
openNotificationConsole={this.expandConsole} openNotificationConsole={this.expandConsole}
@@ -2007,12 +2007,12 @@ export default class Explorer {
} }
public openUploadItemsPanePane(): void { public openUploadItemsPanePane(): void {
this.openSidePanel("Upload", <UploadItemsPane explorer={this} closePanel={this.closeSidePanel} />); this.openSidePanel("Upload " + getUploadName(), <UploadItemsPane explorer={this} />);
} }
public openSettingPane(): void { public openSettingPane(): void {
this.openSidePanel( this.openSidePanel(
"Settings", "Setting",
<SettingsPane expandConsole={() => this.expandConsole()} closePanel={this.closeSidePanel} /> <SettingsPane expandConsole={() => this.expandConsole()} closePanel={this.closeSidePanel} />
); );
} }
@@ -2046,7 +2046,7 @@ export default class Explorer {
document.getElementById("linkAddDatabase").focus(); document.getElementById("linkAddDatabase").focus();
} else { } else {
this.openSidePanel( this.openSidePanel(
"Add Database", "Add " + getDatabaseName(),
<AddDatabasePanel <AddDatabasePanel
explorer={this} explorer={this}
openNotificationConsole={this.expandConsole} openNotificationConsole={this.expandConsole}
@@ -2071,7 +2071,7 @@ export default class Explorer {
public openUploadFilePanel(parent?: NotebookContentItem): void { public openUploadFilePanel(parent?: NotebookContentItem): void {
parent = parent || this.resourceTree.myNotebooksContentRoot; parent = parent || this.resourceTree.myNotebooksContentRoot;
this.openSidePanel( this.openSidePanel(
"Upload File", "Upload file to notebook server",
<UploadFilePane <UploadFilePane
expandConsole={() => this.expandConsole()} expandConsole={() => this.expandConsole()}
closePanel={this.closeSidePanel} closePanel={this.closeSidePanel}

View File

@@ -3,7 +3,7 @@ import React, { FunctionComponent, useEffect, useState } from "react";
import * as Constants from "../../../Common/Constants"; import * as Constants from "../../../Common/Constants";
import { createDatabase } from "../../../Common/dataAccess/createDatabase"; import { createDatabase } from "../../../Common/dataAccess/createDatabase";
import { getErrorMessage, getErrorStack } from "../../../Common/ErrorHandlingUtils"; import { getErrorMessage, getErrorStack } from "../../../Common/ErrorHandlingUtils";
import { Tooltip } from "../../../Common/Tooltip/Tooltip"; import { InfoTooltip } from "../../../Common/Tooltip/InfoTooltip";
import { configContext, Platform } from "../../../ConfigContext"; import { configContext, Platform } from "../../../ConfigContext";
import * as DataModels from "../../../Contracts/DataModels"; import * as DataModels from "../../../Contracts/DataModels";
import { SubscriptionType } from "../../../Contracts/SubscriptionType"; import { SubscriptionType } from "../../../Contracts/SubscriptionType";
@@ -102,7 +102,6 @@ export const AddDatabasePanel: FunctionComponent<AddDatabasePaneProps> = ({
return true; return true;
}; };
const title: string = container?.addDatabaseText() || "New Database";
const [isExecuting, setIsExecuting] = useState<boolean>(false); const [isExecuting, setIsExecuting] = useState<boolean>(false);
useEffect(() => { useEffect(() => {
@@ -254,17 +253,13 @@ export const AddDatabasePanel: FunctionComponent<AddDatabasePaneProps> = ({
expandConsole: container.expandConsole, expandConsole: container.expandConsole,
formError: formErrors, formError: formErrors,
formErrorDetail: formErrorsDetails, formErrorDetail: formErrorsDetails,
id: "add-database-inputs",
isExecuting, isExecuting,
title,
submitButtonText: "OK", submitButtonText: "OK",
onClose: closePanel,
onSubmit: submit, onSubmit: submit,
}; };
return ( return (
<RightPaneForm {...genericPaneProps}> <RightPaneForm {...genericPaneProps}>
<form style={{ height: "100%" }}>
<div className="paneContentContainer" role="dialog" aria-labelledby="databaseTitle"> <div className="paneContentContainer" role="dialog" aria-labelledby="databaseTitle">
{showUpsellMessage && formErrors === "" && ( {showUpsellMessage && formErrors === "" && (
<PanelInfoErrorComponent <PanelInfoErrorComponent
@@ -276,13 +271,12 @@ export const AddDatabasePanel: FunctionComponent<AddDatabasePaneProps> = ({
linkText={upsellAnchorText} linkText={upsellAnchorText}
/> />
)} )}
<div className="paneMainContent"> <div className="paneMainContent">
<div> <div>
<p> <p>
<span className="mandatoryStar">*</span> <span className="mandatoryStar">*</span>
<Text variant="small">{databaseIdLabel}</Text> <Text variant="small">{databaseIdLabel}</Text>
<Tooltip>{databaseIdTooltipText}</Tooltip> <InfoTooltip>{databaseIdTooltipText}</InfoTooltip>
</p> </p>
<TextField <TextField
@@ -315,7 +309,7 @@ export const AddDatabasePanel: FunctionComponent<AddDatabasePaneProps> = ({
checked={databaseCreateNewShared} checked={databaseCreateNewShared}
onChange={() => setDatabaseCreateNewShared(!databaseCreateNewShared)} onChange={() => setDatabaseCreateNewShared(!databaseCreateNewShared)}
/>{" "} />{" "}
<Tooltip>{databaseLevelThroughputTooltipText}</Tooltip> <InfoTooltip>{databaseLevelThroughputTooltipText}</InfoTooltip>
</div> </div>
{databaseCreateNewShared && ( {databaseCreateNewShared && (
<div> <div>
@@ -343,7 +337,6 @@ export const AddDatabasePanel: FunctionComponent<AddDatabasePaneProps> = ({
</div> </div>
</div> </div>
</div> </div>
</form>
</RightPaneForm> </RightPaneForm>
); );
}; };

View File

@@ -4,20 +4,10 @@ exports[`AddDatabasePane Pane should render Default properly 1`] = `
<RightPaneForm <RightPaneForm
expandConsole={[Function]} expandConsole={[Function]}
formError="" formError=""
id="add-database-inputs"
isExecuting={false} isExecuting={false}
onClose={[Function]}
onSubmit={[Function]} onSubmit={[Function]}
submitButtonText="OK" submitButtonText="OK"
title="New Database"
> >
<form
style={
Object {
"height": "100%",
}
}
>
<div <div
aria-labelledby="databaseTitle" aria-labelledby="databaseTitle"
className="paneContentContainer" className="paneContentContainer"
@@ -46,9 +36,9 @@ exports[`AddDatabasePane Pane should render Default properly 1`] = `
> >
Database id Database id
</Text> </Text>
<Tooltip> <InfoTooltip>
A database is a logical container of one or more collections A database is a logical container of one or more collections
</Tooltip> </InfoTooltip>
</p> </p>
<StyledTextFieldBase <StyledTextFieldBase
aria-label="Database id" aria-label="Database id"
@@ -92,9 +82,9 @@ exports[`AddDatabasePane Pane should render Default properly 1`] = `
title="Provision shared throughput" title="Provision shared throughput"
/> />
<Tooltip> <InfoTooltip>
Provisioned throughput at the database level will be shared across all collections within the database. Provisioned throughput at the database level will be shared across all collections within the database.
</Tooltip> </InfoTooltip>
</div> </div>
<div> <div>
<ThroughputInput <ThroughputInput
@@ -110,6 +100,5 @@ exports[`AddDatabasePane Pane should render Default properly 1`] = `
</div> </div>
</div> </div>
</div> </div>
</form>
</RightPaneForm> </RightPaneForm>
`; `;

View File

@@ -22,11 +22,11 @@ export const PanelInfoErrorComponent: React.FunctionComponent<PanelInfoErrorProp
}: PanelInfoErrorProps): JSX.Element => { }: PanelInfoErrorProps): JSX.Element => {
let icon: JSX.Element; let icon: JSX.Element;
if (messageType === "error") { if (messageType === "error") {
icon = <Icon iconName="StatusErrorFull" className="panelErrorIcon" data-testid="errorIcon" />; icon = <Icon iconName="StatusErrorFull" className="panelErrorIcon" aria-label="error" />;
} else if (messageType === "warning") { } else if (messageType === "warning") {
icon = <Icon iconName="WarningSolid" className="panelWarningIcon" data-testid="warningIcon" />; icon = <Icon iconName="WarningSolid" className="panelWarningIcon" aria-label="warning" />;
} else if (messageType === "info") { } else if (messageType === "info") {
icon = <Icon iconName="InfoSolid" className="panelLargeInfoIcon" data-testid="InfoIcon" />; icon = <Icon iconName="InfoSolid" className="panelLargeInfoIcon" aria-label="Infomation" />;
} }
return ( return (
@@ -34,7 +34,7 @@ export const PanelInfoErrorComponent: React.FunctionComponent<PanelInfoErrorProp
<Stack className="panelInfoErrorContainer" horizontal verticalAlign="center"> <Stack className="panelInfoErrorContainer" horizontal verticalAlign="center">
{icon} {icon}
<span className="panelWarningErrorDetailsLinkContainer"> <span className="panelWarningErrorDetailsLinkContainer">
<Text className="panelWarningErrorMessage" variant="small" data-testid="panelmessage"> <Text className="panelWarningErrorMessage" variant="small" aria-label="message">
{message} {message}
{link && linkText && ( {link && linkText && (
<Link target="_blank" href={link}> <Link target="_blank" href={link}>

View File

@@ -3,20 +3,15 @@ import { mount, ReactWrapper } from "enzyme";
import React from "react"; import React from "react";
import { RightPaneForm } from "./RightPaneForm"; import { RightPaneForm } from "./RightPaneForm";
const onClose = jest.fn();
const onSubmit = jest.fn(); const onSubmit = jest.fn();
const expandConsole = jest.fn(); const expandConsole = jest.fn();
const props = { const props = {
closePanel: (): void => undefined,
expandConsole, expandConsole,
formError: "", formError: "",
formErrorDetail: "", formErrorDetail: "",
id: "loadQueryPane",
isExecuting: false, isExecuting: false,
title: "Load Query Pane",
submitButtonText: "Load", submitButtonText: "Load",
onClose,
onSubmit, onSubmit,
}; };
@@ -27,11 +22,7 @@ describe("Load Query Pane", () => {
wrapper = mount(<RightPaneForm {...props} />); wrapper = mount(<RightPaneForm {...props} />);
expect(wrapper).toMatchSnapshot(); expect(wrapper).toMatchSnapshot();
}); });
it("should call close method click cancel icon", () => {
render(<RightPaneForm {...props} />);
fireEvent.click(screen.getByTestId("closePaneBtn"));
expect(onClose).toHaveBeenCalled();
});
it("should call submit method enter in form", () => { it("should call submit method enter in form", () => {
render(<RightPaneForm {...props} />); render(<RightPaneForm {...props} />);
fireEvent.click(screen.getByTestId("submit")); fireEvent.click(screen.getByTestId("submit"));
@@ -44,7 +35,7 @@ describe("Load Query Pane", () => {
}); });
it("should render error in header", () => { it("should render error in header", () => {
render(<RightPaneForm {...props} formError="file already Exist" />); render(<RightPaneForm {...props} formError="file already Exist" />);
expect(screen.getByTestId("errorIcon")).toBeDefined(); expect(screen.getByLabelText("error")).toBeDefined();
expect(screen.getByTestId("panelmessage").innerHTML).toEqual("file already Exist"); expect(screen.getByLabelText("message").innerHTML).toEqual("file already Exist");
}); });
}); });

View File

@@ -1,6 +1,4 @@
import { IconButton } from "@fluentui/react";
import React, { FunctionComponent, ReactNode } from "react"; import React, { FunctionComponent, ReactNode } from "react";
import { KeyCodes } from "../../../Common/Constants";
import { PanelFooterComponent } from "../PanelFooterComponent"; import { PanelFooterComponent } from "../PanelFooterComponent";
import { PanelInfoErrorComponent, PanelInfoErrorProps } from "../PanelInfoErrorComponent"; import { PanelInfoErrorComponent, PanelInfoErrorProps } from "../PanelInfoErrorComponent";
import { PanelLoadingScreen } from "../PanelLoadingScreen"; import { PanelLoadingScreen } from "../PanelLoadingScreen";
@@ -9,12 +7,9 @@ export interface RightPaneFormProps {
expandConsole: () => void; expandConsole: () => void;
formError: string; formError: string;
formErrorDetail: string; formErrorDetail: string;
id: string;
isExecuting: boolean; isExecuting: boolean;
onClose: () => void;
onSubmit: () => void; onSubmit: () => void;
submitButtonText: string; submitButtonText: string;
title: string;
isSubmitButtonHidden?: boolean; isSubmitButtonHidden?: boolean;
children?: ReactNode; children?: ReactNode;
} }
@@ -23,51 +18,16 @@ export const RightPaneForm: FunctionComponent<RightPaneFormProps> = ({
expandConsole, expandConsole,
formError, formError,
formErrorDetail, formErrorDetail,
id,
isExecuting, isExecuting,
onClose,
onSubmit, onSubmit,
submitButtonText, submitButtonText,
title,
isSubmitButtonHidden = false, isSubmitButtonHidden = false,
children, children,
}: RightPaneFormProps) => { }: RightPaneFormProps) => {
const getPanelHeight = (): number => {
const notificationConsoleElement: HTMLElement = document.getElementById("explorerNotificationConsole");
return window.innerHeight - $(notificationConsoleElement).height();
};
const panelHeight: number = getPanelHeight();
const handleOnSubmit = (event: React.FormEvent<HTMLFormElement>) => { const handleOnSubmit = (event: React.FormEvent<HTMLFormElement>) => {
event.preventDefault(); event.preventDefault();
onSubmit(); onSubmit();
}; };
const renderPanelHeader = (): JSX.Element => {
return (
<div className="firstdivbg headerline">
<span id="databaseTitle" role="heading" aria-level={2}>
{title}
</span>
<IconButton
ariaLabel="Close pane"
title="Close pane"
data-testid="closePaneBtn"
onClick={onClose}
tabIndex={0}
className="closePaneBtn"
iconProps={{ iconName: "Cancel" }}
/>
</div>
);
};
const onKeyDown = (event: React.KeyboardEvent<HTMLDivElement>): void => {
if (event.keyCode === KeyCodes.Escape) {
onClose();
event.stopPropagation();
}
};
const panelInfoErrorProps: PanelInfoErrorProps = { const panelInfoErrorProps: PanelInfoErrorProps = {
messageType: "error", messageType: "error",
@@ -79,18 +39,12 @@ export const RightPaneForm: FunctionComponent<RightPaneFormProps> = ({
return ( return (
<> <>
<div className="contextual-pane-out" onClick={onClose}></div>
<div className="contextual-pane" id={id} style={{ height: panelHeight }} onKeyDown={onKeyDown}>
<div className="panelContentWrapper">
{renderPanelHeader()}
<PanelInfoErrorComponent {...panelInfoErrorProps} /> <PanelInfoErrorComponent {...panelInfoErrorProps} />
<form className="panelFormWrapper" onSubmit={handleOnSubmit}> <form className="panelFormWrapper" onSubmit={handleOnSubmit}>
{children} {children}
{!isSubmitButtonHidden && <PanelFooterComponent buttonLabel={submitButtonText} />} {!isSubmitButtonHidden && <PanelFooterComponent buttonLabel={submitButtonText} />}
</form> </form>
</div>
{isExecuting && <PanelLoadingScreen />} {isExecuting && <PanelLoadingScreen />}
</div>
</> </>
); );
}; };

View File

@@ -1,7 +1,7 @@
import { Checkbox, ChoiceGroup, IChoiceGroupOption, SpinButton } from "@fluentui/react"; import { Checkbox, ChoiceGroup, IChoiceGroupOption, SpinButton } from "@fluentui/react";
import React, { FunctionComponent, MouseEvent, useState } from "react"; import React, { FunctionComponent, MouseEvent, useState } from "react";
import * as Constants from "../../../Common/Constants"; import * as Constants from "../../../Common/Constants";
import { Tooltip } from "../../../Common/Tooltip/Tooltip"; import { InfoTooltip } from "../../../Common/Tooltip/InfoTooltip";
import { configContext } from "../../../ConfigContext"; import { configContext } from "../../../ConfigContext";
import { LocalStorageUtility, StorageKey } from "../../../Shared/StorageUtility"; import { LocalStorageUtility, StorageKey } from "../../../Shared/StorageUtility";
import * as StringUtility from "../../../Shared/StringUtility"; import * as StringUtility from "../../../Shared/StringUtility";
@@ -106,11 +106,8 @@ export const SettingsPane: FunctionComponent<SettingsPaneProps> = ({
expandConsole, expandConsole,
formError: formErrors, formError: formErrors,
formErrorDetail: "", formErrorDetail: "",
id: "settingspane",
isExecuting, isExecuting,
title: "Setting",
submitButtonText: "Apply", submitButtonText: "Apply",
onClose: () => closePanel(),
onSubmit: () => handlerOnSubmit(undefined), onSubmit: () => handlerOnSubmit(undefined),
}; };
const pageOptionList: IChoiceGroupOption[] = [ const pageOptionList: IChoiceGroupOption[] = [
@@ -134,10 +131,10 @@ export const SettingsPane: FunctionComponent<SettingsPaneProps> = ({
<div className="settingsSectionPart pageOptionsPart"> <div className="settingsSectionPart pageOptionsPart">
<div className="settingsSectionLabel"> <div className="settingsSectionLabel">
Page options Page options
<Tooltip> <InfoTooltip>
Choose Custom to specify a fixed amount of query results to show, or choose Unlimited to show as many Choose Custom to specify a fixed amount of query results to show, or choose Unlimited to show as many
query results per page. query results per page.
</Tooltip> </InfoTooltip>
</div> </div>
<ChoiceGroup selectedKey={pageOption} options={pageOptionList} onChange={handleOnPageOptionChange} /> <ChoiceGroup selectedKey={pageOption} options={pageOptionList} onChange={handleOnPageOptionChange} />
</div> </div>
@@ -146,7 +143,7 @@ export const SettingsPane: FunctionComponent<SettingsPaneProps> = ({
<div className="tabcontent"> <div className="tabcontent">
<div className="settingsSectionLabel"> <div className="settingsSectionLabel">
Query results per page Query results per page
<Tooltip>Enter the number of query results that should be shown per page.</Tooltip> <InfoTooltip>Enter the number of query results that should be shown per page.</InfoTooltip>
</div> </div>
<SpinButton <SpinButton
@@ -173,10 +170,10 @@ export const SettingsPane: FunctionComponent<SettingsPaneProps> = ({
<div className="settingsSectionPart"> <div className="settingsSectionPart">
<div className="settingsSectionLabel"> <div className="settingsSectionLabel">
Enable cross-partition query Enable cross-partition query
<Tooltip> <InfoTooltip>
Send more than one request while executing a query. More than one request is necessary if the query is Send more than one request while executing a query. More than one request is necessary if the query is
not scoped to single partition key value. not scoped to single partition key value.
</Tooltip> </InfoTooltip>
</div> </div>
<Checkbox <Checkbox
@@ -196,11 +193,11 @@ export const SettingsPane: FunctionComponent<SettingsPaneProps> = ({
<div className="settingsSectionPart"> <div className="settingsSectionPart">
<div className="settingsSectionLabel"> <div className="settingsSectionLabel">
Max degree of parallelism Max degree of parallelism
<Tooltip> <InfoTooltip>
Gets or sets the number of concurrent operations run client side during parallel query execution. A Gets or sets the number of concurrent operations run client side during parallel query execution. A
positive property value limits the number of concurrent operations to the set value. If it is set to positive property value limits the number of concurrent operations to the set value. If it is set to
less than 0, the system automatically decides the number of concurrent operations to run. less than 0, the system automatically decides the number of concurrent operations to run.
</Tooltip> </InfoTooltip>
</div> </div>
<SpinButton <SpinButton
@@ -224,10 +221,10 @@ export const SettingsPane: FunctionComponent<SettingsPaneProps> = ({
<div className="settingsSectionPart"> <div className="settingsSectionPart">
<div className="settingsSectionLabel"> <div className="settingsSectionLabel">
Display Gremlin query results as:&nbsp; Display Gremlin query results as:&nbsp;
<Tooltip> <InfoTooltip>
Select Graph to automatically visualize the query results as a Graph or JSON to display the results as Select Graph to automatically visualize the query results as a Graph or JSON to display the results as
JSON. JSON.
</Tooltip> </InfoTooltip>
</div> </div>
<ChoiceGroup <ChoiceGroup

View File

@@ -5,12 +5,9 @@ exports[`Settings Pane should render Default properly 1`] = `
expandConsole={[Function]} expandConsole={[Function]}
formError="" formError=""
formErrorDetail="" formErrorDetail=""
id="settingspane"
isExecuting={false} isExecuting={false}
onClose={[Function]}
onSubmit={[Function]} onSubmit={[Function]}
submitButtonText="Apply" submitButtonText="Apply"
title="Setting"
> >
<div <div
className="paneMainContent" className="paneMainContent"
@@ -25,9 +22,9 @@ exports[`Settings Pane should render Default properly 1`] = `
className="settingsSectionLabel" className="settingsSectionLabel"
> >
Page options Page options
<Tooltip> <InfoTooltip>
Choose Custom to specify a fixed amount of query results to show, or choose Unlimited to show as many query results per page. Choose Custom to specify a fixed amount of query results to show, or choose Unlimited to show as many query results per page.
</Tooltip> </InfoTooltip>
</div> </div>
<StyledChoiceGroup <StyledChoiceGroup
onChange={[Function]} onChange={[Function]}
@@ -56,9 +53,9 @@ exports[`Settings Pane should render Default properly 1`] = `
className="settingsSectionLabel" className="settingsSectionLabel"
> >
Query results per page Query results per page
<Tooltip> <InfoTooltip>
Enter the number of query results that should be shown per page. Enter the number of query results that should be shown per page.
</Tooltip> </InfoTooltip>
</div> </div>
<StyledSpinButton <StyledSpinButton
ariaLabel="Custom query items per page" ariaLabel="Custom query items per page"
@@ -85,9 +82,9 @@ exports[`Settings Pane should render Default properly 1`] = `
className="settingsSectionLabel" className="settingsSectionLabel"
> >
Enable cross-partition query Enable cross-partition query
<Tooltip> <InfoTooltip>
Send more than one request while executing a query. More than one request is necessary if the query is not scoped to single partition key value. Send more than one request while executing a query. More than one request is necessary if the query is not scoped to single partition key value.
</Tooltip> </InfoTooltip>
</div> </div>
<StyledCheckboxBase <StyledCheckboxBase
ariaLabel="Enable cross partition query" ariaLabel="Enable cross partition query"
@@ -114,9 +111,9 @@ exports[`Settings Pane should render Default properly 1`] = `
className="settingsSectionLabel" className="settingsSectionLabel"
> >
Max degree of parallelism Max degree of parallelism
<Tooltip> <InfoTooltip>
Gets or sets the number of concurrent operations run client side during parallel query execution. A positive property value limits the number of concurrent operations to the set value. If it is set to less than 0, the system automatically decides the number of concurrent operations to run. Gets or sets the number of concurrent operations run client side during parallel query execution. A positive property value limits the number of concurrent operations to the set value. If it is set to less than 0, the system automatically decides the number of concurrent operations to run.
</Tooltip> </InfoTooltip>
</div> </div>
<StyledSpinButton <StyledSpinButton
ariaLabel="Max degree of parallelism" ariaLabel="Max degree of parallelism"
@@ -156,12 +153,9 @@ exports[`Settings Pane should render Gremlin properly 1`] = `
expandConsole={[Function]} expandConsole={[Function]}
formError="" formError=""
formErrorDetail="" formErrorDetail=""
id="settingspane"
isExecuting={false} isExecuting={false}
onClose={[Function]}
onSubmit={[Function]} onSubmit={[Function]}
submitButtonText="Apply" submitButtonText="Apply"
title="Setting"
> >
<div <div
className="paneMainContent" className="paneMainContent"
@@ -176,9 +170,9 @@ exports[`Settings Pane should render Gremlin properly 1`] = `
className="settingsSectionLabel" className="settingsSectionLabel"
> >
Display Gremlin query results as:  Display Gremlin query results as: 
<Tooltip> <InfoTooltip>
Select Graph to automatically visualize the query results as a Graph or JSON to display the results as JSON. Select Graph to automatically visualize the query results as a Graph or JSON to display the results as JSON.
</Tooltip> </InfoTooltip>
</div> </div>
<StyledChoiceGroup <StyledChoiceGroup
aria-label="Graph Auto-visualization" aria-label="Graph Auto-visualization"

View File

@@ -15,9 +15,6 @@ export const UploadFilePane: FunctionComponent<UploadFilePanelProps> = ({
closePanel, closePanel,
uploadFile, uploadFile,
}: UploadFilePanelProps) => { }: UploadFilePanelProps) => {
const title = "Upload file to notebook server";
const submitButtonLabel = "Upload";
const selectFileInputLabel = "Select file to upload";
const extensions: string = undefined; //ex. ".ipynb" const extensions: string = undefined; //ex. ".ipynb"
const errorMessage = "Could not upload file"; const errorMessage = "Could not upload file";
const inProgressMessage = "Uploading file to notebook server"; const inProgressMessage = "Uploading file to notebook server";
@@ -39,11 +36,8 @@ export const UploadFilePane: FunctionComponent<UploadFilePanelProps> = ({
} }
const file: File = files.item(0); const file: File = files.item(0);
// const id: string = logConsoleProgress(
// `${inProgressMessage}: ${file.name}`
// );
logConsoleProgress(`${inProgressMessage}: ${file.name}`); const clearMessage = logConsoleProgress(`${inProgressMessage}: ${file.name}`);
setIsExecuting(true); setIsExecuting(true);
@@ -61,7 +55,7 @@ export const UploadFilePane: FunctionComponent<UploadFilePanelProps> = ({
) )
.finally(() => { .finally(() => {
setIsExecuting(false); setIsExecuting(false);
// clearInProgressMessageWithId(id); clearMessage();
}); });
}; };
@@ -92,18 +86,15 @@ export const UploadFilePane: FunctionComponent<UploadFilePanelProps> = ({
expandConsole, expandConsole,
formError: formErrors, formError: formErrors,
formErrorDetail: formErrorsDetails, formErrorDetail: formErrorsDetails,
id: "uploadFilePane",
isExecuting: isExecuting, isExecuting: isExecuting,
title, submitButtonText: "Upload",
submitButtonText: submitButtonLabel,
onClose: closePanel,
onSubmit: submit, onSubmit: submit,
}; };
return ( return (
<RightPaneForm {...genericPaneProps}> <RightPaneForm {...genericPaneProps}>
<div className="paneMainContent"> <div className="paneMainContent">
<Upload label={selectFileInputLabel} accept={extensions} onUpload={updateSelectedFiles} /> <Upload label="Select file to upload" accept={extensions} onUpload={updateSelectedFiles} />
</div> </div>
</RightPaneForm> </RightPaneForm>
); );

View File

@@ -2,7 +2,6 @@ import { DetailsList, DetailsListLayoutMode, IColumn, SelectionMode } from "@flu
import React, { ChangeEvent, FunctionComponent, useState } from "react"; import React, { ChangeEvent, FunctionComponent, useState } from "react";
import { Upload } from "../../../Common/Upload/Upload"; import { Upload } from "../../../Common/Upload/Upload";
import { UploadDetailsRecord } from "../../../Contracts/ViewModels"; import { UploadDetailsRecord } from "../../../Contracts/ViewModels";
import { userContext } from "../../../UserContext";
import { logConsoleError } from "../../../Utils/NotificationConsoleUtils"; import { logConsoleError } from "../../../Utils/NotificationConsoleUtils";
import Explorer from "../../Explorer"; import Explorer from "../../Explorer";
import { getErrorMessage } from "../../Tables/Utilities"; import { getErrorMessage } from "../../Tables/Utilities";
@@ -10,23 +9,9 @@ import { RightPaneForm, RightPaneFormProps } from "../RightPaneForm/RightPaneFor
export interface UploadItemsPaneProps { export interface UploadItemsPaneProps {
explorer: Explorer; explorer: Explorer;
closePanel: () => void;
} }
const getTitle = (): string => { export const UploadItemsPane: FunctionComponent<UploadItemsPaneProps> = ({ explorer }: UploadItemsPaneProps) => {
if (userContext.apiType === "Cassandra" || userContext.apiType === "Tables") {
return "Upload Tables";
} else if (userContext.apiType === "Gremlin") {
return "Upload Graph";
} else {
return "Upload Items";
}
};
export const UploadItemsPane: FunctionComponent<UploadItemsPaneProps> = ({
explorer,
closePanel,
}: UploadItemsPaneProps) => {
const [files, setFiles] = useState<FileList>(); const [files, setFiles] = useState<FileList>();
const [uploadFileData, setUploadFileData] = useState<UploadDetailsRecord[]>([]); const [uploadFileData, setUploadFileData] = useState<UploadDetailsRecord[]>([]);
const [formError, setFormError] = useState<string>(""); const [formError, setFormError] = useState<string>("");
@@ -71,11 +56,8 @@ export const UploadItemsPane: FunctionComponent<UploadItemsPaneProps> = ({
expandConsole: () => explorer.expandConsole(), expandConsole: () => explorer.expandConsole(),
formError, formError,
formErrorDetail, formErrorDetail,
id: "uploaditemspane",
isExecuting: isExecuting, isExecuting: isExecuting,
title: getTitle(),
submitButtonText: "Upload", submitButtonText: "Upload",
onClose: closePanel,
onSubmit, onSubmit,
}; };

View File

@@ -5,11 +5,8 @@ exports[`Upload Items Pane should render Default properly 1`] = `
expandConsole={[Function]} expandConsole={[Function]}
formError="" formError=""
formErrorDetail="" formErrorDetail=""
id="uploaditemspane"
onClose={[Function]}
onSubmit={[Function]} onSubmit={[Function]}
submitButtonText="Upload" submitButtonText="Upload"
title="Upload Items"
> >
<div <div
className="paneMainContent" className="paneMainContent"
@@ -20,7 +17,9 @@ exports[`Upload Items Pane should render Default properly 1`] = `
multiple={true} multiple={true}
onUpload={[Function]} onUpload={[Function]}
tabIndex={0} tabIndex={0}
tooltip="Select one or more JSON files to upload. Each file can contain a single JSON document or an array of JSON documents. The combined size of all files in an individual upload operation must be less than 2 MB. You can perform multiple upload operations for larger data sets." tooltip="Select one or more JSON files to upload. Each file can contain a single JSON document or an array of JSON
documents. The combined size of all files in an individual upload operation must be less than 2 MB. You
can perform multiple upload operations for larger data sets."
/> />
</div> </div>
</RightPaneForm> </RightPaneForm>

View File

@@ -1292,14 +1292,14 @@ exports[`Delete Database Confirmation Pane submit() Should call delete database
className="ms-Stack panelInfoErrorContainer css-202" className="ms-Stack panelInfoErrorContainer css-202"
> >
<StyledIconBase <StyledIconBase
aria-label="warning"
className="panelWarningIcon" className="panelWarningIcon"
data-testid="warningIcon"
iconName="WarningSolid" iconName="WarningSolid"
key=".0:$.0" key=".0:$.0"
> >
<IconBase <IconBase
aria-label="warning"
className="panelWarningIcon" className="panelWarningIcon"
data-testid="warningIcon"
iconName="WarningSolid" iconName="WarningSolid"
styles={[Function]} styles={[Function]}
theme={ theme={
@@ -1577,10 +1577,10 @@ exports[`Delete Database Confirmation Pane submit() Should call delete database
} }
> >
<i <i
aria-hidden={true} aria-label="warning"
className="panelWarningIcon root-204" className="panelWarningIcon root-204"
data-icon-name="WarningSolid" data-icon-name="WarningSolid"
data-testid="warningIcon" role="img"
> >
</i> </i>
@@ -1591,13 +1591,13 @@ exports[`Delete Database Confirmation Pane submit() Should call delete database
key=".0:$.1" key=".0:$.1"
> >
<Text <Text
aria-label="message"
className="panelWarningErrorMessage" className="panelWarningErrorMessage"
data-testid="panelmessage"
variant="small" variant="small"
> >
<span <span
aria-label="message"
className="panelWarningErrorMessage css-205" className="panelWarningErrorMessage css-205"
data-testid="panelmessage"
> >
Warning! The action you are about to take cannot be undone. Continuing will permanently delete this resource and all of its children resources. Warning! The action you are about to take cannot be undone. Continuing will permanently delete this resource and all of its children resources.
</span> </span>

View File

@@ -28,3 +28,30 @@ export const getCollectionName = (isPlural?: boolean): string => {
return collectionName; return collectionName;
}; };
export const getDatabaseName = (): string => {
const { apiType } = userContext;
switch (apiType) {
case "SQL":
case "Mongo":
case "Gremlin":
case "Tables":
return "Database";
case "Cassandra":
return "Keyspace";
default:
throw new Error(`Unknown API type: ${apiType}`);
}
};
export const getUploadName = (): string => {
switch (userContext.apiType) {
case "Cassandra":
case "Tables":
return "Tables";
case "Gremlin":
return "Graph";
default:
return "Items";
}
};

View File

@@ -23,7 +23,7 @@ test("Mongo CRUD", async () => {
await safeClick(explorer, `.nodeItem >> text=${databaseId}`); await safeClick(explorer, `.nodeItem >> text=${databaseId}`);
await safeClick(explorer, `.nodeItem >> text=${containerId}`); await safeClick(explorer, `.nodeItem >> text=${containerId}`);
// Create indexing policy // Create indexing policy
await safeClick(explorer, ".nodeItem >> text=Settings"); await safeClick(explorer, ".nodeItem >> text=Setting");
await explorer.click('button[role="tab"]:has-text("Indexing Policy")'); await explorer.click('button[role="tab"]:has-text("Indexing Policy")');
await explorer.click('[aria-label="Index Field Name 0"]'); await explorer.click('[aria-label="Index Field Name 0"]');
await explorer.fill('[aria-label="Index Field Name 0"]', "foo"); await explorer.fill('[aria-label="Index Field Name 0"]', "foo");

View File

@@ -19,7 +19,7 @@ test("Notebooks", async () => {
await explorer.click('[data-test="My Notebooks"] [aria-label="More"]'); await explorer.click('[data-test="My Notebooks"] [aria-label="More"]');
await explorer.click('button[role="menuitem"]:has-text("Upload File")'); await explorer.click('button[role="menuitem"]:has-text("Upload File")');
await explorer.setInputFiles("#importFileInput", path.join(__dirname, fileToUpload)); await explorer.setInputFiles("#importFileInput", path.join(__dirname, fileToUpload));
await explorer.click('[aria-label="Submit"]'); await explorer.click('[aria-label="Upload"]');
await explorer.click(`[data-test="${fileToUpload}"] [aria-label="More"]`); await explorer.click(`[data-test="${fileToUpload}"] [aria-label="More"]`);
await explorer.click('button[role="menuitem"]:has-text("Delete")'); await explorer.click('button[role="menuitem"]:has-text("Delete")');
await explorer.click('button:has-text("Delete")'); await explorer.click('button:has-text("Delete")');