mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-28 13:21:42 +00:00
Compare commits
11 Commits
defect2276
...
users/aisa
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c13759f392 | ||
|
|
a526410e44 | ||
|
|
58cb85156c | ||
|
|
dd5ccade2b | ||
|
|
38ebef6c02 | ||
|
|
7ad5862e8f | ||
|
|
755b732532 | ||
|
|
1b5a9b83ff | ||
|
|
fb8871cfbf | ||
|
|
874cec26fc | ||
|
|
9d2d0e4754 |
@@ -18,7 +18,8 @@ module.exports = {
|
|||||||
// clearMocks: false,
|
// clearMocks: false,
|
||||||
|
|
||||||
// Indicates whether the coverage information should be collected while executing the test
|
// Indicates whether the coverage information should be collected while executing the test
|
||||||
collectCoverage: true,
|
|
||||||
|
collectCoverage: process.env.skipCodeCoverage === "true" ? false : true,
|
||||||
|
|
||||||
// An array of glob patterns indicating a set of files for which coverage information should be collected
|
// An array of glob patterns indicating a set of files for which coverage information should be collected
|
||||||
collectCoverageFrom: ["src/**/*.{js,jsx,ts,tsx}"],
|
collectCoverageFrom: ["src/**/*.{js,jsx,ts,tsx}"],
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ export const CollapsedResourceTree: FunctionComponent<CollapsedResourceTreeProps
|
|||||||
id="collapseToggleLeftPaneButton"
|
id="collapseToggleLeftPaneButton"
|
||||||
role="button"
|
role="button"
|
||||||
tabIndex={0}
|
tabIndex={0}
|
||||||
aria-label="Expand Tree"
|
aria-label={getApiShortDisplayName() + `Expand tree`}
|
||||||
onClick={toggleLeftPaneExpanded}
|
onClick={toggleLeftPaneExpanded}
|
||||||
onKeyPress={onKeyPressToggleLeftPaneExpanded}
|
onKeyPress={onKeyPressToggleLeftPaneExpanded}
|
||||||
ref={focusButton}
|
ref={focusButton}
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ export const ResourceTreeContainer: FunctionComponent<ResourceTreeContainerProps
|
|||||||
role="button"
|
role="button"
|
||||||
data-bind="click: onRefreshResourcesClick, clickBubble: false, event: { keypress: onRefreshDatabasesKeyPress }"
|
data-bind="click: onRefreshResourcesClick, clickBubble: false, event: { keypress: onRefreshDatabasesKeyPress }"
|
||||||
tabIndex={0}
|
tabIndex={0}
|
||||||
aria-label="Refresh tree"
|
aria-label={getApiShortDisplayName() + `Refresh tree`}
|
||||||
title="Refresh tree"
|
title="Refresh tree"
|
||||||
>
|
>
|
||||||
<img className="refreshcol" src={refreshImg} alt="Refresh Tree" />
|
<img className="refreshcol" src={refreshImg} alt="Refresh Tree" />
|
||||||
@@ -63,7 +63,7 @@ export const ResourceTreeContainer: FunctionComponent<ResourceTreeContainerProps
|
|||||||
onClick={toggleLeftPaneExpanded}
|
onClick={toggleLeftPaneExpanded}
|
||||||
onKeyPress={onKeyPressToggleLeftPaneExpanded}
|
onKeyPress={onKeyPressToggleLeftPaneExpanded}
|
||||||
tabIndex={0}
|
tabIndex={0}
|
||||||
aria-label="Collapse Tree"
|
aria-label={getApiShortDisplayName() + `Collapse Tree`}
|
||||||
title="Collapse Tree"
|
title="Collapse Tree"
|
||||||
ref={focusButton}
|
ref={focusButton}
|
||||||
>
|
>
|
||||||
|
|||||||
168
src/Common/TableEntity.tsx
Normal file
168
src/Common/TableEntity.tsx
Normal file
@@ -0,0 +1,168 @@
|
|||||||
|
import {
|
||||||
|
Dropdown,
|
||||||
|
IDropdownOption,
|
||||||
|
IDropdownStyles,
|
||||||
|
IImageProps,
|
||||||
|
Image,
|
||||||
|
IStackTokens,
|
||||||
|
Stack,
|
||||||
|
TextField,
|
||||||
|
TooltipHost,
|
||||||
|
} from "@fluentui/react";
|
||||||
|
import React, { FunctionComponent } from "react";
|
||||||
|
import DeleteIcon from "../../images/delete.svg";
|
||||||
|
import EditIcon from "../../images/Edit_entity.svg";
|
||||||
|
import { CassandraType, TableType } from "../Explorer/Tables/Constants";
|
||||||
|
import { userContext } from "../UserContext";
|
||||||
|
import { EntityValue } from "./EntityValue";
|
||||||
|
|
||||||
|
const dropdownStyles: Partial<IDropdownStyles> = { dropdown: { width: 100 } };
|
||||||
|
|
||||||
|
export interface TableEntityProps {
|
||||||
|
entityTypeLabel?: string;
|
||||||
|
entityPropertyLabel?: string;
|
||||||
|
entityValueLabel?: string;
|
||||||
|
isDeleteOptionVisible: boolean;
|
||||||
|
entityProperty: string;
|
||||||
|
entityPropertyPlaceHolder: string;
|
||||||
|
selectedKey: string | number;
|
||||||
|
entityValuePlaceholder: string;
|
||||||
|
entityValue: string | Date;
|
||||||
|
isEntityTypeDate: boolean;
|
||||||
|
options: { key: string; text: string }[];
|
||||||
|
isPropertyTypeDisable: boolean;
|
||||||
|
entityTimeValue: string;
|
||||||
|
isEntityValueDisable?: boolean;
|
||||||
|
onDeleteEntity?: () => void;
|
||||||
|
onEditEntity?: () => void;
|
||||||
|
onEntityPropertyChange: (event: React.FormEvent<HTMLElement>, newInput?: string) => void;
|
||||||
|
onEntityTypeChange: (event: React.FormEvent<HTMLElement>, selectedParam: IDropdownOption) => void;
|
||||||
|
onEntityValueChange: (event: React.FormEvent<HTMLElement>, newInput?: string) => void;
|
||||||
|
onSelectDate: (date: Date | null | undefined) => void;
|
||||||
|
onEntityTimeValueChange: (event: React.FormEvent<HTMLElement>, newInput?: string) => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const TableEntity: FunctionComponent<TableEntityProps> = ({
|
||||||
|
entityTypeLabel,
|
||||||
|
entityPropertyLabel,
|
||||||
|
isDeleteOptionVisible,
|
||||||
|
entityProperty,
|
||||||
|
selectedKey,
|
||||||
|
entityPropertyPlaceHolder,
|
||||||
|
entityValueLabel,
|
||||||
|
entityValuePlaceholder,
|
||||||
|
entityValue,
|
||||||
|
options,
|
||||||
|
isPropertyTypeDisable,
|
||||||
|
isEntityTypeDate,
|
||||||
|
entityTimeValue,
|
||||||
|
isEntityValueDisable,
|
||||||
|
onEditEntity,
|
||||||
|
onDeleteEntity,
|
||||||
|
onEntityPropertyChange,
|
||||||
|
onEntityTypeChange,
|
||||||
|
onEntityValueChange,
|
||||||
|
onSelectDate,
|
||||||
|
onEntityTimeValueChange,
|
||||||
|
}: TableEntityProps): JSX.Element => {
|
||||||
|
const imageProps: IImageProps = {
|
||||||
|
width: 16,
|
||||||
|
height: 30,
|
||||||
|
className: entityPropertyLabel ? "addRemoveIconLabel" : "addRemoveIcon",
|
||||||
|
};
|
||||||
|
|
||||||
|
const sectionStackTokens: IStackTokens = { childrenGap: 12 };
|
||||||
|
|
||||||
|
const handleKeyPress = (event: React.KeyboardEvent<HTMLElement>) => {
|
||||||
|
if (event.key === "Enter" || event.key === "Space") {
|
||||||
|
onEditEntity();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const handleKeyPressdelete = (event: React.KeyboardEvent<HTMLElement>) => {
|
||||||
|
if (event.key === "Enter" || event.key === "Space") {
|
||||||
|
onDeleteEntity();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const getEntityValueType = (): string => {
|
||||||
|
const { Int, Smallint, Tinyint } = CassandraType;
|
||||||
|
const { Double, Int32, Int64 } = TableType;
|
||||||
|
|
||||||
|
if (
|
||||||
|
selectedKey === Double ||
|
||||||
|
selectedKey === Int32 ||
|
||||||
|
selectedKey === Int64 ||
|
||||||
|
selectedKey === Int ||
|
||||||
|
selectedKey === Smallint ||
|
||||||
|
selectedKey === Tinyint
|
||||||
|
) {
|
||||||
|
return "number";
|
||||||
|
}
|
||||||
|
return "string";
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Stack horizontal tokens={sectionStackTokens}>
|
||||||
|
<TextField
|
||||||
|
label={entityPropertyLabel && entityPropertyLabel}
|
||||||
|
id="entityPropertyId"
|
||||||
|
autoFocus
|
||||||
|
disabled={isPropertyTypeDisable}
|
||||||
|
placeholder={entityPropertyPlaceHolder}
|
||||||
|
value={entityProperty}
|
||||||
|
onChange={onEntityPropertyChange}
|
||||||
|
required
|
||||||
|
/>
|
||||||
|
<Dropdown
|
||||||
|
label={entityTypeLabel && entityTypeLabel}
|
||||||
|
selectedKey={selectedKey}
|
||||||
|
onChange={onEntityTypeChange}
|
||||||
|
options={options}
|
||||||
|
disabled={isPropertyTypeDisable}
|
||||||
|
id="entityTypeId"
|
||||||
|
styles={dropdownStyles}
|
||||||
|
/>
|
||||||
|
<EntityValue
|
||||||
|
entityValueLabel={entityValueLabel}
|
||||||
|
entityValueType={getEntityValueType()}
|
||||||
|
isEntityValueDisable={isEntityValueDisable}
|
||||||
|
entityValuePlaceholder={entityValuePlaceholder}
|
||||||
|
entityValue={entityValue}
|
||||||
|
isEntityTypeDate={isEntityTypeDate}
|
||||||
|
entityTimeValue={entityTimeValue}
|
||||||
|
onEntityValueChange={onEntityValueChange}
|
||||||
|
onSelectDate={onSelectDate}
|
||||||
|
onEntityTimeValueChange={onEntityTimeValueChange}
|
||||||
|
/>
|
||||||
|
{!isEntityValueDisable && (
|
||||||
|
<TooltipHost content="Edit property" id="editTooltip">
|
||||||
|
<div tabIndex={0}>
|
||||||
|
<Image
|
||||||
|
{...imageProps}
|
||||||
|
src={EditIcon}
|
||||||
|
alt="editEntity"
|
||||||
|
onClick={onEditEntity}
|
||||||
|
tabIndex={0}
|
||||||
|
onKeyPress={handleKeyPress}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</TooltipHost>
|
||||||
|
)}
|
||||||
|
{isDeleteOptionVisible && userContext.apiType !== "Cassandra" && (
|
||||||
|
<TooltipHost content="Delete property" id="deleteTooltip">
|
||||||
|
<Image
|
||||||
|
{...imageProps}
|
||||||
|
src={DeleteIcon}
|
||||||
|
alt="delete entity"
|
||||||
|
id="deleteEntity"
|
||||||
|
onClick={onDeleteEntity}
|
||||||
|
tabIndex={0}
|
||||||
|
onKeyPress={handleKeyPressdelete}
|
||||||
|
/>
|
||||||
|
</TooltipHost>
|
||||||
|
)}
|
||||||
|
</Stack>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -73,7 +73,7 @@ export class AccordionItemComponent extends React.Component<AccordionItemCompone
|
|||||||
<img
|
<img
|
||||||
className="expandCollapseIcon"
|
className="expandCollapseIcon"
|
||||||
src={this.state.isExpanded ? TriangleDownIcon : TriangleRightIcon}
|
src={this.state.isExpanded ? TriangleDownIcon : TriangleRightIcon}
|
||||||
alt="Hide"
|
alt={this.state.isExpanded ? `${this.props.title} hide` : `${this.props.title} expand`}
|
||||||
tabIndex={0}
|
tabIndex={0}
|
||||||
role="button"
|
role="button"
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -201,20 +201,20 @@ export const ThroughputInput: FunctionComponent<ThroughputInputProps> = ({
|
|||||||
Autoscale
|
Autoscale
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<input
|
<input
|
||||||
id="Manual-input"
|
id="Manual-input"
|
||||||
className="throughputInputRadioBtn"
|
className="throughputInputRadioBtn"
|
||||||
aria-label="Manual database throughput"
|
aria-label="Manual database throughput"
|
||||||
checked={!isAutoscaleSelected}
|
checked={!isAutoscaleSelected}
|
||||||
type="radio"
|
type="radio"
|
||||||
aria-required={true}
|
aria-required={true}
|
||||||
role="radio"
|
role="radio"
|
||||||
tabIndex={0}
|
tabIndex={0}
|
||||||
onChange={(e) => handleOnChangeMode(e, "Manual")}
|
onChange={(e) => handleOnChangeMode(e, "Manual")}
|
||||||
/>
|
/>
|
||||||
<label className="throughputInputRadioBtnLabel" htmlFor="Manual-input">
|
<label className="throughputInputRadioBtnLabel" htmlFor="Manual-input">
|
||||||
Manual
|
Manual
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</Stack>
|
</Stack>
|
||||||
|
|
||||||
@@ -250,7 +250,7 @@ export const ThroughputInput: FunctionComponent<ThroughputInputProps> = ({
|
|||||||
step={AutoPilotUtils.autoPilotIncrementStep}
|
step={AutoPilotUtils.autoPilotIncrementStep}
|
||||||
min={AutoPilotUtils.autoPilotThroughput1K}
|
min={AutoPilotUtils.autoPilotThroughput1K}
|
||||||
value={throughput.toString()}
|
value={throughput.toString()}
|
||||||
aria-label="Max request units per second"
|
ariaLabel={`${isDatabase ? "Database" : getCollectionName()} max RU/s`}
|
||||||
required={true}
|
required={true}
|
||||||
errorMessage={throughputError}
|
errorMessage={throughputError}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -347,14 +347,12 @@ exports[`ThroughputInput Pane should render Default properly 1`] = `
|
|||||||
ariaLabel="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."
|
ariaLabel="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."
|
||||||
className="panelInfoIcon"
|
className="panelInfoIcon"
|
||||||
iconName="Info"
|
iconName="Info"
|
||||||
role="tooltip"
|
|
||||||
tabIndex={0}
|
tabIndex={0}
|
||||||
>
|
>
|
||||||
<IconBase
|
<IconBase
|
||||||
ariaLabel="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."
|
ariaLabel="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."
|
||||||
className="panelInfoIcon"
|
className="panelInfoIcon"
|
||||||
iconName="Info"
|
iconName="Info"
|
||||||
role="tooltip"
|
|
||||||
styles={[Function]}
|
styles={[Function]}
|
||||||
tabIndex={0}
|
tabIndex={0}
|
||||||
theme={
|
theme={
|
||||||
@@ -635,7 +633,7 @@ exports[`ThroughputInput Pane should render Default properly 1`] = `
|
|||||||
aria-label="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."
|
aria-label="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."
|
||||||
className="panelInfoIcon root-57"
|
className="panelInfoIcon root-57"
|
||||||
data-icon-name="Info"
|
data-icon-name="Info"
|
||||||
role="tooltip"
|
role="img"
|
||||||
tabIndex={0}
|
tabIndex={0}
|
||||||
>
|
>
|
||||||
|
|
||||||
@@ -1341,14 +1339,12 @@ exports[`ThroughputInput Pane should render Default properly 1`] = `
|
|||||||
ariaLabel="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."
|
ariaLabel="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."
|
||||||
className="panelInfoIcon"
|
className="panelInfoIcon"
|
||||||
iconName="Info"
|
iconName="Info"
|
||||||
role="tooltip"
|
|
||||||
tabIndex={0}
|
tabIndex={0}
|
||||||
>
|
>
|
||||||
<IconBase
|
<IconBase
|
||||||
ariaLabel="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."
|
ariaLabel="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."
|
||||||
className="panelInfoIcon"
|
className="panelInfoIcon"
|
||||||
iconName="Info"
|
iconName="Info"
|
||||||
role="tooltip"
|
|
||||||
styles={[Function]}
|
styles={[Function]}
|
||||||
tabIndex={0}
|
tabIndex={0}
|
||||||
theme={
|
theme={
|
||||||
@@ -1629,7 +1625,7 @@ exports[`ThroughputInput Pane should render Default properly 1`] = `
|
|||||||
aria-label="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."
|
aria-label="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."
|
||||||
className="panelInfoIcon root-57"
|
className="panelInfoIcon root-57"
|
||||||
data-icon-name="Info"
|
data-icon-name="Info"
|
||||||
role="tooltip"
|
role="img"
|
||||||
tabIndex={0}
|
tabIndex={0}
|
||||||
>
|
>
|
||||||
|
|
||||||
@@ -1644,7 +1640,7 @@ exports[`ThroughputInput Pane should render Default properly 1`] = `
|
|||||||
</div>
|
</div>
|
||||||
</Stack>
|
</Stack>
|
||||||
<StyledTextFieldBase
|
<StyledTextFieldBase
|
||||||
aria-label="Max request units per second"
|
ariaLabel="Container max RU/s"
|
||||||
errorMessage=""
|
errorMessage=""
|
||||||
id="autoscaleRUValueField"
|
id="autoscaleRUValueField"
|
||||||
key=".0:$.2"
|
key=".0:$.2"
|
||||||
@@ -1667,7 +1663,7 @@ exports[`ThroughputInput Pane should render Default properly 1`] = `
|
|||||||
value="4000"
|
value="4000"
|
||||||
>
|
>
|
||||||
<TextFieldBase
|
<TextFieldBase
|
||||||
aria-label="Max request units per second"
|
ariaLabel="Container max RU/s"
|
||||||
deferredValidationTime={200}
|
deferredValidationTime={200}
|
||||||
errorMessage=""
|
errorMessage=""
|
||||||
id="autoscaleRUValueField"
|
id="autoscaleRUValueField"
|
||||||
@@ -1965,6 +1961,7 @@ exports[`ThroughputInput Pane should render Default properly 1`] = `
|
|||||||
>
|
>
|
||||||
<input
|
<input
|
||||||
aria-invalid={false}
|
aria-invalid={false}
|
||||||
|
aria-label="Container max RU/s"
|
||||||
className="ms-TextField-field field-64"
|
className="ms-TextField-field field-64"
|
||||||
id="autoscaleRUValueField"
|
id="autoscaleRUValueField"
|
||||||
min={1000}
|
min={1000}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import {
|
|||||||
IButtonStyles,
|
IButtonStyles,
|
||||||
IconButton,
|
IconButton,
|
||||||
IContextualMenuItemProps,
|
IContextualMenuItemProps,
|
||||||
IContextualMenuProps
|
IContextualMenuProps,
|
||||||
} from "@fluentui/react";
|
} from "@fluentui/react";
|
||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
import AnimateHeight from "react-animate-height";
|
import AnimateHeight from "react-animate-height";
|
||||||
|
|||||||
@@ -40,32 +40,30 @@ exports[`TreeNodeComponent does not render children by default 1`] = `
|
|||||||
onKeyPress={[Function]}
|
onKeyPress={[Function]}
|
||||||
role="treeitem"
|
role="treeitem"
|
||||||
>
|
>
|
||||||
<div>
|
<div
|
||||||
<div
|
className="treeNodeHeader "
|
||||||
className="treeNodeHeader "
|
data-test="label"
|
||||||
data-test="label"
|
style={
|
||||||
style={
|
Object {
|
||||||
Object {
|
"paddingLeft": 9,
|
||||||
"paddingLeft": 9,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
tabIndex={-1}
|
}
|
||||||
|
tabIndex={-1}
|
||||||
|
>
|
||||||
|
<img
|
||||||
|
alt="label branch is collapsed"
|
||||||
|
className="expandCollapseIcon"
|
||||||
|
onKeyPress={[Function]}
|
||||||
|
role="button"
|
||||||
|
src=""
|
||||||
|
tabIndex={0}
|
||||||
|
/>
|
||||||
|
<span
|
||||||
|
className="nodeLabel"
|
||||||
|
title="label"
|
||||||
>
|
>
|
||||||
<img
|
label
|
||||||
alt="label branch is collapsed"
|
</span>
|
||||||
className="expandCollapseIcon"
|
|
||||||
onKeyPress={[Function]}
|
|
||||||
role="button"
|
|
||||||
src=""
|
|
||||||
tabIndex={0}
|
|
||||||
/>
|
|
||||||
<span
|
|
||||||
className="nodeLabel"
|
|
||||||
title="label"
|
|
||||||
>
|
|
||||||
label
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
className="loadingIconContainer"
|
className="loadingIconContainer"
|
||||||
@@ -145,80 +143,78 @@ exports[`TreeNodeComponent renders a simple node (sorted children, expanded) 1`]
|
|||||||
onKeyPress={[Function]}
|
onKeyPress={[Function]}
|
||||||
role="treeitem"
|
role="treeitem"
|
||||||
>
|
>
|
||||||
<div>
|
<div
|
||||||
<div
|
className="treeNodeHeader "
|
||||||
className="treeNodeHeader "
|
data-test="label"
|
||||||
data-test="label"
|
style={
|
||||||
style={
|
Object {
|
||||||
Object {
|
"paddingLeft": 23,
|
||||||
"paddingLeft": 23,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
tabIndex={-1}
|
}
|
||||||
|
tabIndex={-1}
|
||||||
|
>
|
||||||
|
<img
|
||||||
|
alt="label branch is expanded"
|
||||||
|
className="expandCollapseIcon"
|
||||||
|
onKeyPress={[Function]}
|
||||||
|
role="button"
|
||||||
|
src=""
|
||||||
|
tabIndex={0}
|
||||||
|
/>
|
||||||
|
<span
|
||||||
|
className="nodeLabel"
|
||||||
|
title="label"
|
||||||
>
|
>
|
||||||
<img
|
label
|
||||||
alt="label branch is expanded"
|
</span>
|
||||||
className="expandCollapseIcon"
|
<div
|
||||||
onKeyPress={[Function]}
|
onContextMenu={[Function]}
|
||||||
role="button"
|
onKeyPress={[Function]}
|
||||||
src=""
|
>
|
||||||
tabIndex={0}
|
<CustomizedIconButton
|
||||||
|
ariaLabel="More"
|
||||||
|
className="treeMenuEllipsis"
|
||||||
|
menuIconProps={
|
||||||
|
Object {
|
||||||
|
"iconName": "More",
|
||||||
|
"styles": Object {
|
||||||
|
"root": Object {
|
||||||
|
"fontSize": "18px",
|
||||||
|
"fontWeight": "bold",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
menuProps={
|
||||||
|
Object {
|
||||||
|
"contextualMenuItemAs": [Function],
|
||||||
|
"coverTarget": true,
|
||||||
|
"directionalHint": 3,
|
||||||
|
"isBeakVisible": false,
|
||||||
|
"items": Array [
|
||||||
|
Object {
|
||||||
|
"className": undefined,
|
||||||
|
"disabled": true,
|
||||||
|
"key": "menuLabel",
|
||||||
|
"onClick": [Function],
|
||||||
|
"onRenderIcon": [Function],
|
||||||
|
"text": "menuLabel",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
"onMenuDismissed": [Function],
|
||||||
|
"onMenuOpened": [Function],
|
||||||
|
}
|
||||||
|
}
|
||||||
|
name="More"
|
||||||
|
styles={
|
||||||
|
Object {
|
||||||
|
"rootFocused": Object {
|
||||||
|
"outline": "1px dashed undefined",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
title="More"
|
||||||
/>
|
/>
|
||||||
<span
|
|
||||||
className="nodeLabel"
|
|
||||||
title="label"
|
|
||||||
>
|
|
||||||
label
|
|
||||||
</span>
|
|
||||||
<div
|
|
||||||
onContextMenu={[Function]}
|
|
||||||
onKeyPress={[Function]}
|
|
||||||
>
|
|
||||||
<CustomizedIconButton
|
|
||||||
ariaLabel="More"
|
|
||||||
className="treeMenuEllipsis"
|
|
||||||
menuIconProps={
|
|
||||||
Object {
|
|
||||||
"iconName": "More",
|
|
||||||
"styles": Object {
|
|
||||||
"root": Object {
|
|
||||||
"fontSize": "18px",
|
|
||||||
"fontWeight": "bold",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
menuProps={
|
|
||||||
Object {
|
|
||||||
"contextualMenuItemAs": [Function],
|
|
||||||
"coverTarget": true,
|
|
||||||
"directionalHint": 3,
|
|
||||||
"isBeakVisible": false,
|
|
||||||
"items": Array [
|
|
||||||
Object {
|
|
||||||
"className": undefined,
|
|
||||||
"disabled": true,
|
|
||||||
"key": "menuLabel",
|
|
||||||
"onClick": [Function],
|
|
||||||
"onRenderIcon": [Function],
|
|
||||||
"text": "menuLabel",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
"onMenuDismissed": [Function],
|
|
||||||
"onMenuOpened": [Function],
|
|
||||||
}
|
|
||||||
}
|
|
||||||
name="More"
|
|
||||||
styles={
|
|
||||||
Object {
|
|
||||||
"rootFocused": Object {
|
|
||||||
"outline": "1px dashed undefined",
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
title="More"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
@@ -298,32 +294,30 @@ exports[`TreeNodeComponent renders loading icon 1`] = `
|
|||||||
onKeyPress={[Function]}
|
onKeyPress={[Function]}
|
||||||
role="treeitem"
|
role="treeitem"
|
||||||
>
|
>
|
||||||
<div>
|
<div
|
||||||
<div
|
className="treeNodeHeader "
|
||||||
className="treeNodeHeader "
|
data-test="label"
|
||||||
data-test="label"
|
style={
|
||||||
style={
|
Object {
|
||||||
Object {
|
"paddingLeft": 9,
|
||||||
"paddingLeft": 9,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
tabIndex={-1}
|
}
|
||||||
|
tabIndex={-1}
|
||||||
|
>
|
||||||
|
<img
|
||||||
|
alt="label branch is expanded"
|
||||||
|
className="expandCollapseIcon"
|
||||||
|
onKeyPress={[Function]}
|
||||||
|
role="button"
|
||||||
|
src=""
|
||||||
|
tabIndex={0}
|
||||||
|
/>
|
||||||
|
<span
|
||||||
|
className="nodeLabel"
|
||||||
|
title="label"
|
||||||
>
|
>
|
||||||
<img
|
label
|
||||||
alt="label branch is expanded"
|
</span>
|
||||||
className="expandCollapseIcon"
|
|
||||||
onKeyPress={[Function]}
|
|
||||||
role="button"
|
|
||||||
src=""
|
|
||||||
tabIndex={0}
|
|
||||||
/>
|
|
||||||
<span
|
|
||||||
className="nodeLabel"
|
|
||||||
title="label"
|
|
||||||
>
|
|
||||||
label
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
className="loadingIconContainer"
|
className="loadingIconContainer"
|
||||||
@@ -374,71 +368,69 @@ exports[`TreeNodeComponent renders sorted children, expanded, leaves and parents
|
|||||||
onKeyPress={[Function]}
|
onKeyPress={[Function]}
|
||||||
role="treeitem"
|
role="treeitem"
|
||||||
>
|
>
|
||||||
<div>
|
<div
|
||||||
<div
|
className="treeNodeHeader "
|
||||||
className="treeNodeHeader "
|
data-test="label"
|
||||||
data-test="label"
|
style={
|
||||||
style={
|
Object {
|
||||||
Object {
|
"paddingLeft": 23,
|
||||||
"paddingLeft": 23,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
tabIndex={-1}
|
}
|
||||||
|
tabIndex={-1}
|
||||||
|
>
|
||||||
|
<img
|
||||||
|
alt="label branch is expanded"
|
||||||
|
className="expandCollapseIcon"
|
||||||
|
onKeyPress={[Function]}
|
||||||
|
role="button"
|
||||||
|
src=""
|
||||||
|
tabIndex={0}
|
||||||
|
/>
|
||||||
|
<span
|
||||||
|
className="nodeLabel"
|
||||||
|
title="label"
|
||||||
>
|
>
|
||||||
<img
|
label
|
||||||
alt="label branch is expanded"
|
</span>
|
||||||
className="expandCollapseIcon"
|
<div
|
||||||
onKeyPress={[Function]}
|
onContextMenu={[Function]}
|
||||||
role="button"
|
onKeyPress={[Function]}
|
||||||
src=""
|
>
|
||||||
tabIndex={0}
|
<CustomizedIconButton
|
||||||
|
ariaLabel="More"
|
||||||
|
className="treeMenuEllipsis"
|
||||||
|
menuIconProps={
|
||||||
|
Object {
|
||||||
|
"iconName": "More",
|
||||||
|
"styles": Object {
|
||||||
|
"root": Object {
|
||||||
|
"fontSize": "18px",
|
||||||
|
"fontWeight": "bold",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
menuProps={
|
||||||
|
Object {
|
||||||
|
"contextualMenuItemAs": [Function],
|
||||||
|
"coverTarget": true,
|
||||||
|
"directionalHint": 3,
|
||||||
|
"isBeakVisible": false,
|
||||||
|
"items": Array [],
|
||||||
|
"onMenuDismissed": [Function],
|
||||||
|
"onMenuOpened": [Function],
|
||||||
|
}
|
||||||
|
}
|
||||||
|
name="More"
|
||||||
|
styles={
|
||||||
|
Object {
|
||||||
|
"rootFocused": Object {
|
||||||
|
"outline": "1px dashed undefined",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
title="More"
|
||||||
/>
|
/>
|
||||||
<span
|
|
||||||
className="nodeLabel"
|
|
||||||
title="label"
|
|
||||||
>
|
|
||||||
label
|
|
||||||
</span>
|
|
||||||
<div
|
|
||||||
onContextMenu={[Function]}
|
|
||||||
onKeyPress={[Function]}
|
|
||||||
>
|
|
||||||
<CustomizedIconButton
|
|
||||||
ariaLabel="More"
|
|
||||||
className="treeMenuEllipsis"
|
|
||||||
menuIconProps={
|
|
||||||
Object {
|
|
||||||
"iconName": "More",
|
|
||||||
"styles": Object {
|
|
||||||
"root": Object {
|
|
||||||
"fontSize": "18px",
|
|
||||||
"fontWeight": "bold",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
menuProps={
|
|
||||||
Object {
|
|
||||||
"contextualMenuItemAs": [Function],
|
|
||||||
"coverTarget": true,
|
|
||||||
"directionalHint": 3,
|
|
||||||
"isBeakVisible": false,
|
|
||||||
"items": Array [],
|
|
||||||
"onMenuDismissed": [Function],
|
|
||||||
"onMenuOpened": [Function],
|
|
||||||
}
|
|
||||||
}
|
|
||||||
name="More"
|
|
||||||
styles={
|
|
||||||
Object {
|
|
||||||
"rootFocused": Object {
|
|
||||||
"outline": "1px dashed undefined",
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
title="More"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
@@ -546,32 +538,30 @@ exports[`TreeNodeComponent renders unsorted children by default 1`] = `
|
|||||||
onKeyPress={[Function]}
|
onKeyPress={[Function]}
|
||||||
role="treeitem"
|
role="treeitem"
|
||||||
>
|
>
|
||||||
<div>
|
<div
|
||||||
<div
|
className="treeNodeHeader "
|
||||||
className="treeNodeHeader "
|
data-test="label"
|
||||||
data-test="label"
|
style={
|
||||||
style={
|
Object {
|
||||||
Object {
|
"paddingLeft": 9,
|
||||||
"paddingLeft": 9,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
tabIndex={-1}
|
}
|
||||||
|
tabIndex={-1}
|
||||||
|
>
|
||||||
|
<img
|
||||||
|
alt="label branch is expanded"
|
||||||
|
className="expandCollapseIcon"
|
||||||
|
onKeyPress={[Function]}
|
||||||
|
role="button"
|
||||||
|
src=""
|
||||||
|
tabIndex={0}
|
||||||
|
/>
|
||||||
|
<span
|
||||||
|
className="nodeLabel"
|
||||||
|
title="label"
|
||||||
>
|
>
|
||||||
<img
|
label
|
||||||
alt="label branch is expanded"
|
</span>
|
||||||
className="expandCollapseIcon"
|
|
||||||
onKeyPress={[Function]}
|
|
||||||
role="button"
|
|
||||||
src=""
|
|
||||||
tabIndex={0}
|
|
||||||
/>
|
|
||||||
<span
|
|
||||||
className="nodeLabel"
|
|
||||||
title="label"
|
|
||||||
>
|
|
||||||
label
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
className="loadingIconContainer"
|
className="loadingIconContainer"
|
||||||
|
|||||||
@@ -23,7 +23,9 @@ export class MiddlePaneComponent extends React.Component<MiddlePaneComponentProp
|
|||||||
onClick={this.props.toggleExpandGraph}
|
onClick={this.props.toggleExpandGraph}
|
||||||
role="button"
|
role="button"
|
||||||
aria-expanded={this.props.isTabsContentExpanded}
|
aria-expanded={this.props.isTabsContentExpanded}
|
||||||
aria-name="View graph in full screen"
|
aria-label={
|
||||||
|
this.props.isTabsContentExpanded ? "Collapse graph to minimized view" : "View graph in full screen"
|
||||||
|
}
|
||||||
>
|
>
|
||||||
<img
|
<img
|
||||||
src={this.props.isTabsContentExpanded ? CollapseArrowIcon : ExpandIcon}
|
src={this.props.isTabsContentExpanded ? CollapseArrowIcon : ExpandIcon}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ describe("CommandBarComponentButtonFactory tests", () => {
|
|||||||
updateUserContext({
|
updateUserContext({
|
||||||
databaseAccount: {
|
databaseAccount: {
|
||||||
properties: {
|
properties: {
|
||||||
capabilities: [{ name: "EnableTable" }],
|
capabilities: [{ name: "EnableMongo" }],
|
||||||
},
|
},
|
||||||
} as DatabaseAccount,
|
} as DatabaseAccount,
|
||||||
});
|
});
|
||||||
@@ -38,6 +38,38 @@ describe("CommandBarComponentButtonFactory tests", () => {
|
|||||||
);
|
);
|
||||||
expect(enableAzureSynapseLinkBtn).toBeDefined();
|
expect(enableAzureSynapseLinkBtn).toBeDefined();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("Button should not be visible for Tables API", () => {
|
||||||
|
updateUserContext({
|
||||||
|
databaseAccount: {
|
||||||
|
properties: {
|
||||||
|
capabilities: [{ name: "EnableTable" }],
|
||||||
|
},
|
||||||
|
} as DatabaseAccount,
|
||||||
|
});
|
||||||
|
|
||||||
|
const buttons = CommandBarComponentButtonFactory.createStaticCommandBarButtons(mockExplorer, selectedNodeState);
|
||||||
|
const enableAzureSynapseLinkBtn = buttons.find(
|
||||||
|
(button) => button.commandButtonLabel === enableAzureSynapseLinkBtnLabel
|
||||||
|
);
|
||||||
|
expect(enableAzureSynapseLinkBtn).toBeUndefined();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Button should not be visible for Cassandra API", () => {
|
||||||
|
updateUserContext({
|
||||||
|
databaseAccount: {
|
||||||
|
properties: {
|
||||||
|
capabilities: [{ name: "EnableCassandra" }],
|
||||||
|
},
|
||||||
|
} as DatabaseAccount,
|
||||||
|
});
|
||||||
|
|
||||||
|
const buttons = CommandBarComponentButtonFactory.createStaticCommandBarButtons(mockExplorer, selectedNodeState);
|
||||||
|
const enableAzureSynapseLinkBtn = buttons.find(
|
||||||
|
(button) => button.commandButtonLabel === enableAzureSynapseLinkBtnLabel
|
||||||
|
);
|
||||||
|
expect(enableAzureSynapseLinkBtn).toBeUndefined();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("Enable notebook button", () => {
|
describe("Enable notebook button", () => {
|
||||||
|
|||||||
@@ -51,11 +51,13 @@ export function createStaticCommandBarButtons(
|
|||||||
const buttons: CommandButtonComponentProps[] = [];
|
const buttons: CommandButtonComponentProps[] = [];
|
||||||
|
|
||||||
buttons.push(newCollectionBtn);
|
buttons.push(newCollectionBtn);
|
||||||
|
if (userContext.apiType !== "Tables" && userContext.apiType !== "Cassandra") {
|
||||||
|
const addSynapseLink = createOpenSynapseLinkDialogButton(container);
|
||||||
|
|
||||||
const addSynapseLink = createOpenSynapseLinkDialogButton(container);
|
if (addSynapseLink) {
|
||||||
if (addSynapseLink) {
|
buttons.push(createDivider());
|
||||||
buttons.push(createDivider());
|
buttons.push(addSynapseLink);
|
||||||
buttons.push(addSynapseLink);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (userContext.apiType !== "Tables") {
|
if (userContext.apiType !== "Tables") {
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import {
|
|||||||
Stack,
|
Stack,
|
||||||
TeachingBubble,
|
TeachingBubble,
|
||||||
Text,
|
Text,
|
||||||
TooltipHost
|
TooltipHost,
|
||||||
} from "@fluentui/react";
|
} from "@fluentui/react";
|
||||||
import * as Constants from "Common/Constants";
|
import * as Constants from "Common/Constants";
|
||||||
import { createCollection } from "Common/dataAccess/createCollection";
|
import { createCollection } from "Common/dataAccess/createCollection";
|
||||||
@@ -100,7 +100,6 @@ export interface AddCollectionPanelState {
|
|||||||
isExecuting: boolean;
|
isExecuting: boolean;
|
||||||
isThroughputCapExceeded: boolean;
|
isThroughputCapExceeded: boolean;
|
||||||
teachingBubbleStep: number;
|
teachingBubbleStep: number;
|
||||||
isParentTooltipVisible:boolean;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class AddCollectionPanel extends React.Component<AddCollectionPanelProps, AddCollectionPanelState> {
|
export class AddCollectionPanel extends React.Component<AddCollectionPanelProps, AddCollectionPanelState> {
|
||||||
@@ -109,7 +108,6 @@ export class AddCollectionPanel extends React.Component<AddCollectionPanelProps,
|
|||||||
private collectionThroughput: number;
|
private collectionThroughput: number;
|
||||||
private isCollectionAutoscale: boolean;
|
private isCollectionAutoscale: boolean;
|
||||||
private isCostAcknowledged: boolean;
|
private isCostAcknowledged: boolean;
|
||||||
|
|
||||||
|
|
||||||
constructor(props: AddCollectionPanelProps) {
|
constructor(props: AddCollectionPanelProps) {
|
||||||
super(props);
|
super(props);
|
||||||
@@ -136,16 +134,13 @@ export class AddCollectionPanel extends React.Component<AddCollectionPanelProps,
|
|||||||
isExecuting: false,
|
isExecuting: false,
|
||||||
isThroughputCapExceeded: false,
|
isThroughputCapExceeded: false,
|
||||||
teachingBubbleStep: 0,
|
teachingBubbleStep: 0,
|
||||||
isParentTooltipVisible: false,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount(): void {
|
componentDidMount(): void {
|
||||||
if (this.state.teachingBubbleStep === 0 && this.props.isQuickstart) {
|
if (this.state.teachingBubbleStep === 0 && this.props.isQuickstart) {
|
||||||
this.setState({ teachingBubbleStep: 1 });
|
this.setState({ teachingBubbleStep: 1 });
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
render(): JSX.Element {
|
render(): JSX.Element {
|
||||||
@@ -413,7 +408,6 @@ export class AddCollectionPanel extends React.Component<AddCollectionPanelProps,
|
|||||||
className="panelInfoIcon"
|
className="panelInfoIcon"
|
||||||
tabIndex={0}
|
tabIndex={0}
|
||||||
ariaLabel={`Unique identifier for the ${getCollectionName().toLocaleLowerCase()} and used for id-based routing through REST and all SDKs.`}
|
ariaLabel={`Unique identifier for the ${getCollectionName().toLocaleLowerCase()} and used for id-based routing through REST and all SDKs.`}
|
||||||
|
|
||||||
/>
|
/>
|
||||||
</TooltipHost>
|
</TooltipHost>
|
||||||
</Stack>
|
</Stack>
|
||||||
|
|||||||
@@ -2,13 +2,13 @@ import { Checkbox, Dropdown, IDropdownOption, Link, Stack, Text, TextField } fro
|
|||||||
import * as Constants from "Common/Constants";
|
import * as Constants from "Common/Constants";
|
||||||
import { getErrorMessage, getErrorStack } from "Common/ErrorHandlingUtils";
|
import { getErrorMessage, getErrorStack } from "Common/ErrorHandlingUtils";
|
||||||
import { InfoTooltip } from "Common/Tooltip/InfoTooltip";
|
import { InfoTooltip } from "Common/Tooltip/InfoTooltip";
|
||||||
import { useSidePanel } from "hooks/useSidePanel";
|
|
||||||
import React, { FunctionComponent, useState } from "react";
|
|
||||||
import * as SharedConstants from "Shared/Constants";
|
import * as SharedConstants from "Shared/Constants";
|
||||||
import { Action } from "Shared/Telemetry/TelemetryConstants";
|
import { Action } 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 { isServerlessAccount } from "Utils/CapabilityUtils";
|
import { isServerlessAccount } from "Utils/CapabilityUtils";
|
||||||
|
import { useSidePanel } from "hooks/useSidePanel";
|
||||||
|
import React, { FunctionComponent, useState } from "react";
|
||||||
import { ThroughputInput } from "../../Controls/ThroughputInput/ThroughputInput";
|
import { ThroughputInput } from "../../Controls/ThroughputInput/ThroughputInput";
|
||||||
import Explorer from "../../Explorer";
|
import Explorer from "../../Explorer";
|
||||||
import { CassandraAPIDataClient } from "../../Tables/TableDataClient";
|
import { CassandraAPIDataClient } from "../../Tables/TableDataClient";
|
||||||
@@ -86,7 +86,7 @@ export const CassandraAddCollectionPane: FunctionComponent<CassandraAddCollectio
|
|||||||
: `${createKeyspaceQueryPrefix} AND cosmosdb_provisioned_throughput=${newKeySpaceThroughput};`
|
: `${createKeyspaceQueryPrefix} AND cosmosdb_provisioned_throughput=${newKeySpaceThroughput};`
|
||||||
: `${createKeyspaceQueryPrefix};`;
|
: `${createKeyspaceQueryPrefix};`;
|
||||||
let tableQuery: string;
|
let tableQuery: string;
|
||||||
const createTableQueryPrefix = `CREATE TABLE ${keyspaceId}.${tableId.trim()} ${userTableQuery}`;
|
const createTableQueryPrefix = `CREATE TABLE \"${keyspaceId}\".\"${tableId.trim()}\" ${userTableQuery}`;
|
||||||
|
|
||||||
if (tableThroughput) {
|
if (tableThroughput) {
|
||||||
if (isTableAutoscale) {
|
if (isTableAutoscale) {
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ export const PanelInfoErrorComponent: React.FunctionComponent<PanelInfoErrorProp
|
|||||||
)}
|
)}
|
||||||
</Text>
|
</Text>
|
||||||
{showErrorDetails && (
|
{showErrorDetails && (
|
||||||
<a className="paneErrorLink" role="link" onClick={expandConsole} tabIndex={0} onKeyPress={expandConsole}>
|
<a className="paneErrorLink" role="button" onClick={expandConsole} tabIndex={0} onKeyPress={expandConsole}>
|
||||||
More details
|
More details
|
||||||
</a>
|
</a>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import {
|
|||||||
Stack,
|
Stack,
|
||||||
TeachingBubble,
|
TeachingBubble,
|
||||||
TeachingBubbleContent,
|
TeachingBubbleContent,
|
||||||
Text
|
Text,
|
||||||
} from "@fluentui/react";
|
} from "@fluentui/react";
|
||||||
import { sendMessage } from "Common/MessageHandler";
|
import { sendMessage } from "Common/MessageHandler";
|
||||||
import { MessageTypes } from "Contracts/ExplorerContracts";
|
import { MessageTypes } from "Contracts/ExplorerContracts";
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import React, { Component } from "react";
|
import React, { Component } from "react";
|
||||||
import * as Constants from "../../../Common/Constants";
|
import * as Constants from "../../../Common/Constants";
|
||||||
import { configContext, Platform } from "../../../ConfigContext";
|
import { configContext } from "../../../ConfigContext";
|
||||||
import * as ViewModels from "../../../Contracts/ViewModels";
|
import * as ViewModels from "../../../Contracts/ViewModels";
|
||||||
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";
|
||||||
@@ -9,6 +9,8 @@ import { isInvalidParentFrameOrigin, isReadyMessage } from "../../../Utils/Messa
|
|||||||
import { logConsoleError, logConsoleInfo, logConsoleProgress } from "../../../Utils/NotificationConsoleUtils";
|
import { logConsoleError, logConsoleInfo, logConsoleProgress } from "../../../Utils/NotificationConsoleUtils";
|
||||||
import Explorer from "../../Explorer";
|
import Explorer from "../../Explorer";
|
||||||
import TabsBase from "../TabsBase";
|
import TabsBase from "../TabsBase";
|
||||||
|
import { getMongoShellOrigin } from "./getMongoShellOrigin";
|
||||||
|
import { getMongoShellUrl } from "./getMongoShellUrl";
|
||||||
|
|
||||||
//eslint-disable-next-line
|
//eslint-disable-next-line
|
||||||
class MessageType {
|
class MessageType {
|
||||||
@@ -47,7 +49,6 @@ export default class MongoShellTabComponent extends Component<
|
|||||||
IMongoShellTabComponentProps,
|
IMongoShellTabComponentProps,
|
||||||
IMongoShellTabComponentStates
|
IMongoShellTabComponentStates
|
||||||
> {
|
> {
|
||||||
private _runtimeEndpoint: string;
|
|
||||||
private _logTraces: Map<string, number>;
|
private _logTraces: Map<string, number>;
|
||||||
|
|
||||||
constructor(props: IMongoShellTabComponentProps) {
|
constructor(props: IMongoShellTabComponentProps) {
|
||||||
@@ -55,7 +56,7 @@ export default class MongoShellTabComponent extends Component<
|
|||||||
this._logTraces = new Map();
|
this._logTraces = new Map();
|
||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
url: this.getURL(),
|
url: getMongoShellUrl(),
|
||||||
};
|
};
|
||||||
|
|
||||||
props.onMongoShellTabAccessor({
|
props.onMongoShellTabAccessor({
|
||||||
@@ -65,22 +66,6 @@ export default class MongoShellTabComponent extends Component<
|
|||||||
window.addEventListener("message", this.handleMessage.bind(this), false);
|
window.addEventListener("message", this.handleMessage.bind(this), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public getURL(): string {
|
|
||||||
const { databaseAccount: account } = userContext;
|
|
||||||
const resourceId = account?.id;
|
|
||||||
const accountName = account?.name;
|
|
||||||
const mongoEndpoint = account?.properties?.mongoEndpoint || account?.properties?.documentEndpoint;
|
|
||||||
|
|
||||||
this._runtimeEndpoint = configContext.platform === Platform.Hosted ? configContext.BACKEND_ENDPOINT : "";
|
|
||||||
const extensionEndpoint: string = configContext.BACKEND_ENDPOINT || this._runtimeEndpoint || "";
|
|
||||||
let baseUrl = "/content/mongoshell/dist/";
|
|
||||||
if (userContext.portalEnv === "localhost") {
|
|
||||||
baseUrl = "/content/mongoshell/";
|
|
||||||
}
|
|
||||||
|
|
||||||
return `${extensionEndpoint}${baseUrl}index.html?resourceId=${resourceId}&accountName=${accountName}&mongoEndpoint=${mongoEndpoint}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
//eslint-disable-next-line
|
//eslint-disable-next-line
|
||||||
public setContentFocus(event: React.SyntheticEvent<HTMLIFrameElement, Event>): void {}
|
public setContentFocus(event: React.SyntheticEvent<HTMLIFrameElement, Event>): void {}
|
||||||
|
|
||||||
@@ -136,6 +121,7 @@ export default class MongoShellTabComponent extends Component<
|
|||||||
const collectionId = this.props.collection.id();
|
const collectionId = this.props.collection.id();
|
||||||
const apiEndpoint = configContext.BACKEND_ENDPOINT;
|
const apiEndpoint = configContext.BACKEND_ENDPOINT;
|
||||||
const encryptedAuthToken: string = userContext.accessToken;
|
const encryptedAuthToken: string = userContext.accessToken;
|
||||||
|
const targetOrigin = getMongoShellOrigin();
|
||||||
|
|
||||||
shellIframe.contentWindow.postMessage(
|
shellIframe.contentWindow.postMessage(
|
||||||
{
|
{
|
||||||
@@ -151,7 +137,7 @@ export default class MongoShellTabComponent extends Component<
|
|||||||
apiEndpoint: apiEndpoint,
|
apiEndpoint: apiEndpoint,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
configContext.BACKEND_ENDPOINT
|
targetOrigin
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
86
src/Explorer/Tabs/MongoShellTab/getMongoShellOrigin.test.ts
Normal file
86
src/Explorer/Tabs/MongoShellTab/getMongoShellOrigin.test.ts
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
import { extractFeatures } from "Platform/Hosted/extractFeatures";
|
||||||
|
import { configContext } from "../../../ConfigContext";
|
||||||
|
import { updateUserContext } from "../../../UserContext";
|
||||||
|
import { getMongoShellOrigin } from "./getMongoShellOrigin";
|
||||||
|
|
||||||
|
describe("getMongoShellOrigin", () => {
|
||||||
|
(window as { origin: string }).origin = "window_origin";
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
updateUserContext({
|
||||||
|
features: extractFeatures(
|
||||||
|
new URLSearchParams({
|
||||||
|
"feature.enableLegacyMongoShellV1": "false",
|
||||||
|
"feature.enableLegacyMongoShellV2": "false",
|
||||||
|
"feature.enableLegacyMongoShellV1Debug": "false",
|
||||||
|
"feature.enableLegacyMongoShellV2Debug": "false",
|
||||||
|
"feature.loadLegacyMongoShellFromBE": "false",
|
||||||
|
})
|
||||||
|
),
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should return by default", () => {
|
||||||
|
expect(getMongoShellOrigin()).toBe(window.origin);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should return window.origin when enableLegacyMongoShellV1", () => {
|
||||||
|
updateUserContext({
|
||||||
|
features: extractFeatures(
|
||||||
|
new URLSearchParams({
|
||||||
|
"feature.enableLegacyMongoShellV1": "true",
|
||||||
|
})
|
||||||
|
),
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(getMongoShellOrigin()).toBe(window.origin);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should return window.origin when enableLegacyMongoShellV2===true", () => {
|
||||||
|
updateUserContext({
|
||||||
|
features: extractFeatures(
|
||||||
|
new URLSearchParams({
|
||||||
|
"feature.enableLegacyMongoShellV2": "true",
|
||||||
|
})
|
||||||
|
),
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(getMongoShellOrigin()).toBe(window.origin);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should return window.origin when enableLegacyMongoShellV1Debug===true", () => {
|
||||||
|
updateUserContext({
|
||||||
|
features: extractFeatures(
|
||||||
|
new URLSearchParams({
|
||||||
|
"feature.enableLegacyMongoShellV1Debug": "true",
|
||||||
|
})
|
||||||
|
),
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(getMongoShellOrigin()).toBe(window.origin);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should return window.origin when enableLegacyMongoShellV2Debug===true", () => {
|
||||||
|
updateUserContext({
|
||||||
|
features: extractFeatures(
|
||||||
|
new URLSearchParams({
|
||||||
|
"feature.enableLegacyMongoShellV2Debug": "true",
|
||||||
|
})
|
||||||
|
),
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(getMongoShellOrigin()).toBe(window.origin);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should return BACKEND_ENDPOINT when loadLegacyMongoShellFromBE===true", () => {
|
||||||
|
updateUserContext({
|
||||||
|
features: extractFeatures(
|
||||||
|
new URLSearchParams({
|
||||||
|
"feature.loadLegacyMongoShellFromBE": "true",
|
||||||
|
})
|
||||||
|
),
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(getMongoShellOrigin()).toBe(configContext.BACKEND_ENDPOINT);
|
||||||
|
});
|
||||||
|
});
|
||||||
10
src/Explorer/Tabs/MongoShellTab/getMongoShellOrigin.ts
Normal file
10
src/Explorer/Tabs/MongoShellTab/getMongoShellOrigin.ts
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
import { configContext } from "../../../ConfigContext";
|
||||||
|
import { userContext } from "../../../UserContext";
|
||||||
|
|
||||||
|
export function getMongoShellOrigin(): string {
|
||||||
|
if (userContext.features.loadLegacyMongoShellFromBE === true) {
|
||||||
|
return configContext.BACKEND_ENDPOINT;
|
||||||
|
}
|
||||||
|
|
||||||
|
return window.origin;
|
||||||
|
}
|
||||||
206
src/Explorer/Tabs/MongoShellTab/getMongoShellUrl.test.ts
Normal file
206
src/Explorer/Tabs/MongoShellTab/getMongoShellUrl.test.ts
Normal file
@@ -0,0 +1,206 @@
|
|||||||
|
import { extractFeatures } from "Platform/Hosted/extractFeatures";
|
||||||
|
import { Platform, configContext, resetConfigContext, updateConfigContext } from "../../../ConfigContext";
|
||||||
|
import { updateUserContext, userContext } from "../../../UserContext";
|
||||||
|
import { getExtensionEndpoint, getMongoShellUrl } from "./getMongoShellUrl";
|
||||||
|
|
||||||
|
const mongoBackendEndpoint = "https://localhost:1234";
|
||||||
|
|
||||||
|
describe("getMongoShellUrl", () => {
|
||||||
|
let queryString = "";
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
resetConfigContext();
|
||||||
|
|
||||||
|
updateConfigContext({
|
||||||
|
BACKEND_ENDPOINT: mongoBackendEndpoint,
|
||||||
|
platform: Platform.Hosted,
|
||||||
|
});
|
||||||
|
|
||||||
|
updateUserContext({
|
||||||
|
subscriptionId: "fakeSubscriptionId",
|
||||||
|
resourceGroup: "fakeResourceGroup",
|
||||||
|
databaseAccount: {
|
||||||
|
id: "fakeId",
|
||||||
|
name: "fakeName",
|
||||||
|
location: "fakeLocation",
|
||||||
|
type: "fakeType",
|
||||||
|
kind: "fakeKind",
|
||||||
|
properties: {
|
||||||
|
documentEndpoint: "fakeDocumentEndpoint",
|
||||||
|
tableEndpoint: "fakeTableEndpoint",
|
||||||
|
gremlinEndpoint: "fakeGremlinEndpoint",
|
||||||
|
cassandraEndpoint: "fakeCassandraEndpoint",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
features: extractFeatures(
|
||||||
|
new URLSearchParams({
|
||||||
|
"feature.enableLegacyMongoShellV1": "false",
|
||||||
|
"feature.enableLegacyMongoShellV2": "false",
|
||||||
|
"feature.enableLegacyMongoShellV1Debug": "false",
|
||||||
|
"feature.enableLegacyMongoShellV2Debug": "false",
|
||||||
|
"feature.loadLegacyMongoShellFromBE": "false",
|
||||||
|
})
|
||||||
|
),
|
||||||
|
portalEnv: "prod",
|
||||||
|
});
|
||||||
|
|
||||||
|
queryString = `resourceId=${userContext.databaseAccount.id}&accountName=${userContext.databaseAccount.name}&mongoEndpoint=${userContext.databaseAccount.properties.documentEndpoint}`;
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should return /mongoshell/indexv2.html by default ", () => {
|
||||||
|
expect(getMongoShellUrl()).toBe(`/mongoshell/indexv2.html?${queryString}`);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should return /mongoshell/indexv2.html when portalEnv==localhost ", () => {
|
||||||
|
updateUserContext({
|
||||||
|
portalEnv: "localhost",
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(getMongoShellUrl()).toBe(`/mongoshell/indexv2.html?${queryString}`);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should return /mongoshell/index.html when enableLegacyMongoShellV1===true", () => {
|
||||||
|
updateUserContext({
|
||||||
|
features: extractFeatures(
|
||||||
|
new URLSearchParams({
|
||||||
|
"feature.enableLegacyMongoShellV1": "true",
|
||||||
|
})
|
||||||
|
),
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(getMongoShellUrl()).toBe(`/mongoshell/index.html?${queryString}`);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should return /mongoshell/index.html when enableLegacyMongoShellV2===true", () => {
|
||||||
|
updateUserContext({
|
||||||
|
features: extractFeatures(
|
||||||
|
new URLSearchParams({
|
||||||
|
"feature.enableLegacyMongoShellV2": "true",
|
||||||
|
})
|
||||||
|
),
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(getMongoShellUrl()).toBe(`/mongoshell/indexv2.html?${queryString}`);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should return /mongoshell/index.html when enableLegacyMongoShellV1Debug===true", () => {
|
||||||
|
updateUserContext({
|
||||||
|
features: extractFeatures(
|
||||||
|
new URLSearchParams({
|
||||||
|
"feature.enableLegacyMongoShellV1Debug": "true",
|
||||||
|
})
|
||||||
|
),
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(getMongoShellUrl()).toBe(`/mongoshell/debug/index.html?${queryString}`);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should return /mongoshell/index.html when enableLegacyMongoShellV2Debug===true", () => {
|
||||||
|
updateUserContext({
|
||||||
|
features: extractFeatures(
|
||||||
|
new URLSearchParams({
|
||||||
|
"feature.enableLegacyMongoShellV2Debug": "true",
|
||||||
|
})
|
||||||
|
),
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(getMongoShellUrl()).toBe(`/mongoshell/debug/indexv2.html?${queryString}`);
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("loadLegacyMongoShellFromBE===true", () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
resetConfigContext();
|
||||||
|
updateConfigContext({
|
||||||
|
BACKEND_ENDPOINT: mongoBackendEndpoint,
|
||||||
|
platform: Platform.Hosted,
|
||||||
|
});
|
||||||
|
|
||||||
|
updateUserContext({
|
||||||
|
features: extractFeatures(
|
||||||
|
new URLSearchParams({
|
||||||
|
"feature.loadLegacyMongoShellFromBE": "true",
|
||||||
|
})
|
||||||
|
),
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should return /mongoshell/index.html", () => {
|
||||||
|
const endpoint = getExtensionEndpoint(configContext.platform, configContext.BACKEND_ENDPOINT);
|
||||||
|
expect(getMongoShellUrl()).toBe(`${endpoint}/content/mongoshell/debug/index.html?${queryString}`);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("configContext.platform !== Platform.Hosted, should return /mongoshell/indexv2.html", () => {
|
||||||
|
updateConfigContext({
|
||||||
|
platform: Platform.Portal,
|
||||||
|
});
|
||||||
|
|
||||||
|
const endpoint = getExtensionEndpoint(configContext.platform, configContext.BACKEND_ENDPOINT);
|
||||||
|
expect(getMongoShellUrl()).toBe(`${endpoint}/content/mongoshell/debug/index.html?${queryString}`);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("configContext.BACKEND_ENDPOINT !== '' and configContext.platform !== Platform.Hosted, should return /mongoshell/indexv2.html", () => {
|
||||||
|
resetConfigContext();
|
||||||
|
updateConfigContext({
|
||||||
|
platform: Platform.Portal,
|
||||||
|
BACKEND_ENDPOINT: mongoBackendEndpoint,
|
||||||
|
});
|
||||||
|
|
||||||
|
const endpoint = getExtensionEndpoint(configContext.platform, configContext.BACKEND_ENDPOINT);
|
||||||
|
expect(getMongoShellUrl()).toBe(`${endpoint}/content/mongoshell/debug/index.html?${queryString}`);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("configContext.BACKEND_ENDPOINT === '' and configContext.platform === Platform.Hosted, should return /mongoshell/indexv2.html ", () => {
|
||||||
|
resetConfigContext();
|
||||||
|
updateConfigContext({
|
||||||
|
platform: Platform.Hosted,
|
||||||
|
});
|
||||||
|
|
||||||
|
const endpoint = getExtensionEndpoint(configContext.platform, configContext.BACKEND_ENDPOINT);
|
||||||
|
expect(getMongoShellUrl()).toBe(`${endpoint}/content/mongoshell/debug/index.html?${queryString}`);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("configContext.BACKEND_ENDPOINT === '' and configContext.platform !== Platform.Hosted, should return /mongoshell/indexv2.html", () => {
|
||||||
|
resetConfigContext();
|
||||||
|
updateConfigContext({
|
||||||
|
platform: Platform.Portal,
|
||||||
|
});
|
||||||
|
|
||||||
|
const endpoint = getExtensionEndpoint(configContext.platform, configContext.BACKEND_ENDPOINT);
|
||||||
|
expect(getMongoShellUrl()).toBe(`${endpoint}/content/mongoshell/debug/index.html?${queryString}`);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("getExtensionEndpoint", () => {
|
||||||
|
it("when platform === Platform.Hosted, backendEndpoint is undefined ", () => {
|
||||||
|
expect(getExtensionEndpoint(Platform.Hosted, undefined)).toBe("");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("when platform === Platform.Hosted, backendEndpoint === ''", () => {
|
||||||
|
expect(getExtensionEndpoint(Platform.Hosted, "")).toBe("");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("when platform === Platform.Hosted, backendEndpoint === null", () => {
|
||||||
|
expect(getExtensionEndpoint(Platform.Hosted, null)).toBe("");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("when platform === Platform.Hosted, backendEndpoint != '' ", () => {
|
||||||
|
expect(getExtensionEndpoint(Platform.Hosted, "foo")).toBe("foo");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("when platform === Platform.Portal, backendEndpoint is udefined ", () => {
|
||||||
|
expect(getExtensionEndpoint(Platform.Portal, undefined)).toBe("");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("when platform === Platform.Portal, backendEndpoint === '' ", () => {
|
||||||
|
expect(getExtensionEndpoint(Platform.Portal, "")).toBe("");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("when platform === Platform.Portal, backendEndpoint === null", () => {
|
||||||
|
expect(getExtensionEndpoint(Platform.Portal, null)).toBe("");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("when platform !== Platform.Portal, backendEndpoint != '' ", () => {
|
||||||
|
expect(getExtensionEndpoint(Platform.Portal, "foo")).toBe("foo");
|
||||||
|
});
|
||||||
|
});
|
||||||
45
src/Explorer/Tabs/MongoShellTab/getMongoShellUrl.ts
Normal file
45
src/Explorer/Tabs/MongoShellTab/getMongoShellUrl.ts
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
import { configContext, Platform } from "../../../ConfigContext";
|
||||||
|
import { userContext } from "../../../UserContext";
|
||||||
|
|
||||||
|
export function getMongoShellUrl(): string {
|
||||||
|
const { databaseAccount: account } = userContext;
|
||||||
|
const resourceId = account?.id;
|
||||||
|
const accountName = account?.name;
|
||||||
|
const mongoEndpoint = account?.properties?.mongoEndpoint || account?.properties?.documentEndpoint;
|
||||||
|
const queryString = `resourceId=${resourceId}&accountName=${accountName}&mongoEndpoint=${mongoEndpoint}`;
|
||||||
|
|
||||||
|
if (userContext.features.enableLegacyMongoShellV1 === true) {
|
||||||
|
return `/mongoshell/index.html?${queryString}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (userContext.features.enableLegacyMongoShellV1Debug === true) {
|
||||||
|
return `/mongoshell/debug/index.html?${queryString}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (userContext.features.enableLegacyMongoShellV2 === true) {
|
||||||
|
return `/mongoshell/indexv2.html?${queryString}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (userContext.features.enableLegacyMongoShellV2Debug === true) {
|
||||||
|
return `/mongoshell/debug/indexv2.html?${queryString}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (userContext.portalEnv === "localhost") {
|
||||||
|
return `/mongoshell/indexv2.html?${queryString}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (userContext.features.loadLegacyMongoShellFromBE === true) {
|
||||||
|
const extensionEndpoint: string = getExtensionEndpoint(configContext.platform, configContext.BACKEND_ENDPOINT);
|
||||||
|
return `${extensionEndpoint}/content/mongoshell/debug/index.html?${queryString}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
return `/mongoshell/indexv2.html?${queryString}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getExtensionEndpoint(platform: string, backendEndpoint: string): string {
|
||||||
|
const runtimeEndpoint = platform === Platform.Hosted ? backendEndpoint : "";
|
||||||
|
|
||||||
|
const extensionEndpoint: string = backendEndpoint || runtimeEndpoint || "";
|
||||||
|
|
||||||
|
return extensionEndpoint;
|
||||||
|
}
|
||||||
@@ -30,6 +30,11 @@ export type Features = {
|
|||||||
readonly mongoProxyAPIs?: string;
|
readonly mongoProxyAPIs?: string;
|
||||||
readonly enableThroughputCap: boolean;
|
readonly enableThroughputCap: boolean;
|
||||||
readonly enableHierarchicalKeys: boolean;
|
readonly enableHierarchicalKeys: boolean;
|
||||||
|
readonly enableLegacyMongoShellV1: boolean;
|
||||||
|
readonly enableLegacyMongoShellV1Debug: boolean;
|
||||||
|
readonly enableLegacyMongoShellV2: boolean;
|
||||||
|
readonly enableLegacyMongoShellV2Debug: boolean;
|
||||||
|
readonly loadLegacyMongoShellFromBE: boolean;
|
||||||
|
|
||||||
// can be set via both flight and feature flag
|
// can be set via both flight and feature flag
|
||||||
autoscaleDefault: boolean;
|
autoscaleDefault: boolean;
|
||||||
@@ -92,6 +97,11 @@ export function extractFeatures(given = new URLSearchParams(window.location.sear
|
|||||||
notebooksDownBanner: "true" === get("notebooksDownBanner"),
|
notebooksDownBanner: "true" === get("notebooksDownBanner"),
|
||||||
enableThroughputCap: "true" === get("enablethroughputcap"),
|
enableThroughputCap: "true" === get("enablethroughputcap"),
|
||||||
enableHierarchicalKeys: "true" === get("enablehierarchicalkeys"),
|
enableHierarchicalKeys: "true" === get("enablehierarchicalkeys"),
|
||||||
|
enableLegacyMongoShellV1: "true" === get("enablelegacymongoshellv1"),
|
||||||
|
enableLegacyMongoShellV1Debug: "true" === get("enablelegacymongoshellv1debug"),
|
||||||
|
enableLegacyMongoShellV2: "true" === get("enablelegacymongoshellv2"),
|
||||||
|
enableLegacyMongoShellV2Debug: "true" === get("enablelegacymongoshellv2debug"),
|
||||||
|
loadLegacyMongoShellFromBE: "true" === get("loadlegacymongoshellfrombe"),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user