mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2026-01-06 03:00:23 +00:00
Compare commits
7 Commits
PROD-2021-
...
languy-res
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a17d71d76e | ||
|
|
faf2e3b559 | ||
|
|
7e992c2b17 | ||
|
|
21b92ed4f8 | ||
|
|
e5755dff39 | ||
|
|
e48a6a10cb | ||
|
|
4480a7250d |
@@ -24,6 +24,7 @@ src/Common/ObjectCache.test.ts
|
|||||||
src/Common/ObjectCache.ts
|
src/Common/ObjectCache.ts
|
||||||
src/Common/QueriesClient.ts
|
src/Common/QueriesClient.ts
|
||||||
src/Common/Splitter.ts
|
src/Common/Splitter.ts
|
||||||
|
src/Common/UrlUtility.ts
|
||||||
src/Config.ts
|
src/Config.ts
|
||||||
src/Contracts/ActionContracts.ts
|
src/Contracts/ActionContracts.ts
|
||||||
src/Contracts/DataModels.ts
|
src/Contracts/DataModels.ts
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ Jest and Puppeteer are used for end to end browser based tests and are contained
|
|||||||
|
|
||||||
We generally adhere to the release strategy [documented by the Azure SDK Guidelines](https://azure.github.io/azure-sdk/policies_repobranching.html#release-branches). Most releases should happen from the master branch. If master contains commits that cannot be released, you may create a release from a `release/` or `hotfix/` branch. See linked documentation for more details.
|
We generally adhere to the release strategy [documented by the Azure SDK Guidelines](https://azure.github.io/azure-sdk/policies_repobranching.html#release-branches). Most releases should happen from the master branch. If master contains commits that cannot be released, you may create a release from a `release/` or `hotfix/` branch. See linked documentation for more details.
|
||||||
|
|
||||||
### Architecture
|
### Architechture
|
||||||
|
|
||||||
[](https://mermaid-js.github.io/mermaid-live-editor/#/edit/eyJjb2RlIjoiZ3JhcGggTFJcbiAgaG9zdGVkKGh0dHBzOi8vY29zbW9zLmF6dXJlLmNvbSlcbiAgcG9ydGFsKFBvcnRhbClcbiAgZW11bGF0b3IoRW11bGF0b3IpXG4gIGFhZFtBQURdXG4gIHJlc291cmNlVG9rZW5bUmVzb3VyY2UgVG9rZW5dXG4gIGNvbm5lY3Rpb25TdHJpbmdbQ29ubmVjdGlvbiBTdHJpbmddXG4gIHBvcnRhbFRva2VuW0VuY3J5cHRlZCBQb3J0YWwgVG9rZW5dXG4gIG1hc3RlcktleVtNYXN0ZXIgS2V5XVxuICBhcm1bQVJNIFJlc291cmNlIFByb3ZpZGVyXVxuICBkYXRhcGxhbmVbRGF0YSBQbGFuZV1cbiAgcHJveHlbUG9ydGFsIEFQSSBQcm94eV1cbiAgc3FsW1NRTF1cbiAgbW9uZ29bTW9uZ29dXG4gIHRhYmxlc1tUYWJsZXNdXG4gIGNhc3NhbmRyYVtDYXNzYW5kcmFdXG4gIGdyYWZbR3JhcGhdXG5cblxuICBlbXVsYXRvciAtLT4gbWFzdGVyS2V5IC0tLS0-IGRhdGFwbGFuZVxuICBwb3J0YWwgLS0-IGFhZFxuICBob3N0ZWQgLS0-IHBvcnRhbFRva2VuICYgcmVzb3VyY2VUb2tlbiAmIGNvbm5lY3Rpb25TdHJpbmcgJiBhYWRcbiAgYWFkIC0tLT4gYXJtXG4gIGFhZCAtLS0-IGRhdGFwbGFuZVxuICBhYWQgLS0tPiBwcm94eVxuICByZXNvdXJjZVRva2VuIC0tLT4gc3FsIC0tPiBkYXRhcGxhbmVcbiAgcG9ydGFsVG9rZW4gLS0tPiBwcm94eVxuICBwcm94eSAtLT4gZGF0YXBsYW5lXG4gIGNvbm5lY3Rpb25TdHJpbmcgLS0-IHNxbCAmIG1vbmdvICYgY2Fzc2FuZHJhICYgZ3JhZiAmIHRhYmxlc1xuICBzcWwgLS0-IGRhdGFwbGFuZVxuICB0YWJsZXMgLS0-IGRhdGFwbGFuZVxuICBtb25nbyAtLT4gcHJveHlcbiAgY2Fzc2FuZHJhIC0tPiBwcm94eVxuICBncmFmIC0tPiBwcm94eVxuXG5cdFx0IiwibWVybWFpZCI6eyJ0aGVtZSI6ImRlZmF1bHQifSwidXBkYXRlRWRpdG9yIjpmYWxzZX0)
|
[](https://mermaid-js.github.io/mermaid-live-editor/#/edit/eyJjb2RlIjoiZ3JhcGggTFJcbiAgaG9zdGVkKGh0dHBzOi8vY29zbW9zLmF6dXJlLmNvbSlcbiAgcG9ydGFsKFBvcnRhbClcbiAgZW11bGF0b3IoRW11bGF0b3IpXG4gIGFhZFtBQURdXG4gIHJlc291cmNlVG9rZW5bUmVzb3VyY2UgVG9rZW5dXG4gIGNvbm5lY3Rpb25TdHJpbmdbQ29ubmVjdGlvbiBTdHJpbmddXG4gIHBvcnRhbFRva2VuW0VuY3J5cHRlZCBQb3J0YWwgVG9rZW5dXG4gIG1hc3RlcktleVtNYXN0ZXIgS2V5XVxuICBhcm1bQVJNIFJlc291cmNlIFByb3ZpZGVyXVxuICBkYXRhcGxhbmVbRGF0YSBQbGFuZV1cbiAgcHJveHlbUG9ydGFsIEFQSSBQcm94eV1cbiAgc3FsW1NRTF1cbiAgbW9uZ29bTW9uZ29dXG4gIHRhYmxlc1tUYWJsZXNdXG4gIGNhc3NhbmRyYVtDYXNzYW5kcmFdXG4gIGdyYWZbR3JhcGhdXG5cblxuICBlbXVsYXRvciAtLT4gbWFzdGVyS2V5IC0tLS0-IGRhdGFwbGFuZVxuICBwb3J0YWwgLS0-IGFhZFxuICBob3N0ZWQgLS0-IHBvcnRhbFRva2VuICYgcmVzb3VyY2VUb2tlbiAmIGNvbm5lY3Rpb25TdHJpbmcgJiBhYWRcbiAgYWFkIC0tLT4gYXJtXG4gIGFhZCAtLS0-IGRhdGFwbGFuZVxuICBhYWQgLS0tPiBwcm94eVxuICByZXNvdXJjZVRva2VuIC0tLT4gc3FsIC0tPiBkYXRhcGxhbmVcbiAgcG9ydGFsVG9rZW4gLS0tPiBwcm94eVxuICBwcm94eSAtLT4gZGF0YXBsYW5lXG4gIGNvbm5lY3Rpb25TdHJpbmcgLS0-IHNxbCAmIG1vbmdvICYgY2Fzc2FuZHJhICYgZ3JhZiAmIHRhYmxlc1xuICBzcWwgLS0-IGRhdGFwbGFuZVxuICB0YWJsZXMgLS0-IGRhdGFwbGFuZVxuICBtb25nbyAtLT4gcHJveHlcbiAgY2Fzc2FuZHJhIC0tPiBwcm94eVxuICBncmFmIC0tPiBwcm94eVxuXG5cdFx0IiwibWVybWFpZCI6eyJ0aGVtZSI6ImRlZmF1bHQifSwidXBkYXRlRWRpdG9yIjpmYWxzZX0)
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,5 @@ module.exports = {
|
|||||||
defaultViewport: null,
|
defaultViewport: null,
|
||||||
ignoreHTTPSErrors: true,
|
ignoreHTTPSErrors: true,
|
||||||
args: ["--disable-web-security"],
|
args: ["--disable-web-security"],
|
||||||
exitOnPageError: false,
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -21,13 +21,17 @@ module.exports = {
|
|||||||
collectCoverage: true,
|
collectCoverage: true,
|
||||||
|
|
||||||
// An array of glob patterns indicating a set of files for which coverage information should be collected
|
// An array of glob patterns indicating a set of files for which coverage information should be collected
|
||||||
collectCoverageFrom: ["src/**/*.{js,jsx,ts,tsx}"],
|
// collectCoverageFrom: [
|
||||||
|
// "src/Common/Headers*"
|
||||||
|
// ],
|
||||||
|
|
||||||
// The directory where Jest should output its coverage files
|
// The directory where Jest should output its coverage files
|
||||||
coverageDirectory: "coverage",
|
coverageDirectory: "coverage",
|
||||||
|
|
||||||
// An array of regexp pattern strings used to skip coverage collection
|
// An array of regexp pattern strings used to skip coverage collection
|
||||||
coveragePathIgnorePatterns: ["/node_modules/"],
|
// coveragePathIgnorePatterns: [
|
||||||
|
// "/node_modules/"
|
||||||
|
// ],
|
||||||
|
|
||||||
// A list of reporter names that Jest uses when writing coverage reports
|
// A list of reporter names that Jest uses when writing coverage reports
|
||||||
coverageReporters: ["json", "text", "cobertura"],
|
coverageReporters: ["json", "text", "cobertura"],
|
||||||
@@ -35,10 +39,10 @@ module.exports = {
|
|||||||
// An object that configures minimum threshold enforcement for coverage results
|
// An object that configures minimum threshold enforcement for coverage results
|
||||||
coverageThreshold: {
|
coverageThreshold: {
|
||||||
global: {
|
global: {
|
||||||
branches: 25,
|
branches: 22,
|
||||||
functions: 25,
|
functions: 28,
|
||||||
lines: 30,
|
lines: 33,
|
||||||
statements: 30,
|
statements: 31,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
.main {
|
.main {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
border-right: 1px solid @BaseMedium;
|
||||||
}
|
}
|
||||||
|
|
||||||
.resourceTreeScroll {
|
.resourceTreeScroll {
|
||||||
|
|||||||
26621
package-lock.json
generated
26621
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
12
package.json
12
package.json
@@ -80,7 +80,7 @@
|
|||||||
"ms": "2.1.3",
|
"ms": "2.1.3",
|
||||||
"msal": "1.4.4",
|
"msal": "1.4.4",
|
||||||
"object.entries": "1.1.0",
|
"object.entries": "1.1.0",
|
||||||
"office-ui-fabric-react": "7.164.2",
|
"office-ui-fabric-react": "7.134.1",
|
||||||
"p-retry": "4.2.0",
|
"p-retry": "4.2.0",
|
||||||
"plotly.js-cartesian-dist-min": "1.52.3",
|
"plotly.js-cartesian-dist-min": "1.52.3",
|
||||||
"promise-polyfill": "8.1.0",
|
"promise-polyfill": "8.1.0",
|
||||||
@@ -121,15 +121,15 @@
|
|||||||
"@types/d3": "5.9.2",
|
"@types/d3": "5.9.2",
|
||||||
"@types/enzyme": "3.10.7",
|
"@types/enzyme": "3.10.7",
|
||||||
"@types/enzyme-adapter-react-16": "1.0.6",
|
"@types/enzyme-adapter-react-16": "1.0.6",
|
||||||
"@types/expect-puppeteer": "4.4.5",
|
"@types/expect-puppeteer": "4.4.3",
|
||||||
"@types/hasher": "0.0.31",
|
"@types/hasher": "0.0.31",
|
||||||
"@types/jest": "26.0.20",
|
"@types/jest": "26.0.20",
|
||||||
"@types/jest-environment-puppeteer": "4.4.1",
|
"@types/jest-environment-puppeteer": "4.3.2",
|
||||||
"@types/memoize-one": "4.1.1",
|
"@types/memoize-one": "4.1.1",
|
||||||
"@types/node": "12.11.1",
|
"@types/node": "12.11.1",
|
||||||
"@types/promise.prototype.finally": "2.0.3",
|
"@types/promise.prototype.finally": "2.0.3",
|
||||||
"@types/prop-types": "15.5.8",
|
"@types/prop-types": "15.5.8",
|
||||||
"@types/puppeteer": "5.4.3",
|
"@types/puppeteer": "3.0.1",
|
||||||
"@types/q": "1.5.1",
|
"@types/q": "1.5.1",
|
||||||
"@types/react": "17.0.0",
|
"@types/react": "17.0.0",
|
||||||
"@types/react-dom": "17.0.0",
|
"@types/react-dom": "17.0.0",
|
||||||
@@ -176,7 +176,7 @@
|
|||||||
"monaco-editor-webpack-plugin": "1.7.0",
|
"monaco-editor-webpack-plugin": "1.7.0",
|
||||||
"node-fetch": "2.6.1",
|
"node-fetch": "2.6.1",
|
||||||
"prettier": "2.2.1",
|
"prettier": "2.2.1",
|
||||||
"puppeteer": "8.0.0",
|
"puppeteer": "4.0.0",
|
||||||
"raw-loader": "0.5.1",
|
"raw-loader": "0.5.1",
|
||||||
"rimraf": "3.0.0",
|
"rimraf": "3.0.0",
|
||||||
"sinon": "3.2.1",
|
"sinon": "3.2.1",
|
||||||
@@ -238,4 +238,4 @@
|
|||||||
"prettier": {
|
"prettier": {
|
||||||
"printWidth": 120
|
"printWidth": 120
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -120,7 +120,6 @@ export class Features {
|
|||||||
public static readonly enableDatabaseSettingsTabV1 = "enabledbsettingsv1";
|
public static readonly enableDatabaseSettingsTabV1 = "enabledbsettingsv1";
|
||||||
public static readonly selfServeType = "selfservetype";
|
public static readonly selfServeType = "selfservetype";
|
||||||
public static readonly enableKOPanel = "enablekopanel";
|
public static readonly enableKOPanel = "enablekopanel";
|
||||||
public static readonly enableReactPane = "enablereactpane";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// flight names returned from the portal are always lowercase
|
// flight names returned from the portal are always lowercase
|
||||||
@@ -393,6 +392,9 @@ export class Notebook {
|
|||||||
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 MyNotebooksTitle = "My Notebooks";
|
||||||
|
public static readonly GitHubReposTitle = "GitHub repos";
|
||||||
}
|
}
|
||||||
|
|
||||||
export class SparkLibrary {
|
export class SparkLibrary {
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
|
import { MessageTypes } from "../Contracts/ExplorerContracts";
|
||||||
import Q from "q";
|
import Q from "q";
|
||||||
import * as _ from "underscore";
|
import * as _ from "underscore";
|
||||||
import { MessageTypes } from "../Contracts/ExplorerContracts";
|
|
||||||
import { getDataExplorerWindow } from "../Utils/WindowUtils";
|
|
||||||
import * as Constants from "./Constants";
|
import * as Constants from "./Constants";
|
||||||
|
import { getDataExplorerWindow } from "../Utils/WindowUtils";
|
||||||
|
|
||||||
export interface CachedDataPromise<T> {
|
export interface CachedDataPromise<T> {
|
||||||
deferred: Q.Deferred<T>;
|
deferred: Q.Deferred<T>;
|
||||||
@@ -61,21 +61,6 @@ export function sendMessage(data: any): void {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function sendReadyMessage(): void {
|
|
||||||
if (canSendMessage()) {
|
|
||||||
// We try to find data explorer window first, then fallback to current window
|
|
||||||
const portalChildWindow = getDataExplorerWindow(window) || window;
|
|
||||||
portalChildWindow.parent.postMessage(
|
|
||||||
{
|
|
||||||
signature: "pcIframe",
|
|
||||||
kind: "ready",
|
|
||||||
data: "ready",
|
|
||||||
},
|
|
||||||
portalChildWindow.document.referrer
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export function canSendMessage(): boolean {
|
export function canSendMessage(): boolean {
|
||||||
return window.parent !== window;
|
return window.parent !== window;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,61 +1,55 @@
|
|||||||
interface Result {
|
export default class UrlUtility {
|
||||||
type?: string;
|
public static parseDocumentsPath(resourcePath: string): any {
|
||||||
objectBody?: {
|
if (typeof resourcePath !== "string") {
|
||||||
id: string;
|
return {};
|
||||||
self: string;
|
}
|
||||||
};
|
|
||||||
}
|
if (resourcePath.length === 0) {
|
||||||
|
return {};
|
||||||
export function parseDocumentsPath(resourcePath: string): Result {
|
}
|
||||||
if (typeof resourcePath !== "string") {
|
|
||||||
return {};
|
if (resourcePath[resourcePath.length - 1] !== "/") {
|
||||||
}
|
resourcePath = resourcePath + "/";
|
||||||
|
}
|
||||||
if (resourcePath.length === 0) {
|
|
||||||
return {};
|
if (resourcePath[0] !== "/") {
|
||||||
}
|
resourcePath = "/" + resourcePath;
|
||||||
|
}
|
||||||
if (resourcePath[resourcePath.length - 1] !== "/") {
|
|
||||||
resourcePath = resourcePath + "/";
|
var id: string;
|
||||||
}
|
var type: string;
|
||||||
|
var pathParts = resourcePath.split("/");
|
||||||
if (resourcePath[0] !== "/") {
|
|
||||||
resourcePath = "/" + resourcePath;
|
if (pathParts.length % 2 === 0) {
|
||||||
}
|
id = pathParts[pathParts.length - 2];
|
||||||
|
type = pathParts[pathParts.length - 3];
|
||||||
let id: string;
|
} else {
|
||||||
let type: string;
|
id = pathParts[pathParts.length - 3];
|
||||||
const pathParts = resourcePath.split("/");
|
type = pathParts[pathParts.length - 2];
|
||||||
|
}
|
||||||
if (pathParts.length % 2 === 0) {
|
|
||||||
id = pathParts[pathParts.length - 2];
|
var result = {
|
||||||
type = pathParts[pathParts.length - 3];
|
type: type,
|
||||||
} else {
|
objectBody: {
|
||||||
id = pathParts[pathParts.length - 3];
|
id: id,
|
||||||
type = pathParts[pathParts.length - 2];
|
self: resourcePath,
|
||||||
}
|
},
|
||||||
|
};
|
||||||
const result = {
|
|
||||||
type: type,
|
return result;
|
||||||
objectBody: {
|
}
|
||||||
id: id,
|
|
||||||
self: resourcePath,
|
public static createUri(baseUri: string, relativeUri: string): string {
|
||||||
},
|
if (!baseUri) {
|
||||||
};
|
throw new Error("baseUri is null or empty");
|
||||||
|
}
|
||||||
return result;
|
|
||||||
}
|
var slashAtEndOfUriRegex = /\/$/,
|
||||||
|
slashAtStartOfUriRegEx = /^\//;
|
||||||
export function createUri(baseUri: string, relativeUri: string): string {
|
|
||||||
if (!baseUri) {
|
var normalizedBaseUri = baseUri.replace(slashAtEndOfUriRegex, "") + "/",
|
||||||
throw new Error("baseUri is null or empty");
|
normalizedRelativeUri = (relativeUri && relativeUri.replace(slashAtStartOfUriRegEx, "")) || "";
|
||||||
}
|
|
||||||
|
return normalizedBaseUri + normalizedRelativeUri;
|
||||||
const slashAtEndOfUriRegex = /\/$/,
|
}
|
||||||
slashAtStartOfUriRegEx = /^\//;
|
|
||||||
|
|
||||||
const normalizedBaseUri = baseUri.replace(slashAtEndOfUriRegex, "") + "/",
|
|
||||||
normalizedRelativeUri = (relativeUri && relativeUri.replace(slashAtStartOfUriRegEx, "")) || "";
|
|
||||||
|
|
||||||
return normalizedBaseUri + normalizedRelativeUri;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -390,6 +390,7 @@ export interface DataExplorerInputsFrame {
|
|||||||
sharedThroughputMaximum?: number;
|
sharedThroughputMaximum?: number;
|
||||||
sharedThroughputDefault?: number;
|
sharedThroughputDefault?: number;
|
||||||
dataExplorerVersion?: string;
|
dataExplorerVersion?: string;
|
||||||
|
isAuthWithresourceToken?: boolean;
|
||||||
defaultCollectionThroughput?: CollectionCreationDefaults;
|
defaultCollectionThroughput?: CollectionCreationDefaults;
|
||||||
flights?: readonly string[];
|
flights?: readonly string[];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,5 @@
|
|||||||
import dayjs from "dayjs";
|
|
||||||
import * as Plotly from "plotly.js-cartesian-dist-min";
|
import * as Plotly from "plotly.js-cartesian-dist-min";
|
||||||
import { StyleConstants } from "../../Common/Constants";
|
import dayjs from "dayjs";
|
||||||
import { sendCachedDataMessage, sendReadyMessage } from "../../Common/MessageHandler";
|
|
||||||
import { MessageTypes } from "../../Contracts/ExplorerContracts";
|
|
||||||
import { isInvalidParentFrameOrigin } from "../../Utils/MessageValidation";
|
|
||||||
import "./Heatmap.less";
|
|
||||||
import {
|
import {
|
||||||
ChartSettings,
|
ChartSettings,
|
||||||
DataPayload,
|
DataPayload,
|
||||||
@@ -16,6 +11,11 @@ import {
|
|||||||
PartitionTimeStampToData,
|
PartitionTimeStampToData,
|
||||||
PortalTheme,
|
PortalTheme,
|
||||||
} from "./HeatmapDatatypes";
|
} from "./HeatmapDatatypes";
|
||||||
|
import { isInvalidParentFrameOrigin } from "../../Utils/MessageValidation";
|
||||||
|
import { sendCachedDataMessage, sendMessage } from "../../Common/MessageHandler";
|
||||||
|
import { MessageTypes } from "../../Contracts/ExplorerContracts";
|
||||||
|
import { StyleConstants } from "../../Common/Constants";
|
||||||
|
import "./Heatmap.less";
|
||||||
|
|
||||||
export class Heatmap {
|
export class Heatmap {
|
||||||
public static readonly elementId: string = "heatmap";
|
public static readonly elementId: string = "heatmap";
|
||||||
@@ -266,4 +266,4 @@ export function handleMessage(event: MessageEvent) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
window.addEventListener("message", handleMessage, false);
|
window.addEventListener("message", handleMessage, false);
|
||||||
sendReadyMessage();
|
sendMessage("ready");
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ describe("CollapsibleSectionComponent", () => {
|
|||||||
it("renders", () => {
|
it("renders", () => {
|
||||||
const props: CollapsibleSectionProps = {
|
const props: CollapsibleSectionProps = {
|
||||||
title: "Sample title",
|
title: "Sample title",
|
||||||
isExpandedByDefault: true,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const wrapper = shallow(<CollapsibleSectionComponent {...props} />);
|
const wrapper = shallow(<CollapsibleSectionComponent {...props} />);
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
import { Icon, Label, Stack } from "office-ui-fabric-react";
|
import { Icon, Label, Stack } from "office-ui-fabric-react";
|
||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
import { accordionStackTokens } from "../Settings/SettingsRenderUtils";
|
import { accordionIconStyles, accordionStackTokens } from "../Settings/SettingsRenderUtils";
|
||||||
|
|
||||||
export interface CollapsibleSectionProps {
|
export interface CollapsibleSectionProps {
|
||||||
title: string;
|
title: string;
|
||||||
isExpandedByDefault: boolean;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CollapsibleSectionState {
|
export interface CollapsibleSectionState {
|
||||||
@@ -15,7 +14,7 @@ export class CollapsibleSectionComponent extends React.Component<CollapsibleSect
|
|||||||
constructor(props: CollapsibleSectionProps) {
|
constructor(props: CollapsibleSectionProps) {
|
||||||
super(props);
|
super(props);
|
||||||
this.state = {
|
this.state = {
|
||||||
isExpanded: this.props.isExpandedByDefault,
|
isExpanded: true,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -26,14 +25,8 @@ export class CollapsibleSectionComponent extends React.Component<CollapsibleSect
|
|||||||
public render(): JSX.Element {
|
public render(): JSX.Element {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Stack
|
<Stack className="collapsibleSection" horizontal tokens={accordionStackTokens} onClick={this.toggleCollapsed}>
|
||||||
className="collapsibleSection"
|
<Icon iconName={this.state.isExpanded ? "ChevronDown" : "ChevronRight"} styles={accordionIconStyles} />
|
||||||
horizontal
|
|
||||||
verticalAlign="center"
|
|
||||||
tokens={accordionStackTokens}
|
|
||||||
onClick={this.toggleCollapsed}
|
|
||||||
>
|
|
||||||
<Icon iconName={this.state.isExpanded ? "ChevronDown" : "ChevronRight"} />
|
|
||||||
<Label>{this.props.title}</Label>
|
<Label>{this.props.title}</Label>
|
||||||
</Stack>
|
</Stack>
|
||||||
{this.state.isExpanded && this.props.children}
|
{this.state.isExpanded && this.props.children}
|
||||||
|
|||||||
@@ -11,10 +11,16 @@ exports[`CollapsibleSectionComponent renders 1`] = `
|
|||||||
"childrenGap": 10,
|
"childrenGap": 10,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
verticalAlign="center"
|
|
||||||
>
|
>
|
||||||
<Icon
|
<StyledIconBase
|
||||||
iconName="ChevronDown"
|
iconName="ChevronDown"
|
||||||
|
styles={
|
||||||
|
Object {
|
||||||
|
"root": Object {
|
||||||
|
"paddingTop": 7,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
<StyledLabelBase>
|
<StyledLabelBase>
|
||||||
Sample title
|
Sample title
|
||||||
|
|||||||
@@ -354,6 +354,7 @@ exports[`test render renders with filters 1`] = `
|
|||||||
data-is-scrollable="true"
|
data-is-scrollable="true"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
|
aria-hidden="true"
|
||||||
className="stickyAbove-42"
|
className="stickyAbove-42"
|
||||||
style={
|
style={
|
||||||
Object {
|
Object {
|
||||||
@@ -374,6 +375,7 @@ exports[`test render renders with filters 1`] = `
|
|||||||
>
|
>
|
||||||
<div>
|
<div>
|
||||||
<div
|
<div
|
||||||
|
aria-hidden={true}
|
||||||
style={
|
style={
|
||||||
Object {
|
Object {
|
||||||
"pointerEvents": "none",
|
"pointerEvents": "none",
|
||||||
@@ -393,6 +395,7 @@ exports[`test render renders with filters 1`] = `
|
|||||||
style={Object {}}
|
style={Object {}}
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
|
aria-hidden={false}
|
||||||
style={
|
style={
|
||||||
Object {
|
Object {
|
||||||
"backgroundColor": "",
|
"backgroundColor": "",
|
||||||
@@ -408,7 +411,6 @@ exports[`test render renders with filters 1`] = `
|
|||||||
>
|
>
|
||||||
<TextFieldBase
|
<TextFieldBase
|
||||||
ariaLabel="Directory filter text box"
|
ariaLabel="Directory filter text box"
|
||||||
canRevealPassword={false}
|
|
||||||
className="directoryListFilterTextBox"
|
className="directoryListFilterTextBox"
|
||||||
deferredValidationTime={200}
|
deferredValidationTime={200}
|
||||||
onChange={[Function]}
|
onChange={[Function]}
|
||||||
@@ -1121,7 +1123,7 @@ exports[`test render renders with filters 1`] = `
|
|||||||
"iconDisabled": Object {
|
"iconDisabled": Object {
|
||||||
"color": "#a19f9d",
|
"color": "#a19f9d",
|
||||||
"selectors": Object {
|
"selectors": Object {
|
||||||
"@media screen and (-ms-high-contrast: active), (forced-colors: active)": Object {
|
"@media screen and (-ms-high-contrast: active)": Object {
|
||||||
"color": "GrayText",
|
"color": "GrayText",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -1147,7 +1149,7 @@ exports[`test render renders with filters 1`] = `
|
|||||||
"menuIconDisabled": Object {
|
"menuIconDisabled": Object {
|
||||||
"color": "#a19f9d",
|
"color": "#a19f9d",
|
||||||
"selectors": Object {
|
"selectors": Object {
|
||||||
"@media screen and (-ms-high-contrast: active), (forced-colors: active)": Object {
|
"@media screen and (-ms-high-contrast: active)": Object {
|
||||||
"color": "GrayText",
|
"color": "GrayText",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -1166,7 +1168,7 @@ exports[`test render renders with filters 1`] = `
|
|||||||
"position": "absolute",
|
"position": "absolute",
|
||||||
"right": 2,
|
"right": 2,
|
||||||
"selectors": Object {
|
"selectors": Object {
|
||||||
"@media screen and (-ms-high-contrast: active), (forced-colors: active)": Object {
|
"@media screen and (-ms-high-contrast: active)": Object {
|
||||||
"bottom": -2,
|
"bottom": -2,
|
||||||
"left": -2,
|
"left": -2,
|
||||||
"outlineColor": "ButtonText",
|
"outlineColor": "ButtonText",
|
||||||
@@ -1245,7 +1247,7 @@ exports[`test render renders with filters 1`] = `
|
|||||||
"position": "absolute",
|
"position": "absolute",
|
||||||
"right": 2,
|
"right": 2,
|
||||||
"selectors": Object {
|
"selectors": Object {
|
||||||
"@media screen and (-ms-high-contrast: active), (forced-colors: active)": Object {
|
"@media screen and (-ms-high-contrast: active)": Object {
|
||||||
"bottom": -2,
|
"bottom": -2,
|
||||||
"left": -2,
|
"left": -2,
|
||||||
"outlineColor": "ButtonText",
|
"outlineColor": "ButtonText",
|
||||||
@@ -1277,10 +1279,8 @@ exports[`test render renders with filters 1`] = `
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
Object {
|
Object {
|
||||||
"backgroundColor": "#f3f2f1",
|
|
||||||
"color": "#a19f9d",
|
|
||||||
"selectors": Object {
|
"selectors": Object {
|
||||||
"@media screen and (-ms-high-contrast: active), (forced-colors: active)": Object {
|
"@media screen and (-ms-high-contrast: active)": Object {
|
||||||
"backgroundColor": "Window",
|
"backgroundColor": "Window",
|
||||||
"borderColor": "GrayText",
|
"borderColor": "GrayText",
|
||||||
"color": "GrayText",
|
"color": "GrayText",
|
||||||
@@ -1300,7 +1300,7 @@ exports[`test render renders with filters 1`] = `
|
|||||||
"backgroundColor": "#f3f2f1",
|
"backgroundColor": "#f3f2f1",
|
||||||
"color": "#201f1e",
|
"color": "#201f1e",
|
||||||
"selectors": Object {
|
"selectors": Object {
|
||||||
"@media screen and (-ms-high-contrast: active), (forced-colors: active)": Object {
|
"@media screen and (-ms-high-contrast: active)": Object {
|
||||||
"borderColor": "Highlight",
|
"borderColor": "Highlight",
|
||||||
"color": "Highlight",
|
"color": "Highlight",
|
||||||
},
|
},
|
||||||
@@ -1326,7 +1326,7 @@ exports[`test render renders with filters 1`] = `
|
|||||||
"splitButtonContainer": Array [
|
"splitButtonContainer": Array [
|
||||||
Object {
|
Object {
|
||||||
"selectors": Object {
|
"selectors": Object {
|
||||||
"@media screen and (-ms-high-contrast: active), (forced-colors: active)": Object {
|
"@media screen and (-ms-high-contrast: active)": Object {
|
||||||
"border": "none",
|
"border": "none",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -1344,7 +1344,7 @@ exports[`test render renders with filters 1`] = `
|
|||||||
"position": "absolute",
|
"position": "absolute",
|
||||||
"right": 3,
|
"right": 3,
|
||||||
"selectors": Object {
|
"selectors": Object {
|
||||||
"@media screen and (-ms-high-contrast: active), (forced-colors: active)": Object {
|
"@media screen and (-ms-high-contrast: active)": Object {
|
||||||
"border": "none",
|
"border": "none",
|
||||||
"bottom": -2,
|
"bottom": -2,
|
||||||
"left": -2,
|
"left": -2,
|
||||||
@@ -1373,20 +1373,19 @@ exports[`test render renders with filters 1`] = `
|
|||||||
"borderBottomRightRadius": "0",
|
"borderBottomRightRadius": "0",
|
||||||
"borderTopRightRadius": "0",
|
"borderTopRightRadius": "0",
|
||||||
"selectors": Object {
|
"selectors": Object {
|
||||||
"@media screen and (-ms-high-contrast: active), (forced-colors: active)": Object {
|
"@media screen and (-ms-high-contrast: active)": Object {
|
||||||
"MsHighContrastAdjust": "none",
|
"MsHighContrastAdjust": "none",
|
||||||
"backgroundColor": "Window",
|
"backgroundColor": "Window",
|
||||||
"border": "1px solid WindowText",
|
"border": "1px solid WindowText",
|
||||||
"borderRightWidth": "0",
|
"borderRightWidth": "0",
|
||||||
"color": "WindowText",
|
"color": "WindowText",
|
||||||
"forcedColorAdjust": "none",
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
".ms-Button--primary + .ms-Button": Object {
|
".ms-Button--primary + .ms-Button": Object {
|
||||||
"border": "none",
|
"border": "none",
|
||||||
"selectors": Object {
|
"selectors": Object {
|
||||||
"@media screen and (-ms-high-contrast: active), (forced-colors: active)": Object {
|
"@media screen and (-ms-high-contrast: active)": Object {
|
||||||
"border": "1px solid WindowText",
|
"border": "1px solid WindowText",
|
||||||
"borderLeftWidth": "0",
|
"borderLeftWidth": "0",
|
||||||
},
|
},
|
||||||
@@ -1399,11 +1398,10 @@ exports[`test render renders with filters 1`] = `
|
|||||||
"selectors": Object {
|
"selectors": Object {
|
||||||
".ms-Button--primary": Object {
|
".ms-Button--primary": Object {
|
||||||
"selectors": Object {
|
"selectors": Object {
|
||||||
"@media screen and (-ms-high-contrast: active), (forced-colors: active)": Object {
|
"@media screen and (-ms-high-contrast: active)": Object {
|
||||||
"MsHighContrastAdjust": "none",
|
"MsHighContrastAdjust": "none",
|
||||||
"backgroundColor": "WindowText",
|
"backgroundColor": "WindowText",
|
||||||
"color": "Window",
|
"color": "Window",
|
||||||
"forcedColorAdjust": "none",
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -1413,11 +1411,10 @@ exports[`test render renders with filters 1`] = `
|
|||||||
"selectors": Object {
|
"selectors": Object {
|
||||||
".ms-Button--primary": Object {
|
".ms-Button--primary": Object {
|
||||||
"selectors": Object {
|
"selectors": Object {
|
||||||
"@media screen and (-ms-high-contrast: active), (forced-colors: active)": Object {
|
"@media screen and (-ms-high-contrast: active)": Object {
|
||||||
"MsHighContrastAdjust": "none",
|
"MsHighContrastAdjust": "none",
|
||||||
"backgroundColor": "WindowText",
|
"backgroundColor": "WindowText",
|
||||||
"color": "Window",
|
"color": "Window",
|
||||||
"forcedColorAdjust": "none",
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -1427,11 +1424,12 @@ exports[`test render renders with filters 1`] = `
|
|||||||
"border": "none",
|
"border": "none",
|
||||||
"outline": "none",
|
"outline": "none",
|
||||||
"selectors": Object {
|
"selectors": Object {
|
||||||
"@media screen and (-ms-high-contrast: active), (forced-colors: active)": Object {
|
"@media screen and (-ms-high-contrast: active)": Object {
|
||||||
"MsHighContrastAdjust": "none",
|
|
||||||
"backgroundColor": "Window",
|
"backgroundColor": "Window",
|
||||||
"borderColor": "GrayText",
|
"borderColor": "GrayText",
|
||||||
"color": "GrayText",
|
"color": "GrayText",
|
||||||
|
},
|
||||||
|
"@media screen and (forced-colors: active)": Object {
|
||||||
"forcedColorAdjust": "none",
|
"forcedColorAdjust": "none",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -1443,7 +1441,7 @@ exports[`test render renders with filters 1`] = `
|
|||||||
"selectors": Object {
|
"selectors": Object {
|
||||||
".ms-Button--primary": Object {
|
".ms-Button--primary": Object {
|
||||||
"selectors": Object {
|
"selectors": Object {
|
||||||
"@media screen and (-ms-high-contrast: active), (forced-colors: active)": Object {
|
"@media screen and (-ms-high-contrast: active)": Object {
|
||||||
"backgroundColor": "Highlight",
|
"backgroundColor": "Highlight",
|
||||||
"color": "Window",
|
"color": "Window",
|
||||||
},
|
},
|
||||||
@@ -1452,7 +1450,7 @@ exports[`test render renders with filters 1`] = `
|
|||||||
".ms-Button.is-disabled": Object {
|
".ms-Button.is-disabled": Object {
|
||||||
"color": "#a19f9d",
|
"color": "#a19f9d",
|
||||||
"selectors": Object {
|
"selectors": Object {
|
||||||
"@media screen and (-ms-high-contrast: active), (forced-colors: active)": Object {
|
"@media screen and (-ms-high-contrast: active)": Object {
|
||||||
"backgroundColor": "Window",
|
"backgroundColor": "Window",
|
||||||
"borderColor": "GrayText",
|
"borderColor": "GrayText",
|
||||||
"color": "GrayText",
|
"color": "GrayText",
|
||||||
@@ -1468,7 +1466,7 @@ exports[`test render renders with filters 1`] = `
|
|||||||
"position": "absolute",
|
"position": "absolute",
|
||||||
"right": 31,
|
"right": 31,
|
||||||
"selectors": Object {
|
"selectors": Object {
|
||||||
"@media screen and (-ms-high-contrast: active), (forced-colors: active)": Object {
|
"@media screen and (-ms-high-contrast: active)": Object {
|
||||||
"backgroundColor": "WindowText",
|
"backgroundColor": "WindowText",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -1480,7 +1478,7 @@ exports[`test render renders with filters 1`] = `
|
|||||||
"position": "absolute",
|
"position": "absolute",
|
||||||
"right": 31,
|
"right": 31,
|
||||||
"selectors": Object {
|
"selectors": Object {
|
||||||
"@media screen and (-ms-high-contrast: active), (forced-colors: active)": Object {
|
"@media screen and (-ms-high-contrast: active)": Object {
|
||||||
"backgroundColor": "WindowText",
|
"backgroundColor": "WindowText",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -1497,7 +1495,7 @@ exports[`test render renders with filters 1`] = `
|
|||||||
"position": "absolute",
|
"position": "absolute",
|
||||||
"right": 31,
|
"right": 31,
|
||||||
"selectors": Object {
|
"selectors": Object {
|
||||||
"@media screen and (-ms-high-contrast: active), (forced-colors: active)": Object {
|
"@media screen and (-ms-high-contrast: active)": Object {
|
||||||
"backgroundColor": "GrayText",
|
"backgroundColor": "GrayText",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -1520,7 +1518,7 @@ exports[`test render renders with filters 1`] = `
|
|||||||
":hover": Object {
|
":hover": Object {
|
||||||
"backgroundColor": "#edebe9",
|
"backgroundColor": "#edebe9",
|
||||||
"selectors": Object {
|
"selectors": Object {
|
||||||
"@media screen and (-ms-high-contrast: active), (forced-colors: active)": Object {
|
"@media screen and (-ms-high-contrast: active)": Object {
|
||||||
"color": "Highlight",
|
"color": "Highlight",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -1528,11 +1526,6 @@ exports[`test render renders with filters 1`] = `
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
Object {
|
Object {
|
||||||
"@media screen and (-ms-high-contrast: active), (forced-colors: active)": Object {
|
|
||||||
".ms-Button-menuIcon": Object {
|
|
||||||
"color": "WindowText",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"border": "1px solid #8a8886",
|
"border": "1px solid #8a8886",
|
||||||
"borderBottomRightRadius": "2px",
|
"borderBottomRightRadius": "2px",
|
||||||
"borderLeft": "none",
|
"borderLeft": "none",
|
||||||
@@ -1578,7 +1571,7 @@ exports[`test render renders with filters 1`] = `
|
|||||||
"selectors": Object {
|
"selectors": Object {
|
||||||
".ms-Button--primary": Object {
|
".ms-Button--primary": Object {
|
||||||
"selectors": Object {
|
"selectors": Object {
|
||||||
"@media screen and (-ms-high-contrast: active), (forced-colors: active)": Object {
|
"@media screen and (-ms-high-contrast: active)": Object {
|
||||||
"backgroundColor": "Window",
|
"backgroundColor": "Window",
|
||||||
"borderColor": "GrayText",
|
"borderColor": "GrayText",
|
||||||
"color": "GrayText",
|
"color": "GrayText",
|
||||||
@@ -1587,7 +1580,7 @@ exports[`test render renders with filters 1`] = `
|
|||||||
},
|
},
|
||||||
".ms-Button-menuIcon": Object {
|
".ms-Button-menuIcon": Object {
|
||||||
"selectors": Object {
|
"selectors": Object {
|
||||||
"@media screen and (-ms-high-contrast: active), (forced-colors: active)": Object {
|
"@media screen and (-ms-high-contrast: active)": Object {
|
||||||
"color": "GrayText",
|
"color": "GrayText",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -1595,7 +1588,7 @@ exports[`test render renders with filters 1`] = `
|
|||||||
":hover": Object {
|
":hover": Object {
|
||||||
"cursor": "default",
|
"cursor": "default",
|
||||||
},
|
},
|
||||||
"@media screen and (-ms-high-contrast: active), (forced-colors: active)": Object {
|
"@media screen and (-ms-high-contrast: active)": Object {
|
||||||
"backgroundColor": "Window",
|
"backgroundColor": "Window",
|
||||||
"border": "1px solid GrayText",
|
"border": "1px solid GrayText",
|
||||||
"color": "GrayText",
|
"color": "GrayText",
|
||||||
@@ -1900,7 +1893,7 @@ exports[`test render renders with filters 1`] = `
|
|||||||
>
|
>
|
||||||
<button
|
<button
|
||||||
aria-disabled={true}
|
aria-disabled={true}
|
||||||
className="ms-Button ms-Button--default is-disabled directoryListButton root-57"
|
className="ms-Button ms-Button--default is-disabled directoryListButton root-54"
|
||||||
data-is-focusable={false}
|
data-is-focusable={false}
|
||||||
disabled={true}
|
disabled={true}
|
||||||
onClick={[Function]}
|
onClick={[Function]}
|
||||||
@@ -1912,7 +1905,7 @@ exports[`test render renders with filters 1`] = `
|
|||||||
type="button"
|
type="button"
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
className="ms-Button-flexContainer flexContainer-58"
|
className="ms-Button-flexContainer flexContainer-55"
|
||||||
data-automationid="splitbuttonprimary"
|
data-automationid="splitbuttonprimary"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
@@ -1943,6 +1936,7 @@ exports[`test render renders with filters 1`] = `
|
|||||||
</List>
|
</List>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
|
aria-hidden="true"
|
||||||
className="stickyBelow-43"
|
className="stickyBelow-43"
|
||||||
style={
|
style={
|
||||||
Object {
|
Object {
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import { ChildrenMargin } from "./GitHubStyleConstants";
|
|||||||
import * as GitHubUtils from "../../../Utils/GitHubUtils";
|
import * as GitHubUtils from "../../../Utils/GitHubUtils";
|
||||||
import { IGitHubRepo } from "../../../GitHub/GitHubClient";
|
import { IGitHubRepo } from "../../../GitHub/GitHubClient";
|
||||||
import * as TelemetryProcessor from "../../../Shared/Telemetry/TelemetryProcessor";
|
import * as TelemetryProcessor from "../../../Shared/Telemetry/TelemetryProcessor";
|
||||||
import * as UrlUtility from "../../../Common/UrlUtility";
|
import UrlUtility from "../../../Common/UrlUtility";
|
||||||
import Explorer from "../../Explorer";
|
import Explorer from "../../Explorer";
|
||||||
|
|
||||||
export interface AddRepoComponentProps {
|
export interface AddRepoComponentProps {
|
||||||
|
|||||||
@@ -47,7 +47,6 @@ export class GalleryCardComponent extends React.Component<GalleryCardComponentPr
|
|||||||
private static readonly cardItemGapBig = 10;
|
private static readonly cardItemGapBig = 10;
|
||||||
private static readonly cardItemGapSmall = 8;
|
private static readonly cardItemGapSmall = 8;
|
||||||
private static readonly cardDeleteSpinnerHeight = 360;
|
private static readonly cardDeleteSpinnerHeight = 360;
|
||||||
private static readonly smallTextLineHeight = 18;
|
|
||||||
|
|
||||||
constructor(props: GalleryCardComponentProps) {
|
constructor(props: GalleryCardComponentProps) {
|
||||||
super(props);
|
super(props);
|
||||||
@@ -104,7 +103,7 @@ export class GalleryCardComponent extends React.Component<GalleryCardComponentPr
|
|||||||
</Card.Item>
|
</Card.Item>
|
||||||
|
|
||||||
<Card.Section styles={{ root: { padding: GalleryCardComponent.cardItemGapBig } }}>
|
<Card.Section styles={{ root: { padding: GalleryCardComponent.cardItemGapBig } }}>
|
||||||
<Text variant="small" nowrap styles={{ root: { height: GalleryCardComponent.smallTextLineHeight } }}>
|
<Text variant="small" nowrap>
|
||||||
{this.props.data.tags ? (
|
{this.props.data.tags ? (
|
||||||
this.props.data.tags.map((tag, index, array) => (
|
this.props.data.tags.map((tag, index, array) => (
|
||||||
<span key={tag}>
|
<span key={tag}>
|
||||||
@@ -130,7 +129,7 @@ export class GalleryCardComponent extends React.Component<GalleryCardComponentPr
|
|||||||
{cardTitle}
|
{cardTitle}
|
||||||
</Text>
|
</Text>
|
||||||
|
|
||||||
<Text variant="small" styles={{ root: { height: GalleryCardComponent.smallTextLineHeight * 2 } }}>
|
<Text variant="small" styles={{ root: { height: 36 } }}>
|
||||||
{this.renderTruncatedDescription()}
|
{this.renderTruncatedDescription()}
|
||||||
</Text>
|
</Text>
|
||||||
|
|
||||||
|
|||||||
@@ -50,13 +50,6 @@ exports[`GalleryCardComponent renders 1`] = `
|
|||||||
>
|
>
|
||||||
<Text
|
<Text
|
||||||
nowrap={true}
|
nowrap={true}
|
||||||
styles={
|
|
||||||
Object {
|
|
||||||
"root": Object {
|
|
||||||
"height": 18,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
variant="small"
|
variant="small"
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
@@ -107,7 +100,7 @@ exports[`GalleryCardComponent renders 1`] = `
|
|||||||
}
|
}
|
||||||
variant="tiny"
|
variant="tiny"
|
||||||
>
|
>
|
||||||
<Icon
|
<StyledIconBase
|
||||||
iconName="RedEye"
|
iconName="RedEye"
|
||||||
styles={
|
styles={
|
||||||
Object {
|
Object {
|
||||||
@@ -131,7 +124,7 @@ exports[`GalleryCardComponent renders 1`] = `
|
|||||||
}
|
}
|
||||||
variant="tiny"
|
variant="tiny"
|
||||||
>
|
>
|
||||||
<Icon
|
<StyledIconBase
|
||||||
iconName="Download"
|
iconName="Download"
|
||||||
styles={
|
styles={
|
||||||
Object {
|
Object {
|
||||||
@@ -155,7 +148,7 @@ exports[`GalleryCardComponent renders 1`] = `
|
|||||||
}
|
}
|
||||||
variant="tiny"
|
variant="tiny"
|
||||||
>
|
>
|
||||||
<Icon
|
<StyledIconBase
|
||||||
iconName="Heart"
|
iconName="Heart"
|
||||||
styles={
|
styles={
|
||||||
Object {
|
Object {
|
||||||
@@ -180,7 +173,7 @@ exports[`GalleryCardComponent renders 1`] = `
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<Separator
|
<Styled
|
||||||
styles={
|
styles={
|
||||||
Object {
|
Object {
|
||||||
"root": Object {
|
"root": Object {
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ exports[`InfoComponent renders 1`] = `
|
|||||||
<div
|
<div
|
||||||
className="infoPanelMain"
|
className="infoPanelMain"
|
||||||
>
|
>
|
||||||
<Icon
|
<StyledIconBase
|
||||||
className="infoIconMain"
|
className="infoIconMain"
|
||||||
iconName="Help"
|
iconName="Help"
|
||||||
styles={
|
styles={
|
||||||
|
|||||||
@@ -68,14 +68,14 @@ exports[`NotebookMetadataComponent renders liked notebook 1`] = `
|
|||||||
Invalid Date
|
Invalid Date
|
||||||
</Text>
|
</Text>
|
||||||
<Text>
|
<Text>
|
||||||
<Icon
|
<StyledIconBase
|
||||||
iconName="RedEye"
|
iconName="RedEye"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
0
|
0
|
||||||
</Text>
|
</Text>
|
||||||
<Text>
|
<Text>
|
||||||
<Icon
|
<StyledIconBase
|
||||||
iconName="Download"
|
iconName="Download"
|
||||||
/>
|
/>
|
||||||
0
|
0
|
||||||
@@ -180,14 +180,14 @@ exports[`NotebookMetadataComponent renders un-liked notebook 1`] = `
|
|||||||
Invalid Date
|
Invalid Date
|
||||||
</Text>
|
</Text>
|
||||||
<Text>
|
<Text>
|
||||||
<Icon
|
<StyledIconBase
|
||||||
iconName="RedEye"
|
iconName="RedEye"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
0
|
0
|
||||||
</Text>
|
</Text>
|
||||||
<Text>
|
<Text>
|
||||||
<Icon
|
<StyledIconBase
|
||||||
iconName="Download"
|
iconName="Download"
|
||||||
/>
|
/>
|
||||||
0
|
0
|
||||||
|
|||||||
@@ -1,51 +1,49 @@
|
|||||||
import { IPivotItemProps, IPivotProps, Pivot, PivotItem } from "office-ui-fabric-react";
|
|
||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
import DiscardIcon from "../../../../images/discard.svg";
|
import * as AutoPilotUtils from "../../../Utils/AutoPilotUtils";
|
||||||
import SaveIcon from "../../../../images/save-cosmos.svg";
|
|
||||||
import { AuthType } from "../../../AuthType";
|
|
||||||
import * as Constants from "../../../Common/Constants";
|
import * as Constants from "../../../Common/Constants";
|
||||||
import { getIndexTransformationProgress } from "../../../Common/dataAccess/getIndexTransformationProgress";
|
|
||||||
import { readMongoDBCollectionThroughRP } from "../../../Common/dataAccess/readMongoDBCollection";
|
|
||||||
import { updateCollection, updateMongoDBCollectionThroughRP } from "../../../Common/dataAccess/updateCollection";
|
|
||||||
import { updateOffer } from "../../../Common/dataAccess/updateOffer";
|
|
||||||
import { getErrorMessage, getErrorStack } from "../../../Common/ErrorHandlingUtils";
|
|
||||||
import * as DataModels from "../../../Contracts/DataModels";
|
import * as DataModels from "../../../Contracts/DataModels";
|
||||||
import * as ViewModels from "../../../Contracts/ViewModels";
|
import * as ViewModels from "../../../Contracts/ViewModels";
|
||||||
|
import DiscardIcon from "../../../../images/discard.svg";
|
||||||
|
import SaveIcon from "../../../../images/save-cosmos.svg";
|
||||||
|
import { traceStart, traceFailure, traceSuccess, trace } from "../../../Shared/Telemetry/TelemetryProcessor";
|
||||||
import { Action, ActionModifiers } from "../../../Shared/Telemetry/TelemetryConstants";
|
import { Action, ActionModifiers } from "../../../Shared/Telemetry/TelemetryConstants";
|
||||||
import { trace, traceFailure, traceStart, traceSuccess } from "../../../Shared/Telemetry/TelemetryProcessor";
|
|
||||||
import { userContext } from "../../../UserContext";
|
|
||||||
import { MongoDBCollectionResource, MongoIndex } from "../../../Utils/arm/generatedClients/2020-04-01/types";
|
|
||||||
import * as AutoPilotUtils from "../../../Utils/AutoPilotUtils";
|
|
||||||
import { CommandButtonComponentProps } from "../../Controls/CommandButton/CommandButtonComponent";
|
|
||||||
import Explorer from "../../Explorer";
|
import Explorer from "../../Explorer";
|
||||||
|
import { updateOffer } from "../../../Common/dataAccess/updateOffer";
|
||||||
|
import { updateCollection, updateMongoDBCollectionThroughRP } from "../../../Common/dataAccess/updateCollection";
|
||||||
|
import { CommandButtonComponentProps } from "../../Controls/CommandButton/CommandButtonComponent";
|
||||||
import { SettingsTabV2 } from "../../Tabs/SettingsTabV2";
|
import { SettingsTabV2 } from "../../Tabs/SettingsTabV2";
|
||||||
import "./SettingsComponent.less";
|
|
||||||
import { mongoIndexingPolicyAADError } from "./SettingsRenderUtils";
|
import { mongoIndexingPolicyAADError } from "./SettingsRenderUtils";
|
||||||
import {
|
import { ScaleComponent, ScaleComponentProps } from "./SettingsSubComponents/ScaleComponent";
|
||||||
ConflictResolutionComponent,
|
|
||||||
ConflictResolutionComponentProps,
|
|
||||||
} from "./SettingsSubComponents/ConflictResolutionComponent";
|
|
||||||
import { IndexingPolicyComponent, IndexingPolicyComponentProps } from "./SettingsSubComponents/IndexingPolicyComponent";
|
|
||||||
import {
|
import {
|
||||||
MongoIndexingPolicyComponent,
|
MongoIndexingPolicyComponent,
|
||||||
MongoIndexingPolicyComponentProps,
|
MongoIndexingPolicyComponentProps,
|
||||||
} from "./SettingsSubComponents/MongoIndexingPolicy/MongoIndexingPolicyComponent";
|
} from "./SettingsSubComponents/MongoIndexingPolicy/MongoIndexingPolicyComponent";
|
||||||
import { ScaleComponent, ScaleComponentProps } from "./SettingsSubComponents/ScaleComponent";
|
|
||||||
import { SubSettingsComponent, SubSettingsComponentProps } from "./SettingsSubComponents/SubSettingsComponent";
|
|
||||||
import {
|
import {
|
||||||
AddMongoIndexProps,
|
|
||||||
ChangeFeedPolicyState,
|
|
||||||
GeospatialConfigType,
|
|
||||||
getMongoNotification,
|
|
||||||
getTabTitle,
|
|
||||||
hasDatabaseSharedThroughput,
|
hasDatabaseSharedThroughput,
|
||||||
|
GeospatialConfigType,
|
||||||
|
TtlType,
|
||||||
|
ChangeFeedPolicyState,
|
||||||
|
SettingsV2TabTypes,
|
||||||
|
getTabTitle,
|
||||||
isDirty,
|
isDirty,
|
||||||
|
AddMongoIndexProps,
|
||||||
MongoIndexTypes,
|
MongoIndexTypes,
|
||||||
parseConflictResolutionMode,
|
parseConflictResolutionMode,
|
||||||
parseConflictResolutionProcedure,
|
parseConflictResolutionProcedure,
|
||||||
SettingsV2TabTypes,
|
getMongoNotification,
|
||||||
TtlType,
|
|
||||||
} from "./SettingsUtils";
|
} from "./SettingsUtils";
|
||||||
|
import {
|
||||||
|
ConflictResolutionComponent,
|
||||||
|
ConflictResolutionComponentProps,
|
||||||
|
} from "./SettingsSubComponents/ConflictResolutionComponent";
|
||||||
|
import { SubSettingsComponent, SubSettingsComponentProps } from "./SettingsSubComponents/SubSettingsComponent";
|
||||||
|
import { Pivot, PivotItem, IPivotProps, IPivotItemProps } from "office-ui-fabric-react";
|
||||||
|
import "./SettingsComponent.less";
|
||||||
|
import { IndexingPolicyComponent, IndexingPolicyComponentProps } from "./SettingsSubComponents/IndexingPolicyComponent";
|
||||||
|
import { MongoDBCollectionResource, MongoIndex } from "../../../Utils/arm/generatedClients/2020-04-01/types";
|
||||||
|
import { readMongoDBCollectionThroughRP } from "../../../Common/dataAccess/readMongoDBCollection";
|
||||||
|
import { getIndexTransformationProgress } from "../../../Common/dataAccess/getIndexTransformationProgress";
|
||||||
|
import { getErrorMessage, getErrorStack } from "../../../Common/ErrorHandlingUtils";
|
||||||
|
|
||||||
interface SettingsV2TabInfo {
|
interface SettingsV2TabInfo {
|
||||||
tab: SettingsV2TabTypes;
|
tab: SettingsV2TabTypes;
|
||||||
@@ -327,6 +325,7 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
|
|||||||
? this.saveCollectionSettings(startKey)
|
? this.saveCollectionSettings(startKey)
|
||||||
: this.saveDatabaseSettings(startKey));
|
: this.saveDatabaseSettings(startKey));
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
this.container.isRefreshingExplorer(false);
|
||||||
this.props.settingsTab.isExecutionError(true);
|
this.props.settingsTab.isExecutionError(true);
|
||||||
console.error(error);
|
console.error(error);
|
||||||
traceFailure(
|
traceFailure(
|
||||||
@@ -700,6 +699,7 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.container.isRefreshingExplorer(false);
|
||||||
this.setBaseline();
|
this.setBaseline();
|
||||||
this.setState({ wasAutopilotOriginallySet: this.state.isAutoPilotSelected });
|
this.setState({ wasAutopilotOriginallySet: this.state.isAutoPilotSelected });
|
||||||
traceSuccess(
|
traceSuccess(
|
||||||
@@ -862,6 +862,7 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
this.container.isRefreshingExplorer(false);
|
||||||
this.setBaseline();
|
this.setBaseline();
|
||||||
this.setState({ wasAutopilotOriginallySet: this.state.isAutoPilotSelected });
|
this.setState({ wasAutopilotOriginallySet: this.state.isAutoPilotSelected });
|
||||||
traceSuccess(
|
traceSuccess(
|
||||||
@@ -876,18 +877,6 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
public getMongoIndexTabContent = (
|
|
||||||
mongoIndexingPolicyComponentProps: MongoIndexingPolicyComponentProps
|
|
||||||
): JSX.Element => {
|
|
||||||
if (userContext.authType === AuthType.AAD) {
|
|
||||||
if (this.container.isEnableMongoCapabilityPresent()) {
|
|
||||||
return <MongoIndexingPolicyComponent {...mongoIndexingPolicyComponentProps} />;
|
|
||||||
}
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
return mongoIndexingPolicyAADError;
|
|
||||||
};
|
|
||||||
|
|
||||||
public render(): JSX.Element {
|
public render(): JSX.Element {
|
||||||
const scaleComponentProps: ScaleComponentProps = {
|
const scaleComponentProps: ScaleComponentProps = {
|
||||||
collection: this.collection,
|
collection: this.collection,
|
||||||
@@ -1005,11 +994,15 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
|
|||||||
content: <IndexingPolicyComponent {...indexingPolicyComponentProps} />,
|
content: <IndexingPolicyComponent {...indexingPolicyComponentProps} />,
|
||||||
});
|
});
|
||||||
} else if (this.container.isPreferredApiMongoDB()) {
|
} else if (this.container.isPreferredApiMongoDB()) {
|
||||||
const mongoIndexTabContext = this.getMongoIndexTabContent(mongoIndexingPolicyComponentProps);
|
if (this.container.isEnableMongoCapabilityPresent()) {
|
||||||
if (mongoIndexTabContext) {
|
|
||||||
tabs.push({
|
tabs.push({
|
||||||
tab: SettingsV2TabTypes.IndexingPolicyTab,
|
tab: SettingsV2TabTypes.IndexingPolicyTab,
|
||||||
content: mongoIndexTabContext,
|
content: <MongoIndexingPolicyComponent {...mongoIndexingPolicyComponentProps} />,
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
tabs.push({
|
||||||
|
tab: SettingsV2TabTypes.IndexingPolicyTab,
|
||||||
|
content: mongoIndexingPolicyAADError,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import {
|
|||||||
ITextStyles,
|
ITextStyles,
|
||||||
IDetailsRowStyles,
|
IDetailsRowStyles,
|
||||||
IStackStyles,
|
IStackStyles,
|
||||||
|
IIconStyles,
|
||||||
IDetailsListStyles,
|
IDetailsListStyles,
|
||||||
IDropdownStyles,
|
IDropdownStyles,
|
||||||
ISeparatorStyles,
|
ISeparatorStyles,
|
||||||
@@ -115,6 +116,8 @@ export const addMongoIndexSubElementsTokens: IStackTokens = {
|
|||||||
childrenGap: 20,
|
childrenGap: 20,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const accordionIconStyles: IIconStyles = { root: { paddingTop: 7 } };
|
||||||
|
|
||||||
export const mediumWidthStackStyles: IStackStyles = { root: { width: 600 } };
|
export const mediumWidthStackStyles: IStackStyles = { root: { width: 600 } };
|
||||||
|
|
||||||
export const shortWidthTextFieldStyles: Partial<ITextFieldStyles> = { root: { paddingLeft: 10, width: 210 } };
|
export const shortWidthTextFieldStyles: Partial<ITextFieldStyles> = { root: { paddingLeft: 10, width: 210 } };
|
||||||
|
|||||||
@@ -239,7 +239,7 @@ export class MongoIndexingPolicyComponent extends React.Component<MongoIndexingP
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Stack {...createAndAddMongoIndexStackProps} styles={mediumWidthStackStyles}>
|
<Stack {...createAndAddMongoIndexStackProps} styles={mediumWidthStackStyles}>
|
||||||
<CollapsibleSectionComponent title="Current index(es)" isExpandedByDefault={true}>
|
<CollapsibleSectionComponent title="Current index(es)">
|
||||||
{
|
{
|
||||||
<>
|
<>
|
||||||
<DetailsList
|
<DetailsList
|
||||||
@@ -266,7 +266,7 @@ export class MongoIndexingPolicyComponent extends React.Component<MongoIndexingP
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Stack styles={mediumWidthStackStyles}>
|
<Stack styles={mediumWidthStackStyles}>
|
||||||
<CollapsibleSectionComponent title="Index(es) to be dropped" isExpandedByDefault={true}>
|
<CollapsibleSectionComponent title="Index(es) to be dropped">
|
||||||
{indexesToBeDropped.length > 0 && (
|
{indexesToBeDropped.length > 0 && (
|
||||||
<DetailsList
|
<DetailsList
|
||||||
styles={customDetailsListStyles}
|
styles={customDetailsListStyles}
|
||||||
|
|||||||
@@ -42,7 +42,6 @@ exports[`MongoIndexingPolicyComponent renders 1`] = `
|
|||||||
}
|
}
|
||||||
>
|
>
|
||||||
<CollapsibleSectionComponent
|
<CollapsibleSectionComponent
|
||||||
isExpandedByDefault={true}
|
|
||||||
title="Current index(es)"
|
title="Current index(es)"
|
||||||
>
|
>
|
||||||
<StyledWithViewportComponent
|
<StyledWithViewportComponent
|
||||||
@@ -115,7 +114,7 @@ exports[`MongoIndexingPolicyComponent renders 1`] = `
|
|||||||
</Stack>
|
</Stack>
|
||||||
</CollapsibleSectionComponent>
|
</CollapsibleSectionComponent>
|
||||||
</Stack>
|
</Stack>
|
||||||
<Separator
|
<Styled
|
||||||
styles={
|
styles={
|
||||||
Object {
|
Object {
|
||||||
"root": Array [
|
"root": Array [
|
||||||
@@ -140,7 +139,6 @@ exports[`MongoIndexingPolicyComponent renders 1`] = `
|
|||||||
}
|
}
|
||||||
>
|
>
|
||||||
<CollapsibleSectionComponent
|
<CollapsibleSectionComponent
|
||||||
isExpandedByDefault={true}
|
|
||||||
title="Index(es) to be dropped"
|
title="Index(es) to be dropped"
|
||||||
/>
|
/>
|
||||||
</Stack>
|
</Stack>
|
||||||
|
|||||||
@@ -1,24 +1,23 @@
|
|||||||
import { Label, Link, MessageBar, MessageBarType, Stack, Text, TextField } from "office-ui-fabric-react";
|
|
||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
import * as Constants from "../../../../Common/Constants";
|
import * as Constants from "../../../../Common/Constants";
|
||||||
import { configContext, Platform } from "../../../../ConfigContext";
|
import { ThroughputInputAutoPilotV3Component } from "./ThroughputInputComponents/ThroughputInputAutoPilotV3Component";
|
||||||
import * as DataModels from "../../../../Contracts/DataModels";
|
|
||||||
import * as ViewModels from "../../../../Contracts/ViewModels";
|
import * as ViewModels from "../../../../Contracts/ViewModels";
|
||||||
|
import * as DataModels from "../../../../Contracts/DataModels";
|
||||||
import * as SharedConstants from "../../../../Shared/Constants";
|
import * as SharedConstants from "../../../../Shared/Constants";
|
||||||
import { userContext } from "../../../../UserContext";
|
|
||||||
import * as AutoPilotUtils from "../../../../Utils/AutoPilotUtils";
|
|
||||||
import Explorer from "../../../Explorer";
|
import Explorer from "../../../Explorer";
|
||||||
import {
|
import {
|
||||||
getTextFieldStyles,
|
getTextFieldStyles,
|
||||||
|
subComponentStackProps,
|
||||||
|
titleAndInputStackProps,
|
||||||
|
throughputUnit,
|
||||||
getThroughputApplyLongDelayMessage,
|
getThroughputApplyLongDelayMessage,
|
||||||
getThroughputApplyShortDelayMessage,
|
getThroughputApplyShortDelayMessage,
|
||||||
subComponentStackProps,
|
|
||||||
throughputUnit,
|
|
||||||
titleAndInputStackProps,
|
|
||||||
updateThroughputBeyondLimitWarningMessage,
|
updateThroughputBeyondLimitWarningMessage,
|
||||||
} from "../SettingsRenderUtils";
|
} from "../SettingsRenderUtils";
|
||||||
import { hasDatabaseSharedThroughput } from "../SettingsUtils";
|
import { hasDatabaseSharedThroughput } from "../SettingsUtils";
|
||||||
import { ThroughputInputAutoPilotV3Component } from "./ThroughputInputComponents/ThroughputInputAutoPilotV3Component";
|
import * as AutoPilotUtils from "../../../../Utils/AutoPilotUtils";
|
||||||
|
import { Link, Text, TextField, Stack, Label, MessageBar, MessageBarType } from "office-ui-fabric-react";
|
||||||
|
import { configContext, Platform } from "../../../../ConfigContext";
|
||||||
|
|
||||||
export interface ScaleComponentProps {
|
export interface ScaleComponentProps {
|
||||||
collection: ViewModels.Collection;
|
collection: ViewModels.Collection;
|
||||||
@@ -80,7 +79,7 @@ export class ScaleComponent extends React.Component<ScaleComponentProps> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
public getMaxRUs = (): number => {
|
public getMaxRUs = (): number => {
|
||||||
if (userContext.isTryCosmosDBSubscription) {
|
if (this.props.container?.isTryCosmosDBSubscription()) {
|
||||||
return Constants.TryCosmosExperience.maxRU;
|
return Constants.TryCosmosExperience.maxRU;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,7 +91,7 @@ export class ScaleComponent extends React.Component<ScaleComponentProps> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
public getMinRUs = (): number => {
|
public getMinRUs = (): number => {
|
||||||
if (userContext.isTryCosmosDBSubscription) {
|
if (this.props.container?.isTryCosmosDBSubscription()) {
|
||||||
return SharedConstants.CollectionCreation.DefaultCollectionRUs400;
|
return SharedConstants.CollectionCreation.DefaultCollectionRUs400;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -173,6 +172,7 @@ export class ScaleComponent extends React.Component<ScaleComponentProps> {
|
|||||||
databaseAccount={this.props.container.databaseAccount()}
|
databaseAccount={this.props.container.databaseAccount()}
|
||||||
databaseName={this.databaseId}
|
databaseName={this.databaseId}
|
||||||
collectionName={this.collectionId}
|
collectionName={this.collectionId}
|
||||||
|
serverId={this.props.container.serverId()}
|
||||||
throughput={this.props.throughput}
|
throughput={this.props.throughput}
|
||||||
throughputBaseline={this.props.throughputBaseline}
|
throughputBaseline={this.props.throughputBaseline}
|
||||||
onThroughputChange={this.props.onThroughputChange}
|
onThroughputChange={this.props.onThroughputChange}
|
||||||
|
|||||||
@@ -1,16 +1,17 @@
|
|||||||
import { shallow } from "enzyme";
|
import { shallow } from "enzyme";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import * as DataModels from "../../../../../Contracts/DataModels";
|
|
||||||
import {
|
import {
|
||||||
ThroughputInputAutoPilotV3Component,
|
ThroughputInputAutoPilotV3Component,
|
||||||
ThroughputInputAutoPilotV3Props,
|
ThroughputInputAutoPilotV3Props,
|
||||||
} from "./ThroughputInputAutoPilotV3Component";
|
} from "./ThroughputInputAutoPilotV3Component";
|
||||||
|
import * as DataModels from "../../../../../Contracts/DataModels";
|
||||||
|
|
||||||
describe("ThroughputInputAutoPilotV3Component", () => {
|
describe("ThroughputInputAutoPilotV3Component", () => {
|
||||||
const baseProps: ThroughputInputAutoPilotV3Props = {
|
const baseProps: ThroughputInputAutoPilotV3Props = {
|
||||||
databaseAccount: {} as DataModels.DatabaseAccount,
|
databaseAccount: {} as DataModels.DatabaseAccount,
|
||||||
databaseName: "test",
|
databaseName: "test",
|
||||||
collectionName: "test",
|
collectionName: "test",
|
||||||
|
serverId: undefined,
|
||||||
wasAutopilotOriginallySet: false,
|
wasAutopilotOriginallySet: false,
|
||||||
throughput: 100,
|
throughput: 100,
|
||||||
throughputBaseline: 100,
|
throughputBaseline: 100,
|
||||||
|
|||||||
@@ -1,53 +1,55 @@
|
|||||||
|
import React from "react";
|
||||||
|
import * as AutoPilotUtils from "../../../../../Utils/AutoPilotUtils";
|
||||||
import {
|
import {
|
||||||
Checkbox,
|
getTextFieldStyles,
|
||||||
|
getToolTipContainer,
|
||||||
|
noLeftPaddingCheckBoxStyle,
|
||||||
|
titleAndInputStackProps,
|
||||||
|
checkBoxAndInputStackProps,
|
||||||
|
getChoiceGroupStyles,
|
||||||
|
messageBarStyles,
|
||||||
|
getEstimatedSpendingElement,
|
||||||
|
getAutoPilotV3SpendElement,
|
||||||
|
manualToAutoscaleDisclaimerElement,
|
||||||
|
saveThroughputWarningMessage,
|
||||||
|
ManualEstimatedSpendingDisplayProps,
|
||||||
|
AutoscaleEstimatedSpendingDisplayProps,
|
||||||
|
PriceBreakdown,
|
||||||
|
getRuPriceBreakdown,
|
||||||
|
transparentDetailsHeaderStyle,
|
||||||
|
} from "../../SettingsRenderUtils";
|
||||||
|
import {
|
||||||
|
Text,
|
||||||
|
TextField,
|
||||||
ChoiceGroup,
|
ChoiceGroup,
|
||||||
FontIcon,
|
|
||||||
IChoiceGroupOption,
|
IChoiceGroupOption,
|
||||||
IColumn,
|
Checkbox,
|
||||||
|
Stack,
|
||||||
Label,
|
Label,
|
||||||
Link,
|
Link,
|
||||||
MessageBar,
|
MessageBar,
|
||||||
Stack,
|
FontIcon,
|
||||||
Text,
|
IColumn,
|
||||||
TextField,
|
|
||||||
} from "office-ui-fabric-react";
|
} from "office-ui-fabric-react";
|
||||||
import React from "react";
|
|
||||||
import { Features } from "../../../../../Common/Constants";
|
|
||||||
import * as DataModels from "../../../../../Contracts/DataModels";
|
|
||||||
import { SubscriptionType } from "../../../../../Contracts/SubscriptionType";
|
|
||||||
import * as SharedConstants from "../../../../../Shared/Constants";
|
|
||||||
import { Action, ActionModifiers } from "../../../../../Shared/Telemetry/TelemetryConstants";
|
|
||||||
import * as TelemetryProcessor from "../../../../../Shared/Telemetry/TelemetryProcessor";
|
|
||||||
import { userContext } from "../../../../../UserContext";
|
|
||||||
import * as AutoPilotUtils from "../../../../../Utils/AutoPilotUtils";
|
|
||||||
import { minAutoPilotThroughput } from "../../../../../Utils/AutoPilotUtils";
|
|
||||||
import { calculateEstimateNumber, usageInGB } from "../../../../../Utils/PricingUtils";
|
|
||||||
import { Int32 } from "../../../../Panes/Tables/Validators/EntityPropertyValidationCommon";
|
|
||||||
import {
|
|
||||||
AutoscaleEstimatedSpendingDisplayProps,
|
|
||||||
checkBoxAndInputStackProps,
|
|
||||||
getAutoPilotV3SpendElement,
|
|
||||||
getChoiceGroupStyles,
|
|
||||||
getEstimatedSpendingElement,
|
|
||||||
getRuPriceBreakdown,
|
|
||||||
getTextFieldStyles,
|
|
||||||
getToolTipContainer,
|
|
||||||
ManualEstimatedSpendingDisplayProps,
|
|
||||||
manualToAutoscaleDisclaimerElement,
|
|
||||||
messageBarStyles,
|
|
||||||
noLeftPaddingCheckBoxStyle,
|
|
||||||
PriceBreakdown,
|
|
||||||
saveThroughputWarningMessage,
|
|
||||||
titleAndInputStackProps,
|
|
||||||
transparentDetailsHeaderStyle,
|
|
||||||
} from "../../SettingsRenderUtils";
|
|
||||||
import { getSanitizedInputValue, IsComponentDirtyResult, isDirty } from "../../SettingsUtils";
|
|
||||||
import { ToolTipLabelComponent } from "../ToolTipLabelComponent";
|
import { ToolTipLabelComponent } from "../ToolTipLabelComponent";
|
||||||
|
import { getSanitizedInputValue, IsComponentDirtyResult, isDirty } from "../../SettingsUtils";
|
||||||
|
import * as SharedConstants from "../../../../../Shared/Constants";
|
||||||
|
import * as DataModels from "../../../../../Contracts/DataModels";
|
||||||
|
import { Int32 } from "../../../../Panes/Tables/Validators/EntityPropertyValidationCommon";
|
||||||
|
import { userContext } from "../../../../../UserContext";
|
||||||
|
import { SubscriptionType } from "../../../../../Contracts/SubscriptionType";
|
||||||
|
import { usageInGB, calculateEstimateNumber } from "../../../../../Utils/PricingUtils";
|
||||||
|
import { Features } from "../../../../../Common/Constants";
|
||||||
|
import { minAutoPilotThroughput } from "../../../../../Utils/AutoPilotUtils";
|
||||||
|
|
||||||
|
import * as TelemetryProcessor from "../../../../../Shared/Telemetry/TelemetryProcessor";
|
||||||
|
import { Action, ActionModifiers } from "../../../../../Shared/Telemetry/TelemetryConstants";
|
||||||
|
|
||||||
export interface ThroughputInputAutoPilotV3Props {
|
export interface ThroughputInputAutoPilotV3Props {
|
||||||
databaseAccount: DataModels.DatabaseAccount;
|
databaseAccount: DataModels.DatabaseAccount;
|
||||||
databaseName: string;
|
databaseName: string;
|
||||||
collectionName: string;
|
collectionName: string;
|
||||||
|
serverId: string;
|
||||||
throughput: number;
|
throughput: number;
|
||||||
throughputBaseline: number;
|
throughputBaseline: number;
|
||||||
onThroughputChange: (newThroughput: number) => void;
|
onThroughputChange: (newThroughput: number) => void;
|
||||||
@@ -180,6 +182,7 @@ export class ThroughputInputAutoPilotV3Component extends React.Component<
|
|||||||
}
|
}
|
||||||
|
|
||||||
const isDirty: boolean = this.IsComponentDirty().isDiscardable;
|
const isDirty: boolean = this.IsComponentDirty().isDiscardable;
|
||||||
|
const serverId: string = this.props.serverId;
|
||||||
const regions = account?.properties?.readLocations?.length || 1;
|
const regions = account?.properties?.readLocations?.length || 1;
|
||||||
const multimaster = account?.properties?.enableMultipleWriteLocations || false;
|
const multimaster = account?.properties?.enableMultipleWriteLocations || false;
|
||||||
|
|
||||||
@@ -189,7 +192,7 @@ export class ThroughputInputAutoPilotV3Component extends React.Component<
|
|||||||
estimatedSpend = this.getEstimatedManualSpendElement(
|
estimatedSpend = this.getEstimatedManualSpendElement(
|
||||||
// if migrating from autoscale to manual, we use the autoscale RUs value as that is what will be set...
|
// if migrating from autoscale to manual, we use the autoscale RUs value as that is what will be set...
|
||||||
this.overrideWithAutoPilotSettings() ? this.props.maxAutoPilotThroughput : this.props.throughputBaseline,
|
this.overrideWithAutoPilotSettings() ? this.props.maxAutoPilotThroughput : this.props.throughputBaseline,
|
||||||
userContext.portalEnv,
|
serverId,
|
||||||
regions,
|
regions,
|
||||||
multimaster,
|
multimaster,
|
||||||
isDirty ? this.props.throughput : undefined
|
isDirty ? this.props.throughput : undefined
|
||||||
@@ -197,7 +200,7 @@ export class ThroughputInputAutoPilotV3Component extends React.Component<
|
|||||||
} else {
|
} else {
|
||||||
estimatedSpend = this.getEstimatedAutoscaleSpendElement(
|
estimatedSpend = this.getEstimatedAutoscaleSpendElement(
|
||||||
this.props.maxAutoPilotThroughputBaseline,
|
this.props.maxAutoPilotThroughputBaseline,
|
||||||
userContext.portalEnv,
|
serverId,
|
||||||
regions,
|
regions,
|
||||||
multimaster,
|
multimaster,
|
||||||
isDirty ? this.props.maxAutoPilotThroughput : undefined
|
isDirty ? this.props.maxAutoPilotThroughput : undefined
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ exports[`ToolTipLabelComponent renders 1`] = `
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<Icon
|
<StyledIconBase
|
||||||
ariaLabel="Info"
|
ariaLabel="Info"
|
||||||
iconName="Info"
|
iconName="Info"
|
||||||
styles={
|
styles={
|
||||||
|
|||||||
@@ -920,6 +920,7 @@ exports[`SettingsComponent renders 1`] = `
|
|||||||
"hasStorageAnalyticsAfecFeature": [Function],
|
"hasStorageAnalyticsAfecFeature": [Function],
|
||||||
"hasWriteAccess": [Function],
|
"hasWriteAccess": [Function],
|
||||||
"isAccountReady": [Function],
|
"isAccountReady": [Function],
|
||||||
|
"isAuthWithResourceToken": [Function],
|
||||||
"isAutoscaleDefaultEnabled": [Function],
|
"isAutoscaleDefaultEnabled": [Function],
|
||||||
"isCopyNotebookPaneEnabled": [Function],
|
"isCopyNotebookPaneEnabled": [Function],
|
||||||
"isEnableMongoCapabilityPresent": [Function],
|
"isEnableMongoCapabilityPresent": [Function],
|
||||||
@@ -936,6 +937,7 @@ exports[`SettingsComponent renders 1`] = `
|
|||||||
"isPreferredApiMongoDB": [Function],
|
"isPreferredApiMongoDB": [Function],
|
||||||
"isPreferredApiTable": [Function],
|
"isPreferredApiTable": [Function],
|
||||||
"isPublishNotebookPaneEnabled": [Function],
|
"isPublishNotebookPaneEnabled": [Function],
|
||||||
|
"isRefreshingExplorer": [Function],
|
||||||
"isResourceTokenCollectionNodeSelected": [Function],
|
"isResourceTokenCollectionNodeSelected": [Function],
|
||||||
"isRightPanelV2Enabled": [Function],
|
"isRightPanelV2Enabled": [Function],
|
||||||
"isSchemaEnabled": [Function],
|
"isSchemaEnabled": [Function],
|
||||||
@@ -944,6 +946,7 @@ exports[`SettingsComponent renders 1`] = `
|
|||||||
"isSparkEnabledForAccount": [Function],
|
"isSparkEnabledForAccount": [Function],
|
||||||
"isSynapseLinkUpdating": [Function],
|
"isSynapseLinkUpdating": [Function],
|
||||||
"isTabsContentExpanded": [Function],
|
"isTabsContentExpanded": [Function],
|
||||||
|
"isTryCosmosDBSubscription": [Function],
|
||||||
"loadQueryPane": LoadQueryPane {
|
"loadQueryPane": LoadQueryPane {
|
||||||
"container": [Circular],
|
"container": [Circular],
|
||||||
"files": [Function],
|
"files": [Function],
|
||||||
@@ -983,6 +986,7 @@ exports[`SettingsComponent renders 1`] = `
|
|||||||
"onSwitchToConnectionString": [Function],
|
"onSwitchToConnectionString": [Function],
|
||||||
"openDialog": undefined,
|
"openDialog": undefined,
|
||||||
"openSidePanel": undefined,
|
"openSidePanel": undefined,
|
||||||
|
"params": undefined,
|
||||||
"provideFeedbackEmail": [Function],
|
"provideFeedbackEmail": [Function],
|
||||||
"queriesClient": QueriesClient {
|
"queriesClient": QueriesClient {
|
||||||
"container": [Circular],
|
"container": [Circular],
|
||||||
@@ -1015,26 +1019,6 @@ exports[`SettingsComponent renders 1`] = `
|
|||||||
"resourceTokenCollectionId": [Function],
|
"resourceTokenCollectionId": [Function],
|
||||||
"resourceTokenDatabaseId": [Function],
|
"resourceTokenDatabaseId": [Function],
|
||||||
"resourceTokenPartitionKey": [Function],
|
"resourceTokenPartitionKey": [Function],
|
||||||
"resourceTree": ResourceTreeAdapter {
|
|
||||||
"container": [Circular],
|
|
||||||
"copyNotebook": [Function],
|
|
||||||
"databaseCollectionIdMap": ArrayHashMap {
|
|
||||||
"store": HashMap {
|
|
||||||
"container": Object {},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"koSubsCollectionIdMap": ArrayHashMap {
|
|
||||||
"store": HashMap {
|
|
||||||
"container": Object {},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"koSubsDatabaseIdMap": ArrayHashMap {
|
|
||||||
"store": HashMap {
|
|
||||||
"container": Object {},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"parameters": [Function],
|
|
||||||
},
|
|
||||||
"resourceTreeForResourceToken": ResourceTreeAdapterForResourceToken {
|
"resourceTreeForResourceToken": ResourceTreeAdapterForResourceToken {
|
||||||
"container": [Circular],
|
"container": [Circular],
|
||||||
"parameters": [Function],
|
"parameters": [Function],
|
||||||
@@ -1057,6 +1041,7 @@ exports[`SettingsComponent renders 1`] = `
|
|||||||
},
|
},
|
||||||
"selectedDatabaseId": [Function],
|
"selectedDatabaseId": [Function],
|
||||||
"selectedNode": [Function],
|
"selectedNode": [Function],
|
||||||
|
"serverId": [Function],
|
||||||
"setInProgressConsoleDataIdToBeDeleted": undefined,
|
"setInProgressConsoleDataIdToBeDeleted": undefined,
|
||||||
"setIsNotificationConsoleExpanded": undefined,
|
"setIsNotificationConsoleExpanded": undefined,
|
||||||
"setNotificationConsoleData": undefined,
|
"setNotificationConsoleData": undefined,
|
||||||
@@ -2117,6 +2102,7 @@ exports[`SettingsComponent renders 1`] = `
|
|||||||
"hasStorageAnalyticsAfecFeature": [Function],
|
"hasStorageAnalyticsAfecFeature": [Function],
|
||||||
"hasWriteAccess": [Function],
|
"hasWriteAccess": [Function],
|
||||||
"isAccountReady": [Function],
|
"isAccountReady": [Function],
|
||||||
|
"isAuthWithResourceToken": [Function],
|
||||||
"isAutoscaleDefaultEnabled": [Function],
|
"isAutoscaleDefaultEnabled": [Function],
|
||||||
"isCopyNotebookPaneEnabled": [Function],
|
"isCopyNotebookPaneEnabled": [Function],
|
||||||
"isEnableMongoCapabilityPresent": [Function],
|
"isEnableMongoCapabilityPresent": [Function],
|
||||||
@@ -2133,6 +2119,7 @@ exports[`SettingsComponent renders 1`] = `
|
|||||||
"isPreferredApiMongoDB": [Function],
|
"isPreferredApiMongoDB": [Function],
|
||||||
"isPreferredApiTable": [Function],
|
"isPreferredApiTable": [Function],
|
||||||
"isPublishNotebookPaneEnabled": [Function],
|
"isPublishNotebookPaneEnabled": [Function],
|
||||||
|
"isRefreshingExplorer": [Function],
|
||||||
"isResourceTokenCollectionNodeSelected": [Function],
|
"isResourceTokenCollectionNodeSelected": [Function],
|
||||||
"isRightPanelV2Enabled": [Function],
|
"isRightPanelV2Enabled": [Function],
|
||||||
"isSchemaEnabled": [Function],
|
"isSchemaEnabled": [Function],
|
||||||
@@ -2141,6 +2128,7 @@ exports[`SettingsComponent renders 1`] = `
|
|||||||
"isSparkEnabledForAccount": [Function],
|
"isSparkEnabledForAccount": [Function],
|
||||||
"isSynapseLinkUpdating": [Function],
|
"isSynapseLinkUpdating": [Function],
|
||||||
"isTabsContentExpanded": [Function],
|
"isTabsContentExpanded": [Function],
|
||||||
|
"isTryCosmosDBSubscription": [Function],
|
||||||
"loadQueryPane": LoadQueryPane {
|
"loadQueryPane": LoadQueryPane {
|
||||||
"container": [Circular],
|
"container": [Circular],
|
||||||
"files": [Function],
|
"files": [Function],
|
||||||
@@ -2180,6 +2168,7 @@ exports[`SettingsComponent renders 1`] = `
|
|||||||
"onSwitchToConnectionString": [Function],
|
"onSwitchToConnectionString": [Function],
|
||||||
"openDialog": undefined,
|
"openDialog": undefined,
|
||||||
"openSidePanel": undefined,
|
"openSidePanel": undefined,
|
||||||
|
"params": undefined,
|
||||||
"provideFeedbackEmail": [Function],
|
"provideFeedbackEmail": [Function],
|
||||||
"queriesClient": QueriesClient {
|
"queriesClient": QueriesClient {
|
||||||
"container": [Circular],
|
"container": [Circular],
|
||||||
@@ -2212,26 +2201,6 @@ exports[`SettingsComponent renders 1`] = `
|
|||||||
"resourceTokenCollectionId": [Function],
|
"resourceTokenCollectionId": [Function],
|
||||||
"resourceTokenDatabaseId": [Function],
|
"resourceTokenDatabaseId": [Function],
|
||||||
"resourceTokenPartitionKey": [Function],
|
"resourceTokenPartitionKey": [Function],
|
||||||
"resourceTree": ResourceTreeAdapter {
|
|
||||||
"container": [Circular],
|
|
||||||
"copyNotebook": [Function],
|
|
||||||
"databaseCollectionIdMap": ArrayHashMap {
|
|
||||||
"store": HashMap {
|
|
||||||
"container": Object {},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"koSubsCollectionIdMap": ArrayHashMap {
|
|
||||||
"store": HashMap {
|
|
||||||
"container": Object {},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"koSubsDatabaseIdMap": ArrayHashMap {
|
|
||||||
"store": HashMap {
|
|
||||||
"container": Object {},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"parameters": [Function],
|
|
||||||
},
|
|
||||||
"resourceTreeForResourceToken": ResourceTreeAdapterForResourceToken {
|
"resourceTreeForResourceToken": ResourceTreeAdapterForResourceToken {
|
||||||
"container": [Circular],
|
"container": [Circular],
|
||||||
"parameters": [Function],
|
"parameters": [Function],
|
||||||
@@ -2254,6 +2223,7 @@ exports[`SettingsComponent renders 1`] = `
|
|||||||
},
|
},
|
||||||
"selectedDatabaseId": [Function],
|
"selectedDatabaseId": [Function],
|
||||||
"selectedNode": [Function],
|
"selectedNode": [Function],
|
||||||
|
"serverId": [Function],
|
||||||
"setInProgressConsoleDataIdToBeDeleted": undefined,
|
"setInProgressConsoleDataIdToBeDeleted": undefined,
|
||||||
"setIsNotificationConsoleExpanded": undefined,
|
"setIsNotificationConsoleExpanded": undefined,
|
||||||
"setNotificationConsoleData": undefined,
|
"setNotificationConsoleData": undefined,
|
||||||
@@ -3327,6 +3297,7 @@ exports[`SettingsComponent renders 1`] = `
|
|||||||
"hasStorageAnalyticsAfecFeature": [Function],
|
"hasStorageAnalyticsAfecFeature": [Function],
|
||||||
"hasWriteAccess": [Function],
|
"hasWriteAccess": [Function],
|
||||||
"isAccountReady": [Function],
|
"isAccountReady": [Function],
|
||||||
|
"isAuthWithResourceToken": [Function],
|
||||||
"isAutoscaleDefaultEnabled": [Function],
|
"isAutoscaleDefaultEnabled": [Function],
|
||||||
"isCopyNotebookPaneEnabled": [Function],
|
"isCopyNotebookPaneEnabled": [Function],
|
||||||
"isEnableMongoCapabilityPresent": [Function],
|
"isEnableMongoCapabilityPresent": [Function],
|
||||||
@@ -3343,6 +3314,7 @@ exports[`SettingsComponent renders 1`] = `
|
|||||||
"isPreferredApiMongoDB": [Function],
|
"isPreferredApiMongoDB": [Function],
|
||||||
"isPreferredApiTable": [Function],
|
"isPreferredApiTable": [Function],
|
||||||
"isPublishNotebookPaneEnabled": [Function],
|
"isPublishNotebookPaneEnabled": [Function],
|
||||||
|
"isRefreshingExplorer": [Function],
|
||||||
"isResourceTokenCollectionNodeSelected": [Function],
|
"isResourceTokenCollectionNodeSelected": [Function],
|
||||||
"isRightPanelV2Enabled": [Function],
|
"isRightPanelV2Enabled": [Function],
|
||||||
"isSchemaEnabled": [Function],
|
"isSchemaEnabled": [Function],
|
||||||
@@ -3351,6 +3323,7 @@ exports[`SettingsComponent renders 1`] = `
|
|||||||
"isSparkEnabledForAccount": [Function],
|
"isSparkEnabledForAccount": [Function],
|
||||||
"isSynapseLinkUpdating": [Function],
|
"isSynapseLinkUpdating": [Function],
|
||||||
"isTabsContentExpanded": [Function],
|
"isTabsContentExpanded": [Function],
|
||||||
|
"isTryCosmosDBSubscription": [Function],
|
||||||
"loadQueryPane": LoadQueryPane {
|
"loadQueryPane": LoadQueryPane {
|
||||||
"container": [Circular],
|
"container": [Circular],
|
||||||
"files": [Function],
|
"files": [Function],
|
||||||
@@ -3390,6 +3363,7 @@ exports[`SettingsComponent renders 1`] = `
|
|||||||
"onSwitchToConnectionString": [Function],
|
"onSwitchToConnectionString": [Function],
|
||||||
"openDialog": undefined,
|
"openDialog": undefined,
|
||||||
"openSidePanel": undefined,
|
"openSidePanel": undefined,
|
||||||
|
"params": undefined,
|
||||||
"provideFeedbackEmail": [Function],
|
"provideFeedbackEmail": [Function],
|
||||||
"queriesClient": QueriesClient {
|
"queriesClient": QueriesClient {
|
||||||
"container": [Circular],
|
"container": [Circular],
|
||||||
@@ -3422,26 +3396,6 @@ exports[`SettingsComponent renders 1`] = `
|
|||||||
"resourceTokenCollectionId": [Function],
|
"resourceTokenCollectionId": [Function],
|
||||||
"resourceTokenDatabaseId": [Function],
|
"resourceTokenDatabaseId": [Function],
|
||||||
"resourceTokenPartitionKey": [Function],
|
"resourceTokenPartitionKey": [Function],
|
||||||
"resourceTree": ResourceTreeAdapter {
|
|
||||||
"container": [Circular],
|
|
||||||
"copyNotebook": [Function],
|
|
||||||
"databaseCollectionIdMap": ArrayHashMap {
|
|
||||||
"store": HashMap {
|
|
||||||
"container": Object {},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"koSubsCollectionIdMap": ArrayHashMap {
|
|
||||||
"store": HashMap {
|
|
||||||
"container": Object {},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"koSubsDatabaseIdMap": ArrayHashMap {
|
|
||||||
"store": HashMap {
|
|
||||||
"container": Object {},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"parameters": [Function],
|
|
||||||
},
|
|
||||||
"resourceTreeForResourceToken": ResourceTreeAdapterForResourceToken {
|
"resourceTreeForResourceToken": ResourceTreeAdapterForResourceToken {
|
||||||
"container": [Circular],
|
"container": [Circular],
|
||||||
"parameters": [Function],
|
"parameters": [Function],
|
||||||
@@ -3464,6 +3418,7 @@ exports[`SettingsComponent renders 1`] = `
|
|||||||
},
|
},
|
||||||
"selectedDatabaseId": [Function],
|
"selectedDatabaseId": [Function],
|
||||||
"selectedNode": [Function],
|
"selectedNode": [Function],
|
||||||
|
"serverId": [Function],
|
||||||
"setInProgressConsoleDataIdToBeDeleted": undefined,
|
"setInProgressConsoleDataIdToBeDeleted": undefined,
|
||||||
"setIsNotificationConsoleExpanded": undefined,
|
"setIsNotificationConsoleExpanded": undefined,
|
||||||
"setNotificationConsoleData": undefined,
|
"setNotificationConsoleData": undefined,
|
||||||
@@ -4524,6 +4479,7 @@ exports[`SettingsComponent renders 1`] = `
|
|||||||
"hasStorageAnalyticsAfecFeature": [Function],
|
"hasStorageAnalyticsAfecFeature": [Function],
|
||||||
"hasWriteAccess": [Function],
|
"hasWriteAccess": [Function],
|
||||||
"isAccountReady": [Function],
|
"isAccountReady": [Function],
|
||||||
|
"isAuthWithResourceToken": [Function],
|
||||||
"isAutoscaleDefaultEnabled": [Function],
|
"isAutoscaleDefaultEnabled": [Function],
|
||||||
"isCopyNotebookPaneEnabled": [Function],
|
"isCopyNotebookPaneEnabled": [Function],
|
||||||
"isEnableMongoCapabilityPresent": [Function],
|
"isEnableMongoCapabilityPresent": [Function],
|
||||||
@@ -4540,6 +4496,7 @@ exports[`SettingsComponent renders 1`] = `
|
|||||||
"isPreferredApiMongoDB": [Function],
|
"isPreferredApiMongoDB": [Function],
|
||||||
"isPreferredApiTable": [Function],
|
"isPreferredApiTable": [Function],
|
||||||
"isPublishNotebookPaneEnabled": [Function],
|
"isPublishNotebookPaneEnabled": [Function],
|
||||||
|
"isRefreshingExplorer": [Function],
|
||||||
"isResourceTokenCollectionNodeSelected": [Function],
|
"isResourceTokenCollectionNodeSelected": [Function],
|
||||||
"isRightPanelV2Enabled": [Function],
|
"isRightPanelV2Enabled": [Function],
|
||||||
"isSchemaEnabled": [Function],
|
"isSchemaEnabled": [Function],
|
||||||
@@ -4548,6 +4505,7 @@ exports[`SettingsComponent renders 1`] = `
|
|||||||
"isSparkEnabledForAccount": [Function],
|
"isSparkEnabledForAccount": [Function],
|
||||||
"isSynapseLinkUpdating": [Function],
|
"isSynapseLinkUpdating": [Function],
|
||||||
"isTabsContentExpanded": [Function],
|
"isTabsContentExpanded": [Function],
|
||||||
|
"isTryCosmosDBSubscription": [Function],
|
||||||
"loadQueryPane": LoadQueryPane {
|
"loadQueryPane": LoadQueryPane {
|
||||||
"container": [Circular],
|
"container": [Circular],
|
||||||
"files": [Function],
|
"files": [Function],
|
||||||
@@ -4587,6 +4545,7 @@ exports[`SettingsComponent renders 1`] = `
|
|||||||
"onSwitchToConnectionString": [Function],
|
"onSwitchToConnectionString": [Function],
|
||||||
"openDialog": undefined,
|
"openDialog": undefined,
|
||||||
"openSidePanel": undefined,
|
"openSidePanel": undefined,
|
||||||
|
"params": undefined,
|
||||||
"provideFeedbackEmail": [Function],
|
"provideFeedbackEmail": [Function],
|
||||||
"queriesClient": QueriesClient {
|
"queriesClient": QueriesClient {
|
||||||
"container": [Circular],
|
"container": [Circular],
|
||||||
@@ -4619,26 +4578,6 @@ exports[`SettingsComponent renders 1`] = `
|
|||||||
"resourceTokenCollectionId": [Function],
|
"resourceTokenCollectionId": [Function],
|
||||||
"resourceTokenDatabaseId": [Function],
|
"resourceTokenDatabaseId": [Function],
|
||||||
"resourceTokenPartitionKey": [Function],
|
"resourceTokenPartitionKey": [Function],
|
||||||
"resourceTree": ResourceTreeAdapter {
|
|
||||||
"container": [Circular],
|
|
||||||
"copyNotebook": [Function],
|
|
||||||
"databaseCollectionIdMap": ArrayHashMap {
|
|
||||||
"store": HashMap {
|
|
||||||
"container": Object {},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"koSubsCollectionIdMap": ArrayHashMap {
|
|
||||||
"store": HashMap {
|
|
||||||
"container": Object {},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"koSubsDatabaseIdMap": ArrayHashMap {
|
|
||||||
"store": HashMap {
|
|
||||||
"container": Object {},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"parameters": [Function],
|
|
||||||
},
|
|
||||||
"resourceTreeForResourceToken": ResourceTreeAdapterForResourceToken {
|
"resourceTreeForResourceToken": ResourceTreeAdapterForResourceToken {
|
||||||
"container": [Circular],
|
"container": [Circular],
|
||||||
"parameters": [Function],
|
"parameters": [Function],
|
||||||
@@ -4661,6 +4600,7 @@ exports[`SettingsComponent renders 1`] = `
|
|||||||
},
|
},
|
||||||
"selectedDatabaseId": [Function],
|
"selectedDatabaseId": [Function],
|
||||||
"selectedNode": [Function],
|
"selectedNode": [Function],
|
||||||
|
"serverId": [Function],
|
||||||
"setInProgressConsoleDataIdToBeDeleted": undefined,
|
"setInProgressConsoleDataIdToBeDeleted": undefined,
|
||||||
"setIsNotificationConsoleExpanded": undefined,
|
"setIsNotificationConsoleExpanded": undefined,
|
||||||
"setNotificationConsoleData": undefined,
|
"setNotificationConsoleData": undefined,
|
||||||
|
|||||||
@@ -1,13 +1,14 @@
|
|||||||
import { TFunction } from "i18next";
|
import * as React from "react";
|
||||||
import { Label, Link, MessageBar, MessageBarType, Toggle } from "office-ui-fabric-react";
|
import { Position } from "office-ui-fabric-react/lib/utilities/positioning";
|
||||||
import { Dropdown, IDropdownOption } from "office-ui-fabric-react/lib/Dropdown";
|
|
||||||
import { Slider } from "office-ui-fabric-react/lib/Slider";
|
import { Slider } from "office-ui-fabric-react/lib/Slider";
|
||||||
import { SpinButton } from "office-ui-fabric-react/lib/SpinButton";
|
import { SpinButton } from "office-ui-fabric-react/lib/SpinButton";
|
||||||
import { IStackTokens, Stack } from "office-ui-fabric-react/lib/Stack";
|
import { Dropdown, IDropdownOption } from "office-ui-fabric-react/lib/Dropdown";
|
||||||
import { Text } from "office-ui-fabric-react/lib/Text";
|
|
||||||
import { TextField } from "office-ui-fabric-react/lib/TextField";
|
import { TextField } from "office-ui-fabric-react/lib/TextField";
|
||||||
import { Position } from "office-ui-fabric-react/lib/utilities/positioning";
|
import { Text } from "office-ui-fabric-react/lib/Text";
|
||||||
import * as React from "react";
|
import { Stack, IStackTokens } from "office-ui-fabric-react/lib/Stack";
|
||||||
|
import { Label, Link, MessageBar, MessageBarType, Toggle } from "office-ui-fabric-react";
|
||||||
|
import * as InputUtils from "./InputUtils";
|
||||||
|
import "./SmartUiComponent.less";
|
||||||
import {
|
import {
|
||||||
ChoiceItem,
|
ChoiceItem,
|
||||||
Description,
|
Description,
|
||||||
@@ -18,9 +19,8 @@ import {
|
|||||||
NumberUiType,
|
NumberUiType,
|
||||||
SmartUiInput,
|
SmartUiInput,
|
||||||
} from "../../../SelfServe/SelfServeTypes";
|
} from "../../../SelfServe/SelfServeTypes";
|
||||||
|
import { TFunction } from "i18next";
|
||||||
import { ToolTipLabelComponent } from "../Settings/SettingsSubComponents/ToolTipLabelComponent";
|
import { ToolTipLabelComponent } from "../Settings/SettingsSubComponents/ToolTipLabelComponent";
|
||||||
import * as InputUtils from "./InputUtils";
|
|
||||||
import "./SmartUiComponent.less";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generic UX renderer
|
* Generic UX renderer
|
||||||
@@ -138,12 +138,11 @@ export class SmartUiComponent extends React.Component<SmartUiComponentProps, Sma
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private renderTextInput(input: StringInput, labelId: string, labelElement: JSX.Element): JSX.Element {
|
private renderTextInput(input: StringInput, labelId: string): JSX.Element {
|
||||||
const value = this.props.currentValues.get(input.dataFieldName)?.value as string;
|
const value = this.props.currentValues.get(input.dataFieldName)?.value as string;
|
||||||
const disabled = this.props.disabled || this.props.currentValues.get(input.dataFieldName)?.disabled;
|
const disabled = this.props.disabled || this.props.currentValues.get(input.dataFieldName)?.disabled;
|
||||||
return (
|
return (
|
||||||
<Stack>
|
<div className="stringInputContainer">
|
||||||
{labelElement}
|
|
||||||
<TextField
|
<TextField
|
||||||
id={`${input.dataFieldName}-textField-input`}
|
id={`${input.dataFieldName}-textField-input`}
|
||||||
aria-labelledby={labelId}
|
aria-labelledby={labelId}
|
||||||
@@ -156,32 +155,25 @@ export class SmartUiComponent extends React.Component<SmartUiComponentProps, Sma
|
|||||||
root: { width: 400 },
|
root: { width: 400 },
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</Stack>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private renderDescription(input: DescriptionDisplay, labelId: string, labelElement: JSX.Element): JSX.Element {
|
private renderDescription(input: DescriptionDisplay, labelId: string): JSX.Element {
|
||||||
const dataFieldName = input.dataFieldName;
|
const dataFieldName = input.dataFieldName;
|
||||||
const description = input.description || (this.props.currentValues.get(dataFieldName)?.value as Description);
|
const description = input.description || (this.props.currentValues.get(dataFieldName)?.value as Description);
|
||||||
if (!description) {
|
if (!description) {
|
||||||
if (!input.isDynamicDescription) {
|
return this.renderError("Description is not provided.");
|
||||||
return this.renderError("Description is not provided.");
|
|
||||||
}
|
|
||||||
// If input is a dynamic description and description is not available, empty element is rendered
|
|
||||||
return <></>;
|
|
||||||
}
|
}
|
||||||
const descriptionElement = (
|
const descriptionElement = (
|
||||||
<Stack>
|
<Text id={`${dataFieldName}-text-display`} aria-labelledby={labelId}>
|
||||||
{labelElement}
|
{this.props.getTranslation(description.textTKey)}{" "}
|
||||||
<Text id={`${dataFieldName}-text-display`} aria-labelledby={labelId}>
|
{description.link && (
|
||||||
{this.props.getTranslation(description.textTKey)}{" "}
|
<Link target="_blank" href={description.link.href}>
|
||||||
{description.link && (
|
{this.props.getTranslation(description.link.textTKey)}
|
||||||
<Link target="_blank" href={description.link.href}>
|
</Link>
|
||||||
{this.props.getTranslation(description.link.textTKey)}
|
)}
|
||||||
</Link>
|
</Text>
|
||||||
)}
|
|
||||||
</Text>
|
|
||||||
</Stack>
|
|
||||||
);
|
);
|
||||||
|
|
||||||
if (description.type === DescriptionType.Text) {
|
if (description.type === DescriptionType.Text) {
|
||||||
@@ -235,7 +227,7 @@ export class SmartUiComponent extends React.Component<SmartUiComponentProps, Sma
|
|||||||
return undefined;
|
return undefined;
|
||||||
};
|
};
|
||||||
|
|
||||||
private renderNumberInput(input: NumberInput, labelId: string, labelElement: JSX.Element): JSX.Element {
|
private renderNumberInput(input: NumberInput, labelId: string): JSX.Element {
|
||||||
const { labelTKey, min, max, dataFieldName, step } = input;
|
const { labelTKey, min, max, dataFieldName, step } = input;
|
||||||
const props = {
|
const props = {
|
||||||
min: min,
|
min: min,
|
||||||
@@ -248,72 +240,61 @@ export class SmartUiComponent extends React.Component<SmartUiComponentProps, Sma
|
|||||||
const disabled = this.props.disabled || this.props.currentValues.get(dataFieldName)?.disabled;
|
const disabled = this.props.disabled || this.props.currentValues.get(dataFieldName)?.disabled;
|
||||||
if (input.uiType === NumberUiType.Spinner) {
|
if (input.uiType === NumberUiType.Spinner) {
|
||||||
return (
|
return (
|
||||||
<Stack>
|
<Stack styles={{ root: { width: 400 } }} tokens={{ childrenGap: 2 }}>
|
||||||
{labelElement}
|
<SpinButton
|
||||||
<Stack styles={{ root: { width: 400 } }} tokens={{ childrenGap: 2 }}>
|
{...props}
|
||||||
<SpinButton
|
id={`${input.dataFieldName}-spinner-input`}
|
||||||
{...props}
|
value={value?.toString()}
|
||||||
id={`${input.dataFieldName}-spinner-input`}
|
onValidate={(newValue) => this.onValidate(input, newValue, props.min, props.max)}
|
||||||
value={value?.toString()}
|
onIncrement={(newValue) => this.onIncrement(input, newValue, props.step, props.max)}
|
||||||
onValidate={(newValue) => this.onValidate(input, newValue, props.min, props.max)}
|
onDecrement={(newValue) => this.onDecrement(input, newValue, props.step, props.min)}
|
||||||
onIncrement={(newValue) => this.onIncrement(input, newValue, props.step, props.max)}
|
labelPosition={Position.top}
|
||||||
onDecrement={(newValue) => this.onDecrement(input, newValue, props.step, props.min)}
|
aria-labelledby={labelId}
|
||||||
labelPosition={Position.top}
|
disabled={disabled}
|
||||||
aria-labelledby={labelId}
|
/>
|
||||||
disabled={disabled}
|
{this.state.errors.has(dataFieldName) && (
|
||||||
/>
|
<MessageBar messageBarType={MessageBarType.error}>Error: {this.state.errors.get(dataFieldName)}</MessageBar>
|
||||||
{this.state.errors.has(dataFieldName) && (
|
)}
|
||||||
<MessageBar messageBarType={MessageBarType.error}>
|
|
||||||
Error: {this.state.errors.get(dataFieldName)}
|
|
||||||
</MessageBar>
|
|
||||||
)}
|
|
||||||
</Stack>
|
|
||||||
</Stack>
|
</Stack>
|
||||||
);
|
);
|
||||||
} else if (input.uiType === NumberUiType.Slider) {
|
} else if (input.uiType === NumberUiType.Slider) {
|
||||||
return (
|
return (
|
||||||
<Stack>
|
<div id={`${input.dataFieldName}-slider-input`}>
|
||||||
{labelElement}
|
<Slider
|
||||||
<div id={`${input.dataFieldName}-slider-input`}>
|
{...props}
|
||||||
<Slider
|
value={value}
|
||||||
{...props}
|
disabled={disabled}
|
||||||
value={value}
|
onChange={(newValue) => this.props.onInputChange(input, newValue)}
|
||||||
disabled={disabled}
|
styles={{
|
||||||
onChange={(newValue) => this.props.onInputChange(input, newValue)}
|
root: { width: 400 },
|
||||||
styles={{
|
valueLabel: SmartUiComponent.labelStyle,
|
||||||
root: { width: 400 },
|
}}
|
||||||
valueLabel: SmartUiComponent.labelStyle,
|
/>
|
||||||
}}
|
</div>
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</Stack>
|
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return <>Unsupported number UI type {input.uiType}</>;
|
return <>Unsupported number UI type {input.uiType}</>;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private renderBooleanInput(input: BooleanInput, labelId: string, labelElement: JSX.Element): JSX.Element {
|
private renderBooleanInput(input: BooleanInput, labelId: string): JSX.Element {
|
||||||
const value = this.props.currentValues.get(input.dataFieldName)?.value as boolean;
|
const value = this.props.currentValues.get(input.dataFieldName)?.value as boolean;
|
||||||
const disabled = this.props.disabled || this.props.currentValues.get(input.dataFieldName)?.disabled;
|
const disabled = this.props.disabled || this.props.currentValues.get(input.dataFieldName)?.disabled;
|
||||||
return (
|
return (
|
||||||
<Stack>
|
<Toggle
|
||||||
{labelElement}
|
id={`${input.dataFieldName}-toggle-input`}
|
||||||
<Toggle
|
aria-labelledby={labelId}
|
||||||
id={`${input.dataFieldName}-toggle-input`}
|
checked={value || false}
|
||||||
aria-labelledby={labelId}
|
onText={this.props.getTranslation(input.trueLabelTKey)}
|
||||||
checked={value || false}
|
offText={this.props.getTranslation(input.falseLabelTKey)}
|
||||||
onText={this.props.getTranslation(input.trueLabelTKey)}
|
disabled={disabled}
|
||||||
offText={this.props.getTranslation(input.falseLabelTKey)}
|
onChange={(event, checked: boolean) => this.props.onInputChange(input, checked)}
|
||||||
disabled={disabled}
|
styles={{ root: { width: 400 } }}
|
||||||
onChange={(event, checked: boolean) => this.props.onInputChange(input, checked)}
|
/>
|
||||||
styles={{ root: { width: 400 } }}
|
|
||||||
/>
|
|
||||||
</Stack>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private renderChoiceInput(input: ChoiceInput, labelId: string, labelElement: JSX.Element): JSX.Element {
|
private renderChoiceInput(input: ChoiceInput, labelId: string): JSX.Element {
|
||||||
const { defaultKey, dataFieldName, choices, placeholderTKey } = input;
|
const { defaultKey, dataFieldName, choices, placeholderTKey } = input;
|
||||||
const value = this.props.currentValues.get(dataFieldName)?.value as string;
|
const value = this.props.currentValues.get(dataFieldName)?.value as string;
|
||||||
const disabled = this.props.disabled || this.props.currentValues.get(dataFieldName)?.disabled;
|
const disabled = this.props.disabled || this.props.currentValues.get(dataFieldName)?.disabled;
|
||||||
@@ -322,26 +303,22 @@ export class SmartUiComponent extends React.Component<SmartUiComponentProps, Sma
|
|||||||
selectedKey = "";
|
selectedKey = "";
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<Stack>
|
<Dropdown
|
||||||
{labelElement}
|
id={`${input.dataFieldName}-dropdown-input`}
|
||||||
<Dropdown
|
aria-labelledby={labelId}
|
||||||
id={`${input.dataFieldName}-dropdown-input`}
|
selectedKey={selectedKey}
|
||||||
aria-labelledby={labelId}
|
onChange={(_, item: IDropdownOption) => this.props.onInputChange(input, item.key.toString())}
|
||||||
selectedKey={selectedKey}
|
placeholder={this.props.getTranslation(placeholderTKey)}
|
||||||
onChange={(_, item: IDropdownOption) => this.props.onInputChange(input, item.key.toString())}
|
disabled={disabled}
|
||||||
placeholder={this.props.getTranslation(placeholderTKey)}
|
options={choices.map((c) => ({
|
||||||
disabled={disabled}
|
key: c.key,
|
||||||
dropdownWidth="auto"
|
text: this.props.getTranslation(c.label),
|
||||||
options={choices.map((c) => ({
|
}))}
|
||||||
key: c.key,
|
styles={{
|
||||||
text: this.props.getTranslation(c.label),
|
root: { width: 400 },
|
||||||
}))}
|
dropdown: SmartUiComponent.labelStyle,
|
||||||
styles={{
|
}}
|
||||||
root: { width: 400 },
|
/>
|
||||||
dropdown: SmartUiComponent.labelStyle,
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</Stack>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -349,7 +326,7 @@ export class SmartUiComponent extends React.Component<SmartUiComponentProps, Sma
|
|||||||
return <MessageBar messageBarType={MessageBarType.error}>Error: {errorMessage}</MessageBar>;
|
return <MessageBar messageBarType={MessageBarType.error}>Error: {errorMessage}</MessageBar>;
|
||||||
}
|
}
|
||||||
|
|
||||||
private renderElement(input: AnyDisplay, info: Info): JSX.Element {
|
private renderDisplayWithInfoBubble(input: AnyDisplay, info: Info): JSX.Element {
|
||||||
if (input.errorMessage) {
|
if (input.errorMessage) {
|
||||||
return this.renderError(input.errorMessage);
|
return this.renderError(input.errorMessage);
|
||||||
}
|
}
|
||||||
@@ -358,31 +335,34 @@ export class SmartUiComponent extends React.Component<SmartUiComponentProps, Sma
|
|||||||
return <></>;
|
return <></>;
|
||||||
}
|
}
|
||||||
const labelId = `${input.dataFieldName}-label`;
|
const labelId = `${input.dataFieldName}-label`;
|
||||||
const labelElement: JSX.Element = input.labelTKey && (
|
return (
|
||||||
<Label id={labelId}>
|
<Stack>
|
||||||
<ToolTipLabelComponent
|
{input.labelTKey && (
|
||||||
label={this.props.getTranslation(input.labelTKey)}
|
<Label id={labelId}>
|
||||||
toolTipElement={this.renderInfo(info)}
|
<ToolTipLabelComponent
|
||||||
/>
|
label={this.props.getTranslation(input.labelTKey)}
|
||||||
</Label>
|
toolTipElement={this.renderInfo(info)}
|
||||||
|
/>
|
||||||
|
</Label>
|
||||||
|
)}
|
||||||
|
{this.renderDisplay(input, labelId)}
|
||||||
|
</Stack>
|
||||||
);
|
);
|
||||||
|
|
||||||
return <Stack>{this.renderControl(input, labelId, labelElement)}</Stack>;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private renderControl(input: AnyDisplay, labelId: string, labelElement: JSX.Element): JSX.Element {
|
private renderDisplay(input: AnyDisplay, labelId: string): JSX.Element {
|
||||||
switch (input.type) {
|
switch (input.type) {
|
||||||
case "string":
|
case "string":
|
||||||
if ("description" in input || "isDynamicDescription" in input) {
|
if ("description" in input || "isDynamicDescription" in input) {
|
||||||
return this.renderDescription(input as DescriptionDisplay, labelId, labelElement);
|
return this.renderDescription(input as DescriptionDisplay, labelId);
|
||||||
}
|
}
|
||||||
return this.renderTextInput(input as StringInput, labelId, labelElement);
|
return this.renderTextInput(input as StringInput, labelId);
|
||||||
case "number":
|
case "number":
|
||||||
return this.renderNumberInput(input as NumberInput, labelId, labelElement);
|
return this.renderNumberInput(input as NumberInput, labelId);
|
||||||
case "boolean":
|
case "boolean":
|
||||||
return this.renderBooleanInput(input as BooleanInput, labelId, labelElement);
|
return this.renderBooleanInput(input as BooleanInput, labelId);
|
||||||
case "object":
|
case "object":
|
||||||
return this.renderChoiceInput(input as ChoiceInput, labelId, labelElement);
|
return this.renderChoiceInput(input as ChoiceInput, labelId);
|
||||||
default:
|
default:
|
||||||
throw new Error(`Unknown input type: ${input.type}`);
|
throw new Error(`Unknown input type: ${input.type}`);
|
||||||
}
|
}
|
||||||
@@ -393,7 +373,7 @@ export class SmartUiComponent extends React.Component<SmartUiComponentProps, Sma
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Stack tokens={containerStackTokens} className="widgetRendererContainer">
|
<Stack tokens={containerStackTokens} className="widgetRendererContainer">
|
||||||
<Stack.Item>{node.input && this.renderElement(node.input, node.info as Info)}</Stack.Item>
|
<Stack.Item>{node.input && this.renderDisplayWithInfoBubble(node.input, node.info as Info)}</Stack.Item>
|
||||||
{node.children && node.children.map((child) => <div key={child.id}>{this.renderNode(child)}</div>)}
|
{node.children && node.children.map((child) => <div key={child.id}>{this.renderNode(child)}</div>)}
|
||||||
</Stack>
|
</Stack>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -23,21 +23,19 @@ exports[`SmartUiComponent disable all inputs 1`] = `
|
|||||||
>
|
>
|
||||||
<StackItem>
|
<StackItem>
|
||||||
<Stack>
|
<Stack>
|
||||||
<Stack>
|
<Text
|
||||||
<Text
|
aria-labelledby="description-label"
|
||||||
aria-labelledby="description-label"
|
id="description-text-display"
|
||||||
id="description-text-display"
|
>
|
||||||
|
this is an example description text.
|
||||||
|
|
||||||
|
<StyledLinkBase
|
||||||
|
href="https://docs.microsoft.com/en-us/azure/cosmos-db/introduction"
|
||||||
|
target="_blank"
|
||||||
>
|
>
|
||||||
this is an example description text.
|
Click here for more information.
|
||||||
|
</StyledLinkBase>
|
||||||
<StyledLinkBase
|
</Text>
|
||||||
href="https://docs.microsoft.com/en-us/azure/cosmos-db/introduction"
|
|
||||||
target="_blank"
|
|
||||||
>
|
|
||||||
Click here for more information.
|
|
||||||
</StyledLinkBase>
|
|
||||||
</Text>
|
|
||||||
</Stack>
|
|
||||||
</Stack>
|
</Stack>
|
||||||
</StackItem>
|
</StackItem>
|
||||||
</Stack>
|
</Stack>
|
||||||
@@ -55,53 +53,51 @@ exports[`SmartUiComponent disable all inputs 1`] = `
|
|||||||
>
|
>
|
||||||
<StackItem>
|
<StackItem>
|
||||||
<Stack>
|
<Stack>
|
||||||
<Stack>
|
<StyledLabelBase
|
||||||
<StyledLabelBase
|
id="throughput-label"
|
||||||
id="throughput-label"
|
>
|
||||||
>
|
<ToolTipLabelComponent
|
||||||
<ToolTipLabelComponent
|
label="Throughput (input)"
|
||||||
label="Throughput (input)"
|
/>
|
||||||
/>
|
</StyledLabelBase>
|
||||||
</StyledLabelBase>
|
<Stack
|
||||||
<Stack
|
styles={
|
||||||
styles={
|
Object {
|
||||||
|
"root": Object {
|
||||||
|
"width": 400,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
tokens={
|
||||||
|
Object {
|
||||||
|
"childrenGap": 2,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<CustomizedSpinButton
|
||||||
|
aria-labelledby="throughput-label"
|
||||||
|
ariaLabel="Throughput (input)"
|
||||||
|
decrementButtonIcon={
|
||||||
Object {
|
Object {
|
||||||
"root": Object {
|
"iconName": "ChevronDownSmall",
|
||||||
"width": 400,
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tokens={
|
disabled={true}
|
||||||
|
id="throughput-spinner-input"
|
||||||
|
incrementButtonIcon={
|
||||||
Object {
|
Object {
|
||||||
"childrenGap": 2,
|
"iconName": "ChevronUpSmall",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
>
|
label=""
|
||||||
<CustomizedSpinButton
|
labelPosition={0}
|
||||||
aria-labelledby="throughput-label"
|
max={500}
|
||||||
ariaLabel="Throughput (input)"
|
min={400}
|
||||||
decrementButtonIcon={
|
onDecrement={[Function]}
|
||||||
Object {
|
onIncrement={[Function]}
|
||||||
"iconName": "ChevronDownSmall",
|
onValidate={[Function]}
|
||||||
}
|
step={10}
|
||||||
}
|
/>
|
||||||
disabled={true}
|
|
||||||
id="throughput-spinner-input"
|
|
||||||
incrementButtonIcon={
|
|
||||||
Object {
|
|
||||||
"iconName": "ChevronUpSmall",
|
|
||||||
}
|
|
||||||
}
|
|
||||||
label=""
|
|
||||||
labelPosition={0}
|
|
||||||
max={500}
|
|
||||||
min={400}
|
|
||||||
onDecrement={[Function]}
|
|
||||||
onIncrement={[Function]}
|
|
||||||
onValidate={[Function]}
|
|
||||||
step={10}
|
|
||||||
/>
|
|
||||||
</Stack>
|
|
||||||
</Stack>
|
</Stack>
|
||||||
</Stack>
|
</Stack>
|
||||||
</StackItem>
|
</StackItem>
|
||||||
@@ -120,39 +116,37 @@ exports[`SmartUiComponent disable all inputs 1`] = `
|
|||||||
>
|
>
|
||||||
<StackItem>
|
<StackItem>
|
||||||
<Stack>
|
<Stack>
|
||||||
<Stack>
|
<StyledLabelBase
|
||||||
<StyledLabelBase
|
id="throughput2-label"
|
||||||
id="throughput2-label"
|
>
|
||||||
>
|
<ToolTipLabelComponent
|
||||||
<ToolTipLabelComponent
|
label="Throughput (Slider)"
|
||||||
label="Throughput (Slider)"
|
/>
|
||||||
/>
|
</StyledLabelBase>
|
||||||
</StyledLabelBase>
|
<div
|
||||||
<div
|
id="throughput2-slider-input"
|
||||||
id="throughput2-slider-input"
|
>
|
||||||
>
|
<StyledSliderBase
|
||||||
<StyledSliderBase
|
ariaLabel="Throughput (Slider)"
|
||||||
ariaLabel="Throughput (Slider)"
|
disabled={true}
|
||||||
disabled={true}
|
max={500}
|
||||||
max={500}
|
min={400}
|
||||||
min={400}
|
onChange={[Function]}
|
||||||
onChange={[Function]}
|
step={10}
|
||||||
step={10}
|
styles={
|
||||||
styles={
|
Object {
|
||||||
Object {
|
"root": Object {
|
||||||
"root": Object {
|
"width": 400,
|
||||||
"width": 400,
|
},
|
||||||
},
|
"valueLabel": Object {
|
||||||
"valueLabel": Object {
|
"color": "#393939",
|
||||||
"color": "#393939",
|
"fontFamily": "wf_segoe-ui_normal, 'Segoe UI', 'Segoe WP', Tahoma, Arial, sans-serif",
|
||||||
"fontFamily": "wf_segoe-ui_normal, 'Segoe UI', 'Segoe WP', Tahoma, Arial, sans-serif",
|
"fontSize": 12,
|
||||||
"fontSize": 12,
|
},
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
/>
|
}
|
||||||
</div>
|
/>
|
||||||
</Stack>
|
</div>
|
||||||
</Stack>
|
</Stack>
|
||||||
</StackItem>
|
</StackItem>
|
||||||
</Stack>
|
</Stack>
|
||||||
@@ -191,14 +185,16 @@ exports[`SmartUiComponent disable all inputs 1`] = `
|
|||||||
>
|
>
|
||||||
<StackItem>
|
<StackItem>
|
||||||
<Stack>
|
<Stack>
|
||||||
<Stack>
|
<StyledLabelBase
|
||||||
<StyledLabelBase
|
id="containerId-label"
|
||||||
id="containerId-label"
|
>
|
||||||
>
|
<ToolTipLabelComponent
|
||||||
<ToolTipLabelComponent
|
label="Container id"
|
||||||
label="Container id"
|
/>
|
||||||
/>
|
</StyledLabelBase>
|
||||||
</StyledLabelBase>
|
<div
|
||||||
|
className="stringInputContainer"
|
||||||
|
>
|
||||||
<StyledTextFieldBase
|
<StyledTextFieldBase
|
||||||
aria-labelledby="containerId-label"
|
aria-labelledby="containerId-label"
|
||||||
disabled={true}
|
disabled={true}
|
||||||
@@ -214,7 +210,7 @@ exports[`SmartUiComponent disable all inputs 1`] = `
|
|||||||
type="text"
|
type="text"
|
||||||
value=""
|
value=""
|
||||||
/>
|
/>
|
||||||
</Stack>
|
</div>
|
||||||
</Stack>
|
</Stack>
|
||||||
</StackItem>
|
</StackItem>
|
||||||
</Stack>
|
</Stack>
|
||||||
@@ -232,31 +228,29 @@ exports[`SmartUiComponent disable all inputs 1`] = `
|
|||||||
>
|
>
|
||||||
<StackItem>
|
<StackItem>
|
||||||
<Stack>
|
<Stack>
|
||||||
<Stack>
|
<StyledLabelBase
|
||||||
<StyledLabelBase
|
id="analyticalStore-label"
|
||||||
id="analyticalStore-label"
|
>
|
||||||
>
|
<ToolTipLabelComponent
|
||||||
<ToolTipLabelComponent
|
label="Analytical Store"
|
||||||
label="Analytical Store"
|
|
||||||
/>
|
|
||||||
</StyledLabelBase>
|
|
||||||
<StyledToggleBase
|
|
||||||
aria-labelledby="analyticalStore-label"
|
|
||||||
checked={false}
|
|
||||||
disabled={true}
|
|
||||||
id="analyticalStore-toggle-input"
|
|
||||||
offText="Disabled"
|
|
||||||
onChange={[Function]}
|
|
||||||
onText="Enabled"
|
|
||||||
styles={
|
|
||||||
Object {
|
|
||||||
"root": Object {
|
|
||||||
"width": 400,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/>
|
/>
|
||||||
</Stack>
|
</StyledLabelBase>
|
||||||
|
<StyledToggleBase
|
||||||
|
aria-labelledby="analyticalStore-label"
|
||||||
|
checked={false}
|
||||||
|
disabled={true}
|
||||||
|
id="analyticalStore-toggle-input"
|
||||||
|
offText="Disabled"
|
||||||
|
onChange={[Function]}
|
||||||
|
onText="Enabled"
|
||||||
|
styles={
|
||||||
|
Object {
|
||||||
|
"root": Object {
|
||||||
|
"width": 400,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/>
|
||||||
</Stack>
|
</Stack>
|
||||||
</StackItem>
|
</StackItem>
|
||||||
</Stack>
|
</Stack>
|
||||||
@@ -274,51 +268,48 @@ exports[`SmartUiComponent disable all inputs 1`] = `
|
|||||||
>
|
>
|
||||||
<StackItem>
|
<StackItem>
|
||||||
<Stack>
|
<Stack>
|
||||||
<Stack>
|
<StyledLabelBase
|
||||||
<StyledLabelBase
|
id="database-label"
|
||||||
id="database-label"
|
>
|
||||||
>
|
<ToolTipLabelComponent
|
||||||
<ToolTipLabelComponent
|
label="Database"
|
||||||
label="Database"
|
|
||||||
/>
|
|
||||||
</StyledLabelBase>
|
|
||||||
<StyledWithResponsiveMode
|
|
||||||
aria-labelledby="database-label"
|
|
||||||
disabled={true}
|
|
||||||
dropdownWidth="auto"
|
|
||||||
id="database-dropdown-input"
|
|
||||||
onChange={[Function]}
|
|
||||||
options={
|
|
||||||
Array [
|
|
||||||
Object {
|
|
||||||
"key": "db1",
|
|
||||||
"text": "Database 1",
|
|
||||||
},
|
|
||||||
Object {
|
|
||||||
"key": "db2",
|
|
||||||
"text": "Database 2",
|
|
||||||
},
|
|
||||||
Object {
|
|
||||||
"key": "db3",
|
|
||||||
"text": "Database 3",
|
|
||||||
},
|
|
||||||
]
|
|
||||||
}
|
|
||||||
selectedKey="db2"
|
|
||||||
styles={
|
|
||||||
Object {
|
|
||||||
"dropdown": Object {
|
|
||||||
"color": "#393939",
|
|
||||||
"fontFamily": "wf_segoe-ui_normal, 'Segoe UI', 'Segoe WP', Tahoma, Arial, sans-serif",
|
|
||||||
"fontSize": 12,
|
|
||||||
},
|
|
||||||
"root": Object {
|
|
||||||
"width": 400,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/>
|
/>
|
||||||
</Stack>
|
</StyledLabelBase>
|
||||||
|
<StyledWithResponsiveMode
|
||||||
|
aria-labelledby="database-label"
|
||||||
|
disabled={true}
|
||||||
|
id="database-dropdown-input"
|
||||||
|
onChange={[Function]}
|
||||||
|
options={
|
||||||
|
Array [
|
||||||
|
Object {
|
||||||
|
"key": "db1",
|
||||||
|
"text": "Database 1",
|
||||||
|
},
|
||||||
|
Object {
|
||||||
|
"key": "db2",
|
||||||
|
"text": "Database 2",
|
||||||
|
},
|
||||||
|
Object {
|
||||||
|
"key": "db3",
|
||||||
|
"text": "Database 3",
|
||||||
|
},
|
||||||
|
]
|
||||||
|
}
|
||||||
|
selectedKey="db2"
|
||||||
|
styles={
|
||||||
|
Object {
|
||||||
|
"dropdown": Object {
|
||||||
|
"color": "#393939",
|
||||||
|
"fontFamily": "wf_segoe-ui_normal, 'Segoe UI', 'Segoe WP', Tahoma, Arial, sans-serif",
|
||||||
|
"fontSize": 12,
|
||||||
|
},
|
||||||
|
"root": Object {
|
||||||
|
"width": 400,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/>
|
||||||
</Stack>
|
</Stack>
|
||||||
</StackItem>
|
</StackItem>
|
||||||
</Stack>
|
</Stack>
|
||||||
@@ -349,21 +340,19 @@ exports[`SmartUiComponent should render and honor input's hidden, disabled state
|
|||||||
>
|
>
|
||||||
<StackItem>
|
<StackItem>
|
||||||
<Stack>
|
<Stack>
|
||||||
<Stack>
|
<Text
|
||||||
<Text
|
aria-labelledby="description-label"
|
||||||
aria-labelledby="description-label"
|
id="description-text-display"
|
||||||
id="description-text-display"
|
>
|
||||||
|
this is an example description text.
|
||||||
|
|
||||||
|
<StyledLinkBase
|
||||||
|
href="https://docs.microsoft.com/en-us/azure/cosmos-db/introduction"
|
||||||
|
target="_blank"
|
||||||
>
|
>
|
||||||
this is an example description text.
|
Click here for more information.
|
||||||
|
</StyledLinkBase>
|
||||||
<StyledLinkBase
|
</Text>
|
||||||
href="https://docs.microsoft.com/en-us/azure/cosmos-db/introduction"
|
|
||||||
target="_blank"
|
|
||||||
>
|
|
||||||
Click here for more information.
|
|
||||||
</StyledLinkBase>
|
|
||||||
</Text>
|
|
||||||
</Stack>
|
|
||||||
</Stack>
|
</Stack>
|
||||||
</StackItem>
|
</StackItem>
|
||||||
</Stack>
|
</Stack>
|
||||||
@@ -381,53 +370,51 @@ exports[`SmartUiComponent should render and honor input's hidden, disabled state
|
|||||||
>
|
>
|
||||||
<StackItem>
|
<StackItem>
|
||||||
<Stack>
|
<Stack>
|
||||||
<Stack>
|
<StyledLabelBase
|
||||||
<StyledLabelBase
|
id="throughput-label"
|
||||||
id="throughput-label"
|
>
|
||||||
>
|
<ToolTipLabelComponent
|
||||||
<ToolTipLabelComponent
|
label="Throughput (input)"
|
||||||
label="Throughput (input)"
|
/>
|
||||||
/>
|
</StyledLabelBase>
|
||||||
</StyledLabelBase>
|
<Stack
|
||||||
<Stack
|
styles={
|
||||||
styles={
|
Object {
|
||||||
|
"root": Object {
|
||||||
|
"width": 400,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
tokens={
|
||||||
|
Object {
|
||||||
|
"childrenGap": 2,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<CustomizedSpinButton
|
||||||
|
aria-labelledby="throughput-label"
|
||||||
|
ariaLabel="Throughput (input)"
|
||||||
|
decrementButtonIcon={
|
||||||
Object {
|
Object {
|
||||||
"root": Object {
|
"iconName": "ChevronDownSmall",
|
||||||
"width": 400,
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tokens={
|
disabled={false}
|
||||||
|
id="throughput-spinner-input"
|
||||||
|
incrementButtonIcon={
|
||||||
Object {
|
Object {
|
||||||
"childrenGap": 2,
|
"iconName": "ChevronUpSmall",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
>
|
label=""
|
||||||
<CustomizedSpinButton
|
labelPosition={0}
|
||||||
aria-labelledby="throughput-label"
|
max={500}
|
||||||
ariaLabel="Throughput (input)"
|
min={400}
|
||||||
decrementButtonIcon={
|
onDecrement={[Function]}
|
||||||
Object {
|
onIncrement={[Function]}
|
||||||
"iconName": "ChevronDownSmall",
|
onValidate={[Function]}
|
||||||
}
|
step={10}
|
||||||
}
|
/>
|
||||||
disabled={false}
|
|
||||||
id="throughput-spinner-input"
|
|
||||||
incrementButtonIcon={
|
|
||||||
Object {
|
|
||||||
"iconName": "ChevronUpSmall",
|
|
||||||
}
|
|
||||||
}
|
|
||||||
label=""
|
|
||||||
labelPosition={0}
|
|
||||||
max={500}
|
|
||||||
min={400}
|
|
||||||
onDecrement={[Function]}
|
|
||||||
onIncrement={[Function]}
|
|
||||||
onValidate={[Function]}
|
|
||||||
step={10}
|
|
||||||
/>
|
|
||||||
</Stack>
|
|
||||||
</Stack>
|
</Stack>
|
||||||
</Stack>
|
</Stack>
|
||||||
</StackItem>
|
</StackItem>
|
||||||
@@ -446,38 +433,36 @@ exports[`SmartUiComponent should render and honor input's hidden, disabled state
|
|||||||
>
|
>
|
||||||
<StackItem>
|
<StackItem>
|
||||||
<Stack>
|
<Stack>
|
||||||
<Stack>
|
<StyledLabelBase
|
||||||
<StyledLabelBase
|
id="throughput2-label"
|
||||||
id="throughput2-label"
|
>
|
||||||
>
|
<ToolTipLabelComponent
|
||||||
<ToolTipLabelComponent
|
label="Throughput (Slider)"
|
||||||
label="Throughput (Slider)"
|
/>
|
||||||
/>
|
</StyledLabelBase>
|
||||||
</StyledLabelBase>
|
<div
|
||||||
<div
|
id="throughput2-slider-input"
|
||||||
id="throughput2-slider-input"
|
>
|
||||||
>
|
<StyledSliderBase
|
||||||
<StyledSliderBase
|
ariaLabel="Throughput (Slider)"
|
||||||
ariaLabel="Throughput (Slider)"
|
max={500}
|
||||||
max={500}
|
min={400}
|
||||||
min={400}
|
onChange={[Function]}
|
||||||
onChange={[Function]}
|
step={10}
|
||||||
step={10}
|
styles={
|
||||||
styles={
|
Object {
|
||||||
Object {
|
"root": Object {
|
||||||
"root": Object {
|
"width": 400,
|
||||||
"width": 400,
|
},
|
||||||
},
|
"valueLabel": Object {
|
||||||
"valueLabel": Object {
|
"color": "#393939",
|
||||||
"color": "#393939",
|
"fontFamily": "wf_segoe-ui_normal, 'Segoe UI', 'Segoe WP', Tahoma, Arial, sans-serif",
|
||||||
"fontFamily": "wf_segoe-ui_normal, 'Segoe UI', 'Segoe WP', Tahoma, Arial, sans-serif",
|
"fontSize": 12,
|
||||||
"fontSize": 12,
|
},
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
/>
|
}
|
||||||
</div>
|
/>
|
||||||
</Stack>
|
</div>
|
||||||
</Stack>
|
</Stack>
|
||||||
</StackItem>
|
</StackItem>
|
||||||
</Stack>
|
</Stack>
|
||||||
@@ -516,14 +501,16 @@ exports[`SmartUiComponent should render and honor input's hidden, disabled state
|
|||||||
>
|
>
|
||||||
<StackItem>
|
<StackItem>
|
||||||
<Stack>
|
<Stack>
|
||||||
<Stack>
|
<StyledLabelBase
|
||||||
<StyledLabelBase
|
id="containerId-label"
|
||||||
id="containerId-label"
|
>
|
||||||
>
|
<ToolTipLabelComponent
|
||||||
<ToolTipLabelComponent
|
label="Container id"
|
||||||
label="Container id"
|
/>
|
||||||
/>
|
</StyledLabelBase>
|
||||||
</StyledLabelBase>
|
<div
|
||||||
|
className="stringInputContainer"
|
||||||
|
>
|
||||||
<StyledTextFieldBase
|
<StyledTextFieldBase
|
||||||
aria-labelledby="containerId-label"
|
aria-labelledby="containerId-label"
|
||||||
id="containerId-textField-input"
|
id="containerId-textField-input"
|
||||||
@@ -538,7 +525,7 @@ exports[`SmartUiComponent should render and honor input's hidden, disabled state
|
|||||||
type="text"
|
type="text"
|
||||||
value=""
|
value=""
|
||||||
/>
|
/>
|
||||||
</Stack>
|
</div>
|
||||||
</Stack>
|
</Stack>
|
||||||
</StackItem>
|
</StackItem>
|
||||||
</Stack>
|
</Stack>
|
||||||
@@ -556,30 +543,28 @@ exports[`SmartUiComponent should render and honor input's hidden, disabled state
|
|||||||
>
|
>
|
||||||
<StackItem>
|
<StackItem>
|
||||||
<Stack>
|
<Stack>
|
||||||
<Stack>
|
<StyledLabelBase
|
||||||
<StyledLabelBase
|
id="analyticalStore-label"
|
||||||
id="analyticalStore-label"
|
>
|
||||||
>
|
<ToolTipLabelComponent
|
||||||
<ToolTipLabelComponent
|
label="Analytical Store"
|
||||||
label="Analytical Store"
|
|
||||||
/>
|
|
||||||
</StyledLabelBase>
|
|
||||||
<StyledToggleBase
|
|
||||||
aria-labelledby="analyticalStore-label"
|
|
||||||
checked={false}
|
|
||||||
id="analyticalStore-toggle-input"
|
|
||||||
offText="Disabled"
|
|
||||||
onChange={[Function]}
|
|
||||||
onText="Enabled"
|
|
||||||
styles={
|
|
||||||
Object {
|
|
||||||
"root": Object {
|
|
||||||
"width": 400,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/>
|
/>
|
||||||
</Stack>
|
</StyledLabelBase>
|
||||||
|
<StyledToggleBase
|
||||||
|
aria-labelledby="analyticalStore-label"
|
||||||
|
checked={false}
|
||||||
|
id="analyticalStore-toggle-input"
|
||||||
|
offText="Disabled"
|
||||||
|
onChange={[Function]}
|
||||||
|
onText="Enabled"
|
||||||
|
styles={
|
||||||
|
Object {
|
||||||
|
"root": Object {
|
||||||
|
"width": 400,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/>
|
||||||
</Stack>
|
</Stack>
|
||||||
</StackItem>
|
</StackItem>
|
||||||
</Stack>
|
</Stack>
|
||||||
@@ -597,50 +582,47 @@ exports[`SmartUiComponent should render and honor input's hidden, disabled state
|
|||||||
>
|
>
|
||||||
<StackItem>
|
<StackItem>
|
||||||
<Stack>
|
<Stack>
|
||||||
<Stack>
|
<StyledLabelBase
|
||||||
<StyledLabelBase
|
id="database-label"
|
||||||
id="database-label"
|
>
|
||||||
>
|
<ToolTipLabelComponent
|
||||||
<ToolTipLabelComponent
|
label="Database"
|
||||||
label="Database"
|
|
||||||
/>
|
|
||||||
</StyledLabelBase>
|
|
||||||
<StyledWithResponsiveMode
|
|
||||||
aria-labelledby="database-label"
|
|
||||||
dropdownWidth="auto"
|
|
||||||
id="database-dropdown-input"
|
|
||||||
onChange={[Function]}
|
|
||||||
options={
|
|
||||||
Array [
|
|
||||||
Object {
|
|
||||||
"key": "db1",
|
|
||||||
"text": "Database 1",
|
|
||||||
},
|
|
||||||
Object {
|
|
||||||
"key": "db2",
|
|
||||||
"text": "Database 2",
|
|
||||||
},
|
|
||||||
Object {
|
|
||||||
"key": "db3",
|
|
||||||
"text": "Database 3",
|
|
||||||
},
|
|
||||||
]
|
|
||||||
}
|
|
||||||
selectedKey="db2"
|
|
||||||
styles={
|
|
||||||
Object {
|
|
||||||
"dropdown": Object {
|
|
||||||
"color": "#393939",
|
|
||||||
"fontFamily": "wf_segoe-ui_normal, 'Segoe UI', 'Segoe WP', Tahoma, Arial, sans-serif",
|
|
||||||
"fontSize": 12,
|
|
||||||
},
|
|
||||||
"root": Object {
|
|
||||||
"width": 400,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/>
|
/>
|
||||||
</Stack>
|
</StyledLabelBase>
|
||||||
|
<StyledWithResponsiveMode
|
||||||
|
aria-labelledby="database-label"
|
||||||
|
id="database-dropdown-input"
|
||||||
|
onChange={[Function]}
|
||||||
|
options={
|
||||||
|
Array [
|
||||||
|
Object {
|
||||||
|
"key": "db1",
|
||||||
|
"text": "Database 1",
|
||||||
|
},
|
||||||
|
Object {
|
||||||
|
"key": "db2",
|
||||||
|
"text": "Database 2",
|
||||||
|
},
|
||||||
|
Object {
|
||||||
|
"key": "db3",
|
||||||
|
"text": "Database 3",
|
||||||
|
},
|
||||||
|
]
|
||||||
|
}
|
||||||
|
selectedKey="db2"
|
||||||
|
styles={
|
||||||
|
Object {
|
||||||
|
"dropdown": Object {
|
||||||
|
"color": "#393939",
|
||||||
|
"fontFamily": "wf_segoe-ui_normal, 'Segoe UI', 'Segoe WP', Tahoma, Arial, sans-serif",
|
||||||
|
"fontSize": 12,
|
||||||
|
},
|
||||||
|
"root": Object {
|
||||||
|
"width": 400,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/>
|
||||||
</Stack>
|
</Stack>
|
||||||
</StackItem>
|
</StackItem>
|
||||||
</Stack>
|
</Stack>
|
||||||
|
|||||||
@@ -1,20 +0,0 @@
|
|||||||
@import "../../../../less/Common/Constants";
|
|
||||||
|
|
||||||
.throughputInputContainer {
|
|
||||||
.throughputInputRadioBtn {
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.throughputInputRadioBtnLabel {
|
|
||||||
font-size: @mediumFontSize;
|
|
||||||
padding: 0 @LargeSpace 0 @SmallSpace;
|
|
||||||
}
|
|
||||||
|
|
||||||
.throughputInputSpacing {
|
|
||||||
margin-bottom: @SmallSpace;
|
|
||||||
|
|
||||||
& > * {
|
|
||||||
margin-bottom: @SmallSpace;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,302 +0,0 @@
|
|||||||
import { Checkbox, DirectionalHint, Icon, Link, Stack, Text, TextField, TooltipHost } from "office-ui-fabric-react";
|
|
||||||
import React from "react";
|
|
||||||
import * as Constants from "../../../Common/Constants";
|
|
||||||
import * as SharedConstants from "../../../Shared/Constants";
|
|
||||||
import { userContext } from "../../../UserContext";
|
|
||||||
import * as AutoPilotUtils from "../../../Utils/AutoPilotUtils";
|
|
||||||
import * as PricingUtils from "../../../Utils/PricingUtils";
|
|
||||||
|
|
||||||
export interface ThroughputInputProps {
|
|
||||||
isDatabase: boolean;
|
|
||||||
showFreeTierExceedThroughputTooltip: boolean;
|
|
||||||
setThroughputValue: (throughput: number) => void;
|
|
||||||
setIsAutoscale: (isAutoscale: boolean) => void;
|
|
||||||
onCostAcknowledgeChange: (isAcknowledged: boolean) => void;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ThroughputInputState {
|
|
||||||
isAutoscaleSelected: boolean;
|
|
||||||
throughput: number;
|
|
||||||
isCostAcknowledged: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
export class ThroughputInput extends React.Component<ThroughputInputProps, ThroughputInputState> {
|
|
||||||
constructor(props: ThroughputInputProps) {
|
|
||||||
super(props);
|
|
||||||
|
|
||||||
this.state = {
|
|
||||||
isAutoscaleSelected: true,
|
|
||||||
throughput: AutoPilotUtils.minAutoPilotThroughput,
|
|
||||||
isCostAcknowledged: false,
|
|
||||||
};
|
|
||||||
|
|
||||||
this.props.setThroughputValue(AutoPilotUtils.minAutoPilotThroughput);
|
|
||||||
this.props.setIsAutoscale(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
render(): JSX.Element {
|
|
||||||
return (
|
|
||||||
<div className="throughputInputContainer throughputInputSpacing">
|
|
||||||
<Stack horizontal>
|
|
||||||
<span className="mandatoryStar">* </span>
|
|
||||||
<Text variant="small" style={{ lineHeight: "20px" }}>
|
|
||||||
{this.getThroughputLabelText()}
|
|
||||||
</Text>
|
|
||||||
<TooltipHost directionalHint={DirectionalHint.bottomLeftEdge} content={PricingUtils.getRuToolTipText()}>
|
|
||||||
<Icon iconName="InfoSolid" className="panelInfoIcon" />
|
|
||||||
</TooltipHost>
|
|
||||||
</Stack>
|
|
||||||
|
|
||||||
<Stack horizontal verticalAlign="center">
|
|
||||||
<input
|
|
||||||
className="throughputInputRadioBtn"
|
|
||||||
aria-label="Autoscale mode"
|
|
||||||
checked={this.state.isAutoscaleSelected}
|
|
||||||
type="radio"
|
|
||||||
role="radio"
|
|
||||||
tabIndex={0}
|
|
||||||
onChange={this.onAutoscaleRadioBtnChange.bind(this)}
|
|
||||||
/>
|
|
||||||
<span className="throughputInputRadioBtnLabel">Autoscale</span>
|
|
||||||
|
|
||||||
<input
|
|
||||||
className="throughputInputRadioBtn"
|
|
||||||
aria-label="Manual mode"
|
|
||||||
checked={!this.state.isAutoscaleSelected}
|
|
||||||
type="radio"
|
|
||||||
role="radio"
|
|
||||||
tabIndex={0}
|
|
||||||
onChange={this.onManualRadioBtnChange.bind(this)}
|
|
||||||
/>
|
|
||||||
<span className="throughputInputRadioBtnLabel">Manual</span>
|
|
||||||
</Stack>
|
|
||||||
|
|
||||||
{this.state.isAutoscaleSelected && (
|
|
||||||
<Stack className="throughputInputSpacing">
|
|
||||||
<Text variant="small">
|
|
||||||
Provision maximum RU/s required by this resource. Estimate your required RU/s with
|
|
||||||
<Link target="_blank" href="https://cosmos.azure.com/capacitycalculator/">
|
|
||||||
capacity calculator
|
|
||||||
</Link>
|
|
||||||
.
|
|
||||||
</Text>
|
|
||||||
|
|
||||||
<Stack horizontal>
|
|
||||||
<Text variant="small" style={{ lineHeight: "20px" }}>
|
|
||||||
Max RU/s
|
|
||||||
</Text>
|
|
||||||
<TooltipHost directionalHint={DirectionalHint.bottomLeftEdge} content={this.getAutoScaleTooltip()}>
|
|
||||||
<Icon iconName="InfoSolid" className="panelInfoIcon" />
|
|
||||||
</TooltipHost>
|
|
||||||
</Stack>
|
|
||||||
|
|
||||||
<TextField
|
|
||||||
type="number"
|
|
||||||
styles={{
|
|
||||||
fieldGroup: { width: 300, height: 27 },
|
|
||||||
field: { fontSize: 12 },
|
|
||||||
}}
|
|
||||||
onChange={(event, newInput?: string) => this.onThroughputValueChange(newInput)}
|
|
||||||
step={AutoPilotUtils.autoPilotIncrementStep}
|
|
||||||
min={AutoPilotUtils.minAutoPilotThroughput}
|
|
||||||
value={this.state.throughput.toString()}
|
|
||||||
aria-label="Max request units per second"
|
|
||||||
required={true}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<Text variant="small">
|
|
||||||
Your {this.props.isDatabase ? "database" : "container"} throughput will automatically scale from{" "}
|
|
||||||
<b>
|
|
||||||
{AutoPilotUtils.getMinRUsBasedOnUserInput(this.state.throughput)} RU/s (10% of max RU/s) -{" "}
|
|
||||||
{this.state.throughput} RU/s
|
|
||||||
</b>{" "}
|
|
||||||
based on usage.
|
|
||||||
</Text>
|
|
||||||
</Stack>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{!this.state.isAutoscaleSelected && (
|
|
||||||
<Stack className="throughputInputSpacing">
|
|
||||||
<Text variant="small">
|
|
||||||
Estimate your required RU/s with
|
|
||||||
<Link target="_blank" href="https://cosmos.azure.com/capacitycalculator/">
|
|
||||||
capacity calculator
|
|
||||||
</Link>
|
|
||||||
.
|
|
||||||
</Text>
|
|
||||||
|
|
||||||
<TooltipHost
|
|
||||||
directionalHint={DirectionalHint.topLeftEdge}
|
|
||||||
content={
|
|
||||||
this.props.showFreeTierExceedThroughputTooltip &&
|
|
||||||
this.state.throughput > SharedConstants.CollectionCreation.DefaultCollectionRUs400
|
|
||||||
? "The first 400 RU/s in this account are free. Billing will apply to any throughput beyond 400 RU/s."
|
|
||||||
: undefined
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<TextField
|
|
||||||
type="number"
|
|
||||||
styles={{
|
|
||||||
fieldGroup: { width: 300, height: 27 },
|
|
||||||
field: { fontSize: 12 },
|
|
||||||
}}
|
|
||||||
onChange={(event, newInput?: string) => this.onThroughputValueChange(newInput)}
|
|
||||||
step={100}
|
|
||||||
min={SharedConstants.CollectionCreation.DefaultCollectionRUs400}
|
|
||||||
max={userContext.isTryCosmosDBSubscription ? Constants.TryCosmosExperience.maxRU : Infinity}
|
|
||||||
value={this.state.throughput.toString()}
|
|
||||||
aria-label="Max request units per second"
|
|
||||||
required={true}
|
|
||||||
/>
|
|
||||||
</TooltipHost>
|
|
||||||
</Stack>
|
|
||||||
)}
|
|
||||||
|
|
||||||
<CostEstimateText requestUnits={this.state.throughput} isAutoscale={this.state.isAutoscaleSelected} />
|
|
||||||
|
|
||||||
{this.state.throughput > SharedConstants.CollectionCreation.DefaultCollectionRUs100K && (
|
|
||||||
<Stack horizontal verticalAlign="start">
|
|
||||||
<Checkbox
|
|
||||||
checked={this.state.isCostAcknowledged}
|
|
||||||
styles={{
|
|
||||||
checkbox: { width: 12, height: 12 },
|
|
||||||
label: { padding: 0, margin: "4px 4px 0 0" },
|
|
||||||
}}
|
|
||||||
onChange={(ev: React.FormEvent<HTMLElement>, isChecked: boolean) => {
|
|
||||||
this.setState({ isCostAcknowledged: isChecked });
|
|
||||||
this.props.onCostAcknowledgeChange(isChecked);
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
<Text variant="small" style={{ lineHeight: "20px" }}>
|
|
||||||
{this.getCostAcknowledgeText()}
|
|
||||||
</Text>
|
|
||||||
</Stack>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
private getThroughputLabelText(): string {
|
|
||||||
if (this.state.isAutoscaleSelected) {
|
|
||||||
return AutoPilotUtils.getAutoPilotHeaderText();
|
|
||||||
}
|
|
||||||
|
|
||||||
const minRU: string = SharedConstants.CollectionCreation.DefaultCollectionRUs400.toLocaleString();
|
|
||||||
const maxRU: string = userContext.isTryCosmosDBSubscription
|
|
||||||
? Constants.TryCosmosExperience.maxRU.toLocaleString()
|
|
||||||
: "unlimited";
|
|
||||||
return this.state.isAutoscaleSelected
|
|
||||||
? AutoPilotUtils.getAutoPilotHeaderText()
|
|
||||||
: `Throughput (${minRU} - ${maxRU} RU/s)`;
|
|
||||||
}
|
|
||||||
|
|
||||||
private onThroughputValueChange(newInput: string): void {
|
|
||||||
const newThroughput = parseInt(newInput);
|
|
||||||
this.setState({ throughput: newThroughput });
|
|
||||||
this.props.setThroughputValue(newThroughput);
|
|
||||||
}
|
|
||||||
|
|
||||||
private getAutoScaleTooltip(): string {
|
|
||||||
return `After the first ${AutoPilotUtils.getStorageBasedOnUserInput(
|
|
||||||
this.state.throughput
|
|
||||||
)} GB of data stored, the max
|
|
||||||
RU/s will be automatically upgraded based on the new storage value.`;
|
|
||||||
}
|
|
||||||
|
|
||||||
private getCostAcknowledgeText(): string {
|
|
||||||
const databaseAccount = userContext.databaseAccount;
|
|
||||||
if (!databaseAccount || !databaseAccount.properties) {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
const numberOfRegions: number = databaseAccount.properties.readLocations?.length || 1;
|
|
||||||
const multimasterEnabled: boolean = databaseAccount.properties.enableMultipleWriteLocations;
|
|
||||||
|
|
||||||
return PricingUtils.getEstimatedSpendAcknowledgeString(
|
|
||||||
this.state.throughput,
|
|
||||||
userContext.portalEnv,
|
|
||||||
numberOfRegions,
|
|
||||||
multimasterEnabled,
|
|
||||||
this.state.isAutoscaleSelected
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
private onAutoscaleRadioBtnChange(event: React.ChangeEvent<HTMLInputElement>): void {
|
|
||||||
if (event.target.checked && !this.state.isAutoscaleSelected) {
|
|
||||||
this.setState({ isAutoscaleSelected: true, throughput: AutoPilotUtils.minAutoPilotThroughput });
|
|
||||||
this.props.setIsAutoscale(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private onManualRadioBtnChange(event: React.ChangeEvent<HTMLInputElement>): void {
|
|
||||||
if (event.target.checked && this.state.isAutoscaleSelected) {
|
|
||||||
this.setState({
|
|
||||||
isAutoscaleSelected: false,
|
|
||||||
throughput: SharedConstants.CollectionCreation.DefaultCollectionRUs400,
|
|
||||||
});
|
|
||||||
this.props.setIsAutoscale(false);
|
|
||||||
this.props.setThroughputValue(SharedConstants.CollectionCreation.DefaultCollectionRUs400);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
interface CostEstimateTextProps {
|
|
||||||
requestUnits: number;
|
|
||||||
isAutoscale: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
const CostEstimateText: React.FunctionComponent<CostEstimateTextProps> = (props: CostEstimateTextProps) => {
|
|
||||||
const { requestUnits, isAutoscale } = props;
|
|
||||||
const databaseAccount = userContext.databaseAccount;
|
|
||||||
if (!databaseAccount || !databaseAccount.properties) {
|
|
||||||
return <></>;
|
|
||||||
}
|
|
||||||
|
|
||||||
const serverId: string = userContext.portalEnv;
|
|
||||||
const numberOfRegions: number = databaseAccount.properties.readLocations?.length || 1;
|
|
||||||
const multimasterEnabled: boolean = databaseAccount.properties.enableMultipleWriteLocations;
|
|
||||||
const hourlyPrice: number = PricingUtils.computeRUUsagePriceHourly({
|
|
||||||
serverId,
|
|
||||||
requestUnits,
|
|
||||||
numberOfRegions,
|
|
||||||
multimasterEnabled,
|
|
||||||
isAutoscale,
|
|
||||||
});
|
|
||||||
const dailyPrice: number = hourlyPrice * 24;
|
|
||||||
const monthlyPrice: number = hourlyPrice * SharedConstants.hoursInAMonth;
|
|
||||||
const currency: string = PricingUtils.getPriceCurrency(serverId);
|
|
||||||
const currencySign: string = PricingUtils.getCurrencySign(serverId);
|
|
||||||
const multiplier = PricingUtils.getMultimasterMultiplier(numberOfRegions, multimasterEnabled);
|
|
||||||
const pricePerRu = isAutoscale
|
|
||||||
? PricingUtils.getAutoscalePricePerRu(serverId, multiplier) * multiplier
|
|
||||||
: PricingUtils.getPricePerRu(serverId) * multiplier;
|
|
||||||
|
|
||||||
if (isAutoscale) {
|
|
||||||
return (
|
|
||||||
<Text variant="small">
|
|
||||||
Estimated monthly cost ({currency}):{" "}
|
|
||||||
<b>
|
|
||||||
{currencySign + PricingUtils.calculateEstimateNumber(monthlyPrice / 10)} -{" "}
|
|
||||||
{currencySign + PricingUtils.calculateEstimateNumber(monthlyPrice)}{" "}
|
|
||||||
</b>
|
|
||||||
({numberOfRegions + (numberOfRegions === 1 ? " region" : " regions")}, {requestUnits / 10} - {requestUnits}{" "}
|
|
||||||
RU/s, {currencySign + pricePerRu}/RU)
|
|
||||||
</Text>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Text variant="small">
|
|
||||||
Cost ({currency}):{" "}
|
|
||||||
<b>
|
|
||||||
{currencySign + PricingUtils.calculateEstimateNumber(hourlyPrice)} hourly /{" "}
|
|
||||||
{currencySign + PricingUtils.calculateEstimateNumber(dailyPrice)} daily /{" "}
|
|
||||||
{currencySign + PricingUtils.calculateEstimateNumber(monthlyPrice)} monthly{" "}
|
|
||||||
</b>
|
|
||||||
({numberOfRegions + (numberOfRegions === 1 ? " region" : " regions")}, {requestUnits}RU/s,{" "}
|
|
||||||
{currencySign + pricePerRu}/RU)
|
|
||||||
<br />
|
|
||||||
<em>{PricingUtils.estimatedCostDisclaimer}</em>
|
|
||||||
</Text>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
@@ -21,7 +21,7 @@ import * as DataModels from "../Contracts/DataModels";
|
|||||||
import { MessageTypes } from "../Contracts/ExplorerContracts";
|
import { MessageTypes } from "../Contracts/ExplorerContracts";
|
||||||
import { SubscriptionType } from "../Contracts/SubscriptionType";
|
import { SubscriptionType } from "../Contracts/SubscriptionType";
|
||||||
import * as ViewModels from "../Contracts/ViewModels";
|
import * as ViewModels from "../Contracts/ViewModels";
|
||||||
import { IGalleryItem } from "../Juno/JunoClient";
|
import { IGalleryItem, IPinnedRepo } from "../Juno/JunoClient";
|
||||||
import { NotebookWorkspaceManager } from "../NotebookWorkspaceManager/NotebookWorkspaceManager";
|
import { NotebookWorkspaceManager } from "../NotebookWorkspaceManager/NotebookWorkspaceManager";
|
||||||
import { ResourceProviderClientFactory } from "../ResourceProvider/ResourceProviderClientFactory";
|
import { ResourceProviderClientFactory } from "../ResourceProvider/ResourceProviderClientFactory";
|
||||||
import { RouteHandler } from "../RouteHandlers/RouteHandler";
|
import { RouteHandler } from "../RouteHandlers/RouteHandler";
|
||||||
@@ -48,7 +48,6 @@ import { FileSystemUtil } from "./Notebook/FileSystemUtil";
|
|||||||
import { NotebookContentItem, NotebookContentItemType } from "./Notebook/NotebookContentItem";
|
import { NotebookContentItem, NotebookContentItemType } from "./Notebook/NotebookContentItem";
|
||||||
import { NotebookUtil } from "./Notebook/NotebookUtil";
|
import { NotebookUtil } from "./Notebook/NotebookUtil";
|
||||||
import AddCollectionPane from "./Panes/AddCollectionPane";
|
import AddCollectionPane from "./Panes/AddCollectionPane";
|
||||||
import { AddCollectionPanel } from "./Panes/AddCollectionPanel";
|
|
||||||
import AddDatabasePane from "./Panes/AddDatabasePane";
|
import AddDatabasePane from "./Panes/AddDatabasePane";
|
||||||
import { BrowseQueriesPane } from "./Panes/BrowseQueriesPane";
|
import { BrowseQueriesPane } from "./Panes/BrowseQueriesPane";
|
||||||
import CassandraAddCollectionPane from "./Panes/CassandraAddCollectionPane";
|
import CassandraAddCollectionPane from "./Panes/CassandraAddCollectionPane";
|
||||||
@@ -78,7 +77,6 @@ import { TabsManager } from "./Tabs/TabsManager";
|
|||||||
import TerminalTab from "./Tabs/TerminalTab";
|
import TerminalTab from "./Tabs/TerminalTab";
|
||||||
import Database from "./Tree/Database";
|
import Database from "./Tree/Database";
|
||||||
import ResourceTokenCollection from "./Tree/ResourceTokenCollection";
|
import ResourceTokenCollection from "./Tree/ResourceTokenCollection";
|
||||||
import { ResourceTreeAdapter } from "./Tree/ResourceTreeAdapter";
|
|
||||||
import { ResourceTreeAdapterForResourceToken } from "./Tree/ResourceTreeAdapterForResourceToken";
|
import { ResourceTreeAdapterForResourceToken } from "./Tree/ResourceTreeAdapterForResourceToken";
|
||||||
import StoredProcedure from "./Tree/StoredProcedure";
|
import StoredProcedure from "./Tree/StoredProcedure";
|
||||||
import Trigger from "./Tree/Trigger";
|
import Trigger from "./Tree/Trigger";
|
||||||
@@ -96,6 +94,10 @@ export interface ExplorerParams {
|
|||||||
closeSidePanel: () => void;
|
closeSidePanel: () => void;
|
||||||
closeDialog: () => void;
|
closeDialog: () => void;
|
||||||
openDialog: (props: DialogProps) => void;
|
openDialog: (props: DialogProps) => void;
|
||||||
|
|
||||||
|
onRefreshNotebookList: () => void;
|
||||||
|
initializeGitHubRepos: (pinnedRepos: IPinnedRepo[]) => void;
|
||||||
|
getMyNotebooksContentRoot: () => NotebookContentItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class Explorer {
|
export default class Explorer {
|
||||||
@@ -164,6 +166,8 @@ export default class Explorer {
|
|||||||
public isAccountReady: ko.Observable<boolean>;
|
public isAccountReady: ko.Observable<boolean>;
|
||||||
public canSaveQueries: ko.Computed<boolean>;
|
public canSaveQueries: ko.Computed<boolean>;
|
||||||
public features: ko.Observable<any>;
|
public features: ko.Observable<any>;
|
||||||
|
public serverId: ko.Observable<string>;
|
||||||
|
public isTryCosmosDBSubscription: ko.Observable<boolean>;
|
||||||
public queriesClient: QueriesClient;
|
public queriesClient: QueriesClient;
|
||||||
public tableDataClient: TableDataClient;
|
public tableDataClient: TableDataClient;
|
||||||
public splitter: Splitter;
|
public splitter: Splitter;
|
||||||
@@ -185,15 +189,20 @@ export default class Explorer {
|
|||||||
public selectedCollectionId: ko.Computed<string>;
|
public selectedCollectionId: ko.Computed<string>;
|
||||||
public isLeftPaneExpanded: ko.Observable<boolean>;
|
public isLeftPaneExpanded: ko.Observable<boolean>;
|
||||||
public selectedNode: ko.Observable<ViewModels.TreeNode>;
|
public selectedNode: ko.Observable<ViewModels.TreeNode>;
|
||||||
private resourceTree: ResourceTreeAdapter;
|
/**
|
||||||
|
* @deprecated
|
||||||
|
* Use a local loading state and spinner instead. Using a global isRefreshing state causes problems.
|
||||||
|
* */
|
||||||
|
public isRefreshingExplorer: ko.Observable<boolean>;
|
||||||
|
|
||||||
// Resource Token
|
// Resource Token
|
||||||
public resourceTokenDatabaseId: ko.Observable<string>;
|
public resourceTokenDatabaseId: ko.Observable<string>;
|
||||||
public resourceTokenCollectionId: ko.Observable<string>;
|
public resourceTokenCollectionId: ko.Observable<string>;
|
||||||
public resourceTokenCollection: ko.Observable<ViewModels.CollectionBase>;
|
public resourceTokenCollection: ko.Observable<ViewModels.CollectionBase>;
|
||||||
public resourceTokenPartitionKey: ko.Observable<string>;
|
public resourceTokenPartitionKey: ko.Observable<string>;
|
||||||
|
public isAuthWithResourceToken: ko.Observable<boolean>;
|
||||||
public isResourceTokenCollectionNodeSelected: ko.Computed<boolean>;
|
public isResourceTokenCollectionNodeSelected: ko.Computed<boolean>;
|
||||||
public resourceTreeForResourceToken: ResourceTreeAdapterForResourceToken;
|
private resourceTreeForResourceToken: ResourceTreeAdapterForResourceToken;
|
||||||
|
|
||||||
// Tabs
|
// Tabs
|
||||||
public isTabsContentExpanded: ko.Observable<boolean>;
|
public isTabsContentExpanded: ko.Observable<boolean>;
|
||||||
@@ -271,7 +280,7 @@ export default class Explorer {
|
|||||||
|
|
||||||
private static readonly MaxNbDatabasesToAutoExpand = 5;
|
private static readonly MaxNbDatabasesToAutoExpand = 5;
|
||||||
|
|
||||||
constructor(params?: ExplorerParams) {
|
constructor(public params?: ExplorerParams) {
|
||||||
this.setIsNotificationConsoleExpanded = params?.setIsNotificationConsoleExpanded;
|
this.setIsNotificationConsoleExpanded = params?.setIsNotificationConsoleExpanded;
|
||||||
this.setNotificationConsoleData = params?.setNotificationConsoleData;
|
this.setNotificationConsoleData = params?.setNotificationConsoleData;
|
||||||
this.setInProgressConsoleDataIdToBeDeleted = params?.setInProgressConsoleDataIdToBeDeleted;
|
this.setInProgressConsoleDataIdToBeDeleted = params?.setInProgressConsoleDataIdToBeDeleted;
|
||||||
@@ -294,6 +303,22 @@ export default class Explorer {
|
|||||||
|
|
||||||
this.databaseAccount = ko.observable<DataModels.DatabaseAccount>();
|
this.databaseAccount = ko.observable<DataModels.DatabaseAccount>();
|
||||||
this.subscriptionType = ko.observable<SubscriptionType>(SharedConstants.CollectionCreation.DefaultSubscriptionType);
|
this.subscriptionType = ko.observable<SubscriptionType>(SharedConstants.CollectionCreation.DefaultSubscriptionType);
|
||||||
|
let firstInitialization = true;
|
||||||
|
this.isRefreshingExplorer = ko.observable<boolean>(true);
|
||||||
|
this.isRefreshingExplorer.subscribe((isRefreshing: boolean) => {
|
||||||
|
if (!isRefreshing && firstInitialization) {
|
||||||
|
// set focus on first element
|
||||||
|
firstInitialization = false;
|
||||||
|
try {
|
||||||
|
document.getElementById("createNewContainerCommandButton").parentElement.parentElement.focus();
|
||||||
|
} catch (e) {
|
||||||
|
Logger.logWarning(
|
||||||
|
"getElementById('createNewContainerCommandButton') failed to find element",
|
||||||
|
"Explorer/this.isRefreshingExplorer.subscribe"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
this.isAccountReady = ko.observable<boolean>(false);
|
this.isAccountReady = ko.observable<boolean>(false);
|
||||||
this._isInitializingNotebooks = false;
|
this._isInitializingNotebooks = false;
|
||||||
this.arcadiaToken = ko.observable<string>();
|
this.arcadiaToken = ko.observable<string>();
|
||||||
@@ -314,9 +339,7 @@ export default class Explorer {
|
|||||||
this.isSynapseLinkUpdating = ko.observable<boolean>(false);
|
this.isSynapseLinkUpdating = ko.observable<boolean>(false);
|
||||||
this.isAccountReady.subscribe(async (isAccountReady: boolean) => {
|
this.isAccountReady.subscribe(async (isAccountReady: boolean) => {
|
||||||
if (isAccountReady) {
|
if (isAccountReady) {
|
||||||
userContext.authType === AuthType.ResourceToken
|
this.isAuthWithResourceToken() ? this.refreshDatabaseForResourceToken() : this.refreshAllDatabases(true);
|
||||||
? this.refreshDatabaseForResourceToken()
|
|
||||||
: this.refreshAllDatabases(true);
|
|
||||||
RouteHandler.getInstance().initHandler();
|
RouteHandler.getInstance().initHandler();
|
||||||
this.notebookWorkspaceManager = new NotebookWorkspaceManager();
|
this.notebookWorkspaceManager = new NotebookWorkspaceManager();
|
||||||
this.arcadiaWorkspaces = ko.observableArray();
|
this.arcadiaWorkspaces = ko.observableArray();
|
||||||
@@ -327,7 +350,7 @@ export default class Explorer {
|
|||||||
Promise.all([this._refreshNotebooksEnabledStateForAccount(), this._refreshSparkEnabledStateForAccount()]).then(
|
Promise.all([this._refreshNotebooksEnabledStateForAccount(), this._refreshSparkEnabledStateForAccount()]).then(
|
||||||
async () => {
|
async () => {
|
||||||
this.isNotebookEnabled(
|
this.isNotebookEnabled(
|
||||||
userContext.authType !== AuthType.ResourceToken &&
|
!this.isAuthWithResourceToken() &&
|
||||||
((await this._containsDefaultNotebookWorkspace(this.databaseAccount())) ||
|
((await this._containsDefaultNotebookWorkspace(this.databaseAccount())) ||
|
||||||
this.isFeatureEnabled(Constants.Features.enableNotebooks))
|
this.isFeatureEnabled(Constants.Features.enableNotebooks))
|
||||||
);
|
);
|
||||||
@@ -376,12 +399,15 @@ export default class Explorer {
|
|||||||
this.memoryUsageInfo = ko.observable<DataModels.MemoryUsageInfo>();
|
this.memoryUsageInfo = ko.observable<DataModels.MemoryUsageInfo>();
|
||||||
|
|
||||||
this.features = ko.observable();
|
this.features = ko.observable();
|
||||||
|
this.serverId = ko.observable<string>();
|
||||||
this.queriesClient = new QueriesClient(this);
|
this.queriesClient = new QueriesClient(this);
|
||||||
|
this.isTryCosmosDBSubscription = ko.observable<boolean>(false);
|
||||||
|
|
||||||
this.resourceTokenDatabaseId = ko.observable<string>();
|
this.resourceTokenDatabaseId = ko.observable<string>();
|
||||||
this.resourceTokenCollectionId = ko.observable<string>();
|
this.resourceTokenCollectionId = ko.observable<string>();
|
||||||
this.resourceTokenCollection = ko.observable<ViewModels.CollectionBase>();
|
this.resourceTokenCollection = ko.observable<ViewModels.CollectionBase>();
|
||||||
this.resourceTokenPartitionKey = ko.observable<string>();
|
this.resourceTokenPartitionKey = ko.observable<string>();
|
||||||
|
this.isAuthWithResourceToken = ko.observable<boolean>(false);
|
||||||
this.isGitHubPaneEnabled = ko.observable<boolean>(false);
|
this.isGitHubPaneEnabled = ko.observable<boolean>(false);
|
||||||
this.isMongoIndexingEnabled = ko.observable<boolean>(false);
|
this.isMongoIndexingEnabled = ko.observable<boolean>(false);
|
||||||
this.isPublishNotebookPaneEnabled = ko.observable<boolean>(false);
|
this.isPublishNotebookPaneEnabled = ko.observable<boolean>(false);
|
||||||
@@ -854,7 +880,6 @@ export default class Explorer {
|
|||||||
this.notebookManager.initialize({
|
this.notebookManager.initialize({
|
||||||
container: this,
|
container: this,
|
||||||
notebookBasePath: this.notebookBasePath,
|
notebookBasePath: this.notebookBasePath,
|
||||||
resourceTree: this.resourceTree,
|
|
||||||
refreshCommandBarButtons: () => this.refreshCommandBarButtons(),
|
refreshCommandBarButtons: () => this.refreshCommandBarButtons(),
|
||||||
refreshNotebookList: () => this.refreshNotebookList(),
|
refreshNotebookList: () => this.refreshNotebookList(),
|
||||||
});
|
});
|
||||||
@@ -869,7 +894,6 @@ export default class Explorer {
|
|||||||
|
|
||||||
this.isSparkEnabled = ko.observable(false);
|
this.isSparkEnabled = ko.observable(false);
|
||||||
this.isSparkEnabled.subscribe((isEnabled: boolean) => this.refreshCommandBarButtons());
|
this.isSparkEnabled.subscribe((isEnabled: boolean) => this.refreshCommandBarButtons());
|
||||||
this.resourceTree = new ResourceTreeAdapter(this);
|
|
||||||
this.resourceTreeForResourceToken = new ResourceTreeAdapterForResourceToken(this);
|
this.resourceTreeForResourceToken = new ResourceTreeAdapterForResourceToken(this);
|
||||||
this.notebookServerInfo = ko.observable<DataModels.NotebookWorkspaceConnectionInfo>({
|
this.notebookServerInfo = ko.observable<DataModels.NotebookWorkspaceConnectionInfo>({
|
||||||
notebookServerEndpoint: undefined,
|
notebookServerEndpoint: undefined,
|
||||||
@@ -1062,6 +1086,7 @@ export default class Explorer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public refreshAllDatabases(isInitialLoad?: boolean): Q.Promise<any> {
|
public refreshAllDatabases(isInitialLoad?: boolean): Q.Promise<any> {
|
||||||
|
this.isRefreshingExplorer(true);
|
||||||
const startKey: number = TelemetryProcessor.traceStart(Action.LoadDatabases, {
|
const startKey: number = TelemetryProcessor.traceStart(Action.LoadDatabases, {
|
||||||
dataExplorerArea: Constants.Areas.ResourceTree,
|
dataExplorerArea: Constants.Areas.ResourceTree,
|
||||||
});
|
});
|
||||||
@@ -1091,19 +1116,22 @@ export default class Explorer {
|
|||||||
this.deleteDatabasesFromList(deltaDatabases.toDelete);
|
this.deleteDatabasesFromList(deltaDatabases.toDelete);
|
||||||
this.selectedNode(currentlySelectedNode);
|
this.selectedNode(currentlySelectedNode);
|
||||||
this._setLoadingStatusText("Fetching containers...");
|
this._setLoadingStatusText("Fetching containers...");
|
||||||
this.refreshAndExpandNewDatabases(deltaDatabases.toAdd).then(
|
this.refreshAndExpandNewDatabases(deltaDatabases.toAdd)
|
||||||
() => {
|
.then(
|
||||||
this._setLoadingStatusText("Successfully fetched containers.");
|
() => {
|
||||||
deferred.resolve();
|
this._setLoadingStatusText("Successfully fetched containers.");
|
||||||
},
|
deferred.resolve();
|
||||||
(reason) => {
|
},
|
||||||
this._setLoadingStatusText("Failed to fetch containers.");
|
(reason) => {
|
||||||
deferred.reject(reason);
|
this._setLoadingStatusText("Failed to fetch containers.");
|
||||||
}
|
deferred.reject(reason);
|
||||||
);
|
}
|
||||||
|
)
|
||||||
|
.finally(() => this.isRefreshingExplorer(false));
|
||||||
},
|
},
|
||||||
(error) => {
|
(error) => {
|
||||||
this._setLoadingStatusText("Failed to fetch databases.");
|
this._setLoadingStatusText("Failed to fetch databases.");
|
||||||
|
this.isRefreshingExplorer(false);
|
||||||
deferred.reject(error);
|
deferred.reject(error);
|
||||||
const errorMessage = getErrorMessage(error);
|
const errorMessage = getErrorMessage(error);
|
||||||
TelemetryProcessor.traceFailure(
|
TelemetryProcessor.traceFailure(
|
||||||
@@ -1163,9 +1191,8 @@ export default class Explorer {
|
|||||||
description: "Refresh button clicked",
|
description: "Refresh button clicked",
|
||||||
dataExplorerArea: Constants.Areas.ResourceTree,
|
dataExplorerArea: Constants.Areas.ResourceTree,
|
||||||
});
|
});
|
||||||
userContext.authType === AuthType.ResourceToken
|
this.isRefreshingExplorer(true);
|
||||||
? this.refreshDatabaseForResourceToken()
|
this.isAuthWithResourceToken() ? this.refreshDatabaseForResourceToken() : this.refreshAllDatabases();
|
||||||
: this.refreshAllDatabases();
|
|
||||||
this.refreshNotebookList();
|
this.refreshNotebookList();
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1414,12 +1441,15 @@ export default class Explorer {
|
|||||||
this.collectionCreationDefaults = inputs.defaultCollectionThroughput;
|
this.collectionCreationDefaults = inputs.defaultCollectionThroughput;
|
||||||
}
|
}
|
||||||
this.features(inputs.features);
|
this.features(inputs.features);
|
||||||
|
this.serverId(inputs.serverId ?? Constants.ServerIds.productionPortal);
|
||||||
this.databaseAccount(databaseAccount);
|
this.databaseAccount(databaseAccount);
|
||||||
this.subscriptionType(inputs.subscriptionType ?? SharedConstants.CollectionCreation.DefaultSubscriptionType);
|
this.subscriptionType(inputs.subscriptionType ?? SharedConstants.CollectionCreation.DefaultSubscriptionType);
|
||||||
this.hasWriteAccess(inputs.hasWriteAccess ?? true);
|
this.hasWriteAccess(inputs.hasWriteAccess ?? true);
|
||||||
if (inputs.addCollectionDefaultFlight) {
|
if (inputs.addCollectionDefaultFlight) {
|
||||||
this.flight(inputs.addCollectionDefaultFlight);
|
this.flight(inputs.addCollectionDefaultFlight);
|
||||||
}
|
}
|
||||||
|
this.isTryCosmosDBSubscription(inputs.isTryCosmosDBSubscription ?? false);
|
||||||
|
this.isAuthWithResourceToken(inputs.isAuthWithresourceToken ?? false);
|
||||||
this.setFeatureFlagsFromFlights(inputs.flights);
|
this.setFeatureFlagsFromFlights(inputs.flights);
|
||||||
TelemetryProcessor.traceSuccess(
|
TelemetryProcessor.traceSuccess(
|
||||||
Action.LoadDatabaseAccount,
|
Action.LoadDatabaseAccount,
|
||||||
@@ -1500,9 +1530,9 @@ export default class Explorer {
|
|||||||
|
|
||||||
public isRunningOnNationalCloud(): boolean {
|
public isRunningOnNationalCloud(): boolean {
|
||||||
return (
|
return (
|
||||||
userContext.portalEnv === "blackforest" ||
|
this.serverId() === Constants.ServerIds.blackforest ||
|
||||||
userContext.portalEnv === "fairfax" ||
|
this.serverId() === Constants.ServerIds.fairfax ||
|
||||||
userContext.portalEnv === "mooncake"
|
this.serverId() === Constants.ServerIds.mooncake
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1677,7 +1707,7 @@ export default class Explorer {
|
|||||||
|
|
||||||
const promise = this.notebookManager?.notebookContentClient.uploadFileAsync(name, content, parent);
|
const promise = this.notebookManager?.notebookContentClient.uploadFileAsync(name, content, parent);
|
||||||
promise
|
promise
|
||||||
.then(() => this.resourceTree.triggerRender())
|
.then(() => this.params.onRefreshNotebookList())
|
||||||
.catch((reason: any) => this.showOkModalDialog("Unable to upload file", reason));
|
.catch((reason: any) => this.showOkModalDialog("Unable to upload file", reason));
|
||||||
return promise;
|
return promise;
|
||||||
}
|
}
|
||||||
@@ -1685,7 +1715,7 @@ export default class Explorer {
|
|||||||
public async importAndOpen(path: string): Promise<boolean> {
|
public async importAndOpen(path: string): Promise<boolean> {
|
||||||
const name = NotebookUtil.getName(path);
|
const name = NotebookUtil.getName(path);
|
||||||
const item = NotebookUtil.createNotebookContentItem(name, path, "file");
|
const item = NotebookUtil.createNotebookContentItem(name, path, "file");
|
||||||
const parent = this.resourceTree.myNotebooksContentRoot;
|
const parent = this.params.getMyNotebooksContentRoot();
|
||||||
|
|
||||||
if (parent && parent.children && this.isNotebookEnabled() && this.notebookManager?.notebookClient) {
|
if (parent && parent.children && this.isNotebookEnabled() && this.notebookManager?.notebookClient) {
|
||||||
const existingItem = _.find(parent.children, (node) => node.name === name);
|
const existingItem = _.find(parent.children, (node) => node.name === name);
|
||||||
@@ -1702,7 +1732,8 @@ export default class Explorer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public async importAndOpenContent(name: string, content: string): Promise<boolean> {
|
public async importAndOpenContent(name: string, content: string): Promise<boolean> {
|
||||||
const parent = this.resourceTree.myNotebooksContentRoot;
|
// const parent = this.params.getMyNotebooksContentRoot();
|
||||||
|
const parent = this.params.getMyNotebooksContentRoot();
|
||||||
|
|
||||||
if (parent && parent.children && this.isNotebookEnabled() && this.notebookManager?.notebookClient) {
|
if (parent && parent.children && this.isNotebookEnabled() && this.notebookManager?.notebookClient) {
|
||||||
if (this.notebookToImport && this.notebookToImport.name === name && this.notebookToImport.content === content) {
|
if (this.notebookToImport && this.notebookToImport.name === name && this.notebookToImport.content === content) {
|
||||||
@@ -1887,7 +1918,6 @@ export default class Explorer {
|
|||||||
|
|
||||||
return newNotebookFile;
|
return newNotebookFile;
|
||||||
});
|
});
|
||||||
result.then(() => this.resourceTree.triggerRender());
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1908,7 +1938,6 @@ export default class Explorer {
|
|||||||
defaultInput: "",
|
defaultInput: "",
|
||||||
onSubmit: (input: string) => this.notebookManager?.notebookContentClient.createDirectory(parent, input),
|
onSubmit: (input: string) => this.notebookManager?.notebookContentClient.createDirectory(parent, input),
|
||||||
});
|
});
|
||||||
result.then(() => this.resourceTree.triggerRender());
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2064,12 +2093,14 @@ export default class Explorer {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private refreshNotebookList = async (): Promise<void> => {
|
private refreshNotebookList = async (): Promise<void> => {
|
||||||
if (!this.isNotebookEnabled() || !this.notebookManager?.notebookContentClient) {
|
if (!this.isNotebookEnabled() || !this.notebookManager?.notebookContentClient) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.resourceTree.initialize();
|
this.params?.onRefreshNotebookList();
|
||||||
|
|
||||||
this.notebookManager?.refreshPinnedRepos();
|
this.notebookManager?.refreshPinnedRepos();
|
||||||
if (this.notebookToImport) {
|
if (this.notebookToImport) {
|
||||||
this.importAndOpenContent(this.notebookToImport.name, this.notebookToImport.content);
|
this.importAndOpenContent(this.notebookToImport.name, this.notebookToImport.content);
|
||||||
@@ -2132,7 +2163,7 @@ export default class Explorer {
|
|||||||
throw new Error(error);
|
throw new Error(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
parent = parent || this.resourceTree.myNotebooksContentRoot;
|
parent = parent || this.params.getMyNotebooksContentRoot();
|
||||||
|
|
||||||
const notificationProgressId = NotificationConsoleUtils.logConsoleMessage(
|
const notificationProgressId = NotificationConsoleUtils.logConsoleMessage(
|
||||||
ConsoleDataType.InProgress,
|
ConsoleDataType.InProgress,
|
||||||
@@ -2156,7 +2187,7 @@ export default class Explorer {
|
|||||||
);
|
);
|
||||||
return this.openNotebook(newFile);
|
return this.openNotebook(newFile);
|
||||||
})
|
})
|
||||||
.then(() => this.resourceTree.triggerRender())
|
.then(() => this.params.onRefreshNotebookList())
|
||||||
.catch((error: any) => {
|
.catch((error: any) => {
|
||||||
const errorMessage = `Failed to create a new notebook: ${getErrorMessage(error)}`;
|
const errorMessage = `Failed to create a new notebook: ${getErrorMessage(error)}`;
|
||||||
NotificationConsoleUtils.logConsoleMessage(ConsoleDataType.Error, errorMessage);
|
NotificationConsoleUtils.logConsoleMessage(ConsoleDataType.Error, errorMessage);
|
||||||
@@ -2174,7 +2205,7 @@ export default class Explorer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public onUploadToNotebookServerClicked(parent?: NotebookContentItem): void {
|
public onUploadToNotebookServerClicked(parent?: NotebookContentItem): void {
|
||||||
parent = parent || this.resourceTree.myNotebooksContentRoot;
|
parent = parent || this.params.getMyNotebooksContentRoot();
|
||||||
|
|
||||||
this.uploadFilePane.openWithOptions({
|
this.uploadFilePane.openWithOptions({
|
||||||
paneTitle: "Upload file to notebook server",
|
paneTitle: "Upload file to notebook server",
|
||||||
@@ -2205,7 +2236,7 @@ export default class Explorer {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public refreshContentItem(item: NotebookContentItem): Promise<void> {
|
public refreshContentItem(item: NotebookContentItem): Promise<NotebookContentItem> {
|
||||||
if (!this.isNotebookEnabled() || !this.notebookManager?.notebookContentClient) {
|
if (!this.isNotebookEnabled() || !this.notebookManager?.notebookContentClient) {
|
||||||
const error = "Attempt to refresh notebook list, but notebook is not enabled";
|
const error = "Attempt to refresh notebook list, but notebook is not enabled";
|
||||||
handleError(error, "Explorer/refreshContentItem");
|
handleError(error, "Explorer/refreshContentItem");
|
||||||
@@ -2367,12 +2398,10 @@ export default class Explorer {
|
|||||||
public onNewCollectionClicked(): void {
|
public onNewCollectionClicked(): void {
|
||||||
if (this.isPreferredApiCassandra()) {
|
if (this.isPreferredApiCassandra()) {
|
||||||
this.cassandraAddCollectionPane.open();
|
this.cassandraAddCollectionPane.open();
|
||||||
} else if (this.isFeatureEnabled(Constants.Features.enableReactPane)) {
|
|
||||||
this.openAddCollectionPanel();
|
|
||||||
} else {
|
} else {
|
||||||
this.addCollectionPane.open(this.selectedDatabaseId());
|
this.addCollectionPane.open(this.selectedDatabaseId());
|
||||||
document.getElementById("linkAddCollection").focus();
|
|
||||||
}
|
}
|
||||||
|
document.getElementById("linkAddCollection").focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
private refreshCommandBarButtons(): void {
|
private refreshCommandBarButtons(): void {
|
||||||
@@ -2512,16 +2541,4 @@ export default class Explorer {
|
|||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async openAddCollectionPanel(): Promise<void> {
|
|
||||||
await this.loadDatabaseOffers();
|
|
||||||
this.openSidePanel(
|
|
||||||
"New Collection",
|
|
||||||
<AddCollectionPanel
|
|
||||||
explorer={this}
|
|
||||||
closePanel={() => this.closeSidePanel()}
|
|
||||||
openNotificationConsole={() => this.expandConsole()}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,8 @@
|
|||||||
import * as ko from "knockout";
|
import * as ko from "knockout";
|
||||||
import { AuthType } from "../../../AuthType";
|
|
||||||
import { GitHubOAuthService } from "../../../GitHub/GitHubOAuthService";
|
|
||||||
import { updateUserContext } from "../../../UserContext";
|
|
||||||
import Explorer from "../../Explorer";
|
|
||||||
import NotebookManager from "../../Notebook/NotebookManager";
|
|
||||||
import * as CommandBarComponentButtonFactory from "./CommandBarComponentButtonFactory";
|
import * as CommandBarComponentButtonFactory from "./CommandBarComponentButtonFactory";
|
||||||
|
import { GitHubOAuthService } from "../../../GitHub/GitHubOAuthService";
|
||||||
|
import NotebookManager from "../../Notebook/NotebookManager";
|
||||||
|
import Explorer from "../../Explorer";
|
||||||
|
|
||||||
describe("CommandBarComponentButtonFactory tests", () => {
|
describe("CommandBarComponentButtonFactory tests", () => {
|
||||||
let mockExplorer: Explorer;
|
let mockExplorer: Explorer;
|
||||||
@@ -15,6 +13,7 @@ describe("CommandBarComponentButtonFactory tests", () => {
|
|||||||
beforeAll(() => {
|
beforeAll(() => {
|
||||||
mockExplorer = {} as Explorer;
|
mockExplorer = {} as Explorer;
|
||||||
mockExplorer.addCollectionText = ko.observable("mockText");
|
mockExplorer.addCollectionText = ko.observable("mockText");
|
||||||
|
mockExplorer.isAuthWithResourceToken = ko.observable(false);
|
||||||
mockExplorer.isPreferredApiTable = ko.computed(() => true);
|
mockExplorer.isPreferredApiTable = ko.computed(() => true);
|
||||||
mockExplorer.isPreferredApiMongoDB = ko.computed<boolean>(() => false);
|
mockExplorer.isPreferredApiMongoDB = ko.computed<boolean>(() => false);
|
||||||
mockExplorer.isPreferredApiCassandra = ko.computed<boolean>(() => false);
|
mockExplorer.isPreferredApiCassandra = ko.computed<boolean>(() => false);
|
||||||
@@ -54,6 +53,7 @@ describe("CommandBarComponentButtonFactory tests", () => {
|
|||||||
beforeAll(() => {
|
beforeAll(() => {
|
||||||
mockExplorer = {} as Explorer;
|
mockExplorer = {} as Explorer;
|
||||||
mockExplorer.addCollectionText = ko.observable("mockText");
|
mockExplorer.addCollectionText = ko.observable("mockText");
|
||||||
|
mockExplorer.isAuthWithResourceToken = ko.observable(false);
|
||||||
mockExplorer.isPreferredApiTable = ko.computed(() => true);
|
mockExplorer.isPreferredApiTable = ko.computed(() => true);
|
||||||
mockExplorer.isPreferredApiMongoDB = ko.computed<boolean>(() => false);
|
mockExplorer.isPreferredApiMongoDB = ko.computed<boolean>(() => false);
|
||||||
mockExplorer.isPreferredApiCassandra = ko.computed<boolean>(() => false);
|
mockExplorer.isPreferredApiCassandra = ko.computed<boolean>(() => false);
|
||||||
@@ -118,6 +118,7 @@ describe("CommandBarComponentButtonFactory tests", () => {
|
|||||||
beforeAll(() => {
|
beforeAll(() => {
|
||||||
mockExplorer = {} as Explorer;
|
mockExplorer = {} as Explorer;
|
||||||
mockExplorer.addCollectionText = ko.observable("mockText");
|
mockExplorer.addCollectionText = ko.observable("mockText");
|
||||||
|
mockExplorer.isAuthWithResourceToken = ko.observable(false);
|
||||||
mockExplorer.isPreferredApiTable = ko.computed(() => true);
|
mockExplorer.isPreferredApiTable = ko.computed(() => true);
|
||||||
mockExplorer.isPreferredApiCassandra = ko.computed<boolean>(() => false);
|
mockExplorer.isPreferredApiCassandra = ko.computed<boolean>(() => false);
|
||||||
mockExplorer.isSparkEnabled = ko.observable(true);
|
mockExplorer.isSparkEnabled = ko.observable(true);
|
||||||
@@ -198,6 +199,7 @@ describe("CommandBarComponentButtonFactory tests", () => {
|
|||||||
beforeAll(() => {
|
beforeAll(() => {
|
||||||
mockExplorer = {} as Explorer;
|
mockExplorer = {} as Explorer;
|
||||||
mockExplorer.addCollectionText = ko.observable("mockText");
|
mockExplorer.addCollectionText = ko.observable("mockText");
|
||||||
|
mockExplorer.isAuthWithResourceToken = ko.observable(false);
|
||||||
mockExplorer.isPreferredApiTable = ko.computed(() => true);
|
mockExplorer.isPreferredApiTable = ko.computed(() => true);
|
||||||
mockExplorer.isPreferredApiMongoDB = ko.computed<boolean>(() => false);
|
mockExplorer.isPreferredApiMongoDB = ko.computed<boolean>(() => false);
|
||||||
mockExplorer.isSynapseLinkUpdating = ko.observable(false);
|
mockExplorer.isSynapseLinkUpdating = ko.observable(false);
|
||||||
@@ -279,6 +281,7 @@ describe("CommandBarComponentButtonFactory tests", () => {
|
|||||||
beforeAll(() => {
|
beforeAll(() => {
|
||||||
mockExplorer = {} as Explorer;
|
mockExplorer = {} as Explorer;
|
||||||
mockExplorer.addCollectionText = ko.observable("mockText");
|
mockExplorer.addCollectionText = ko.observable("mockText");
|
||||||
|
mockExplorer.isAuthWithResourceToken = ko.observable(false);
|
||||||
mockExplorer.isPreferredApiTable = ko.computed(() => true);
|
mockExplorer.isPreferredApiTable = ko.computed(() => true);
|
||||||
mockExplorer.isPreferredApiMongoDB = ko.computed<boolean>(() => false);
|
mockExplorer.isPreferredApiMongoDB = ko.computed<boolean>(() => false);
|
||||||
mockExplorer.isPreferredApiCassandra = ko.computed<boolean>(() => false);
|
mockExplorer.isPreferredApiCassandra = ko.computed<boolean>(() => false);
|
||||||
@@ -337,13 +340,12 @@ describe("CommandBarComponentButtonFactory tests", () => {
|
|||||||
beforeAll(() => {
|
beforeAll(() => {
|
||||||
mockExplorer = {} as Explorer;
|
mockExplorer = {} as Explorer;
|
||||||
mockExplorer.addCollectionText = ko.observable("mockText");
|
mockExplorer.addCollectionText = ko.observable("mockText");
|
||||||
|
mockExplorer.isAuthWithResourceToken = ko.observable(true);
|
||||||
mockExplorer.isPreferredApiDocumentDB = ko.computed(() => true);
|
mockExplorer.isPreferredApiDocumentDB = ko.computed(() => true);
|
||||||
mockExplorer.isDatabaseNodeOrNoneSelected = () => true;
|
mockExplorer.isDatabaseNodeOrNoneSelected = () => true;
|
||||||
|
|
||||||
mockExplorer.isResourceTokenCollectionNodeSelected = ko.computed(() => true);
|
mockExplorer.isResourceTokenCollectionNodeSelected = ko.computed(() => true);
|
||||||
mockExplorer.isServerlessEnabled = ko.computed<boolean>(() => false);
|
mockExplorer.isServerlessEnabled = ko.computed<boolean>(() => false);
|
||||||
updateUserContext({
|
|
||||||
authType: AuthType.ResourceToken,
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should only show New SQL Query and Open Query buttons", () => {
|
it("should only show New SQL Query and Open Query buttons", () => {
|
||||||
|
|||||||
@@ -1,38 +1,37 @@
|
|||||||
import * as React from "react";
|
import * as ViewModels from "../../../Contracts/ViewModels";
|
||||||
import AddCollectionIcon from "../../../../images/AddCollection.svg";
|
import { Action, ActionModifiers } from "../../../Shared/Telemetry/TelemetryConstants";
|
||||||
|
import { Areas } from "../../../Common/Constants";
|
||||||
|
import * as TelemetryProcessor from "../../../Shared/Telemetry/TelemetryProcessor";
|
||||||
|
|
||||||
import AddDatabaseIcon from "../../../../images/AddDatabase.svg";
|
import AddDatabaseIcon from "../../../../images/AddDatabase.svg";
|
||||||
|
import AddCollectionIcon from "../../../../images/AddCollection.svg";
|
||||||
import AddSqlQueryIcon from "../../../../images/AddSqlQuery_16x16.svg";
|
import AddSqlQueryIcon from "../../../../images/AddSqlQuery_16x16.svg";
|
||||||
import AddStoredProcedureIcon from "../../../../images/AddStoredProcedure.svg";
|
|
||||||
import AddTriggerIcon from "../../../../images/AddTrigger.svg";
|
|
||||||
import AddUdfIcon from "../../../../images/AddUdf.svg";
|
|
||||||
import BrowseQueriesIcon from "../../../../images/BrowseQuery.svg";
|
import BrowseQueriesIcon from "../../../../images/BrowseQuery.svg";
|
||||||
|
import * as Constants from "../../../Common/Constants";
|
||||||
|
import OpenInTabIcon from "../../../../images/open-in-tab.svg";
|
||||||
|
import OpenQueryFromDiskIcon from "../../../../images/OpenQueryFromDisk.svg";
|
||||||
import CosmosTerminalIcon from "../../../../images/Cosmos-Terminal.svg";
|
import CosmosTerminalIcon from "../../../../images/Cosmos-Terminal.svg";
|
||||||
import FeedbackIcon from "../../../../images/Feedback-Command.svg";
|
|
||||||
import GitHubIcon from "../../../../images/github.svg";
|
|
||||||
import HostedTerminalIcon from "../../../../images/Hosted-Terminal.svg";
|
import HostedTerminalIcon from "../../../../images/Hosted-Terminal.svg";
|
||||||
|
import AddStoredProcedureIcon from "../../../../images/AddStoredProcedure.svg";
|
||||||
|
import SettingsIcon from "../../../../images/settings_15x15.svg";
|
||||||
|
import AddUdfIcon from "../../../../images/AddUdf.svg";
|
||||||
|
import AddTriggerIcon from "../../../../images/AddTrigger.svg";
|
||||||
|
import FeedbackIcon from "../../../../images/Feedback-Command.svg";
|
||||||
import EnableNotebooksIcon from "../../../../images/notebook/Notebook-enable.svg";
|
import EnableNotebooksIcon from "../../../../images/notebook/Notebook-enable.svg";
|
||||||
import NewNotebookIcon from "../../../../images/notebook/Notebook-new.svg";
|
import NewNotebookIcon from "../../../../images/notebook/Notebook-new.svg";
|
||||||
import ResetWorkspaceIcon from "../../../../images/notebook/Notebook-reset-workspace.svg";
|
import ResetWorkspaceIcon from "../../../../images/notebook/Notebook-reset-workspace.svg";
|
||||||
import OpenInTabIcon from "../../../../images/open-in-tab.svg";
|
import GitHubIcon from "../../../../images/github.svg";
|
||||||
import OpenQueryFromDiskIcon from "../../../../images/OpenQueryFromDisk.svg";
|
|
||||||
import SettingsIcon from "../../../../images/settings_15x15.svg";
|
|
||||||
import SynapseIcon from "../../../../images/synapse-link.svg";
|
import SynapseIcon from "../../../../images/synapse-link.svg";
|
||||||
import { AuthType } from "../../../AuthType";
|
|
||||||
import * as Constants from "../../../Common/Constants";
|
|
||||||
import { Areas } from "../../../Common/Constants";
|
|
||||||
import { configContext, Platform } from "../../../ConfigContext";
|
import { configContext, Platform } from "../../../ConfigContext";
|
||||||
import * as ViewModels from "../../../Contracts/ViewModels";
|
|
||||||
import { Action, ActionModifiers } from "../../../Shared/Telemetry/TelemetryConstants";
|
|
||||||
import * as TelemetryProcessor from "../../../Shared/Telemetry/TelemetryProcessor";
|
|
||||||
import { userContext } from "../../../UserContext";
|
|
||||||
import { CommandButtonComponentProps } from "../../Controls/CommandButton/CommandButtonComponent";
|
|
||||||
import Explorer from "../../Explorer";
|
import Explorer from "../../Explorer";
|
||||||
|
import { CommandButtonComponentProps } from "../../Controls/CommandButton/CommandButtonComponent";
|
||||||
|
import * as React from "react";
|
||||||
import { OpenFullScreen } from "../../OpenFullScreen";
|
import { OpenFullScreen } from "../../OpenFullScreen";
|
||||||
|
|
||||||
let counter = 0;
|
let counter = 0;
|
||||||
|
|
||||||
export function createStaticCommandBarButtons(container: Explorer): CommandButtonComponentProps[] {
|
export function createStaticCommandBarButtons(container: Explorer): CommandButtonComponentProps[] {
|
||||||
if (userContext.authType === AuthType.ResourceToken) {
|
if (container.isAuthWithResourceToken()) {
|
||||||
return createStaticCommandBarButtonsForResourceToken(container);
|
return createStaticCommandBarButtonsForResourceToken(container);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { EMPTY, merge, of, timer, concat, Subject, Subscriber, Observable, Observer, from } from "rxjs";
|
import { EMPTY, merge, of, timer, concat, Subject, Subscriber, Observable, Observer } from "rxjs";
|
||||||
import { webSocket } from "rxjs/webSocket";
|
import { webSocket } from "rxjs/webSocket";
|
||||||
import { StateObservable } from "redux-observable";
|
import { StateObservable } from "redux-observable";
|
||||||
import { ofType } from "redux-observable";
|
import { ofType } from "redux-observable";
|
||||||
@@ -944,39 +944,6 @@ const traceNotebookKernelEpic = (
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const resetCellStatusOnExecuteCanceledEpic = (
|
|
||||||
action$: Observable<actions.ExecuteCanceled>,
|
|
||||||
state$: StateObservable<AppState>
|
|
||||||
): Observable<actions.UpdateCellStatus> => {
|
|
||||||
return action$.pipe(
|
|
||||||
ofType(actions.EXECUTE_CANCELED),
|
|
||||||
mergeMap((action) => {
|
|
||||||
const contentRef = action.payload.contentRef;
|
|
||||||
const model = state$.value.core.entities.contents.byRef.get(contentRef).model;
|
|
||||||
let busyCellIds: string[] = [];
|
|
||||||
|
|
||||||
if (model.type === "notebook") {
|
|
||||||
const cellMap = model.transient.get("cellMap");
|
|
||||||
if (cellMap) {
|
|
||||||
for (const entry of cellMap.toArray()) {
|
|
||||||
const cellId = entry[0];
|
|
||||||
const status = model.transient.getIn(["cellMap", cellId, "status"]);
|
|
||||||
if (status === "busy") {
|
|
||||||
busyCellIds.push(cellId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return from(busyCellIds).pipe(
|
|
||||||
map((busyCellId) => {
|
|
||||||
return actions.updateCellStatus({ id: busyCellId, contentRef, status: undefined });
|
|
||||||
})
|
|
||||||
);
|
|
||||||
})
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export const allEpics = [
|
export const allEpics = [
|
||||||
addInitialCodeCellEpic,
|
addInitialCodeCellEpic,
|
||||||
focusInitialCodeCellEpic,
|
focusInitialCodeCellEpic,
|
||||||
@@ -993,5 +960,4 @@ export const allEpics = [
|
|||||||
traceNotebookTelemetryEpic,
|
traceNotebookTelemetryEpic,
|
||||||
traceNotebookInfoEpic,
|
traceNotebookInfoEpic,
|
||||||
traceNotebookKernelEpic,
|
traceNotebookKernelEpic,
|
||||||
resetCellStatusOnExecuteCanceledEpic,
|
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -18,11 +18,13 @@ export class NotebookContentClient {
|
|||||||
/**
|
/**
|
||||||
* This updates the item and points all the children's parent to this item
|
* This updates the item and points all the children's parent to this item
|
||||||
* @param item
|
* @param item
|
||||||
|
* @return updated item
|
||||||
*/
|
*/
|
||||||
public updateItemChildren(item: NotebookContentItem): Promise<void> {
|
public updateItemChildren(item: NotebookContentItem): Promise<NotebookContentItem> {
|
||||||
return this.fetchNotebookFiles(item.path).then((subItems) => {
|
return this.fetchNotebookFiles(item.path).then((subItems) => {
|
||||||
item.children = subItems;
|
item.children = subItems;
|
||||||
subItems.forEach((subItem) => (subItem.parent = item));
|
subItems.forEach((subItem) => (subItem.parent = item));
|
||||||
|
return item;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ import { contents } from "rx-jupyter";
|
|||||||
import { NotebookContainerClient } from "./NotebookContainerClient";
|
import { NotebookContainerClient } from "./NotebookContainerClient";
|
||||||
import { MemoryUsageInfo } from "../../Contracts/DataModels";
|
import { MemoryUsageInfo } from "../../Contracts/DataModels";
|
||||||
import { NotebookContentClient } from "./NotebookContentClient";
|
import { NotebookContentClient } from "./NotebookContentClient";
|
||||||
import { ResourceTreeAdapter } from "../Tree/ResourceTreeAdapter";
|
|
||||||
import { PublishNotebookPaneAdapter } from "../Panes/PublishNotebookPaneAdapter";
|
import { PublishNotebookPaneAdapter } from "../Panes/PublishNotebookPaneAdapter";
|
||||||
import { getFullName } from "../../Utils/UserUtils";
|
import { getFullName } from "../../Utils/UserUtils";
|
||||||
import { ImmutableNotebook } from "@nteract/commutable";
|
import { ImmutableNotebook } from "@nteract/commutable";
|
||||||
@@ -30,7 +29,6 @@ import { getErrorMessage } from "../../Common/ErrorHandlingUtils";
|
|||||||
export interface NotebookManagerOptions {
|
export interface NotebookManagerOptions {
|
||||||
container: Explorer;
|
container: Explorer;
|
||||||
notebookBasePath: ko.Observable<string>;
|
notebookBasePath: ko.Observable<string>;
|
||||||
resourceTree: ResourceTreeAdapter;
|
|
||||||
refreshCommandBarButtons: () => void;
|
refreshCommandBarButtons: () => void;
|
||||||
refreshNotebookList: () => void;
|
refreshNotebookList: () => void;
|
||||||
}
|
}
|
||||||
@@ -107,8 +105,8 @@ export default class NotebookManager {
|
|||||||
});
|
});
|
||||||
|
|
||||||
this.junoClient.subscribeToPinnedRepos((pinnedRepos) => {
|
this.junoClient.subscribeToPinnedRepos((pinnedRepos) => {
|
||||||
this.params.resourceTree.initializeGitHubRepos(pinnedRepos);
|
// TODO Move this out of NotebookManager?
|
||||||
this.params.resourceTree.triggerRender();
|
this.params.container.params.initializeGitHubRepos(pinnedRepos);
|
||||||
});
|
});
|
||||||
this.refreshPinnedRepos();
|
this.refreshPinnedRepos();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,22 +1,22 @@
|
|||||||
import * as ko from "knockout";
|
|
||||||
import * as _ from "underscore";
|
import * as _ from "underscore";
|
||||||
import * as Constants from "../../Common/Constants";
|
|
||||||
import { createCollection } from "../../Common/dataAccess/createCollection";
|
|
||||||
import editable from "../../Common/EditableUtility";
|
|
||||||
import { getErrorMessage, getErrorStack } from "../../Common/ErrorHandlingUtils";
|
|
||||||
import { configContext, Platform } from "../../ConfigContext";
|
|
||||||
import * as DataModels from "../../Contracts/DataModels";
|
|
||||||
import { SubscriptionType } from "../../Contracts/SubscriptionType";
|
|
||||||
import * as ViewModels from "../../Contracts/ViewModels";
|
|
||||||
import * as AddCollectionUtility from "../../Shared/AddCollectionUtility";
|
import * as AddCollectionUtility from "../../Shared/AddCollectionUtility";
|
||||||
import * as SharedConstants from "../../Shared/Constants";
|
|
||||||
import { Action, ActionModifiers } from "../../Shared/Telemetry/TelemetryConstants";
|
|
||||||
import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
|
||||||
import { userContext } from "../../UserContext";
|
|
||||||
import * as AutoPilotUtils from "../../Utils/AutoPilotUtils";
|
import * as AutoPilotUtils from "../../Utils/AutoPilotUtils";
|
||||||
|
import * as Constants from "../../Common/Constants";
|
||||||
|
import * as DataModels from "../../Contracts/DataModels";
|
||||||
|
import * as ko from "knockout";
|
||||||
import * as PricingUtils from "../../Utils/PricingUtils";
|
import * as PricingUtils from "../../Utils/PricingUtils";
|
||||||
import { DynamicListItem } from "../Controls/DynamicList/DynamicListComponent";
|
import * as SharedConstants from "../../Shared/Constants";
|
||||||
|
import * as ViewModels from "../../Contracts/ViewModels";
|
||||||
|
import { SubscriptionType } from "../../Contracts/SubscriptionType";
|
||||||
|
import editable from "../../Common/EditableUtility";
|
||||||
|
import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
||||||
|
import { Action, ActionModifiers } from "../../Shared/Telemetry/TelemetryConstants";
|
||||||
|
import { configContext, Platform } from "../../ConfigContext";
|
||||||
import { ContextualPaneBase } from "./ContextualPaneBase";
|
import { ContextualPaneBase } from "./ContextualPaneBase";
|
||||||
|
import { DynamicListItem } from "../Controls/DynamicList/DynamicListComponent";
|
||||||
|
import { createCollection } from "../../Common/dataAccess/createCollection";
|
||||||
|
import { getErrorMessage, getErrorStack } from "../../Common/ErrorHandlingUtils";
|
||||||
|
import { userContext } from "../../UserContext";
|
||||||
|
|
||||||
export interface AddCollectionPaneOptions extends ViewModels.PaneOptions {
|
export interface AddCollectionPaneOptions extends ViewModels.PaneOptions {
|
||||||
isPreferredApiTable: ko.Computed<boolean>;
|
isPreferredApiTable: ko.Computed<boolean>;
|
||||||
@@ -49,7 +49,7 @@ export default class AddCollectionPane extends ContextualPaneBase {
|
|||||||
public throughputDatabase: ViewModels.Editable<number>;
|
public throughputDatabase: ViewModels.Editable<number>;
|
||||||
public isPreferredApiTable: ko.Computed<boolean>;
|
public isPreferredApiTable: ko.Computed<boolean>;
|
||||||
public partitionKeyPlaceholder: ko.Computed<string>;
|
public partitionKeyPlaceholder: ko.Computed<string>;
|
||||||
public isTryCosmosDBSubscription: ko.Observable<boolean>;
|
public isTryCosmosDBSubscription: ko.Computed<boolean>;
|
||||||
public maxThroughputRU: ko.Observable<number>;
|
public maxThroughputRU: ko.Observable<number>;
|
||||||
public minThroughputRU: ko.Observable<number>;
|
public minThroughputRU: ko.Observable<number>;
|
||||||
public throughputRangeText: ko.Computed<string>;
|
public throughputRangeText: ko.Computed<string>;
|
||||||
@@ -186,6 +186,7 @@ export default class AddCollectionPane extends ContextualPaneBase {
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const serverId: string = this.container.serverId();
|
||||||
const regions =
|
const regions =
|
||||||
(account &&
|
(account &&
|
||||||
account.properties &&
|
account.properties &&
|
||||||
@@ -199,28 +200,23 @@ export default class AddCollectionPane extends ContextualPaneBase {
|
|||||||
if (!this.isSharedAutoPilotSelected()) {
|
if (!this.isSharedAutoPilotSelected()) {
|
||||||
throughputSpendAckText = PricingUtils.getEstimatedSpendAcknowledgeString(
|
throughputSpendAckText = PricingUtils.getEstimatedSpendAcknowledgeString(
|
||||||
offerThroughput,
|
offerThroughput,
|
||||||
userContext.portalEnv,
|
serverId,
|
||||||
regions,
|
regions,
|
||||||
multimaster,
|
multimaster,
|
||||||
this.isSharedAutoPilotSelected()
|
this.isSharedAutoPilotSelected()
|
||||||
);
|
);
|
||||||
estimatedSpend = PricingUtils.getEstimatedSpendHtml(
|
estimatedSpend = PricingUtils.getEstimatedSpendHtml(offerThroughput, serverId, regions, multimaster);
|
||||||
offerThroughput,
|
|
||||||
userContext.portalEnv,
|
|
||||||
regions,
|
|
||||||
multimaster
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
throughputSpendAckText = PricingUtils.getEstimatedSpendAcknowledgeString(
|
throughputSpendAckText = PricingUtils.getEstimatedSpendAcknowledgeString(
|
||||||
this.sharedAutoPilotThroughput(),
|
this.sharedAutoPilotThroughput(),
|
||||||
userContext.portalEnv,
|
serverId,
|
||||||
regions,
|
regions,
|
||||||
multimaster,
|
multimaster,
|
||||||
this.isSharedAutoPilotSelected()
|
this.isSharedAutoPilotSelected()
|
||||||
);
|
);
|
||||||
estimatedSpend = PricingUtils.getEstimatedAutoscaleSpendHtml(
|
estimatedSpend = PricingUtils.getEstimatedAutoscaleSpendHtml(
|
||||||
this.sharedAutoPilotThroughput(),
|
this.sharedAutoPilotThroughput(),
|
||||||
userContext.portalEnv,
|
serverId,
|
||||||
regions,
|
regions,
|
||||||
multimaster
|
multimaster
|
||||||
);
|
);
|
||||||
@@ -244,6 +240,7 @@ export default class AddCollectionPane extends ContextualPaneBase {
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const serverId: string = this.container.serverId();
|
||||||
const regions =
|
const regions =
|
||||||
(account &&
|
(account &&
|
||||||
account.properties &&
|
account.properties &&
|
||||||
@@ -257,28 +254,28 @@ export default class AddCollectionPane extends ContextualPaneBase {
|
|||||||
if (!this.isAutoPilotSelected()) {
|
if (!this.isAutoPilotSelected()) {
|
||||||
throughputSpendAckText = PricingUtils.getEstimatedSpendAcknowledgeString(
|
throughputSpendAckText = PricingUtils.getEstimatedSpendAcknowledgeString(
|
||||||
this.throughputMultiPartition(),
|
this.throughputMultiPartition(),
|
||||||
userContext.portalEnv,
|
serverId,
|
||||||
regions,
|
regions,
|
||||||
multimaster,
|
multimaster,
|
||||||
this.isAutoPilotSelected()
|
this.isAutoPilotSelected()
|
||||||
);
|
);
|
||||||
estimatedSpend = PricingUtils.getEstimatedSpendHtml(
|
estimatedSpend = PricingUtils.getEstimatedSpendHtml(
|
||||||
this.throughputMultiPartition(),
|
this.throughputMultiPartition(),
|
||||||
userContext.portalEnv,
|
serverId,
|
||||||
regions,
|
regions,
|
||||||
multimaster
|
multimaster
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
throughputSpendAckText = PricingUtils.getEstimatedSpendAcknowledgeString(
|
throughputSpendAckText = PricingUtils.getEstimatedSpendAcknowledgeString(
|
||||||
this.autoPilotThroughput(),
|
this.autoPilotThroughput(),
|
||||||
userContext.portalEnv,
|
serverId,
|
||||||
regions,
|
regions,
|
||||||
multimaster,
|
multimaster,
|
||||||
this.isAutoPilotSelected()
|
this.isAutoPilotSelected()
|
||||||
);
|
);
|
||||||
estimatedSpend = PricingUtils.getEstimatedAutoscaleSpendHtml(
|
estimatedSpend = PricingUtils.getEstimatedAutoscaleSpendHtml(
|
||||||
this.autoPilotThroughput(),
|
this.autoPilotThroughput(),
|
||||||
userContext.portalEnv,
|
serverId,
|
||||||
regions,
|
regions,
|
||||||
multimaster
|
multimaster
|
||||||
);
|
);
|
||||||
@@ -288,7 +285,9 @@ export default class AddCollectionPane extends ContextualPaneBase {
|
|||||||
return estimatedSpend;
|
return estimatedSpend;
|
||||||
});
|
});
|
||||||
|
|
||||||
this.isTryCosmosDBSubscription = ko.observable<boolean>(userContext.isTryCosmosDBSubscription || false);
|
this.isTryCosmosDBSubscription = ko.pureComputed<boolean>(() => {
|
||||||
|
return (this.container && this.container.isTryCosmosDBSubscription()) || false;
|
||||||
|
});
|
||||||
|
|
||||||
this.isTryCosmosDBSubscription.subscribe((isTryCosmosDB: boolean) => {
|
this.isTryCosmosDBSubscription.subscribe((isTryCosmosDB: boolean) => {
|
||||||
if (!!isTryCosmosDB) {
|
if (!!isTryCosmosDB) {
|
||||||
@@ -299,7 +298,7 @@ export default class AddCollectionPane extends ContextualPaneBase {
|
|||||||
this.canRequestSupport = ko.pureComputed(() => {
|
this.canRequestSupport = ko.pureComputed(() => {
|
||||||
if (
|
if (
|
||||||
configContext.platform !== Platform.Emulator &&
|
configContext.platform !== Platform.Emulator &&
|
||||||
!userContext.isTryCosmosDBSubscription &&
|
!this.container.isTryCosmosDBSubscription() &&
|
||||||
configContext.platform !== Platform.Portal
|
configContext.platform !== Platform.Portal
|
||||||
) {
|
) {
|
||||||
const offerThroughput: number = this._getThroughput();
|
const offerThroughput: number = this._getThroughput();
|
||||||
@@ -490,7 +489,7 @@ export default class AddCollectionPane extends ContextualPaneBase {
|
|||||||
|
|
||||||
this.upsellMessage = ko.pureComputed<string>(() => {
|
this.upsellMessage = ko.pureComputed<string>(() => {
|
||||||
return PricingUtils.getUpsellMessage(
|
return PricingUtils.getUpsellMessage(
|
||||||
userContext.portalEnv,
|
this.container.serverId(),
|
||||||
this.isFreeTierAccount(),
|
this.isFreeTierAccount(),
|
||||||
this.container.isFirstResourceCreated(),
|
this.container.isFirstResourceCreated(),
|
||||||
this.container.defaultExperience(),
|
this.container.defaultExperience(),
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,19 +1,19 @@
|
|||||||
import * as ko from "knockout";
|
|
||||||
import * as Constants from "../../Common/Constants";
|
|
||||||
import { createDatabase } from "../../Common/dataAccess/createDatabase";
|
|
||||||
import editable from "../../Common/EditableUtility";
|
|
||||||
import { getErrorMessage, getErrorStack } from "../../Common/ErrorHandlingUtils";
|
|
||||||
import { configContext, Platform } from "../../ConfigContext";
|
|
||||||
import * as DataModels from "../../Contracts/DataModels";
|
|
||||||
import { SubscriptionType } from "../../Contracts/SubscriptionType";
|
|
||||||
import * as ViewModels from "../../Contracts/ViewModels";
|
|
||||||
import * as SharedConstants from "../../Shared/Constants";
|
|
||||||
import { Action, ActionModifiers } from "../../Shared/Telemetry/TelemetryConstants";
|
|
||||||
import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
|
||||||
import { userContext } from "../../UserContext";
|
|
||||||
import * as AutoPilotUtils from "../../Utils/AutoPilotUtils";
|
import * as AutoPilotUtils from "../../Utils/AutoPilotUtils";
|
||||||
|
import * as Constants from "../../Common/Constants";
|
||||||
|
import * as DataModels from "../../Contracts/DataModels";
|
||||||
|
import * as ko from "knockout";
|
||||||
import * as PricingUtils from "../../Utils/PricingUtils";
|
import * as PricingUtils from "../../Utils/PricingUtils";
|
||||||
|
import * as SharedConstants from "../../Shared/Constants";
|
||||||
|
import * as ViewModels from "../../Contracts/ViewModels";
|
||||||
|
import editable from "../../Common/EditableUtility";
|
||||||
|
import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
||||||
|
import { Action, ActionModifiers } from "../../Shared/Telemetry/TelemetryConstants";
|
||||||
import { ContextualPaneBase } from "./ContextualPaneBase";
|
import { ContextualPaneBase } from "./ContextualPaneBase";
|
||||||
|
import { createDatabase } from "../../Common/dataAccess/createDatabase";
|
||||||
|
import { configContext, Platform } from "../../ConfigContext";
|
||||||
|
import { getErrorMessage, getErrorStack } from "../../Common/ErrorHandlingUtils";
|
||||||
|
import { SubscriptionType } from "../../Contracts/SubscriptionType";
|
||||||
|
import { userContext } from "../../UserContext";
|
||||||
|
|
||||||
export default class AddDatabasePane extends ContextualPaneBase {
|
export default class AddDatabasePane extends ContextualPaneBase {
|
||||||
public defaultExperience: ko.Computed<string>;
|
public defaultExperience: ko.Computed<string>;
|
||||||
@@ -122,6 +122,7 @@ export default class AddDatabasePane extends ContextualPaneBase {
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const serverId = this.container.serverId();
|
||||||
const regions =
|
const regions =
|
||||||
(account &&
|
(account &&
|
||||||
account.properties &&
|
account.properties &&
|
||||||
@@ -133,15 +134,10 @@ export default class AddDatabasePane extends ContextualPaneBase {
|
|||||||
let estimatedSpendAcknowledge: string;
|
let estimatedSpendAcknowledge: string;
|
||||||
let estimatedSpend: string;
|
let estimatedSpend: string;
|
||||||
if (!this.isAutoPilotSelected()) {
|
if (!this.isAutoPilotSelected()) {
|
||||||
estimatedSpend = PricingUtils.getEstimatedSpendHtml(
|
estimatedSpend = PricingUtils.getEstimatedSpendHtml(offerThroughput, serverId, regions, multimaster);
|
||||||
offerThroughput,
|
|
||||||
userContext.portalEnv,
|
|
||||||
regions,
|
|
||||||
multimaster
|
|
||||||
);
|
|
||||||
estimatedSpendAcknowledge = PricingUtils.getEstimatedSpendAcknowledgeString(
|
estimatedSpendAcknowledge = PricingUtils.getEstimatedSpendAcknowledgeString(
|
||||||
offerThroughput,
|
offerThroughput,
|
||||||
userContext.portalEnv,
|
serverId,
|
||||||
regions,
|
regions,
|
||||||
multimaster,
|
multimaster,
|
||||||
this.isAutoPilotSelected()
|
this.isAutoPilotSelected()
|
||||||
@@ -149,13 +145,13 @@ export default class AddDatabasePane extends ContextualPaneBase {
|
|||||||
} else {
|
} else {
|
||||||
estimatedSpend = PricingUtils.getEstimatedAutoscaleSpendHtml(
|
estimatedSpend = PricingUtils.getEstimatedAutoscaleSpendHtml(
|
||||||
this.maxAutoPilotThroughputSet(),
|
this.maxAutoPilotThroughputSet(),
|
||||||
userContext.portalEnv,
|
serverId,
|
||||||
regions,
|
regions,
|
||||||
multimaster
|
multimaster
|
||||||
);
|
);
|
||||||
estimatedSpendAcknowledge = PricingUtils.getEstimatedSpendAcknowledgeString(
|
estimatedSpendAcknowledge = PricingUtils.getEstimatedSpendAcknowledgeString(
|
||||||
this.maxAutoPilotThroughputSet(),
|
this.maxAutoPilotThroughputSet(),
|
||||||
userContext.portalEnv,
|
serverId,
|
||||||
regions,
|
regions,
|
||||||
multimaster,
|
multimaster,
|
||||||
this.isAutoPilotSelected()
|
this.isAutoPilotSelected()
|
||||||
@@ -169,7 +165,7 @@ export default class AddDatabasePane extends ContextualPaneBase {
|
|||||||
this.canRequestSupport = ko.pureComputed(() => {
|
this.canRequestSupport = ko.pureComputed(() => {
|
||||||
if (
|
if (
|
||||||
configContext.platform !== Platform.Emulator &&
|
configContext.platform !== Platform.Emulator &&
|
||||||
!userContext.isTryCosmosDBSubscription &&
|
!this.container.isTryCosmosDBSubscription() &&
|
||||||
configContext.platform !== Platform.Portal
|
configContext.platform !== Platform.Portal
|
||||||
) {
|
) {
|
||||||
const offerThroughput: number = this.throughput();
|
const offerThroughput: number = this.throughput();
|
||||||
@@ -243,7 +239,7 @@ export default class AddDatabasePane extends ContextualPaneBase {
|
|||||||
|
|
||||||
this.upsellMessage = ko.pureComputed<string>(() => {
|
this.upsellMessage = ko.pureComputed<string>(() => {
|
||||||
return PricingUtils.getUpsellMessage(
|
return PricingUtils.getUpsellMessage(
|
||||||
userContext.portalEnv,
|
this.container.serverId(),
|
||||||
this.isFreeTierAccount(),
|
this.isFreeTierAccount(),
|
||||||
this.container.isFirstResourceCreated(),
|
this.container.isFirstResourceCreated(),
|
||||||
this.container.defaultExperience(),
|
this.container.defaultExperience(),
|
||||||
|
|||||||
@@ -1,21 +1,21 @@
|
|||||||
import * as ko from "knockout";
|
|
||||||
import * as _ from "underscore";
|
import * as _ from "underscore";
|
||||||
import * as Constants from "../../Common/Constants";
|
|
||||||
import { getErrorMessage, getErrorStack } from "../../Common/ErrorHandlingUtils";
|
|
||||||
import { HashMap } from "../../Common/HashMap";
|
|
||||||
import { configContext, Platform } from "../../ConfigContext";
|
|
||||||
import * as DataModels from "../../Contracts/DataModels";
|
|
||||||
import { SubscriptionType } from "../../Contracts/SubscriptionType";
|
|
||||||
import * as ViewModels from "../../Contracts/ViewModels";
|
|
||||||
import * as AddCollectionUtility from "../../Shared/AddCollectionUtility";
|
import * as AddCollectionUtility from "../../Shared/AddCollectionUtility";
|
||||||
import * as SharedConstants from "../../Shared/Constants";
|
|
||||||
import { Action, ActionModifiers } from "../../Shared/Telemetry/TelemetryConstants";
|
|
||||||
import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
|
||||||
import { userContext } from "../../UserContext";
|
|
||||||
import * as AutoPilotUtils from "../../Utils/AutoPilotUtils";
|
import * as AutoPilotUtils from "../../Utils/AutoPilotUtils";
|
||||||
|
import * as Constants from "../../Common/Constants";
|
||||||
|
import * as DataModels from "../../Contracts/DataModels";
|
||||||
|
import * as ko from "knockout";
|
||||||
import * as PricingUtils from "../../Utils/PricingUtils";
|
import * as PricingUtils from "../../Utils/PricingUtils";
|
||||||
|
import * as SharedConstants from "../../Shared/Constants";
|
||||||
|
import * as ViewModels from "../../Contracts/ViewModels";
|
||||||
|
import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
||||||
|
import { Action, ActionModifiers } from "../../Shared/Telemetry/TelemetryConstants";
|
||||||
import { CassandraAPIDataClient } from "../Tables/TableDataClient";
|
import { CassandraAPIDataClient } from "../Tables/TableDataClient";
|
||||||
import { ContextualPaneBase } from "./ContextualPaneBase";
|
import { ContextualPaneBase } from "./ContextualPaneBase";
|
||||||
|
import { HashMap } from "../../Common/HashMap";
|
||||||
|
import { configContext, Platform } from "../../ConfigContext";
|
||||||
|
import { getErrorMessage, getErrorStack } from "../../Common/ErrorHandlingUtils";
|
||||||
|
import { SubscriptionType } from "../../Contracts/SubscriptionType";
|
||||||
|
import { userContext } from "../../UserContext";
|
||||||
|
|
||||||
export default class CassandraAddCollectionPane extends ContextualPaneBase {
|
export default class CassandraAddCollectionPane extends ContextualPaneBase {
|
||||||
public createTableQuery: ko.Observable<string>;
|
public createTableQuery: ko.Observable<string>;
|
||||||
@@ -127,6 +127,7 @@ export default class CassandraAddCollectionPane extends ContextualPaneBase {
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const serverId = this.container.serverId();
|
||||||
const regions =
|
const regions =
|
||||||
(account &&
|
(account &&
|
||||||
account.properties &&
|
account.properties &&
|
||||||
@@ -138,15 +139,10 @@ export default class CassandraAddCollectionPane extends ContextualPaneBase {
|
|||||||
let estimatedSpend: string;
|
let estimatedSpend: string;
|
||||||
let estimatedDedicatedSpendAcknowledge: string;
|
let estimatedDedicatedSpendAcknowledge: string;
|
||||||
if (!this.isAutoPilotSelected()) {
|
if (!this.isAutoPilotSelected()) {
|
||||||
estimatedSpend = PricingUtils.getEstimatedSpendHtml(
|
estimatedSpend = PricingUtils.getEstimatedSpendHtml(offerThroughput, serverId, regions, multimaster);
|
||||||
offerThroughput,
|
|
||||||
userContext.portalEnv,
|
|
||||||
regions,
|
|
||||||
multimaster
|
|
||||||
);
|
|
||||||
estimatedDedicatedSpendAcknowledge = PricingUtils.getEstimatedSpendAcknowledgeString(
|
estimatedDedicatedSpendAcknowledge = PricingUtils.getEstimatedSpendAcknowledgeString(
|
||||||
offerThroughput,
|
offerThroughput,
|
||||||
userContext.portalEnv,
|
serverId,
|
||||||
regions,
|
regions,
|
||||||
multimaster,
|
multimaster,
|
||||||
this.isAutoPilotSelected()
|
this.isAutoPilotSelected()
|
||||||
@@ -154,13 +150,13 @@ export default class CassandraAddCollectionPane extends ContextualPaneBase {
|
|||||||
} else {
|
} else {
|
||||||
estimatedSpend = PricingUtils.getEstimatedAutoscaleSpendHtml(
|
estimatedSpend = PricingUtils.getEstimatedAutoscaleSpendHtml(
|
||||||
this.selectedAutoPilotThroughput(),
|
this.selectedAutoPilotThroughput(),
|
||||||
userContext.portalEnv,
|
serverId,
|
||||||
regions,
|
regions,
|
||||||
multimaster
|
multimaster
|
||||||
);
|
);
|
||||||
estimatedDedicatedSpendAcknowledge = PricingUtils.getEstimatedSpendAcknowledgeString(
|
estimatedDedicatedSpendAcknowledge = PricingUtils.getEstimatedSpendAcknowledgeString(
|
||||||
this.selectedAutoPilotThroughput(),
|
this.selectedAutoPilotThroughput(),
|
||||||
userContext.portalEnv,
|
serverId,
|
||||||
regions,
|
regions,
|
||||||
multimaster,
|
multimaster,
|
||||||
this.isAutoPilotSelected()
|
this.isAutoPilotSelected()
|
||||||
@@ -176,6 +172,7 @@ export default class CassandraAddCollectionPane extends ContextualPaneBase {
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const serverId = this.container.serverId();
|
||||||
const regions =
|
const regions =
|
||||||
(account &&
|
(account &&
|
||||||
account.properties &&
|
account.properties &&
|
||||||
@@ -186,15 +183,10 @@ export default class CassandraAddCollectionPane extends ContextualPaneBase {
|
|||||||
let estimatedSpend: string;
|
let estimatedSpend: string;
|
||||||
let estimatedSharedSpendAcknowledge: string;
|
let estimatedSharedSpendAcknowledge: string;
|
||||||
if (!this.isSharedAutoPilotSelected()) {
|
if (!this.isSharedAutoPilotSelected()) {
|
||||||
estimatedSpend = PricingUtils.getEstimatedSpendHtml(
|
estimatedSpend = PricingUtils.getEstimatedSpendHtml(this.keyspaceThroughput(), serverId, regions, multimaster);
|
||||||
this.keyspaceThroughput(),
|
|
||||||
userContext.portalEnv,
|
|
||||||
regions,
|
|
||||||
multimaster
|
|
||||||
);
|
|
||||||
estimatedSharedSpendAcknowledge = PricingUtils.getEstimatedSpendAcknowledgeString(
|
estimatedSharedSpendAcknowledge = PricingUtils.getEstimatedSpendAcknowledgeString(
|
||||||
this.keyspaceThroughput(),
|
this.keyspaceThroughput(),
|
||||||
userContext.portalEnv,
|
serverId,
|
||||||
regions,
|
regions,
|
||||||
multimaster,
|
multimaster,
|
||||||
this.isSharedAutoPilotSelected()
|
this.isSharedAutoPilotSelected()
|
||||||
@@ -202,13 +194,13 @@ export default class CassandraAddCollectionPane extends ContextualPaneBase {
|
|||||||
} else {
|
} else {
|
||||||
estimatedSpend = PricingUtils.getEstimatedAutoscaleSpendHtml(
|
estimatedSpend = PricingUtils.getEstimatedAutoscaleSpendHtml(
|
||||||
this.sharedAutoPilotThroughput(),
|
this.sharedAutoPilotThroughput(),
|
||||||
userContext.portalEnv,
|
serverId,
|
||||||
regions,
|
regions,
|
||||||
multimaster
|
multimaster
|
||||||
);
|
);
|
||||||
estimatedSharedSpendAcknowledge = PricingUtils.getEstimatedSpendAcknowledgeString(
|
estimatedSharedSpendAcknowledge = PricingUtils.getEstimatedSpendAcknowledgeString(
|
||||||
this.sharedAutoPilotThroughput(),
|
this.sharedAutoPilotThroughput(),
|
||||||
userContext.portalEnv,
|
serverId,
|
||||||
regions,
|
regions,
|
||||||
multimaster,
|
multimaster,
|
||||||
this.isSharedAutoPilotSelected()
|
this.isSharedAutoPilotSelected()
|
||||||
@@ -223,7 +215,7 @@ export default class CassandraAddCollectionPane extends ContextualPaneBase {
|
|||||||
});
|
});
|
||||||
|
|
||||||
this.canRequestSupport = ko.pureComputed(() => {
|
this.canRequestSupport = ko.pureComputed(() => {
|
||||||
if (configContext.platform !== Platform.Emulator && !userContext.isTryCosmosDBSubscription) {
|
if (configContext.platform !== Platform.Emulator && !this.container.isTryCosmosDBSubscription()) {
|
||||||
const offerThroughput: number = this.throughput();
|
const offerThroughput: number = this.throughput();
|
||||||
return offerThroughput <= 100000;
|
return offerThroughput <= 100000;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,10 +8,9 @@ import { GenericRightPaneComponent, GenericRightPaneProps } from "./GenericRight
|
|||||||
import { CopyNotebookPaneComponent, CopyNotebookPaneProps } from "./CopyNotebookPaneComponent";
|
import { CopyNotebookPaneComponent, CopyNotebookPaneProps } from "./CopyNotebookPaneComponent";
|
||||||
import { IDropdownOption } from "office-ui-fabric-react";
|
import { IDropdownOption } from "office-ui-fabric-react";
|
||||||
import { GitHubOAuthService } from "../../GitHub/GitHubOAuthService";
|
import { GitHubOAuthService } from "../../GitHub/GitHubOAuthService";
|
||||||
import { HttpStatusCodes } from "../../Common/Constants";
|
import { HttpStatusCodes, Notebook } from "../../Common/Constants";
|
||||||
import * as GitHubUtils from "../../Utils/GitHubUtils";
|
import * as GitHubUtils from "../../Utils/GitHubUtils";
|
||||||
import { NotebookContentItemType, NotebookContentItem } from "../Notebook/NotebookContentItem";
|
import { NotebookContentItemType, NotebookContentItem } from "../Notebook/NotebookContentItem";
|
||||||
import { ResourceTreeAdapter } from "../Tree/ResourceTreeAdapter";
|
|
||||||
import { handleError, getErrorMessage } from "../../Common/ErrorHandlingUtils";
|
import { handleError, getErrorMessage } from "../../Common/ErrorHandlingUtils";
|
||||||
|
|
||||||
interface Location {
|
interface Location {
|
||||||
@@ -151,7 +150,7 @@ export class CopyNotebookPaneAdapter implements ReactAdapter {
|
|||||||
switch (location.type) {
|
switch (location.type) {
|
||||||
case "MyNotebooks":
|
case "MyNotebooks":
|
||||||
parent = {
|
parent = {
|
||||||
name: ResourceTreeAdapter.MyNotebooksTitle,
|
name: Notebook.MyNotebooksTitle,
|
||||||
path: this.container.getNotebookBasePath(),
|
path: this.container.getNotebookBasePath(),
|
||||||
type: NotebookContentItemType.Directory,
|
type: NotebookContentItemType.Directory,
|
||||||
};
|
};
|
||||||
@@ -159,7 +158,7 @@ export class CopyNotebookPaneAdapter implements ReactAdapter {
|
|||||||
|
|
||||||
case "GitHub":
|
case "GitHub":
|
||||||
parent = {
|
parent = {
|
||||||
name: ResourceTreeAdapter.GitHubReposTitle,
|
name: Notebook.GitHubReposTitle,
|
||||||
path: GitHubUtils.toContentUri(
|
path: GitHubUtils.toContentUri(
|
||||||
this.selectedLocation.owner,
|
this.selectedLocation.owner,
|
||||||
this.selectedLocation.repo,
|
this.selectedLocation.repo,
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import * as GitHubUtils from "../../Utils/GitHubUtils";
|
import * as GitHubUtils from "../../Utils/GitHubUtils";
|
||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
import { IPinnedRepo } from "../../Juno/JunoClient";
|
import { IPinnedRepo } from "../../Juno/JunoClient";
|
||||||
import { ResourceTreeAdapter } from "../Tree/ResourceTreeAdapter";
|
|
||||||
import {
|
import {
|
||||||
Stack,
|
Stack,
|
||||||
Label,
|
Label,
|
||||||
@@ -13,6 +12,7 @@ import {
|
|||||||
IRenderFunction,
|
IRenderFunction,
|
||||||
ISelectableOption,
|
ISelectableOption,
|
||||||
} from "office-ui-fabric-react";
|
} from "office-ui-fabric-react";
|
||||||
|
import { Notebook } from "../../Common/Constants";
|
||||||
|
|
||||||
interface Location {
|
interface Location {
|
||||||
type: "MyNotebooks" | "GitHub";
|
type: "MyNotebooks" | "GitHub";
|
||||||
@@ -70,8 +70,8 @@ export class CopyNotebookPaneComponent extends React.Component<CopyNotebookPaneP
|
|||||||
|
|
||||||
options.push({
|
options.push({
|
||||||
key: "MyNotebooks-Item",
|
key: "MyNotebooks-Item",
|
||||||
text: ResourceTreeAdapter.MyNotebooksTitle,
|
text: Notebook.MyNotebooksTitle,
|
||||||
title: ResourceTreeAdapter.MyNotebooksTitle,
|
title: Notebook.MyNotebooksTitle,
|
||||||
data: {
|
data: {
|
||||||
type: "MyNotebooks",
|
type: "MyNotebooks",
|
||||||
} as Location,
|
} as Location,
|
||||||
@@ -86,7 +86,7 @@ export class CopyNotebookPaneComponent extends React.Component<CopyNotebookPaneP
|
|||||||
|
|
||||||
options.push({
|
options.push({
|
||||||
key: "GitHub-Header",
|
key: "GitHub-Header",
|
||||||
text: ResourceTreeAdapter.GitHubReposTitle,
|
text: Notebook.GitHubReposTitle,
|
||||||
itemType: SelectableOptionMenuItemType.Header,
|
itemType: SelectableOptionMenuItemType.Header,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ describe("Delete Collection Confirmation Pane", () => {
|
|||||||
.simulate("change", { target: { value: selectedCollectionId } });
|
.simulate("change", { target: { value: selectedCollectionId } });
|
||||||
|
|
||||||
expect(wrapper.exists("#sidePanelOkButton")).toBe(true);
|
expect(wrapper.exists("#sidePanelOkButton")).toBe(true);
|
||||||
wrapper.find("#sidePanelOkButton").hostNodes().simulate("submit");
|
wrapper.find("#sidePanelOkButton").hostNodes().simulate("click");
|
||||||
expect(deleteCollection).toHaveBeenCalledWith(databaseId, selectedCollectionId);
|
expect(deleteCollection).toHaveBeenCalledWith(databaseId, selectedCollectionId);
|
||||||
|
|
||||||
wrapper.unmount();
|
wrapper.unmount();
|
||||||
@@ -154,7 +154,7 @@ describe("Delete Collection Confirmation Pane", () => {
|
|||||||
.simulate("change", { target: { value: feedbackText } });
|
.simulate("change", { target: { value: feedbackText } });
|
||||||
|
|
||||||
expect(wrapper.exists("#sidePanelOkButton")).toBe(true);
|
expect(wrapper.exists("#sidePanelOkButton")).toBe(true);
|
||||||
wrapper.find("#sidePanelOkButton").hostNodes().simulate("submit");
|
wrapper.find("#sidePanelOkButton").hostNodes().simulate("click");
|
||||||
expect(deleteCollection).toHaveBeenCalledWith(databaseId, selectedCollectionId);
|
expect(deleteCollection).toHaveBeenCalledWith(databaseId, selectedCollectionId);
|
||||||
|
|
||||||
const deleteFeedback = new DeleteFeedback(
|
const deleteFeedback = new DeleteFeedback(
|
||||||
|
|||||||
@@ -1,19 +1,20 @@
|
|||||||
import { Text, TextField } from "office-ui-fabric-react";
|
import * as NotificationConsoleUtils from "../../Utils/NotificationConsoleUtils";
|
||||||
|
import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
|
import { Action, ActionModifiers } from "../../Shared/Telemetry/TelemetryConstants";
|
||||||
|
import { PanelFooterComponent } from "./PanelFooterComponent";
|
||||||
|
import { Collection } from "../../Contracts/ViewModels";
|
||||||
|
import { Text, TextField } from "office-ui-fabric-react";
|
||||||
|
import { userContext } from "../../UserContext";
|
||||||
import { Areas } from "../../Common/Constants";
|
import { Areas } from "../../Common/Constants";
|
||||||
import { deleteCollection } from "../../Common/dataAccess/deleteCollection";
|
import { deleteCollection } from "../../Common/dataAccess/deleteCollection";
|
||||||
import DeleteFeedback from "../../Common/DeleteFeedback";
|
|
||||||
import { getErrorMessage, getErrorStack } from "../../Common/ErrorHandlingUtils";
|
import { getErrorMessage, getErrorStack } from "../../Common/ErrorHandlingUtils";
|
||||||
import { Collection } from "../../Contracts/ViewModels";
|
|
||||||
import { DefaultExperienceUtility } from "../../Shared/DefaultExperienceUtility";
|
import { DefaultExperienceUtility } from "../../Shared/DefaultExperienceUtility";
|
||||||
import { Action, ActionModifiers } from "../../Shared/Telemetry/TelemetryConstants";
|
import { PanelErrorComponent, PanelErrorProps } from "./PanelErrorComponent";
|
||||||
import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
import DeleteFeedback from "../../Common/DeleteFeedback";
|
||||||
import { userContext } from "../../UserContext";
|
|
||||||
import * as NotificationConsoleUtils from "../../Utils/NotificationConsoleUtils";
|
|
||||||
import Explorer from "../Explorer";
|
import Explorer from "../Explorer";
|
||||||
import { PanelFooterComponent } from "./PanelFooterComponent";
|
import LoadingIndicator_3Squares from "../../../images/LoadingIndicator_3Squares.gif";
|
||||||
import { PanelInfoErrorComponent, PanelInfoErrorProps } from "./PanelInfoErrorComponent";
|
|
||||||
import { PanelLoadingScreen } from "./PanelLoadingScreen";
|
|
||||||
export interface DeleteCollectionConfirmationPanelProps {
|
export interface DeleteCollectionConfirmationPanelProps {
|
||||||
explorer: Explorer;
|
explorer: Explorer;
|
||||||
closePanel: () => void;
|
closePanel: () => void;
|
||||||
@@ -43,8 +44,8 @@ export class DeleteCollectionConfirmationPanel extends React.Component<
|
|||||||
|
|
||||||
render(): JSX.Element {
|
render(): JSX.Element {
|
||||||
return (
|
return (
|
||||||
<form className="panelFormWrapper" onSubmit={this.submit.bind(this)}>
|
<div className="panelContentContainer">
|
||||||
<PanelInfoErrorComponent {...this.getPanelErrorProps()} />
|
<PanelErrorComponent {...this.getPanelErrorProps()} />
|
||||||
<div className="panelMainContent">
|
<div className="panelMainContent">
|
||||||
<div className="confirmDeleteInput">
|
<div className="confirmDeleteInput">
|
||||||
<span className="mandatoryStar">* </span>
|
<span className="mandatoryStar">* </span>
|
||||||
@@ -78,16 +79,18 @@ export class DeleteCollectionConfirmationPanel extends React.Component<
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<PanelFooterComponent buttonLabel="OK" />
|
<PanelFooterComponent buttonLabel="OK" onOKButtonClicked={() => this.submit()} />
|
||||||
{this.state.isExecuting && <PanelLoadingScreen />}
|
<div className="dataExplorerLoaderContainer dataExplorerPaneLoaderContainer" hidden={!this.state.isExecuting}>
|
||||||
</form>
|
<img className="dataExplorerLoader" src={LoadingIndicator_3Squares} />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private getPanelErrorProps(): PanelInfoErrorProps {
|
private getPanelErrorProps(): PanelErrorProps {
|
||||||
if (this.state.formError) {
|
if (this.state.formError) {
|
||||||
return {
|
return {
|
||||||
messageType: "error",
|
isWarning: false,
|
||||||
message: this.state.formError,
|
message: this.state.formError,
|
||||||
showErrorDetails: true,
|
showErrorDetails: true,
|
||||||
openNotificationConsole: this.props.openNotificationConsole,
|
openNotificationConsole: this.props.openNotificationConsole,
|
||||||
@@ -95,7 +98,7 @@ export class DeleteCollectionConfirmationPanel extends React.Component<
|
|||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
messageType: "warning",
|
isWarning: true,
|
||||||
showErrorDetails: false,
|
showErrorDetails: false,
|
||||||
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.",
|
||||||
@@ -106,10 +109,9 @@ export class DeleteCollectionConfirmationPanel extends React.Component<
|
|||||||
return this.props.explorer.isLastCollection() && !this.props.explorer.isSelectedDatabaseShared();
|
return this.props.explorer.isLastCollection() && !this.props.explorer.isSelectedDatabaseShared();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async submit(event: React.FormEvent<HTMLFormElement>): Promise<void> {
|
public async submit(): Promise<void> {
|
||||||
event.preventDefault();
|
|
||||||
|
|
||||||
const collection = this.props.explorer.findSelectedCollection();
|
const collection = this.props.explorer.findSelectedCollection();
|
||||||
|
|
||||||
if (!collection || this.inputCollectionName !== collection.id()) {
|
if (!collection || this.inputCollectionName !== collection.id()) {
|
||||||
const errorMessage = "Input collection name does not match the selected collection";
|
const errorMessage = "Input collection name does not match the selected collection";
|
||||||
this.setState({ formError: errorMessage });
|
this.setState({ formError: errorMessage });
|
||||||
|
|||||||
@@ -1,58 +1,12 @@
|
|||||||
@import "../../../less/Common/Constants";
|
@import "../../../less/Common/Constants";
|
||||||
|
|
||||||
.panelFormWrapper {
|
.panelContentContainer {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
|
||||||
.panelMainContent {
|
.panelMainContent {
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
padding: 0 34px;
|
|
||||||
margin: 20px 0;
|
|
||||||
overflow: auto;
|
|
||||||
|
|
||||||
& > * {
|
|
||||||
margin-bottom: @DefaultSpace;
|
|
||||||
|
|
||||||
& > * {
|
|
||||||
margin-bottom: @SmallSpace;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.panelInfoIcon {
|
|
||||||
font-size: @mediumFontSize;
|
|
||||||
width: @mediumFontSize;
|
|
||||||
margin: auto 0 auto @SmallSpace;
|
|
||||||
color: @InfoIconColor;
|
|
||||||
cursor: default;
|
|
||||||
vertical-align: middle;
|
|
||||||
}
|
|
||||||
|
|
||||||
.panelTextBold {
|
|
||||||
font-weight: 600;
|
|
||||||
line-height: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.panelTextField {
|
|
||||||
font-size: @mediumFontSize;
|
|
||||||
border: 1px solid #605e5c;
|
|
||||||
color: #000;
|
|
||||||
padding: 4px 10px;
|
|
||||||
width: @newCollectionPaneInputWidth;
|
|
||||||
}
|
|
||||||
|
|
||||||
.panelRadioBtn {
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.panelRadioBtnLabel {
|
|
||||||
font-size: @mediumFontSize;
|
|
||||||
padding: 0 @LargeSpace 0 @SmallSpace;
|
|
||||||
}
|
|
||||||
|
|
||||||
.collapsibleSection {
|
|
||||||
margin-bottom: 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -62,30 +16,26 @@
|
|||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
}
|
}
|
||||||
|
|
||||||
.panelInfoErrorContainer {
|
.panelWarningErrorContainer {
|
||||||
background-color: @BaseLow;
|
background-color: @BaseLow;
|
||||||
padding: @DefaultSpace;
|
padding: @DefaultSpace;
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
margin: 20px 34px 0 34px;
|
margin-bottom: 24px;
|
||||||
|
|
||||||
i {
|
|
||||||
font-size: @WarningErrorIconSize;
|
|
||||||
width: @WarningErrorIconSize;
|
|
||||||
margin-left: @SmallSpace;
|
|
||||||
}
|
|
||||||
|
|
||||||
.panelWarningIcon {
|
.panelWarningIcon {
|
||||||
|
font-size: @WarningErrorIconSize;
|
||||||
|
width: @WarningErrorIconSize;
|
||||||
|
margin: auto 0 auto @SmallSpace;
|
||||||
color: @WarningIconColor;
|
color: @WarningIconColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
.panelErrorIcon {
|
.panelErrorIcon {
|
||||||
|
font-size: @WarningErrorIconSize;
|
||||||
|
width: @WarningErrorIconSize;
|
||||||
|
margin: auto 0 auto @SmallSpace;
|
||||||
color: @ErrorIconColor;
|
color: @ErrorIconColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
.panelLargeInfoIcon {
|
|
||||||
color: @InfoIconColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
.panelWarningErrorDetailsLinkContainer {
|
.panelWarningErrorDetailsLinkContainer {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
@@ -98,19 +48,10 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.panelFooter {
|
.panelFooter button {
|
||||||
padding: 20px 34px;
|
height: 30px;
|
||||||
border-top: solid 1px #bbbbbb;
|
|
||||||
|
|
||||||
& button {
|
|
||||||
height: 30px;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.deleteCollectionFeedback {
|
.deleteCollectionFeedback {
|
||||||
margin-top: 12px;
|
margin-top: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.panelGroupSpacing > * {
|
|
||||||
margin-bottom: @SmallSpace;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -9,30 +9,10 @@ export interface PanelContainerProps {
|
|||||||
closePanel: () => void;
|
closePanel: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PanelContainerState {
|
export class PanelContainerComponent extends React.Component<PanelContainerProps> {
|
||||||
height: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export class PanelContainerComponent extends React.Component<PanelContainerProps, PanelContainerState> {
|
|
||||||
private static readonly consoleHeaderHeight = 32;
|
private static readonly consoleHeaderHeight = 32;
|
||||||
private static readonly consoleContentHeight = 220;
|
private static readonly consoleContentHeight = 220;
|
||||||
|
|
||||||
constructor(props: PanelContainerProps) {
|
|
||||||
super(props);
|
|
||||||
|
|
||||||
this.state = {
|
|
||||||
height: this.getPanelHeight(),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
componentDidMount(): void {
|
|
||||||
window.addEventListener("resize", () => this.setState({ height: this.getPanelHeight() }));
|
|
||||||
}
|
|
||||||
|
|
||||||
componentWillUnmount(): void {
|
|
||||||
window.removeEventListener("resize", () => this.setState({ height: this.getPanelHeight() }));
|
|
||||||
}
|
|
||||||
|
|
||||||
render(): JSX.Element {
|
render(): JSX.Element {
|
||||||
if (!this.props.panelContent) {
|
if (!this.props.panelContent) {
|
||||||
return <></>;
|
return <></>;
|
||||||
@@ -50,10 +30,8 @@ export class PanelContainerComponent extends React.Component<PanelContainerProps
|
|||||||
headerClassName="panelHeader"
|
headerClassName="panelHeader"
|
||||||
styles={{
|
styles={{
|
||||||
navigation: { borderBottom: "1px solid #cccccc" },
|
navigation: { borderBottom: "1px solid #cccccc" },
|
||||||
content: { padding: 0, height: "100%" },
|
content: { padding: "24px 34px 20px 34px", height: "100%" },
|
||||||
scrollableContent: { height: "100%" },
|
scrollableContent: { height: "100%" },
|
||||||
header: { padding: "0 0 8px 34px" },
|
|
||||||
commands: { marginTop: 8 },
|
|
||||||
}}
|
}}
|
||||||
style={{ height: this.getPanelHeight() }}
|
style={{ height: this.getPanelHeight() }}
|
||||||
>
|
>
|
||||||
|
|||||||
29
src/Explorer/Panes/PanelErrorComponent.tsx
Normal file
29
src/Explorer/Panes/PanelErrorComponent.tsx
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
import React from "react";
|
||||||
|
import { Icon, Text } from "office-ui-fabric-react";
|
||||||
|
|
||||||
|
export interface PanelErrorProps {
|
||||||
|
message: string;
|
||||||
|
isWarning: boolean;
|
||||||
|
showErrorDetails: boolean;
|
||||||
|
openNotificationConsole?: () => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const PanelErrorComponent: React.FunctionComponent<PanelErrorProps> = (props: PanelErrorProps): JSX.Element => (
|
||||||
|
<div className="panelWarningErrorContainer">
|
||||||
|
{props.isWarning ? (
|
||||||
|
<Icon iconName="WarningSolid" className="panelWarningIcon" />
|
||||||
|
) : (
|
||||||
|
<Icon iconName="StatusErrorFull" className="panelErrorIcon" />
|
||||||
|
)}
|
||||||
|
<span className="panelWarningErrorDetailsLinkContainer">
|
||||||
|
<Text className="panelWarningErrorMessage" variant="small">
|
||||||
|
{props.message}
|
||||||
|
</Text>
|
||||||
|
{props.showErrorDetails && (
|
||||||
|
<a className="paneErrorLink" role="link" onClick={props.openNotificationConsole}>
|
||||||
|
More details
|
||||||
|
</a>
|
||||||
|
)}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
@@ -3,12 +3,13 @@ import { PrimaryButton } from "office-ui-fabric-react";
|
|||||||
|
|
||||||
export interface PanelFooterProps {
|
export interface PanelFooterProps {
|
||||||
buttonLabel: string;
|
buttonLabel: string;
|
||||||
|
onOKButtonClicked: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const PanelFooterComponent: React.FunctionComponent<PanelFooterProps> = (
|
export const PanelFooterComponent: React.FunctionComponent<PanelFooterProps> = (
|
||||||
props: PanelFooterProps
|
props: PanelFooterProps
|
||||||
): JSX.Element => (
|
): JSX.Element => (
|
||||||
<div className="panelFooter">
|
<div className="panelFooter">
|
||||||
<PrimaryButton type="submit" id="sidePanelOkButton" text={props.buttonLabel} />
|
<PrimaryButton id="sidePanelOkButton" text={props.buttonLabel} onClick={() => props.onOKButtonClicked()} />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,45 +0,0 @@
|
|||||||
import React from "react";
|
|
||||||
import { Icon, Link, Stack, Text } from "office-ui-fabric-react";
|
|
||||||
|
|
||||||
export interface PanelInfoErrorProps {
|
|
||||||
message: string;
|
|
||||||
messageType: string;
|
|
||||||
showErrorDetails: boolean;
|
|
||||||
link?: string;
|
|
||||||
linkText?: string;
|
|
||||||
openNotificationConsole?: () => void;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const PanelInfoErrorComponent: React.FunctionComponent<PanelInfoErrorProps> = (
|
|
||||||
props: PanelInfoErrorProps
|
|
||||||
): JSX.Element => {
|
|
||||||
let icon: JSX.Element;
|
|
||||||
if (props.messageType === "error") {
|
|
||||||
icon = <Icon iconName="StatusErrorFull" className="panelErrorIcon" />;
|
|
||||||
} else if (props.messageType === "warning") {
|
|
||||||
icon = <Icon iconName="WarningSolid" className="panelWarningIcon" />;
|
|
||||||
} else if (props.messageType === "info") {
|
|
||||||
icon = <Icon iconName="InfoSolid" className="panelLargeInfoIcon" />;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Stack className="panelInfoErrorContainer" horizontal verticalAlign="start">
|
|
||||||
{icon}
|
|
||||||
<span className="panelWarningErrorDetailsLinkContainer">
|
|
||||||
<Text className="panelWarningErrorMessage" variant="small">
|
|
||||||
{props.message}{" "}
|
|
||||||
{props.link && props.linkText && (
|
|
||||||
<Link target="_blank" href={props.link}>
|
|
||||||
{props.linkText}
|
|
||||||
</Link>
|
|
||||||
)}
|
|
||||||
</Text>
|
|
||||||
{props.showErrorDetails && (
|
|
||||||
<a className="paneErrorLink" role="link" onClick={props.openNotificationConsole}>
|
|
||||||
More details
|
|
||||||
</a>
|
|
||||||
)}
|
|
||||||
</span>
|
|
||||||
</Stack>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
import React from "react";
|
|
||||||
import LoadingIndicator_3Squares from "../../../images/LoadingIndicator_3Squares.gif";
|
|
||||||
|
|
||||||
export const PanelLoadingScreen: React.FunctionComponent = () => (
|
|
||||||
<div className="dataExplorerLoaderContainer dataExplorerPaneLoaderContainer">
|
|
||||||
<img className="dataExplorerLoader" src={LoadingIndicator_3Squares} />
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -16,15 +16,9 @@ exports[`PaneContainerComponent test should be resize if notification console is
|
|||||||
}
|
}
|
||||||
styles={
|
styles={
|
||||||
Object {
|
Object {
|
||||||
"commands": Object {
|
|
||||||
"marginTop": 8,
|
|
||||||
},
|
|
||||||
"content": Object {
|
"content": Object {
|
||||||
"height": "100%",
|
"height": "100%",
|
||||||
"padding": 0,
|
"padding": "24px 34px 20px 34px",
|
||||||
},
|
|
||||||
"header": Object {
|
|
||||||
"padding": "0 0 8px 34px",
|
|
||||||
},
|
},
|
||||||
"navigation": Object {
|
"navigation": Object {
|
||||||
"borderBottom": "1px solid #cccccc",
|
"borderBottom": "1px solid #cccccc",
|
||||||
@@ -58,15 +52,9 @@ exports[`PaneContainerComponent test should render with panel content and header
|
|||||||
}
|
}
|
||||||
styles={
|
styles={
|
||||||
Object {
|
Object {
|
||||||
"commands": Object {
|
|
||||||
"marginTop": 8,
|
|
||||||
},
|
|
||||||
"content": Object {
|
"content": Object {
|
||||||
"height": "100%",
|
"height": "100%",
|
||||||
"padding": 0,
|
"padding": "24px 34px 20px 34px",
|
||||||
},
|
|
||||||
"header": Object {
|
|
||||||
"padding": "0 0 8px 34px",
|
|
||||||
},
|
},
|
||||||
"navigation": Object {
|
"navigation": Object {
|
||||||
"borderBottom": "1px solid #cccccc",
|
"borderBottom": "1px solid #cccccc",
|
||||||
|
|||||||
@@ -1,26 +1,25 @@
|
|||||||
/**
|
/**
|
||||||
* Accordion top class
|
* Accordion top class
|
||||||
*/
|
*/
|
||||||
import { Link } from "office-ui-fabric-react/lib/Link";
|
|
||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
import AddDatabaseIcon from "../../../images/AddDatabase.svg";
|
import * as ViewModels from "../../Contracts/ViewModels";
|
||||||
import NewQueryIcon from "../../../images/AddSqlQuery_16x16.svg";
|
import * as Constants from "../../Common/Constants";
|
||||||
import NewStoredProcedureIcon from "../../../images/AddStoredProcedure.svg";
|
import { Link } from "office-ui-fabric-react/lib/Link";
|
||||||
import OpenQueryIcon from "../../../images/BrowseQuery.svg";
|
|
||||||
import NewContainerIcon from "../../../images/Hero-new-container.svg";
|
import NewContainerIcon from "../../../images/Hero-new-container.svg";
|
||||||
import NewNotebookIcon from "../../../images/Hero-new-notebook.svg";
|
import NewNotebookIcon from "../../../images/Hero-new-notebook.svg";
|
||||||
import SampleIcon from "../../../images/Hero-sample.svg";
|
import NewQueryIcon from "../../../images/AddSqlQuery_16x16.svg";
|
||||||
import NotebookIcon from "../../../images/notebook/Notebook-resource.svg";
|
import OpenQueryIcon from "../../../images/BrowseQuery.svg";
|
||||||
|
import NewStoredProcedureIcon from "../../../images/AddStoredProcedure.svg";
|
||||||
import ScaleAndSettingsIcon from "../../../images/Scale_15x15.svg";
|
import ScaleAndSettingsIcon from "../../../images/Scale_15x15.svg";
|
||||||
import CollectionIcon from "../../../images/tree-collection.svg";
|
import * as MostRecentActivity from "../MostRecentActivity/MostRecentActivity";
|
||||||
import { AuthType } from "../../AuthType";
|
import AddDatabaseIcon from "../../../images/AddDatabase.svg";
|
||||||
import * as Constants from "../../Common/Constants";
|
import SampleIcon from "../../../images/Hero-sample.svg";
|
||||||
import * as ViewModels from "../../Contracts/ViewModels";
|
|
||||||
import { userContext } from "../../UserContext";
|
|
||||||
import { FeaturePanelLauncher } from "../Controls/FeaturePanel/FeaturePanelLauncher";
|
|
||||||
import { DataSamplesUtil } from "../DataSamples/DataSamplesUtil";
|
import { DataSamplesUtil } from "../DataSamples/DataSamplesUtil";
|
||||||
import Explorer from "../Explorer";
|
import Explorer from "../Explorer";
|
||||||
import * as MostRecentActivity from "../MostRecentActivity/MostRecentActivity";
|
import { userContext } from "../../UserContext";
|
||||||
|
import { FeaturePanelLauncher } from "../Controls/FeaturePanel/FeaturePanelLauncher";
|
||||||
|
import CollectionIcon from "../../../images/tree-collection.svg";
|
||||||
|
import NotebookIcon from "../../../images/notebook/Notebook-resource.svg";
|
||||||
|
|
||||||
export interface SplashScreenItem {
|
export interface SplashScreenItem {
|
||||||
iconSrc: string;
|
iconSrc: string;
|
||||||
@@ -221,7 +220,7 @@ export class SplashScreen extends React.Component<SplashScreenProps> {
|
|||||||
private createCommonTaskItems(): SplashScreenItem[] {
|
private createCommonTaskItems(): SplashScreenItem[] {
|
||||||
const items: SplashScreenItem[] = [];
|
const items: SplashScreenItem[] = [];
|
||||||
|
|
||||||
if (userContext.authType === AuthType.ResourceToken) {
|
if (this.container.isAuthWithResourceToken()) {
|
||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,21 +1,22 @@
|
|||||||
import * as ko from "knockout";
|
import * as ko from "knockout";
|
||||||
import Q from "q";
|
|
||||||
import * as _ from "underscore";
|
import * as _ from "underscore";
|
||||||
import { Areas } from "../../../Common/Constants";
|
import Q from "q";
|
||||||
import * as ViewModels from "../../../Contracts/ViewModels";
|
|
||||||
import { Action } from "../../../Shared/Telemetry/TelemetryConstants";
|
import { Action } from "../../../Shared/Telemetry/TelemetryConstants";
|
||||||
import * as TelemetryProcessor from "../../../Shared/Telemetry/TelemetryProcessor";
|
import { CassandraTableKey, CassandraAPIDataClient } from "../TableDataClient";
|
||||||
import QueryTablesTab from "../../Tabs/QueryTablesTab";
|
|
||||||
import * as Constants from "../Constants";
|
|
||||||
import { getQuotedCqlIdentifier } from "../CqlUtilities";
|
|
||||||
import * as Entities from "../Entities";
|
|
||||||
import { CassandraAPIDataClient, CassandraTableKey } from "../TableDataClient";
|
|
||||||
import * as TableEntityProcessor from "../TableEntityProcessor";
|
|
||||||
import * as Utilities from "../Utilities";
|
|
||||||
import * as DataTableUtilities from "./DataTableUtilities";
|
|
||||||
import DataTableViewModel from "./DataTableViewModel";
|
import DataTableViewModel from "./DataTableViewModel";
|
||||||
|
import * as DataTableUtilities from "./DataTableUtilities";
|
||||||
|
import { getQuotedCqlIdentifier } from "../CqlUtilities";
|
||||||
import TableCommands from "./TableCommands";
|
import TableCommands from "./TableCommands";
|
||||||
import TableEntityCache from "./TableEntityCache";
|
import TableEntityCache from "./TableEntityCache";
|
||||||
|
import * as Constants from "../Constants";
|
||||||
|
import { Areas } from "../../../Common/Constants";
|
||||||
|
import * as Utilities from "../Utilities";
|
||||||
|
import * as Entities from "../Entities";
|
||||||
|
import QueryTablesTab from "../../Tabs/QueryTablesTab";
|
||||||
|
import * as TableEntityProcessor from "../TableEntityProcessor";
|
||||||
|
import * as TelemetryProcessor from "../../../Shared/Telemetry/TelemetryProcessor";
|
||||||
|
import * as ViewModels from "../../../Contracts/ViewModels";
|
||||||
|
|
||||||
interface IListTableEntitiesSegmentedResult extends Entities.IListTableEntitiesResult {
|
interface IListTableEntitiesSegmentedResult extends Entities.IListTableEntitiesResult {
|
||||||
ExceedMaximumRetries?: boolean;
|
ExceedMaximumRetries?: boolean;
|
||||||
@@ -353,8 +354,8 @@ export default class TableEntityListViewModel extends DataTableViewModel {
|
|||||||
itemB = new Date(<string>(<any>rowB[col])._);
|
itemB = new Date(<string>(<any>rowB[col])._);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
itemA = <string>(<any>rowA[col])._?.toLowerCase();
|
itemA = <string>(<any>rowA[col])._.toLowerCase();
|
||||||
itemB = <string>(<any>rowB[col])._?.toLowerCase();
|
itemB = <string>(<any>rowB[col])._.toLowerCase();
|
||||||
}
|
}
|
||||||
var compareResult: number = itemA < itemB ? -1 : itemA > itemB ? 1 : 0;
|
var compareResult: number = itemA < itemB ? -1 : itemA > itemB ? 1 : 0;
|
||||||
if (compareResult !== 0) {
|
if (compareResult !== 0) {
|
||||||
|
|||||||
@@ -136,6 +136,7 @@ export default class DatabaseSettingsTab extends TabsBase implements ViewModels.
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const serverId = this.container.serverId();
|
||||||
const regions =
|
const regions =
|
||||||
(account &&
|
(account &&
|
||||||
account.properties &&
|
account.properties &&
|
||||||
@@ -149,14 +150,14 @@ export default class DatabaseSettingsTab extends TabsBase implements ViewModels.
|
|||||||
estimatedSpend = PricingUtils.getEstimatedSpendHtml(
|
estimatedSpend = PricingUtils.getEstimatedSpendHtml(
|
||||||
// if migrating from autoscale to manual, we use the autoscale RUs value as that is what will be set...
|
// if migrating from autoscale to manual, we use the autoscale RUs value as that is what will be set...
|
||||||
this.overrideWithAutoPilotSettings() ? this.autoPilotThroughput() : this.throughput(),
|
this.overrideWithAutoPilotSettings() ? this.autoPilotThroughput() : this.throughput(),
|
||||||
userContext.portalEnv,
|
serverId,
|
||||||
regions,
|
regions,
|
||||||
multimaster
|
multimaster
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
estimatedSpend = PricingUtils.getEstimatedAutoscaleSpendHtml(
|
estimatedSpend = PricingUtils.getEstimatedAutoscaleSpendHtml(
|
||||||
this.autoPilotThroughput(),
|
this.autoPilotThroughput(),
|
||||||
userContext.portalEnv,
|
serverId,
|
||||||
regions,
|
regions,
|
||||||
multimaster
|
multimaster
|
||||||
);
|
);
|
||||||
@@ -401,6 +402,7 @@ export default class DatabaseSettingsTab extends TabsBase implements ViewModels.
|
|||||||
this._setBaseline();
|
this._setBaseline();
|
||||||
this._wasAutopilotOriginallySet(this.isAutoPilotSelected());
|
this._wasAutopilotOriginallySet(this.isAutoPilotSelected());
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
this.container.isRefreshingExplorer(false);
|
||||||
this.isExecutionError(true);
|
this.isExecutionError(true);
|
||||||
console.error(error);
|
console.error(error);
|
||||||
const errorMessage = getErrorMessage(error);
|
const errorMessage = getErrorMessage(error);
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ export default class GalleryTab extends TabsBase {
|
|||||||
galleryItem: options.galleryItem,
|
galleryItem: options.galleryItem,
|
||||||
isFavorite: options.isFavorite,
|
isFavorite: options.isFavorite,
|
||||||
selectedTab: options.selectedTab,
|
selectedTab: options.selectedTab,
|
||||||
sortBy: SortBy.MostRecent,
|
sortBy: SortBy.MostViewed,
|
||||||
searchText: undefined,
|
searchText: undefined,
|
||||||
};
|
};
|
||||||
this.galleryAndNotebookViewerComponentAdapter = new GalleryAndNotebookViewerComponentAdapter(
|
this.galleryAndNotebookViewerComponentAdapter = new GalleryAndNotebookViewerComponentAdapter(
|
||||||
|
|||||||
@@ -1,16 +1,18 @@
|
|||||||
import * as ko from "knockout";
|
|
||||||
import * as Constants from "../../Common/Constants";
|
import * as Constants from "../../Common/Constants";
|
||||||
import { HashMap } from "../../Common/HashMap";
|
import * as ko from "knockout";
|
||||||
import { configContext, Platform } from "../../ConfigContext";
|
|
||||||
import * as ViewModels from "../../Contracts/ViewModels";
|
import * as ViewModels from "../../Contracts/ViewModels";
|
||||||
import { Action, ActionModifiers } from "../../Shared/Telemetry/TelemetryConstants";
|
import AuthHeadersUtil from "../../Platform/Hosted/Authorization";
|
||||||
import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
|
||||||
import { userContext } from "../../UserContext";
|
|
||||||
import { isInvalidParentFrameOrigin } from "../../Utils/MessageValidation";
|
import { isInvalidParentFrameOrigin } from "../../Utils/MessageValidation";
|
||||||
|
import Q from "q";
|
||||||
|
import TabsBase from "./TabsBase";
|
||||||
|
import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
||||||
|
import { Action, ActionModifiers } from "../../Shared/Telemetry/TelemetryConstants";
|
||||||
|
import { ConsoleDataType } from "../Menus/NotificationConsole/NotificationConsoleComponent";
|
||||||
|
import { HashMap } from "../../Common/HashMap";
|
||||||
import * as NotificationConsoleUtils from "../../Utils/NotificationConsoleUtils";
|
import * as NotificationConsoleUtils from "../../Utils/NotificationConsoleUtils";
|
||||||
import Explorer from "../Explorer";
|
import Explorer from "../Explorer";
|
||||||
import { ConsoleDataType } from "../Menus/NotificationConsole/NotificationConsoleComponent";
|
import { userContext } from "../../UserContext";
|
||||||
import TabsBase from "./TabsBase";
|
import { configContext, Platform } from "../../ConfigContext";
|
||||||
|
|
||||||
export default class MongoShellTab extends TabsBase {
|
export default class MongoShellTab extends TabsBase {
|
||||||
public url: ko.Computed<string>;
|
public url: ko.Computed<string>;
|
||||||
@@ -31,7 +33,7 @@ export default class MongoShellTab extends TabsBase {
|
|||||||
this._runtimeEndpoint = configContext.platform === Platform.Hosted ? configContext.BACKEND_ENDPOINT : "";
|
this._runtimeEndpoint = configContext.platform === Platform.Hosted ? configContext.BACKEND_ENDPOINT : "";
|
||||||
const extensionEndpoint: string = configContext.BACKEND_ENDPOINT || this._runtimeEndpoint || "";
|
const extensionEndpoint: string = configContext.BACKEND_ENDPOINT || this._runtimeEndpoint || "";
|
||||||
let baseUrl = "/content/mongoshell/dist/";
|
let baseUrl = "/content/mongoshell/dist/";
|
||||||
if (userContext.portalEnv === "localhost") {
|
if (this._container.serverId() === "localhost") {
|
||||||
baseUrl = "/content/mongoshell/";
|
baseUrl = "/content/mongoshell/";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -83,10 +85,10 @@ export default class MongoShellTab extends TabsBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private handleReadyMessage(event: MessageEvent, shellIframe: HTMLIFrameElement) {
|
private handleReadyMessage(event: MessageEvent, shellIframe: HTMLIFrameElement) {
|
||||||
if (typeof event.data["kind"] !== "string") {
|
if (typeof event.data["data"] !== "string") {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (event.data.kind !== "ready") {
|
if (event.data.data !== "ready") {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,24 +4,18 @@ import * as _ from "underscore";
|
|||||||
import UploadWorker from "worker-loader!../../workers/upload";
|
import UploadWorker from "worker-loader!../../workers/upload";
|
||||||
import { AuthType } from "../../AuthType";
|
import { AuthType } from "../../AuthType";
|
||||||
import * as Constants from "../../Common/Constants";
|
import * as Constants from "../../Common/Constants";
|
||||||
import { createDocument } from "../../Common/dataAccess/createDocument";
|
|
||||||
import { getCollectionUsageSizeInKB } from "../../Common/dataAccess/getCollectionDataUsageSize";
|
|
||||||
import { readCollectionOffer } from "../../Common/dataAccess/readCollectionOffer";
|
|
||||||
import { readStoredProcedures } from "../../Common/dataAccess/readStoredProcedures";
|
import { readStoredProcedures } from "../../Common/dataAccess/readStoredProcedures";
|
||||||
import { readTriggers } from "../../Common/dataAccess/readTriggers";
|
import { readTriggers } from "../../Common/dataAccess/readTriggers";
|
||||||
import { readUserDefinedFunctions } from "../../Common/dataAccess/readUserDefinedFunctions";
|
import { readUserDefinedFunctions } from "../../Common/dataAccess/readUserDefinedFunctions";
|
||||||
import { getErrorMessage, getErrorStack } from "../../Common/ErrorHandlingUtils";
|
import { readCollectionOffer } from "../../Common/dataAccess/readCollectionOffer";
|
||||||
|
import { getCollectionUsageSizeInKB } from "../../Common/dataAccess/getCollectionDataUsageSize";
|
||||||
import * as Logger from "../../Common/Logger";
|
import * as Logger from "../../Common/Logger";
|
||||||
import { fetchPortalNotifications } from "../../Common/PortalNotifications";
|
|
||||||
import { configContext, Platform } from "../../ConfigContext";
|
|
||||||
import * as DataModels from "../../Contracts/DataModels";
|
import * as DataModels from "../../Contracts/DataModels";
|
||||||
import * as ViewModels from "../../Contracts/ViewModels";
|
import * as ViewModels from "../../Contracts/ViewModels";
|
||||||
import { Action, ActionModifiers } from "../../Shared/Telemetry/TelemetryConstants";
|
import { Action, ActionModifiers } from "../../Shared/Telemetry/TelemetryConstants";
|
||||||
import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
||||||
import { userContext } from "../../UserContext";
|
|
||||||
import * as NotificationConsoleUtils from "../../Utils/NotificationConsoleUtils";
|
import * as NotificationConsoleUtils from "../../Utils/NotificationConsoleUtils";
|
||||||
import { StartUploadMessageParams, UploadDetails, UploadDetailsRecord } from "../../workers/upload/definitions";
|
import { StartUploadMessageParams, UploadDetails, UploadDetailsRecord } from "../../workers/upload/definitions";
|
||||||
import Explorer from "../Explorer";
|
|
||||||
import { ConsoleDataType } from "../Menus/NotificationConsole/NotificationConsoleComponent";
|
import { ConsoleDataType } from "../Menus/NotificationConsole/NotificationConsoleComponent";
|
||||||
import { CassandraAPIDataClient, CassandraTableKey, CassandraTableKeys } from "../Tables/TableDataClient";
|
import { CassandraAPIDataClient, CassandraTableKey, CassandraTableKeys } from "../Tables/TableDataClient";
|
||||||
import ConflictsTab from "../Tabs/ConflictsTab";
|
import ConflictsTab from "../Tabs/ConflictsTab";
|
||||||
@@ -38,6 +32,12 @@ import DocumentId from "./DocumentId";
|
|||||||
import StoredProcedure from "./StoredProcedure";
|
import StoredProcedure from "./StoredProcedure";
|
||||||
import Trigger from "./Trigger";
|
import Trigger from "./Trigger";
|
||||||
import UserDefinedFunction from "./UserDefinedFunction";
|
import UserDefinedFunction from "./UserDefinedFunction";
|
||||||
|
import { configContext, Platform } from "../../ConfigContext";
|
||||||
|
import Explorer from "../Explorer";
|
||||||
|
import { userContext } from "../../UserContext";
|
||||||
|
import { fetchPortalNotifications } from "../../Common/PortalNotifications";
|
||||||
|
import { getErrorMessage, getErrorStack } from "../../Common/ErrorHandlingUtils";
|
||||||
|
import { createDocument } from "../../Common/dataAccess/createDocument";
|
||||||
|
|
||||||
export default class Collection implements ViewModels.Collection {
|
export default class Collection implements ViewModels.Collection {
|
||||||
public nodeKind: string;
|
public nodeKind: string;
|
||||||
@@ -1200,6 +1200,7 @@ export default class Collection implements ViewModels.Collection {
|
|||||||
|
|
||||||
public async loadOffer(): Promise<void> {
|
public async loadOffer(): Promise<void> {
|
||||||
if (!this.container.isServerlessEnabled() && !this.offer()) {
|
if (!this.container.isServerlessEnabled() && !this.offer()) {
|
||||||
|
this.container.isRefreshingExplorer(true);
|
||||||
const startKey: number = TelemetryProcessor.traceStart(Action.LoadOffers, {
|
const startKey: number = TelemetryProcessor.traceStart(Action.LoadOffers, {
|
||||||
databaseName: this.databaseId,
|
databaseName: this.databaseId,
|
||||||
collectionName: this.id(),
|
collectionName: this.id(),
|
||||||
@@ -1236,6 +1237,8 @@ export default class Collection implements ViewModels.Collection {
|
|||||||
startKey
|
startKey
|
||||||
);
|
);
|
||||||
throw error;
|
throw error;
|
||||||
|
} finally {
|
||||||
|
this.container.isRefreshingExplorer(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
import * as ko from "knockout";
|
import * as ko from "knockout";
|
||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
import { ReactAdapter } from "../../Bindings/ReactBindingHandler";
|
|
||||||
import { AccordionComponent, AccordionItemComponent } from "../Controls/Accordion/AccordionComponent";
|
import { AccordionComponent, AccordionItemComponent } from "../Controls/Accordion/AccordionComponent";
|
||||||
import { TreeComponent, TreeNode, TreeNodeMenuItem, TreeNodeComponent } from "../Controls/TreeComponent/TreeComponent";
|
import { TreeComponent, TreeNode, TreeNodeMenuItem } from "../Controls/TreeComponent/TreeComponent";
|
||||||
import * as ViewModels from "../../Contracts/ViewModels";
|
import * as ViewModels from "../../Contracts/ViewModels";
|
||||||
import { NotebookContentItem, NotebookContentItemType } from "../Notebook/NotebookContentItem";
|
import { NotebookContentItem, NotebookContentItemType } from "../Notebook/NotebookContentItem";
|
||||||
import { ResourceTreeContextMenuButtonFactory } from "../ContextMenuButtonFactory";
|
import { ResourceTreeContextMenuButtonFactory } from "../ContextMenuButtonFactory";
|
||||||
@@ -18,8 +17,6 @@ import FileIcon from "../../../images/notebook/file-cosmos.svg";
|
|||||||
import PublishIcon from "../../../images/notebook/publish_content.svg";
|
import PublishIcon from "../../../images/notebook/publish_content.svg";
|
||||||
import { ArrayHashMap } from "../../Common/ArrayHashMap";
|
import { ArrayHashMap } from "../../Common/ArrayHashMap";
|
||||||
import { NotebookUtil } from "../Notebook/NotebookUtil";
|
import { NotebookUtil } from "../Notebook/NotebookUtil";
|
||||||
import _ from "underscore";
|
|
||||||
import { IPinnedRepo } from "../../Juno/JunoClient";
|
|
||||||
import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
||||||
import { Action, ActionModifiers, Source } from "../../Shared/Telemetry/TelemetryConstants";
|
import { Action, ActionModifiers, Source } from "../../Shared/Telemetry/TelemetryConstants";
|
||||||
import { Areas } from "../../Common/Constants";
|
import { Areas } from "../../Common/Constants";
|
||||||
@@ -34,31 +31,39 @@ import Trigger from "./Trigger";
|
|||||||
import TabsBase from "../Tabs/TabsBase";
|
import TabsBase from "../Tabs/TabsBase";
|
||||||
import { userContext } from "../../UserContext";
|
import { userContext } from "../../UserContext";
|
||||||
import * as DataModels from "../../Contracts/DataModels";
|
import * as DataModels from "../../Contracts/DataModels";
|
||||||
|
import { DataTitle, NotebooksTitle, PseudoDirPath } from "../../hooks/useNotebooks";
|
||||||
|
|
||||||
export class ResourceTreeAdapter implements ReactAdapter {
|
export interface ResourceTreeProps {
|
||||||
public static readonly MyNotebooksTitle = "My Notebooks";
|
// TODO remove eventually
|
||||||
public static readonly GitHubReposTitle = "GitHub repos";
|
explorer: Explorer;
|
||||||
|
|
||||||
private static readonly DataTitle = "DATA";
|
lastRefreshedTime: number;
|
||||||
private static readonly NotebooksTitle = "NOTEBOOKS";
|
|
||||||
private static readonly PseudoDirPath = "PsuedoDir";
|
|
||||||
|
|
||||||
public parameters: ko.Observable<number>;
|
galleryContentRoot: NotebookContentItem;
|
||||||
|
myNotebooksContentRoot: NotebookContentItem;
|
||||||
public galleryContentRoot: NotebookContentItem;
|
gitHubNotebooksContentRoot: NotebookContentItem;
|
||||||
public myNotebooksContentRoot: NotebookContentItem;
|
}
|
||||||
public gitHubNotebooksContentRoot: NotebookContentItem;
|
|
||||||
|
|
||||||
|
export class ResourceTree extends React.Component<ResourceTreeProps> {
|
||||||
private koSubsDatabaseIdMap: ArrayHashMap<ko.Subscription>; // database id -> ko subs
|
private koSubsDatabaseIdMap: ArrayHashMap<ko.Subscription>; // database id -> ko subs
|
||||||
private koSubsCollectionIdMap: ArrayHashMap<ko.Subscription>; // collection id -> ko subs
|
private koSubsCollectionIdMap: ArrayHashMap<ko.Subscription>; // collection id -> ko subs
|
||||||
private databaseCollectionIdMap: ArrayHashMap<string>; // database id -> collection ids
|
private databaseCollectionIdMap: ArrayHashMap<string>; // database id -> collection ids
|
||||||
|
|
||||||
public constructor(private container: Explorer) {
|
private readonly container: Explorer;
|
||||||
this.parameters = ko.observable(Date.now());
|
|
||||||
|
|
||||||
this.container.selectedNode.subscribe((newValue: any) => this.triggerRender());
|
constructor(props: ResourceTreeProps) {
|
||||||
this.container.tabsManager.activeTab.subscribe((newValue: TabsBase) => this.triggerRender());
|
super(props);
|
||||||
this.container.isNotebookEnabled.subscribe((newValue) => this.triggerRender());
|
this.state = {
|
||||||
|
galleryContentRoot: undefined,
|
||||||
|
myNotebooksContentRoot: undefined,
|
||||||
|
gitHubNotebooksContentRoot: undefined,
|
||||||
|
};
|
||||||
|
|
||||||
|
this.container = props.explorer;
|
||||||
|
|
||||||
|
this.container.selectedNode.subscribe(() => this.triggerRender());
|
||||||
|
this.container.tabsManager.activeTab.subscribe(() => this.triggerRender());
|
||||||
|
this.container.isNotebookEnabled.subscribe(() => this.triggerRender());
|
||||||
|
|
||||||
this.koSubsDatabaseIdMap = new ArrayHashMap();
|
this.koSubsDatabaseIdMap = new ArrayHashMap();
|
||||||
this.koSubsCollectionIdMap = new ArrayHashMap();
|
this.koSubsCollectionIdMap = new ArrayHashMap();
|
||||||
@@ -73,34 +78,9 @@ export class ResourceTreeAdapter implements ReactAdapter {
|
|||||||
});
|
});
|
||||||
|
|
||||||
this.container.nonSystemDatabases().forEach((database: ViewModels.Database) => this.watchDatabase(database));
|
this.container.nonSystemDatabases().forEach((database: ViewModels.Database) => this.watchDatabase(database));
|
||||||
this.triggerRender();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private traceMyNotebookTreeInfo() {
|
render(): JSX.Element {
|
||||||
const myNotebooksTree = this.myNotebooksContentRoot;
|
|
||||||
if (myNotebooksTree.children) {
|
|
||||||
// Count 1st generation children (tree is lazy-loaded)
|
|
||||||
const nodeCounts = { files: 0, notebooks: 0, directories: 0 };
|
|
||||||
myNotebooksTree.children.forEach((treeNode) => {
|
|
||||||
switch ((treeNode as NotebookContentItem).type) {
|
|
||||||
case NotebookContentItemType.File:
|
|
||||||
nodeCounts.files++;
|
|
||||||
break;
|
|
||||||
case NotebookContentItemType.Directory:
|
|
||||||
nodeCounts.directories++;
|
|
||||||
break;
|
|
||||||
case NotebookContentItemType.Notebook:
|
|
||||||
nodeCounts.notebooks++;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
TelemetryProcessor.trace(Action.RefreshResourceTreeMyNotebooks, ActionModifiers.Mark, { ...nodeCounts });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public renderComponent(): JSX.Element {
|
|
||||||
const dataRootNode = this.buildDataTree();
|
const dataRootNode = this.buildDataTree();
|
||||||
const notebooksRootNode = this.buildNotebooksTrees();
|
const notebooksRootNode = this.buildNotebooksTrees();
|
||||||
|
|
||||||
@@ -108,15 +88,15 @@ export class ResourceTreeAdapter implements ReactAdapter {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<AccordionComponent>
|
<AccordionComponent>
|
||||||
<AccordionItemComponent title={ResourceTreeAdapter.DataTitle} isExpanded={!this.gitHubNotebooksContentRoot}>
|
<AccordionItemComponent title={DataTitle} isExpanded={!this.props.gitHubNotebooksContentRoot}>
|
||||||
<TreeComponent className="dataResourceTree" rootNode={dataRootNode} />
|
<TreeComponent className="dataResourceTree" rootNode={dataRootNode} />
|
||||||
</AccordionItemComponent>
|
</AccordionItemComponent>
|
||||||
<AccordionItemComponent title={ResourceTreeAdapter.NotebooksTitle}>
|
<AccordionItemComponent title={NotebooksTitle}>
|
||||||
<TreeComponent className="notebookResourceTree" rootNode={notebooksRootNode} />
|
<TreeComponent className="notebookResourceTree" rootNode={notebooksRootNode} />
|
||||||
</AccordionItemComponent>
|
</AccordionItemComponent>
|
||||||
</AccordionComponent>
|
</AccordionComponent>
|
||||||
|
|
||||||
{this.galleryContentRoot && this.buildGalleryCallout()}
|
{this.props.galleryContentRoot && this.buildGalleryCallout()}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
@@ -124,71 +104,6 @@ export class ResourceTreeAdapter implements ReactAdapter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async initialize(): Promise<void[]> {
|
|
||||||
const refreshTasks: Promise<void>[] = [];
|
|
||||||
|
|
||||||
this.galleryContentRoot = {
|
|
||||||
name: "Gallery",
|
|
||||||
path: "Gallery",
|
|
||||||
type: NotebookContentItemType.File,
|
|
||||||
};
|
|
||||||
|
|
||||||
this.myNotebooksContentRoot = {
|
|
||||||
name: ResourceTreeAdapter.MyNotebooksTitle,
|
|
||||||
path: this.container.getNotebookBasePath(),
|
|
||||||
type: NotebookContentItemType.Directory,
|
|
||||||
};
|
|
||||||
|
|
||||||
// Only if notebook server is available we can refresh
|
|
||||||
if (this.container.notebookServerInfo().notebookServerEndpoint) {
|
|
||||||
refreshTasks.push(
|
|
||||||
this.container.refreshContentItem(this.myNotebooksContentRoot).then(() => {
|
|
||||||
this.triggerRender();
|
|
||||||
this.traceMyNotebookTreeInfo();
|
|
||||||
})
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.container.notebookManager?.gitHubOAuthService.isLoggedIn()) {
|
|
||||||
this.gitHubNotebooksContentRoot = {
|
|
||||||
name: ResourceTreeAdapter.GitHubReposTitle,
|
|
||||||
path: ResourceTreeAdapter.PseudoDirPath,
|
|
||||||
type: NotebookContentItemType.Directory,
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
this.gitHubNotebooksContentRoot = undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
return Promise.all(refreshTasks);
|
|
||||||
}
|
|
||||||
|
|
||||||
public initializeGitHubRepos(pinnedRepos: IPinnedRepo[]): void {
|
|
||||||
if (this.gitHubNotebooksContentRoot) {
|
|
||||||
this.gitHubNotebooksContentRoot.children = [];
|
|
||||||
pinnedRepos?.forEach((pinnedRepo) => {
|
|
||||||
const repoFullName = GitHubUtils.toRepoFullName(pinnedRepo.owner, pinnedRepo.name);
|
|
||||||
const repoTreeItem: NotebookContentItem = {
|
|
||||||
name: repoFullName,
|
|
||||||
path: ResourceTreeAdapter.PseudoDirPath,
|
|
||||||
type: NotebookContentItemType.Directory,
|
|
||||||
children: [],
|
|
||||||
};
|
|
||||||
|
|
||||||
pinnedRepo.branches.forEach((branch) => {
|
|
||||||
repoTreeItem.children.push({
|
|
||||||
name: branch.name,
|
|
||||||
path: GitHubUtils.toContentUri(pinnedRepo.owner, pinnedRepo.name, branch.name, ""),
|
|
||||||
type: NotebookContentItemType.Directory,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
this.gitHubNotebooksContentRoot.children.push(repoTreeItem);
|
|
||||||
});
|
|
||||||
|
|
||||||
this.triggerRender();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private buildDataTree(): TreeNode {
|
private buildDataTree(): TreeNode {
|
||||||
const databaseTreeNodes: TreeNode[] = this.container.nonSystemDatabases().map((database: ViewModels.Database) => {
|
const databaseTreeNodes: TreeNode[] = this.container.nonSystemDatabases().map((database: ViewModels.Database) => {
|
||||||
const databaseNode: TreeNode = {
|
const databaseNode: TreeNode = {
|
||||||
@@ -288,7 +203,7 @@ export class ResourceTreeAdapter implements ReactAdapter {
|
|||||||
children.push(schemaNode);
|
children.push(schemaNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ResourceTreeAdapter.showScriptNodes(this.container)) {
|
if (ResourceTree.showScriptNodes(this.container)) {
|
||||||
children.push(this.buildStoredProcedureNode(collection));
|
children.push(this.buildStoredProcedureNode(collection));
|
||||||
children.push(this.buildUserDefinedFunctionsNode(collection));
|
children.push(this.buildUserDefinedFunctionsNode(collection));
|
||||||
children.push(this.buildTriggerNode(collection));
|
children.push(this.buildTriggerNode(collection));
|
||||||
@@ -329,7 +244,7 @@ export class ResourceTreeAdapter implements ReactAdapter {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
onExpanded: () => {
|
onExpanded: () => {
|
||||||
if (ResourceTreeAdapter.showScriptNodes(this.container)) {
|
if (ResourceTree.showScriptNodes(this.container)) {
|
||||||
collection.loadStoredProcedures();
|
collection.loadStoredProcedures();
|
||||||
collection.loadUserDefinedFunctions();
|
collection.loadUserDefinedFunctions();
|
||||||
collection.loadTriggers();
|
collection.loadTriggers();
|
||||||
@@ -408,7 +323,7 @@ export class ResourceTreeAdapter implements ReactAdapter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public buildSchemaNode(collection: ViewModels.Collection): TreeNode {
|
public buildSchemaNode(collection: ViewModels.Collection): TreeNode {
|
||||||
if (collection.analyticalStorageTtl() == undefined) {
|
if (collection.analyticalStorageTtl() === undefined) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -429,12 +344,14 @@ export class ResourceTreeAdapter implements ReactAdapter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private getSchemaNodes(fields: DataModels.IDataField[]): TreeNode[] {
|
private getSchemaNodes(fields: DataModels.IDataField[]): TreeNode[] {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
const schema: any = {};
|
const schema: any = {};
|
||||||
|
|
||||||
//unflatten
|
//unflatten
|
||||||
fields.forEach((field: DataModels.IDataField, fieldIndex: number) => {
|
fields.forEach((field: DataModels.IDataField) => {
|
||||||
const path: string[] = field.path.split(".");
|
const path: string[] = field.path.split(".");
|
||||||
const fieldProperties = [field.dataType.name, `HasNulls: ${field.hasNulls}`];
|
const fieldProperties = [field.dataType.name, `HasNulls: ${field.hasNulls}`];
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
let current: any = {};
|
let current: any = {};
|
||||||
path.forEach((name: string, pathIndex: number) => {
|
path.forEach((name: string, pathIndex: number) => {
|
||||||
if (pathIndex === 0) {
|
if (pathIndex === 0) {
|
||||||
@@ -459,9 +376,11 @@ export class ResourceTreeAdapter implements ReactAdapter {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
const traverse = (obj: any): TreeNode[] => {
|
const traverse = (obj: any): TreeNode[] => {
|
||||||
const children: TreeNode[] = [];
|
const children: TreeNode[] = [];
|
||||||
|
|
||||||
|
// eslint-disable-next-line no-null/no-null
|
||||||
if (obj !== null && !Array.isArray(obj) && typeof obj === "object") {
|
if (obj !== null && !Array.isArray(obj) && typeof obj === "object") {
|
||||||
Object.entries(obj).forEach(([key, value]) => {
|
Object.entries(obj).forEach(([key, value]) => {
|
||||||
children.push({ label: key, children: traverse(value) });
|
children.push({ label: key, children: traverse(value) });
|
||||||
@@ -477,21 +396,21 @@ export class ResourceTreeAdapter implements ReactAdapter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private buildNotebooksTrees(): TreeNode {
|
private buildNotebooksTrees(): TreeNode {
|
||||||
let notebooksTree: TreeNode = {
|
const notebooksTree: TreeNode = {
|
||||||
label: undefined,
|
label: undefined,
|
||||||
isExpanded: true,
|
isExpanded: true,
|
||||||
children: [],
|
children: [],
|
||||||
};
|
};
|
||||||
|
|
||||||
if (this.galleryContentRoot) {
|
if (this.props.galleryContentRoot) {
|
||||||
notebooksTree.children.push(this.buildGalleryNotebooksTree());
|
notebooksTree.children.push(this.buildGalleryNotebooksTree());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.myNotebooksContentRoot) {
|
if (this.props.myNotebooksContentRoot) {
|
||||||
notebooksTree.children.push(this.buildMyNotebooksTree());
|
notebooksTree.children.push(this.buildMyNotebooksTree());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.gitHubNotebooksContentRoot) {
|
if (this.props.gitHubNotebooksContentRoot) {
|
||||||
// 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(this.buildGitHubNotebooksTree());
|
notebooksTree.children.push(this.buildGitHubNotebooksTree());
|
||||||
@@ -561,7 +480,7 @@ export class ResourceTreeAdapter implements ReactAdapter {
|
|||||||
|
|
||||||
private buildMyNotebooksTree(): TreeNode {
|
private buildMyNotebooksTree(): TreeNode {
|
||||||
const myNotebooksTree: TreeNode = this.buildNotebookDirectoryNode(
|
const myNotebooksTree: TreeNode = this.buildNotebookDirectoryNode(
|
||||||
this.myNotebooksContentRoot,
|
this.props.myNotebooksContentRoot,
|
||||||
(item: NotebookContentItem) => {
|
(item: NotebookContentItem) => {
|
||||||
this.container.openNotebook(item).then((hasOpened) => {
|
this.container.openNotebook(item).then((hasOpened) => {
|
||||||
if (hasOpened) {
|
if (hasOpened) {
|
||||||
@@ -582,7 +501,7 @@ export class ResourceTreeAdapter implements ReactAdapter {
|
|||||||
|
|
||||||
private buildGitHubNotebooksTree(): TreeNode {
|
private buildGitHubNotebooksTree(): TreeNode {
|
||||||
const gitHubNotebooksTree: TreeNode = this.buildNotebookDirectoryNode(
|
const gitHubNotebooksTree: TreeNode = this.buildNotebookDirectoryNode(
|
||||||
this.gitHubNotebooksContentRoot,
|
this.props.gitHubNotebooksContentRoot,
|
||||||
(item: NotebookContentItem) => {
|
(item: NotebookContentItem) => {
|
||||||
this.container.openNotebook(item).then((hasOpened) => {
|
this.container.openNotebook(item).then((hasOpened) => {
|
||||||
if (hasOpened) {
|
if (hasOpened) {
|
||||||
@@ -654,6 +573,7 @@ export class ResourceTreeAdapter implements ReactAdapter {
|
|||||||
/* TODO Redesign Tab interface so that resource tree doesn't need to know about NotebookV2Tab.
|
/* TODO Redesign Tab interface so that resource tree doesn't need to know about NotebookV2Tab.
|
||||||
NotebookV2Tab could be dynamically imported, but not worth it to just get this type right.
|
NotebookV2Tab could be dynamically imported, but not worth it to just get this type right.
|
||||||
*/
|
*/
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
(activeTab as any).notebookPath() === item.path
|
(activeTab as any).notebookPath() === item.path
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
@@ -667,7 +587,7 @@ export class ResourceTreeAdapter implements ReactAdapter {
|
|||||||
{
|
{
|
||||||
label: "Rename",
|
label: "Rename",
|
||||||
iconSrc: NotebookIcon,
|
iconSrc: NotebookIcon,
|
||||||
onClick: () => this.container.renameNotebook(item),
|
onClick: () => this.container.renameNotebook(item).then(() => this.triggerRender()),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "Delete",
|
label: "Delete",
|
||||||
@@ -756,7 +676,7 @@ export class ResourceTreeAdapter implements ReactAdapter {
|
|||||||
{
|
{
|
||||||
label: "New Directory",
|
label: "New Directory",
|
||||||
iconSrc: NewNotebookIcon,
|
iconSrc: NewNotebookIcon,
|
||||||
onClick: () => this.container.onCreateDirectory(item),
|
onClick: () => this.container.onCreateDirectory(item).then(() => this.triggerRender()),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "New Notebook",
|
label: "New Notebook",
|
||||||
@@ -809,20 +729,19 @@ export class ResourceTreeAdapter implements ReactAdapter {
|
|||||||
/* TODO Redesign Tab interface so that resource tree doesn't need to know about NotebookV2Tab.
|
/* TODO Redesign Tab interface so that resource tree doesn't need to know about NotebookV2Tab.
|
||||||
NotebookV2Tab could be dynamically imported, but not worth it to just get this type right.
|
NotebookV2Tab could be dynamically imported, but not worth it to just get this type right.
|
||||||
*/
|
*/
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
(activeTab as any).notebookPath() === item.path
|
(activeTab as any).notebookPath() === item.path
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
contextMenu:
|
contextMenu:
|
||||||
createDirectoryContextMenu && item.path !== ResourceTreeAdapter.PseudoDirPath
|
createDirectoryContextMenu && item.path !== PseudoDirPath ? this.createDirectoryContextMenu(item) : undefined,
|
||||||
? this.createDirectoryContextMenu(item)
|
|
||||||
: undefined,
|
|
||||||
data: item,
|
data: item,
|
||||||
children: this.buildChildNodes(item, onFileClick, createDirectoryContextMenu, createFileContextMenu),
|
children: this.buildChildNodes(item, onFileClick, createDirectoryContextMenu, createFileContextMenu),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public triggerRender() {
|
private triggerRender() {
|
||||||
window.requestAnimationFrame(() => this.parameters(Date.now()));
|
this.setState({});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import Explorer from "../Explorer";
|
import Explorer from "../Explorer";
|
||||||
import * as ko from "knockout";
|
import * as ko from "knockout";
|
||||||
import { ResourceTreeAdapter } from "./ResourceTreeAdapter";
|
import { ResourceTree } from "./ResourceTree";
|
||||||
import * as ViewModels from "../../Contracts/ViewModels";
|
import * as ViewModels from "../../Contracts/ViewModels";
|
||||||
import TabsBase from "../Tabs/TabsBase";
|
import TabsBase from "../Tabs/TabsBase";
|
||||||
|
|
||||||
@@ -26,22 +26,40 @@ describe("ResourceTreeAdapter", () => {
|
|||||||
it("it should not select if no selected node", () => {
|
it("it should not select if no selected node", () => {
|
||||||
const explorer = mockContainer();
|
const explorer = mockContainer();
|
||||||
explorer.selectedNode(undefined);
|
explorer.selectedNode(undefined);
|
||||||
const resourceTreeAdapter = new ResourceTreeAdapter(explorer);
|
const resourceTree = new ResourceTree({
|
||||||
const isDataNodeSelected = resourceTreeAdapter.isDataNodeSelected("foo", "bar", undefined);
|
explorer,
|
||||||
|
lastRefreshedTime: 0,
|
||||||
|
galleryContentRoot: undefined,
|
||||||
|
myNotebooksContentRoot: undefined,
|
||||||
|
gitHubNotebooksContentRoot: undefined,
|
||||||
|
});
|
||||||
|
const isDataNodeSelected = resourceTree.isDataNodeSelected("foo", "bar", undefined);
|
||||||
expect(isDataNodeSelected).toBeFalsy();
|
expect(isDataNodeSelected).toBeFalsy();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("it should not select incorrect subnodekinds", () => {
|
it("it should not select incorrect subnodekinds", () => {
|
||||||
const resourceTreeAdapter = new ResourceTreeAdapter(mockContainer());
|
const resourceTree = new ResourceTree({
|
||||||
const isDataNodeSelected = resourceTreeAdapter.isDataNodeSelected("foo", "bar", undefined);
|
explorer: mockContainer(),
|
||||||
|
lastRefreshedTime: 0,
|
||||||
|
galleryContentRoot: undefined,
|
||||||
|
myNotebooksContentRoot: undefined,
|
||||||
|
gitHubNotebooksContentRoot: undefined,
|
||||||
|
});
|
||||||
|
const isDataNodeSelected = resourceTree.isDataNodeSelected("foo", "bar", undefined);
|
||||||
expect(isDataNodeSelected).toBeFalsy();
|
expect(isDataNodeSelected).toBeFalsy();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("it should not select if no active tab", () => {
|
it("it should not select if no active tab", () => {
|
||||||
const explorer = mockContainer();
|
const explorer = mockContainer();
|
||||||
explorer.tabsManager.activeTab(undefined);
|
explorer.tabsManager.activeTab(undefined);
|
||||||
const resourceTreeAdapter = new ResourceTreeAdapter(explorer);
|
const resourceTree = new ResourceTree({
|
||||||
const isDataNodeSelected = resourceTreeAdapter.isDataNodeSelected("foo", "bar", undefined);
|
explorer,
|
||||||
|
lastRefreshedTime: 0,
|
||||||
|
galleryContentRoot: undefined,
|
||||||
|
myNotebooksContentRoot: undefined,
|
||||||
|
gitHubNotebooksContentRoot: undefined,
|
||||||
|
});
|
||||||
|
const isDataNodeSelected = resourceTree.isDataNodeSelected("foo", "bar", undefined);
|
||||||
expect(isDataNodeSelected).toBeFalsy();
|
expect(isDataNodeSelected).toBeFalsy();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -54,8 +72,14 @@ describe("ResourceTreeAdapter", () => {
|
|||||||
id: ko.observable<string>("dbid"),
|
id: ko.observable<string>("dbid"),
|
||||||
selectedSubnodeKind: ko.observable<ViewModels.CollectionTabKind>(subNodeKind),
|
selectedSubnodeKind: ko.observable<ViewModels.CollectionTabKind>(subNodeKind),
|
||||||
} as unknown) as ViewModels.TreeNode);
|
} as unknown) as ViewModels.TreeNode);
|
||||||
const resourceTreeAdapter = new ResourceTreeAdapter(explorer);
|
const resourceTree = new ResourceTree({
|
||||||
const isDataNodeSelected = resourceTreeAdapter.isDataNodeSelected("dbid", undefined, [
|
explorer,
|
||||||
|
lastRefreshedTime: 0,
|
||||||
|
galleryContentRoot: undefined,
|
||||||
|
myNotebooksContentRoot: undefined,
|
||||||
|
gitHubNotebooksContentRoot: undefined,
|
||||||
|
});
|
||||||
|
const isDataNodeSelected = resourceTree.isDataNodeSelected("dbid", undefined, [
|
||||||
ViewModels.CollectionTabKind.Documents,
|
ViewModels.CollectionTabKind.Documents,
|
||||||
]);
|
]);
|
||||||
expect(isDataNodeSelected).toBeTruthy();
|
expect(isDataNodeSelected).toBeTruthy();
|
||||||
@@ -74,8 +98,14 @@ describe("ResourceTreeAdapter", () => {
|
|||||||
id: ko.observable<string>("collid"),
|
id: ko.observable<string>("collid"),
|
||||||
selectedSubnodeKind: ko.observable<ViewModels.CollectionTabKind>(subNodeKind),
|
selectedSubnodeKind: ko.observable<ViewModels.CollectionTabKind>(subNodeKind),
|
||||||
} as unknown) as ViewModels.TreeNode);
|
} as unknown) as ViewModels.TreeNode);
|
||||||
const resourceTreeAdapter = new ResourceTreeAdapter(explorer);
|
const resourceTree = new ResourceTree({
|
||||||
let isDataNodeSelected = resourceTreeAdapter.isDataNodeSelected("dbid", "collid", [subNodeKind]);
|
explorer,
|
||||||
|
lastRefreshedTime: 0,
|
||||||
|
galleryContentRoot: undefined,
|
||||||
|
myNotebooksContentRoot: undefined,
|
||||||
|
gitHubNotebooksContentRoot: undefined,
|
||||||
|
});
|
||||||
|
let isDataNodeSelected = resourceTree.isDataNodeSelected("dbid", "collid", [subNodeKind]);
|
||||||
expect(isDataNodeSelected).toBeTruthy();
|
expect(isDataNodeSelected).toBeTruthy();
|
||||||
|
|
||||||
subNodeKind = ViewModels.CollectionTabKind.Graph;
|
subNodeKind = ViewModels.CollectionTabKind.Graph;
|
||||||
@@ -89,7 +119,7 @@ describe("ResourceTreeAdapter", () => {
|
|||||||
id: ko.observable<string>("collid"),
|
id: ko.observable<string>("collid"),
|
||||||
selectedSubnodeKind: ko.observable<ViewModels.CollectionTabKind>(subNodeKind),
|
selectedSubnodeKind: ko.observable<ViewModels.CollectionTabKind>(subNodeKind),
|
||||||
} as unknown) as ViewModels.TreeNode);
|
} as unknown) as ViewModels.TreeNode);
|
||||||
isDataNodeSelected = resourceTreeAdapter.isDataNodeSelected("dbid", "collid", [subNodeKind]);
|
isDataNodeSelected = resourceTree.isDataNodeSelected("dbid", "collid", [subNodeKind]);
|
||||||
expect(isDataNodeSelected).toBeTruthy();
|
expect(isDataNodeSelected).toBeTruthy();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -105,8 +135,14 @@ describe("ResourceTreeAdapter", () => {
|
|||||||
explorer.tabsManager.activeTab({
|
explorer.tabsManager.activeTab({
|
||||||
tabKind: ViewModels.CollectionTabKind.Documents,
|
tabKind: ViewModels.CollectionTabKind.Documents,
|
||||||
} as TabsBase);
|
} as TabsBase);
|
||||||
const resourceTreeAdapter = new ResourceTreeAdapter(explorer);
|
const resourceTree = new ResourceTree({
|
||||||
const isDataNodeSelected = resourceTreeAdapter.isDataNodeSelected("dbid", "collid", [
|
explorer,
|
||||||
|
lastRefreshedTime: 0,
|
||||||
|
galleryContentRoot: undefined,
|
||||||
|
myNotebooksContentRoot: undefined,
|
||||||
|
gitHubNotebooksContentRoot: undefined,
|
||||||
|
});
|
||||||
|
const isDataNodeSelected = resourceTree.isDataNodeSelected("dbid", "collid", [
|
||||||
ViewModels.CollectionTabKind.Settings,
|
ViewModels.CollectionTabKind.Settings,
|
||||||
]);
|
]);
|
||||||
expect(isDataNodeSelected).toBeFalsy();
|
expect(isDataNodeSelected).toBeFalsy();
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import * as ko from "knockout";
|
|||||||
import * as DataModels from "../../Contracts/DataModels";
|
import * as DataModels from "../../Contracts/DataModels";
|
||||||
import * as ViewModels from "../../Contracts/ViewModels";
|
import * as ViewModels from "../../Contracts/ViewModels";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { ResourceTreeAdapter } from "./ResourceTreeAdapter";
|
import { ResourceTree } from "./ResourceTree";
|
||||||
import { shallow } from "enzyme";
|
import { shallow } from "enzyme";
|
||||||
import { TreeComponent, TreeNode, TreeComponentProps } from "../Controls/TreeComponent/TreeComponent";
|
import { TreeComponent, TreeNode, TreeComponentProps } from "../Controls/TreeComponent/TreeComponent";
|
||||||
import Explorer from "../Explorer";
|
import Explorer from "../Explorer";
|
||||||
@@ -237,7 +237,13 @@ const createMockCollection = (): ViewModels.Collection => {
|
|||||||
|
|
||||||
describe("Resource tree for schema", () => {
|
describe("Resource tree for schema", () => {
|
||||||
const mockContainer: Explorer = createMockContainer();
|
const mockContainer: Explorer = createMockContainer();
|
||||||
const resourceTree = new ResourceTreeAdapter(mockContainer);
|
const resourceTree = new ResourceTree({
|
||||||
|
explorer: mockContainer,
|
||||||
|
lastRefreshedTime: 0,
|
||||||
|
galleryContentRoot: undefined,
|
||||||
|
myNotebooksContentRoot: undefined,
|
||||||
|
gitHubNotebooksContentRoot: undefined,
|
||||||
|
});
|
||||||
|
|
||||||
it("should render", () => {
|
it("should render", () => {
|
||||||
const rootNode: TreeNode = resourceTree.buildSchemaNode(createMockCollection());
|
const rootNode: TreeNode = resourceTree.buildSchemaNode(createMockCollection());
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ const onInit = async () => {
|
|||||||
const props: GalleryAndNotebookViewerComponentProps = {
|
const props: GalleryAndNotebookViewerComponentProps = {
|
||||||
junoClient: new JunoClient(),
|
junoClient: new JunoClient(),
|
||||||
selectedTab: galleryViewerProps.selectedTab || GalleryTab.PublicGallery,
|
selectedTab: galleryViewerProps.selectedTab || GalleryTab.PublicGallery,
|
||||||
sortBy: galleryViewerProps.sortBy || SortBy.MostRecent,
|
sortBy: galleryViewerProps.sortBy || SortBy.MostViewed,
|
||||||
searchText: galleryViewerProps.searchText,
|
searchText: galleryViewerProps.searchText,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { Octokit } from "@octokit/rest";
|
import { Octokit } from "@octokit/rest";
|
||||||
import { HttpStatusCodes } from "../Common/Constants";
|
import { HttpStatusCodes } from "../Common/Constants";
|
||||||
import * as Logger from "../Common/Logger";
|
import * as Logger from "../Common/Logger";
|
||||||
import * as UrlUtility from "../Common/UrlUtility";
|
import UrlUtility from "../Common/UrlUtility";
|
||||||
import { NotebookUtil } from "../Explorer/Notebook/NotebookUtil";
|
import { NotebookUtil } from "../Explorer/Notebook/NotebookUtil";
|
||||||
import { getErrorMessage } from "../Common/ErrorHandlingUtils";
|
import { getErrorMessage } from "../Common/ErrorHandlingUtils";
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import * as Logger from "../Common/Logger";
|
|||||||
import { NotebookUtil } from "../Explorer/Notebook/NotebookUtil";
|
import { NotebookUtil } from "../Explorer/Notebook/NotebookUtil";
|
||||||
import { GitHubClient, IGitHubFile, IGitHubResponse } from "./GitHubClient";
|
import { GitHubClient, IGitHubFile, IGitHubResponse } from "./GitHubClient";
|
||||||
import * as GitHubUtils from "../Utils/GitHubUtils";
|
import * as GitHubUtils from "../Utils/GitHubUtils";
|
||||||
import * as UrlUtility from "../Common/UrlUtility";
|
import UrlUtility from "../Common/UrlUtility";
|
||||||
import { getErrorMessage } from "../Common/ErrorHandlingUtils";
|
import { getErrorMessage } from "../Common/ErrorHandlingUtils";
|
||||||
|
|
||||||
export interface GitHubContentProviderParams {
|
export interface GitHubContentProviderParams {
|
||||||
|
|||||||
@@ -27,8 +27,8 @@
|
|||||||
"Enable DB level throughput": "Enable Database Level Throughput",
|
"Enable DB level throughput": "Enable Database Level Throughput",
|
||||||
"Database Throughput": "Database Throughput",
|
"Database Throughput": "Database Throughput",
|
||||||
"UpdateInProgressMessage": "Data is being updated",
|
"UpdateInProgressMessage": "Data is being updated",
|
||||||
"UpdateCompletedMessageTitle": "Update succeeded",
|
"UpdateCompletedMessageTitle":"Update succeeded",
|
||||||
"UpdateCompletedMessageText": "Data update completed.",
|
"UpdateCompletedMessageText": "Data updation completed.",
|
||||||
"SubmissionMessageSuccessTitle": "Update started",
|
"SubmissionMessageSuccessTitle": "Update started",
|
||||||
"SubmissionMessageForNewRegionText": "Data update started. Region changed.",
|
"SubmissionMessageForNewRegionText": "Data update started. Region changed.",
|
||||||
"SubmissionMessageForSameRegionText": "Data update started. Region not changed.",
|
"SubmissionMessageForSameRegionText": "Data update started. Region not changed.",
|
||||||
@@ -37,56 +37,6 @@
|
|||||||
"OnSaveFailureMessage": "Data save operation not currently permitted."
|
"OnSaveFailureMessage": "Data save operation not currently permitted."
|
||||||
},
|
},
|
||||||
"SqlX": {
|
"SqlX": {
|
||||||
"DedicatedGatewayDescription": "Provision a dedicated gateway cluster for your Azure Cosmos DB account. A dedicated gateway is compute that is a front-end to data in your Azure Cosmos DB account. Your dedicated gateway automatically includes the integrated cache, which can improve read performance. ",
|
|
||||||
"DedicatedGateway": "Dedicated Gateway",
|
|
||||||
"Enable": "Enable",
|
|
||||||
"Disable": "Disable",
|
|
||||||
"LearnAboutDedicatedGateway": "Learn more about dedicated gateway.",
|
|
||||||
"DeprovisioningDetailsText": "Learn more about deprovisioning the dedicated gateway.",
|
|
||||||
"DedicatedGatewayPricing": "Learn more about dedicated gateway 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": "Dedicated gateway resource is being created.",
|
|
||||||
"CreateInitializeTitle": "Provisioning resource",
|
|
||||||
"CreateInitializeMessage": "Dedicated gateway resource will be provisioned.",
|
|
||||||
"CreateSuccessTitle": "Resource provisioned",
|
|
||||||
"CreateSuccesseMessage": "Dedicated gateway resource provisioned.",
|
|
||||||
"CreateFailureTitle": "Failed to provision resource",
|
|
||||||
"CreateFailureMessage": "Dedicated gateway resource provisioning failed.",
|
|
||||||
"UpdateMessage": "Dedicated gateway resource is being updated.",
|
|
||||||
"UpdateInitializeTitle": "Updating resource",
|
|
||||||
"UpdateInitializeMessage": "Dedicated gateway resource will be updated.",
|
|
||||||
"UpdateSuccessTitle": "Resource updated",
|
|
||||||
"UpdateSuccesseMessage": "Dedicated gateway resource updated.",
|
|
||||||
"UpdateFailureTitle": "Failed to update resource",
|
|
||||||
"UpdateFailureMessage": "Dedicated gateway resource updation failed.",
|
|
||||||
"DeleteMessage": "Dedicated gateway resource is being deleted.",
|
|
||||||
"DeleteInitializeTitle": "Deleting resource",
|
|
||||||
"DeleteInitializeMessage": "Dedicated gateway resource will be deleted.",
|
|
||||||
"DeleteSuccessTitle": "Resource deleted",
|
|
||||||
"DeleteSuccesseMessage": "Dedicated gateway resource deleted.",
|
|
||||||
"DeleteFailureTitle": "Failed to delete resource",
|
|
||||||
"DeleteFailureMessage": "Dedicated gateway resource deletion failed.",
|
|
||||||
"CannotSave": "Cannot save the changes to the Dedicated gateway resource at the moment",
|
|
||||||
"DedicatedGatewayEndpoint": "Dedicated gatewayEndpoint",
|
|
||||||
"NoValue": "",
|
|
||||||
"SKUDetails": "SKU Details: ",
|
|
||||||
"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",
|
|
||||||
"CosmosD32Details": "General Purpose Cosmos Compute with 32 vCPUs, 128 GB Memory",
|
|
||||||
"Cost": "Cost",
|
|
||||||
"CostText": "Hourly cost of the dedicated gateway resource depends on the SKU selection, number of instances per region, and number of regions.",
|
|
||||||
"ConnectionString": "Connection String",
|
|
||||||
"ConnectionStringText": "To use the dedicated gateway, use the connection string shown in ",
|
|
||||||
"KeysBlade": "the keys blade",
|
|
||||||
"WarningBannerOnUpdate": "Adding or modifying dedicated gateway instances may affect your bill.",
|
|
||||||
"WarningBannerOnDelete": "After deprovisioning the dedicated gateway, you must update any applications using the old dedicated gateway connection string."
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
45
src/Main.tsx
45
src/Main.tsx
@@ -37,7 +37,6 @@ import "../less/TableStyles/EntityEditor.less";
|
|||||||
import "../less/TableStyles/fulldatatables.less";
|
import "../less/TableStyles/fulldatatables.less";
|
||||||
import "../less/TableStyles/queryBuilder.less";
|
import "../less/TableStyles/queryBuilder.less";
|
||||||
import "../less/tree.less";
|
import "../less/tree.less";
|
||||||
import { AuthType } from "./AuthType";
|
|
||||||
import "./Explorer/Controls/Accordion/AccordionComponent.less";
|
import "./Explorer/Controls/Accordion/AccordionComponent.less";
|
||||||
import "./Explorer/Controls/CollapsiblePanel/CollapsiblePanelComponent.less";
|
import "./Explorer/Controls/CollapsiblePanel/CollapsiblePanelComponent.less";
|
||||||
import { Dialog, DialogProps } from "./Explorer/Controls/Dialog";
|
import { Dialog, DialogProps } from "./Explorer/Controls/Dialog";
|
||||||
@@ -45,9 +44,8 @@ import "./Explorer/Controls/DynamicList/DynamicListComponent.less";
|
|||||||
import "./Explorer/Controls/ErrorDisplayComponent/ErrorDisplayComponent.less";
|
import "./Explorer/Controls/ErrorDisplayComponent/ErrorDisplayComponent.less";
|
||||||
import "./Explorer/Controls/JsonEditor/JsonEditorComponent.less";
|
import "./Explorer/Controls/JsonEditor/JsonEditorComponent.less";
|
||||||
import "./Explorer/Controls/Notebook/NotebookTerminalComponent.less";
|
import "./Explorer/Controls/Notebook/NotebookTerminalComponent.less";
|
||||||
import "./Explorer/Controls/ThroughputInput/ThroughputInput.less";
|
|
||||||
import "./Explorer/Controls/TreeComponent/treeComponent.less";
|
import "./Explorer/Controls/TreeComponent/treeComponent.less";
|
||||||
import { ExplorerParams } from "./Explorer/Explorer";
|
import Explorer, { ExplorerParams } from "./Explorer/Explorer";
|
||||||
import "./Explorer/Graph/GraphExplorerComponent/graphExplorer.less";
|
import "./Explorer/Graph/GraphExplorerComponent/graphExplorer.less";
|
||||||
import "./Explorer/Graph/NewVertexComponent/newVertexComponent.less";
|
import "./Explorer/Graph/NewVertexComponent/newVertexComponent.less";
|
||||||
import "./Explorer/Menus/CommandBar/CommandBarComponent.less";
|
import "./Explorer/Menus/CommandBar/CommandBarComponent.less";
|
||||||
@@ -62,12 +60,12 @@ import "./Explorer/SplashScreen/SplashScreen.less";
|
|||||||
import "./Explorer/Tabs/QueryTab.less";
|
import "./Explorer/Tabs/QueryTab.less";
|
||||||
import { useConfig } from "./hooks/useConfig";
|
import { useConfig } from "./hooks/useConfig";
|
||||||
import { useKnockoutExplorer } from "./hooks/useKnockoutExplorer";
|
import { useKnockoutExplorer } from "./hooks/useKnockoutExplorer";
|
||||||
|
import { useNotebooks } from "./hooks/useNotebooks";
|
||||||
import { useSidePanel } from "./hooks/useSidePanel";
|
import { useSidePanel } from "./hooks/useSidePanel";
|
||||||
import { KOCommentEnd, KOCommentIfStart } from "./koComment";
|
import { KOCommentEnd, KOCommentIfStart } from "./koComment";
|
||||||
import "./Libs/is-integer-polyfill";
|
import "./Libs/is-integer-polyfill";
|
||||||
import "./Libs/jquery";
|
import "./Libs/jquery";
|
||||||
import "./Shared/appInsights";
|
import "./Shared/appInsights";
|
||||||
import { userContext } from "./UserContext";
|
|
||||||
|
|
||||||
initializeIcons();
|
initializeIcons();
|
||||||
|
|
||||||
@@ -90,6 +88,18 @@ const App: React.FunctionComponent = () => {
|
|||||||
|
|
||||||
const { isPanelOpen, panelContent, headerText, openSidePanel, closeSidePanel } = useSidePanel();
|
const { isPanelOpen, panelContent, headerText, openSidePanel, closeSidePanel } = useSidePanel();
|
||||||
|
|
||||||
|
// TODO Figure out a better pattern: this is because we don't have container, yet
|
||||||
|
const context: { container: Explorer } = { container: undefined };
|
||||||
|
const {
|
||||||
|
lastRefreshTime,
|
||||||
|
galleryContentRoot,
|
||||||
|
myNotebooksContentRoot,
|
||||||
|
gitHubNotebooksContentRoot,
|
||||||
|
refreshList,
|
||||||
|
initializeGitHubRepos,
|
||||||
|
getMyNotebooksContentRoot,
|
||||||
|
} = useNotebooks(context);
|
||||||
|
|
||||||
const explorerParams: ExplorerParams = {
|
const explorerParams: ExplorerParams = {
|
||||||
setIsNotificationConsoleExpanded,
|
setIsNotificationConsoleExpanded,
|
||||||
setNotificationConsoleData,
|
setNotificationConsoleData,
|
||||||
@@ -98,10 +108,14 @@ const App: React.FunctionComponent = () => {
|
|||||||
closeSidePanel,
|
closeSidePanel,
|
||||||
openDialog,
|
openDialog,
|
||||||
closeDialog,
|
closeDialog,
|
||||||
|
onRefreshNotebookList: refreshList,
|
||||||
|
initializeGitHubRepos,
|
||||||
|
getMyNotebooksContentRoot,
|
||||||
};
|
};
|
||||||
const config = useConfig();
|
const config = useConfig();
|
||||||
const explorer = useKnockoutExplorer(config?.platform, explorerParams);
|
const explorer = useKnockoutExplorer(config?.platform, explorerParams);
|
||||||
|
|
||||||
|
context.container = explorer;
|
||||||
if (!explorer) {
|
if (!explorer) {
|
||||||
return <LoadingExplorer />;
|
return <LoadingExplorer />;
|
||||||
}
|
}
|
||||||
@@ -157,11 +171,19 @@ const App: React.FunctionComponent = () => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{userContext.authType === AuthType.ResourceToken ? (
|
<div
|
||||||
<div style={{ overflowY: "auto" }} data-bind="react:resourceTreeForResourceToken" />
|
style={{ overflowY: "auto" }}
|
||||||
) : (
|
data-bind="if: isAuthWithResourceToken(), react:resourceTreeForResourceToken"
|
||||||
<div style={{ overflowY: "auto" }} data-bind="react:resourceTree" />
|
/>
|
||||||
)}
|
<div style={{ overflowY: "auto" }} data-bind="if: !isAuthWithResourceToken()">
|
||||||
|
<ResourceTree
|
||||||
|
explorer={explorer}
|
||||||
|
lastRefreshedTime={lastRefreshTime}
|
||||||
|
galleryContentRoot={galleryContentRoot}
|
||||||
|
myNotebooksContentRoot={myNotebooksContentRoot}
|
||||||
|
gitHubNotebooksContentRoot={gitHubNotebooksContentRoot}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{/* Collections Window - End */}
|
{/* Collections Window - End */}
|
||||||
</div>
|
</div>
|
||||||
@@ -211,7 +233,10 @@ const App: React.FunctionComponent = () => {
|
|||||||
{/* Splitter - End */}
|
{/* Splitter - End */}
|
||||||
</div>
|
</div>
|
||||||
{/* Collections Tree - End */}
|
{/* Collections Tree - End */}
|
||||||
<div className="connectExplorerContainer" data-bind="visible: tabsManager.openedTabs().length === 0">
|
<div
|
||||||
|
className="connectExplorerContainer"
|
||||||
|
data-bind="visible: !isRefreshingExplorer() && tabsManager.openedTabs().length === 0"
|
||||||
|
>
|
||||||
<form className="connectExplorerFormContainer">
|
<form className="connectExplorerFormContainer">
|
||||||
<SplashScreen explorer={explorer} />
|
<SplashScreen explorer={explorer} />
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { HttpStatusCodes } from "../Common/Constants";
|
|||||||
import { IResourceProviderClient, IResourceProviderRequestOptions } from "./IResourceProviderClient";
|
import { IResourceProviderClient, IResourceProviderRequestOptions } from "./IResourceProviderClient";
|
||||||
import { OperationStatus } from "../Contracts/DataModels";
|
import { OperationStatus } from "../Contracts/DataModels";
|
||||||
import { TokenProviderFactory } from "../TokenProviders/TokenProviderFactory";
|
import { TokenProviderFactory } from "../TokenProviders/TokenProviderFactory";
|
||||||
import * as UrlUtility from "../Common/UrlUtility";
|
import UrlUtility from "../Common/UrlUtility";
|
||||||
|
|
||||||
export class ResourceProviderClient<T> implements IResourceProviderClient<T> {
|
export class ResourceProviderClient<T> implements IResourceProviderClient<T> {
|
||||||
private httpClient: HttpClient;
|
private httpClient: HttpClient;
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
import crossroads from "crossroads";
|
|
||||||
import hasher from "hasher";
|
|
||||||
import * as _ from "underscore";
|
import * as _ from "underscore";
|
||||||
import * as Constants from "../Common/Constants";
|
import * as Constants from "../Common/Constants";
|
||||||
import * as ViewModels from "../Contracts/ViewModels";
|
import * as ViewModels from "../Contracts/ViewModels";
|
||||||
|
|
||||||
|
import crossroads from "crossroads";
|
||||||
|
import hasher from "hasher";
|
||||||
import ScriptTabBase from "../Explorer/Tabs/ScriptTabBase";
|
import ScriptTabBase from "../Explorer/Tabs/ScriptTabBase";
|
||||||
import TabsBase from "../Explorer/Tabs/TabsBase";
|
import TabsBase from "../Explorer/Tabs/TabsBase";
|
||||||
|
|
||||||
@@ -397,7 +398,14 @@ export class TabRouteHandler {
|
|||||||
|
|
||||||
private _executeActionHelper(action: () => void): void {
|
private _executeActionHelper(action: () => void): void {
|
||||||
const explorer = window.dataExplorer;
|
const explorer = window.dataExplorer;
|
||||||
if (explorer && explorer.isAccountReady()) {
|
if (!!explorer && (explorer.isRefreshingExplorer() || !explorer.isAccountReady())) {
|
||||||
|
const refreshSubscription = explorer.isRefreshingExplorer.subscribe((isRefreshing: boolean) => {
|
||||||
|
if (!isRefreshing) {
|
||||||
|
action();
|
||||||
|
refreshSubscription.dispose();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
action();
|
action();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { IsDisplayable, OnChange, PropertyInfo, RefreshOptions, Values } from "../Decorators";
|
import { PropertyInfo, OnChange, Values, IsDisplayable, RefreshOptions } from "../Decorators";
|
||||||
import {
|
import {
|
||||||
ChoiceItem,
|
ChoiceItem,
|
||||||
Description,
|
Description,
|
||||||
@@ -12,14 +12,14 @@ import {
|
|||||||
SmartUiInput,
|
SmartUiInput,
|
||||||
} from "../SelfServeTypes";
|
} from "../SelfServeTypes";
|
||||||
import {
|
import {
|
||||||
getMaxCollectionThroughput,
|
|
||||||
getMaxDatabaseThroughput,
|
|
||||||
getMinCollectionThroughput,
|
|
||||||
getMinDatabaseThroughput,
|
|
||||||
initialize,
|
|
||||||
onRefreshSelfServeExample,
|
onRefreshSelfServeExample,
|
||||||
Regions,
|
Regions,
|
||||||
update,
|
update,
|
||||||
|
initialize,
|
||||||
|
getMinDatabaseThroughput,
|
||||||
|
getMaxDatabaseThroughput,
|
||||||
|
getMinCollectionThroughput,
|
||||||
|
getMaxCollectionThroughput,
|
||||||
} from "./SelfServeExample.rp";
|
} from "./SelfServeExample.rp";
|
||||||
|
|
||||||
const regionDropdownItems: ChoiceItem[] = [
|
const regionDropdownItems: ChoiceItem[] = [
|
||||||
@@ -203,7 +203,11 @@ export default class SelfServeExample extends SelfServeBaseClass {
|
|||||||
public initialize = async (): Promise<Map<string, SmartUiInput>> => {
|
public initialize = async (): Promise<Map<string, SmartUiInput>> => {
|
||||||
const initializeResponse = await initialize();
|
const initializeResponse = await initialize();
|
||||||
const defaults = new Map<string, SmartUiInput>();
|
const defaults = new Map<string, SmartUiInput>();
|
||||||
defaults.set("currentRegionText", undefined);
|
const currentRegionText = `current region selected is ${initializeResponse.regions}`;
|
||||||
|
defaults.set("currentRegionText", {
|
||||||
|
value: { textTKey: currentRegionText, type: DescriptionType.Text } as Description,
|
||||||
|
hidden: false,
|
||||||
|
});
|
||||||
defaults.set("regions", { value: initializeResponse.regions });
|
defaults.set("regions", { value: initializeResponse.regions });
|
||||||
defaults.set("enableLogging", { value: initializeResponse.enableLogging });
|
defaults.set("enableLogging", { value: initializeResponse.enableLogging });
|
||||||
const accountName = initializeResponse.accountName;
|
const accountName = initializeResponse.accountName;
|
||||||
|
|||||||
@@ -1,17 +1,17 @@
|
|||||||
import { Spinner, SpinnerSize } from "office-ui-fabric-react";
|
|
||||||
import { initializeIcons } from "office-ui-fabric-react/lib/Icons";
|
|
||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
import ReactDOM from "react-dom";
|
import ReactDOM from "react-dom";
|
||||||
import { normalizeArmEndpoint } from "../Common/EnvironmentUtility";
|
import { sendMessage } from "../Common/MessageHandler";
|
||||||
import { sendReadyMessage } from "../Common/MessageHandler";
|
|
||||||
import { configContext, updateConfigContext } from "../ConfigContext";
|
|
||||||
import { SelfServeFrameInputs } from "../Contracts/ViewModels";
|
|
||||||
import { updateUserContext } from "../UserContext";
|
|
||||||
import { isInvalidParentFrameOrigin } from "../Utils/MessageValidation";
|
import { isInvalidParentFrameOrigin } from "../Utils/MessageValidation";
|
||||||
import "./SelfServe.less";
|
|
||||||
import { SelfServeComponent } from "./SelfServeComponent";
|
import { SelfServeComponent } from "./SelfServeComponent";
|
||||||
import { SelfServeDescriptor } from "./SelfServeTypes";
|
import { SelfServeDescriptor } from "./SelfServeTypes";
|
||||||
import { SelfServeType } from "./SelfServeUtils";
|
import { SelfServeType } from "./SelfServeUtils";
|
||||||
|
import { SelfServeFrameInputs } from "../Contracts/ViewModels";
|
||||||
|
import { initializeIcons } from "office-ui-fabric-react/lib/Icons";
|
||||||
|
import { configContext, updateConfigContext } from "../ConfigContext";
|
||||||
|
import { normalizeArmEndpoint } from "../Common/EnvironmentUtility";
|
||||||
|
import { updateUserContext } from "../UserContext";
|
||||||
|
import "./SelfServe.less";
|
||||||
|
import { Spinner, SpinnerSize } from "office-ui-fabric-react";
|
||||||
initializeIcons();
|
initializeIcons();
|
||||||
|
|
||||||
const getDescriptor = async (selfServeType: SelfServeType): Promise<SelfServeDescriptor> => {
|
const getDescriptor = async (selfServeType: SelfServeType): Promise<SelfServeDescriptor> => {
|
||||||
@@ -89,4 +89,4 @@ const handleMessage = async (event: MessageEvent): Promise<void> => {
|
|||||||
|
|
||||||
ReactDOM.render(renderSpinner(), document.getElementById("selfServeContent"));
|
ReactDOM.render(renderSpinner(), document.getElementById("selfServeContent"));
|
||||||
window.addEventListener("message", handleMessage, false);
|
window.addEventListener("message", handleMessage, false);
|
||||||
sendReadyMessage();
|
sendMessage("ready");
|
||||||
|
|||||||
@@ -1,36 +1,34 @@
|
|||||||
import { TFunction } from "i18next";
|
import React from "react";
|
||||||
import {
|
import {
|
||||||
CommandBar,
|
CommandBar,
|
||||||
ICommandBarItemProps,
|
ICommandBarItemProps,
|
||||||
|
IStackTokens,
|
||||||
MessageBar,
|
MessageBar,
|
||||||
MessageBarType,
|
MessageBarType,
|
||||||
Separator,
|
|
||||||
Spinner,
|
Spinner,
|
||||||
SpinnerSize,
|
SpinnerSize,
|
||||||
Stack,
|
Stack,
|
||||||
} from "office-ui-fabric-react";
|
} from "office-ui-fabric-react";
|
||||||
import promiseRetry, { AbortError } from "p-retry";
|
|
||||||
import React from "react";
|
|
||||||
import { Translation } from "react-i18next";
|
|
||||||
import * as _ from "underscore";
|
|
||||||
import { sendMessage } from "../Common/MessageHandler";
|
|
||||||
import { SelfServeMessageTypes } from "../Contracts/SelfServeContracts";
|
|
||||||
import { SmartUiComponent, SmartUiDescriptor } from "../Explorer/Controls/SmartUi/SmartUiComponent";
|
|
||||||
import "../i18n";
|
|
||||||
import { commandBarItemStyles, commandBarStyles, containerStackTokens, separatorStyles } from "./SelfServeStyles";
|
|
||||||
import {
|
import {
|
||||||
AnyDisplay,
|
AnyDisplay,
|
||||||
BooleanInput,
|
|
||||||
ChoiceInput,
|
|
||||||
DescriptionDisplay,
|
|
||||||
InputType,
|
|
||||||
Node,
|
Node,
|
||||||
NumberInput,
|
InputType,
|
||||||
RefreshResult,
|
RefreshResult,
|
||||||
SelfServeDescriptor,
|
SelfServeDescriptor,
|
||||||
SmartUiInput,
|
SmartUiInput,
|
||||||
|
DescriptionDisplay,
|
||||||
StringInput,
|
StringInput,
|
||||||
|
NumberInput,
|
||||||
|
BooleanInput,
|
||||||
|
ChoiceInput,
|
||||||
} from "./SelfServeTypes";
|
} from "./SelfServeTypes";
|
||||||
|
import { SmartUiComponent, SmartUiDescriptor } from "../Explorer/Controls/SmartUi/SmartUiComponent";
|
||||||
|
import { Translation } from "react-i18next";
|
||||||
|
import { TFunction } from "i18next";
|
||||||
|
import "../i18n";
|
||||||
|
import { sendMessage } from "../Common/MessageHandler";
|
||||||
|
import { SelfServeMessageTypes } from "../Contracts/SelfServeContracts";
|
||||||
|
import promiseRetry, { AbortError } from "p-retry";
|
||||||
|
|
||||||
interface SelfServeNotification {
|
interface SelfServeNotification {
|
||||||
message: string;
|
message: string;
|
||||||
@@ -129,7 +127,7 @@ export class SelfServeComponent extends React.Component<SelfServeComponentProps,
|
|||||||
this.props.descriptor.inputNames.map((inputName) => {
|
this.props.descriptor.inputNames.map((inputName) => {
|
||||||
let initialValue = initialValues.get(inputName);
|
let initialValue = initialValues.get(inputName);
|
||||||
if (!initialValue) {
|
if (!initialValue) {
|
||||||
initialValue = { value: undefined, hidden: false, disabled: false };
|
initialValue = { value: undefined, hidden: false };
|
||||||
}
|
}
|
||||||
currentValues = currentValues.set(inputName, initialValue);
|
currentValues = currentValues.set(inputName, initialValue);
|
||||||
baselineValues = baselineValues.set(inputName, initialValue);
|
baselineValues = baselineValues.set(inputName, initialValue);
|
||||||
@@ -313,41 +311,34 @@ export class SelfServeComponent extends React.Component<SelfServeComponentProps,
|
|||||||
this.performSave();
|
this.performSave();
|
||||||
};
|
};
|
||||||
|
|
||||||
public isInputModified = (): boolean => {
|
public isDiscardButtonDisabled = (): boolean => {
|
||||||
|
if (this.state.isSaving) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
for (const key of this.state.currentValues.keys()) {
|
for (const key of this.state.currentValues.keys()) {
|
||||||
const currentValue = this.state.currentValues.get(key);
|
const currentValue = JSON.stringify(this.state.currentValues.get(key));
|
||||||
if (currentValue && currentValue.hidden === undefined) {
|
const baselineValue = JSON.stringify(this.state.baselineValues.get(key));
|
||||||
currentValue.hidden = false;
|
|
||||||
}
|
|
||||||
if (currentValue && currentValue.disabled === undefined) {
|
|
||||||
currentValue.disabled = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
const baselineValue = this.state.baselineValues.get(key);
|
if (currentValue !== baselineValue) {
|
||||||
if (baselineValue && baselineValue.hidden === undefined) {
|
return false;
|
||||||
baselineValue.hidden = false;
|
|
||||||
}
|
|
||||||
if (baselineValue && baselineValue.disabled === undefined) {
|
|
||||||
baselineValue.disabled = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!_.isEqual(currentValue, baselineValue)) {
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return true;
|
||||||
};
|
|
||||||
|
|
||||||
public isRefreshing = (): boolean => {
|
|
||||||
return this.state.isSaving || this.state.isInitializing || this.state.refreshResult?.isUpdateInProgress;
|
|
||||||
};
|
|
||||||
|
|
||||||
public isDiscardButtonDisabled = (): boolean => {
|
|
||||||
return this.isRefreshing() || !this.isInputModified();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
public isSaveButtonDisabled = (): boolean => {
|
public isSaveButtonDisabled = (): boolean => {
|
||||||
return this.state.hasErrors || this.isRefreshing() || !this.isInputModified();
|
if (this.state.hasErrors || this.state.isSaving) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
for (const key of this.state.currentValues.keys()) {
|
||||||
|
const currentValue = JSON.stringify(this.state.currentValues.get(key));
|
||||||
|
const baselineValue = JSON.stringify(this.state.baselineValues.get(key));
|
||||||
|
|
||||||
|
if (currentValue !== baselineValue) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
private performRefresh = async (): Promise<void> => {
|
private performRefresh = async (): Promise<void> => {
|
||||||
@@ -406,6 +397,7 @@ export class SelfServeComponent extends React.Component<SelfServeComponentProps,
|
|||||||
key: "save",
|
key: "save",
|
||||||
text: this.getCommonTranslation("Save"),
|
text: this.getCommonTranslation("Save"),
|
||||||
iconProps: { iconName: "Save" },
|
iconProps: { iconName: "Save" },
|
||||||
|
split: true,
|
||||||
disabled: this.isSaveButtonDisabled(),
|
disabled: this.isSaveButtonDisabled(),
|
||||||
onClick: () => this.onSaveButtonClick(),
|
onClick: () => this.onSaveButtonClick(),
|
||||||
},
|
},
|
||||||
@@ -413,21 +405,21 @@ export class SelfServeComponent extends React.Component<SelfServeComponentProps,
|
|||||||
key: "discard",
|
key: "discard",
|
||||||
text: this.getCommonTranslation("Discard"),
|
text: this.getCommonTranslation("Discard"),
|
||||||
iconProps: { iconName: "Undo" },
|
iconProps: { iconName: "Undo" },
|
||||||
|
split: true,
|
||||||
disabled: this.isDiscardButtonDisabled(),
|
disabled: this.isDiscardButtonDisabled(),
|
||||||
onClick: () => {
|
onClick: () => {
|
||||||
this.discard();
|
this.discard();
|
||||||
},
|
},
|
||||||
buttonStyles: commandBarItemStyles,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: "refresh",
|
key: "refresh",
|
||||||
text: this.getCommonTranslation("Refresh"),
|
text: this.getCommonTranslation("Refresh"),
|
||||||
disabled: this.state.isInitializing,
|
disabled: this.state.isInitializing,
|
||||||
iconProps: { iconName: "Refresh" },
|
iconProps: { iconName: "Refresh" },
|
||||||
|
split: true,
|
||||||
onClick: () => {
|
onClick: () => {
|
||||||
this.onRefreshClicked();
|
this.onRefreshClicked();
|
||||||
},
|
},
|
||||||
buttonStyles: commandBarItemStyles,
|
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
@@ -440,6 +432,7 @@ export class SelfServeComponent extends React.Component<SelfServeComponentProps,
|
|||||||
};
|
};
|
||||||
|
|
||||||
public render(): JSX.Element {
|
public render(): JSX.Element {
|
||||||
|
const containerStackTokens: IStackTokens = { childrenGap: 5 };
|
||||||
if (this.state.compileErrorMessage) {
|
if (this.state.compileErrorMessage) {
|
||||||
return <MessageBar messageBarType={MessageBarType.error}>{this.state.compileErrorMessage}</MessageBar>;
|
return <MessageBar messageBarType={MessageBarType.error}>{this.state.compileErrorMessage}</MessageBar>;
|
||||||
}
|
}
|
||||||
@@ -452,13 +445,13 @@ export class SelfServeComponent extends React.Component<SelfServeComponentProps,
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div style={{ overflowX: "auto" }}>
|
<div style={{ overflowX: "auto" }}>
|
||||||
<Stack tokens={containerStackTokens}>
|
<Stack tokens={containerStackTokens} styles={{ root: { padding: 10 } }}>
|
||||||
<Stack.Item>
|
<CommandBar styles={{ root: { paddingLeft: 0 } }} items={this.getCommandBarItems()} />
|
||||||
<CommandBar styles={commandBarStyles} items={this.getCommandBarItems()} />
|
|
||||||
<Separator styles={separatorStyles} />
|
|
||||||
</Stack.Item>
|
|
||||||
{this.state.isInitializing ? (
|
{this.state.isInitializing ? (
|
||||||
<Spinner size={SpinnerSize.large} />
|
<Spinner
|
||||||
|
size={SpinnerSize.large}
|
||||||
|
styles={{ root: { textAlign: "center", justifyContent: "center", width: "100%", height: "100%" } }}
|
||||||
|
/>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
{this.state.notification && (
|
{this.state.notification && (
|
||||||
|
|||||||
@@ -1,20 +0,0 @@
|
|||||||
import { IButtonStyles, ICommandBarStyles, ISeparatorStyles, IStackTokens } from "office-ui-fabric-react";
|
|
||||||
import { StyleConstants } from "../Common/Constants";
|
|
||||||
|
|
||||||
export const commandBarItemStyles: IButtonStyles = { root: { paddingLeft: 20 } };
|
|
||||||
|
|
||||||
export const commandBarStyles: ICommandBarStyles = { root: { paddingLeft: 0 } };
|
|
||||||
|
|
||||||
export const containerStackTokens: IStackTokens = { childrenGap: 5, padding: 10 };
|
|
||||||
|
|
||||||
export const separatorStyles: Partial<ISeparatorStyles> = {
|
|
||||||
root: {
|
|
||||||
selectors: {
|
|
||||||
"::before": {
|
|
||||||
background: StyleConstants.BaseMedium,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
padding: 0,
|
|
||||||
height: 1,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import "reflect-metadata";
|
import "reflect-metadata";
|
||||||
import { userContext } from "../UserContext";
|
|
||||||
import {
|
import {
|
||||||
|
Node,
|
||||||
AnyDisplay,
|
AnyDisplay,
|
||||||
BooleanInput,
|
BooleanInput,
|
||||||
ChoiceInput,
|
ChoiceInput,
|
||||||
@@ -10,13 +10,13 @@ import {
|
|||||||
Info,
|
Info,
|
||||||
InputType,
|
InputType,
|
||||||
InputTypeValue,
|
InputTypeValue,
|
||||||
Node,
|
|
||||||
NumberInput,
|
NumberInput,
|
||||||
RefreshParams,
|
|
||||||
SelfServeDescriptor,
|
SelfServeDescriptor,
|
||||||
SmartUiInput,
|
SmartUiInput,
|
||||||
StringInput,
|
StringInput,
|
||||||
|
RefreshParams,
|
||||||
} from "./SelfServeTypes";
|
} from "./SelfServeTypes";
|
||||||
|
import { userContext } from "../UserContext";
|
||||||
|
|
||||||
export enum SelfServeType {
|
export enum SelfServeType {
|
||||||
// No self serve type passed, launch explorer
|
// No self serve type passed, launch explorer
|
||||||
@@ -195,5 +195,5 @@ export const generateBladeLink = (blade: BladeType): string => {
|
|||||||
const subscriptionId = userContext.subscriptionId;
|
const subscriptionId = userContext.subscriptionId;
|
||||||
const resourceGroupName = userContext.resourceGroup;
|
const resourceGroupName = userContext.resourceGroup;
|
||||||
const databaseAccountName = userContext.databaseAccount.name;
|
const databaseAccountName = userContext.databaseAccount.name;
|
||||||
return `https://portal.azure.com/#@microsoft.onmicrosoft.com/resource/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDb/databaseAccounts/${databaseAccountName}/${blade}`;
|
return `www.portal.azure.com/#@microsoft.onmicrosoft.com/resource/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDb/databaseAccounts/${databaseAccountName}/${blade}`;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,98 +1,33 @@
|
|||||||
import { RefreshResult } from "../SelfServeTypes";
|
import { RefreshResult } from "../SelfServeTypes";
|
||||||
import { userContext } from "../../UserContext";
|
|
||||||
import { armRequestWithoutPolling } from "../../Utils/arm/request";
|
|
||||||
import { configContext } from "../../ConfigContext";
|
|
||||||
import { SqlxServiceResource, UpdateDedicatedGatewayRequestParameters } from "./SqlxTypes";
|
|
||||||
|
|
||||||
const apiVersion = "2020-06-01-preview";
|
|
||||||
|
|
||||||
export enum ResourceStatus {
|
|
||||||
Running = "Running",
|
|
||||||
Creating = "Creating",
|
|
||||||
Updating = "Updating",
|
|
||||||
Deleting = "Deleting",
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface DedicatedGatewayResponse {
|
export interface DedicatedGatewayResponse {
|
||||||
sku: string;
|
sku: string;
|
||||||
instances: number;
|
instances: number;
|
||||||
status: string;
|
|
||||||
endpoint: string;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getPath = (subscriptionId: string, resourceGroup: string, name: string): string => {
|
export const getRegionSpecificMinInstances = async (): Promise<number> => {
|
||||||
return `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroup}/providers/Microsoft.DocumentDB/databaseAccounts/${name}/services/sqlx`;
|
// TODO: write RP call to get min number of instances needed for this region
|
||||||
|
throw new Error("getRegionSpecificMinInstances not implemented");
|
||||||
};
|
};
|
||||||
|
|
||||||
export const updateDedicatedGatewayResource = async (sku: string, instances: number): Promise<string> => {
|
export const getRegionSpecificMaxInstances = async (): Promise<number> => {
|
||||||
const path = getPath(userContext.subscriptionId, userContext.resourceGroup, userContext.databaseAccount.name);
|
// TODO: write RP call to get max number of instances needed for this region
|
||||||
const body: UpdateDedicatedGatewayRequestParameters = {
|
throw new Error("getRegionSpecificMaxInstances not implemented");
|
||||||
properties: {
|
|
||||||
instanceSize: sku,
|
|
||||||
instanceCount: instances,
|
|
||||||
serviceType: "Sqlx",
|
|
||||||
},
|
|
||||||
};
|
|
||||||
const armRequestResult = await armRequestWithoutPolling({
|
|
||||||
host: configContext.ARM_ENDPOINT,
|
|
||||||
path,
|
|
||||||
method: "PUT",
|
|
||||||
apiVersion,
|
|
||||||
body,
|
|
||||||
});
|
|
||||||
return armRequestResult.operationStatusUrl;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const deleteDedicatedGatewayResource = async (): Promise<string> => {
|
export const updateDedicatedGatewayProvisioning = async (sku: string, instances: number): Promise<void> => {
|
||||||
const path = getPath(userContext.subscriptionId, userContext.resourceGroup, userContext.databaseAccount.name);
|
// TODO: write RP call to update dedicated gateway provisioning
|
||||||
const armRequestResult = await armRequestWithoutPolling({
|
throw new Error(
|
||||||
host: configContext.ARM_ENDPOINT,
|
`updateDedicatedGatewayProvisioning not implemented. Parameters- sku: ${sku}, instances:${instances}`
|
||||||
path,
|
);
|
||||||
method: "DELETE",
|
|
||||||
apiVersion,
|
|
||||||
});
|
|
||||||
return armRequestResult.operationStatusUrl;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getDedicatedGatewayResource = async (): Promise<SqlxServiceResource> => {
|
export const initializeDedicatedGatewayProvisioning = async (): Promise<DedicatedGatewayResponse> => {
|
||||||
const path = getPath(userContext.subscriptionId, userContext.resourceGroup, userContext.databaseAccount.name);
|
// TODO: write RP call to initialize UI for dedicated gateway provisioning
|
||||||
const armRequestResult = await armRequestWithoutPolling<SqlxServiceResource>({
|
throw new Error("initializeDedicatedGatewayProvisioning not implemented");
|
||||||
host: configContext.ARM_ENDPOINT,
|
|
||||||
path,
|
|
||||||
method: "GET",
|
|
||||||
apiVersion,
|
|
||||||
});
|
|
||||||
return armRequestResult.result;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getCurrentProvisioningState = async (): Promise<DedicatedGatewayResponse> => {
|
|
||||||
try {
|
|
||||||
const response = await getDedicatedGatewayResource();
|
|
||||||
return {
|
|
||||||
sku: response.properties.instanceSize,
|
|
||||||
instances: response.properties.instanceCount,
|
|
||||||
status: response.properties.status,
|
|
||||||
endpoint: response.properties.sqlxEndPoint,
|
|
||||||
};
|
|
||||||
} catch (e) {
|
|
||||||
return { sku: undefined, instances: undefined, status: undefined, endpoint: undefined };
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const refreshDedicatedGatewayProvisioning = async (): Promise<RefreshResult> => {
|
export const refreshDedicatedGatewayProvisioning = async (): Promise<RefreshResult> => {
|
||||||
try {
|
// TODO: write RP call to check if dedicated gateway update has gone through
|
||||||
const response = await getDedicatedGatewayResource();
|
throw new Error("refreshDedicatedGatewayProvisioning not implemented");
|
||||||
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 };
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { IsDisplayable, OnChange, RefreshOptions, Values } from "../Decorators";
|
import { IsDisplayable, OnChange, Values } from "../Decorators";
|
||||||
import {
|
import {
|
||||||
ChoiceItem,
|
ChoiceItem,
|
||||||
Description,
|
|
||||||
DescriptionType,
|
DescriptionType,
|
||||||
InputType,
|
InputType,
|
||||||
NumberUiType,
|
NumberUiType,
|
||||||
@@ -10,284 +9,65 @@ import {
|
|||||||
SelfServeBaseClass,
|
SelfServeBaseClass,
|
||||||
SmartUiInput,
|
SmartUiInput,
|
||||||
} from "../SelfServeTypes";
|
} from "../SelfServeTypes";
|
||||||
import { BladeType, generateBladeLink } from "../SelfServeUtils";
|
import { refreshDedicatedGatewayProvisioning } from "./SqlX.rp";
|
||||||
import {
|
|
||||||
deleteDedicatedGatewayResource,
|
|
||||||
getCurrentProvisioningState,
|
|
||||||
refreshDedicatedGatewayProvisioning,
|
|
||||||
updateDedicatedGatewayResource,
|
|
||||||
} from "./SqlX.rp";
|
|
||||||
|
|
||||||
const costPerHourValue: Description = {
|
|
||||||
textTKey: "CostText",
|
|
||||||
type: DescriptionType.Text,
|
|
||||||
link: {
|
|
||||||
href: "https://azure.microsoft.com/en-us/pricing/details/cosmos-db/",
|
|
||||||
textTKey: "DedicatedGatewayPricing",
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const connectionStringValue: Description = {
|
|
||||||
textTKey: "ConnectionStringText",
|
|
||||||
type: DescriptionType.Text,
|
|
||||||
link: {
|
|
||||||
href: generateBladeLink(BladeType.SqlKeys),
|
|
||||||
textTKey: "KeysBlade",
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const CosmosD4s = "Cosmos.D4s";
|
|
||||||
const CosmosD8s = "Cosmos.D8s";
|
|
||||||
const CosmosD16s = "Cosmos.D16s";
|
|
||||||
const CosmosD32s = "Cosmos.D32s";
|
|
||||||
|
|
||||||
const getSKUDetails = (sku: string): string => {
|
|
||||||
if (sku === CosmosD4s) {
|
|
||||||
return "CosmosD4Details";
|
|
||||||
} else if (sku === CosmosD8s) {
|
|
||||||
return "CosmosD8Details";
|
|
||||||
} else if (sku === CosmosD16s) {
|
|
||||||
return "CosmosD16Details";
|
|
||||||
} else if (sku === CosmosD32s) {
|
|
||||||
return "CosmosD32Details";
|
|
||||||
}
|
|
||||||
return "Not Supported Yet";
|
|
||||||
};
|
|
||||||
|
|
||||||
const onSKUChange = (newValue: InputType, currentValues: Map<string, SmartUiInput>): Map<string, SmartUiInput> => {
|
|
||||||
currentValues.set("sku", { value: newValue });
|
|
||||||
currentValues.set("skuDetails", {
|
|
||||||
value: { textTKey: getSKUDetails(`${newValue.toString()}`), type: DescriptionType.Text } as Description,
|
|
||||||
});
|
|
||||||
currentValues.set("costPerHour", { value: costPerHourValue });
|
|
||||||
return currentValues;
|
|
||||||
};
|
|
||||||
|
|
||||||
const onNumberOfInstancesChange = (
|
|
||||||
newValue: InputType,
|
|
||||||
currentValues: Map<string, SmartUiInput>
|
|
||||||
): Map<string, SmartUiInput> => {
|
|
||||||
currentValues.set("instances", { value: newValue });
|
|
||||||
currentValues.set("warningBanner", {
|
|
||||||
value: { textTKey: "WarningBannerOnUpdate" } as Description,
|
|
||||||
hidden: false,
|
|
||||||
});
|
|
||||||
|
|
||||||
return currentValues;
|
|
||||||
};
|
|
||||||
|
|
||||||
const onEnableDedicatedGatewayChange = (
|
const onEnableDedicatedGatewayChange = (
|
||||||
newValue: InputType,
|
newValue: InputType,
|
||||||
currentValues: Map<string, SmartUiInput>,
|
currentState: Map<string, SmartUiInput>
|
||||||
baselineValues: ReadonlyMap<string, SmartUiInput>
|
|
||||||
): Map<string, SmartUiInput> => {
|
): Map<string, SmartUiInput> => {
|
||||||
currentValues.set("enableDedicatedGateway", { value: newValue });
|
const sku = currentState.get("sku");
|
||||||
const dedicatedGatewayOriginallyEnabled = baselineValues.get("enableDedicatedGateway")?.value as boolean;
|
const instances = currentState.get("instances");
|
||||||
if (dedicatedGatewayOriginallyEnabled === newValue) {
|
const isSkuHidden = newValue === undefined || !(newValue as boolean);
|
||||||
currentValues.set("sku", baselineValues.get("sku"));
|
currentState.set("enableDedicatedGateway", { value: newValue });
|
||||||
currentValues.set("instances", baselineValues.get("instances"));
|
currentState.set("sku", { value: sku.value, hidden: isSkuHidden });
|
||||||
currentValues.set("skuDetails", baselineValues.get("skuDetails"));
|
currentState.set("instances", { value: instances.value, hidden: isSkuHidden });
|
||||||
currentValues.set("costPerHour", baselineValues.get("costPerHour"));
|
return currentState;
|
||||||
currentValues.set("warningBanner", baselineValues.get("warningBanner"));
|
|
||||||
currentValues.set("connectionString", baselineValues.get("connectionString"));
|
|
||||||
return currentValues;
|
|
||||||
}
|
|
||||||
|
|
||||||
currentValues.set("warningBanner", undefined);
|
|
||||||
if (newValue === true) {
|
|
||||||
currentValues.set("warningBanner", {
|
|
||||||
value: {
|
|
||||||
textTKey: "WarningBannerOnUpdate",
|
|
||||||
link: {
|
|
||||||
href: "https://docs.microsoft.com/en-us/azure/cosmos-db/introduction",
|
|
||||||
textTKey: "DedicatedGatewayPricing",
|
|
||||||
},
|
|
||||||
} as Description,
|
|
||||||
hidden: false,
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
currentValues.set("warningBanner", {
|
|
||||||
value: {
|
|
||||||
textTKey: "WarningBannerOnDelete",
|
|
||||||
link: {
|
|
||||||
href: "https://docs.microsoft.com/en-us/azure/cosmos-db/introduction",
|
|
||||||
textTKey: "DeprovisioningDetailsText",
|
|
||||||
},
|
|
||||||
} as Description,
|
|
||||||
hidden: false,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
const sku = currentValues.get("sku");
|
|
||||||
const instances = currentValues.get("instances");
|
|
||||||
const hideAttributes = newValue === undefined || !(newValue as boolean);
|
|
||||||
currentValues.set("sku", {
|
|
||||||
value: sku.value,
|
|
||||||
hidden: hideAttributes,
|
|
||||||
disabled: dedicatedGatewayOriginallyEnabled,
|
|
||||||
});
|
|
||||||
currentValues.set("instances", {
|
|
||||||
value: instances.value,
|
|
||||||
hidden: hideAttributes,
|
|
||||||
disabled: dedicatedGatewayOriginallyEnabled,
|
|
||||||
});
|
|
||||||
|
|
||||||
currentValues.set("skuDetails", {
|
|
||||||
value: { textTKey: getSKUDetails(`${currentValues.get("sku").value}`), type: DescriptionType.Text } as Description,
|
|
||||||
hidden: hideAttributes,
|
|
||||||
disabled: dedicatedGatewayOriginallyEnabled,
|
|
||||||
});
|
|
||||||
|
|
||||||
currentValues.set("costPerHour", { value: costPerHourValue, hidden: hideAttributes });
|
|
||||||
currentValues.set("connectionString", {
|
|
||||||
value: connectionStringValue,
|
|
||||||
hidden: !newValue || !dedicatedGatewayOriginallyEnabled,
|
|
||||||
});
|
|
||||||
|
|
||||||
return currentValues;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const skuDropDownItems: ChoiceItem[] = [
|
|
||||||
{ label: "CosmosD4s", key: CosmosD4s },
|
|
||||||
{ label: "CosmosD8s", key: CosmosD8s },
|
|
||||||
{ label: "CosmosD16s", key: CosmosD16s },
|
|
||||||
{ label: "CosmosD32s", key: CosmosD32s },
|
|
||||||
];
|
|
||||||
|
|
||||||
const getSkus = async (): Promise<ChoiceItem[]> => {
|
const getSkus = async (): Promise<ChoiceItem[]> => {
|
||||||
return skuDropDownItems;
|
// TODO: get SKUs from getRegionSpecificSkus() RP call and return array of {label:..., key:...}.
|
||||||
|
throw new Error("getSkus not implemented.");
|
||||||
};
|
};
|
||||||
|
|
||||||
const getInstancesMin = async (): Promise<number> => {
|
const getInstancesMin = async (): Promise<number> => {
|
||||||
return 1;
|
// TODO: get SKUs from getRegionSpecificSkus() RP call and return array of {label:..., key:...}.
|
||||||
|
throw new Error("getInstancesMin not implemented.");
|
||||||
};
|
};
|
||||||
|
|
||||||
const getInstancesMax = async (): Promise<number> => {
|
const getInstancesMax = async (): Promise<number> => {
|
||||||
return 5;
|
// TODO: get SKUs from getRegionSpecificSkus() RP call and return array of {label:..., key:...}.
|
||||||
|
throw new Error("getInstancesMax not implemented.");
|
||||||
|
};
|
||||||
|
|
||||||
|
const validate = (currentValues: Map<string, SmartUiInput>): void => {
|
||||||
|
// TODO: add cusom validation logic to be called before Saving the data.
|
||||||
|
throw new Error(`validate not implemented. No. of properties to validate: ${currentValues.size}`);
|
||||||
};
|
};
|
||||||
|
|
||||||
@IsDisplayable()
|
@IsDisplayable()
|
||||||
@RefreshOptions({ retryIntervalInMs: 20000 })
|
|
||||||
export default class SqlX extends SelfServeBaseClass {
|
export default class SqlX extends SelfServeBaseClass {
|
||||||
public onRefresh = async (): Promise<RefreshResult> => {
|
public onRefresh = async (): Promise<RefreshResult> => {
|
||||||
return await refreshDedicatedGatewayProvisioning();
|
return refreshDedicatedGatewayProvisioning();
|
||||||
};
|
};
|
||||||
|
|
||||||
public onSave = async (
|
public onSave = async (currentValues: Map<string, SmartUiInput>): Promise<OnSaveResult> => {
|
||||||
currentValues: Map<string, SmartUiInput>,
|
validate(currentValues);
|
||||||
baselineValues: Map<string, SmartUiInput>
|
// TODO: add pre processing logic before calling the updateDedicatedGatewayProvisioning() RP call.
|
||||||
): Promise<OnSaveResult> => {
|
throw new Error(`onSave not implemented. No. of properties to save: ${currentValues.size}`);
|
||||||
const dedicatedGatewayCurrentlyEnabled = currentValues.get("enableDedicatedGateway")?.value as boolean;
|
|
||||||
const dedicatedGatewayOriginallyEnabled = baselineValues.get("enableDedicatedGateway")?.value as boolean;
|
|
||||||
|
|
||||||
currentValues.set("warningBanner", undefined);
|
|
||||||
|
|
||||||
//TODO : Add try catch for each RP call and return relevant notifications
|
|
||||||
if (dedicatedGatewayOriginallyEnabled) {
|
|
||||||
if (!dedicatedGatewayCurrentlyEnabled) {
|
|
||||||
const operationStatusUrl = await deleteDedicatedGatewayResource();
|
|
||||||
return {
|
|
||||||
operationStatusUrl: operationStatusUrl,
|
|
||||||
portalNotification: {
|
|
||||||
initialize: {
|
|
||||||
titleTKey: "DeleteInitializeTitle",
|
|
||||||
messageTKey: "DeleteInitializeMessage",
|
|
||||||
},
|
|
||||||
success: {
|
|
||||||
titleTKey: "DeleteSuccessTitle",
|
|
||||||
messageTKey: "DeleteSuccesseMessage",
|
|
||||||
},
|
|
||||||
failure: {
|
|
||||||
titleTKey: "DeleteFailureTitle",
|
|
||||||
messageTKey: "DeleteFailureMessage",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
// Check for scaling up/down/in/out
|
|
||||||
return {
|
|
||||||
operationStatusUrl: undefined,
|
|
||||||
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 updateDedicatedGatewayResource(sku, instances);
|
|
||||||
return {
|
|
||||||
operationStatusUrl: operationStatusUrl,
|
|
||||||
portalNotification: {
|
|
||||||
initialize: {
|
|
||||||
titleTKey: "CreateInitializeTitle",
|
|
||||||
messageTKey: "CreateInitializeTitle",
|
|
||||||
},
|
|
||||||
success: {
|
|
||||||
titleTKey: "CreateSuccessTitle",
|
|
||||||
messageTKey: "CreateSuccesseMessage",
|
|
||||||
},
|
|
||||||
failure: {
|
|
||||||
titleTKey: "CreateFailureTitle",
|
|
||||||
messageTKey: "CreateFailureMessage",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
public initialize = async (): Promise<Map<string, SmartUiInput>> => {
|
public initialize = async (): Promise<Map<string, SmartUiInput>> => {
|
||||||
// Based on the RP call enableDedicatedGateway will be true if it has not yet been enabled and false if it has.
|
// TODO: get initialization data from initializeDedicatedGatewayProvisioning() RP call.
|
||||||
const defaults = new Map<string, SmartUiInput>();
|
throw new Error("onSave not implemented");
|
||||||
defaults.set("enableDedicatedGateway", { value: false });
|
|
||||||
defaults.set("sku", { value: CosmosD4s, hidden: true });
|
|
||||||
defaults.set("instances", { value: await getInstancesMin(), hidden: true });
|
|
||||||
defaults.set("skuDetails", undefined);
|
|
||||||
defaults.set("costPerHour", undefined);
|
|
||||||
defaults.set("connectionString", undefined);
|
|
||||||
|
|
||||||
const response = await getCurrentProvisioningState();
|
|
||||||
if (response.status && response.status !== "Deleting") {
|
|
||||||
defaults.set("enableDedicatedGateway", { value: true });
|
|
||||||
defaults.set("sku", { value: response.sku, disabled: true });
|
|
||||||
defaults.set("instances", { value: response.instances, disabled: true });
|
|
||||||
defaults.set("costPerHour", { value: costPerHourValue });
|
|
||||||
defaults.set("skuDetails", {
|
|
||||||
value: { textTKey: getSKUDetails(`${defaults.get("sku").value}`), type: DescriptionType.Text } as Description,
|
|
||||||
hidden: false,
|
|
||||||
});
|
|
||||||
defaults.set("connectionString", {
|
|
||||||
value: connectionStringValue,
|
|
||||||
hidden: false,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
defaults.set("warningBanner", undefined);
|
|
||||||
return defaults;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@Values({
|
|
||||||
isDynamicDescription: true,
|
|
||||||
})
|
|
||||||
warningBanner: string;
|
|
||||||
|
|
||||||
@Values({
|
@Values({
|
||||||
description: {
|
description: {
|
||||||
textTKey: "DedicatedGatewayDescription",
|
textTKey: "Provisioning dedicated gateways for SqlX accounts.",
|
||||||
type: DescriptionType.Text,
|
type: DescriptionType.Text,
|
||||||
link: {
|
link: {
|
||||||
href: "https://docs.microsoft.com/en-us/azure/cosmos-db/introduction",
|
href: "https://docs.microsoft.com/en-us/azure/cosmos-db/introduction",
|
||||||
textTKey: "LearnAboutDedicatedGateway",
|
textTKey: "Learn more about dedicated gateway.",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
@@ -295,45 +75,25 @@ export default class SqlX extends SelfServeBaseClass {
|
|||||||
|
|
||||||
@OnChange(onEnableDedicatedGatewayChange)
|
@OnChange(onEnableDedicatedGatewayChange)
|
||||||
@Values({
|
@Values({
|
||||||
labelTKey: "DedicatedGateway",
|
labelTKey: "Dedicated Gateway",
|
||||||
trueLabelTKey: "Provisioned",
|
trueLabelTKey: "Enable",
|
||||||
falseLabelTKey: "Deprovisioned",
|
falseLabelTKey: "Disable",
|
||||||
})
|
})
|
||||||
enableDedicatedGateway: boolean;
|
enableDedicatedGateway: boolean;
|
||||||
|
|
||||||
@OnChange(onSKUChange)
|
|
||||||
@Values({
|
@Values({
|
||||||
labelTKey: "SKUs",
|
labelTKey: "SKUs",
|
||||||
choices: getSkus,
|
choices: getSkus,
|
||||||
placeholderTKey: "SKUsPlaceHolder",
|
placeholderTKey: "Select SKUs",
|
||||||
})
|
})
|
||||||
sku: ChoiceItem;
|
sku: ChoiceItem;
|
||||||
|
|
||||||
@Values({
|
@Values({
|
||||||
labelTKey: "SKUDetails",
|
labelTKey: "Number of instances",
|
||||||
isDynamicDescription: true,
|
|
||||||
})
|
|
||||||
skuDetails: string;
|
|
||||||
|
|
||||||
@OnChange(onNumberOfInstancesChange)
|
|
||||||
@Values({
|
|
||||||
labelTKey: "NumberOfInstances",
|
|
||||||
min: getInstancesMin,
|
min: getInstancesMin,
|
||||||
max: getInstancesMax,
|
max: getInstancesMax,
|
||||||
step: 1,
|
step: 1,
|
||||||
uiType: NumberUiType.Spinner,
|
uiType: NumberUiType.Spinner,
|
||||||
})
|
})
|
||||||
instances: number;
|
instances: number;
|
||||||
|
|
||||||
@Values({
|
|
||||||
labelTKey: "Cost",
|
|
||||||
isDynamicDescription: true,
|
|
||||||
})
|
|
||||||
costPerHour: string;
|
|
||||||
|
|
||||||
@Values({
|
|
||||||
labelTKey: "ConnectionString",
|
|
||||||
isDynamicDescription: true,
|
|
||||||
})
|
|
||||||
connectionString: string;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,31 +0,0 @@
|
|||||||
export type SqlxServiceResource = {
|
|
||||||
id: string;
|
|
||||||
name: string;
|
|
||||||
type: string;
|
|
||||||
properties: SqlxServiceProps;
|
|
||||||
locations: SqlxServiceLocations;
|
|
||||||
};
|
|
||||||
export type SqlxServiceProps = {
|
|
||||||
serviceType: string;
|
|
||||||
creationTime: string;
|
|
||||||
status: string;
|
|
||||||
instanceSize: string;
|
|
||||||
instanceCount: number;
|
|
||||||
sqlxEndPoint: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type SqlxServiceLocations = {
|
|
||||||
location: string;
|
|
||||||
status: string;
|
|
||||||
sqlxEndpoint: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type UpdateDedicatedGatewayRequestParameters = {
|
|
||||||
properties: UpdateDedicatedGatewayRequestProperties;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type UpdateDedicatedGatewayRequestProperties = {
|
|
||||||
instanceSize: string;
|
|
||||||
instanceCount: number;
|
|
||||||
serviceType: string;
|
|
||||||
};
|
|
||||||
@@ -20,14 +20,11 @@ interface UserContext {
|
|||||||
// API Type is not yet provided by ARM. You need to manually inspect all the capabilities+kind so we abstract that logic in userContext
|
// API Type is not yet provided by ARM. You need to manually inspect all the capabilities+kind so we abstract that logic in userContext
|
||||||
// This is coming in a future Cosmos ARM API version as a prperty on databaseAccount
|
// This is coming in a future Cosmos ARM API version as a prperty on databaseAccount
|
||||||
apiType?: ApiType;
|
apiType?: ApiType;
|
||||||
isTryCosmosDBSubscription?: boolean;
|
|
||||||
portalEnv?: PortalEnv;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type ApiType = "SQL" | "Mongo" | "Gremlin" | "Tables" | "Cassandra";
|
type ApiType = "SQL" | "Mongo" | "Gremlin" | "Tables" | "Cassandra";
|
||||||
export type PortalEnv = "localhost" | "blackforest" | "fairfax" | "mooncake" | "prod" | "dev";
|
|
||||||
|
|
||||||
const userContext: UserContext = { isTryCosmosDBSubscription: false, portalEnv: "prod" };
|
const userContext: UserContext = {};
|
||||||
|
|
||||||
function updateUserContext(newContext: UserContext): void {
|
function updateUserContext(newContext: UserContext): void {
|
||||||
Object.assign(userContext, newContext);
|
Object.assign(userContext, newContext);
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { applyExplorerBindings } from "../applyExplorerBindings";
|
|||||||
import { AuthType } from "../AuthType";
|
import { AuthType } from "../AuthType";
|
||||||
import { AccountKind, DefaultAccountExperience } from "../Common/Constants";
|
import { AccountKind, DefaultAccountExperience } from "../Common/Constants";
|
||||||
import { normalizeArmEndpoint } from "../Common/EnvironmentUtility";
|
import { normalizeArmEndpoint } from "../Common/EnvironmentUtility";
|
||||||
import { sendReadyMessage } from "../Common/MessageHandler";
|
import { sendMessage } from "../Common/MessageHandler";
|
||||||
import { configContext, Platform, updateConfigContext } from "../ConfigContext";
|
import { configContext, Platform, updateConfigContext } from "../ConfigContext";
|
||||||
import { ActionType, DataExplorerAction } from "../Contracts/ActionContracts";
|
import { ActionType, DataExplorerAction } from "../Contracts/ActionContracts";
|
||||||
import { MessageTypes } from "../Contracts/ExplorerContracts";
|
import { MessageTypes } from "../Contracts/ExplorerContracts";
|
||||||
@@ -25,7 +25,7 @@ import {
|
|||||||
getDatabaseAccountPropertiesFromMetadata,
|
getDatabaseAccountPropertiesFromMetadata,
|
||||||
} from "../Platform/Hosted/HostedUtils";
|
} from "../Platform/Hosted/HostedUtils";
|
||||||
import { DefaultExperienceUtility } from "../Shared/DefaultExperienceUtility";
|
import { DefaultExperienceUtility } from "../Shared/DefaultExperienceUtility";
|
||||||
import { PortalEnv, updateUserContext } from "../UserContext";
|
import { updateUserContext } from "../UserContext";
|
||||||
import { listKeys } from "../Utils/arm/generatedClients/2020-04-01/databaseAccounts";
|
import { listKeys } from "../Utils/arm/generatedClients/2020-04-01/databaseAccounts";
|
||||||
import { isInvalidParentFrameOrigin } from "../Utils/MessageValidation";
|
import { isInvalidParentFrameOrigin } from "../Utils/MessageValidation";
|
||||||
|
|
||||||
@@ -78,22 +78,18 @@ async function configureHosted(explorerParams: ExplorerParams): Promise<Explorer
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function configureHostedWithAAD(config: AAD, explorerParams: ExplorerParams): Promise<Explorer> {
|
async function configureHostedWithAAD(config: AAD, explorerParams: ExplorerParams): Promise<Explorer> {
|
||||||
// TODO: Refactor. updateUserContext needs to be called twice because listKeys below depends on userContext.authorizationToken
|
|
||||||
updateUserContext({
|
|
||||||
authType: AuthType.AAD,
|
|
||||||
authorizationToken: `Bearer ${config.authorizationToken}`,
|
|
||||||
});
|
|
||||||
const account = config.databaseAccount;
|
const account = config.databaseAccount;
|
||||||
const accountResourceId = account.id;
|
const accountResourceId = account.id;
|
||||||
const subscriptionId = accountResourceId && accountResourceId.split("subscriptions/")[1].split("/")[0];
|
const subscriptionId = accountResourceId && accountResourceId.split("subscriptions/")[1].split("/")[0];
|
||||||
const resourceGroup = accountResourceId && accountResourceId.split("resourceGroups/")[1].split("/")[0];
|
const resourceGroup = accountResourceId && accountResourceId.split("resourceGroups/")[1].split("/")[0];
|
||||||
const keys = await listKeys(subscriptionId, resourceGroup, account.name);
|
|
||||||
updateUserContext({
|
updateUserContext({
|
||||||
subscriptionId,
|
subscriptionId,
|
||||||
resourceGroup,
|
resourceGroup,
|
||||||
|
authType: AuthType.AAD,
|
||||||
|
authorizationToken: `Bearer ${config.authorizationToken}`,
|
||||||
databaseAccount: config.databaseAccount,
|
databaseAccount: config.databaseAccount,
|
||||||
masterKey: keys.primaryMasterKey,
|
|
||||||
});
|
});
|
||||||
|
const keys = await listKeys(subscriptionId, resourceGroup, account.name);
|
||||||
const explorer = new Explorer(explorerParams);
|
const explorer = new Explorer(explorerParams);
|
||||||
explorer.configure({
|
explorer.configure({
|
||||||
databaseAccount: account,
|
databaseAccount: account,
|
||||||
@@ -122,7 +118,6 @@ function configureHostedWithConnectionString(config: ConnectionString, explorerP
|
|||||||
authType: AuthType.EncryptedToken,
|
authType: AuthType.EncryptedToken,
|
||||||
accessToken: encodeURIComponent(config.encryptedToken),
|
accessToken: encodeURIComponent(config.encryptedToken),
|
||||||
databaseAccount,
|
databaseAccount,
|
||||||
masterKey: config.masterKey,
|
|
||||||
});
|
});
|
||||||
const explorer = new Explorer(explorerParams);
|
const explorer = new Explorer(explorerParams);
|
||||||
explorer.configure({
|
explorer.configure({
|
||||||
@@ -160,7 +155,9 @@ function configureHostedWithResourceToken(config: ResourceToken, explorerParams:
|
|||||||
explorer.configure({
|
explorer.configure({
|
||||||
databaseAccount,
|
databaseAccount,
|
||||||
features: extractFeatures(),
|
features: extractFeatures(),
|
||||||
|
isAuthWithresourceToken: true,
|
||||||
});
|
});
|
||||||
|
explorer.isRefreshingExplorer(false);
|
||||||
return explorer;
|
return explorer;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -260,7 +257,6 @@ async function configurePortal(explorerParams: ExplorerParams): Promise<Explorer
|
|||||||
subscriptionId: inputs.subscriptionId,
|
subscriptionId: inputs.subscriptionId,
|
||||||
subscriptionType: inputs.subscriptionType,
|
subscriptionType: inputs.subscriptionType,
|
||||||
quotaId: inputs.quotaId,
|
quotaId: inputs.quotaId,
|
||||||
portalEnv: inputs.serverId as PortalEnv,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const explorer = new Explorer(explorerParams);
|
const explorer = new Explorer(explorerParams);
|
||||||
@@ -274,7 +270,7 @@ async function configurePortal(explorerParams: ExplorerParams): Promise<Explorer
|
|||||||
false
|
false
|
||||||
);
|
);
|
||||||
|
|
||||||
sendReadyMessage();
|
sendMessage("ready");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
149
src/hooks/useNotebooks.ts
Normal file
149
src/hooks/useNotebooks.ts
Normal file
@@ -0,0 +1,149 @@
|
|||||||
|
import { useState } from "react";
|
||||||
|
import { Notebook } from "../Common/Constants";
|
||||||
|
import Explorer from "../Explorer/Explorer";
|
||||||
|
import { NotebookContentItem, NotebookContentItemType } from "../Explorer/Notebook/NotebookContentItem";
|
||||||
|
import { IPinnedRepo } from "../Juno/JunoClient";
|
||||||
|
import { Action, ActionModifiers } from "../Shared/Telemetry/TelemetryConstants";
|
||||||
|
import * as TelemetryProcessor from "../Shared/Telemetry/TelemetryProcessor";
|
||||||
|
import * as GitHubUtils from "../Utils/GitHubUtils";
|
||||||
|
|
||||||
|
export const DataTitle = "DATA";
|
||||||
|
export const NotebooksTitle = "NOTEBOOKS";
|
||||||
|
export const PseudoDirPath = "PseudoDir";
|
||||||
|
|
||||||
|
export interface NotebookHooks {
|
||||||
|
lastRefreshTime: number;
|
||||||
|
galleryContentRoot: NotebookContentItem;
|
||||||
|
myNotebooksContentRoot: NotebookContentItem;
|
||||||
|
gitHubNotebooksContentRoot: NotebookContentItem;
|
||||||
|
|
||||||
|
refreshList: () => void;
|
||||||
|
initializeGitHubRepos: (pinnedRepos: IPinnedRepo[]) => void;
|
||||||
|
getMyNotebooksContentRoot: () => NotebookContentItem;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const useNotebooks = (context: { container: Explorer }): NotebookHooks => {
|
||||||
|
const [lastRefreshTime, setLastRefreshTime] = useState<number>(undefined);
|
||||||
|
const [galleryContentRoot, setGalleryContentRoot] = useState<NotebookContentItem>(undefined);
|
||||||
|
const [myNotebooksContentRoot, setMyNotebooksContentRoot] = useState<NotebookContentItem>(undefined);
|
||||||
|
const [gitHubNotebooksContentRoot, setGitHubNotebooksContentRoot] = useState<NotebookContentItem>(undefined);
|
||||||
|
|
||||||
|
const refreshList = (): void => {
|
||||||
|
initialize();
|
||||||
|
setLastRefreshTime(new Date().getTime());
|
||||||
|
};
|
||||||
|
|
||||||
|
// TODO For now, we need to rely on this, as setMyNotebooksContentRoot() is not synchronous
|
||||||
|
let _myNotebooksContentRoot: NotebookContentItem;
|
||||||
|
const _setMyNotebooksContentRoot = (newValue: NotebookContentItem) => {
|
||||||
|
_myNotebooksContentRoot = newValue;
|
||||||
|
setMyNotebooksContentRoot(newValue);
|
||||||
|
};
|
||||||
|
|
||||||
|
const initialize = (): Promise<void[]> => {
|
||||||
|
const refreshTasks: Promise<void>[] = [];
|
||||||
|
|
||||||
|
setGalleryContentRoot({
|
||||||
|
name: "Gallery",
|
||||||
|
path: "Gallery",
|
||||||
|
type: NotebookContentItemType.File,
|
||||||
|
});
|
||||||
|
|
||||||
|
const _myNotebooksContentRoot = {
|
||||||
|
name: Notebook.MyNotebooksTitle,
|
||||||
|
path: context.container.getNotebookBasePath(),
|
||||||
|
type: NotebookContentItemType.Directory,
|
||||||
|
};
|
||||||
|
_setMyNotebooksContentRoot(_myNotebooksContentRoot);
|
||||||
|
|
||||||
|
// Only if notebook server is available we can refresh
|
||||||
|
if (context.container.notebookServerInfo().notebookServerEndpoint) {
|
||||||
|
refreshTasks.push(
|
||||||
|
context.container.refreshContentItem(_myNotebooksContentRoot).then((root) => {
|
||||||
|
_setMyNotebooksContentRoot({ ...root });
|
||||||
|
traceMyNotebookTreeInfo(root);
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
initializeGitHubNotebooksContentRoot();
|
||||||
|
return Promise.all(refreshTasks);
|
||||||
|
};
|
||||||
|
|
||||||
|
const traceMyNotebookTreeInfo = (myNotebooksTree: NotebookContentItem) => {
|
||||||
|
if (myNotebooksTree.children) {
|
||||||
|
// Count 1st generation children (tree is lazy-loaded)
|
||||||
|
const nodeCounts = { files: 0, notebooks: 0, directories: 0 };
|
||||||
|
myNotebooksTree.children.forEach((treeNode) => {
|
||||||
|
switch ((treeNode as NotebookContentItem).type) {
|
||||||
|
case NotebookContentItemType.File:
|
||||||
|
nodeCounts.files++;
|
||||||
|
break;
|
||||||
|
case NotebookContentItemType.Directory:
|
||||||
|
nodeCounts.directories++;
|
||||||
|
break;
|
||||||
|
case NotebookContentItemType.Notebook:
|
||||||
|
nodeCounts.notebooks++;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
TelemetryProcessor.trace(Action.RefreshResourceTreeMyNotebooks, ActionModifiers.Mark, { ...nodeCounts });
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const initializeGitHubNotebooksContentRoot = (): NotebookContentItem => {
|
||||||
|
let root: NotebookContentItem;
|
||||||
|
|
||||||
|
if (context.container.notebookManager?.gitHubOAuthService.isLoggedIn()) {
|
||||||
|
root = {
|
||||||
|
name: Notebook.GitHubReposTitle,
|
||||||
|
path: PseudoDirPath,
|
||||||
|
type: NotebookContentItemType.Directory,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
setGitHubNotebooksContentRoot(root);
|
||||||
|
return root;
|
||||||
|
};
|
||||||
|
|
||||||
|
const initializeGitHubRepos = (pinnedRepos: IPinnedRepo[]): void => {
|
||||||
|
const _gitHubNotebooksContentRoot = initializeGitHubNotebooksContentRoot();
|
||||||
|
|
||||||
|
if (_gitHubNotebooksContentRoot) {
|
||||||
|
_gitHubNotebooksContentRoot.children = [];
|
||||||
|
|
||||||
|
pinnedRepos?.forEach((pinnedRepo) => {
|
||||||
|
const repoFullName = GitHubUtils.toRepoFullName(pinnedRepo.owner, pinnedRepo.name);
|
||||||
|
const repoTreeItem: NotebookContentItem = {
|
||||||
|
name: repoFullName,
|
||||||
|
path: PseudoDirPath,
|
||||||
|
type: NotebookContentItemType.Directory,
|
||||||
|
children: [],
|
||||||
|
};
|
||||||
|
|
||||||
|
pinnedRepo.branches.forEach((branch) => {
|
||||||
|
repoTreeItem.children.push({
|
||||||
|
name: branch.name,
|
||||||
|
path: GitHubUtils.toContentUri(pinnedRepo.owner, pinnedRepo.name, branch.name, ""),
|
||||||
|
type: NotebookContentItemType.Directory,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
_gitHubNotebooksContentRoot.children.push(repoTreeItem);
|
||||||
|
});
|
||||||
|
|
||||||
|
setGitHubNotebooksContentRoot({ ..._gitHubNotebooksContentRoot });
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return {
|
||||||
|
lastRefreshTime,
|
||||||
|
galleryContentRoot,
|
||||||
|
myNotebooksContentRoot,
|
||||||
|
gitHubNotebooksContentRoot,
|
||||||
|
refreshList,
|
||||||
|
initializeGitHubRepos,
|
||||||
|
getMyNotebooksContentRoot: () => _myNotebooksContentRoot,
|
||||||
|
};
|
||||||
|
};
|
||||||
@@ -33,7 +33,7 @@ describe("MongoDB Index policy tests", () => {
|
|||||||
await frame.click(`div[data-test="${collectionId}"]`);
|
await frame.click(`div[data-test="${collectionId}"]`);
|
||||||
|
|
||||||
await frame.waitFor(`div[data-test="Scale & Settings"]`), { visible: true };
|
await frame.waitFor(`div[data-test="Scale & Settings"]`), { visible: true };
|
||||||
await frame.waitFor(10000);
|
await frame.waitFor(LOADING_STATE_DELAY);
|
||||||
await frame.click(`div[data-test="Scale & Settings"]`);
|
await frame.click(`div[data-test="Scale & Settings"]`);
|
||||||
|
|
||||||
await frame.waitFor(`button[data-content="Indexing Policy"]`), { visible: true };
|
await frame.waitFor(`button[data-content="Indexing Policy"]`), { visible: true };
|
||||||
|
|||||||
@@ -12,19 +12,14 @@ describe("Self Serve", () => {
|
|||||||
|
|
||||||
// id of the display element is in the format {PROPERTY_NAME}-{DISPLAY_NAME}-{DISPLAY_TYPE}
|
// id of the display element is in the format {PROPERTY_NAME}-{DISPLAY_NAME}-{DISPLAY_TYPE}
|
||||||
await frame.waitForSelector("#description-text-display");
|
await frame.waitForSelector("#description-text-display");
|
||||||
|
await frame.waitForSelector("#currentRegionText-text-display");
|
||||||
|
|
||||||
const regions = await frame.waitForSelector("#regions-dropdown-input");
|
const regions = await frame.waitForSelector("#regions-dropdown-input");
|
||||||
|
|
||||||
const currentRegionsDescription = await frame.$$("#currentRegionText-text-display");
|
|
||||||
expect(currentRegionsDescription).toHaveLength(0);
|
|
||||||
let disabledLoggingToggle = await frame.$$("#enableLogging-toggle-input[disabled]");
|
let disabledLoggingToggle = await frame.$$("#enableLogging-toggle-input[disabled]");
|
||||||
expect(disabledLoggingToggle).toHaveLength(0);
|
expect(disabledLoggingToggle).toHaveLength(0);
|
||||||
|
|
||||||
await regions.click();
|
await regions.click();
|
||||||
const regionsDropdownElement1 = await frame.waitForSelector("#regions-dropdown-input-list0");
|
const regionsDropdownElement1 = await frame.waitForSelector("#regions-dropdown-input-list0");
|
||||||
await regionsDropdownElement1.click();
|
await regionsDropdownElement1.click();
|
||||||
|
|
||||||
await frame.waitForSelector("#currentRegionText-text-display");
|
|
||||||
disabledLoggingToggle = await frame.$$("#enableLogging-toggle-input[disabled]");
|
disabledLoggingToggle = await frame.$$("#enableLogging-toggle-input[disabled]");
|
||||||
expect(disabledLoggingToggle).toHaveLength(1);
|
expect(disabledLoggingToggle).toHaveLength(1);
|
||||||
|
|
||||||
|
|||||||
@@ -65,6 +65,12 @@ describe("Collection Add and Delete SQL spec", () => {
|
|||||||
await frame.waitFor(CREATE_DELAY);
|
await frame.waitFor(CREATE_DELAY);
|
||||||
await frame.waitFor("div[class='rowData'] > span[class='message']");
|
await frame.waitFor("div[class='rowData'] > span[class='message']");
|
||||||
|
|
||||||
|
const didCreateContainer = await frame.$$eval("div[class='rowData'] > span[class='message']", (elements) => {
|
||||||
|
return elements.some((el) => el.textContent.includes("Successfully created"));
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(didCreateContainer).toBe(true);
|
||||||
|
|
||||||
await frame.waitFor(`div[data-test="${selectedDbId}"]`), { visible: true };
|
await frame.waitFor(`div[data-test="${selectedDbId}"]`), { visible: true };
|
||||||
await frame.waitFor(LOADING_STATE_DELAY);
|
await frame.waitFor(LOADING_STATE_DELAY);
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ console.log("Subcription: ", subscriptionId);
|
|||||||
console.log("Account Name: ", accountName);
|
console.log("Account Name: ", accountName);
|
||||||
|
|
||||||
const initTestExplorer = async (): Promise<void> => {
|
const initTestExplorer = async (): Promise<void> => {
|
||||||
const { token } = await credentials.getToken("https://management.azure.com//.default");
|
const { token } = await credentials.getToken("https://management.core.windows.net/.default");
|
||||||
updateUserContext({
|
updateUserContext({
|
||||||
authorizationToken: `bearer ${token}`,
|
authorizationToken: `bearer ${token}`,
|
||||||
});
|
});
|
||||||
@@ -79,7 +79,7 @@ const initTestExplorer = async (): Promise<void> => {
|
|||||||
// After we have received the "ready" message from the child iframe we can post configuration
|
// After we have received the "ready" message from the child iframe we can post configuration
|
||||||
// This simulates the same action that happens in the portal
|
// This simulates the same action that happens in the portal
|
||||||
console.dir(event.data);
|
console.dir(event.data);
|
||||||
if (event.data?.kind === "ready") {
|
if (event.data?.data === "ready") {
|
||||||
iframe.contentWindow.postMessage(
|
iframe.contentWindow.postMessage(
|
||||||
{
|
{
|
||||||
signature: "pcIframe",
|
signature: "pcIframe",
|
||||||
|
|||||||
Reference in New Issue
Block a user