mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-23 19:01:28 +00:00
Compare commits
1 Commits
eslint/fix
...
fixed-tsst
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a99e275f71 |
@@ -44,6 +44,8 @@ src/Explorer/DataSamples/ContainerSampleGenerator.test.ts
|
|||||||
src/Explorer/DataSamples/ContainerSampleGenerator.ts
|
src/Explorer/DataSamples/ContainerSampleGenerator.ts
|
||||||
src/Explorer/DataSamples/DataSamplesUtil.test.ts
|
src/Explorer/DataSamples/DataSamplesUtil.test.ts
|
||||||
src/Explorer/DataSamples/DataSamplesUtil.ts
|
src/Explorer/DataSamples/DataSamplesUtil.ts
|
||||||
|
src/Explorer/Graph/GraphExplorerComponent/ArraysByKeyCache.test.ts
|
||||||
|
src/Explorer/Graph/GraphExplorerComponent/ArraysByKeyCache.ts
|
||||||
src/Explorer/Graph/GraphExplorerComponent/D3ForceGraph.test.ts
|
src/Explorer/Graph/GraphExplorerComponent/D3ForceGraph.test.ts
|
||||||
src/Explorer/Graph/GraphExplorerComponent/D3ForceGraph.ts
|
src/Explorer/Graph/GraphExplorerComponent/D3ForceGraph.ts
|
||||||
src/Explorer/Graph/GraphExplorerComponent/EdgeInfoCache.ts
|
src/Explorer/Graph/GraphExplorerComponent/EdgeInfoCache.ts
|
||||||
|
|||||||
@@ -1,8 +1,16 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"
|
<svg
|
||||||
|
width="16"
|
||||||
|
height="16"
|
||||||
|
version="1.1"
|
||||||
|
viewBox="0 0 16 16"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
xmlns:xlink="http://www.w3.org/1999/xlink">
|
xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||||
<path
|
<path
|
||||||
d="M14,2.691l-5.301,5.309l5.301,5.309l-0.691,0.691l-5.309,-5.301l-5.309,5.301l-0.691,-0.691l5.301,-5.309l-5.301,-5.309l0.691,-0.691l5.309,5.301l5.309,-5.301l0.691,0.691Z"
|
d="M14,2.691l-5.301,5.309l5.301,5.309l-0.691,0.691l-5.309,-5.301l-5.309,5.301l-0.691,-0.691l5.301,-5.309l-5.301,-5.309l0.691,-0.691l5.309,5.301l5.309,-5.301l0.691,0.691Z"
|
||||||
transform="scale(0.5)" fill="#000" stroke="#000">
|
transform="scale(0.5)"
|
||||||
|
fill="#000"
|
||||||
|
stroke="#CCC"
|
||||||
|
>
|
||||||
</path>
|
</path>
|
||||||
</svg>
|
</svg>
|
||||||
|
Before Width: | Height: | Size: 449 B After Width: | Height: | Size: 503 B |
@@ -37,8 +37,8 @@ module.exports = {
|
|||||||
global: {
|
global: {
|
||||||
branches: 25,
|
branches: 25,
|
||||||
functions: 25,
|
functions: 25,
|
||||||
lines: 29.5,
|
lines: 30,
|
||||||
statements: 29.5,
|
statements: 30,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -2357,8 +2357,6 @@ a:link {
|
|||||||
height: 100%;
|
height: 100%;
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
min-height: 300px;
|
|
||||||
overflow-y: scroll;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.tabs {
|
.tabs {
|
||||||
@@ -2834,8 +2832,6 @@ a:link {
|
|||||||
|
|
||||||
#explorerNotificationConsole {
|
#explorerNotificationConsole {
|
||||||
z-index: 1000;
|
z-index: 1000;
|
||||||
overflow-y: auto;
|
|
||||||
overflow-x: clip;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.uniqueIndexesContainer {
|
.uniqueIndexesContainer {
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import React, { FunctionComponent, MutableRefObject, useEffect, useRef } from "react";
|
import React, { FunctionComponent } from "react";
|
||||||
import arrowLeftImg from "../../images/imgarrowlefticon.svg";
|
import arrowLeftImg from "../../images/imgarrowlefticon.svg";
|
||||||
import { userContext } from "../UserContext";
|
import { userContext } from "../UserContext";
|
||||||
import { NormalizedEventKey } from "./Constants";
|
|
||||||
|
|
||||||
export interface CollapsedResourceTreeProps {
|
export interface CollapsedResourceTreeProps {
|
||||||
toggleLeftPaneExpanded: () => void;
|
toggleLeftPaneExpanded: () => void;
|
||||||
@@ -12,21 +11,6 @@ export const CollapsedResourceTree: FunctionComponent<CollapsedResourceTreeProps
|
|||||||
toggleLeftPaneExpanded,
|
toggleLeftPaneExpanded,
|
||||||
isLeftPaneExpanded,
|
isLeftPaneExpanded,
|
||||||
}: CollapsedResourceTreeProps): JSX.Element => {
|
}: CollapsedResourceTreeProps): JSX.Element => {
|
||||||
const focusButton = useRef<HTMLLIElement>() as MutableRefObject<HTMLLIElement>;
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (focusButton.current) {
|
|
||||||
focusButton.current.focus();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
const onKeyPressToggleLeftPaneExpanded = (event: React.KeyboardEvent) => {
|
|
||||||
if (event.key === NormalizedEventKey.Space || event.key === NormalizedEventKey.Enter) {
|
|
||||||
toggleLeftPaneExpanded();
|
|
||||||
event.stopPropagation();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div id="mini" className={!isLeftPaneExpanded ? "mini toggle-mini" : "hiddenMain"}>
|
<div id="mini" className={!isLeftPaneExpanded ? "mini toggle-mini" : "hiddenMain"}>
|
||||||
<div className="main-nav nav">
|
<div className="main-nav nav">
|
||||||
@@ -37,14 +21,11 @@ export const CollapsedResourceTree: FunctionComponent<CollapsedResourceTreeProps
|
|||||||
role="button"
|
role="button"
|
||||||
tabIndex={0}
|
tabIndex={0}
|
||||||
aria-label="Expand Tree"
|
aria-label="Expand Tree"
|
||||||
onClick={toggleLeftPaneExpanded}
|
|
||||||
onKeyPress={onKeyPressToggleLeftPaneExpanded}
|
|
||||||
ref={focusButton}
|
|
||||||
>
|
>
|
||||||
<span className="leftarrowCollapsed">
|
<span className="leftarrowCollapsed" onClick={toggleLeftPaneExpanded}>
|
||||||
<img className="arrowCollapsed" src={arrowLeftImg} alt="Expand" />
|
<img className="arrowCollapsed" src={arrowLeftImg} alt="Expand" />
|
||||||
</span>
|
</span>
|
||||||
<span className="collectionCollapsed">
|
<span className="collectionCollapsed" onClick={toggleLeftPaneExpanded}>
|
||||||
<span>{userContext.apiType} API</span>
|
<span>{userContext.apiType} API</span>
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
|
|||||||
@@ -96,7 +96,6 @@ export class Flights {
|
|||||||
public static readonly AutoscaleTest = "autoscaletest";
|
public static readonly AutoscaleTest = "autoscaletest";
|
||||||
public static readonly PartitionKeyTest = "partitionkeytest";
|
public static readonly PartitionKeyTest = "partitionkeytest";
|
||||||
public static readonly PKPartitionKeyTest = "pkpartitionkeytest";
|
public static readonly PKPartitionKeyTest = "pkpartitionkeytest";
|
||||||
public static readonly Phoenix = "phoenix";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class AfecFeatures {
|
export class AfecFeatures {
|
||||||
@@ -338,14 +337,6 @@ export enum ConflictOperationType {
|
|||||||
Delete = "delete",
|
Delete = "delete",
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum ConnectionStatusType {
|
|
||||||
Connect = "Connect",
|
|
||||||
Connecting = "Connecting",
|
|
||||||
Connected = "Connected",
|
|
||||||
Failed = "Connection Failed",
|
|
||||||
ReConnect = "Reconnect",
|
|
||||||
}
|
|
||||||
|
|
||||||
export const EmulatorMasterKey =
|
export const EmulatorMasterKey =
|
||||||
//[SuppressMessage("Microsoft.Security", "CS002:SecretInNextLine", Justification="Well known public masterKey for emulator")]
|
//[SuppressMessage("Microsoft.Security", "CS002:SecretInNextLine", Justification="Well known public masterKey for emulator")]
|
||||||
"C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==";
|
"C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==";
|
||||||
@@ -355,32 +346,15 @@ export const StyleConstants = require("less-vars-loader!../../less/Common/Consta
|
|||||||
|
|
||||||
export class Notebook {
|
export class Notebook {
|
||||||
public static readonly defaultBasePath = "./notebooks";
|
public static readonly defaultBasePath = "./notebooks";
|
||||||
public static readonly heartbeatDelayMs = 60000;
|
public static readonly heartbeatDelayMs = 5000;
|
||||||
public static readonly kernelRestartInitialDelayMs = 1000;
|
public static readonly kernelRestartInitialDelayMs = 1000;
|
||||||
public static readonly kernelRestartMaxDelayMs = 20000;
|
public static readonly kernelRestartMaxDelayMs = 20000;
|
||||||
public static readonly autoSaveIntervalMs = 120000;
|
public static readonly autoSaveIntervalMs = 120000;
|
||||||
public static readonly memoryGuageToGB = 1048576;
|
|
||||||
public static readonly temporarilyDownMsg = "Notebooks is currently not available. We are working on it.";
|
public static readonly temporarilyDownMsg = "Notebooks is currently not available. We are working on it.";
|
||||||
public static readonly mongoShellTemporarilyDownMsg =
|
public static readonly mongoShellTemporarilyDownMsg =
|
||||||
"We have identified an issue with the Mongo Shell and it is unavailable right now. We are actively working on the mitigation.";
|
"We have identified an issue with the Mongo Shell and it is unavailable right now. We are actively working on the mitigation.";
|
||||||
public static readonly cassandraShellTemporarilyDownMsg =
|
public static readonly cassandraShellTemporarilyDownMsg =
|
||||||
"We have identified an issue with the Cassandra Shell and it is unavailable right now. We are actively working on the mitigation.";
|
"We have identified an issue with the Cassandra Shell and it is unavailable right now. We are actively working on the mitigation.";
|
||||||
public static saveNotebookModalTitle = "Save Notebook in temporary workspace";
|
|
||||||
public static saveNotebookModalContent =
|
|
||||||
"This notebook will be saved in the temporary workspace and will be removed when the session expires. To save your work permanently, save your notebooks to a GitHub repository or download the notebooks to your local machine before the session ends.";
|
|
||||||
public static newNotebookModalTitle = "Create Notebook in temporary workspace";
|
|
||||||
public static newNotebookUploadModalTitle = "Upload Notebook in temporary workspace";
|
|
||||||
public static newNotebookModalContent1 =
|
|
||||||
"A temporary workspace will be created to enable you to work with notebooks. When the session expires, any notebooks in the workspace will be removed.";
|
|
||||||
public static newNotebookModalContent2 =
|
|
||||||
"To save your work permanently, save your notebooks to a GitHub repository or download the notebooks to your local machine before the session ends. ";
|
|
||||||
public static galleryNotebookDownloadContent1 =
|
|
||||||
"To download, run, and make changes to this sample notebook, a temporary workspace will be created. When the session expires, any notebooks in the workspace will be removed.";
|
|
||||||
public static galleryNotebookDownloadContent2 =
|
|
||||||
"To save your work permanently, save your notebooks to a GitHub repository or download the Notebooks to your local machine before the session ends. ";
|
|
||||||
public static cosmosNotebookHomePageUrl = "https://aka.ms/cosmos-notebooks-limits";
|
|
||||||
public static cosmosNotebookGitDocumentationUrl = "https://aka.ms/cosmos-notebooks-github";
|
|
||||||
public static learnMore = "Learn more.";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class SparkLibrary {
|
export class SparkLibrary {
|
||||||
|
|||||||
@@ -3,16 +3,8 @@ import { resetConfigContext, updateConfigContext } from "../ConfigContext";
|
|||||||
import { DatabaseAccount } from "../Contracts/DataModels";
|
import { DatabaseAccount } from "../Contracts/DataModels";
|
||||||
import { Collection } from "../Contracts/ViewModels";
|
import { Collection } from "../Contracts/ViewModels";
|
||||||
import DocumentId from "../Explorer/Tree/DocumentId";
|
import DocumentId from "../Explorer/Tree/DocumentId";
|
||||||
import { extractFeatures } from "../Platform/Hosted/extractFeatures";
|
|
||||||
import { updateUserContext } from "../UserContext";
|
import { updateUserContext } from "../UserContext";
|
||||||
import {
|
import { deleteDocument, getEndpoint, queryDocuments, readDocument, updateDocument } from "./MongoProxyClient";
|
||||||
deleteDocument,
|
|
||||||
getEndpoint,
|
|
||||||
getFeatureEndpointOrDefault,
|
|
||||||
queryDocuments,
|
|
||||||
readDocument,
|
|
||||||
updateDocument,
|
|
||||||
} from "./MongoProxyClient";
|
|
||||||
|
|
||||||
const databaseId = "testDB";
|
const databaseId = "testDB";
|
||||||
|
|
||||||
@@ -254,31 +246,4 @@ describe("MongoProxyClient", () => {
|
|||||||
expect(endpoint).toEqual("https://main.documentdb.ext.azure.com/api/guest/mongo/explorer");
|
expect(endpoint).toEqual("https://main.documentdb.ext.azure.com/api/guest/mongo/explorer");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
describe("getFeatureEndpointOrDefault", () => {
|
|
||||||
beforeEach(() => {
|
|
||||||
resetConfigContext();
|
|
||||||
updateConfigContext({
|
|
||||||
BACKEND_ENDPOINT: "https://main.documentdb.ext.azure.com",
|
|
||||||
});
|
|
||||||
const params = new URLSearchParams({
|
|
||||||
"feature.mongoProxyEndpoint": "https://localhost:12901",
|
|
||||||
"feature.mongoProxyAPIs": "readDocument|createDocument",
|
|
||||||
});
|
|
||||||
const features = extractFeatures(params);
|
|
||||||
updateUserContext({
|
|
||||||
authType: AuthType.AAD,
|
|
||||||
features: features,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it("returns a local endpoint", () => {
|
|
||||||
const endpoint = getFeatureEndpointOrDefault("readDocument");
|
|
||||||
expect(endpoint).toEqual("https://localhost:12901/api/mongo/explorer");
|
|
||||||
});
|
|
||||||
|
|
||||||
it("returns a production endpoint", () => {
|
|
||||||
const endpoint = getFeatureEndpointOrDefault("deleteDocument");
|
|
||||||
expect(endpoint).toEqual("https://main.documentdb.ext.azure.com/api/mongo/explorer");
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import * as DataModels from "../Contracts/DataModels";
|
|||||||
import { MessageTypes } from "../Contracts/ExplorerContracts";
|
import { MessageTypes } from "../Contracts/ExplorerContracts";
|
||||||
import { Collection } from "../Contracts/ViewModels";
|
import { Collection } from "../Contracts/ViewModels";
|
||||||
import DocumentId from "../Explorer/Tree/DocumentId";
|
import DocumentId from "../Explorer/Tree/DocumentId";
|
||||||
import { hasFlag } from "../Platform/Hosted/extractFeatures";
|
|
||||||
import { userContext } from "../UserContext";
|
import { userContext } from "../UserContext";
|
||||||
import { logConsoleError } from "../Utils/NotificationConsoleUtils";
|
import { logConsoleError } from "../Utils/NotificationConsoleUtils";
|
||||||
import { ApiType, HttpHeaders, HttpStatusCodes } from "./Constants";
|
import { ApiType, HttpHeaders, HttpStatusCodes } from "./Constants";
|
||||||
@@ -79,7 +78,7 @@ export function queryDocuments(
|
|||||||
: "",
|
: "",
|
||||||
};
|
};
|
||||||
|
|
||||||
const endpoint = getFeatureEndpointOrDefault("resourcelist") || "";
|
const endpoint = getEndpoint() || "";
|
||||||
|
|
||||||
const headers = {
|
const headers = {
|
||||||
...defaultHeaders,
|
...defaultHeaders,
|
||||||
@@ -142,8 +141,7 @@ export function readDocument(
|
|||||||
: "",
|
: "",
|
||||||
};
|
};
|
||||||
|
|
||||||
const endpoint = getFeatureEndpointOrDefault("readDocument");
|
const endpoint = getEndpoint();
|
||||||
|
|
||||||
return window
|
return window
|
||||||
.fetch(`${endpoint}?${queryString.stringify(params)}`, {
|
.fetch(`${endpoint}?${queryString.stringify(params)}`, {
|
||||||
method: "GET",
|
method: "GET",
|
||||||
@@ -183,7 +181,7 @@ export function createDocument(
|
|||||||
pk: collection && collection.partitionKey && !collection.partitionKey.systemKey ? partitionKeyProperty : "",
|
pk: collection && collection.partitionKey && !collection.partitionKey.systemKey ? partitionKeyProperty : "",
|
||||||
};
|
};
|
||||||
|
|
||||||
const endpoint = getFeatureEndpointOrDefault("createDocument");
|
const endpoint = getEndpoint();
|
||||||
|
|
||||||
return window
|
return window
|
||||||
.fetch(`${endpoint}/resourcelist?${queryString.stringify(params)}`, {
|
.fetch(`${endpoint}/resourcelist?${queryString.stringify(params)}`, {
|
||||||
@@ -227,7 +225,7 @@ export function updateDocument(
|
|||||||
? documentId.partitionKeyProperty
|
? documentId.partitionKeyProperty
|
||||||
: "",
|
: "",
|
||||||
};
|
};
|
||||||
const endpoint = getFeatureEndpointOrDefault("updateDocument");
|
const endpoint = getEndpoint();
|
||||||
|
|
||||||
return window
|
return window
|
||||||
.fetch(`${endpoint}?${queryString.stringify(params)}`, {
|
.fetch(`${endpoint}?${queryString.stringify(params)}`, {
|
||||||
@@ -268,7 +266,7 @@ export function deleteDocument(databaseId: string, collection: Collection, docum
|
|||||||
? documentId.partitionKeyProperty
|
? documentId.partitionKeyProperty
|
||||||
: "",
|
: "",
|
||||||
};
|
};
|
||||||
const endpoint = getFeatureEndpointOrDefault("deleteDocument");
|
const endpoint = getEndpoint();
|
||||||
|
|
||||||
return window
|
return window
|
||||||
.fetch(`${endpoint}?${queryString.stringify(params)}`, {
|
.fetch(`${endpoint}?${queryString.stringify(params)}`, {
|
||||||
@@ -311,7 +309,7 @@ export function createMongoCollectionWithProxy(
|
|||||||
autoPilotThroughput: params.autoPilotMaxThroughput?.toString(),
|
autoPilotThroughput: params.autoPilotMaxThroughput?.toString(),
|
||||||
};
|
};
|
||||||
|
|
||||||
const endpoint = getFeatureEndpointOrDefault("createCollectionWithProxy");
|
const endpoint = getEndpoint();
|
||||||
|
|
||||||
return window
|
return window
|
||||||
.fetch(
|
.fetch(
|
||||||
@@ -335,15 +333,8 @@ export function createMongoCollectionWithProxy(
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getFeatureEndpointOrDefault(feature: string): string {
|
export function getEndpoint(): string {
|
||||||
return hasFlag(userContext.features.mongoProxyAPIs, feature)
|
let url = (configContext.MONGO_BACKEND_ENDPOINT || configContext.BACKEND_ENDPOINT) + "/api/mongo/explorer";
|
||||||
? getEndpoint(userContext.features.mongoProxyEndpoint)
|
|
||||||
: getEndpoint();
|
|
||||||
}
|
|
||||||
|
|
||||||
export function getEndpoint(customEndpoint?: string): string {
|
|
||||||
let url = customEndpoint ? customEndpoint : configContext.MONGO_BACKEND_ENDPOINT || configContext.BACKEND_ENDPOINT;
|
|
||||||
url += "/api/mongo/explorer";
|
|
||||||
|
|
||||||
if (userContext.authType === AuthType.EncryptedToken) {
|
if (userContext.authType === AuthType.EncryptedToken) {
|
||||||
url = url.replace("api/mongo", "api/guest/mongo");
|
url = url.replace("api/mongo", "api/guest/mongo");
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import React, { FunctionComponent, MutableRefObject, useEffect, useRef } from "react";
|
import React, { FunctionComponent } from "react";
|
||||||
import arrowLeftImg from "../../images/imgarrowlefticon.svg";
|
import arrowLeftImg from "../../images/imgarrowlefticon.svg";
|
||||||
import refreshImg from "../../images/refresh-cosmos.svg";
|
import refreshImg from "../../images/refresh-cosmos.svg";
|
||||||
import { AuthType } from "../AuthType";
|
import { AuthType } from "../AuthType";
|
||||||
@@ -6,7 +6,6 @@ import Explorer from "../Explorer/Explorer";
|
|||||||
import { ResourceTokenTree } from "../Explorer/Tree/ResourceTokenTree";
|
import { ResourceTokenTree } from "../Explorer/Tree/ResourceTokenTree";
|
||||||
import { ResourceTree } from "../Explorer/Tree/ResourceTree";
|
import { ResourceTree } from "../Explorer/Tree/ResourceTree";
|
||||||
import { userContext } from "../UserContext";
|
import { userContext } from "../UserContext";
|
||||||
import { NormalizedEventKey } from "./Constants";
|
|
||||||
|
|
||||||
export interface ResourceTreeContainerProps {
|
export interface ResourceTreeContainerProps {
|
||||||
toggleLeftPaneExpanded: () => void;
|
toggleLeftPaneExpanded: () => void;
|
||||||
@@ -19,22 +18,6 @@ export const ResourceTreeContainer: FunctionComponent<ResourceTreeContainerProps
|
|||||||
isLeftPaneExpanded,
|
isLeftPaneExpanded,
|
||||||
container,
|
container,
|
||||||
}: ResourceTreeContainerProps): JSX.Element => {
|
}: ResourceTreeContainerProps): JSX.Element => {
|
||||||
const focusButton = useRef<HTMLLIElement>() as MutableRefObject<HTMLLIElement>;
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (isLeftPaneExpanded) {
|
|
||||||
if (focusButton.current) {
|
|
||||||
focusButton.current.focus();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
const onKeyPressToggleLeftPaneExpanded = (event: React.KeyboardEvent) => {
|
|
||||||
if (event.key === NormalizedEventKey.Space || event.key === NormalizedEventKey.Enter) {
|
|
||||||
toggleLeftPaneExpanded();
|
|
||||||
event.stopPropagation();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
return (
|
return (
|
||||||
<div id="main" className={isLeftPaneExpanded ? "main" : "hiddenMain"}>
|
<div id="main" className={isLeftPaneExpanded ? "main" : "hiddenMain"}>
|
||||||
{/* Collections Window - - Start */}
|
{/* Collections Window - - Start */}
|
||||||
@@ -60,11 +43,9 @@ export const ResourceTreeContainer: FunctionComponent<ResourceTreeContainerProps
|
|||||||
id="expandToggleLeftPaneButton"
|
id="expandToggleLeftPaneButton"
|
||||||
role="button"
|
role="button"
|
||||||
onClick={toggleLeftPaneExpanded}
|
onClick={toggleLeftPaneExpanded}
|
||||||
onKeyPress={onKeyPressToggleLeftPaneExpanded}
|
|
||||||
tabIndex={0}
|
tabIndex={0}
|
||||||
aria-label="Collapse Tree"
|
aria-label="Collapse Tree"
|
||||||
title="Collapse Tree"
|
title="Collapse Tree"
|
||||||
ref={focusButton}
|
|
||||||
>
|
>
|
||||||
<img className="refreshcol1" src={arrowLeftImg} alt="Hide" />
|
<img className="refreshcol1" src={arrowLeftImg} alt="Hide" />
|
||||||
</span>
|
</span>
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ export const InfoTooltip: React.FunctionComponent<TooltipProps> = ({ children }:
|
|||||||
return (
|
return (
|
||||||
<span>
|
<span>
|
||||||
<TooltipHost content={children}>
|
<TooltipHost content={children}>
|
||||||
<Icon iconName="Info" ariaLabel="Info" className="panelInfoIcon" tabIndex={0} />
|
<Icon iconName="Info" ariaLabel="Info" className="panelInfoIcon" />
|
||||||
</TooltipHost>
|
</TooltipHost>
|
||||||
</span>
|
</span>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
import { ConnectionStatusType } from "../Common/Constants";
|
|
||||||
|
|
||||||
export interface DatabaseAccount {
|
export interface DatabaseAccount {
|
||||||
id: string;
|
id: string;
|
||||||
name: string;
|
name: string;
|
||||||
@@ -498,8 +496,3 @@ export interface MemoryUsageInfo {
|
|||||||
freeKB: number;
|
freeKB: number;
|
||||||
totalKB: number;
|
totalKB: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ContainerConnectionInfo {
|
|
||||||
status: ConnectionStatusType;
|
|
||||||
//need to add ram and rom info
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import { Icon, Label, Stack } from "@fluentui/react";
|
import { Icon, Label, Stack } from "@fluentui/react";
|
||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
import { NormalizedEventKey } from "../../../Common/Constants";
|
|
||||||
import { accordionStackTokens } from "../Settings/SettingsRenderUtils";
|
import { accordionStackTokens } from "../Settings/SettingsRenderUtils";
|
||||||
|
|
||||||
export interface CollapsibleSectionProps {
|
export interface CollapsibleSectionProps {
|
||||||
@@ -31,13 +30,6 @@ export class CollapsibleSectionComponent extends React.Component<CollapsibleSect
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private onKeyPress = (event: React.KeyboardEvent) => {
|
|
||||||
if (event.key === NormalizedEventKey.Space || event.key === NormalizedEventKey.Enter) {
|
|
||||||
this.toggleCollapsed();
|
|
||||||
event.stopPropagation();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
public render(): JSX.Element {
|
public render(): JSX.Element {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@@ -47,11 +39,6 @@ export class CollapsibleSectionComponent extends React.Component<CollapsibleSect
|
|||||||
verticalAlign="center"
|
verticalAlign="center"
|
||||||
tokens={accordionStackTokens}
|
tokens={accordionStackTokens}
|
||||||
onClick={this.toggleCollapsed}
|
onClick={this.toggleCollapsed}
|
||||||
onKeyPress={this.onKeyPress}
|
|
||||||
tabIndex={0}
|
|
||||||
aria-name="Advanced"
|
|
||||||
role="button"
|
|
||||||
aria-expanded={this.state.isExpanded}
|
|
||||||
>
|
>
|
||||||
<Icon iconName={this.state.isExpanded ? "ChevronDown" : "ChevronRight"} />
|
<Icon iconName={this.state.isExpanded ? "ChevronDown" : "ChevronRight"} />
|
||||||
<Label>{this.props.title}</Label>
|
<Label>{this.props.title}</Label>
|
||||||
|
|||||||
@@ -3,14 +3,9 @@
|
|||||||
exports[`CollapsibleSectionComponent renders 1`] = `
|
exports[`CollapsibleSectionComponent renders 1`] = `
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<Stack
|
<Stack
|
||||||
aria-expanded={true}
|
|
||||||
aria-name="Advanced"
|
|
||||||
className="collapsibleSection"
|
className="collapsibleSection"
|
||||||
horizontal={true}
|
horizontal={true}
|
||||||
onClick={[Function]}
|
onClick={[Function]}
|
||||||
onKeyPress={[Function]}
|
|
||||||
role="button"
|
|
||||||
tabIndex={0}
|
|
||||||
tokens={
|
tokens={
|
||||||
Object {
|
Object {
|
||||||
"childrenGap": 10,
|
"childrenGap": 10,
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ import {
|
|||||||
Link,
|
Link,
|
||||||
PrimaryButton,
|
PrimaryButton,
|
||||||
ProgressIndicator,
|
ProgressIndicator,
|
||||||
Text,
|
|
||||||
TextField,
|
TextField,
|
||||||
} from "@fluentui/react";
|
} from "@fluentui/react";
|
||||||
import React, { FC } from "react";
|
import React, { FC } from "react";
|
||||||
@@ -31,7 +30,6 @@ export interface DialogState {
|
|||||||
onOk: () => void,
|
onOk: () => void,
|
||||||
cancelLabel: string,
|
cancelLabel: string,
|
||||||
onCancel: () => void,
|
onCancel: () => void,
|
||||||
contentHtml?: JSX.Element,
|
|
||||||
choiceGroupProps?: IChoiceGroupProps,
|
choiceGroupProps?: IChoiceGroupProps,
|
||||||
textFieldProps?: TextFieldProps,
|
textFieldProps?: TextFieldProps,
|
||||||
primaryButtonDisabled?: boolean
|
primaryButtonDisabled?: boolean
|
||||||
@@ -60,7 +58,6 @@ export const useDialog: UseStore<DialogState> = create((set, get) => ({
|
|||||||
onOk: () => void,
|
onOk: () => void,
|
||||||
cancelLabel: string,
|
cancelLabel: string,
|
||||||
onCancel: () => void,
|
onCancel: () => void,
|
||||||
contentHtml?: JSX.Element,
|
|
||||||
choiceGroupProps?: IChoiceGroupProps,
|
choiceGroupProps?: IChoiceGroupProps,
|
||||||
textFieldProps?: TextFieldProps,
|
textFieldProps?: TextFieldProps,
|
||||||
primaryButtonDisabled?: boolean
|
primaryButtonDisabled?: boolean
|
||||||
@@ -79,7 +76,6 @@ export const useDialog: UseStore<DialogState> = create((set, get) => ({
|
|||||||
get().closeDialog();
|
get().closeDialog();
|
||||||
onCancel && onCancel();
|
onCancel && onCancel();
|
||||||
},
|
},
|
||||||
contentHtml,
|
|
||||||
choiceGroupProps,
|
choiceGroupProps,
|
||||||
textFieldProps,
|
textFieldProps,
|
||||||
primaryButtonDisabled,
|
primaryButtonDisabled,
|
||||||
@@ -128,7 +124,6 @@ export interface DialogProps {
|
|||||||
type?: DialogType;
|
type?: DialogType;
|
||||||
showCloseButton?: boolean;
|
showCloseButton?: boolean;
|
||||||
onDismiss?: () => void;
|
onDismiss?: () => void;
|
||||||
contentHtml?: JSX.Element;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const DIALOG_MIN_WIDTH = "400px";
|
const DIALOG_MIN_WIDTH = "400px";
|
||||||
@@ -155,7 +150,6 @@ export const Dialog: FC = () => {
|
|||||||
type,
|
type,
|
||||||
showCloseButton,
|
showCloseButton,
|
||||||
onDismiss,
|
onDismiss,
|
||||||
contentHtml,
|
|
||||||
} = props || {};
|
} = props || {};
|
||||||
|
|
||||||
const dialogProps: IDialogProps = {
|
const dialogProps: IDialogProps = {
|
||||||
@@ -187,7 +181,8 @@ export const Dialog: FC = () => {
|
|||||||
text: secondaryButtonText,
|
text: secondaryButtonText,
|
||||||
onClick: onSecondaryButtonClick,
|
onClick: onSecondaryButtonClick,
|
||||||
}
|
}
|
||||||
: undefined;
|
: {};
|
||||||
|
|
||||||
return visible ? (
|
return visible ? (
|
||||||
<FluentDialog {...dialogProps}>
|
<FluentDialog {...dialogProps}>
|
||||||
{choiceGroupProps && <ChoiceGroup {...choiceGroupProps} />}
|
{choiceGroupProps && <ChoiceGroup {...choiceGroupProps} />}
|
||||||
@@ -197,7 +192,6 @@ export const Dialog: FC = () => {
|
|||||||
{linkProps.linkText} <FontIcon iconName="NavigateExternalInline" />
|
{linkProps.linkText} <FontIcon iconName="NavigateExternalInline" />
|
||||||
</Link>
|
</Link>
|
||||||
)}
|
)}
|
||||||
{contentHtml && <Text>{contentHtml}</Text>}
|
|
||||||
{progressIndicatorProps && <ProgressIndicator {...progressIndicatorProps} />}
|
{progressIndicatorProps && <ProgressIndicator {...progressIndicatorProps} />}
|
||||||
<DialogFooter>
|
<DialogFooter>
|
||||||
<PrimaryButton {...primaryButtonProps} />
|
<PrimaryButton {...primaryButtonProps} />
|
||||||
|
|||||||
@@ -8,9 +8,6 @@
|
|||||||
.input-type-head-text-field {
|
.input-type-head-text-field {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
.input-query-form {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
textarea {
|
textarea {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
line-height: 1;
|
line-height: 1;
|
||||||
|
|||||||
@@ -160,21 +160,18 @@ export class InputTypeaheadComponent extends React.Component<
|
|||||||
return (
|
return (
|
||||||
<div className="input-typeahead-container">
|
<div className="input-typeahead-container">
|
||||||
<Stack horizontal>
|
<Stack horizontal>
|
||||||
<form aria-labelledby="input" className="input-query-form">
|
<TextField
|
||||||
<TextField
|
multiline={useTextarea}
|
||||||
multiline={useTextarea}
|
rows={1}
|
||||||
rows={1}
|
defaultValue={defaultValue}
|
||||||
id="input"
|
ariaLabel="Input query"
|
||||||
defaultValue={defaultValue}
|
placeholder={placeholder}
|
||||||
ariaLabel="Input query"
|
className="input-type-head-text-field"
|
||||||
placeholder={placeholder}
|
value={defaultValue}
|
||||||
className="input-type-head-text-field"
|
onKeyDown={this.onSubmit}
|
||||||
value={defaultValue}
|
onFocus={() => this.setState({ isSuggestionVisible: true })}
|
||||||
onKeyDown={this.onSubmit}
|
onChange={(_event, newValue?: string) => this.handleChange(newValue)}
|
||||||
onFocus={() => this.setState({ isSuggestionVisible: true })}
|
/>
|
||||||
onChange={(_event, newValue?: string) => this.handleChange(newValue)}
|
|
||||||
/>
|
|
||||||
</form>
|
|
||||||
{this.props.showCancelButton && (
|
{this.props.showCancelButton && (
|
||||||
<IconButton
|
<IconButton
|
||||||
styles={iconButtonStyles}
|
styles={iconButtonStyles}
|
||||||
|
|||||||
@@ -7,22 +7,16 @@ exports[`inputTypeahead renders <input /> 1`] = `
|
|||||||
<Stack
|
<Stack
|
||||||
horizontal={true}
|
horizontal={true}
|
||||||
>
|
>
|
||||||
<form
|
<StyledTextFieldBase
|
||||||
aria-labelledby="input"
|
ariaLabel="Input query"
|
||||||
className="input-query-form"
|
className="input-type-head-text-field"
|
||||||
>
|
multiline={false}
|
||||||
<StyledTextFieldBase
|
onChange={[Function]}
|
||||||
ariaLabel="Input query"
|
onFocus={[Function]}
|
||||||
className="input-type-head-text-field"
|
onKeyDown={[Function]}
|
||||||
id="input"
|
placeholder="placeholder"
|
||||||
multiline={false}
|
rows={1}
|
||||||
onChange={[Function]}
|
/>
|
||||||
onFocus={[Function]}
|
|
||||||
onKeyDown={[Function]}
|
|
||||||
placeholder="placeholder"
|
|
||||||
rows={1}
|
|
||||||
/>
|
|
||||||
</form>
|
|
||||||
</Stack>
|
</Stack>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
@@ -34,22 +28,16 @@ exports[`inputTypeahead renders <textarea /> 1`] = `
|
|||||||
<Stack
|
<Stack
|
||||||
horizontal={true}
|
horizontal={true}
|
||||||
>
|
>
|
||||||
<form
|
<StyledTextFieldBase
|
||||||
aria-labelledby="input"
|
ariaLabel="Input query"
|
||||||
className="input-query-form"
|
className="input-type-head-text-field"
|
||||||
>
|
multiline={true}
|
||||||
<StyledTextFieldBase
|
onChange={[Function]}
|
||||||
ariaLabel="Input query"
|
onFocus={[Function]}
|
||||||
className="input-type-head-text-field"
|
onKeyDown={[Function]}
|
||||||
id="input"
|
placeholder="placeholder"
|
||||||
multiline={true}
|
rows={1}
|
||||||
onChange={[Function]}
|
/>
|
||||||
onFocus={[Function]}
|
|
||||||
onKeyDown={[Function]}
|
|
||||||
placeholder="placeholder"
|
|
||||||
rows={1}
|
|
||||||
/>
|
|
||||||
</form>
|
|
||||||
</Stack>
|
</Stack>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|||||||
@@ -17,8 +17,6 @@ import Explorer from "../../Explorer";
|
|||||||
import { NotebookClientV2 } from "../../Notebook/NotebookClientV2";
|
import { NotebookClientV2 } from "../../Notebook/NotebookClientV2";
|
||||||
import { NotebookComponentBootstrapper } from "../../Notebook/NotebookComponent/NotebookComponentBootstrapper";
|
import { NotebookComponentBootstrapper } from "../../Notebook/NotebookComponent/NotebookComponentBootstrapper";
|
||||||
import NotebookReadOnlyRenderer from "../../Notebook/NotebookRenderer/NotebookReadOnlyRenderer";
|
import NotebookReadOnlyRenderer from "../../Notebook/NotebookRenderer/NotebookReadOnlyRenderer";
|
||||||
import { NotebookUtil } from "../../Notebook/NotebookUtil";
|
|
||||||
import { useNotebook } from "../../Notebook/useNotebook";
|
|
||||||
import { Dialog, TextFieldProps, useDialog } from "../Dialog";
|
import { Dialog, TextFieldProps, useDialog } from "../Dialog";
|
||||||
import { NotebookMetadataComponent } from "./NotebookMetadataComponent";
|
import { NotebookMetadataComponent } from "./NotebookMetadataComponent";
|
||||||
import "./NotebookViewerComponent.less";
|
import "./NotebookViewerComponent.less";
|
||||||
@@ -148,9 +146,7 @@ export class NotebookViewerComponent
|
|||||||
<NotebookMetadataComponent
|
<NotebookMetadataComponent
|
||||||
data={this.state.galleryItem}
|
data={this.state.galleryItem}
|
||||||
isFavorite={this.state.isFavorite}
|
isFavorite={this.state.isFavorite}
|
||||||
downloadButtonText={
|
downloadButtonText={this.props.container && "Download to my notebooks"}
|
||||||
this.props.container && NotebookUtil.getNotebookBtnTitle(useNotebook.getState().notebookFolderName)
|
|
||||||
}
|
|
||||||
onTagClick={this.props.onTagClick}
|
onTagClick={this.props.onTagClick}
|
||||||
onFavoriteClick={this.favoriteItem}
|
onFavoriteClick={this.favoriteItem}
|
||||||
onUnfavoriteClick={this.unfavoriteItem}
|
onUnfavoriteClick={this.unfavoriteItem}
|
||||||
|
|||||||
@@ -1,45 +1,45 @@
|
|||||||
|
import * as React from "react";
|
||||||
|
import * as AutoPilotUtils from "../../../Utils/AutoPilotUtils";
|
||||||
|
import { AutopilotDocumentation, hoursInAMonth } from "../../../Shared/Constants";
|
||||||
|
import { Urls, StyleConstants } from "../../../Common/Constants";
|
||||||
|
import {
|
||||||
|
getPriceCurrency,
|
||||||
|
getCurrencySign,
|
||||||
|
getAutoscalePricePerRu,
|
||||||
|
getMultimasterMultiplier,
|
||||||
|
computeRUUsagePriceHourly,
|
||||||
|
getPricePerRu,
|
||||||
|
estimatedCostDisclaimer,
|
||||||
|
} from "../../../Utils/PricingUtils";
|
||||||
import {
|
import {
|
||||||
DetailsList,
|
|
||||||
DetailsListLayoutMode,
|
|
||||||
DetailsRow,
|
|
||||||
ICheckboxStyles,
|
|
||||||
IChoiceGroupStyles,
|
|
||||||
IColumn,
|
|
||||||
IDetailsColumnStyles,
|
|
||||||
IDetailsListStyles,
|
|
||||||
IDetailsRowProps,
|
|
||||||
IDetailsRowStyles,
|
|
||||||
IDropdownStyles,
|
|
||||||
IMessageBarStyles,
|
|
||||||
ISeparatorStyles,
|
|
||||||
IStackProps,
|
|
||||||
IStackStyles,
|
|
||||||
IStackTokens,
|
|
||||||
ITextFieldStyles,
|
ITextFieldStyles,
|
||||||
ITextStyles,
|
ICheckboxStyles,
|
||||||
|
IStackProps,
|
||||||
|
IStackTokens,
|
||||||
|
IChoiceGroupStyles,
|
||||||
Link,
|
Link,
|
||||||
|
Text,
|
||||||
|
IMessageBarStyles,
|
||||||
|
ITextStyles,
|
||||||
|
IDetailsRowStyles,
|
||||||
|
IStackStyles,
|
||||||
|
IDetailsListStyles,
|
||||||
|
IDropdownStyles,
|
||||||
|
ISeparatorStyles,
|
||||||
MessageBar,
|
MessageBar,
|
||||||
MessageBarType,
|
MessageBarType,
|
||||||
SelectionMode,
|
Stack,
|
||||||
Spinner,
|
Spinner,
|
||||||
SpinnerSize,
|
SpinnerSize,
|
||||||
Stack,
|
DetailsList,
|
||||||
Text,
|
IColumn,
|
||||||
|
SelectionMode,
|
||||||
|
DetailsListLayoutMode,
|
||||||
|
IDetailsRowProps,
|
||||||
|
DetailsRow,
|
||||||
|
IDetailsColumnStyles,
|
||||||
} from "@fluentui/react";
|
} from "@fluentui/react";
|
||||||
import * as React from "react";
|
import { isDirtyTypes, isDirty } from "./SettingsUtils";
|
||||||
import { StyleConstants, Urls } from "../../../Common/Constants";
|
|
||||||
import { AutopilotDocumentation, hoursInAMonth } from "../../../Shared/Constants";
|
|
||||||
import * as AutoPilotUtils from "../../../Utils/AutoPilotUtils";
|
|
||||||
import {
|
|
||||||
computeRUUsagePriceHourly,
|
|
||||||
estimatedCostDisclaimer,
|
|
||||||
getAutoscalePricePerRu,
|
|
||||||
getCurrencySign,
|
|
||||||
getMultimasterMultiplier,
|
|
||||||
getPriceCurrency,
|
|
||||||
getPricePerRu,
|
|
||||||
} from "../../../Utils/PricingUtils";
|
|
||||||
import { isDirty, isDirtyTypes } from "./SettingsUtils";
|
|
||||||
|
|
||||||
export interface EstimatedSpendingDisplayProps {
|
export interface EstimatedSpendingDisplayProps {
|
||||||
costType: JSX.Element;
|
costType: JSX.Element;
|
||||||
@@ -65,7 +65,7 @@ export interface PriceBreakdown {
|
|||||||
currencySign: string;
|
currencySign: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const infoAndToolTipTextStyle: ITextStyles = { root: { fontSize: 14, color: "windowtext" } };
|
export const infoAndToolTipTextStyle: ITextStyles = { root: { fontSize: 14 } };
|
||||||
|
|
||||||
export const noLeftPaddingCheckBoxStyle: ICheckboxStyles = {
|
export const noLeftPaddingCheckBoxStyle: ICheckboxStyles = {
|
||||||
label: {
|
label: {
|
||||||
@@ -223,15 +223,14 @@ export const getRuPriceBreakdown = (
|
|||||||
multimasterEnabled: isMultimaster,
|
multimasterEnabled: isMultimaster,
|
||||||
isAutoscale: isAutoscale,
|
isAutoscale: isAutoscale,
|
||||||
});
|
});
|
||||||
const multimasterMultiplier = getMultimasterMultiplier(numberOfRegions, isMultimaster);
|
const basePricePerRu: number = isAutoscale
|
||||||
const pricePerRu: number = isAutoscale
|
? getAutoscalePricePerRu(serverId, getMultimasterMultiplier(numberOfRegions, isMultimaster))
|
||||||
? getAutoscalePricePerRu(serverId, multimasterMultiplier)
|
: getPricePerRu(serverId);
|
||||||
: getPricePerRu(serverId, multimasterMultiplier);
|
|
||||||
return {
|
return {
|
||||||
hourlyPrice,
|
hourlyPrice: hourlyPrice,
|
||||||
dailyPrice: hourlyPrice * 24,
|
dailyPrice: hourlyPrice * 24,
|
||||||
monthlyPrice: hourlyPrice * hoursInAMonth,
|
monthlyPrice: hourlyPrice * hoursInAMonth,
|
||||||
pricePerRu,
|
pricePerRu: basePricePerRu * getMultimasterMultiplier(numberOfRegions, isMultimaster),
|
||||||
currency: getPriceCurrency(serverId),
|
currency: getPriceCurrency(serverId),
|
||||||
currencySign: getCurrencySign(serverId),
|
currencySign: getCurrencySign(serverId),
|
||||||
};
|
};
|
||||||
@@ -272,7 +271,7 @@ export const manualToAutoscaleDisclaimerElement: JSX.Element = (
|
|||||||
<Text styles={infoAndToolTipTextStyle} id="manualToAutoscaleDisclaimerElement">
|
<Text styles={infoAndToolTipTextStyle} id="manualToAutoscaleDisclaimerElement">
|
||||||
The starting autoscale max RU/s will be determined by the system, based on the current manual throughput settings
|
The starting autoscale max RU/s will be determined by the system, based on the current manual throughput settings
|
||||||
and storage of your resource. After autoscale has been enabled, you can change the max RU/s.{" "}
|
and storage of your resource. After autoscale has been enabled, you can change the max RU/s.{" "}
|
||||||
<Link href={Urls.autoscaleMigration}>Learn more</Link>
|
<a href={Urls.autoscaleMigration}>Learn more</a>
|
||||||
</Text>
|
</Text>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ exports[`IndexingPolicyRefreshComponent renders 1`] = `
|
|||||||
styles={
|
styles={
|
||||||
Object {
|
Object {
|
||||||
"root": Object {
|
"root": Object {
|
||||||
"color": "windowtext",
|
|
||||||
"fontSize": 14,
|
"fontSize": 14,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ exports[`ThroughputInputAutoPilotV3Component autopilot input visible 1`] = `
|
|||||||
styles={
|
styles={
|
||||||
Object {
|
Object {
|
||||||
"root": Object {
|
"root": Object {
|
||||||
"color": "windowtext",
|
|
||||||
"fontSize": 14,
|
"fontSize": 14,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -40,7 +39,6 @@ exports[`ThroughputInputAutoPilotV3Component autopilot input visible 1`] = `
|
|||||||
styles={
|
styles={
|
||||||
Object {
|
Object {
|
||||||
"root": Object {
|
"root": Object {
|
||||||
"color": "windowtext",
|
|
||||||
"fontSize": 14,
|
"fontSize": 14,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -75,7 +73,6 @@ exports[`ThroughputInputAutoPilotV3Component autopilot input visible 1`] = `
|
|||||||
styles={
|
styles={
|
||||||
Object {
|
Object {
|
||||||
"root": Object {
|
"root": Object {
|
||||||
"color": "windowtext",
|
|
||||||
"fontSize": 14,
|
"fontSize": 14,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -83,11 +80,11 @@ exports[`ThroughputInputAutoPilotV3Component autopilot input visible 1`] = `
|
|||||||
>
|
>
|
||||||
The starting autoscale max RU/s will be determined by the system, based on the current manual throughput settings and storage of your resource. After autoscale has been enabled, you can change the max RU/s.
|
The starting autoscale max RU/s will be determined by the system, based on the current manual throughput settings and storage of your resource. After autoscale has been enabled, you can change the max RU/s.
|
||||||
|
|
||||||
<StyledLinkBase
|
<a
|
||||||
href="https://aka.ms/cosmos-autoscale-migration"
|
href="https://aka.ms/cosmos-autoscale-migration"
|
||||||
>
|
>
|
||||||
Learn more
|
Learn more
|
||||||
</StyledLinkBase>
|
</a>
|
||||||
</Text>
|
</Text>
|
||||||
</StyledMessageBar>
|
</StyledMessageBar>
|
||||||
<StyledChoiceGroup
|
<StyledChoiceGroup
|
||||||
@@ -189,7 +186,6 @@ exports[`ThroughputInputAutoPilotV3Component spendAck checkbox visible 1`] = `
|
|||||||
styles={
|
styles={
|
||||||
Object {
|
Object {
|
||||||
"root": Object {
|
"root": Object {
|
||||||
"color": "windowtext",
|
|
||||||
"fontSize": 14,
|
"fontSize": 14,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -464,7 +460,6 @@ exports[`ThroughputInputAutoPilotV3Component throughput input visible 1`] = `
|
|||||||
styles={
|
styles={
|
||||||
Object {
|
Object {
|
||||||
"root": Object {
|
"root": Object {
|
||||||
"color": "windowtext",
|
|
||||||
"fontSize": 14,
|
"fontSize": 14,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ exports[`ScaleComponent renders with correct initial notification 1`] = `
|
|||||||
styles={
|
styles={
|
||||||
Object {
|
Object {
|
||||||
"root": Object {
|
"root": Object {
|
||||||
"color": "windowtext",
|
|
||||||
"fontSize": 14,
|
"fontSize": 14,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -136,7 +136,6 @@ exports[`SubSettingsComponent analyticalTimeToLive hidden 1`] = `
|
|||||||
styles={
|
styles={
|
||||||
Object {
|
Object {
|
||||||
"root": Object {
|
"root": Object {
|
||||||
"color": "windowtext",
|
|
||||||
"fontSize": 14,
|
"fontSize": 14,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -413,7 +412,6 @@ exports[`SubSettingsComponent analyticalTimeToLiveSeconds hidden 1`] = `
|
|||||||
styles={
|
styles={
|
||||||
Object {
|
Object {
|
||||||
"root": Object {
|
"root": Object {
|
||||||
"color": "windowtext",
|
|
||||||
"fontSize": 14,
|
"fontSize": 14,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -954,7 +952,6 @@ exports[`SubSettingsComponent renders 1`] = `
|
|||||||
styles={
|
styles={
|
||||||
Object {
|
Object {
|
||||||
"root": Object {
|
"root": Object {
|
||||||
"color": "windowtext",
|
|
||||||
"fontSize": 14,
|
"fontSize": 14,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -1231,7 +1228,6 @@ exports[`SubSettingsComponent timeToLiveSeconds hidden 1`] = `
|
|||||||
styles={
|
styles={
|
||||||
Object {
|
Object {
|
||||||
"root": Object {
|
"root": Object {
|
||||||
"color": "windowtext",
|
|
||||||
"fontSize": 14,
|
"fontSize": 14,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,7 +34,6 @@ exports[`SettingsComponent renders 1`] = `
|
|||||||
"isTabsContentExpanded": [Function],
|
"isTabsContentExpanded": [Function],
|
||||||
"onRefreshDatabasesKeyPress": [Function],
|
"onRefreshDatabasesKeyPress": [Function],
|
||||||
"onRefreshResourcesClick": [Function],
|
"onRefreshResourcesClick": [Function],
|
||||||
"phoenixClient": PhoenixClient {},
|
|
||||||
"provideFeedbackEmail": [Function],
|
"provideFeedbackEmail": [Function],
|
||||||
"queriesClient": QueriesClient {
|
"queriesClient": QueriesClient {
|
||||||
"container": [Circular],
|
"container": [Circular],
|
||||||
@@ -102,7 +101,6 @@ exports[`SettingsComponent renders 1`] = `
|
|||||||
"isTabsContentExpanded": [Function],
|
"isTabsContentExpanded": [Function],
|
||||||
"onRefreshDatabasesKeyPress": [Function],
|
"onRefreshDatabasesKeyPress": [Function],
|
||||||
"onRefreshResourcesClick": [Function],
|
"onRefreshResourcesClick": [Function],
|
||||||
"phoenixClient": PhoenixClient {},
|
|
||||||
"provideFeedbackEmail": [Function],
|
"provideFeedbackEmail": [Function],
|
||||||
"queriesClient": QueriesClient {
|
"queriesClient": QueriesClient {
|
||||||
"container": [Circular],
|
"container": [Circular],
|
||||||
|
|||||||
@@ -159,7 +159,6 @@ exports[`SettingsUtils functions render 1`] = `
|
|||||||
styles={
|
styles={
|
||||||
Object {
|
Object {
|
||||||
"root": Object {
|
"root": Object {
|
||||||
"color": "windowtext",
|
|
||||||
"fontSize": 14,
|
"fontSize": 14,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -167,17 +166,16 @@ exports[`SettingsUtils functions render 1`] = `
|
|||||||
>
|
>
|
||||||
The starting autoscale max RU/s will be determined by the system, based on the current manual throughput settings and storage of your resource. After autoscale has been enabled, you can change the max RU/s.
|
The starting autoscale max RU/s will be determined by the system, based on the current manual throughput settings and storage of your resource. After autoscale has been enabled, you can change the max RU/s.
|
||||||
|
|
||||||
<StyledLinkBase
|
<a
|
||||||
href="https://aka.ms/cosmos-autoscale-migration"
|
href="https://aka.ms/cosmos-autoscale-migration"
|
||||||
>
|
>
|
||||||
Learn more
|
Learn more
|
||||||
</StyledLinkBase>
|
</a>
|
||||||
</Text>
|
</Text>
|
||||||
<Text
|
<Text
|
||||||
styles={
|
styles={
|
||||||
Object {
|
Object {
|
||||||
"root": Object {
|
"root": Object {
|
||||||
"color": "windowtext",
|
|
||||||
"fontSize": 14,
|
"fontSize": 14,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -197,7 +195,6 @@ exports[`SettingsUtils functions render 1`] = `
|
|||||||
styles={
|
styles={
|
||||||
Object {
|
Object {
|
||||||
"root": Object {
|
"root": Object {
|
||||||
"color": "windowtext",
|
|
||||||
"fontSize": 14,
|
"fontSize": 14,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -210,7 +207,6 @@ exports[`SettingsUtils functions render 1`] = `
|
|||||||
styles={
|
styles={
|
||||||
Object {
|
Object {
|
||||||
"root": Object {
|
"root": Object {
|
||||||
"color": "windowtext",
|
|
||||||
"fontSize": 14,
|
"fontSize": 14,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -223,7 +219,6 @@ exports[`SettingsUtils functions render 1`] = `
|
|||||||
styles={
|
styles={
|
||||||
Object {
|
Object {
|
||||||
"root": Object {
|
"root": Object {
|
||||||
"color": "windowtext",
|
|
||||||
"fontSize": 14,
|
"fontSize": 14,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -235,7 +230,6 @@ exports[`SettingsUtils functions render 1`] = `
|
|||||||
styles={
|
styles={
|
||||||
Object {
|
Object {
|
||||||
"root": Object {
|
"root": Object {
|
||||||
"color": "windowtext",
|
|
||||||
"fontSize": 14,
|
"fontSize": 14,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -255,7 +249,6 @@ exports[`SettingsUtils functions render 1`] = `
|
|||||||
styles={
|
styles={
|
||||||
Object {
|
Object {
|
||||||
"root": Object {
|
"root": Object {
|
||||||
"color": "windowtext",
|
|
||||||
"fontSize": 14,
|
"fontSize": 14,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -271,7 +264,6 @@ exports[`SettingsUtils functions render 1`] = `
|
|||||||
styles={
|
styles={
|
||||||
Object {
|
Object {
|
||||||
"root": Object {
|
"root": Object {
|
||||||
"color": "windowtext",
|
|
||||||
"fontSize": 14,
|
"fontSize": 14,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -286,7 +278,6 @@ exports[`SettingsUtils functions render 1`] = `
|
|||||||
styles={
|
styles={
|
||||||
Object {
|
Object {
|
||||||
"root": Object {
|
"root": Object {
|
||||||
"color": "windowtext",
|
|
||||||
"fontSize": 14,
|
"fontSize": 14,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -300,7 +291,6 @@ exports[`SettingsUtils functions render 1`] = `
|
|||||||
styles={
|
styles={
|
||||||
Object {
|
Object {
|
||||||
"root": Object {
|
"root": Object {
|
||||||
"color": "windowtext",
|
|
||||||
"fontSize": 14,
|
"fontSize": 14,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -312,7 +302,6 @@ exports[`SettingsUtils functions render 1`] = `
|
|||||||
styles={
|
styles={
|
||||||
Object {
|
Object {
|
||||||
"root": Object {
|
"root": Object {
|
||||||
"color": "windowtext",
|
|
||||||
"fontSize": 14,
|
"fontSize": 14,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -332,7 +321,6 @@ exports[`SettingsUtils functions render 1`] = `
|
|||||||
styles={
|
styles={
|
||||||
Object {
|
Object {
|
||||||
"root": Object {
|
"root": Object {
|
||||||
"color": "windowtext",
|
|
||||||
"fontSize": 14,
|
"fontSize": 14,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -375,7 +363,6 @@ exports[`SettingsUtils functions render 1`] = `
|
|||||||
styles={
|
styles={
|
||||||
Object {
|
Object {
|
||||||
"root": Object {
|
"root": Object {
|
||||||
"color": "windowtext",
|
|
||||||
"fontSize": 14,
|
"fontSize": 14,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -391,7 +378,6 @@ exports[`SettingsUtils functions render 1`] = `
|
|||||||
styles={
|
styles={
|
||||||
Object {
|
Object {
|
||||||
"root": Object {
|
"root": Object {
|
||||||
"color": "windowtext",
|
|
||||||
"fontSize": 14,
|
"fontSize": 14,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -408,7 +394,6 @@ exports[`SettingsUtils functions render 1`] = `
|
|||||||
styles={
|
styles={
|
||||||
Object {
|
Object {
|
||||||
"root": Object {
|
"root": Object {
|
||||||
"color": "windowtext",
|
|
||||||
"fontSize": 14,
|
"fontSize": 14,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
@import "../../../../less/Common/Constants";
|
@import "../../../../less/Common/Constants";
|
||||||
|
|
||||||
.tabComponentContainer {
|
.tabComponentContainer {
|
||||||
|
overflow: hidden;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
.flex-display();
|
.flex-display();
|
||||||
.flex-direction();
|
.flex-direction();
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import { userContext } from "../../../../UserContext";
|
|||||||
import {
|
import {
|
||||||
calculateEstimateNumber,
|
calculateEstimateNumber,
|
||||||
computeRUUsagePriceHourly,
|
computeRUUsagePriceHourly,
|
||||||
estimatedCostDisclaimer,
|
|
||||||
getAutoscalePricePerRu,
|
getAutoscalePricePerRu,
|
||||||
getCurrencySign,
|
getCurrencySign,
|
||||||
getMultimasterMultiplier,
|
getMultimasterMultiplier,
|
||||||
@@ -43,9 +42,11 @@ export const CostEstimateText: FunctionComponent<CostEstimateTextProps> = ({
|
|||||||
const currency: string = getPriceCurrency(serverId);
|
const currency: string = getPriceCurrency(serverId);
|
||||||
const currencySign: string = getCurrencySign(serverId);
|
const currencySign: string = getCurrencySign(serverId);
|
||||||
const multiplier = getMultimasterMultiplier(numberOfRegions, multimasterEnabled);
|
const multiplier = getMultimasterMultiplier(numberOfRegions, multimasterEnabled);
|
||||||
const pricePerRu = isAutoscale ? getAutoscalePricePerRu(serverId, multiplier) : getPricePerRu(serverId, multiplier);
|
const pricePerRu = isAutoscale
|
||||||
|
? getAutoscalePricePerRu(serverId, multiplier) * multiplier
|
||||||
|
: getPricePerRu(serverId) * multiplier;
|
||||||
|
|
||||||
const iconWithEstimatedCostDisclaimer: JSX.Element = <InfoTooltip>{estimatedCostDisclaimer}</InfoTooltip>;
|
const iconWithEstimatedCostDisclaimer: JSX.Element = <InfoTooltip>PricingUtils.estimatedCostDisclaimer</InfoTooltip>;
|
||||||
|
|
||||||
if (isAutoscale) {
|
if (isAutoscale) {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -118,7 +118,6 @@ export const ThroughputInput: FunctionComponent<ThroughputInputProps> = ({
|
|||||||
<input
|
<input
|
||||||
className="throughputInputRadioBtn"
|
className="throughputInputRadioBtn"
|
||||||
aria-label="Autoscale mode"
|
aria-label="Autoscale mode"
|
||||||
aria-required={true}
|
|
||||||
checked={isAutoscaleSelected}
|
checked={isAutoscaleSelected}
|
||||||
type="radio"
|
type="radio"
|
||||||
role="radio"
|
role="radio"
|
||||||
@@ -132,7 +131,6 @@ export const ThroughputInput: FunctionComponent<ThroughputInputProps> = ({
|
|||||||
aria-label="Manual mode"
|
aria-label="Manual mode"
|
||||||
checked={!isAutoscaleSelected}
|
checked={!isAutoscaleSelected}
|
||||||
type="radio"
|
type="radio"
|
||||||
aria-required={true}
|
|
||||||
role="radio"
|
role="radio"
|
||||||
tabIndex={0}
|
tabIndex={0}
|
||||||
onChange={(e) => handleOnChangeMode(e, "Manual")}
|
onChange={(e) => handleOnChangeMode(e, "Manual")}
|
||||||
|
|||||||
@@ -345,14 +345,12 @@ exports[`ThroughputInput Pane should render Default properly 1`] = `
|
|||||||
ariaLabel="Info"
|
ariaLabel="Info"
|
||||||
className="panelInfoIcon"
|
className="panelInfoIcon"
|
||||||
iconName="Info"
|
iconName="Info"
|
||||||
tabIndex={0}
|
|
||||||
>
|
>
|
||||||
<IconBase
|
<IconBase
|
||||||
ariaLabel="Info"
|
ariaLabel="Info"
|
||||||
className="panelInfoIcon"
|
className="panelInfoIcon"
|
||||||
iconName="Info"
|
iconName="Info"
|
||||||
styles={[Function]}
|
styles={[Function]}
|
||||||
tabIndex={0}
|
|
||||||
theme={
|
theme={
|
||||||
Object {
|
Object {
|
||||||
"disableGlobalClassNames": false,
|
"disableGlobalClassNames": false,
|
||||||
@@ -632,7 +630,6 @@ exports[`ThroughputInput Pane should render Default properly 1`] = `
|
|||||||
className="panelInfoIcon root-57"
|
className="panelInfoIcon root-57"
|
||||||
data-icon-name="Info"
|
data-icon-name="Info"
|
||||||
role="img"
|
role="img"
|
||||||
tabIndex={0}
|
|
||||||
>
|
>
|
||||||
|
|
||||||
</i>
|
</i>
|
||||||
@@ -654,7 +651,6 @@ exports[`ThroughputInput Pane should render Default properly 1`] = `
|
|||||||
>
|
>
|
||||||
<input
|
<input
|
||||||
aria-label="Autoscale mode"
|
aria-label="Autoscale mode"
|
||||||
aria-required={true}
|
|
||||||
checked={true}
|
checked={true}
|
||||||
className="throughputInputRadioBtn"
|
className="throughputInputRadioBtn"
|
||||||
key=".0:$.0"
|
key=".0:$.0"
|
||||||
@@ -671,7 +667,6 @@ exports[`ThroughputInput Pane should render Default properly 1`] = `
|
|||||||
</span>
|
</span>
|
||||||
<input
|
<input
|
||||||
aria-label="Manual mode"
|
aria-label="Manual mode"
|
||||||
aria-required={true}
|
|
||||||
checked={false}
|
checked={false}
|
||||||
className="throughputInputRadioBtn"
|
className="throughputInputRadioBtn"
|
||||||
key=".0:$.2"
|
key=".0:$.2"
|
||||||
@@ -1332,14 +1327,12 @@ exports[`ThroughputInput Pane should render Default properly 1`] = `
|
|||||||
ariaLabel="Info"
|
ariaLabel="Info"
|
||||||
className="panelInfoIcon"
|
className="panelInfoIcon"
|
||||||
iconName="Info"
|
iconName="Info"
|
||||||
tabIndex={0}
|
|
||||||
>
|
>
|
||||||
<IconBase
|
<IconBase
|
||||||
ariaLabel="Info"
|
ariaLabel="Info"
|
||||||
className="panelInfoIcon"
|
className="panelInfoIcon"
|
||||||
iconName="Info"
|
iconName="Info"
|
||||||
styles={[Function]}
|
styles={[Function]}
|
||||||
tabIndex={0}
|
|
||||||
theme={
|
theme={
|
||||||
Object {
|
Object {
|
||||||
"disableGlobalClassNames": false,
|
"disableGlobalClassNames": false,
|
||||||
@@ -1619,7 +1612,6 @@ exports[`ThroughputInput Pane should render Default properly 1`] = `
|
|||||||
className="panelInfoIcon root-57"
|
className="panelInfoIcon root-57"
|
||||||
data-icon-name="Info"
|
data-icon-name="Info"
|
||||||
role="img"
|
role="img"
|
||||||
tabIndex={0}
|
|
||||||
>
|
>
|
||||||
|
|
||||||
</i>
|
</i>
|
||||||
|
|||||||
@@ -243,7 +243,6 @@ export class TreeNodeComponent extends React.Component<TreeNodeComponentProps, T
|
|||||||
<div ref={this.contextMenuRef} onContextMenu={this.onRightClick} onKeyPress={this.onMoreButtonKeyPress}>
|
<div ref={this.contextMenuRef} onContextMenu={this.onRightClick} onKeyPress={this.onMoreButtonKeyPress}>
|
||||||
<IconButton
|
<IconButton
|
||||||
name="More"
|
name="More"
|
||||||
title="More"
|
|
||||||
className="treeMenuEllipsis"
|
className="treeMenuEllipsis"
|
||||||
ariaLabel={menuItemLabel}
|
ariaLabel={menuItemLabel}
|
||||||
menuIconProps={{
|
menuIconProps={{
|
||||||
|
|||||||
@@ -211,7 +211,6 @@ exports[`TreeNodeComponent renders a simple node (sorted children, expanded) 1`]
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
title="More"
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -424,7 +423,6 @@ exports[`TreeNodeComponent renders sorted children, expanded, leaves and parents
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
title="More"
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,11 +1,9 @@
|
|||||||
import { Link } from "@fluentui/react/lib/Link";
|
|
||||||
import * as ko from "knockout";
|
import * as ko from "knockout";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import _ from "underscore";
|
import _ from "underscore";
|
||||||
import { AuthType } from "../AuthType";
|
import { AuthType } from "../AuthType";
|
||||||
import { BindingHandlersRegisterer } from "../Bindings/BindingHandlersRegisterer";
|
import { BindingHandlersRegisterer } from "../Bindings/BindingHandlersRegisterer";
|
||||||
import * as Constants from "../Common/Constants";
|
import * as Constants from "../Common/Constants";
|
||||||
import { ConnectionStatusType, HttpStatusCodes, Notebook } from "../Common/Constants";
|
|
||||||
import { readCollection } from "../Common/dataAccess/readCollection";
|
import { readCollection } from "../Common/dataAccess/readCollection";
|
||||||
import { readDatabases } from "../Common/dataAccess/readDatabases";
|
import { readDatabases } from "../Common/dataAccess/readDatabases";
|
||||||
import { isPublicInternetAccessAllowed } from "../Common/DatabaseAccountUtility";
|
import { isPublicInternetAccessAllowed } from "../Common/DatabaseAccountUtility";
|
||||||
@@ -13,13 +11,11 @@ import { getErrorMessage, getErrorStack, handleError } from "../Common/ErrorHand
|
|||||||
import * as Logger from "../Common/Logger";
|
import * as Logger from "../Common/Logger";
|
||||||
import { QueriesClient } from "../Common/QueriesClient";
|
import { QueriesClient } from "../Common/QueriesClient";
|
||||||
import * as DataModels from "../Contracts/DataModels";
|
import * as DataModels from "../Contracts/DataModels";
|
||||||
import { ContainerConnectionInfo } from "../Contracts/DataModels";
|
|
||||||
import * as ViewModels from "../Contracts/ViewModels";
|
import * as ViewModels from "../Contracts/ViewModels";
|
||||||
import { GitHubOAuthService } from "../GitHub/GitHubOAuthService";
|
import { GitHubOAuthService } from "../GitHub/GitHubOAuthService";
|
||||||
import { useSidePanel } from "../hooks/useSidePanel";
|
import { useSidePanel } from "../hooks/useSidePanel";
|
||||||
import { useTabs } from "../hooks/useTabs";
|
import { useTabs } from "../hooks/useTabs";
|
||||||
import { IGalleryItem } from "../Juno/JunoClient";
|
import { IGalleryItem } from "../Juno/JunoClient";
|
||||||
import { PhoenixClient } from "../Phoenix/PhoenixClient";
|
|
||||||
import * as ExplorerSettings from "../Shared/ExplorerSettings";
|
import * as ExplorerSettings from "../Shared/ExplorerSettings";
|
||||||
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";
|
||||||
@@ -91,13 +87,12 @@ export default class Explorer {
|
|||||||
};
|
};
|
||||||
|
|
||||||
private static readonly MaxNbDatabasesToAutoExpand = 5;
|
private static readonly MaxNbDatabasesToAutoExpand = 5;
|
||||||
private phoenixClient: PhoenixClient;
|
|
||||||
constructor() {
|
constructor() {
|
||||||
const startKey: number = TelemetryProcessor.traceStart(Action.InitializeDataExplorer, {
|
const startKey: number = TelemetryProcessor.traceStart(Action.InitializeDataExplorer, {
|
||||||
dataExplorerArea: Constants.Areas.ResourceTree,
|
dataExplorerArea: Constants.Areas.ResourceTree,
|
||||||
});
|
});
|
||||||
this._isInitializingNotebooks = false;
|
this._isInitializingNotebooks = false;
|
||||||
this.phoenixClient = new PhoenixClient();
|
|
||||||
useNotebook.subscribe(
|
useNotebook.subscribe(
|
||||||
() => this.refreshCommandBarButtons(),
|
() => this.refreshCommandBarButtons(),
|
||||||
(state) => state.isNotebooksEnabledForAccount
|
(state) => state.isNotebooksEnabledForAccount
|
||||||
@@ -166,10 +161,23 @@ export default class Explorer {
|
|||||||
|
|
||||||
useNotebook.subscribe(
|
useNotebook.subscribe(
|
||||||
async () => {
|
async () => {
|
||||||
this.initiateAndRefreshNotebookList();
|
if (!this.notebookManager) {
|
||||||
useNotebook.getState().setIsRefreshed(false);
|
const NotebookManager = await (
|
||||||
|
await import(/* webpackChunkName: "NotebookManager" */ "./Notebook/NotebookManager")
|
||||||
|
).default;
|
||||||
|
this.notebookManager = new NotebookManager();
|
||||||
|
this.notebookManager.initialize({
|
||||||
|
container: this,
|
||||||
|
resourceTree: this.resourceTree,
|
||||||
|
refreshCommandBarButtons: () => this.refreshCommandBarButtons(),
|
||||||
|
refreshNotebookList: () => this.refreshNotebookList(),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
this.refreshCommandBarButtons();
|
||||||
|
this.refreshNotebookList();
|
||||||
},
|
},
|
||||||
(state) => state.isNotebookEnabled || state.isRefreshed
|
(state) => state.isNotebookEnabled
|
||||||
);
|
);
|
||||||
|
|
||||||
this.resourceTree = new ResourceTreeAdapter(this);
|
this.resourceTree = new ResourceTreeAdapter(this);
|
||||||
@@ -202,23 +210,6 @@ export default class Explorer {
|
|||||||
this.refreshExplorer();
|
this.refreshExplorer();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async initiateAndRefreshNotebookList(): Promise<void> {
|
|
||||||
if (!this.notebookManager) {
|
|
||||||
const NotebookManager = (await import(/* webpackChunkName: "NotebookManager" */ "./Notebook/NotebookManager"))
|
|
||||||
.default;
|
|
||||||
this.notebookManager = new NotebookManager();
|
|
||||||
this.notebookManager.initialize({
|
|
||||||
container: this,
|
|
||||||
resourceTree: this.resourceTree,
|
|
||||||
refreshCommandBarButtons: () => this.refreshCommandBarButtons(),
|
|
||||||
refreshNotebookList: () => this.refreshNotebookList(),
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
this.refreshCommandBarButtons();
|
|
||||||
this.refreshNotebookList();
|
|
||||||
}
|
|
||||||
|
|
||||||
public openEnableSynapseLinkDialog(): void {
|
public openEnableSynapseLinkDialog(): void {
|
||||||
const addSynapseLinkDialogProps: DialogProps = {
|
const addSynapseLinkDialogProps: DialogProps = {
|
||||||
linkProps: {
|
linkProps: {
|
||||||
@@ -352,75 +343,28 @@ export default class Explorer {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this._isInitializingNotebooks = true;
|
this._isInitializingNotebooks = true;
|
||||||
if (userContext.features.phoenix === false) {
|
|
||||||
await this.ensureNotebookWorkspaceRunning();
|
|
||||||
const connectionInfo = await listConnectionInfo(
|
|
||||||
userContext.subscriptionId,
|
|
||||||
userContext.resourceGroup,
|
|
||||||
databaseAccount.name,
|
|
||||||
"default"
|
|
||||||
);
|
|
||||||
|
|
||||||
useNotebook.getState().setNotebookServerInfo({
|
await this.ensureNotebookWorkspaceRunning();
|
||||||
notebookServerEndpoint: userContext.features.notebookServerUrl || connectionInfo.notebookServerEndpoint,
|
const connectionInfo = await listConnectionInfo(
|
||||||
authToken: userContext.features.notebookServerToken || connectionInfo.authToken,
|
userContext.subscriptionId,
|
||||||
});
|
userContext.resourceGroup,
|
||||||
}
|
databaseAccount.name,
|
||||||
|
"default"
|
||||||
|
);
|
||||||
|
|
||||||
|
useNotebook.getState().setNotebookServerInfo({
|
||||||
|
notebookServerEndpoint: userContext.features.notebookServerUrl || connectionInfo.notebookServerEndpoint,
|
||||||
|
authToken: userContext.features.notebookServerToken || connectionInfo.authToken,
|
||||||
|
});
|
||||||
|
|
||||||
|
useNotebook.getState().initializeNotebooksTree(this.notebookManager);
|
||||||
|
|
||||||
this.refreshNotebookList();
|
this.refreshNotebookList();
|
||||||
|
|
||||||
this._isInitializingNotebooks = false;
|
this._isInitializingNotebooks = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async allocateContainer(): Promise<void> {
|
public resetNotebookWorkspace() {
|
||||||
const notebookServerInfo = useNotebook.getState().notebookServerInfo;
|
|
||||||
const isAllocating = useNotebook.getState().isAllocating;
|
|
||||||
if (isAllocating === false && notebookServerInfo && notebookServerInfo.notebookServerEndpoint === undefined) {
|
|
||||||
const provisionData = {
|
|
||||||
aadToken: userContext.authorizationToken,
|
|
||||||
subscriptionId: userContext.subscriptionId,
|
|
||||||
resourceGroup: userContext.resourceGroup,
|
|
||||||
dbAccountName: userContext.databaseAccount.name,
|
|
||||||
cosmosEndpoint: userContext.databaseAccount.properties.documentEndpoint,
|
|
||||||
};
|
|
||||||
const connectionStatus: ContainerConnectionInfo = {
|
|
||||||
status: ConnectionStatusType.Connecting,
|
|
||||||
};
|
|
||||||
useNotebook.getState().setConnectionInfo(connectionStatus);
|
|
||||||
try {
|
|
||||||
useNotebook.getState().setIsAllocating(true);
|
|
||||||
const connectionInfo = await this.phoenixClient.containerConnectionInfo(provisionData);
|
|
||||||
if (
|
|
||||||
connectionInfo.status === HttpStatusCodes.OK &&
|
|
||||||
connectionInfo.data &&
|
|
||||||
connectionInfo.data.notebookServerUrl
|
|
||||||
) {
|
|
||||||
connectionStatus.status = ConnectionStatusType.Connected;
|
|
||||||
useNotebook.getState().setConnectionInfo(connectionStatus);
|
|
||||||
useNotebook.getState().setNotebookServerInfo({
|
|
||||||
notebookServerEndpoint: userContext.features.notebookServerUrl || connectionInfo.data.notebookServerUrl,
|
|
||||||
authToken: userContext.features.notebookServerToken || connectionInfo.data.notebookAuthToken,
|
|
||||||
});
|
|
||||||
this.notebookManager?.notebookClient
|
|
||||||
.getMemoryUsage()
|
|
||||||
.then((memoryUsageInfo) => useNotebook.getState().setMemoryUsageInfo(memoryUsageInfo));
|
|
||||||
useNotebook.getState().setIsAllocating(false);
|
|
||||||
} else {
|
|
||||||
connectionStatus.status = ConnectionStatusType.Failed;
|
|
||||||
useNotebook.getState().resetConatinerConnection(connectionStatus);
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
connectionStatus.status = ConnectionStatusType.Failed;
|
|
||||||
useNotebook.getState().resetConatinerConnection(connectionStatus);
|
|
||||||
throw error;
|
|
||||||
}
|
|
||||||
this.refreshNotebookList();
|
|
||||||
|
|
||||||
this._isInitializingNotebooks = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public resetNotebookWorkspace(): void {
|
|
||||||
if (!useNotebook.getState().isNotebookEnabled || !this.notebookManager?.notebookClient) {
|
if (!useNotebook.getState().isNotebookEnabled || !this.notebookManager?.notebookClient) {
|
||||||
handleError(
|
handleError(
|
||||||
"Attempt to reset notebook workspace, but notebook is not enabled",
|
"Attempt to reset notebook workspace, but notebook is not enabled",
|
||||||
@@ -445,6 +389,7 @@ export default class Explorer {
|
|||||||
if (!databaseAccount) {
|
if (!databaseAccount) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const { value: workspaces } = await listByDatabaseAccount(
|
const { value: workspaces } = await listByDatabaseAccount(
|
||||||
userContext.subscriptionId,
|
userContext.subscriptionId,
|
||||||
@@ -691,9 +636,6 @@ export default class Explorer {
|
|||||||
if (!notebookContentItem || !notebookContentItem.path) {
|
if (!notebookContentItem || !notebookContentItem.path) {
|
||||||
throw new Error(`Invalid notebookContentItem: ${notebookContentItem}`);
|
throw new Error(`Invalid notebookContentItem: ${notebookContentItem}`);
|
||||||
}
|
}
|
||||||
if (notebookContentItem.type === NotebookContentItemType.Notebook && NotebookUtil.isPhoenixEnabled()) {
|
|
||||||
this.allocateContainer();
|
|
||||||
}
|
|
||||||
|
|
||||||
const notebookTabs = useTabs
|
const notebookTabs = useTabs
|
||||||
.getState()
|
.getState()
|
||||||
@@ -915,51 +857,9 @@ export default class Explorer {
|
|||||||
handleError(error, "Explorer/onNewNotebookClicked");
|
handleError(error, "Explorer/onNewNotebookClicked");
|
||||||
throw new Error(error);
|
throw new Error(error);
|
||||||
}
|
}
|
||||||
const isPhoenixEnabled = NotebookUtil.isPhoenixEnabled();
|
|
||||||
if (isPhoenixEnabled) {
|
|
||||||
if (isGithubTree) {
|
|
||||||
async () => {
|
|
||||||
await this.allocateContainer();
|
|
||||||
parent = parent || this.resourceTree.myNotebooksContentRoot;
|
|
||||||
this.createNewNoteBook(parent, isGithubTree);
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
useDialog.getState().showOkCancelModalDialog(
|
|
||||||
Notebook.newNotebookModalTitle,
|
|
||||||
undefined,
|
|
||||||
"Create",
|
|
||||||
async () => {
|
|
||||||
await this.allocateContainer();
|
|
||||||
parent = parent || this.resourceTree.myNotebooksContentRoot;
|
|
||||||
this.createNewNoteBook(parent, isGithubTree);
|
|
||||||
},
|
|
||||||
"Cancel",
|
|
||||||
undefined,
|
|
||||||
this.getNewNoteWarningText()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
parent = parent || this.resourceTree.myNotebooksContentRoot;
|
|
||||||
this.createNewNoteBook(parent, isGithubTree);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private getNewNoteWarningText(): JSX.Element {
|
parent = parent || this.resourceTree.myNotebooksContentRoot;
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<p>{Notebook.newNotebookModalContent1}</p>
|
|
||||||
<br />
|
|
||||||
<p>
|
|
||||||
{Notebook.newNotebookModalContent2}
|
|
||||||
<Link href={Notebook.cosmosNotebookHomePageUrl} target="_blank">
|
|
||||||
{Notebook.learnMore}
|
|
||||||
</Link>
|
|
||||||
</p>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
private createNewNoteBook(parent?: NotebookContentItem, isGithubTree?: boolean): void {
|
|
||||||
const clearInProgressMessage = logConsoleProgress(`Creating new notebook in ${parent.path}`);
|
const clearInProgressMessage = logConsoleProgress(`Creating new notebook in ${parent.path}`);
|
||||||
const startKey: number = TelemetryProcessor.traceStart(Action.CreateNewNotebook, {
|
const startKey: number = TelemetryProcessor.traceStart(Action.CreateNewNotebook, {
|
||||||
dataExplorerArea: Constants.Areas.Notebook,
|
dataExplorerArea: Constants.Areas.Notebook,
|
||||||
@@ -1006,26 +906,7 @@ export default class Explorer {
|
|||||||
await this.notebookManager?.notebookContentClient.updateItemChildrenInPlace(item);
|
await this.notebookManager?.notebookContentClient.updateItemChildrenInPlace(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async openNotebookTerminal(kind: ViewModels.TerminalKind): Promise<void> {
|
public openNotebookTerminal(kind: ViewModels.TerminalKind) {
|
||||||
if (NotebookUtil.isPhoenixEnabled()) {
|
|
||||||
await this.allocateContainer();
|
|
||||||
const notebookServerInfo = useNotebook.getState().notebookServerInfo;
|
|
||||||
if (notebookServerInfo && notebookServerInfo.notebookServerEndpoint !== undefined) {
|
|
||||||
this.connectToNotebookTerminal(kind);
|
|
||||||
} else {
|
|
||||||
useDialog
|
|
||||||
.getState()
|
|
||||||
.showOkModalDialog(
|
|
||||||
"Failed to Connect",
|
|
||||||
"Failed to connect temporary workspace, this could happen because of network issue please refresh and try again."
|
|
||||||
);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
this.connectToNotebookTerminal(kind);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private connectToNotebookTerminal(kind: ViewModels.TerminalKind): void {
|
|
||||||
let title: string;
|
let title: string;
|
||||||
|
|
||||||
switch (kind) {
|
switch (kind) {
|
||||||
@@ -1076,7 +957,7 @@ export default class Explorer {
|
|||||||
notebookUrl?: string,
|
notebookUrl?: string,
|
||||||
galleryItem?: IGalleryItem,
|
galleryItem?: IGalleryItem,
|
||||||
isFavorite?: boolean
|
isFavorite?: boolean
|
||||||
): Promise<void> {
|
) {
|
||||||
const title = "Gallery";
|
const title = "Gallery";
|
||||||
const GalleryTab = await (await import(/* webpackChunkName: "GalleryTab" */ "./Tabs/GalleryTab")).default;
|
const GalleryTab = await (await import(/* webpackChunkName: "GalleryTab" */ "./Tabs/GalleryTab")).default;
|
||||||
const galleryTab = useTabs
|
const galleryTab = useTabs
|
||||||
@@ -1145,10 +1026,7 @@ export default class Explorer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public async handleOpenFileAction(path: string): Promise<void> {
|
public async handleOpenFileAction(path: string): Promise<void> {
|
||||||
if (
|
if (!(await this._containsDefaultNotebookWorkspace(userContext.databaseAccount))) {
|
||||||
userContext.features.phoenix === false &&
|
|
||||||
!(await this._containsDefaultNotebookWorkspace(userContext.databaseAccount))
|
|
||||||
) {
|
|
||||||
this._openSetupNotebooksPaneForQuickstart();
|
this._openSetupNotebooksPaneForQuickstart();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1180,27 +1058,7 @@ export default class Explorer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public openUploadFilePanel(parent?: NotebookContentItem): void {
|
public openUploadFilePanel(parent?: NotebookContentItem): void {
|
||||||
if (NotebookUtil.isPhoenixEnabled()) {
|
parent = parent || this.resourceTree.myNotebooksContentRoot;
|
||||||
useDialog.getState().showOkCancelModalDialog(
|
|
||||||
Notebook.newNotebookUploadModalTitle,
|
|
||||||
undefined,
|
|
||||||
"Upload",
|
|
||||||
async () => {
|
|
||||||
await this.allocateContainer();
|
|
||||||
parent = parent || this.resourceTree.myNotebooksContentRoot;
|
|
||||||
this.uploadFilePanel(parent);
|
|
||||||
},
|
|
||||||
"Cancel",
|
|
||||||
undefined,
|
|
||||||
this.getNewNoteWarningText()
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
parent = parent || this.resourceTree.myNotebooksContentRoot;
|
|
||||||
this.uploadFilePanel(parent);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private uploadFilePanel(parent?: NotebookContentItem): void {
|
|
||||||
useSidePanel
|
useSidePanel
|
||||||
.getState()
|
.getState()
|
||||||
.openSidePanel(
|
.openSidePanel(
|
||||||
@@ -1209,36 +1067,15 @@ export default class Explorer {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public getDownloadModalConent(fileName: string): JSX.Element {
|
|
||||||
if (NotebookUtil.isPhoenixEnabled()) {
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<p>{Notebook.galleryNotebookDownloadContent1}</p>
|
|
||||||
<br />
|
|
||||||
<p>
|
|
||||||
{Notebook.galleryNotebookDownloadContent2}
|
|
||||||
<Link href={Notebook.cosmosNotebookGitDocumentationUrl} target="_blank">
|
|
||||||
{Notebook.learnMore}
|
|
||||||
</Link>
|
|
||||||
</p>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return <p> Download {fileName} from gallery as a copy to your notebooks to run and/or edit the notebook. </p>;
|
|
||||||
}
|
|
||||||
|
|
||||||
public async refreshExplorer(): Promise<void> {
|
public async refreshExplorer(): Promise<void> {
|
||||||
userContext.authType === AuthType.ResourceToken
|
userContext.authType === AuthType.ResourceToken
|
||||||
? this.refreshDatabaseForResourceToken()
|
? this.refreshDatabaseForResourceToken()
|
||||||
: this.refreshAllDatabases();
|
: this.refreshAllDatabases();
|
||||||
await useNotebook.getState().refreshNotebooksEnabledStateForAccount();
|
await useNotebook.getState().refreshNotebooksEnabledStateForAccount();
|
||||||
let isNotebookEnabled = true;
|
const isNotebookEnabled: boolean =
|
||||||
if (!userContext.features.phoenix) {
|
userContext.authType !== AuthType.ResourceToken &&
|
||||||
isNotebookEnabled =
|
((await this._containsDefaultNotebookWorkspace(userContext.databaseAccount)) ||
|
||||||
userContext.authType !== AuthType.ResourceToken &&
|
userContext.features.enableNotebooks);
|
||||||
((await this._containsDefaultNotebookWorkspace(userContext.databaseAccount)) ||
|
|
||||||
userContext.features.enableNotebooks);
|
|
||||||
}
|
|
||||||
useNotebook.getState().setIsNotebookEnabled(isNotebookEnabled);
|
useNotebook.getState().setIsNotebookEnabled(isNotebookEnabled);
|
||||||
useNotebook.getState().setIsShellEnabled(isNotebookEnabled && isPublicInternetAccessAllowed());
|
useNotebook.getState().setIsShellEnabled(isNotebookEnabled && isPublicInternetAccessAllowed());
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ describe("Cache arrays by key", () => {
|
|||||||
const key = "key";
|
const key = "key";
|
||||||
cache.insert(key, 1, 0);
|
cache.insert(key, 1, 0);
|
||||||
cache.clear();
|
cache.clear();
|
||||||
expect(cache.retrieve(key, 0, 1)).toBe(undefined);
|
expect(cache.retrieve(key, 0, 1)).toBe(null);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should invalidate oldest key to keep cache size under maximum", () => {
|
it("should invalidate oldest key to keep cache size under maximum", () => {
|
||||||
@@ -21,7 +21,7 @@ describe("Cache arrays by key", () => {
|
|||||||
cache.insert(key1, 2, 4);
|
cache.insert(key1, 2, 4);
|
||||||
|
|
||||||
expect(cache.retrieve(key1, 0, 3)).toEqual([0, 2, 4]);
|
expect(cache.retrieve(key1, 0, 3)).toEqual([0, 2, 4]);
|
||||||
expect(cache.retrieve(key2, 1, 1)).toEqual(undefined);
|
expect(cache.retrieve(key2, 1, 1)).toEqual(null);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should cache and retrieve cached page within boundaries", () => {
|
it("should cache and retrieve cached page within boundaries", () => {
|
||||||
@@ -39,7 +39,7 @@ describe("Cache arrays by key", () => {
|
|||||||
const key = "key";
|
const key = "key";
|
||||||
cache.insert(key, 0, 0);
|
cache.insert(key, 0, 0);
|
||||||
cache.insert(key, 1, 1);
|
cache.insert(key, 1, 1);
|
||||||
expect(cache.retrieve(key, 2, 1)).toEqual(undefined);
|
expect(cache.retrieve(key, 2, 1)).toEqual(null);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should not retrieve cached page overlapping boundaries", () => {
|
it("should not retrieve cached page overlapping boundaries", () => {
|
||||||
@@ -48,7 +48,7 @@ describe("Cache arrays by key", () => {
|
|||||||
cache.insert(key, 0, 0);
|
cache.insert(key, 0, 0);
|
||||||
cache.insert(key, 1, 1);
|
cache.insert(key, 1, 1);
|
||||||
cache.insert(key, 2, 2);
|
cache.insert(key, 2, 2);
|
||||||
expect(cache.retrieve(key, 2, 4)).toEqual(undefined);
|
expect(cache.retrieve(key, 2, 4)).toEqual(null);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should not insert non-contiguous element", () => {
|
it("should not insert non-contiguous element", () => {
|
||||||
@@ -57,7 +57,7 @@ describe("Cache arrays by key", () => {
|
|||||||
cache.insert(key, 0, 0);
|
cache.insert(key, 0, 0);
|
||||||
cache.insert(key, 1, 1);
|
cache.insert(key, 1, 1);
|
||||||
cache.insert(key, 3, 3);
|
cache.insert(key, 3, 3);
|
||||||
expect(cache.retrieve(key, 3, 1)).toEqual(undefined);
|
expect(cache.retrieve(key, 3, 1)).toEqual(null);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should cache multiple keys", () => {
|
it("should cache multiple keys", () => {
|
||||||
|
|||||||
@@ -61,12 +61,12 @@ export class ArraysByKeyCache<T> {
|
|||||||
* @param pageSize
|
* @param pageSize
|
||||||
*/
|
*/
|
||||||
public retrieve(key: string, startIndex: number, pageSize: number): T[] | null {
|
public retrieve(key: string, startIndex: number, pageSize: number): T[] | null {
|
||||||
if (!Object.prototype.hasOwnProperty.call(this.cache, key)) {
|
if (!this.cache.hasOwnProperty(key)) {
|
||||||
return undefined;
|
return null;
|
||||||
}
|
}
|
||||||
const elements = this.cache[key];
|
const elements = this.cache[key];
|
||||||
if (startIndex + pageSize > elements.length) {
|
if (startIndex + pageSize > elements.length) {
|
||||||
return undefined;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return elements.slice(startIndex, startIndex + pageSize);
|
return elements.slice(startIndex, startIndex + pageSize);
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ export interface GremlinSimpleClientParameters {
|
|||||||
password: string;
|
password: string;
|
||||||
successCallback: (result: Result) => void;
|
successCallback: (result: Result) => void;
|
||||||
progressCallback: (result: Result) => void;
|
progressCallback: (result: Result) => void;
|
||||||
failureCallback: (result: Result, error: string) => void;
|
failureCallback: (result: Result | null, error: string) => void;
|
||||||
infoCallback: (msg: string) => void;
|
infoCallback: (msg: string) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -62,14 +62,15 @@ export class GremlinSimpleClient {
|
|||||||
private static readonly requestChargeHeader = "x-ms-request-charge";
|
private static readonly requestChargeHeader = "x-ms-request-charge";
|
||||||
|
|
||||||
public params: GremlinSimpleClientParameters;
|
public params: GremlinSimpleClientParameters;
|
||||||
private protocols: string | string[];
|
private ws: WebSocket | undefined;
|
||||||
private ws: WebSocket;
|
|
||||||
|
|
||||||
public requestsToSend: { [requestId: string]: GremlinRequestMessage };
|
public requestsToSend: { [requestId: string]: GremlinRequestMessage };
|
||||||
public pendingRequests: { [requestId: string]: GremlinRequestMessage };
|
public pendingRequests: { [requestId: string]: GremlinRequestMessage };
|
||||||
|
|
||||||
constructor(params: GremlinSimpleClientParameters) {
|
constructor(params: GremlinSimpleClientParameters) {
|
||||||
this.params = params;
|
this.params = params;
|
||||||
|
this.ws = undefined;
|
||||||
|
|
||||||
this.pendingRequests = {};
|
this.pendingRequests = {};
|
||||||
this.requestsToSend = {};
|
this.requestsToSend = {};
|
||||||
}
|
}
|
||||||
@@ -117,7 +118,7 @@ export class GremlinSimpleClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public decodeMessage(msg: MessageEvent): GremlinResponseMessage {
|
public decodeMessage(msg: MessageEvent): GremlinResponseMessage | null {
|
||||||
if (msg.data === null) {
|
if (msg.data === null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -280,7 +281,7 @@ export class GremlinSimpleClient {
|
|||||||
|
|
||||||
public static utf8ToB64(utf8Str: string) {
|
public static utf8ToB64(utf8Str: string) {
|
||||||
return btoa(
|
return btoa(
|
||||||
encodeURIComponent(utf8Str).replace(/%([0-9A-F]{2})/g, function (match, p1) {
|
encodeURIComponent(utf8Str).replace(/%([0-9A-F]{2})/g, function (_match, p1) {
|
||||||
return String.fromCharCode(parseInt(p1, 16));
|
return String.fromCharCode(parseInt(p1, 16));
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
@@ -305,7 +306,7 @@ export class GremlinSimpleClient {
|
|||||||
return binaryMessage;
|
return binaryMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
private onOpen(event: any) {
|
private onOpen(_event: any) {
|
||||||
this.executeRequestsToSend();
|
this.executeRequestsToSend();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -348,6 +349,6 @@ export class GremlinSimpleClient {
|
|||||||
|
|
||||||
private sendGremlinMessage(gremlinRequestMessage: GremlinRequestMessage) {
|
private sendGremlinMessage(gremlinRequestMessage: GremlinRequestMessage) {
|
||||||
const gremlinFrame = GremlinSimpleClient.buildGremlinMessage(gremlinRequestMessage);
|
const gremlinFrame = GremlinSimpleClient.buildGremlinMessage(gremlinRequestMessage);
|
||||||
this.ws.send(gremlinFrame);
|
this.ws && this.ws.send(gremlinFrame);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
|
import { GraphVizComponent, GraphVizComponentProps } from "./GraphVizComponent";
|
||||||
import CollapseArrowIcon from "../../../../images/Collapse_arrow_14x14.svg";
|
import CollapseArrowIcon from "../../../../images/Collapse_arrow_14x14.svg";
|
||||||
import ExpandIcon from "../../../../images/Expand_14x14.svg";
|
import ExpandIcon from "../../../../images/Expand_14x14.svg";
|
||||||
import LoadingIndicatorIcon from "../../../../images/LoadingIndicator_3Squares.gif";
|
import LoadingIndicatorIcon from "../../../../images/LoadingIndicator_3Squares.gif";
|
||||||
import { GraphVizComponent, GraphVizComponentProps } from "./GraphVizComponent";
|
|
||||||
|
|
||||||
interface MiddlePaneComponentProps {
|
interface MiddlePaneComponentProps {
|
||||||
isTabsContentExpanded: boolean;
|
isTabsContentExpanded: boolean;
|
||||||
@@ -17,14 +17,7 @@ export class MiddlePaneComponent extends React.Component<MiddlePaneComponentProp
|
|||||||
<div className="middlePane">
|
<div className="middlePane">
|
||||||
<div className="graphTitle">
|
<div className="graphTitle">
|
||||||
<span className="paneTitle">Graph</span>
|
<span className="paneTitle">Graph</span>
|
||||||
<span
|
<span className="graphExpandCollapseBtn pull-right" onClick={this.props.toggleExpandGraph}>
|
||||||
className="graphExpandCollapseBtn pull-right"
|
|
||||||
onClick={this.props.toggleExpandGraph}
|
|
||||||
role="button"
|
|
||||||
aria-expanded={this.props.isTabsContentExpanded}
|
|
||||||
aria-name="View graph in full screen"
|
|
||||||
tabIndex={0}
|
|
||||||
>
|
|
||||||
<img
|
<img
|
||||||
src={this.props.isTabsContentExpanded ? CollapseArrowIcon : ExpandIcon}
|
src={this.props.isTabsContentExpanded ? CollapseArrowIcon : ExpandIcon}
|
||||||
alt={this.props.isTabsContentExpanded ? "collapse graph content" : "expand graph content"}
|
alt={this.props.isTabsContentExpanded ? "collapse graph content" : "expand graph content"}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -9,10 +9,8 @@ import create, { UseStore } from "zustand";
|
|||||||
import { StyleConstants } from "../../../Common/Constants";
|
import { StyleConstants } from "../../../Common/Constants";
|
||||||
import * as ViewModels from "../../../Contracts/ViewModels";
|
import * as ViewModels from "../../../Contracts/ViewModels";
|
||||||
import { useTabs } from "../../../hooks/useTabs";
|
import { useTabs } from "../../../hooks/useTabs";
|
||||||
import { userContext } from "../../../UserContext";
|
|
||||||
import { CommandButtonComponentProps } from "../../Controls/CommandButton/CommandButtonComponent";
|
import { CommandButtonComponentProps } from "../../Controls/CommandButton/CommandButtonComponent";
|
||||||
import Explorer from "../../Explorer";
|
import Explorer from "../../Explorer";
|
||||||
import { NotebookUtil } from "../../Notebook/NotebookUtil";
|
|
||||||
import { useSelectedNode } from "../../useSelectedNode";
|
import { useSelectedNode } from "../../useSelectedNode";
|
||||||
import * as CommandBarComponentButtonFactory from "./CommandBarComponentButtonFactory";
|
import * as CommandBarComponentButtonFactory from "./CommandBarComponentButtonFactory";
|
||||||
import * as CommandBarUtil from "./CommandBarUtil";
|
import * as CommandBarUtil from "./CommandBarUtil";
|
||||||
@@ -56,15 +54,7 @@ export const CommandBar: React.FC<Props> = ({ container }: Props) => {
|
|||||||
const uiFabricControlButtons = CommandBarUtil.convertButton(controlButtons, backgroundColor);
|
const uiFabricControlButtons = CommandBarUtil.convertButton(controlButtons, backgroundColor);
|
||||||
uiFabricControlButtons.forEach((btn: ICommandBarItemProps) => (btn.iconOnly = true));
|
uiFabricControlButtons.forEach((btn: ICommandBarItemProps) => (btn.iconOnly = true));
|
||||||
|
|
||||||
if (NotebookUtil.isPhoenixEnabled()) {
|
if (useTabs.getState().activeTab?.tabKind === ViewModels.CollectionTabKind.NotebookV2) {
|
||||||
uiFabricControlButtons.unshift(CommandBarUtil.createConnectionStatus(container, "connectionStatus"));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (
|
|
||||||
userContext.features.phoenix === false &&
|
|
||||||
userContext.features.notebooksTemporarilyDown === false &&
|
|
||||||
useTabs.getState().activeTab?.tabKind === ViewModels.CollectionTabKind.NotebookV2
|
|
||||||
) {
|
|
||||||
uiFabricControlButtons.unshift(CommandBarUtil.createMemoryTracker("memoryTracker"));
|
uiFabricControlButtons.unshift(CommandBarUtil.createMemoryTracker("memoryTracker"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -80,9 +80,8 @@ export function createStaticCommandBarButtons(
|
|||||||
}
|
}
|
||||||
|
|
||||||
notebookButtons.push(createOpenTerminalButton(container));
|
notebookButtons.push(createOpenTerminalButton(container));
|
||||||
if (userContext.features.phoenix === false) {
|
|
||||||
notebookButtons.push(createNotebookWorkspaceResetButton(container));
|
notebookButtons.push(createNotebookWorkspaceResetButton(container));
|
||||||
}
|
|
||||||
if (
|
if (
|
||||||
(userContext.apiType === "Mongo" &&
|
(userContext.apiType === "Mongo" &&
|
||||||
useNotebook.getState().isShellEnabled &&
|
useNotebook.getState().isShellEnabled &&
|
||||||
@@ -596,7 +595,7 @@ function createManageGitHubAccountButton(container: Explorer): CommandButtonComp
|
|||||||
return {
|
return {
|
||||||
iconSrc: GitHubIcon,
|
iconSrc: GitHubIcon,
|
||||||
iconAlt: label,
|
iconAlt: label,
|
||||||
onCommandClick: () => {
|
onCommandClick: () =>
|
||||||
useSidePanel
|
useSidePanel
|
||||||
.getState()
|
.getState()
|
||||||
.openSidePanel(
|
.openSidePanel(
|
||||||
@@ -606,8 +605,7 @@ function createManageGitHubAccountButton(container: Explorer): CommandButtonComp
|
|||||||
gitHubClientProp={container.notebookManager.gitHubClient}
|
gitHubClientProp={container.notebookManager.gitHubClient}
|
||||||
junoClientProp={junoClient}
|
junoClientProp={junoClient}
|
||||||
/>
|
/>
|
||||||
);
|
),
|
||||||
},
|
|
||||||
commandButtonLabel: label,
|
commandButtonLabel: label,
|
||||||
hasPopup: false,
|
hasPopup: false,
|
||||||
disabled: false,
|
disabled: false,
|
||||||
|
|||||||
@@ -13,8 +13,6 @@ import { StyleConstants } from "../../../Common/Constants";
|
|||||||
import { Action, ActionModifiers } from "../../../Shared/Telemetry/TelemetryConstants";
|
import { Action, ActionModifiers } from "../../../Shared/Telemetry/TelemetryConstants";
|
||||||
import * as TelemetryProcessor from "../../../Shared/Telemetry/TelemetryProcessor";
|
import * as TelemetryProcessor from "../../../Shared/Telemetry/TelemetryProcessor";
|
||||||
import { CommandButtonComponentProps } from "../../Controls/CommandButton/CommandButtonComponent";
|
import { CommandButtonComponentProps } from "../../Controls/CommandButton/CommandButtonComponent";
|
||||||
import Explorer from "../../Explorer";
|
|
||||||
import { ConnectionStatus } from "./ConnectionStatusComponent";
|
|
||||||
import { MemoryTracker } from "./MemoryTrackerComponent";
|
import { MemoryTracker } from "./MemoryTrackerComponent";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -203,10 +201,3 @@ export const createMemoryTracker = (key: string): ICommandBarItemProps => {
|
|||||||
onRender: () => <MemoryTracker />,
|
onRender: () => <MemoryTracker />,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
export const createConnectionStatus = (container: Explorer, key: string): ICommandBarItemProps => {
|
|
||||||
return {
|
|
||||||
key,
|
|
||||||
onRender: () => <ConnectionStatus container={container} />,
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|||||||
@@ -1,184 +0,0 @@
|
|||||||
@import "../../../../less/Common/Constants";
|
|
||||||
|
|
||||||
.connectionStatusContainer {
|
|
||||||
cursor: default;
|
|
||||||
align-items: center;
|
|
||||||
border: 1px;
|
|
||||||
min-height: 44px;
|
|
||||||
|
|
||||||
> span {
|
|
||||||
padding-right: 12px;
|
|
||||||
font-size: 12px;
|
|
||||||
font-family: @DataExplorerFont;
|
|
||||||
color: @DefaultFontColor;
|
|
||||||
}
|
|
||||||
&:focus{
|
|
||||||
outline: 0px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.commandReactBtn {
|
|
||||||
&:hover {
|
|
||||||
background-color: rgb(238, 247, 255);
|
|
||||||
color: rgb(32, 31, 30);
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
&:focus{
|
|
||||||
outline: 1px dashed #605e5c;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.connectedReactBtn {
|
|
||||||
&:hover {
|
|
||||||
background-color: rgb(238, 247, 255);
|
|
||||||
color: rgb(32, 31, 30);
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
&:focus{
|
|
||||||
outline: 0px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.connectIcon{
|
|
||||||
margin: 0px 4px;
|
|
||||||
height: 18px;
|
|
||||||
width: 18px;
|
|
||||||
color: rgb(0, 120, 212);
|
|
||||||
}
|
|
||||||
.status {
|
|
||||||
position: relative;
|
|
||||||
display: block;
|
|
||||||
margin-right: 8px;
|
|
||||||
width: 1em;
|
|
||||||
height: 1em;
|
|
||||||
font-size: 9px!important;
|
|
||||||
padding: 0px!important;
|
|
||||||
border-radius: 0.5em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.status::before,
|
|
||||||
.status::after {
|
|
||||||
position: absolute;
|
|
||||||
content: "";
|
|
||||||
}
|
|
||||||
|
|
||||||
.status::before {
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
width: 1em;
|
|
||||||
height: 1em;
|
|
||||||
background-color: rgba(#fff, 0.1);
|
|
||||||
border-radius: 100%;
|
|
||||||
opacity: 1;
|
|
||||||
transform: translate3d(0, 0, 0) scale(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
.connected{
|
|
||||||
background-color: green;
|
|
||||||
box-shadow:
|
|
||||||
0 0 0 0em rgba(green, 0),
|
|
||||||
0em 0.05em 0.1em rgba(#000000, 0.2);
|
|
||||||
transform: translate3d(0, 0, 0) scale(1);
|
|
||||||
}
|
|
||||||
.connecting{
|
|
||||||
background-color:#ffbf00;
|
|
||||||
box-shadow:
|
|
||||||
0 0 0 0em rgba(#ffbf00, 0),
|
|
||||||
0em 0.05em 0.1em rgba(#000000, 0.2);
|
|
||||||
transform: translate3d(0, 0, 0) scale(1);
|
|
||||||
}
|
|
||||||
.failed{
|
|
||||||
background-color:#bd1919;
|
|
||||||
box-shadow:
|
|
||||||
0 0 0 0em rgba(#bd1919, 0),
|
|
||||||
0em 0.05em 0.1em rgba(#000000, 0.2);
|
|
||||||
transform: translate3d(0, 0, 0) scale(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
.status.connecting.is-animating {
|
|
||||||
animation: status-outer-connecting 3000ms infinite;
|
|
||||||
}
|
|
||||||
.status.failed.is-animating {
|
|
||||||
animation: status-outer-failed 3000ms infinite;
|
|
||||||
}
|
|
||||||
.status.connected.is-animating {
|
|
||||||
animation: status-outer-connected 3000ms infinite;
|
|
||||||
}
|
|
||||||
@keyframes status-outer-connected {
|
|
||||||
|
|
||||||
0% {
|
|
||||||
transform: translate3d(0, 0, 0) scale(1);
|
|
||||||
box-shadow: 0 0 0 0em #008000, 0em 0.05em 0.1em rgba(0, 0, 0, 0.2);
|
|
||||||
}
|
|
||||||
20% {
|
|
||||||
transform: translate3d(0, 0, 0) scale(1);
|
|
||||||
box-shadow: 0 0 0 0em rgba(0, 128, 0, 0.6), 0em 0.05em 0.1em rgba(0, 0, 0, 0.5);
|
|
||||||
}
|
|
||||||
40% {
|
|
||||||
transform: translate3d(0, 0, 0) scale(1);
|
|
||||||
box-shadow: 0 0 0 0em rgba(0, 128, 0, 0.5), 0em 0.05em 0.1em rgba(0, 0, 0, 0.4);
|
|
||||||
}
|
|
||||||
60% {
|
|
||||||
transform: translate3d(0, 0, 0) scale(1);
|
|
||||||
box-shadow: 0 0 0 0em rgba(0, 128, 0, 0.3), 0em 0.05em 0.1em rgba(0, 0, 0, 0.3);
|
|
||||||
}
|
|
||||||
80% {
|
|
||||||
transform: translate3d(0, 0, 0) scale(1);
|
|
||||||
box-shadow: 0 0 0 0.5em rgba(0, 128, 0, 0.1), 0em 0.05em 0.1em rgba(0, 0, 0, 0.1);
|
|
||||||
}
|
|
||||||
85% {
|
|
||||||
transform: translate3d(0, 0, 0) scale(1);
|
|
||||||
box-shadow: 0 0 0 0em rgba(0, 128, 0, 0), 0em 0.05em 0.1em rgba(0, 0, 0, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@keyframes status-outer-failed {
|
|
||||||
|
|
||||||
0% {
|
|
||||||
transform: translate3d(0, 0, 0) scale(1);
|
|
||||||
box-shadow: 0 0 0 0em #bd1919, 0em 0.05em 0.1em rgba(0, 0, 0, 0.2);
|
|
||||||
}
|
|
||||||
20% {
|
|
||||||
transform: translate3d(0, 0, 0) scale(1);
|
|
||||||
box-shadow: 0 0 0 0em #c52d2d, 0em 0.05em 0.1em rgba(0, 0, 0, 0.5);
|
|
||||||
}
|
|
||||||
40% {
|
|
||||||
transform: translate3d(0, 0, 0) scale(1);
|
|
||||||
box-shadow: 0 0 0 0em #b47b7b, 0em 0.05em 0.1em rgba(0, 0, 0, 0.4);
|
|
||||||
}
|
|
||||||
60% {
|
|
||||||
transform: translate3d(0, 0, 0) scale(1);
|
|
||||||
box-shadow: 0 0 0 0em rgba(0, 128, 0, 0.3), 0em 0.05em 0.1em rgba(0, 0, 0, 0.3);
|
|
||||||
}
|
|
||||||
80% {
|
|
||||||
transform: translate3d(0, 0, 0) scale(1);
|
|
||||||
box-shadow: 0 0 0 0.5em rgba(0, 128, 0, 0.1), 0em 0.05em 0.1em rgba(0, 0, 0, 0.1);
|
|
||||||
}
|
|
||||||
85% {
|
|
||||||
transform: translate3d(0, 0, 0) scale(1);
|
|
||||||
box-shadow: 0 0 0 0em rgba(0, 128, 0, 0), 0em 0.05em 0.1em rgba(0, 0, 0, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@keyframes status-outer-connecting {
|
|
||||||
|
|
||||||
0% {
|
|
||||||
transform: translate3d(0, 0, 0) scale(1);
|
|
||||||
box-shadow: 0 0 0 0em #ffbf00, 0em 0.05em 0.1em rgba(0, 0, 0, 0.2);
|
|
||||||
}
|
|
||||||
20% {
|
|
||||||
transform: translate3d(0, 0, 0) scale(1);
|
|
||||||
box-shadow: 0 0 0 0em #f0dfad, 0em 0.05em 0.1em rgba(0, 0, 0, 0.5);
|
|
||||||
}
|
|
||||||
40% {
|
|
||||||
transform: translate3d(0, 0, 0) scale(1);
|
|
||||||
box-shadow: 0 0 0 0em rgba(198, 243, 198, 0.5), 0em 0.05em 0.1em rgba(0, 0, 0, 0.4);
|
|
||||||
}
|
|
||||||
60% {
|
|
||||||
transform: translate3d(0, 0, 0) scale(1);
|
|
||||||
box-shadow: 0 0 0 0em rgba(213, 241, 213, 0.3), 0em 0.05em 0.1em rgba(0, 0, 0, 0.3);
|
|
||||||
}
|
|
||||||
80% {
|
|
||||||
transform: translate3d(0, 0, 0) scale(1);
|
|
||||||
box-shadow: 0 0 0 0.5em rgba(0, 128, 0, 0.1), 0em 0.05em 0.1em rgba(0, 0, 0, 0.1);
|
|
||||||
}
|
|
||||||
85% {
|
|
||||||
transform: translate3d(0, 0, 0) scale(1);
|
|
||||||
box-shadow: 0 0 0 0em rgba(0, 128, 0, 0), 0em 0.05em 0.1em rgba(0, 0, 0, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,107 +0,0 @@
|
|||||||
import { Icon, ProgressIndicator, Stack, TooltipHost } from "@fluentui/react";
|
|
||||||
import { ActionButton } from "@fluentui/react/lib/Button";
|
|
||||||
import * as React from "react";
|
|
||||||
import "../../../../less/hostedexplorer.less";
|
|
||||||
import { ConnectionStatusType, Notebook } from "../../../Common/Constants";
|
|
||||||
import Explorer from "../../Explorer";
|
|
||||||
import { useNotebook } from "../../Notebook/useNotebook";
|
|
||||||
import "../CommandBar/ConnectionStatusComponent.less";
|
|
||||||
interface Props {
|
|
||||||
container: Explorer;
|
|
||||||
}
|
|
||||||
export const ConnectionStatus: React.FC<Props> = ({ container }: Props): JSX.Element => {
|
|
||||||
const [second, setSecond] = React.useState("00");
|
|
||||||
const [minute, setMinute] = React.useState("00");
|
|
||||||
const [isActive, setIsActive] = React.useState(false);
|
|
||||||
const [counter, setCounter] = React.useState(0);
|
|
||||||
const [statusColor, setStatusColor] = React.useState("");
|
|
||||||
const [toolTipContent, setToolTipContent] = React.useState("Connect to temporary workspace.");
|
|
||||||
React.useEffect(() => {
|
|
||||||
let intervalId: NodeJS.Timeout;
|
|
||||||
|
|
||||||
if (isActive) {
|
|
||||||
intervalId = setInterval(() => {
|
|
||||||
const secondCounter = counter % 60;
|
|
||||||
const minuteCounter = Math.floor(counter / 60);
|
|
||||||
const computedSecond: string = String(secondCounter).length === 1 ? `0${secondCounter}` : `${secondCounter}`;
|
|
||||||
const computedMinute: string = String(minuteCounter).length === 1 ? `0${minuteCounter}` : `${minuteCounter}`;
|
|
||||||
|
|
||||||
setSecond(computedSecond);
|
|
||||||
setMinute(computedMinute);
|
|
||||||
|
|
||||||
setCounter((counter) => counter + 1);
|
|
||||||
}, 1000);
|
|
||||||
}
|
|
||||||
return () => clearInterval(intervalId);
|
|
||||||
}, [isActive, counter]);
|
|
||||||
|
|
||||||
const stopTimer = () => {
|
|
||||||
setIsActive(false);
|
|
||||||
setCounter(0);
|
|
||||||
setSecond("00");
|
|
||||||
setMinute("00");
|
|
||||||
};
|
|
||||||
|
|
||||||
const connectionInfo = useNotebook((state) => state.connectionInfo);
|
|
||||||
const memoryUsageInfo = useNotebook((state) => state.memoryUsageInfo);
|
|
||||||
|
|
||||||
const totalGB = memoryUsageInfo ? memoryUsageInfo.totalKB / Notebook.memoryGuageToGB : 0;
|
|
||||||
const usedGB = totalGB > 0 ? totalGB - memoryUsageInfo.freeKB / Notebook.memoryGuageToGB : 0;
|
|
||||||
|
|
||||||
if (
|
|
||||||
connectionInfo &&
|
|
||||||
(connectionInfo.status === ConnectionStatusType.Connect || connectionInfo.status === ConnectionStatusType.ReConnect)
|
|
||||||
) {
|
|
||||||
return (
|
|
||||||
<ActionButton className="commandReactBtn" onClick={() => container.allocateContainer()}>
|
|
||||||
<TooltipHost content={toolTipContent}>
|
|
||||||
<Stack className="connectionStatusContainer" horizontal>
|
|
||||||
<Icon iconName="ConnectVirtualMachine" className="connectIcon" />
|
|
||||||
<span>{connectionInfo.status}</span>
|
|
||||||
</Stack>
|
|
||||||
</TooltipHost>
|
|
||||||
</ActionButton>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (connectionInfo && connectionInfo.status === ConnectionStatusType.Connecting && isActive === false) {
|
|
||||||
setIsActive(true);
|
|
||||||
setStatusColor("status connecting is-animating");
|
|
||||||
setToolTipContent("Connecting to temporary workspace.");
|
|
||||||
} else if (connectionInfo && connectionInfo.status === ConnectionStatusType.Connected && isActive === true) {
|
|
||||||
stopTimer();
|
|
||||||
setStatusColor("status connected is-animating");
|
|
||||||
setToolTipContent("Connected to temporary workspace.");
|
|
||||||
} else if (connectionInfo && connectionInfo.status === ConnectionStatusType.Failed && isActive === true) {
|
|
||||||
stopTimer();
|
|
||||||
setStatusColor("status failed is-animating");
|
|
||||||
setToolTipContent("Click here to Reconnect to temporary workspace.");
|
|
||||||
}
|
|
||||||
return (
|
|
||||||
<ActionButton
|
|
||||||
className={connectionInfo.status === ConnectionStatusType.Failed ? "commandReactBtn" : "connectedReactBtn"}
|
|
||||||
onClick={(e: React.MouseEvent<HTMLSpanElement>) =>
|
|
||||||
connectionInfo.status === ConnectionStatusType.Failed ? container.allocateContainer() : e.preventDefault()
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<TooltipHost content={toolTipContent}>
|
|
||||||
<Stack className="connectionStatusContainer" horizontal>
|
|
||||||
<i className={statusColor}></i>
|
|
||||||
<span className={connectionInfo.status === ConnectionStatusType.Failed ? "connectionStatusFailed" : ""}>
|
|
||||||
{connectionInfo.status}
|
|
||||||
</span>
|
|
||||||
{connectionInfo.status === ConnectionStatusType.Connecting && isActive && (
|
|
||||||
<ProgressIndicator description={minute + ":" + second} />
|
|
||||||
)}
|
|
||||||
{connectionInfo.status === ConnectionStatusType.Connected && !isActive && (
|
|
||||||
<ProgressIndicator
|
|
||||||
className={usedGB / totalGB > 0.8 ? "lowMemory" : ""}
|
|
||||||
description={usedGB.toFixed(1) + " of " + totalGB.toFixed(1) + " GB"}
|
|
||||||
percentComplete={usedGB / totalGB}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</Stack>
|
|
||||||
</TooltipHost>
|
|
||||||
</ActionButton>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
@@ -129,7 +129,7 @@ export class NotificationConsoleComponent extends React.Component<
|
|||||||
className="expandCollapseButton"
|
className="expandCollapseButton"
|
||||||
role="button"
|
role="button"
|
||||||
tabIndex={0}
|
tabIndex={0}
|
||||||
aria-label={"console button" + (this.props.isConsoleExpanded ? " expanded" : " collapsed")}
|
aria-label={"console button" + (this.props.isConsoleExpanded ? " collapsed" : " expanded")}
|
||||||
aria-expanded={!this.props.isConsoleExpanded}
|
aria-expanded={!this.props.isConsoleExpanded}
|
||||||
>
|
>
|
||||||
<img
|
<img
|
||||||
@@ -205,9 +205,7 @@ export class NotificationConsoleComponent extends React.Component<
|
|||||||
{item.type === ConsoleDataType.Error && <img className="errorIcon" src={ErrorRedIcon} alt="error" />}
|
{item.type === ConsoleDataType.Error && <img className="errorIcon" src={ErrorRedIcon} alt="error" />}
|
||||||
{item.type === ConsoleDataType.InProgress && <img className="loaderIcon" src={LoaderIcon} alt="in progress" />}
|
{item.type === ConsoleDataType.InProgress && <img className="loaderIcon" src={LoaderIcon} alt="in progress" />}
|
||||||
<span className="date">{item.date}</span>
|
<span className="date">{item.date}</span>
|
||||||
<span className="message" role="alert" aria-live="assertive">
|
<span className="message">{item.message}</span>
|
||||||
{item.message}
|
|
||||||
</span>
|
|
||||||
</div>
|
</div>
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ exports[`NotificationConsoleComponent renders the console 1`] = `
|
|||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
aria-expanded={true}
|
aria-expanded={true}
|
||||||
aria-label="console button collapsed"
|
aria-label="console button expanded"
|
||||||
className="expandCollapseButton"
|
className="expandCollapseButton"
|
||||||
role="button"
|
role="button"
|
||||||
tabIndex={0}
|
tabIndex={0}
|
||||||
@@ -236,7 +236,7 @@ exports[`NotificationConsoleComponent renders the console 2`] = `
|
|||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
aria-expanded={true}
|
aria-expanded={true}
|
||||||
aria-label="console button collapsed"
|
aria-label="console button expanded"
|
||||||
className="expandCollapseButton"
|
className="expandCollapseButton"
|
||||||
role="button"
|
role="button"
|
||||||
tabIndex={0}
|
tabIndex={0}
|
||||||
@@ -340,9 +340,7 @@ exports[`NotificationConsoleComponent renders the console 2`] = `
|
|||||||
date
|
date
|
||||||
</span>
|
</span>
|
||||||
<span
|
<span
|
||||||
aria-live="assertive"
|
|
||||||
className="message"
|
className="message"
|
||||||
role="alert"
|
|
||||||
>
|
>
|
||||||
message
|
message
|
||||||
</span>
|
</span>
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ const formWebSocketURL = (serverConfig: NotebookServiceConfig, kernelId: string,
|
|||||||
const q = params.toString();
|
const q = params.toString();
|
||||||
const suffix = q !== "" ? `?${q}` : "";
|
const suffix = q !== "" ? `?${q}` : "";
|
||||||
|
|
||||||
const url = (serverConfig.endpoint.slice(0, -1) || "") + `api/kernels/${kernelId}/channels${suffix}`;
|
const url = (serverConfig.endpoint || "") + `api/kernels/${kernelId}/channels${suffix}`;
|
||||||
|
|
||||||
return url.replace(/^http(s)?/, "ws$1");
|
return url.replace(/^http(s)?/, "ws$1");
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -2,15 +2,12 @@
|
|||||||
* Notebook container related stuff
|
* Notebook container related stuff
|
||||||
*/
|
*/
|
||||||
import * as Constants from "../../Common/Constants";
|
import * as Constants from "../../Common/Constants";
|
||||||
import { ConnectionStatusType } from "../../Common/Constants";
|
|
||||||
import { getErrorMessage } from "../../Common/ErrorHandlingUtils";
|
import { getErrorMessage } from "../../Common/ErrorHandlingUtils";
|
||||||
import * as Logger from "../../Common/Logger";
|
import * as Logger from "../../Common/Logger";
|
||||||
import * as DataModels from "../../Contracts/DataModels";
|
import * as DataModels from "../../Contracts/DataModels";
|
||||||
import { ContainerConnectionInfo } from "../../Contracts/DataModels";
|
|
||||||
import { userContext } from "../../UserContext";
|
import { userContext } from "../../UserContext";
|
||||||
import { createOrUpdate, destroy } from "../../Utils/arm/generatedClients/cosmosNotebooks/notebookWorkspaces";
|
import { createOrUpdate, destroy } from "../../Utils/arm/generatedClients/cosmosNotebooks/notebookWorkspaces";
|
||||||
import { logConsoleProgress } from "../../Utils/NotificationConsoleUtils";
|
import { logConsoleProgress } from "../../Utils/NotificationConsoleUtils";
|
||||||
import { NotebookUtil } from "./NotebookUtil";
|
|
||||||
import { useNotebook } from "./useNotebook";
|
import { useNotebook } from "./useNotebook";
|
||||||
|
|
||||||
export class NotebookContainerClient {
|
export class NotebookContainerClient {
|
||||||
@@ -45,7 +42,7 @@ export class NotebookContainerClient {
|
|||||||
}, delayMs);
|
}, delayMs);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async getMemoryUsage(): Promise<DataModels.MemoryUsageInfo> {
|
private async getMemoryUsage(): Promise<DataModels.MemoryUsageInfo> {
|
||||||
const notebookServerInfo = useNotebook.getState().notebookServerInfo;
|
const notebookServerInfo = useNotebook.getState().notebookServerInfo;
|
||||||
if (!notebookServerInfo || !notebookServerInfo.notebookServerEndpoint) {
|
if (!notebookServerInfo || !notebookServerInfo.notebookServerEndpoint) {
|
||||||
const error = "No server endpoint detected";
|
const error = "No server endpoint detected";
|
||||||
@@ -59,7 +56,7 @@ export class NotebookContainerClient {
|
|||||||
|
|
||||||
const { notebookServerEndpoint, authToken } = this.getNotebookServerConfig();
|
const { notebookServerEndpoint, authToken } = this.getNotebookServerConfig();
|
||||||
try {
|
try {
|
||||||
const response = await fetch(`${notebookServerEndpoint}api/metrics/memory`, {
|
const response = await fetch(`${notebookServerEndpoint}/api/metrics/memory`, {
|
||||||
method: "GET",
|
method: "GET",
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: authToken,
|
Authorization: authToken,
|
||||||
@@ -78,12 +75,6 @@ export class NotebookContainerClient {
|
|||||||
freeKB: memoryUsageInfo.free,
|
freeKB: memoryUsageInfo.free,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
} else if (NotebookUtil.isPhoenixEnabled()) {
|
|
||||||
const connectionStatus: ContainerConnectionInfo = {
|
|
||||||
status: ConnectionStatusType.ReConnect,
|
|
||||||
};
|
|
||||||
useNotebook.getState().resetConatinerConnection(connectionStatus);
|
|
||||||
useNotebook.getState().setIsRefreshed(true);
|
|
||||||
}
|
}
|
||||||
return undefined;
|
return undefined;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -93,13 +84,6 @@ export class NotebookContainerClient {
|
|||||||
"Connection lost with Notebook server. Attempting to reconnect..."
|
"Connection lost with Notebook server. Attempting to reconnect..."
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (NotebookUtil.isPhoenixEnabled()) {
|
|
||||||
const connectionStatus: ContainerConnectionInfo = {
|
|
||||||
status: ConnectionStatusType.Failed,
|
|
||||||
};
|
|
||||||
useNotebook.getState().resetConatinerConnection(connectionStatus);
|
|
||||||
useNotebook.getState().setIsRefreshed(true);
|
|
||||||
}
|
|
||||||
this.onConnectionLost();
|
this.onConnectionLost();
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,10 +36,7 @@ export class NotebookContentClient {
|
|||||||
*
|
*
|
||||||
* @param parent parent folder
|
* @param parent parent folder
|
||||||
*/
|
*/
|
||||||
public async createNewNotebookFile(
|
public createNewNotebookFile(parent: NotebookContentItem, isGithubTree?: boolean): Promise<NotebookContentItem> {
|
||||||
parent: NotebookContentItem,
|
|
||||||
isGithubTree?: boolean
|
|
||||||
): Promise<NotebookContentItem> {
|
|
||||||
if (!parent || parent.type !== NotebookContentItemType.Directory) {
|
if (!parent || parent.type !== NotebookContentItemType.Directory) {
|
||||||
throw new Error(`Parent must be a directory: ${parent}`);
|
throw new Error(`Parent must be a directory: ${parent}`);
|
||||||
}
|
}
|
||||||
@@ -102,6 +99,7 @@ export class NotebookContentClient {
|
|||||||
if (!parent || parent.type !== NotebookContentItemType.Directory) {
|
if (!parent || parent.type !== NotebookContentItemType.Directory) {
|
||||||
throw new Error(`Parent must be a directory: ${parent}`);
|
throw new Error(`Parent must be a directory: ${parent}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const filepath = NotebookUtil.getFilePath(parent.path, name);
|
const filepath = NotebookUtil.getFilePath(parent.path, name);
|
||||||
if (await this.checkIfFilepathExists(filepath)) {
|
if (await this.checkIfFilepathExists(filepath)) {
|
||||||
throw new Error(`File already exists: ${filepath}`);
|
throw new Error(`File already exists: ${filepath}`);
|
||||||
|
|||||||
@@ -212,7 +212,6 @@ export default class NotebookManager {
|
|||||||
"Cancel",
|
"Cancel",
|
||||||
() => reject(new Error("Commit dialog canceled")),
|
() => reject(new Error("Commit dialog canceled")),
|
||||||
undefined,
|
undefined,
|
||||||
undefined,
|
|
||||||
{
|
{
|
||||||
label: "Commit message",
|
label: "Commit message",
|
||||||
autoAdjustHeight: true,
|
autoAdjustHeight: true,
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ import { AppState, selectors } from "@nteract/core";
|
|||||||
import domtoimage from "dom-to-image";
|
import domtoimage from "dom-to-image";
|
||||||
import Html2Canvas from "html2canvas";
|
import Html2Canvas from "html2canvas";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
import { userContext } from "../../UserContext";
|
|
||||||
import * as GitHubUtils from "../../Utils/GitHubUtils";
|
import * as GitHubUtils from "../../Utils/GitHubUtils";
|
||||||
import * as StringUtils from "../../Utils/StringUtils";
|
import * as StringUtils from "../../Utils/StringUtils";
|
||||||
import { SnapshotFragment } from "./NotebookComponent/types";
|
import { SnapshotFragment } from "./NotebookComponent/types";
|
||||||
@@ -329,16 +328,4 @@ export class NotebookUtil {
|
|||||||
link.click();
|
link.click();
|
||||||
document.body.removeChild(link);
|
document.body.removeChild(link);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static getNotebookBtnTitle(fileName: string): string {
|
|
||||||
if (this.isPhoenixEnabled()) {
|
|
||||||
return `Download to ${fileName}`;
|
|
||||||
} else {
|
|
||||||
return `Download to my notebooks`;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static isPhoenixEnabled(): boolean {
|
|
||||||
return userContext.features.notebooksTemporarilyDown === false && userContext.features.phoenix === true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,12 +2,10 @@ import { cloneDeep } from "lodash";
|
|||||||
import create, { UseStore } from "zustand";
|
import create, { UseStore } from "zustand";
|
||||||
import { AuthType } from "../../AuthType";
|
import { AuthType } from "../../AuthType";
|
||||||
import * as Constants from "../../Common/Constants";
|
import * as Constants from "../../Common/Constants";
|
||||||
import { ConnectionStatusType } from "../../Common/Constants";
|
|
||||||
import { getErrorMessage } from "../../Common/ErrorHandlingUtils";
|
import { getErrorMessage } from "../../Common/ErrorHandlingUtils";
|
||||||
import * as Logger from "../../Common/Logger";
|
import * as Logger from "../../Common/Logger";
|
||||||
import { configContext } from "../../ConfigContext";
|
import { configContext } from "../../ConfigContext";
|
||||||
import * as DataModels from "../../Contracts/DataModels";
|
import * as DataModels from "../../Contracts/DataModels";
|
||||||
import { ContainerConnectionInfo } from "../../Contracts/DataModels";
|
|
||||||
import { IPinnedRepo } from "../../Juno/JunoClient";
|
import { IPinnedRepo } from "../../Juno/JunoClient";
|
||||||
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";
|
||||||
@@ -16,7 +14,6 @@ import { getAuthorizationHeader } from "../../Utils/AuthorizationUtils";
|
|||||||
import * as GitHubUtils from "../../Utils/GitHubUtils";
|
import * as GitHubUtils from "../../Utils/GitHubUtils";
|
||||||
import { NotebookContentItem, NotebookContentItemType } from "./NotebookContentItem";
|
import { NotebookContentItem, NotebookContentItemType } from "./NotebookContentItem";
|
||||||
import NotebookManager from "./NotebookManager";
|
import NotebookManager from "./NotebookManager";
|
||||||
import { NotebookUtil } from "./NotebookUtil";
|
|
||||||
|
|
||||||
interface NotebookState {
|
interface NotebookState {
|
||||||
isNotebookEnabled: boolean;
|
isNotebookEnabled: boolean;
|
||||||
@@ -31,10 +28,6 @@ interface NotebookState {
|
|||||||
myNotebooksContentRoot: NotebookContentItem;
|
myNotebooksContentRoot: NotebookContentItem;
|
||||||
gitHubNotebooksContentRoot: NotebookContentItem;
|
gitHubNotebooksContentRoot: NotebookContentItem;
|
||||||
galleryContentRoot: NotebookContentItem;
|
galleryContentRoot: NotebookContentItem;
|
||||||
connectionInfo: ContainerConnectionInfo;
|
|
||||||
notebookFolderName: string;
|
|
||||||
isAllocating: boolean;
|
|
||||||
isRefreshed: boolean;
|
|
||||||
setIsNotebookEnabled: (isNotebookEnabled: boolean) => void;
|
setIsNotebookEnabled: (isNotebookEnabled: boolean) => void;
|
||||||
setIsNotebooksEnabledForAccount: (isNotebooksEnabledForAccount: boolean) => void;
|
setIsNotebooksEnabledForAccount: (isNotebooksEnabledForAccount: boolean) => void;
|
||||||
setNotebookServerInfo: (notebookServerInfo: DataModels.NotebookWorkspaceConnectionInfo) => void;
|
setNotebookServerInfo: (notebookServerInfo: DataModels.NotebookWorkspaceConnectionInfo) => void;
|
||||||
@@ -43,7 +36,6 @@ interface NotebookState {
|
|||||||
setMemoryUsageInfo: (memoryUsageInfo: DataModels.MemoryUsageInfo) => void;
|
setMemoryUsageInfo: (memoryUsageInfo: DataModels.MemoryUsageInfo) => void;
|
||||||
setIsShellEnabled: (isShellEnabled: boolean) => void;
|
setIsShellEnabled: (isShellEnabled: boolean) => void;
|
||||||
setNotebookBasePath: (notebookBasePath: string) => void;
|
setNotebookBasePath: (notebookBasePath: string) => void;
|
||||||
setNotebookFolderName: (notebookFolderName: string) => void;
|
|
||||||
refreshNotebooksEnabledStateForAccount: () => Promise<void>;
|
refreshNotebooksEnabledStateForAccount: () => Promise<void>;
|
||||||
findItem: (root: NotebookContentItem, item: NotebookContentItem) => NotebookContentItem;
|
findItem: (root: NotebookContentItem, item: NotebookContentItem) => NotebookContentItem;
|
||||||
insertNotebookItem: (parent: NotebookContentItem, item: NotebookContentItem, isGithubTree?: boolean) => void;
|
insertNotebookItem: (parent: NotebookContentItem, item: NotebookContentItem, isGithubTree?: boolean) => void;
|
||||||
@@ -51,10 +43,6 @@ interface NotebookState {
|
|||||||
deleteNotebookItem: (item: NotebookContentItem, isGithubTree?: boolean) => void;
|
deleteNotebookItem: (item: NotebookContentItem, isGithubTree?: boolean) => void;
|
||||||
initializeNotebooksTree: (notebookManager: NotebookManager) => Promise<void>;
|
initializeNotebooksTree: (notebookManager: NotebookManager) => Promise<void>;
|
||||||
initializeGitHubRepos: (pinnedRepos: IPinnedRepo[]) => void;
|
initializeGitHubRepos: (pinnedRepos: IPinnedRepo[]) => void;
|
||||||
setConnectionInfo: (connectionInfo: ContainerConnectionInfo) => void;
|
|
||||||
setIsAllocating: (isAllocating: boolean) => void;
|
|
||||||
resetConatinerConnection: (connectionStatus: ContainerConnectionInfo) => void;
|
|
||||||
setIsRefreshed: (isAllocating: boolean) => void;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const useNotebook: UseStore<NotebookState> = create((set, get) => ({
|
export const useNotebook: UseStore<NotebookState> = create((set, get) => ({
|
||||||
@@ -77,12 +65,6 @@ export const useNotebook: UseStore<NotebookState> = create((set, get) => ({
|
|||||||
myNotebooksContentRoot: undefined,
|
myNotebooksContentRoot: undefined,
|
||||||
gitHubNotebooksContentRoot: undefined,
|
gitHubNotebooksContentRoot: undefined,
|
||||||
galleryContentRoot: undefined,
|
galleryContentRoot: undefined,
|
||||||
connectionInfo: {
|
|
||||||
status: ConnectionStatusType.Connect,
|
|
||||||
},
|
|
||||||
notebookFolderName: undefined,
|
|
||||||
isAllocating: false,
|
|
||||||
isRefreshed: false,
|
|
||||||
setIsNotebookEnabled: (isNotebookEnabled: boolean) => set({ isNotebookEnabled }),
|
setIsNotebookEnabled: (isNotebookEnabled: boolean) => set({ isNotebookEnabled }),
|
||||||
setIsNotebooksEnabledForAccount: (isNotebooksEnabledForAccount: boolean) => set({ isNotebooksEnabledForAccount }),
|
setIsNotebooksEnabledForAccount: (isNotebooksEnabledForAccount: boolean) => set({ isNotebooksEnabledForAccount }),
|
||||||
setNotebookServerInfo: (notebookServerInfo: DataModels.NotebookWorkspaceConnectionInfo) =>
|
setNotebookServerInfo: (notebookServerInfo: DataModels.NotebookWorkspaceConnectionInfo) =>
|
||||||
@@ -93,7 +75,6 @@ export const useNotebook: UseStore<NotebookState> = create((set, get) => ({
|
|||||||
setMemoryUsageInfo: (memoryUsageInfo: DataModels.MemoryUsageInfo) => set({ memoryUsageInfo }),
|
setMemoryUsageInfo: (memoryUsageInfo: DataModels.MemoryUsageInfo) => set({ memoryUsageInfo }),
|
||||||
setIsShellEnabled: (isShellEnabled: boolean) => set({ isShellEnabled }),
|
setIsShellEnabled: (isShellEnabled: boolean) => set({ isShellEnabled }),
|
||||||
setNotebookBasePath: (notebookBasePath: string) => set({ notebookBasePath }),
|
setNotebookBasePath: (notebookBasePath: string) => set({ notebookBasePath }),
|
||||||
setNotebookFolderName: (notebookFolderName: string) => set({ notebookFolderName }),
|
|
||||||
refreshNotebooksEnabledStateForAccount: async (): Promise<void> => {
|
refreshNotebooksEnabledStateForAccount: async (): Promise<void> => {
|
||||||
const { databaseAccount, authType } = userContext;
|
const { databaseAccount, authType } = userContext;
|
||||||
if (
|
if (
|
||||||
@@ -187,10 +168,8 @@ export const useNotebook: UseStore<NotebookState> = create((set, get) => ({
|
|||||||
isGithubTree ? set({ gitHubNotebooksContentRoot: root }) : set({ myNotebooksContentRoot: root });
|
isGithubTree ? set({ gitHubNotebooksContentRoot: root }) : set({ myNotebooksContentRoot: root });
|
||||||
},
|
},
|
||||||
initializeNotebooksTree: async (notebookManager: NotebookManager): Promise<void> => {
|
initializeNotebooksTree: async (notebookManager: NotebookManager): Promise<void> => {
|
||||||
const notebookFolderName = NotebookUtil.isPhoenixEnabled() === true ? "Temporary Notebooks" : "My Notebooks";
|
|
||||||
set({ notebookFolderName });
|
|
||||||
const myNotebooksContentRoot = {
|
const myNotebooksContentRoot = {
|
||||||
name: get().notebookFolderName,
|
name: "My Notebooks",
|
||||||
path: get().notebookBasePath,
|
path: get().notebookBasePath,
|
||||||
type: NotebookContentItemType.Directory,
|
type: NotebookContentItemType.Directory,
|
||||||
};
|
};
|
||||||
@@ -206,7 +185,6 @@ export const useNotebook: UseStore<NotebookState> = create((set, get) => ({
|
|||||||
type: NotebookContentItemType.Directory,
|
type: NotebookContentItemType.Directory,
|
||||||
}
|
}
|
||||||
: undefined;
|
: undefined;
|
||||||
|
|
||||||
set({
|
set({
|
||||||
myNotebooksContentRoot,
|
myNotebooksContentRoot,
|
||||||
galleryContentRoot,
|
galleryContentRoot,
|
||||||
@@ -268,15 +246,4 @@ export const useNotebook: UseStore<NotebookState> = create((set, get) => ({
|
|||||||
set({ gitHubNotebooksContentRoot });
|
set({ gitHubNotebooksContentRoot });
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
setConnectionInfo: (connectionInfo: ContainerConnectionInfo) => set({ connectionInfo }),
|
|
||||||
setIsAllocating: (isAllocating: boolean) => set({ isAllocating }),
|
|
||||||
resetConatinerConnection: (connectionStatus: ContainerConnectionInfo): void => {
|
|
||||||
useNotebook.getState().setConnectionInfo(connectionStatus);
|
|
||||||
useNotebook.getState().setNotebookServerInfo({
|
|
||||||
notebookServerEndpoint: undefined,
|
|
||||||
authToken: undefined,
|
|
||||||
});
|
|
||||||
useNotebook.getState().setIsAllocating(false);
|
|
||||||
},
|
|
||||||
setIsRefreshed: (isRefreshed: boolean) => set({ isRefreshed }),
|
|
||||||
}));
|
}));
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ export class AddCollectionPanel extends React.Component<AddCollectionPanelProps,
|
|||||||
true
|
true
|
||||||
).toLocaleLowerCase()}.`}
|
).toLocaleLowerCase()}.`}
|
||||||
>
|
>
|
||||||
<Icon iconName="Info" className="panelInfoIcon" tabIndex={0} />
|
<Icon iconName="Info" className="panelInfoIcon" />
|
||||||
</TooltipHost>
|
</TooltipHost>
|
||||||
</Stack>
|
</Stack>
|
||||||
|
|
||||||
@@ -210,7 +210,6 @@ export class AddCollectionPanel extends React.Component<AddCollectionPanelProps,
|
|||||||
className="panelTextField"
|
className="panelTextField"
|
||||||
aria-label="New database id"
|
aria-label="New database id"
|
||||||
autoFocus
|
autoFocus
|
||||||
tabIndex={0}
|
|
||||||
value={this.state.newDatabaseId}
|
value={this.state.newDatabaseId}
|
||||||
onChange={(event: React.ChangeEvent<HTMLInputElement>) =>
|
onChange={(event: React.ChangeEvent<HTMLInputElement>) =>
|
||||||
this.setState({ newDatabaseId: event.target.value })
|
this.setState({ newDatabaseId: event.target.value })
|
||||||
@@ -237,7 +236,7 @@ export class AddCollectionPanel extends React.Component<AddCollectionPanelProps,
|
|||||||
true
|
true
|
||||||
).toLocaleLowerCase()} within the database.`}
|
).toLocaleLowerCase()} within the database.`}
|
||||||
>
|
>
|
||||||
<Icon iconName="Info" className="panelInfoIcon" tabIndex={0} />
|
<Icon iconName="Info" className="panelInfoIcon" />
|
||||||
</TooltipHost>
|
</TooltipHost>
|
||||||
</Stack>
|
</Stack>
|
||||||
)}
|
)}
|
||||||
@@ -280,7 +279,7 @@ export class AddCollectionPanel extends React.Component<AddCollectionPanelProps,
|
|||||||
directionalHint={DirectionalHint.bottomLeftEdge}
|
directionalHint={DirectionalHint.bottomLeftEdge}
|
||||||
content={`Unique identifier for the ${getCollectionName().toLocaleLowerCase()} and used for id-based routing through REST and all SDKs.`}
|
content={`Unique identifier for the ${getCollectionName().toLocaleLowerCase()} and used for id-based routing through REST and all SDKs.`}
|
||||||
>
|
>
|
||||||
<Icon iconName="Info" className="panelInfoIcon" tabIndex={0} />
|
<Icon iconName="Info" className="panelInfoIcon" />
|
||||||
</TooltipHost>
|
</TooltipHost>
|
||||||
</Stack>
|
</Stack>
|
||||||
|
|
||||||
@@ -363,7 +362,7 @@ export class AddCollectionPanel extends React.Component<AddCollectionPanelProps,
|
|||||||
"Sharded collections split your data across many replica sets (shards) to achieve unlimited scalability. Sharded collections require choosing a shard key (field) to evenly distribute your data."
|
"Sharded collections split your data across many replica sets (shards) to achieve unlimited scalability. Sharded collections require choosing a shard key (field) to evenly distribute your data."
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<Icon iconName="Info" className="panelInfoIcon" tabIndex={0} />
|
<Icon iconName="Info" className="panelInfoIcon" />
|
||||||
</TooltipHost>
|
</TooltipHost>
|
||||||
</Stack>
|
</Stack>
|
||||||
|
|
||||||
@@ -410,7 +409,7 @@ export class AddCollectionPanel extends React.Component<AddCollectionPanelProps,
|
|||||||
directionalHint={DirectionalHint.bottomLeftEdge}
|
directionalHint={DirectionalHint.bottomLeftEdge}
|
||||||
content={this.getPartitionKeyTooltipText()}
|
content={this.getPartitionKeyTooltipText()}
|
||||||
>
|
>
|
||||||
<Icon iconName="Info" className="panelInfoIcon" tabIndex={0} />
|
<Icon iconName="Info" className="panelInfoIcon" />
|
||||||
</TooltipHost>
|
</TooltipHost>
|
||||||
</Stack>
|
</Stack>
|
||||||
|
|
||||||
@@ -468,7 +467,7 @@ export class AddCollectionPanel extends React.Component<AddCollectionPanelProps,
|
|||||||
does not count towards the throughput you provisioned for the database. This throughput amount will be
|
does not count towards the throughput you provisioned for the database. This throughput amount will be
|
||||||
billed in addition to the throughput amount you provisioned at the database level.`}
|
billed in addition to the throughput amount you provisioned at the database level.`}
|
||||||
>
|
>
|
||||||
<Icon iconName="Info" className="panelInfoIcon" tabIndex={0} />
|
<Icon iconName="Info" className="panelInfoIcon" />
|
||||||
</TooltipHost>
|
</TooltipHost>
|
||||||
</Stack>
|
</Stack>
|
||||||
)}
|
)}
|
||||||
@@ -498,7 +497,7 @@ export class AddCollectionPanel extends React.Component<AddCollectionPanelProps,
|
|||||||
creating a unique key policy when a container is created, you ensure the uniqueness of one or more values
|
creating a unique key policy when a container is created, you ensure the uniqueness of one or more values
|
||||||
per partition key."
|
per partition key."
|
||||||
>
|
>
|
||||||
<Icon iconName="Info" className="panelInfoIcon" tabIndex={0} />
|
<Icon iconName="Info" className="panelInfoIcon" />
|
||||||
</TooltipHost>
|
</TooltipHost>
|
||||||
</Stack>
|
</Stack>
|
||||||
|
|
||||||
@@ -561,7 +560,7 @@ export class AddCollectionPanel extends React.Component<AddCollectionPanelProps,
|
|||||||
directionalHint={DirectionalHint.bottomLeftEdge}
|
directionalHint={DirectionalHint.bottomLeftEdge}
|
||||||
content={this.getAnalyticalStorageTooltipContent()}
|
content={this.getAnalyticalStorageTooltipContent()}
|
||||||
>
|
>
|
||||||
<Icon iconName="Info" className="panelInfoIcon" tabIndex={0} />
|
<Icon iconName="Info" className="panelInfoIcon" />
|
||||||
</TooltipHost>
|
</TooltipHost>
|
||||||
</Stack>
|
</Stack>
|
||||||
|
|
||||||
@@ -638,7 +637,7 @@ export class AddCollectionPanel extends React.Component<AddCollectionPanelProps,
|
|||||||
directionalHint={DirectionalHint.bottomLeftEdge}
|
directionalHint={DirectionalHint.bottomLeftEdge}
|
||||||
content="The _id field is indexed by default. Creating a wildcard index for all fields will optimize queries and is recommended for development."
|
content="The _id field is indexed by default. Creating a wildcard index for all fields will optimize queries and is recommended for development."
|
||||||
>
|
>
|
||||||
<Icon iconName="Info" className="panelInfoIcon" tabIndex={0} />
|
<Icon iconName="Info" className="panelInfoIcon" />
|
||||||
</TooltipHost>
|
</TooltipHost>
|
||||||
</Stack>
|
</Stack>
|
||||||
|
|
||||||
|
|||||||
@@ -23,12 +23,10 @@ import { RightPaneForm, RightPaneFormProps } from "../RightPaneForm/RightPaneFor
|
|||||||
|
|
||||||
export interface AddDatabasePaneProps {
|
export interface AddDatabasePaneProps {
|
||||||
explorer: Explorer;
|
explorer: Explorer;
|
||||||
buttonElement?: HTMLElement;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const AddDatabasePanel: FunctionComponent<AddDatabasePaneProps> = ({
|
export const AddDatabasePanel: FunctionComponent<AddDatabasePaneProps> = ({
|
||||||
explorer: container,
|
explorer: container,
|
||||||
buttonElement,
|
|
||||||
}: AddDatabasePaneProps) => {
|
}: AddDatabasePaneProps) => {
|
||||||
const closeSidePanel = useSidePanel((state) => state.closeSidePanel);
|
const closeSidePanel = useSidePanel((state) => state.closeSidePanel);
|
||||||
let throughput: number;
|
let throughput: number;
|
||||||
@@ -79,7 +77,6 @@ export const AddDatabasePanel: FunctionComponent<AddDatabasePaneProps> = ({
|
|||||||
dataExplorerArea: Constants.Areas.ContextualPane,
|
dataExplorerArea: Constants.Areas.ContextualPane,
|
||||||
};
|
};
|
||||||
TelemetryProcessor.trace(Action.CreateDatabase, ActionModifiers.Open, addDatabasePaneOpenMessage);
|
TelemetryProcessor.trace(Action.CreateDatabase, ActionModifiers.Open, addDatabasePaneOpenMessage);
|
||||||
buttonElement.focus();
|
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const onSubmit = () => {
|
const onSubmit = () => {
|
||||||
|
|||||||
@@ -198,7 +198,6 @@ export const CassandraAddCollectionPane: FunctionComponent<CassandraAddCollectio
|
|||||||
<Stack className="panelGroupSpacing">
|
<Stack className="panelGroupSpacing">
|
||||||
<TextField
|
<TextField
|
||||||
aria-required="true"
|
aria-required="true"
|
||||||
required={true}
|
|
||||||
autoComplete="off"
|
autoComplete="off"
|
||||||
styles={getTextFieldStyles()}
|
styles={getTextFieldStyles()}
|
||||||
pattern="[^/?#\\]*[^/?# \\]"
|
pattern="[^/?#\\]*[^/?# \\]"
|
||||||
@@ -286,7 +285,6 @@ export const CassandraAddCollectionPane: FunctionComponent<CassandraAddCollectio
|
|||||||
underlined
|
underlined
|
||||||
styles={getTextFieldStyles({ fontSize: 12, width: 150 })}
|
styles={getTextFieldStyles({ fontSize: 12, width: 150 })}
|
||||||
aria-required="true"
|
aria-required="true"
|
||||||
required={true}
|
|
||||||
ariaLabel="addCollection-tableId"
|
ariaLabel="addCollection-tableId"
|
||||||
autoComplete="off"
|
autoComplete="off"
|
||||||
pattern="[^/?#\\]*[^/?# \\]"
|
pattern="[^/?#\\]*[^/?# \\]"
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import { getErrorMessage, handleError } from "../../../Common/ErrorHandlingUtils
|
|||||||
import { GitHubOAuthService } from "../../../GitHub/GitHubOAuthService";
|
import { GitHubOAuthService } from "../../../GitHub/GitHubOAuthService";
|
||||||
import { useSidePanel } from "../../../hooks/useSidePanel";
|
import { useSidePanel } from "../../../hooks/useSidePanel";
|
||||||
import { IPinnedRepo, JunoClient } from "../../../Juno/JunoClient";
|
import { IPinnedRepo, JunoClient } from "../../../Juno/JunoClient";
|
||||||
import { userContext } from "../../../UserContext";
|
|
||||||
import * as GitHubUtils from "../../../Utils/GitHubUtils";
|
import * as GitHubUtils from "../../../Utils/GitHubUtils";
|
||||||
import * as NotificationConsoleUtils from "../../../Utils/NotificationConsoleUtils";
|
import * as NotificationConsoleUtils from "../../../Utils/NotificationConsoleUtils";
|
||||||
import Explorer from "../../Explorer";
|
import Explorer from "../../Explorer";
|
||||||
@@ -76,8 +75,6 @@ export const CopyNotebookPane: FunctionComponent<CopyNotebookPanelProps> = ({
|
|||||||
selectedLocation.owner,
|
selectedLocation.owner,
|
||||||
selectedLocation.repo
|
selectedLocation.repo
|
||||||
)} - ${selectedLocation.branch}`;
|
)} - ${selectedLocation.branch}`;
|
||||||
} else if (selectedLocation.type === "MyNotebooks" && userContext.features.phoenix) {
|
|
||||||
destination = useNotebook.getState().notebookFolderName;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
clearMessage = NotificationConsoleUtils.logConsoleProgress(`Copying ${name} to ${destination}`);
|
clearMessage = NotificationConsoleUtils.logConsoleProgress(`Copying ${name} to ${destination}`);
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ import {
|
|||||||
import React, { FormEvent, FunctionComponent } from "react";
|
import React, { FormEvent, FunctionComponent } from "react";
|
||||||
import { IPinnedRepo } from "../../../Juno/JunoClient";
|
import { IPinnedRepo } from "../../../Juno/JunoClient";
|
||||||
import * as GitHubUtils from "../../../Utils/GitHubUtils";
|
import * as GitHubUtils from "../../../Utils/GitHubUtils";
|
||||||
import { useNotebook } from "../../Notebook/useNotebook";
|
|
||||||
import { ResourceTreeAdapter } from "../../Tree/ResourceTreeAdapter";
|
import { ResourceTreeAdapter } from "../../Tree/ResourceTreeAdapter";
|
||||||
|
|
||||||
interface Location {
|
interface Location {
|
||||||
@@ -47,10 +46,11 @@ export const CopyNotebookPaneComponent: FunctionComponent<CopyNotebookPaneProps>
|
|||||||
|
|
||||||
const getDropDownOptions = (): IDropdownOption[] => {
|
const getDropDownOptions = (): IDropdownOption[] => {
|
||||||
const options: IDropdownOption[] = [];
|
const options: IDropdownOption[] = [];
|
||||||
|
|
||||||
options.push({
|
options.push({
|
||||||
key: "MyNotebooks-Item",
|
key: "MyNotebooks-Item",
|
||||||
text: useNotebook.getState().notebookFolderName,
|
text: ResourceTreeAdapter.MyNotebooksTitle,
|
||||||
title: useNotebook.getState().notebookFolderName,
|
title: ResourceTreeAdapter.MyNotebooksTitle,
|
||||||
data: {
|
data: {
|
||||||
type: "MyNotebooks",
|
type: "MyNotebooks",
|
||||||
} as Location,
|
} as Location,
|
||||||
|
|||||||
@@ -108,8 +108,6 @@ export const DeleteCollectionConfirmationPane: FunctionComponent<DeleteCollectio
|
|||||||
submitButtonText: "OK",
|
submitButtonText: "OK",
|
||||||
onSubmit,
|
onSubmit,
|
||||||
};
|
};
|
||||||
const confirmContainer = `Confirm by typing the ${collectionName.toLowerCase()} id`;
|
|
||||||
const reasonInfo = `Help us improve Azure Cosmos DB! What is the reason why you are deleting this ${collectionName}?`;
|
|
||||||
return (
|
return (
|
||||||
<RightPaneForm {...props}>
|
<RightPaneForm {...props}>
|
||||||
<div className="panelFormWrapper">
|
<div className="panelFormWrapper">
|
||||||
@@ -125,7 +123,6 @@ export const DeleteCollectionConfirmationPane: FunctionComponent<DeleteCollectio
|
|||||||
onChange={(event, newInput?: string) => {
|
onChange={(event, newInput?: string) => {
|
||||||
setInputCollectionName(newInput);
|
setInputCollectionName(newInput);
|
||||||
}}
|
}}
|
||||||
ariaLabel={confirmContainer}
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
{shouldRecordFeedback() && (
|
{shouldRecordFeedback() && (
|
||||||
@@ -145,7 +142,6 @@ export const DeleteCollectionConfirmationPane: FunctionComponent<DeleteCollectio
|
|||||||
onChange={(event, newInput?: string) => {
|
onChange={(event, newInput?: string) => {
|
||||||
setDeleteCollectionFeedback(newInput);
|
setDeleteCollectionFeedback(newInput);
|
||||||
}}
|
}}
|
||||||
ariaLabel={reasonInfo}
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -40,7 +40,6 @@ exports[`Delete Collection Confirmation Pane submit() should call delete collect
|
|||||||
</span>
|
</span>
|
||||||
</Text>
|
</Text>
|
||||||
<StyledTextFieldBase
|
<StyledTextFieldBase
|
||||||
ariaLabel="Confirm by typing the container id"
|
|
||||||
autoFocus={true}
|
autoFocus={true}
|
||||||
id="confirmCollectionId"
|
id="confirmCollectionId"
|
||||||
onChange={[Function]}
|
onChange={[Function]}
|
||||||
@@ -54,7 +53,6 @@ exports[`Delete Collection Confirmation Pane submit() should call delete collect
|
|||||||
value=""
|
value=""
|
||||||
>
|
>
|
||||||
<TextFieldBase
|
<TextFieldBase
|
||||||
ariaLabel="Confirm by typing the container id"
|
|
||||||
autoFocus={true}
|
autoFocus={true}
|
||||||
deferredValidationTime={200}
|
deferredValidationTime={200}
|
||||||
id="confirmCollectionId"
|
id="confirmCollectionId"
|
||||||
@@ -348,7 +346,6 @@ exports[`Delete Collection Confirmation Pane submit() should call delete collect
|
|||||||
>
|
>
|
||||||
<input
|
<input
|
||||||
aria-invalid={false}
|
aria-invalid={false}
|
||||||
aria-label="Confirm by typing the container id"
|
|
||||||
autoFocus={true}
|
autoFocus={true}
|
||||||
className="ms-TextField-field field-57"
|
className="ms-TextField-field field-57"
|
||||||
id="confirmCollectionId"
|
id="confirmCollectionId"
|
||||||
|
|||||||
@@ -118,8 +118,7 @@ export const DeleteDatabaseConfirmationPanel: FunctionComponent<DeleteDatabaseCo
|
|||||||
message:
|
message:
|
||||||
"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.",
|
||||||
};
|
};
|
||||||
const confirmDatabase = "Confirm by typing the database id";
|
|
||||||
const reasonInfo = "Help us improve Azure Cosmos DB! What is the reason why you are deleting this database?";
|
|
||||||
return (
|
return (
|
||||||
<RightPaneForm {...props}>
|
<RightPaneForm {...props}>
|
||||||
{!formError && <PanelInfoErrorComponent {...errorProps} />}
|
{!formError && <PanelInfoErrorComponent {...errorProps} />}
|
||||||
@@ -134,7 +133,6 @@ export const DeleteDatabaseConfirmationPanel: FunctionComponent<DeleteDatabaseCo
|
|||||||
onChange={(event, newInput?: string) => {
|
onChange={(event, newInput?: string) => {
|
||||||
setDatabaseInput(newInput);
|
setDatabaseInput(newInput);
|
||||||
}}
|
}}
|
||||||
ariaLabel={confirmDatabase}
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
{isLastNonEmptyDatabase() && (
|
{isLastNonEmptyDatabase() && (
|
||||||
@@ -153,7 +151,6 @@ export const DeleteDatabaseConfirmationPanel: FunctionComponent<DeleteDatabaseCo
|
|||||||
onChange={(event, newInput?: string) => {
|
onChange={(event, newInput?: string) => {
|
||||||
setDatabaseFeedbackInput(newInput);
|
setDatabaseFeedbackInput(newInput);
|
||||||
}}
|
}}
|
||||||
ariaLabel={reasonInfo}
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ export const ExecuteSprocParamsPane: FunctionComponent<ExecuteSprocParamsPanePro
|
|||||||
selectedKey={paramKeyValue && paramKeyValue.key}
|
selectedKey={paramKeyValue && paramKeyValue.key}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
<Stack horizontal onClick={addNewParamAtLastIndex} tabIndex={0}>
|
<Stack horizontal onClick={addNewParamAtLastIndex}>
|
||||||
<Image {...imageProps} src={AddPropertyIcon} alt="Add param" />
|
<Image {...imageProps} src={AddPropertyIcon} alt="Add param" />
|
||||||
<Text className="addNewParamStyle">Add New Param</Text>
|
<Text className="addNewParamStyle">Add New Param</Text>
|
||||||
</Stack>
|
</Stack>
|
||||||
|
|||||||
@@ -59,36 +59,30 @@ export const InputParameter: FunctionComponent<InputParameterProps> = ({
|
|||||||
onChange={onParamKeyChange}
|
onChange={onParamKeyChange}
|
||||||
options={options}
|
options={options}
|
||||||
styles={dropdownStyles}
|
styles={dropdownStyles}
|
||||||
tabIndex={0}
|
|
||||||
/>
|
/>
|
||||||
<TextField
|
<TextField
|
||||||
label={inputLabel && inputLabel}
|
label={inputLabel && inputLabel}
|
||||||
id="confirmCollectionId"
|
id="confirmCollectionId"
|
||||||
|
autoFocus
|
||||||
value={paramValue}
|
value={paramValue}
|
||||||
onChange={onParamValueChange}
|
onChange={onParamValueChange}
|
||||||
/>
|
/>
|
||||||
{isAddRemoveVisible && (
|
{isAddRemoveVisible && (
|
||||||
<>
|
<>
|
||||||
<div tabIndex={0}>
|
<Image
|
||||||
<Image
|
{...imageProps}
|
||||||
{...imageProps}
|
src={EntityCancelIcon}
|
||||||
src={EntityCancelIcon}
|
alt="Delete param"
|
||||||
alt="Delete param"
|
id="deleteparam"
|
||||||
id="deleteparam"
|
onClick={onDeleteParamKeyPress}
|
||||||
role="button"
|
/>
|
||||||
onClick={onDeleteParamKeyPress}
|
<Image
|
||||||
/>
|
{...imageProps}
|
||||||
</div>
|
src={AddPropertyIcon}
|
||||||
<div tabIndex={0}>
|
alt="Add param"
|
||||||
<Image
|
id="addparam"
|
||||||
{...imageProps}
|
onClick={onAddNewParamKeyPress}
|
||||||
src={AddPropertyIcon}
|
/>
|
||||||
alt="Add param"
|
|
||||||
id="addparam"
|
|
||||||
role="button"
|
|
||||||
onClick={onAddNewParamKeyPress}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</Stack>
|
</Stack>
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -23,7 +23,6 @@ exports[`GitHub Repos Panel should render Default properly 1`] = `
|
|||||||
"isTabsContentExpanded": [Function],
|
"isTabsContentExpanded": [Function],
|
||||||
"onRefreshDatabasesKeyPress": [Function],
|
"onRefreshDatabasesKeyPress": [Function],
|
||||||
"onRefreshResourcesClick": [Function],
|
"onRefreshResourcesClick": [Function],
|
||||||
"phoenixClient": PhoenixClient {},
|
|
||||||
"provideFeedbackEmail": [Function],
|
"provideFeedbackEmail": [Function],
|
||||||
"queriesClient": QueriesClient {
|
"queriesClient": QueriesClient {
|
||||||
"container": [Circular],
|
"container": [Circular],
|
||||||
|
|||||||
@@ -3,13 +3,13 @@
|
|||||||
.panelFormWrapper {
|
.panelFormWrapper {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
min-height: 100%;
|
height: 100%;
|
||||||
|
|
||||||
.panelMainContent {
|
.panelMainContent {
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
padding: 0 34px;
|
padding: 0 34px;
|
||||||
margin: 20px 0;
|
margin: 20px 0;
|
||||||
overflow-x: hidden;
|
overflow: auto;
|
||||||
|
|
||||||
& > :not(.collapsibleSection) {
|
& > :not(.collapsibleSection) {
|
||||||
margin-bottom: @DefaultSpace;
|
margin-bottom: @DefaultSpace;
|
||||||
|
|||||||
@@ -33,13 +33,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
|
<Text className="panelWarningErrorMessage" variant="small" aria-label="message">
|
||||||
role="alert"
|
|
||||||
aria-live="assertive"
|
|
||||||
aria-label={message}
|
|
||||||
className="panelWarningErrorMessage"
|
|
||||||
variant="small"
|
|
||||||
>
|
|
||||||
{message}
|
{message}
|
||||||
{link && linkText && (
|
{link && linkText && (
|
||||||
<Link target="_blank" href={link}>
|
<Link target="_blank" href={link}>
|
||||||
|
|||||||
@@ -34,6 +34,6 @@ describe("Right Pane Form", () => {
|
|||||||
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.getByLabelText("error")).toBeDefined();
|
expect(screen.getByLabelText("error")).toBeDefined();
|
||||||
expect(screen.getByRole("alert").innerHTML).toEqual("file already Exist");
|
expect(screen.getByLabelText("message").innerHTML).toEqual("file already Exist");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -195,6 +195,7 @@ export const SettingsPane: FunctionComponent = () => {
|
|||||||
step={1}
|
step={1}
|
||||||
className="textfontclr"
|
className="textfontclr"
|
||||||
role="textbox"
|
role="textbox"
|
||||||
|
tabIndex={0}
|
||||||
id="max-degree"
|
id="max-degree"
|
||||||
value={"" + maxDegreeOfParallelism}
|
value={"" + maxDegreeOfParallelism}
|
||||||
onIncrement={(newValue) => setMaxDegreeOfParallelism(parseInt(newValue) + 1 || maxDegreeOfParallelism)}
|
onIncrement={(newValue) => setMaxDegreeOfParallelism(parseInt(newValue) + 1 || maxDegreeOfParallelism)}
|
||||||
|
|||||||
@@ -123,6 +123,7 @@ exports[`Settings Pane should render Default properly 1`] = `
|
|||||||
onValidate={[Function]}
|
onValidate={[Function]}
|
||||||
role="textbox"
|
role="textbox"
|
||||||
step={1}
|
step={1}
|
||||||
|
tabIndex={0}
|
||||||
value="6"
|
value="6"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ exports[`StringInput Pane should render Create new directory properly 1`] = `
|
|||||||
"isTabsContentExpanded": [Function],
|
"isTabsContentExpanded": [Function],
|
||||||
"onRefreshDatabasesKeyPress": [Function],
|
"onRefreshDatabasesKeyPress": [Function],
|
||||||
"onRefreshResourcesClick": [Function],
|
"onRefreshResourcesClick": [Function],
|
||||||
"phoenixClient": PhoenixClient {},
|
|
||||||
"provideFeedbackEmail": [Function],
|
"provideFeedbackEmail": [Function],
|
||||||
"queriesClient": QueriesClient {
|
"queriesClient": QueriesClient {
|
||||||
"container": [Circular],
|
"container": [Circular],
|
||||||
|
|||||||
@@ -29,7 +29,6 @@ describe("Table query select Panel", () => {
|
|||||||
it("Should checked availableCheckbox by default", () => {
|
it("Should checked availableCheckbox by default", () => {
|
||||||
const wrapper = mount(<TableQuerySelectPanel {...props} />);
|
const wrapper = mount(<TableQuerySelectPanel {...props} />);
|
||||||
expect(wrapper.find("#availableCheckbox").first().props()).toEqual({
|
expect(wrapper.find("#availableCheckbox").first().props()).toEqual({
|
||||||
ariaPositionInSet: 0,
|
|
||||||
id: "availableCheckbox",
|
id: "availableCheckbox",
|
||||||
label: "Available Columns",
|
label: "Available Columns",
|
||||||
checked: true,
|
checked: true,
|
||||||
|
|||||||
@@ -128,9 +128,8 @@ export const TableQuerySelectPanel: FunctionComponent<TableQuerySelectPanelProps
|
|||||||
label="Available Columns"
|
label="Available Columns"
|
||||||
checked={isAvailableColumnChecked}
|
checked={isAvailableColumnChecked}
|
||||||
onChange={availableColumnsCheckboxClick}
|
onChange={availableColumnsCheckboxClick}
|
||||||
ariaPositionInSet={0}
|
|
||||||
/>
|
/>
|
||||||
{columnOptions.map((column, index) => {
|
{columnOptions.map((column) => {
|
||||||
return (
|
return (
|
||||||
<Checkbox
|
<Checkbox
|
||||||
label={column.columnName}
|
label={column.columnName}
|
||||||
@@ -138,7 +137,6 @@ export const TableQuerySelectPanel: FunctionComponent<TableQuerySelectPanelProps
|
|||||||
key={column.columnName}
|
key={column.columnName}
|
||||||
checked={column.selected}
|
checked={column.selected}
|
||||||
disabled={!column.editable}
|
disabled={!column.editable}
|
||||||
ariaPositionInSet={index + 1}
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
|||||||
@@ -37,14 +37,12 @@ exports[`Table query select Panel should render Default properly 1`] = `
|
|||||||
className="column-select-view"
|
className="column-select-view"
|
||||||
>
|
>
|
||||||
<StyledCheckboxBase
|
<StyledCheckboxBase
|
||||||
ariaPositionInSet={0}
|
|
||||||
checked={true}
|
checked={true}
|
||||||
id="availableCheckbox"
|
id="availableCheckbox"
|
||||||
label="Available Columns"
|
label="Available Columns"
|
||||||
onChange={[Function]}
|
onChange={[Function]}
|
||||||
>
|
>
|
||||||
<CheckboxBase
|
<CheckboxBase
|
||||||
ariaPositionInSet={0}
|
|
||||||
checked={true}
|
checked={true}
|
||||||
id="availableCheckbox"
|
id="availableCheckbox"
|
||||||
label="Available Columns"
|
label="Available Columns"
|
||||||
@@ -330,7 +328,6 @@ exports[`Table query select Panel should render Default properly 1`] = `
|
|||||||
<input
|
<input
|
||||||
aria-checked="true"
|
aria-checked="true"
|
||||||
aria-label="Available Columns"
|
aria-label="Available Columns"
|
||||||
aria-posinset={0}
|
|
||||||
checked={true}
|
checked={true}
|
||||||
className="input-55"
|
className="input-55"
|
||||||
data-ktp-execute-target={true}
|
data-ktp-execute-target={true}
|
||||||
@@ -649,7 +646,6 @@ exports[`Table query select Panel should render Default properly 1`] = `
|
|||||||
</CheckboxBase>
|
</CheckboxBase>
|
||||||
</StyledCheckboxBase>
|
</StyledCheckboxBase>
|
||||||
<StyledCheckboxBase
|
<StyledCheckboxBase
|
||||||
ariaPositionInSet={1}
|
|
||||||
checked={true}
|
checked={true}
|
||||||
disabled={false}
|
disabled={false}
|
||||||
key=""
|
key=""
|
||||||
@@ -657,7 +653,6 @@ exports[`Table query select Panel should render Default properly 1`] = `
|
|||||||
onChange={[Function]}
|
onChange={[Function]}
|
||||||
>
|
>
|
||||||
<CheckboxBase
|
<CheckboxBase
|
||||||
ariaPositionInSet={1}
|
|
||||||
checked={true}
|
checked={true}
|
||||||
disabled={false}
|
disabled={false}
|
||||||
label=""
|
label=""
|
||||||
@@ -944,7 +939,6 @@ exports[`Table query select Panel should render Default properly 1`] = `
|
|||||||
aria-checked="true"
|
aria-checked="true"
|
||||||
aria-disabled={false}
|
aria-disabled={false}
|
||||||
aria-label=""
|
aria-label=""
|
||||||
aria-posinset={1}
|
|
||||||
checked={true}
|
checked={true}
|
||||||
className="input-55"
|
className="input-55"
|
||||||
data-ktp-execute-target={true}
|
data-ktp-execute-target={true}
|
||||||
|
|||||||
@@ -327,17 +327,13 @@ exports[`Delete Database Confirmation Pane Should call delete database 1`] = `
|
|||||||
key=".0:$.1"
|
key=".0:$.1"
|
||||||
>
|
>
|
||||||
<Text
|
<Text
|
||||||
aria-label="Warning! The action you are about to take cannot be undone. Continuing will permanently delete this resource and all of its children resources."
|
aria-label="message"
|
||||||
aria-live="assertive"
|
|
||||||
className="panelWarningErrorMessage"
|
className="panelWarningErrorMessage"
|
||||||
role="alert"
|
|
||||||
variant="small"
|
variant="small"
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
aria-label="Warning! The action you are about to take cannot be undone. Continuing will permanently delete this resource and all of its children resources."
|
aria-label="message"
|
||||||
aria-live="assertive"
|
|
||||||
className="panelWarningErrorMessage css-56"
|
className="panelWarningErrorMessage css-56"
|
||||||
role="alert"
|
|
||||||
>
|
>
|
||||||
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>
|
||||||
@@ -367,7 +363,6 @@ exports[`Delete Database Confirmation Pane Should call delete database 1`] = `
|
|||||||
</span>
|
</span>
|
||||||
</Text>
|
</Text>
|
||||||
<StyledTextFieldBase
|
<StyledTextFieldBase
|
||||||
ariaLabel="Confirm by typing the database id"
|
|
||||||
autoFocus={true}
|
autoFocus={true}
|
||||||
id="confirmDatabaseId"
|
id="confirmDatabaseId"
|
||||||
onChange={[Function]}
|
onChange={[Function]}
|
||||||
@@ -380,7 +375,6 @@ exports[`Delete Database Confirmation Pane Should call delete database 1`] = `
|
|||||||
}
|
}
|
||||||
>
|
>
|
||||||
<TextFieldBase
|
<TextFieldBase
|
||||||
ariaLabel="Confirm by typing the database id"
|
|
||||||
autoFocus={true}
|
autoFocus={true}
|
||||||
deferredValidationTime={200}
|
deferredValidationTime={200}
|
||||||
id="confirmDatabaseId"
|
id="confirmDatabaseId"
|
||||||
@@ -673,7 +667,6 @@ exports[`Delete Database Confirmation Pane Should call delete database 1`] = `
|
|||||||
>
|
>
|
||||||
<input
|
<input
|
||||||
aria-invalid={false}
|
aria-invalid={false}
|
||||||
aria-label="Confirm by typing the database id"
|
|
||||||
autoFocus={true}
|
autoFocus={true}
|
||||||
className="ms-TextField-field field-60"
|
className="ms-TextField-field field-60"
|
||||||
id="confirmDatabaseId"
|
id="confirmDatabaseId"
|
||||||
@@ -714,7 +707,6 @@ exports[`Delete Database Confirmation Pane Should call delete database 1`] = `
|
|||||||
</span>
|
</span>
|
||||||
</Text>
|
</Text>
|
||||||
<StyledTextFieldBase
|
<StyledTextFieldBase
|
||||||
ariaLabel="Help us improve Azure Cosmos DB! What is the reason why you are deleting this database?"
|
|
||||||
id="deleteDatabaseFeedbackInput"
|
id="deleteDatabaseFeedbackInput"
|
||||||
multiline={true}
|
multiline={true}
|
||||||
onChange={[Function]}
|
onChange={[Function]}
|
||||||
@@ -728,7 +720,6 @@ exports[`Delete Database Confirmation Pane Should call delete database 1`] = `
|
|||||||
}
|
}
|
||||||
>
|
>
|
||||||
<TextFieldBase
|
<TextFieldBase
|
||||||
ariaLabel="Help us improve Azure Cosmos DB! What is the reason why you are deleting this database?"
|
|
||||||
deferredValidationTime={200}
|
deferredValidationTime={200}
|
||||||
id="deleteDatabaseFeedbackInput"
|
id="deleteDatabaseFeedbackInput"
|
||||||
multiline={true}
|
multiline={true}
|
||||||
@@ -1022,7 +1013,6 @@ exports[`Delete Database Confirmation Pane Should call delete database 1`] = `
|
|||||||
>
|
>
|
||||||
<textarea
|
<textarea
|
||||||
aria-invalid={false}
|
aria-invalid={false}
|
||||||
aria-label="Help us improve Azure Cosmos DB! What is the reason why you are deleting this database?"
|
|
||||||
className="ms-TextField-field field-71"
|
className="ms-TextField-field field-71"
|
||||||
id="deleteDatabaseFeedbackInput"
|
id="deleteDatabaseFeedbackInput"
|
||||||
onBlur={[Function]}
|
onBlur={[Function]}
|
||||||
|
|||||||
@@ -307,23 +307,16 @@ export class SplashScreen extends React.Component<SplashScreenProps> {
|
|||||||
iconSrc: AddDatabaseIcon,
|
iconSrc: AddDatabaseIcon,
|
||||||
title: "New " + getDatabaseName(),
|
title: "New " + getDatabaseName(),
|
||||||
description: undefined,
|
description: undefined,
|
||||||
onClick: () => this.openAddDatabasePanel(),
|
onClick: () =>
|
||||||
|
useSidePanel
|
||||||
|
.getState()
|
||||||
|
.openSidePanel("New " + getDatabaseName(), <AddDatabasePanel explorer={this.container} />),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
|
|
||||||
private openAddDatabasePanel() {
|
|
||||||
const newDatabaseButton = document.activeElement as HTMLElement;
|
|
||||||
useSidePanel
|
|
||||||
.getState()
|
|
||||||
.openSidePanel(
|
|
||||||
"New " + getDatabaseName(),
|
|
||||||
<AddDatabasePanel explorer={this.container} buttonElement={newDatabaseButton} />
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
private decorateOpenCollectionActivity({ databaseId, collectionId }: MostRecentActivity.OpenCollectionItem) {
|
private decorateOpenCollectionActivity({ databaseId, collectionId }: MostRecentActivity.OpenCollectionItem) {
|
||||||
return {
|
return {
|
||||||
iconSrc: NotebookIcon,
|
iconSrc: NotebookIcon,
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { DetailsList, DetailsListLayoutMode, IColumn, Pivot, PivotItem, SelectionMode, Text } from "@fluentui/react";
|
import { DetailsList, DetailsListLayoutMode, IColumn, Pivot, PivotItem, SelectionMode } from "@fluentui/react";
|
||||||
import React, { Fragment } from "react";
|
import React, { Fragment } from "react";
|
||||||
import SplitterLayout from "react-splitter-layout";
|
import SplitterLayout from "react-splitter-layout";
|
||||||
import "react-splitter-layout/lib/index.css";
|
import "react-splitter-layout/lib/index.css";
|
||||||
@@ -120,13 +120,21 @@ export default class QueryTabComponent extends React.Component<IQueryTabComponen
|
|||||||
constructor(props: IQueryTabComponentProps) {
|
constructor(props: IQueryTabComponentProps) {
|
||||||
super(props);
|
super(props);
|
||||||
const columns: IColumn[] = [
|
const columns: IColumn[] = [
|
||||||
|
{
|
||||||
|
key: "column1",
|
||||||
|
name: "",
|
||||||
|
minWidth: 16,
|
||||||
|
maxWidth: 16,
|
||||||
|
data: String,
|
||||||
|
fieldName: "toolTip",
|
||||||
|
onRender: this.onRenderColumnItem,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
key: "column2",
|
key: "column2",
|
||||||
name: "METRIC",
|
name: "METRIC",
|
||||||
minWidth: 200,
|
minWidth: 200,
|
||||||
data: String,
|
data: String,
|
||||||
fieldName: "metric",
|
fieldName: "metric",
|
||||||
onRender: this.onRenderColumnItem,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: "column3",
|
key: "column3",
|
||||||
@@ -198,12 +206,7 @@ export default class QueryTabComponent extends React.Component<IQueryTabComponen
|
|||||||
|
|
||||||
public onRenderColumnItem(item: IDocument): JSX.Element {
|
public onRenderColumnItem(item: IDocument): JSX.Element {
|
||||||
if (item.toolTip !== "") {
|
if (item.toolTip !== "") {
|
||||||
return (
|
return <InfoTooltip>{`${item.toolTip}`}</InfoTooltip>;
|
||||||
<>
|
|
||||||
<InfoTooltip>{`${item.toolTip}`}</InfoTooltip>
|
|
||||||
<Text style={{ paddingLeft: 10, margin: 0 }}>{`${item.metric}`}</Text>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
@@ -999,7 +1002,7 @@ export default class QueryTabComponent extends React.Component<IQueryTabComponen
|
|||||||
"data-order": 2,
|
"data-order": 2,
|
||||||
"data-title": "Query Stats",
|
"data-title": "Query Stats",
|
||||||
}}
|
}}
|
||||||
style={{ height: "100%", overflowY: "scroll" }}
|
style={{ height: "100%" }}
|
||||||
>
|
>
|
||||||
{this.state.allResultsMetadata.length > 0 && !this.state.error && (
|
{this.state.allResultsMetadata.length > 0 && !this.state.error && (
|
||||||
<div className="queryMetricsSummaryContainer">
|
<div className="queryMetricsSummaryContainer">
|
||||||
|
|||||||
@@ -47,9 +47,7 @@
|
|||||||
<img class="and-or-svg" src="/And-Or.svg" alt="Group selected clauses" />
|
<img class="and-or-svg" src="/And-Or.svg" alt="Group selected clauses" />
|
||||||
</button>
|
</button>
|
||||||
</th>
|
</th>
|
||||||
<th class="clause-table-cell header-background">
|
<th class="clause-table-cell header-background"><!-- Grouping indicator --></th>
|
||||||
<!-- Grouping indicator -->
|
|
||||||
</th>
|
|
||||||
<th class="clause-table-cell header-background and-or-header">
|
<th class="clause-table-cell header-background and-or-header">
|
||||||
<span data-bind="text: andLabel"></span>
|
<span data-bind="text: andLabel"></span>
|
||||||
</th>
|
</th>
|
||||||
@@ -138,7 +136,7 @@
|
|||||||
class="select-options-link"
|
class="select-options-link"
|
||||||
data-bind="click: selectQueryOptions, event: { keydown: onselectQueryOptionsKeyDown }"
|
data-bind="click: selectQueryOptions, event: { keydown: onselectQueryOptionsKeyDown }"
|
||||||
tabindex="0"
|
tabindex="0"
|
||||||
role="button"
|
role="link"
|
||||||
>
|
>
|
||||||
<span>Choose Columns... </span>
|
<span>Choose Columns... </span>
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import ko from "knockout";
|
import ko from "knockout";
|
||||||
import React, { MutableRefObject, useEffect, useRef, useState } from "react";
|
import React, { useEffect, useRef, useState } from "react";
|
||||||
import loadingIcon from "../../../images/circular_loader_black_16x16.gif";
|
import loadingIcon from "../../../images/circular_loader_black_16x16.gif";
|
||||||
import errorIcon from "../../../images/close-black.svg";
|
import errorIcon from "../../../images/close-black.svg";
|
||||||
import { useObservable } from "../../hooks/useObservable";
|
import { useObservable } from "../../hooks/useObservable";
|
||||||
@@ -32,13 +32,7 @@ export const Tabs = (): JSX.Element => {
|
|||||||
|
|
||||||
function TabNav({ tab, active }: { tab: Tab; active: boolean }) {
|
function TabNav({ tab, active }: { tab: Tab; active: boolean }) {
|
||||||
const [hovering, setHovering] = useState(false);
|
const [hovering, setHovering] = useState(false);
|
||||||
const focusTab = useRef<HTMLLIElement>() as MutableRefObject<HTMLLIElement>;
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (active && focusTab.current) {
|
|
||||||
focusTab.current.focus();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return (
|
return (
|
||||||
<li
|
<li
|
||||||
onMouseOver={() => setHovering(true)}
|
onMouseOver={() => setHovering(true)}
|
||||||
@@ -52,7 +46,6 @@ function TabNav({ tab, active }: { tab: Tab; active: boolean }) {
|
|||||||
aria-controls={tab.tabId}
|
aria-controls={tab.tabId}
|
||||||
tabIndex={0}
|
tabIndex={0}
|
||||||
role="tab"
|
role="tab"
|
||||||
ref={focusTab}
|
|
||||||
>
|
>
|
||||||
<span className="tabNavContentContainer">
|
<span className="tabNavContentContainer">
|
||||||
<a data-toggle="tab" href={"#" + tab.tabId} tabIndex={-1}>
|
<a data-toggle="tab" href={"#" + tab.tabId} tabIndex={-1}>
|
||||||
|
|||||||
@@ -291,7 +291,7 @@ export default class UserDefinedFunctionTabContent extends Component<
|
|||||||
language={"javascript"}
|
language={"javascript"}
|
||||||
content={udfBody}
|
content={udfBody}
|
||||||
isReadOnly={false}
|
isReadOnly={false}
|
||||||
ariaLabel={"User defined function body"}
|
ariaLabel={"Graph JSON"}
|
||||||
onContentChanged={this.handleUdfBodyChange}
|
onContentChanged={this.handleUdfBodyChange}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import NotebookIcon from "../../../images/notebook/Notebook-resource.svg";
|
|||||||
import PublishIcon from "../../../images/notebook/publish_content.svg";
|
import PublishIcon from "../../../images/notebook/publish_content.svg";
|
||||||
import RefreshIcon from "../../../images/refresh-cosmos.svg";
|
import RefreshIcon from "../../../images/refresh-cosmos.svg";
|
||||||
import CollectionIcon from "../../../images/tree-collection.svg";
|
import CollectionIcon from "../../../images/tree-collection.svg";
|
||||||
import { Areas, ConnectionStatusType, Notebook } from "../../Common/Constants";
|
import { Areas, Notebook } from "../../Common/Constants";
|
||||||
import { isPublicInternetAccessAllowed } from "../../Common/DatabaseAccountUtility";
|
import { isPublicInternetAccessAllowed } from "../../Common/DatabaseAccountUtility";
|
||||||
import * as DataModels from "../../Contracts/DataModels";
|
import * as DataModels from "../../Contracts/DataModels";
|
||||||
import * as ViewModels from "../../Contracts/ViewModels";
|
import * as ViewModels from "../../Contracts/ViewModels";
|
||||||
@@ -128,20 +128,17 @@ export const ResourceTree: React.FC<ResourceTreeProps> = ({ container }: Resourc
|
|||||||
notebooksTree.children.push(buildGalleryNotebooksTree());
|
notebooksTree.children.push(buildGalleryNotebooksTree());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (myNotebooksContentRoot) {
|
||||||
myNotebooksContentRoot &&
|
|
||||||
((NotebookUtil.isPhoenixEnabled() &&
|
|
||||||
useNotebook.getState().connectionInfo.status === ConnectionStatusType.Connected) ||
|
|
||||||
userContext.features.phoenix === false)
|
|
||||||
) {
|
|
||||||
notebooksTree.children.push(buildMyNotebooksTree());
|
notebooksTree.children.push(buildMyNotebooksTree());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (container.notebookManager?.gitHubOAuthService.isLoggedIn()) {
|
if (container.notebookManager?.gitHubOAuthService.isLoggedIn()) {
|
||||||
// collapse all other notebook nodes
|
// collapse all other notebook nodes
|
||||||
notebooksTree.children.forEach((node) => (node.isExpanded = false));
|
notebooksTree.children.forEach((node) => (node.isExpanded = false));
|
||||||
notebooksTree.children.push(buildGitHubNotebooksTree(true));
|
notebooksTree.children.push(buildGitHubNotebooksTree());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return notebooksTree;
|
return notebooksTree;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -167,11 +164,7 @@ export const ResourceTree: React.FC<ResourceTreeProps> = ({ container }: Resourc
|
|||||||
myNotebooksContentRoot,
|
myNotebooksContentRoot,
|
||||||
(item: NotebookContentItem) => {
|
(item: NotebookContentItem) => {
|
||||||
container.openNotebook(item).then((hasOpened) => {
|
container.openNotebook(item).then((hasOpened) => {
|
||||||
if (
|
if (hasOpened) {
|
||||||
hasOpened &&
|
|
||||||
userContext.features.notebooksTemporarilyDown === false &&
|
|
||||||
userContext.features.phoenix === false
|
|
||||||
) {
|
|
||||||
mostRecentActivity.notebookWasItemOpened(userContext.databaseAccount?.id, item);
|
mostRecentActivity.notebookWasItemOpened(userContext.databaseAccount?.id, item);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -185,23 +178,20 @@ export const ResourceTree: React.FC<ResourceTreeProps> = ({ container }: Resourc
|
|||||||
return myNotebooksTree;
|
return myNotebooksTree;
|
||||||
};
|
};
|
||||||
|
|
||||||
const buildGitHubNotebooksTree = (isConnected: boolean): TreeNode => {
|
const buildGitHubNotebooksTree = (): TreeNode => {
|
||||||
const gitHubNotebooksTree: TreeNode = buildNotebookDirectoryNode(
|
const gitHubNotebooksTree: TreeNode = buildNotebookDirectoryNode(
|
||||||
gitHubNotebooksContentRoot,
|
gitHubNotebooksContentRoot,
|
||||||
(item: NotebookContentItem) => {
|
(item: NotebookContentItem) => {
|
||||||
container.openNotebook(item).then((hasOpened) => {
|
container.openNotebook(item).then((hasOpened) => {
|
||||||
if (
|
if (hasOpened) {
|
||||||
hasOpened &&
|
|
||||||
userContext.features.notebooksTemporarilyDown === false &&
|
|
||||||
userContext.features.phoenix === false
|
|
||||||
) {
|
|
||||||
mostRecentActivity.notebookWasItemOpened(userContext.databaseAccount?.id, item);
|
mostRecentActivity.notebookWasItemOpened(userContext.databaseAccount?.id, item);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
const manageGitContextMenu: TreeNodeMenuItem[] = [
|
|
||||||
|
gitHubNotebooksTree.contextMenu = [
|
||||||
{
|
{
|
||||||
label: "Manage GitHub settings",
|
label: "Manage GitHub settings",
|
||||||
onClick: () =>
|
onClick: () =>
|
||||||
@@ -226,7 +216,7 @@ export const ResourceTree: React.FC<ResourceTreeProps> = ({ container }: Resourc
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
gitHubNotebooksTree.contextMenu = manageGitContextMenu;
|
|
||||||
gitHubNotebooksTree.isExpanded = true;
|
gitHubNotebooksTree.isExpanded = true;
|
||||||
gitHubNotebooksTree.isAlphaSorted = true;
|
gitHubNotebooksTree.isAlphaSorted = true;
|
||||||
|
|
||||||
|
|||||||
@@ -130,8 +130,9 @@ export class ResourceTreeAdapter implements ReactAdapter {
|
|||||||
path: "Gallery",
|
path: "Gallery",
|
||||||
type: NotebookContentItemType.File,
|
type: NotebookContentItemType.File,
|
||||||
};
|
};
|
||||||
|
|
||||||
this.myNotebooksContentRoot = {
|
this.myNotebooksContentRoot = {
|
||||||
name: useNotebook.getState().notebookFolderName,
|
name: ResourceTreeAdapter.MyNotebooksTitle,
|
||||||
path: useNotebook.getState().notebookBasePath,
|
path: useNotebook.getState().notebookBasePath,
|
||||||
type: NotebookContentItemType.Directory,
|
type: NotebookContentItemType.Directory,
|
||||||
};
|
};
|
||||||
@@ -145,11 +146,16 @@ export class ResourceTreeAdapter implements ReactAdapter {
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
this.gitHubNotebooksContentRoot = {
|
|
||||||
name: ResourceTreeAdapter.GitHubReposTitle,
|
if (this.container.notebookManager?.gitHubOAuthService.isLoggedIn()) {
|
||||||
path: ResourceTreeAdapter.PseudoDirPath,
|
this.gitHubNotebooksContentRoot = {
|
||||||
type: NotebookContentItemType.Directory,
|
name: ResourceTreeAdapter.GitHubReposTitle,
|
||||||
};
|
path: ResourceTreeAdapter.PseudoDirPath,
|
||||||
|
type: NotebookContentItemType.Directory,
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
this.gitHubNotebooksContentRoot = undefined;
|
||||||
|
}
|
||||||
|
|
||||||
return Promise.all(refreshTasks);
|
return Promise.all(refreshTasks);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,57 +0,0 @@
|
|||||||
{
|
|
||||||
"GraphAPIDescription": "Provision a Graph API Compute for your Azure Cosmos DB account.",
|
|
||||||
"GraphAPICompute": "Graph GraphAPI Compute",
|
|
||||||
"Provisioned": "Provisioned",
|
|
||||||
"Deprovisioned": "Deprovisioned",
|
|
||||||
"Compute": "Compute",
|
|
||||||
"GremlinV2": "GremlinV2",
|
|
||||||
"LearnAboutCompute": "Learn more about GraphAPI Compute.",
|
|
||||||
"DeprovisioningDetailsText": "Learn more about deprovisioning the GraphAPI Compute.",
|
|
||||||
"ComputePricing": "Learn more about GraphAPI Compute pricing.",
|
|
||||||
"SKUs": "SKUs",
|
|
||||||
"SKUsPlaceHolder": "Select SKUs",
|
|
||||||
"NumberOfInstances": "Number of instances",
|
|
||||||
"CosmosD4s": "Cosmos.D4s (General Purpose Cosmos Compute with 4 vCPUs, 16 GB Memory)",
|
|
||||||
"CosmosD8s": "Cosmos.D8s (General Purpose Cosmos Compute with 8 vCPUs, 32 GB Memory)",
|
|
||||||
"CosmosD16s": "Cosmos.D16s (General Purpose Cosmos Compute with 16 vCPUs, 64 GB Memory)",
|
|
||||||
"CosmosD32s": "Cosmos.D32s (General Purpose Cosmos Compute with 32 vCPUs, 128 GB Memory)",
|
|
||||||
"CreateMessage": "Graph GraphAPI Compute resource is being created.",
|
|
||||||
"CreateInitializeTitle": "Provisioning resource",
|
|
||||||
"CreateInitializeMessage": "GraphAPI Compute resource will be provisioned.",
|
|
||||||
"CreateSuccessTitle": "Resource provisioned",
|
|
||||||
"CreateSuccesseMessage": "GraphAPI Compute resource provisioned.",
|
|
||||||
"CreateFailureTitle": "Failed to provision resource",
|
|
||||||
"CreateFailureMessage": "GraphAPI Compute resource provisioning failed.",
|
|
||||||
"UpdateMessage": "GraphAPI Compute resource is being updated.",
|
|
||||||
"UpdateInitializeTitle": "Updating resource",
|
|
||||||
"UpdateInitializeMessage": "GraphAPI Compute resource will be updated.",
|
|
||||||
"UpdateSuccessTitle": "Resource updated",
|
|
||||||
"UpdateSuccesseMessage": "GraphAPI Compute resource updated.",
|
|
||||||
"UpdateFailureTitle": "Failed to update resource",
|
|
||||||
"UpdateFailureMessage": "GraphAPI Compute resource updation failed.",
|
|
||||||
"DeleteMessage": "GraphAPI Compute resource is being deleted.",
|
|
||||||
"DeleteInitializeTitle": "Deleting resource",
|
|
||||||
"DeleteInitializeMessage": "GraphAPI Compute resource will be deleted.",
|
|
||||||
"DeleteSuccessTitle": "Resource deleted",
|
|
||||||
"DeleteSuccesseMessage": "GraphAPI Compute resource deleted.",
|
|
||||||
"DeleteFailureTitle": "Failed to delete resource",
|
|
||||||
"DeleteFailureMessage": "GraphAPI Compute resource deletion failed.",
|
|
||||||
"CannotSave": "Cannot save the changes to the GraphAPI Compute resource at the moment.",
|
|
||||||
"GraphAccountEndpoint": "Graph Account Endpoint",
|
|
||||||
"CosmosD4Details": "General Purpose Cosmos Compute with 4 vCPUs, 16 GB Memory",
|
|
||||||
"CosmosD8Details": "General Purpose Cosmos Compute with 8 vCPUs, 32 GB Memory",
|
|
||||||
"CosmosD16Details": "General Purpose Cosmos Compute with 16 vCPUs, 64 GB Memory",
|
|
||||||
"ApproximateCost": "Approximate Cost Per Hour",
|
|
||||||
"CostText": "Hourly cost of the GraphAPI Compute resource depends on the SKU selection, number of instances per region, and number of regions.",
|
|
||||||
"ConnectionString": "Connection String",
|
|
||||||
"ConnectionStringText": "To use the GraphAPI Compute, use the connection string shown in ",
|
|
||||||
"KeysBlade": "the keys blade.",
|
|
||||||
"MetricsString": "Metrics",
|
|
||||||
"MetricsText": "Monitor the CPU and memory usage for the GraphAPI Compute instances in ",
|
|
||||||
"MetricsBlade": "the metrics blade.",
|
|
||||||
"MonitorUsage": "Monitor Usage",
|
|
||||||
"ResizingDecisionText": "Number of instances has to be 1 during provisioning. Instances can only be incremented by 1 at once. ",
|
|
||||||
"ResizingDecisionLink": "Learn more about GraphAPI Compute sizing.",
|
|
||||||
"WarningBannerOnUpdate": "Adding or modifying GraphAPI Compute instances may affect your bill.",
|
|
||||||
"WarningBannerOnDelete": "After deprovisioning the GraphAPI Compute, you will not be able to connect to the Graph API account."
|
|
||||||
}
|
|
||||||
@@ -37,7 +37,6 @@ import "./Explorer/Controls/TreeComponent/treeComponent.less";
|
|||||||
import "./Explorer/Graph/GraphExplorerComponent/graphExplorer.less";
|
import "./Explorer/Graph/GraphExplorerComponent/graphExplorer.less";
|
||||||
import "./Explorer/Menus/CommandBar/CommandBarComponent.less";
|
import "./Explorer/Menus/CommandBar/CommandBarComponent.less";
|
||||||
import { CommandBar } from "./Explorer/Menus/CommandBar/CommandBarComponentAdapter";
|
import { CommandBar } from "./Explorer/Menus/CommandBar/CommandBarComponentAdapter";
|
||||||
import "./Explorer/Menus/CommandBar/ConnectionStatusComponent.less";
|
|
||||||
import "./Explorer/Menus/CommandBar/MemoryTrackerComponent.less";
|
import "./Explorer/Menus/CommandBar/MemoryTrackerComponent.less";
|
||||||
import "./Explorer/Menus/NotificationConsole/NotificationConsole.less";
|
import "./Explorer/Menus/NotificationConsole/NotificationConsole.less";
|
||||||
import { NotificationConsole } from "./Explorer/Menus/NotificationConsole/NotificationConsoleComponent";
|
import { NotificationConsole } from "./Explorer/Menus/NotificationConsole/NotificationConsoleComponent";
|
||||||
|
|||||||
@@ -1,67 +0,0 @@
|
|||||||
import { HttpHeaders, HttpStatusCodes } from "../Common/Constants";
|
|
||||||
import { configContext } from "../ConfigContext";
|
|
||||||
import { userContext } from "../UserContext";
|
|
||||||
import { getAuthorizationHeader } from "../Utils/AuthorizationUtils";
|
|
||||||
|
|
||||||
export interface IPhoenixResponse<T> {
|
|
||||||
status: number;
|
|
||||||
data: T;
|
|
||||||
}
|
|
||||||
export interface IPhoenixConnectionInfoResult {
|
|
||||||
readonly notebookAuthToken?: string;
|
|
||||||
readonly notebookServerUrl?: string;
|
|
||||||
}
|
|
||||||
export interface IProvosionData {
|
|
||||||
cosmosEndpoint: string;
|
|
||||||
dbAccountName: string;
|
|
||||||
aadToken: string;
|
|
||||||
resourceGroup: string;
|
|
||||||
subscriptionId: string;
|
|
||||||
}
|
|
||||||
export class PhoenixClient {
|
|
||||||
public async containerConnectionInfo(
|
|
||||||
provisionData: IProvosionData
|
|
||||||
): Promise<IPhoenixResponse<IPhoenixConnectionInfoResult>> {
|
|
||||||
try {
|
|
||||||
const response = await window.fetch(`${this.getPhoenixContainerPoolingEndPoint()}/allocate`, {
|
|
||||||
method: "POST",
|
|
||||||
headers: PhoenixClient.getHeaders(),
|
|
||||||
body: JSON.stringify(provisionData),
|
|
||||||
});
|
|
||||||
let data: IPhoenixConnectionInfoResult;
|
|
||||||
if (response.status === HttpStatusCodes.OK) {
|
|
||||||
data = await response.json();
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
status: response.status,
|
|
||||||
data,
|
|
||||||
};
|
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
throw error;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static getPhoenixEndpoint(): string {
|
|
||||||
const phoenixEndpoint =
|
|
||||||
userContext.features.phoenixEndpoint ?? userContext.features.junoEndpoint ?? configContext.JUNO_ENDPOINT;
|
|
||||||
if (configContext.allowedJunoOrigins.indexOf(new URL(phoenixEndpoint).origin) === -1) {
|
|
||||||
const error = `${phoenixEndpoint} not allowed as juno endpoint`;
|
|
||||||
console.error(error);
|
|
||||||
throw new Error(error);
|
|
||||||
}
|
|
||||||
|
|
||||||
return phoenixEndpoint;
|
|
||||||
}
|
|
||||||
|
|
||||||
public getPhoenixContainerPoolingEndPoint(): string {
|
|
||||||
return `${PhoenixClient.getPhoenixEndpoint()}/api/controlplane/toolscontainer`;
|
|
||||||
}
|
|
||||||
private static getHeaders(): HeadersInit {
|
|
||||||
const authorizationHeader = getAuthorizationHeader();
|
|
||||||
return {
|
|
||||||
[authorizationHeader.header]: authorizationHeader.token,
|
|
||||||
[HttpHeaders.contentType]: "application/json",
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import { extractFeatures, hasFlag } from "./extractFeatures";
|
import { extractFeatures } from "./extractFeatures";
|
||||||
|
|
||||||
describe("extractFeatures", () => {
|
describe("extractFeatures", () => {
|
||||||
it("correctly detects feature flags in a case insensitive manner", () => {
|
it("correctly detects feature flags in a case insensitive manner", () => {
|
||||||
@@ -14,25 +14,9 @@ describe("extractFeatures", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const features = extractFeatures(params);
|
const features = extractFeatures(params);
|
||||||
|
|
||||||
expect(features.notebookServerUrl).toBe(url);
|
expect(features.notebookServerUrl).toBe(url);
|
||||||
expect(features.notebookServerToken).toBe(token);
|
expect(features.notebookServerToken).toBe(token);
|
||||||
expect(features.enableNotebooks).toBe(notebooksEnabled);
|
expect(features.enableNotebooks).toBe(notebooksEnabled);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("hasFlag", () => {
|
|
||||||
it("correctly determines if value has flag", () => {
|
|
||||||
const desiredFlag = "readDocument";
|
|
||||||
|
|
||||||
const singleFlagValue = "readDocument";
|
|
||||||
const multipleFlagValues = "readDocument|createDocument";
|
|
||||||
const differentFlagValue = "createDocument";
|
|
||||||
|
|
||||||
expect(hasFlag(singleFlagValue, desiredFlag)).toBe(true);
|
|
||||||
expect(hasFlag(multipleFlagValues, desiredFlag)).toBe(true);
|
|
||||||
expect(hasFlag(differentFlagValue, desiredFlag)).toBe(false);
|
|
||||||
expect(hasFlag(multipleFlagValues, (undefined as unknown) as string)).toBe(false);
|
|
||||||
expect(hasFlag((undefined as unknown) as string, desiredFlag)).toBe(false);
|
|
||||||
expect(hasFlag((undefined as unknown) as string, (undefined as unknown) as string)).toBe(false);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ export type Features = {
|
|||||||
autoscaleDefault: boolean;
|
autoscaleDefault: boolean;
|
||||||
partitionKeyDefault: boolean;
|
partitionKeyDefault: boolean;
|
||||||
partitionKeyDefault2: boolean;
|
partitionKeyDefault2: boolean;
|
||||||
phoenix: boolean;
|
|
||||||
readonly enableSDKoperations: boolean;
|
readonly enableSDKoperations: boolean;
|
||||||
readonly enableSpark: boolean;
|
readonly enableSpark: boolean;
|
||||||
readonly enableTtl: boolean;
|
readonly enableTtl: boolean;
|
||||||
@@ -20,7 +19,6 @@ export type Features = {
|
|||||||
readonly enableKoResourceTree: boolean;
|
readonly enableKoResourceTree: boolean;
|
||||||
readonly hostedDataExplorer: boolean;
|
readonly hostedDataExplorer: boolean;
|
||||||
readonly junoEndpoint?: string;
|
readonly junoEndpoint?: string;
|
||||||
readonly phoenixEndpoint?: string;
|
|
||||||
readonly livyEndpoint?: string;
|
readonly livyEndpoint?: string;
|
||||||
readonly notebookBasePath?: string;
|
readonly notebookBasePath?: string;
|
||||||
readonly notebookServerToken?: string;
|
readonly notebookServerToken?: string;
|
||||||
@@ -30,8 +28,6 @@ export type Features = {
|
|||||||
readonly pr?: string;
|
readonly pr?: string;
|
||||||
readonly showMinRUSurvey: boolean;
|
readonly showMinRUSurvey: boolean;
|
||||||
readonly ttl90Days: boolean;
|
readonly ttl90Days: boolean;
|
||||||
readonly mongoProxyEndpoint?: string;
|
|
||||||
readonly mongoProxyAPIs?: string;
|
|
||||||
readonly notebooksTemporarilyDown: boolean;
|
readonly notebooksTemporarilyDown: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -66,10 +62,7 @@ export function extractFeatures(given = new URLSearchParams(window.location.sear
|
|||||||
enableKoResourceTree: "true" === get("enablekoresourcetree"),
|
enableKoResourceTree: "true" === get("enablekoresourcetree"),
|
||||||
executeSproc: "true" === get("dataexplorerexecutesproc"),
|
executeSproc: "true" === get("dataexplorerexecutesproc"),
|
||||||
hostedDataExplorer: "true" === get("hosteddataexplorerenabled"),
|
hostedDataExplorer: "true" === get("hosteddataexplorerenabled"),
|
||||||
mongoProxyEndpoint: get("mongoproxyendpoint"),
|
|
||||||
mongoProxyAPIs: get("mongoproxyapis"),
|
|
||||||
junoEndpoint: get("junoendpoint"),
|
junoEndpoint: get("junoendpoint"),
|
||||||
phoenixEndpoint: get("phoenixendpoint"),
|
|
||||||
livyEndpoint: get("livyendpoint"),
|
livyEndpoint: get("livyendpoint"),
|
||||||
notebookBasePath: get("notebookbasepath"),
|
notebookBasePath: get("notebookbasepath"),
|
||||||
notebookServerToken: get("notebookservertoken"),
|
notebookServerToken: get("notebookservertoken"),
|
||||||
@@ -83,15 +76,5 @@ export function extractFeatures(given = new URLSearchParams(window.location.sear
|
|||||||
partitionKeyDefault: "true" === get("partitionkeytest"),
|
partitionKeyDefault: "true" === get("partitionkeytest"),
|
||||||
partitionKeyDefault2: "true" === get("pkpartitionkeytest"),
|
partitionKeyDefault2: "true" === get("pkpartitionkeytest"),
|
||||||
notebooksTemporarilyDown: "true" === get("notebookstemporarilydown", "true"),
|
notebooksTemporarilyDown: "true" === get("notebookstemporarilydown", "true"),
|
||||||
phoenix: "true" === get("phoenix"),
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function hasFlag(flags: string | undefined, desiredFlag: string | undefined): boolean {
|
|
||||||
if (!flags || !desiredFlag) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
const features = flags.split("|");
|
|
||||||
return features.find((feature) => feature === desiredFlag) ? true : false;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,200 +0,0 @@
|
|||||||
import { configContext } from "../../ConfigContext";
|
|
||||||
import { userContext } from "../../UserContext";
|
|
||||||
import { armRequestWithoutPolling } from "../../Utils/arm/request";
|
|
||||||
import { selfServeTraceFailure, selfServeTraceStart, selfServeTraceSuccess } from "../SelfServeTelemetryProcessor";
|
|
||||||
import { RefreshResult } from "../SelfServeTypes";
|
|
||||||
import GraphAPICompute from "./GraphAPICompute";
|
|
||||||
import {
|
|
||||||
FetchPricesResponse,
|
|
||||||
RegionsResponse,
|
|
||||||
GraphAPIComputeServiceResource,
|
|
||||||
UpdateComputeRequestParameters,
|
|
||||||
} from "./GraphAPICompute.types";
|
|
||||||
|
|
||||||
const apiVersion = "2021-04-01-preview";
|
|
||||||
const gremlinV2 = "GremlinV2";
|
|
||||||
|
|
||||||
export enum ResourceStatus {
|
|
||||||
Running = "Running",
|
|
||||||
Creating = "Creating",
|
|
||||||
Updating = "Updating",
|
|
||||||
Deleting = "Deleting",
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ComputeResponse {
|
|
||||||
sku: string;
|
|
||||||
instances: number;
|
|
||||||
status: string;
|
|
||||||
endpoint: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const getPath = (subscriptionId: string, resourceGroup: string, name: string): string => {
|
|
||||||
return `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroup}/providers/Microsoft.DocumentDB/databaseAccounts/${name}/services/${gremlinV2}`;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const updateComputeResource = async (sku: string, instances: number): Promise<string> => {
|
|
||||||
const path = getPath(userContext.subscriptionId, userContext.resourceGroup, userContext.databaseAccount.name);
|
|
||||||
const body: UpdateComputeRequestParameters = {
|
|
||||||
properties: {
|
|
||||||
instanceSize: sku,
|
|
||||||
instanceCount: instances,
|
|
||||||
serviceType: gremlinV2,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
const telemetryData = { ...body, httpMethod: "PUT", selfServeClassName: GraphAPICompute.name };
|
|
||||||
const updateTimeStamp = selfServeTraceStart(telemetryData);
|
|
||||||
let armRequestResult;
|
|
||||||
try {
|
|
||||||
armRequestResult = await armRequestWithoutPolling({
|
|
||||||
host: configContext.ARM_ENDPOINT,
|
|
||||||
path,
|
|
||||||
method: "PUT",
|
|
||||||
apiVersion,
|
|
||||||
body,
|
|
||||||
});
|
|
||||||
selfServeTraceSuccess(telemetryData, updateTimeStamp);
|
|
||||||
} catch (e) {
|
|
||||||
const failureTelemetry = { ...body, e, selfServeClassName: GraphAPICompute.name };
|
|
||||||
selfServeTraceFailure(failureTelemetry, updateTimeStamp);
|
|
||||||
throw e;
|
|
||||||
}
|
|
||||||
return armRequestResult?.operationStatusUrl;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const deleteComputeResource = async (): Promise<string> => {
|
|
||||||
const path = getPath(userContext.subscriptionId, userContext.resourceGroup, userContext.databaseAccount.name);
|
|
||||||
const telemetryData = { httpMethod: "DELETE", selfServeClassName: GraphAPICompute.name };
|
|
||||||
const deleteTimeStamp = selfServeTraceStart(telemetryData);
|
|
||||||
let armRequestResult;
|
|
||||||
try {
|
|
||||||
armRequestResult = await armRequestWithoutPolling({
|
|
||||||
host: configContext.ARM_ENDPOINT,
|
|
||||||
path,
|
|
||||||
method: "DELETE",
|
|
||||||
apiVersion,
|
|
||||||
});
|
|
||||||
selfServeTraceSuccess(telemetryData, deleteTimeStamp);
|
|
||||||
} catch (e) {
|
|
||||||
const failureTelemetry = { e, selfServeClassName: GraphAPICompute.name };
|
|
||||||
selfServeTraceFailure(failureTelemetry, deleteTimeStamp);
|
|
||||||
throw e;
|
|
||||||
}
|
|
||||||
return armRequestResult?.operationStatusUrl;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getComputeResource = async (): Promise<GraphAPIComputeServiceResource> => {
|
|
||||||
const path = getPath(userContext.subscriptionId, userContext.resourceGroup, userContext.databaseAccount.name);
|
|
||||||
const telemetryData = { httpMethod: "GET", selfServeClassName: GraphAPICompute.name };
|
|
||||||
const getResourceTimeStamp = selfServeTraceStart(telemetryData);
|
|
||||||
let armRequestResult;
|
|
||||||
try {
|
|
||||||
armRequestResult = await armRequestWithoutPolling<GraphAPIComputeServiceResource>({
|
|
||||||
host: configContext.ARM_ENDPOINT,
|
|
||||||
path,
|
|
||||||
method: "GET",
|
|
||||||
apiVersion,
|
|
||||||
});
|
|
||||||
selfServeTraceSuccess(telemetryData, getResourceTimeStamp);
|
|
||||||
} catch (e) {
|
|
||||||
const failureTelemetry = { e, selfServeClassName: GraphAPICompute.name };
|
|
||||||
selfServeTraceFailure(failureTelemetry, getResourceTimeStamp);
|
|
||||||
throw e;
|
|
||||||
}
|
|
||||||
return armRequestResult?.result;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getCurrentProvisioningState = async (): Promise<ComputeResponse> => {
|
|
||||||
try {
|
|
||||||
const response = await getComputeResource();
|
|
||||||
return {
|
|
||||||
sku: response.properties.instanceSize,
|
|
||||||
instances: response.properties.instanceCount,
|
|
||||||
status: response.properties.status,
|
|
||||||
endpoint: response.properties.GraphAPIComputeEndPoint,
|
|
||||||
};
|
|
||||||
} catch (e) {
|
|
||||||
return { sku: undefined, instances: undefined, status: undefined, endpoint: undefined };
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
export const refreshComputeProvisioning = async (): Promise<RefreshResult> => {
|
|
||||||
try {
|
|
||||||
const response = await getComputeResource();
|
|
||||||
if (response.properties.status === ResourceStatus.Running.toString()) {
|
|
||||||
return { isUpdateInProgress: false, updateInProgressMessageTKey: undefined };
|
|
||||||
} else if (response.properties.status === ResourceStatus.Creating.toString()) {
|
|
||||||
return { isUpdateInProgress: true, updateInProgressMessageTKey: "CreateMessage" };
|
|
||||||
} else if (response.properties.status === ResourceStatus.Deleting.toString()) {
|
|
||||||
return { isUpdateInProgress: true, updateInProgressMessageTKey: "DeleteMessage" };
|
|
||||||
} else {
|
|
||||||
return { isUpdateInProgress: true, updateInProgressMessageTKey: "UpdateMessage" };
|
|
||||||
}
|
|
||||||
} catch {
|
|
||||||
//TODO differentiate between different failures
|
|
||||||
return { isUpdateInProgress: false, updateInProgressMessageTKey: undefined };
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const getGeneralPath = (subscriptionId: string, resourceGroup: string, name: string): string => {
|
|
||||||
return `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroup}/providers/Microsoft.DocumentDB/databaseAccounts/${name}`;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getReadRegions = async (): Promise<Array<string>> => {
|
|
||||||
try {
|
|
||||||
const readRegions = new Array<string>();
|
|
||||||
|
|
||||||
const response = await armRequestWithoutPolling<RegionsResponse>({
|
|
||||||
host: configContext.ARM_ENDPOINT,
|
|
||||||
path: getGeneralPath(userContext.subscriptionId, userContext.resourceGroup, userContext.databaseAccount.name),
|
|
||||||
method: "GET",
|
|
||||||
apiVersion: "2021-04-01-preview",
|
|
||||||
});
|
|
||||||
|
|
||||||
if (response.result.location !== undefined) {
|
|
||||||
readRegions.push(response.result.location.split(" ").join("").toLowerCase());
|
|
||||||
} else {
|
|
||||||
for (const location of response.result.locations) {
|
|
||||||
readRegions.push(location.locationName.split(" ").join("").toLowerCase());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return readRegions;
|
|
||||||
} catch (err) {
|
|
||||||
return new Array<string>();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const getFetchPricesPathForRegion = (subscriptionId: string): string => {
|
|
||||||
return `/subscriptions/${subscriptionId}/providers/Microsoft.CostManagement/fetchPrices`;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getPriceMap = async (regions: Array<string>): Promise<Map<string, Map<string, number>>> => {
|
|
||||||
try {
|
|
||||||
const priceMap = new Map<string, Map<string, number>>();
|
|
||||||
|
|
||||||
for (const region of regions) {
|
|
||||||
const regionPriceMap = new Map<string, number>();
|
|
||||||
|
|
||||||
const response = await armRequestWithoutPolling<FetchPricesResponse>({
|
|
||||||
host: configContext.ARM_ENDPOINT,
|
|
||||||
path: getFetchPricesPathForRegion(userContext.subscriptionId),
|
|
||||||
method: "POST",
|
|
||||||
apiVersion: "2020-01-01-preview",
|
|
||||||
queryParams: {
|
|
||||||
filter:
|
|
||||||
"armRegionName eq '" +
|
|
||||||
region +
|
|
||||||
"' and serviceFamily eq 'Databases' and productName eq 'Azure Cosmos DB Dedicated Gateway - General Purpose'",
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
for (const item of response.result.Items) {
|
|
||||||
regionPriceMap.set(item.skuName, item.retailPrice);
|
|
||||||
}
|
|
||||||
priceMap.set(region, regionPriceMap);
|
|
||||||
}
|
|
||||||
|
|
||||||
return priceMap;
|
|
||||||
} catch (err) {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@@ -1,423 +0,0 @@
|
|||||||
import { IsDisplayable, OnChange, PropertyInfo, RefreshOptions, Values } from "../Decorators";
|
|
||||||
import { selfServeTrace } from "../SelfServeTelemetryProcessor";
|
|
||||||
import {
|
|
||||||
ChoiceItem,
|
|
||||||
Description,
|
|
||||||
DescriptionType,
|
|
||||||
Info,
|
|
||||||
InputType,
|
|
||||||
NumberUiType,
|
|
||||||
OnSaveResult,
|
|
||||||
RefreshResult,
|
|
||||||
SelfServeBaseClass,
|
|
||||||
SmartUiInput,
|
|
||||||
} from "../SelfServeTypes";
|
|
||||||
import { BladeType, generateBladeLink } from "../SelfServeUtils";
|
|
||||||
import {
|
|
||||||
deleteComputeResource,
|
|
||||||
getCurrentProvisioningState,
|
|
||||||
getPriceMap,
|
|
||||||
getReadRegions,
|
|
||||||
refreshComputeProvisioning,
|
|
||||||
updateComputeResource,
|
|
||||||
} from "./GraphAPICompute.rp";
|
|
||||||
|
|
||||||
const costPerHourDefaultValue: Description = {
|
|
||||||
textTKey: "CostText",
|
|
||||||
type: DescriptionType.Text,
|
|
||||||
link: {
|
|
||||||
href: "https://aka.ms/cosmos-db-dedicated-gateway-pricing",
|
|
||||||
textTKey: "ComputePricing",
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const connectionStringValue: Description = {
|
|
||||||
textTKey: "ConnectionStringText",
|
|
||||||
type: DescriptionType.Text,
|
|
||||||
link: {
|
|
||||||
href: generateBladeLink(BladeType.SqlKeys),
|
|
||||||
textTKey: "KeysBlade",
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const metricsStringValue: Description = {
|
|
||||||
textTKey: "MetricsText",
|
|
||||||
type: DescriptionType.Text,
|
|
||||||
link: {
|
|
||||||
href: generateBladeLink(BladeType.Metrics),
|
|
||||||
textTKey: "MetricsBlade",
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const CosmosD4s = "Cosmos.D4s";
|
|
||||||
const CosmosD8s = "Cosmos.D8s";
|
|
||||||
const CosmosD16s = "Cosmos.D16s";
|
|
||||||
|
|
||||||
const onSKUChange = (newValue: InputType, currentValues: Map<string, SmartUiInput>): Map<string, SmartUiInput> => {
|
|
||||||
currentValues.set("sku", { value: newValue });
|
|
||||||
currentValues.set("costPerHour", {
|
|
||||||
value: calculateCost(newValue as string, currentValues.get("instances").value as number),
|
|
||||||
});
|
|
||||||
|
|
||||||
return currentValues;
|
|
||||||
};
|
|
||||||
|
|
||||||
const onNumberOfInstancesChange = (
|
|
||||||
newValue: InputType,
|
|
||||||
currentValues: Map<string, SmartUiInput>,
|
|
||||||
baselineValues: Map<string, SmartUiInput>
|
|
||||||
): Map<string, SmartUiInput> => {
|
|
||||||
currentValues.set("instances", { value: newValue });
|
|
||||||
const ComputeOriginallyEnabled = baselineValues.get("enableCompute")?.value as boolean;
|
|
||||||
const baselineInstances = baselineValues.get("instances")?.value as number;
|
|
||||||
if (!ComputeOriginallyEnabled || baselineInstances !== newValue) {
|
|
||||||
currentValues.set("warningBanner", {
|
|
||||||
value: {
|
|
||||||
textTKey: "WarningBannerOnUpdate",
|
|
||||||
link: {
|
|
||||||
href: "https://aka.ms/cosmos-db-dedicated-gateway-overview",
|
|
||||||
textTKey: "ComputePricing",
|
|
||||||
},
|
|
||||||
} as Description,
|
|
||||||
hidden: false,
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
currentValues.set("warningBanner", undefined);
|
|
||||||
}
|
|
||||||
|
|
||||||
currentValues.set("costPerHour", {
|
|
||||||
value: calculateCost(currentValues.get("sku").value as string, newValue as number),
|
|
||||||
});
|
|
||||||
|
|
||||||
return currentValues;
|
|
||||||
};
|
|
||||||
|
|
||||||
const onEnableComputeChange = (
|
|
||||||
newValue: InputType,
|
|
||||||
currentValues: Map<string, SmartUiInput>,
|
|
||||||
baselineValues: ReadonlyMap<string, SmartUiInput>
|
|
||||||
): Map<string, SmartUiInput> => {
|
|
||||||
currentValues.set("enableCompute", { value: newValue });
|
|
||||||
const ComputeOriginallyEnabled = baselineValues.get("enableCompute")?.value as boolean;
|
|
||||||
if (ComputeOriginallyEnabled === newValue) {
|
|
||||||
currentValues.set("sku", baselineValues.get("sku"));
|
|
||||||
currentValues.set("instances", baselineValues.get("instances"));
|
|
||||||
currentValues.set("costPerHour", baselineValues.get("costPerHour"));
|
|
||||||
currentValues.set("warningBanner", baselineValues.get("warningBanner"));
|
|
||||||
currentValues.set("connectionString", baselineValues.get("connectionString"));
|
|
||||||
currentValues.set("metricsString", baselineValues.get("metricsString"));
|
|
||||||
return currentValues;
|
|
||||||
}
|
|
||||||
|
|
||||||
currentValues.set("warningBanner", undefined);
|
|
||||||
if (newValue === true) {
|
|
||||||
currentValues.set("warningBanner", {
|
|
||||||
value: {
|
|
||||||
textTKey: "WarningBannerOnUpdate",
|
|
||||||
link: {
|
|
||||||
href: "https://aka.ms/cosmos-db-dedicated-gateway-pricing", //needs updating
|
|
||||||
textTKey: "ComputePricing",
|
|
||||||
},
|
|
||||||
} as Description,
|
|
||||||
hidden: false,
|
|
||||||
});
|
|
||||||
|
|
||||||
currentValues.set("costPerHour", {
|
|
||||||
value: calculateCost(baselineValues.get("sku").value as string, baselineValues.get("instances").value as number),
|
|
||||||
hidden: false,
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
currentValues.set("warningBanner", {
|
|
||||||
value: {
|
|
||||||
textTKey: "WarningBannerOnDelete",
|
|
||||||
link: {
|
|
||||||
href: "https://aka.ms/cosmos-db-dedicated-gateway-overview", // needs updating
|
|
||||||
textTKey: "DeprovisioningDetailsText",
|
|
||||||
},
|
|
||||||
} as Description,
|
|
||||||
hidden: false,
|
|
||||||
});
|
|
||||||
|
|
||||||
currentValues.set("costPerHour", { value: costPerHourDefaultValue, hidden: true });
|
|
||||||
}
|
|
||||||
const sku = currentValues.get("sku");
|
|
||||||
const hideAttributes = newValue === undefined || !(newValue as boolean);
|
|
||||||
currentValues.set("sku", {
|
|
||||||
value: sku.value,
|
|
||||||
hidden: hideAttributes,
|
|
||||||
disabled: ComputeOriginallyEnabled,
|
|
||||||
});
|
|
||||||
currentValues.set("instances", {
|
|
||||||
value: 1,
|
|
||||||
hidden: hideAttributes,
|
|
||||||
disabled: true,
|
|
||||||
});
|
|
||||||
|
|
||||||
currentValues.set("connectionString", {
|
|
||||||
value: connectionStringValue,
|
|
||||||
hidden: !newValue || !ComputeOriginallyEnabled,
|
|
||||||
});
|
|
||||||
|
|
||||||
currentValues.set("metricsString", {
|
|
||||||
value: metricsStringValue,
|
|
||||||
hidden: !newValue || !ComputeOriginallyEnabled,
|
|
||||||
});
|
|
||||||
|
|
||||||
return currentValues;
|
|
||||||
};
|
|
||||||
|
|
||||||
const skuDropDownItems: ChoiceItem[] = [
|
|
||||||
{ labelTKey: "CosmosD4s", key: CosmosD4s },
|
|
||||||
{ labelTKey: "CosmosD8s", key: CosmosD8s },
|
|
||||||
{ labelTKey: "CosmosD16s", key: CosmosD16s },
|
|
||||||
];
|
|
||||||
|
|
||||||
const getSkus = async (): Promise<ChoiceItem[]> => {
|
|
||||||
return skuDropDownItems;
|
|
||||||
};
|
|
||||||
|
|
||||||
const NumberOfInstancesDropdownInfo: Info = {
|
|
||||||
messageTKey: "ResizingDecisionText",
|
|
||||||
link: {
|
|
||||||
href: "https://aka.ms/cosmos-db-dedicated-gateway-size", // todo
|
|
||||||
textTKey: "ResizingDecisionLink",
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const getInstancesMin = async (): Promise<number> => {
|
|
||||||
return 1;
|
|
||||||
};
|
|
||||||
|
|
||||||
const getInstancesMax = async (): Promise<number> => {
|
|
||||||
return 5;
|
|
||||||
};
|
|
||||||
|
|
||||||
const ApproximateCostDropDownInfo: Info = {
|
|
||||||
messageTKey: "CostText",
|
|
||||||
link: {
|
|
||||||
href: "https://aka.ms/cosmos-db-dedicated-gateway-pricing", //todo
|
|
||||||
textTKey: "ComputePricing",
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
let priceMap: Map<string, Map<string, number>>;
|
|
||||||
let regions: Array<string>;
|
|
||||||
|
|
||||||
const calculateCost = (skuName: string, instanceCount: number): Description => {
|
|
||||||
try {
|
|
||||||
let costPerHour = 0;
|
|
||||||
for (const region of regions) {
|
|
||||||
const incrementalCost = priceMap.get(region).get(skuName.replace("Cosmos.", ""));
|
|
||||||
if (incrementalCost === undefined) {
|
|
||||||
throw new Error("Value not found in map.");
|
|
||||||
}
|
|
||||||
costPerHour += incrementalCost;
|
|
||||||
}
|
|
||||||
|
|
||||||
costPerHour *= instanceCount;
|
|
||||||
costPerHour = Math.round(costPerHour * 100) / 100;
|
|
||||||
|
|
||||||
return {
|
|
||||||
textTKey: `${costPerHour} USD`,
|
|
||||||
type: DescriptionType.Text,
|
|
||||||
};
|
|
||||||
} catch (err) {
|
|
||||||
return costPerHourDefaultValue;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
@IsDisplayable()
|
|
||||||
@RefreshOptions({ retryIntervalInMs: 20000 })
|
|
||||||
export default class GraphAPICompute extends SelfServeBaseClass {
|
|
||||||
public onRefresh = async (): Promise<RefreshResult> => {
|
|
||||||
return await refreshComputeProvisioning();
|
|
||||||
};
|
|
||||||
|
|
||||||
public onSave = async (
|
|
||||||
currentValues: Map<string, SmartUiInput>,
|
|
||||||
baselineValues: Map<string, SmartUiInput>
|
|
||||||
): Promise<OnSaveResult> => {
|
|
||||||
selfServeTrace({ selfServeClassName: GraphAPICompute.name });
|
|
||||||
|
|
||||||
const ComputeCurrentlyEnabled = currentValues.get("enableCompute")?.value as boolean;
|
|
||||||
const ComputeOriginallyEnabled = baselineValues.get("enableCompute")?.value as boolean;
|
|
||||||
|
|
||||||
currentValues.set("warningBanner", undefined);
|
|
||||||
|
|
||||||
if (ComputeOriginallyEnabled) {
|
|
||||||
if (!ComputeCurrentlyEnabled) {
|
|
||||||
const operationStatusUrl = await deleteComputeResource();
|
|
||||||
return {
|
|
||||||
operationStatusUrl: operationStatusUrl,
|
|
||||||
portalNotification: {
|
|
||||||
initialize: {
|
|
||||||
titleTKey: "DeleteInitializeTitle",
|
|
||||||
messageTKey: "DeleteInitializeMessage",
|
|
||||||
},
|
|
||||||
success: {
|
|
||||||
titleTKey: "DeleteSuccessTitle",
|
|
||||||
messageTKey: "DeleteSuccesseMessage",
|
|
||||||
},
|
|
||||||
failure: {
|
|
||||||
titleTKey: "DeleteFailureTitle",
|
|
||||||
messageTKey: "DeleteFailureMessage",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
const sku = currentValues.get("sku")?.value as string;
|
|
||||||
const instances = currentValues.get("instances").value as number;
|
|
||||||
const operationStatusUrl = await updateComputeResource(sku, instances);
|
|
||||||
return {
|
|
||||||
operationStatusUrl: operationStatusUrl,
|
|
||||||
portalNotification: {
|
|
||||||
initialize: {
|
|
||||||
titleTKey: "UpdateInitializeTitle",
|
|
||||||
messageTKey: "UpdateInitializeMessage",
|
|
||||||
},
|
|
||||||
success: {
|
|
||||||
titleTKey: "UpdateSuccessTitle",
|
|
||||||
messageTKey: "UpdateSuccesseMessage",
|
|
||||||
},
|
|
||||||
failure: {
|
|
||||||
titleTKey: "UpdateFailureTitle",
|
|
||||||
messageTKey: "UpdateFailureMessage",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
const sku = currentValues.get("sku")?.value as string;
|
|
||||||
const instances = currentValues.get("instances").value as number;
|
|
||||||
const operationStatusUrl = await updateComputeResource(sku, instances);
|
|
||||||
return {
|
|
||||||
operationStatusUrl: operationStatusUrl,
|
|
||||||
portalNotification: {
|
|
||||||
initialize: {
|
|
||||||
titleTKey: "CreateInitializeTitle",
|
|
||||||
messageTKey: "CreateInitializeMessage",
|
|
||||||
},
|
|
||||||
success: {
|
|
||||||
titleTKey: "CreateSuccessTitle",
|
|
||||||
messageTKey: "CreateSuccesseMessage",
|
|
||||||
},
|
|
||||||
failure: {
|
|
||||||
titleTKey: "CreateFailureTitle",
|
|
||||||
messageTKey: "CreateFailureMessage",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
public initialize = async (): Promise<Map<string, SmartUiInput>> => {
|
|
||||||
// Based on the RP call enableCompute will be true if it has not yet been enabled and false if it has.
|
|
||||||
const defaults = new Map<string, SmartUiInput>();
|
|
||||||
defaults.set("enableCompute", { value: false });
|
|
||||||
defaults.set("sku", { value: CosmosD4s, hidden: true });
|
|
||||||
defaults.set("instances", { value: 1, hidden: true });
|
|
||||||
defaults.set("costPerHour", undefined);
|
|
||||||
defaults.set("connectionString", undefined);
|
|
||||||
defaults.set("metricsString", {
|
|
||||||
value: undefined,
|
|
||||||
hidden: true,
|
|
||||||
});
|
|
||||||
|
|
||||||
regions = await getReadRegions();
|
|
||||||
priceMap = await getPriceMap(regions);
|
|
||||||
const response = await getCurrentProvisioningState();
|
|
||||||
if (response.status && response.status === "Creating") {
|
|
||||||
defaults.set("enableCompute", { value: true });
|
|
||||||
defaults.set("sku", { value: response.sku, disabled: true });
|
|
||||||
defaults.set("instances", { value: response.instances, disabled: true });
|
|
||||||
defaults.set("costPerHour", { value: calculateCost(response.sku, response.instances) });
|
|
||||||
defaults.set("connectionString", {
|
|
||||||
value: connectionStringValue,
|
|
||||||
hidden: true,
|
|
||||||
});
|
|
||||||
defaults.set("metricsString", {
|
|
||||||
value: metricsStringValue,
|
|
||||||
hidden: true,
|
|
||||||
});
|
|
||||||
} else if (response.status && response.status !== "Deleting") {
|
|
||||||
defaults.set("enableCompute", { value: true });
|
|
||||||
defaults.set("sku", { value: response.sku, disabled: true });
|
|
||||||
defaults.set("instances", { value: response.instances });
|
|
||||||
defaults.set("costPerHour", { value: calculateCost(response.sku, response.instances) });
|
|
||||||
defaults.set("connectionString", {
|
|
||||||
value: connectionStringValue,
|
|
||||||
hidden: false,
|
|
||||||
});
|
|
||||||
defaults.set("metricsString", {
|
|
||||||
value: metricsStringValue,
|
|
||||||
hidden: false,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
defaults.set("warningBanner", undefined);
|
|
||||||
return defaults;
|
|
||||||
};
|
|
||||||
|
|
||||||
@Values({
|
|
||||||
isDynamicDescription: true,
|
|
||||||
})
|
|
||||||
warningBanner: string;
|
|
||||||
|
|
||||||
@Values({
|
|
||||||
description: {
|
|
||||||
textTKey: "GraphAPIDescription",
|
|
||||||
type: DescriptionType.Text,
|
|
||||||
link: {
|
|
||||||
href: "https://aka.ms/cosmos-db-dedicated-gateway-overview", //todo
|
|
||||||
textTKey: "LearnAboutCompute",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
description: string;
|
|
||||||
|
|
||||||
@OnChange(onEnableComputeChange)
|
|
||||||
@Values({
|
|
||||||
labelTKey: "Compute",
|
|
||||||
trueLabelTKey: "Provisioned",
|
|
||||||
falseLabelTKey: "Deprovisioned",
|
|
||||||
})
|
|
||||||
enableCompute: boolean;
|
|
||||||
|
|
||||||
@OnChange(onSKUChange)
|
|
||||||
@Values({
|
|
||||||
labelTKey: "SKUs",
|
|
||||||
choices: getSkus,
|
|
||||||
placeholderTKey: "SKUsPlaceHolder",
|
|
||||||
})
|
|
||||||
sku: ChoiceItem;
|
|
||||||
|
|
||||||
@OnChange(onNumberOfInstancesChange)
|
|
||||||
@PropertyInfo(NumberOfInstancesDropdownInfo)
|
|
||||||
@Values({
|
|
||||||
labelTKey: "NumberOfInstances",
|
|
||||||
min: getInstancesMin,
|
|
||||||
max: getInstancesMax,
|
|
||||||
step: 1,
|
|
||||||
uiType: NumberUiType.Spinner,
|
|
||||||
})
|
|
||||||
instances: number;
|
|
||||||
|
|
||||||
@PropertyInfo(ApproximateCostDropDownInfo)
|
|
||||||
@Values({
|
|
||||||
labelTKey: "ApproximateCost",
|
|
||||||
isDynamicDescription: true,
|
|
||||||
})
|
|
||||||
costPerHour: string;
|
|
||||||
|
|
||||||
@Values({
|
|
||||||
labelTKey: "ConnectionString",
|
|
||||||
isDynamicDescription: true,
|
|
||||||
})
|
|
||||||
connectionString: string;
|
|
||||||
|
|
||||||
@Values({
|
|
||||||
labelTKey: "MonitorUsage",
|
|
||||||
description: metricsStringValue,
|
|
||||||
})
|
|
||||||
metricsString: string;
|
|
||||||
}
|
|
||||||
@@ -1,65 +0,0 @@
|
|||||||
export enum Regions {
|
|
||||||
NorthCentralUS = "NorthCentralUS",
|
|
||||||
WestUS = "WestUS",
|
|
||||||
EastUS2 = "EastUS2",
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface AccountProps {
|
|
||||||
regions: Regions;
|
|
||||||
enableLogging: boolean;
|
|
||||||
accountName: string;
|
|
||||||
collectionThroughput: number;
|
|
||||||
dbThroughput: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
export type GraphAPIComputeServiceResource = {
|
|
||||||
id: string;
|
|
||||||
name: string;
|
|
||||||
type: string;
|
|
||||||
properties: GraphAPIComputeServiceProps;
|
|
||||||
locations: GraphAPIComputeServiceLocations;
|
|
||||||
};
|
|
||||||
export type GraphAPIComputeServiceProps = {
|
|
||||||
serviceType: string;
|
|
||||||
creationTime: string;
|
|
||||||
status: string;
|
|
||||||
instanceSize: string;
|
|
||||||
instanceCount: number;
|
|
||||||
GraphAPIComputeEndPoint: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type GraphAPIComputeServiceLocations = {
|
|
||||||
location: string;
|
|
||||||
status: string;
|
|
||||||
GraphAPIComputeEndpoint: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type UpdateComputeRequestParameters = {
|
|
||||||
properties: UpdateComputeRequestProperties;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type UpdateComputeRequestProperties = {
|
|
||||||
instanceSize: string;
|
|
||||||
instanceCount: number;
|
|
||||||
serviceType: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type FetchPricesResponse = {
|
|
||||||
Items: Array<PriceItem>;
|
|
||||||
NextPageLink: string | undefined;
|
|
||||||
Count: number;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type PriceItem = {
|
|
||||||
retailPrice: number;
|
|
||||||
skuName: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type RegionsResponse = {
|
|
||||||
locations: Array<RegionItem>;
|
|
||||||
location: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type RegionItem = {
|
|
||||||
locationName: string;
|
|
||||||
};
|
|
||||||
@@ -50,14 +50,6 @@ const getDescriptor = async (selfServeType: SelfServeType): Promise<SelfServeDes
|
|||||||
await loadTranslations(sqlX.constructor.name);
|
await loadTranslations(sqlX.constructor.name);
|
||||||
return sqlX.toSelfServeDescriptor();
|
return sqlX.toSelfServeDescriptor();
|
||||||
}
|
}
|
||||||
case SelfServeType.graphapicompute: {
|
|
||||||
const GraphAPICompute = await import(
|
|
||||||
/* webpackChunkName: "GraphAPICompute" */ "./GraphAPICompute/GraphAPICompute"
|
|
||||||
);
|
|
||||||
const graphAPICompute = new GraphAPICompute.default();
|
|
||||||
await loadTranslations(graphAPICompute.constructor.name);
|
|
||||||
return graphAPICompute.toSelfServeDescriptor();
|
|
||||||
}
|
|
||||||
default:
|
default:
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ export enum SelfServeType {
|
|||||||
// Add your self serve types here
|
// Add your self serve types here
|
||||||
example = "example",
|
example = "example",
|
||||||
sqlx = "sqlx",
|
sqlx = "sqlx",
|
||||||
graphapicompute = "graphapicompute",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -138,17 +138,9 @@ const getGeneralPath = (subscriptionId: string, resourceGroup: string, name: str
|
|||||||
return `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroup}/providers/Microsoft.DocumentDB/databaseAccounts/${name}`;
|
return `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroup}/providers/Microsoft.DocumentDB/databaseAccounts/${name}`;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getRegions = async (): Promise<Array<string>> => {
|
export const getReadRegions = async (): Promise<Array<string>> => {
|
||||||
const telemetryData = {
|
|
||||||
feature: "Calculate approximate cost",
|
|
||||||
function: "getRegions",
|
|
||||||
description: "",
|
|
||||||
selfServeClassName: SqlX.name,
|
|
||||||
};
|
|
||||||
const getRegionsTimestamp = selfServeTraceStart(telemetryData);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const regions = new Array<string>();
|
const readRegions = new Array<string>();
|
||||||
|
|
||||||
const response = await armRequestWithoutPolling<RegionsResponse>({
|
const response = await armRequestWithoutPolling<RegionsResponse>({
|
||||||
host: configContext.ARM_ENDPOINT,
|
host: configContext.ARM_ENDPOINT,
|
||||||
@@ -158,18 +150,14 @@ export const getRegions = async (): Promise<Array<string>> => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (response.result.location !== undefined) {
|
if (response.result.location !== undefined) {
|
||||||
regions.push(response.result.location.split(" ").join("").toLowerCase());
|
readRegions.push(response.result.location.replace(" ", "").toLowerCase());
|
||||||
} else {
|
} else {
|
||||||
for (const location of response.result.locations) {
|
for (const location of response.result.locations) {
|
||||||
regions.push(location.locationName.split(" ").join("").toLowerCase());
|
readRegions.push(location.locationName.replace(" ", "").toLowerCase());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return readRegions;
|
||||||
selfServeTraceSuccess(telemetryData, getRegionsTimestamp);
|
|
||||||
return regions;
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
const failureTelemetry = { err, selfServeClassName: SqlX.name };
|
|
||||||
selfServeTraceFailure(failureTelemetry, getRegionsTimestamp);
|
|
||||||
return new Array<string>();
|
return new Array<string>();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -179,14 +167,6 @@ const getFetchPricesPathForRegion = (subscriptionId: string): string => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const getPriceMap = async (regions: Array<string>): Promise<Map<string, Map<string, number>>> => {
|
export const getPriceMap = async (regions: Array<string>): Promise<Map<string, Map<string, number>>> => {
|
||||||
const telemetryData = {
|
|
||||||
feature: "Calculate approximate cost",
|
|
||||||
function: "getPriceMap",
|
|
||||||
description: "fetch prices API call",
|
|
||||||
selfServeClassName: SqlX.name,
|
|
||||||
};
|
|
||||||
const getPriceMapTimestamp = selfServeTraceStart(telemetryData);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const priceMap = new Map<string, Map<string, number>>();
|
const priceMap = new Map<string, Map<string, number>>();
|
||||||
|
|
||||||
@@ -212,12 +192,8 @@ export const getPriceMap = async (regions: Array<string>): Promise<Map<string, M
|
|||||||
priceMap.set(region, regionPriceMap);
|
priceMap.set(region, regionPriceMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
selfServeTraceSuccess(telemetryData, getPriceMapTimestamp);
|
|
||||||
return priceMap;
|
return priceMap;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
const failureTelemetry = { err, selfServeClassName: SqlX.name };
|
|
||||||
selfServeTraceFailure(failureTelemetry, getPriceMapTimestamp);
|
|
||||||
|
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,10 +1,5 @@
|
|||||||
import { IsDisplayable, OnChange, PropertyInfo, RefreshOptions, Values } from "../Decorators";
|
import { IsDisplayable, OnChange, PropertyInfo, RefreshOptions, Values } from "../Decorators";
|
||||||
import {
|
import { selfServeTrace } from "../SelfServeTelemetryProcessor";
|
||||||
selfServeTrace,
|
|
||||||
selfServeTraceFailure,
|
|
||||||
selfServeTraceStart,
|
|
||||||
selfServeTraceSuccess,
|
|
||||||
} from "../SelfServeTelemetryProcessor";
|
|
||||||
import {
|
import {
|
||||||
ChoiceItem,
|
ChoiceItem,
|
||||||
Description,
|
Description,
|
||||||
@@ -22,7 +17,7 @@ import {
|
|||||||
deleteDedicatedGatewayResource,
|
deleteDedicatedGatewayResource,
|
||||||
getCurrentProvisioningState,
|
getCurrentProvisioningState,
|
||||||
getPriceMap,
|
getPriceMap,
|
||||||
getRegions,
|
getReadRegions,
|
||||||
refreshDedicatedGatewayProvisioning,
|
refreshDedicatedGatewayProvisioning,
|
||||||
updateDedicatedGatewayResource,
|
updateDedicatedGatewayResource,
|
||||||
} from "./SqlX.rp";
|
} from "./SqlX.rp";
|
||||||
@@ -210,14 +205,6 @@ let priceMap: Map<string, Map<string, number>>;
|
|||||||
let regions: Array<string>;
|
let regions: Array<string>;
|
||||||
|
|
||||||
const calculateCost = (skuName: string, instanceCount: number): Description => {
|
const calculateCost = (skuName: string, instanceCount: number): Description => {
|
||||||
const telemetryData = {
|
|
||||||
feature: "Calculate approximate cost",
|
|
||||||
function: "calculateCost",
|
|
||||||
description: "performs final calculation",
|
|
||||||
selfServeClassName: SqlX.name,
|
|
||||||
};
|
|
||||||
const calculateCostTimestamp = selfServeTraceStart(telemetryData);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
let costPerHour = 0;
|
let costPerHour = 0;
|
||||||
for (const region of regions) {
|
for (const region of regions) {
|
||||||
@@ -228,22 +215,14 @@ const calculateCost = (skuName: string, instanceCount: number): Description => {
|
|||||||
costPerHour += incrementalCost;
|
costPerHour += incrementalCost;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (costPerHour === 0) {
|
|
||||||
throw new Error("Cost per hour = 0");
|
|
||||||
}
|
|
||||||
|
|
||||||
costPerHour *= instanceCount;
|
costPerHour *= instanceCount;
|
||||||
costPerHour = Math.round(costPerHour * 100) / 100;
|
costPerHour = Math.round(costPerHour * 100) / 100;
|
||||||
|
|
||||||
selfServeTraceSuccess(telemetryData, calculateCostTimestamp);
|
|
||||||
return {
|
return {
|
||||||
textTKey: `${costPerHour} USD`,
|
textTKey: `${costPerHour} USD`,
|
||||||
type: DescriptionType.Text,
|
type: DescriptionType.Text,
|
||||||
};
|
};
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
const failureTelemetry = { err, regions, priceMap, selfServeClassName: SqlX.name };
|
|
||||||
selfServeTraceFailure(failureTelemetry, calculateCostTimestamp);
|
|
||||||
|
|
||||||
return costPerHourDefaultValue;
|
return costPerHourDefaultValue;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -345,7 +324,7 @@ export default class SqlX extends SelfServeBaseClass {
|
|||||||
hidden: true,
|
hidden: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
regions = await getRegions();
|
regions = await getReadRegions();
|
||||||
priceMap = await getPriceMap(regions);
|
priceMap = await getPriceMap(regions);
|
||||||
|
|
||||||
const response = await getCurrentProvisioningState();
|
const response = await getCurrentProvisioningState();
|
||||||
|
|||||||
@@ -125,8 +125,7 @@ export class OfferPricing {
|
|||||||
S3Price: 0.1344,
|
S3Price: 0.1344,
|
||||||
Standard: {
|
Standard: {
|
||||||
StartingPrice: 24 / hoursInAMonth, // per hour
|
StartingPrice: 24 / hoursInAMonth, // per hour
|
||||||
SingleMasterPricePerRU: 0.00008,
|
PricePerRU: 0.00008,
|
||||||
MultiMasterPricePerRU: 0.00016,
|
|
||||||
PricePerGB: 0.25 / hoursInAMonth,
|
PricePerGB: 0.25 / hoursInAMonth,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -138,8 +137,7 @@ export class OfferPricing {
|
|||||||
S3Price: 0.6,
|
S3Price: 0.6,
|
||||||
Standard: {
|
Standard: {
|
||||||
StartingPrice: OfferPricing.MonthlyPricing.mooncake.Standard.StartingPrice / hoursInAMonth, // per hour
|
StartingPrice: OfferPricing.MonthlyPricing.mooncake.Standard.StartingPrice / hoursInAMonth, // per hour
|
||||||
SingleMasterPricePerRU: 0.00051,
|
PricePerRU: 0.00051,
|
||||||
MultiMasterPricePerRU: 0.00102,
|
|
||||||
PricePerGB: OfferPricing.MonthlyPricing.mooncake.Standard.PricePerGB / hoursInAMonth,
|
PricePerGB: OfferPricing.MonthlyPricing.mooncake.Standard.PricePerGB / hoursInAMonth,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -2,11 +2,11 @@ import * as Constants from "./Constants";
|
|||||||
|
|
||||||
export function computeRUUsagePrice(serverId: string, requestUnits: number): string {
|
export function computeRUUsagePrice(serverId: string, requestUnits: number): string {
|
||||||
if (serverId === "mooncake") {
|
if (serverId === "mooncake") {
|
||||||
const ruCharge = requestUnits * Constants.OfferPricing.HourlyPricing.mooncake.Standard.SingleMasterPricePerRU;
|
const ruCharge = requestUnits * Constants.OfferPricing.HourlyPricing.mooncake.Standard.PricePerRU;
|
||||||
return calculateEstimateNumber(ruCharge) + " " + Constants.OfferPricing.HourlyPricing.mooncake.Currency;
|
return calculateEstimateNumber(ruCharge) + " " + Constants.OfferPricing.HourlyPricing.mooncake.Currency;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ruCharge = requestUnits * Constants.OfferPricing.HourlyPricing.default.Standard.SingleMasterPricePerRU;
|
const ruCharge = requestUnits * Constants.OfferPricing.HourlyPricing.default.Standard.PricePerRU;
|
||||||
return calculateEstimateNumber(ruCharge) + " " + Constants.OfferPricing.HourlyPricing.default.Currency;
|
return calculateEstimateNumber(ruCharge) + " " + Constants.OfferPricing.HourlyPricing.default.Currency;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,7 @@
|
|||||||
|
import * as Constants from "../Common/Constants";
|
||||||
|
|
||||||
|
export const manualToAutoscaleDisclaimer = `The starting autoscale max RU/s will be determined by the system, based on the current manual throughput settings and storage of your resource. After autoscale has been enabled, you can change the max RU/s. <a href="${Constants.Urls.autoscaleMigration}">Learn more</a>.`;
|
||||||
|
|
||||||
export const minAutoPilotThroughput = 4000;
|
export const minAutoPilotThroughput = 4000;
|
||||||
|
|
||||||
export const autoPilotIncrementStep = 1000;
|
export const autoPilotIncrementStep = 1000;
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ import { HttpStatusCodes } from "../Common/Constants";
|
|||||||
import { useDialog } from "../Explorer/Controls/Dialog";
|
import { useDialog } from "../Explorer/Controls/Dialog";
|
||||||
import { GalleryTab, SortBy } from "../Explorer/Controls/NotebookGallery/GalleryViewerComponent";
|
import { GalleryTab, SortBy } from "../Explorer/Controls/NotebookGallery/GalleryViewerComponent";
|
||||||
import Explorer from "../Explorer/Explorer";
|
import Explorer from "../Explorer/Explorer";
|
||||||
import { useNotebook } from "../Explorer/Notebook/useNotebook";
|
|
||||||
import { IGalleryItem, JunoClient } from "../Juno/JunoClient";
|
import { IGalleryItem, JunoClient } from "../Juno/JunoClient";
|
||||||
import * as GalleryUtils from "./GalleryUtils";
|
import * as GalleryUtils from "./GalleryUtils";
|
||||||
|
|
||||||
@@ -35,7 +34,7 @@ describe("GalleryUtils", () => {
|
|||||||
|
|
||||||
expect(useDialog.getState().visible).toBe(true);
|
expect(useDialog.getState().visible).toBe(true);
|
||||||
expect(useDialog.getState().dialogProps).toBeDefined();
|
expect(useDialog.getState().dialogProps).toBeDefined();
|
||||||
expect(useDialog.getState().dialogProps.title).toBe(`Download to ${useNotebook.getState().notebookFolderName}`);
|
expect(useDialog.getState().dialogProps.title).toBe("Download to My Notebooks");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("favoriteItem favorites item", async () => {
|
it("favoriteItem favorites item", async () => {
|
||||||
|
|||||||
@@ -10,8 +10,6 @@ import {
|
|||||||
SortBy,
|
SortBy,
|
||||||
} from "../Explorer/Controls/NotebookGallery/GalleryViewerComponent";
|
} from "../Explorer/Controls/NotebookGallery/GalleryViewerComponent";
|
||||||
import Explorer from "../Explorer/Explorer";
|
import Explorer from "../Explorer/Explorer";
|
||||||
import { NotebookUtil } from "../Explorer/Notebook/NotebookUtil";
|
|
||||||
import { useNotebook } from "../Explorer/Notebook/useNotebook";
|
|
||||||
import { IGalleryItem, JunoClient } from "../Juno/JunoClient";
|
import { IGalleryItem, JunoClient } from "../Juno/JunoClient";
|
||||||
import { Action, ActionModifiers } from "../Shared/Telemetry/TelemetryConstants";
|
import { Action, ActionModifiers } from "../Shared/Telemetry/TelemetryConstants";
|
||||||
import { trace, traceFailure, traceStart, traceSuccess } from "../Shared/Telemetry/TelemetryProcessor";
|
import { trace, traceFailure, traceStart, traceSuccess } from "../Shared/Telemetry/TelemetryProcessor";
|
||||||
@@ -225,90 +223,66 @@ export function downloadItem(
|
|||||||
|
|
||||||
const name = data.name;
|
const name = data.name;
|
||||||
useDialog.getState().showOkCancelModalDialog(
|
useDialog.getState().showOkCancelModalDialog(
|
||||||
`Download to ${useNotebook.getState().notebookFolderName}`,
|
"Download to My Notebooks",
|
||||||
undefined,
|
`Download ${name} from gallery as a copy to your notebooks to run and/or edit the notebook.`,
|
||||||
"Download",
|
"Download",
|
||||||
async () => {
|
async () => {
|
||||||
if (NotebookUtil.isPhoenixEnabled()) {
|
const clearInProgressMessage = logConsoleProgress(`Downloading ${name} to My Notebooks`);
|
||||||
await container.allocateContainer();
|
const startKey = traceStart(Action.NotebooksGalleryDownload, {
|
||||||
}
|
|
||||||
const notebookServerInfo = useNotebook.getState().notebookServerInfo;
|
|
||||||
if (notebookServerInfo && notebookServerInfo.notebookServerEndpoint !== undefined) {
|
|
||||||
downloadNotebookItem(name, data, junoClient, container, onComplete);
|
|
||||||
} else {
|
|
||||||
useDialog
|
|
||||||
.getState()
|
|
||||||
.showOkModalDialog(
|
|
||||||
"Failed to Connect",
|
|
||||||
"Failed to connect to temporary workspace. Please refresh the page and try again."
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"Cancel",
|
|
||||||
undefined,
|
|
||||||
container.getDownloadModalConent(name)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
export async function downloadNotebookItem(
|
|
||||||
fileName: string,
|
|
||||||
data: IGalleryItem,
|
|
||||||
junoClient: JunoClient,
|
|
||||||
container: Explorer,
|
|
||||||
onComplete: (item: IGalleryItem) => void
|
|
||||||
) {
|
|
||||||
const clearInProgressMessage = logConsoleProgress(
|
|
||||||
`Downloading ${fileName} to ${useNotebook.getState().notebookFolderName}`
|
|
||||||
);
|
|
||||||
const startKey = traceStart(Action.NotebooksGalleryDownload, {
|
|
||||||
notebookId: data.id,
|
|
||||||
downloadCount: data.downloads,
|
|
||||||
isSample: data.isSample,
|
|
||||||
});
|
|
||||||
|
|
||||||
try {
|
|
||||||
const response = await junoClient.getNotebookContent(data.id);
|
|
||||||
if (!response.data) {
|
|
||||||
throw new Error(`Received HTTP ${response.status} when fetching ${data.name}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
const notebook = JSON.parse(response.data) as Notebook;
|
|
||||||
removeNotebookViewerLink(notebook, data.newCellId);
|
|
||||||
|
|
||||||
if (!data.isSample) {
|
|
||||||
const metadata = notebook.metadata as { [name: string]: unknown };
|
|
||||||
metadata.untrusted = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
await container.importAndOpenContent(data.name, JSON.stringify(notebook));
|
|
||||||
logConsoleInfo(`Successfully downloaded ${data.name} to ${useNotebook.getState().notebookFolderName}`);
|
|
||||||
|
|
||||||
const increaseDownloadResponse = await junoClient.increaseNotebookDownloadCount(data.id);
|
|
||||||
if (increaseDownloadResponse.data) {
|
|
||||||
traceSuccess(
|
|
||||||
Action.NotebooksGalleryDownload,
|
|
||||||
{ notebookId: data.id, downloadCount: increaseDownloadResponse.data.downloads, isSample: data.isSample },
|
|
||||||
startKey
|
|
||||||
);
|
|
||||||
onComplete(increaseDownloadResponse.data);
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
traceFailure(
|
|
||||||
Action.NotebooksGalleryDownload,
|
|
||||||
{
|
|
||||||
notebookId: data.id,
|
notebookId: data.id,
|
||||||
downloadCount: data.downloads,
|
downloadCount: data.downloads,
|
||||||
isSample: data.isSample,
|
isSample: data.isSample,
|
||||||
error: getErrorMessage(error),
|
});
|
||||||
errorStack: getErrorStack(error),
|
|
||||||
},
|
|
||||||
startKey
|
|
||||||
);
|
|
||||||
|
|
||||||
handleError(error, "GalleryUtils/downloadItem", `Failed to download ${data.name}`);
|
try {
|
||||||
}
|
const response = await junoClient.getNotebookContent(data.id);
|
||||||
|
if (!response.data) {
|
||||||
|
throw new Error(`Received HTTP ${response.status} when fetching ${data.name}`);
|
||||||
|
}
|
||||||
|
|
||||||
clearInProgressMessage();
|
const notebook = JSON.parse(response.data) as Notebook;
|
||||||
|
removeNotebookViewerLink(notebook, data.newCellId);
|
||||||
|
|
||||||
|
if (!data.isSample) {
|
||||||
|
const metadata = notebook.metadata as { [name: string]: unknown };
|
||||||
|
metadata.untrusted = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
await container.importAndOpenContent(data.name, JSON.stringify(notebook));
|
||||||
|
logConsoleInfo(`Successfully downloaded ${name} to My Notebooks`);
|
||||||
|
|
||||||
|
const increaseDownloadResponse = await junoClient.increaseNotebookDownloadCount(data.id);
|
||||||
|
if (increaseDownloadResponse.data) {
|
||||||
|
traceSuccess(
|
||||||
|
Action.NotebooksGalleryDownload,
|
||||||
|
{ notebookId: data.id, downloadCount: increaseDownloadResponse.data.downloads, isSample: data.isSample },
|
||||||
|
startKey
|
||||||
|
);
|
||||||
|
onComplete(increaseDownloadResponse.data);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
traceFailure(
|
||||||
|
Action.NotebooksGalleryDownload,
|
||||||
|
{
|
||||||
|
notebookId: data.id,
|
||||||
|
downloadCount: data.downloads,
|
||||||
|
isSample: data.isSample,
|
||||||
|
error: getErrorMessage(error),
|
||||||
|
errorStack: getErrorStack(error),
|
||||||
|
},
|
||||||
|
startKey
|
||||||
|
);
|
||||||
|
|
||||||
|
handleError(error, "GalleryUtils/downloadItem", `Failed to download ${data.name}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
clearInProgressMessage();
|
||||||
|
},
|
||||||
|
"Cancel",
|
||||||
|
undefined
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export const removeNotebookViewerLink = (notebook: Notebook, newCellId: string): void => {
|
export const removeNotebookViewerLink = (notebook: Notebook, newCellId: string): void => {
|
||||||
if (!newCellId) {
|
if (!newCellId) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -150,7 +150,7 @@ describe("PricingUtils Tests", () => {
|
|||||||
expect(value).toBe(0.00012);
|
expect(value).toBe(0.00012);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should return 0.00032 for default cloud, 1RU, 2 region, multimaster enabled", () => {
|
it("should return 0.00048 for default cloud, 1RU, 2 region, multimaster enabled", () => {
|
||||||
const value = PricingUtils.computeRUUsagePriceHourly({
|
const value = PricingUtils.computeRUUsagePriceHourly({
|
||||||
serverId: "default",
|
serverId: "default",
|
||||||
requestUnits: 1,
|
requestUnits: 1,
|
||||||
@@ -158,9 +158,9 @@ describe("PricingUtils Tests", () => {
|
|||||||
multimasterEnabled: true,
|
multimasterEnabled: true,
|
||||||
isAutoscale: false,
|
isAutoscale: false,
|
||||||
});
|
});
|
||||||
expect(value).toBe(0.00032);
|
expect(value).toBe(0.00048);
|
||||||
});
|
});
|
||||||
it("should return 0.00032 for default cloud, 1RU, 2 region, multimaster enabled, autoscale", () => {
|
it("should return 0.00048 for default cloud, 1RU, 2 region, multimaster enabled, autoscale", () => {
|
||||||
const value = PricingUtils.computeRUUsagePriceHourly({
|
const value = PricingUtils.computeRUUsagePriceHourly({
|
||||||
serverId: "default",
|
serverId: "default",
|
||||||
requestUnits: 1,
|
requestUnits: 1,
|
||||||
@@ -168,7 +168,7 @@ describe("PricingUtils Tests", () => {
|
|||||||
multimasterEnabled: true,
|
multimasterEnabled: true,
|
||||||
isAutoscale: true,
|
isAutoscale: true,
|
||||||
});
|
});
|
||||||
expect(value).toBe(0.00032);
|
expect(value).toBe(0.00096);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -251,47 +251,70 @@ describe("PricingUtils Tests", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe("getPricePerRu()", () => {
|
describe("getPricePerRu()", () => {
|
||||||
it("should return 0.00008 for single master default clouds", () => {
|
it("should return 0.00008 for default clouds", () => {
|
||||||
const value = PricingUtils.getPricePerRu("default", 1);
|
const value = PricingUtils.getPricePerRu("default");
|
||||||
expect(value).toBe(0.00008);
|
expect(value).toBe(0.00008);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should return 0.00016 for multi master default clouds", () => {
|
it("should return 0.00051 for mooncake", () => {
|
||||||
const value = PricingUtils.getPricePerRu("default", 2);
|
const value = PricingUtils.getPricePerRu("mooncake");
|
||||||
expect(value).toBe(0.00016);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should return 0.00051 for single master mooncake", () => {
|
|
||||||
const value = PricingUtils.getPricePerRu("mooncake", 1);
|
|
||||||
expect(value).toBe(0.00051);
|
expect(value).toBe(0.00051);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should return 0.00102 for multi master mooncake", () => {
|
|
||||||
const value = PricingUtils.getPricePerRu("mooncake", 2);
|
|
||||||
expect(value).toBe(0.00102);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("getRegionMultiplier()", () => {
|
describe("getRegionMultiplier()", () => {
|
||||||
it("should return 0 for undefined", () => {
|
describe("without multimaster", () => {
|
||||||
const value = PricingUtils.getRegionMultiplier(undefined);
|
it("should return 0 for undefined", () => {
|
||||||
expect(value).toBe(0);
|
const value = PricingUtils.getRegionMultiplier(undefined, false);
|
||||||
|
expect(value).toBe(0);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should return 0 for -1", () => {
|
||||||
|
const value = PricingUtils.getRegionMultiplier(-1, false);
|
||||||
|
expect(value).toBe(0);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should return 0 for 0", () => {
|
||||||
|
const value = PricingUtils.getRegionMultiplier(0, false);
|
||||||
|
expect(value).toBe(0);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should return 1 for 1", () => {
|
||||||
|
const value = PricingUtils.getRegionMultiplier(1, false);
|
||||||
|
expect(value).toBe(1);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should return 2 for 2", () => {
|
||||||
|
const value = PricingUtils.getRegionMultiplier(2, false);
|
||||||
|
expect(value).toBe(2);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
it("should return 0 for -1", () => {
|
|
||||||
const value = PricingUtils.getRegionMultiplier(-1);
|
describe("with multimaster", () => {
|
||||||
expect(value).toBe(0);
|
it("should return 0 for undefined", () => {
|
||||||
});
|
const value = PricingUtils.getRegionMultiplier(undefined, true);
|
||||||
it("should return 0 for 0", () => {
|
expect(value).toBe(0);
|
||||||
const value = PricingUtils.getRegionMultiplier(0);
|
});
|
||||||
expect(value).toBe(0);
|
|
||||||
});
|
it("should return 0 for -1", () => {
|
||||||
it("should return 1 for 1", () => {
|
const value = PricingUtils.getRegionMultiplier(-1, true);
|
||||||
const value = PricingUtils.getRegionMultiplier(1);
|
expect(value).toBe(0);
|
||||||
expect(value).toBe(1);
|
});
|
||||||
});
|
|
||||||
it("should return 2 for 2", () => {
|
it("should return 0 for 0", () => {
|
||||||
const value = PricingUtils.getRegionMultiplier(2);
|
const value = PricingUtils.getRegionMultiplier(0, true);
|
||||||
expect(value).toBe(2);
|
expect(value).toBe(0);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should return 1 for 1", () => {
|
||||||
|
const value = PricingUtils.getRegionMultiplier(1, true);
|
||||||
|
expect(value).toBe(1);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should return 3 for 2", () => {
|
||||||
|
const value = PricingUtils.getRegionMultiplier(2, true);
|
||||||
|
expect(value).toBe(3);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -353,7 +376,7 @@ describe("PricingUtils Tests", () => {
|
|||||||
true /* multimaster */
|
true /* multimaster */
|
||||||
);
|
);
|
||||||
expect(value).toBe(
|
expect(value).toBe(
|
||||||
"Cost (USD): <b>$0.13 hourly / $3.07 daily / $93.44 monthly </b> (2 regions, 400RU/s, $0.00016/RU)<p style='padding: 10px 0px 0px 0px;'><em>*This cost is an estimate and may vary based on the regions where your account is deployed and potential discounts applied to your account</em></p>"
|
"Cost (USD): <b>$0.19 hourly / $4.61 daily / $140.16 monthly </b> (2 regions, 400RU/s, $0.00016/RU)<p style='padding: 10px 0px 0px 0px;'><em>*This cost is an estimate and may vary based on the regions where your account is deployed and potential discounts applied to your account</em></p>"
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -401,7 +424,7 @@ describe("PricingUtils Tests", () => {
|
|||||||
true /* multimaster */,
|
true /* multimaster */,
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
expect(value).toBe("I acknowledge the estimated $3.07 daily cost for the throughput above.");
|
expect(value).toBe("I acknowledge the estimated $4.61 daily cost for the throughput above.");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should return 'I acknowledge the estimated $1.54 daily cost for the throughput above.' for 400RU/s on default cloud, 2 region, without multimaster", () => {
|
it("should return 'I acknowledge the estimated $1.54 daily cost for the throughput above.' for 400RU/s on default cloud, 2 region, without multimaster", () => {
|
||||||
|
|||||||
@@ -34,18 +34,26 @@ export function getRuToolTipText(): string {
|
|||||||
* Otherwise, return numberOfRegions
|
* Otherwise, return numberOfRegions
|
||||||
* @param numberOfRegions
|
* @param numberOfRegions
|
||||||
*/
|
*/
|
||||||
export function getRegionMultiplier(numberOfRegions: number): number {
|
export function getRegionMultiplier(numberOfRegions: number, multimasterEnabled: boolean): number {
|
||||||
const normalizedNumberOfRegions: number = normalizeNumber(numberOfRegions);
|
const normalizedNumberOfRegions: number = normalizeNumber(numberOfRegions);
|
||||||
|
|
||||||
if (normalizedNumberOfRegions <= 0) {
|
if (normalizedNumberOfRegions <= 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (numberOfRegions === 1) {
|
||||||
|
return numberOfRegions;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (multimasterEnabled) {
|
||||||
|
return numberOfRegions + 1;
|
||||||
|
}
|
||||||
|
|
||||||
return numberOfRegions;
|
return numberOfRegions;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getMultimasterMultiplier(numberOfRegions: number, multimasterEnabled: boolean): number {
|
export function getMultimasterMultiplier(numberOfRegions: number, multimasterEnabled: boolean): number {
|
||||||
const regionMultiplier: number = getRegionMultiplier(numberOfRegions);
|
const regionMultiplier: number = getRegionMultiplier(numberOfRegions, multimasterEnabled);
|
||||||
const multimasterMultiplier: number = !multimasterEnabled ? 1 : regionMultiplier > 1 ? 2 : 1;
|
const multimasterMultiplier: number = !multimasterEnabled ? 1 : regionMultiplier > 1 ? 2 : 1;
|
||||||
|
|
||||||
return multimasterMultiplier;
|
return multimasterMultiplier;
|
||||||
@@ -58,12 +66,10 @@ export function computeRUUsagePriceHourly({
|
|||||||
multimasterEnabled,
|
multimasterEnabled,
|
||||||
isAutoscale,
|
isAutoscale,
|
||||||
}: ComputeRUUsagePriceHourlyArgs): number {
|
}: ComputeRUUsagePriceHourlyArgs): number {
|
||||||
const regionMultiplier: number = getRegionMultiplier(numberOfRegions);
|
const regionMultiplier: number = getRegionMultiplier(numberOfRegions, multimasterEnabled);
|
||||||
const multimasterMultiplier: number = getMultimasterMultiplier(numberOfRegions, multimasterEnabled);
|
const multimasterMultiplier: number = getMultimasterMultiplier(numberOfRegions, multimasterEnabled);
|
||||||
const pricePerRu = isAutoscale
|
const pricePerRu = isAutoscale ? getAutoscalePricePerRu(serverId, multimasterMultiplier) : getPricePerRu(serverId);
|
||||||
? getAutoscalePricePerRu(serverId, multimasterMultiplier)
|
const ruCharge = requestUnits * pricePerRu * multimasterMultiplier * regionMultiplier;
|
||||||
: getPricePerRu(serverId, multimasterMultiplier);
|
|
||||||
const ruCharge = requestUnits * pricePerRu * regionMultiplier;
|
|
||||||
|
|
||||||
return Number(ruCharge.toFixed(5));
|
return Number(ruCharge.toFixed(5));
|
||||||
}
|
}
|
||||||
@@ -143,16 +149,12 @@ export function getAutoscalePricePerRu(serverId: string, mmMultiplier: number):
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getPricePerRu(serverId: string, mmMultiplier: number): number {
|
export function getPricePerRu(serverId: string): number {
|
||||||
if (serverId === "mooncake") {
|
if (serverId === "mooncake") {
|
||||||
return mmMultiplier > 1
|
return Constants.OfferPricing.HourlyPricing.mooncake.Standard.PricePerRU;
|
||||||
? Constants.OfferPricing.HourlyPricing.mooncake.Standard.MultiMasterPricePerRU
|
|
||||||
: Constants.OfferPricing.HourlyPricing.mooncake.Standard.SingleMasterPricePerRU;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return mmMultiplier > 1
|
return Constants.OfferPricing.HourlyPricing.default.Standard.PricePerRU;
|
||||||
? Constants.OfferPricing.HourlyPricing.default.Standard.MultiMasterPricePerRU
|
|
||||||
: Constants.OfferPricing.HourlyPricing.default.Standard.SingleMasterPricePerRU;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getAutoPilotV3SpendHtml(maxAutoPilotThroughputSet: number, isDatabaseThroughput: boolean): string {
|
export function getAutoPilotV3SpendHtml(maxAutoPilotThroughputSet: number, isDatabaseThroughput: boolean): string {
|
||||||
@@ -186,7 +188,9 @@ export function getEstimatedAutoscaleSpendHtml(
|
|||||||
const monthlyPrice: number = hourlyPrice * Constants.hoursInAMonth;
|
const monthlyPrice: number = hourlyPrice * Constants.hoursInAMonth;
|
||||||
const currency: string = getPriceCurrency(serverId);
|
const currency: string = getPriceCurrency(serverId);
|
||||||
const currencySign: string = getCurrencySign(serverId);
|
const currencySign: string = getCurrencySign(serverId);
|
||||||
const pricePerRu = getAutoscalePricePerRu(serverId, getMultimasterMultiplier(regions, multimaster));
|
const pricePerRu =
|
||||||
|
getAutoscalePricePerRu(serverId, getMultimasterMultiplier(regions, multimaster)) *
|
||||||
|
getMultimasterMultiplier(regions, multimaster);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
`Estimated monthly cost (${currency}): <b>` +
|
`Estimated monthly cost (${currency}): <b>` +
|
||||||
@@ -215,7 +219,7 @@ export function getEstimatedSpendHtml(
|
|||||||
const monthlyPrice: number = hourlyPrice * Constants.hoursInAMonth;
|
const monthlyPrice: number = hourlyPrice * Constants.hoursInAMonth;
|
||||||
const currency: string = getPriceCurrency(serverId);
|
const currency: string = getPriceCurrency(serverId);
|
||||||
const currencySign: string = getCurrencySign(serverId);
|
const currencySign: string = getCurrencySign(serverId);
|
||||||
const pricePerRu = getPricePerRu(serverId, getMultimasterMultiplier(regions, multimaster));
|
const pricePerRu = getPricePerRu(serverId) * getMultimasterMultiplier(regions, multimaster);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
`Cost (${currency}): <b>` +
|
`Cost (${currency}): <b>` +
|
||||||
|
|||||||
@@ -56,7 +56,6 @@ export function useAADAuth(): ReturnType {
|
|||||||
});
|
});
|
||||||
setTenantId(response.tenantId);
|
setTenantId(response.tenantId);
|
||||||
setAccount(response.account);
|
setAccount(response.account);
|
||||||
localStorage.setItem("cachedTenantId", response.tenantId);
|
|
||||||
},
|
},
|
||||||
[account, tenantId]
|
[account, tenantId]
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -98,11 +98,9 @@ async function configureHostedWithAAD(config: AAD): Promise<Explorer> {
|
|||||||
const msalInstance = getMsalInstance();
|
const msalInstance = getMsalInstance();
|
||||||
const cachedAccount = msalInstance.getAllAccounts()?.[0];
|
const cachedAccount = msalInstance.getAllAccounts()?.[0];
|
||||||
msalInstance.setActiveAccount(cachedAccount);
|
msalInstance.setActiveAccount(cachedAccount);
|
||||||
const cachedTenantId = localStorage.getItem("cachedTenantId");
|
|
||||||
const aadTokenResponse = await msalInstance.acquireTokenSilent({
|
const aadTokenResponse = await msalInstance.acquireTokenSilent({
|
||||||
forceRefresh: true,
|
forceRefresh: true,
|
||||||
scopes: [hrefEndpoint],
|
scopes: [hrefEndpoint],
|
||||||
authority: `${configContext.AAD_ENDPOINT}${cachedTenantId}`,
|
|
||||||
});
|
});
|
||||||
aadToken = aadTokenResponse.accessToken;
|
aadToken = aadTokenResponse.accessToken;
|
||||||
}
|
}
|
||||||
@@ -339,9 +337,6 @@ function updateContextsFromPortalMessage(inputs: DataExplorerInputsFrame) {
|
|||||||
if (inputs.flights.indexOf(Flights.PKPartitionKeyTest) !== -1) {
|
if (inputs.flights.indexOf(Flights.PKPartitionKeyTest) !== -1) {
|
||||||
userContext.features.partitionKeyDefault2 = true;
|
userContext.features.partitionKeyDefault2 = true;
|
||||||
}
|
}
|
||||||
if (inputs.flights.indexOf(Flights.Phoenix) !== -1) {
|
|
||||||
userContext.features.phoenix = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user