mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-27 21:01:57 +00:00
Compare commits
4 Commits
users/srna
...
generated-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c4fd56ecb0 | ||
|
|
a8eeeebb59 | ||
|
|
abe491f5cd | ||
|
|
2fc15cf322 |
@@ -4,4 +4,3 @@ PORTAL_RUNNER_PASSWORD=
|
|||||||
PORTAL_RUNNER_SUBSCRIPTION=
|
PORTAL_RUNNER_SUBSCRIPTION=
|
||||||
PORTAL_RUNNER_RESOURCE_GROUP=
|
PORTAL_RUNNER_RESOURCE_GROUP=
|
||||||
PORTAL_RUNNER_DATABASE_ACCOUNT=
|
PORTAL_RUNNER_DATABASE_ACCOUNT=
|
||||||
PORTAL_RUNNER_CONNECTION_STRING=
|
|
||||||
@@ -266,6 +266,10 @@ src/ResourceProvider/ResourceProviderClientFactory.ts
|
|||||||
src/RouteHandlers/RouteHandler.ts
|
src/RouteHandlers/RouteHandler.ts
|
||||||
src/RouteHandlers/TabRouteHandler.test.ts
|
src/RouteHandlers/TabRouteHandler.test.ts
|
||||||
src/RouteHandlers/TabRouteHandler.ts
|
src/RouteHandlers/TabRouteHandler.ts
|
||||||
|
src/Shared/AddCollectionUtility.test.ts
|
||||||
|
src/Shared/AddCollectionUtility.ts
|
||||||
|
src/Shared/AddDatabaseUtility.test.ts
|
||||||
|
src/Shared/AddDatabaseUtility.ts
|
||||||
src/Shared/Constants.ts
|
src/Shared/Constants.ts
|
||||||
src/Shared/DefaultExperienceUtility.test.ts
|
src/Shared/DefaultExperienceUtility.test.ts
|
||||||
src/Shared/DefaultExperienceUtility.ts
|
src/Shared/DefaultExperienceUtility.ts
|
||||||
@@ -275,6 +279,8 @@ src/Shared/StorageUtility.test.ts
|
|||||||
src/Shared/StorageUtility.ts
|
src/Shared/StorageUtility.ts
|
||||||
src/Shared/StringUtility.test.ts
|
src/Shared/StringUtility.test.ts
|
||||||
src/Shared/StringUtility.ts
|
src/Shared/StringUtility.ts
|
||||||
|
src/Shared/Telemetry/TelemetryConstants.ts
|
||||||
|
src/Shared/Telemetry/TelemetryProcessor.ts
|
||||||
src/Shared/appInsights.ts
|
src/Shared/appInsights.ts
|
||||||
src/SparkClusterManager/ArcadiaResourceManager.ts
|
src/SparkClusterManager/ArcadiaResourceManager.ts
|
||||||
src/SparkClusterManager/SparkClusterManager.ts
|
src/SparkClusterManager/SparkClusterManager.ts
|
||||||
@@ -412,5 +418,6 @@ cypress/integration/dataexplorer/SQL/addCollection.spec.ts
|
|||||||
cypress/integration/dataexplorer/TABLE/addCollection.spec.ts
|
cypress/integration/dataexplorer/TABLE/addCollection.spec.ts
|
||||||
cypress/integration/notebook/newNotebook.spec.ts
|
cypress/integration/notebook/newNotebook.spec.ts
|
||||||
cypress/integration/notebook/resourceTree.spec.ts
|
cypress/integration/notebook/resourceTree.spec.ts
|
||||||
|
__mocks__/AddDatabaseUtility.ts
|
||||||
__mocks__/monaco-editor.ts
|
__mocks__/monaco-editor.ts
|
||||||
src/Explorer/Tree/ResourceTreeAdapterForResourceToken.test.tsx
|
src/Explorer/Tree/ResourceTreeAdapterForResourceToken.test.tsx
|
||||||
20
.github/workflows/ci.yml
vendored
20
.github/workflows/ci.yml
vendored
@@ -196,26 +196,6 @@ jobs:
|
|||||||
shell: bash
|
shell: bash
|
||||||
env:
|
env:
|
||||||
NODE_TLS_REJECT_UNAUTHORIZED: 0
|
NODE_TLS_REJECT_UNAUTHORIZED: 0
|
||||||
endtoendpuppeteer:
|
|
||||||
name: "End to end puppeteer tests"
|
|
||||||
needs: [lint, format, compile, unittest]
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- name: Use Node.js 12.x
|
|
||||||
uses: actions/setup-node@v1
|
|
||||||
with:
|
|
||||||
node-version: 12.x
|
|
||||||
- name: End to End Puppeteer Tests
|
|
||||||
run: |
|
|
||||||
npm ci
|
|
||||||
npm start &
|
|
||||||
npm run wait-for-server
|
|
||||||
npm run test:e2e
|
|
||||||
shell: bash
|
|
||||||
env:
|
|
||||||
NODE_TLS_REJECT_UNAUTHORIZED: 0
|
|
||||||
PORTAL_RUNNER_CONNECTION_STRING: ${{ secrets.CONNECTION_STRING_SQL }}
|
|
||||||
nuget:
|
nuget:
|
||||||
name: Publish Nuget
|
name: Publish Nuget
|
||||||
if: github.ref == 'refs/heads/master' || contains(github.ref, 'hotfix/') || contains(github.ref, 'release/')
|
if: github.ref == 'refs/heads/master' || contains(github.ref, 'hotfix/') || contains(github.ref, 'release/')
|
||||||
|
|||||||
5
__mocks__/AddDatabaseUtility.ts
Normal file
5
__mocks__/AddDatabaseUtility.ts
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
export class AddDbUtilities {
|
||||||
|
createGremlinDatabase(params: any) {
|
||||||
|
return Promise.resolve(1)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,8 +3,7 @@ const isCI = require("is-ci");
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
launch: {
|
launch: {
|
||||||
headless: isCI,
|
headless: isCI,
|
||||||
slowMo: 50,
|
slowMo: isCI ? null : 20,
|
||||||
defaultViewport: null,
|
defaultViewport: null
|
||||||
ignoreHTTPSErrors: true
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -54,7 +54,7 @@
|
|||||||
|
|
||||||
@SelectionColor: #3074B0;
|
@SelectionColor: #3074B0;
|
||||||
|
|
||||||
@FocusColor: #605e5c;
|
@FocusColor: #00bcf2;
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
METRICS
|
METRICS
|
||||||
|
|||||||
@@ -1646,7 +1646,7 @@ p {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.contextual-pane .collid {
|
.contextual-pane .collid {
|
||||||
border: 1px solid #605e5c;
|
border: 1px solid #bbbbbb;
|
||||||
font-size: 10px;
|
font-size: 10px;
|
||||||
padding: 5px 10px;
|
padding: 5px 10px;
|
||||||
color: #000;
|
color: #000;
|
||||||
@@ -2423,6 +2423,22 @@ a:link {
|
|||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
::-webkit-input-placeholder {
|
||||||
|
color: #969696;
|
||||||
|
}
|
||||||
|
|
||||||
|
::-moz-placeholder {
|
||||||
|
color: #969696;
|
||||||
|
}
|
||||||
|
|
||||||
|
:-ms-input-placeholder {
|
||||||
|
color: #969696;
|
||||||
|
}
|
||||||
|
|
||||||
|
:-moz-placeholder {
|
||||||
|
color: #969696;
|
||||||
|
}
|
||||||
|
|
||||||
::-ms-expand {
|
::-ms-expand {
|
||||||
color: #969696;
|
color: #969696;
|
||||||
}
|
}
|
||||||
@@ -3002,11 +3018,3 @@ settings-pane {
|
|||||||
.italic {
|
.italic {
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
}
|
}
|
||||||
|
|
||||||
.warningErrorContent a {
|
|
||||||
color: @AccentMediumHigh
|
|
||||||
}
|
|
||||||
|
|
||||||
.infoBoxContent a {
|
|
||||||
color: @AccentMediumHigh
|
|
||||||
}
|
|
||||||
|
|||||||
858
package-lock.json
generated
858
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
17
package.json
17
package.json
@@ -8,7 +8,7 @@
|
|||||||
"@azure/cosmos-language-service": "0.0.4",
|
"@azure/cosmos-language-service": "0.0.4",
|
||||||
"@jupyterlab/services": "4.2.0",
|
"@jupyterlab/services": "4.2.0",
|
||||||
"@jupyterlab/terminal": "1.2.1",
|
"@jupyterlab/terminal": "1.2.1",
|
||||||
"@microsoft/applicationinsights-web": "2.5.8",
|
"@microsoft/applicationinsights-web": "2.5.4",
|
||||||
"@nteract/commutable": "7.1.4",
|
"@nteract/commutable": "7.1.4",
|
||||||
"@nteract/connected-components": "6.7.8",
|
"@nteract/connected-components": "6.7.8",
|
||||||
"@nteract/core": "13.0.0",
|
"@nteract/core": "13.0.0",
|
||||||
@@ -66,7 +66,7 @@
|
|||||||
"mkdirp": "1.0.4",
|
"mkdirp": "1.0.4",
|
||||||
"monaco-editor": "0.15.6",
|
"monaco-editor": "0.15.6",
|
||||||
"object.entries": "1.1.0",
|
"object.entries": "1.1.0",
|
||||||
"office-ui-fabric-react": "7.134.1",
|
"office-ui-fabric-react": "7.121.10",
|
||||||
"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",
|
||||||
@@ -102,15 +102,12 @@
|
|||||||
"@types/d3": "4.13.2",
|
"@types/d3": "4.13.2",
|
||||||
"@types/enzyme": "3.10.3",
|
"@types/enzyme": "3.10.3",
|
||||||
"@types/enzyme-adapter-react-16": "1.0.5",
|
"@types/enzyme-adapter-react-16": "1.0.5",
|
||||||
"@types/expect-puppeteer": "4.4.3",
|
|
||||||
"@types/hasher": "0.0.31",
|
"@types/hasher": "0.0.31",
|
||||||
"@types/jest": "23.3.10",
|
"@types/jest": "23.3.10",
|
||||||
"@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": "3.0.1",
|
|
||||||
"@types/q": "1.5.1",
|
"@types/q": "1.5.1",
|
||||||
"@types/react": "16.8.25",
|
"@types/react": "16.8.25",
|
||||||
"@types/react-dom": "16.0.7",
|
"@types/react-dom": "16.0.7",
|
||||||
@@ -121,8 +118,8 @@
|
|||||||
"@types/text-encoding": "0.0.33",
|
"@types/text-encoding": "0.0.33",
|
||||||
"@types/underscore": "1.7.36",
|
"@types/underscore": "1.7.36",
|
||||||
"@types/webfontloader": "1.6.29",
|
"@types/webfontloader": "1.6.29",
|
||||||
"@typescript-eslint/eslint-plugin": "4.0.1",
|
"@typescript-eslint/eslint-plugin": "3.2.0",
|
||||||
"@typescript-eslint/parser": "4.0.1",
|
"@typescript-eslint/parser": "3.2.0",
|
||||||
"adal-angular": "1.0.15",
|
"adal-angular": "1.0.15",
|
||||||
"axe-puppeteer": "1.1.0",
|
"axe-puppeteer": "1.1.0",
|
||||||
"babel-jest": "24.9.0",
|
"babel-jest": "24.9.0",
|
||||||
@@ -135,7 +132,7 @@
|
|||||||
"enzyme": "3.10.0",
|
"enzyme": "3.10.0",
|
||||||
"enzyme-adapter-react-16": "1.15.1",
|
"enzyme-adapter-react-16": "1.15.1",
|
||||||
"enzyme-to-json": "3.4.3",
|
"enzyme-to-json": "3.4.3",
|
||||||
"eslint": "7.8.1",
|
"eslint": "7.3.1",
|
||||||
"eslint-cli": "1.1.1",
|
"eslint-cli": "1.1.1",
|
||||||
"eslint-plugin-no-null": "1.0.2",
|
"eslint-plugin-no-null": "1.0.2",
|
||||||
"eslint-plugin-prefer-arrow": "1.2.2",
|
"eslint-plugin-prefer-arrow": "1.2.2",
|
||||||
@@ -167,9 +164,8 @@
|
|||||||
"ts-loader": "6.2.2",
|
"ts-loader": "6.2.2",
|
||||||
"tslint": "5.11.0",
|
"tslint": "5.11.0",
|
||||||
"tslint-microsoft-contrib": "6.0.0",
|
"tslint-microsoft-contrib": "6.0.0",
|
||||||
"typescript": "4.0.2",
|
"typescript": "3.9.6",
|
||||||
"url-loader": "1.1.1",
|
"url-loader": "1.1.1",
|
||||||
"wait-on": "4.0.2",
|
|
||||||
"webpack": "4.43.0",
|
"webpack": "4.43.0",
|
||||||
"webpack-bundle-analyzer": "3.6.1",
|
"webpack-bundle-analyzer": "3.6.1",
|
||||||
"webpack-cli": "3.3.10",
|
"webpack-cli": "3.3.10",
|
||||||
@@ -188,7 +184,6 @@
|
|||||||
"test": "rimraf coverage && jest",
|
"test": "rimraf coverage && jest",
|
||||||
"test:e2e": "jest -c ./jest.config.e2e.js --detectOpenHandles",
|
"test:e2e": "jest -c ./jest.config.e2e.js --detectOpenHandles",
|
||||||
"watch": "npm run start",
|
"watch": "npm run start",
|
||||||
"wait-for-server": "wait-on -t 240000 -i 5000 -v https-get://0.0.0.0:1234/",
|
|
||||||
"build:ase": "gulp build:ase",
|
"build:ase": "gulp build:ase",
|
||||||
"compile": "tsc",
|
"compile": "tsc",
|
||||||
"compile:contracts": "tsc -p ./tsconfig.contracts.json",
|
"compile:contracts": "tsc -p ./tsconfig.contracts.json",
|
||||||
|
|||||||
@@ -122,7 +122,6 @@ export class Features {
|
|||||||
public static readonly enableTtl = "enablettl";
|
public static readonly enableTtl = "enablettl";
|
||||||
public static readonly enableNotebooks = "enablenotebooks";
|
public static readonly enableNotebooks = "enablenotebooks";
|
||||||
public static readonly enableGalleryPublish = "enablegallerypublish";
|
public static readonly enableGalleryPublish = "enablegallerypublish";
|
||||||
public static readonly enableQueryTabV2 = "enablequerytabv2";
|
|
||||||
public static readonly enableCodeOfConduct = "enablecodeofconduct";
|
public static readonly enableCodeOfConduct = "enablecodeofconduct";
|
||||||
public static readonly enableLinkInjection = "enablelinkinjection";
|
public static readonly enableLinkInjection = "enablelinkinjection";
|
||||||
public static readonly enableSpark = "enablespark";
|
public static readonly enableSpark = "enablespark";
|
||||||
|
|||||||
@@ -5,7 +5,14 @@ import { Collection } from "../Contracts/ViewModels";
|
|||||||
import DocumentId from "../Explorer/Tree/DocumentId";
|
import DocumentId from "../Explorer/Tree/DocumentId";
|
||||||
import { ResourceProviderClient } from "../ResourceProvider/ResourceProviderClient";
|
import { ResourceProviderClient } from "../ResourceProvider/ResourceProviderClient";
|
||||||
import { updateUserContext } from "../UserContext";
|
import { updateUserContext } from "../UserContext";
|
||||||
import { deleteDocument, getEndpoint, queryDocuments, readDocument, updateDocument } from "./MongoProxyClient";
|
import {
|
||||||
|
deleteDocument,
|
||||||
|
getEndpoint,
|
||||||
|
queryDocuments,
|
||||||
|
readDocument,
|
||||||
|
updateDocument,
|
||||||
|
_createMongoCollectionWithARM
|
||||||
|
} from "./MongoProxyClient";
|
||||||
jest.mock("../ResourceProvider/ResourceProviderClient.ts");
|
jest.mock("../ResourceProvider/ResourceProviderClient.ts");
|
||||||
|
|
||||||
const databaseId = "testDB";
|
const databaseId = "testDB";
|
||||||
@@ -253,4 +260,58 @@ describe("MongoProxyClient", () => {
|
|||||||
expect(endpoint).toEqual("https://main.documentdb.ext.azure.com/api/guest/mongo/explorer");
|
expect(endpoint).toEqual("https://main.documentdb.ext.azure.com/api/guest/mongo/explorer");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe("createMongoCollectionWithARM", () => {
|
||||||
|
it("should create a collection with autopilot when autopilot is selected + shared throughput is false", () => {
|
||||||
|
const resourceProviderClientPutAsyncSpy = jest.spyOn(ResourceProviderClient.prototype, "putAsync");
|
||||||
|
const properties = {
|
||||||
|
pk: "state",
|
||||||
|
coll: "abc-collection",
|
||||||
|
cd: true,
|
||||||
|
db: "a1-db",
|
||||||
|
st: false,
|
||||||
|
sid: "a2",
|
||||||
|
rg: "c1",
|
||||||
|
dba: "main",
|
||||||
|
is: false
|
||||||
|
};
|
||||||
|
_createMongoCollectionWithARM("management.azure.com", properties, { "x-ms-cosmos-offer-autopilot-tier": "1" });
|
||||||
|
expect(resourceProviderClientPutAsyncSpy).toHaveBeenCalledWith(
|
||||||
|
"subscriptions/a2/resourceGroups/c1/providers/Microsoft.DocumentDB/databaseAccounts/foo/mongodbDatabases/a1-db/collections/abc-collection",
|
||||||
|
"2020-04-01",
|
||||||
|
{
|
||||||
|
properties: {
|
||||||
|
options: { "x-ms-cosmos-offer-autopilot-tier": "1" },
|
||||||
|
resource: { id: "abc-collection" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
it("should create a collection with provisioned throughput when provisioned throughput is selected + shared throughput is false", () => {
|
||||||
|
const resourceProviderClientPutAsyncSpy = jest.spyOn(ResourceProviderClient.prototype, "putAsync");
|
||||||
|
const properties = {
|
||||||
|
pk: "state",
|
||||||
|
coll: "abc-collection",
|
||||||
|
cd: true,
|
||||||
|
db: "a1-db",
|
||||||
|
st: false,
|
||||||
|
sid: "a2",
|
||||||
|
rg: "c1",
|
||||||
|
dba: "main",
|
||||||
|
is: false,
|
||||||
|
offerThroughput: 400
|
||||||
|
};
|
||||||
|
_createMongoCollectionWithARM("management.azure.com", properties, undefined);
|
||||||
|
expect(resourceProviderClientPutAsyncSpy).toHaveBeenCalledWith(
|
||||||
|
"subscriptions/a2/resourceGroups/c1/providers/Microsoft.DocumentDB/databaseAccounts/foo/mongodbDatabases/a1-db/collections/abc-collection",
|
||||||
|
"2020-04-01",
|
||||||
|
{
|
||||||
|
properties: {
|
||||||
|
options: { throughput: "400" },
|
||||||
|
resource: { id: "abc-collection" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,12 +1,15 @@
|
|||||||
import { Constants as CosmosSDKConstants } from "@azure/cosmos";
|
import { Constants as CosmosSDKConstants } from "@azure/cosmos";
|
||||||
import queryString from "querystring";
|
import queryString from "querystring";
|
||||||
import { AuthType } from "../AuthType";
|
import { AuthType } from "../AuthType";
|
||||||
|
import * as DataExplorerConstants from "../Common/Constants";
|
||||||
import { configContext } from "../ConfigContext";
|
import { configContext } from "../ConfigContext";
|
||||||
import * as DataModels from "../Contracts/DataModels";
|
import * as DataModels from "../Contracts/DataModels";
|
||||||
import { MessageTypes } from "../Contracts/ExplorerContracts";
|
import { MessageTypes } from "../Contracts/ExplorerContracts";
|
||||||
import { Collection } from "../Contracts/ViewModels";
|
import { Collection } from "../Contracts/ViewModels";
|
||||||
import { ConsoleDataType } from "../Explorer/Menus/NotificationConsole/NotificationConsoleComponent";
|
import { ConsoleDataType } from "../Explorer/Menus/NotificationConsole/NotificationConsoleComponent";
|
||||||
import DocumentId from "../Explorer/Tree/DocumentId";
|
import DocumentId from "../Explorer/Tree/DocumentId";
|
||||||
|
import { ResourceProviderClient } from "../ResourceProvider/ResourceProviderClient";
|
||||||
|
import { AddDbUtilities } from "../Shared/AddDatabaseUtility";
|
||||||
import * as NotificationConsoleUtils from "../Utils/NotificationConsoleUtils";
|
import * as NotificationConsoleUtils from "../Utils/NotificationConsoleUtils";
|
||||||
import { ApiType, HttpHeaders, HttpStatusCodes } from "./Constants";
|
import { ApiType, HttpHeaders, HttpStatusCodes } from "./Constants";
|
||||||
import { userContext } from "../UserContext";
|
import { userContext } from "../UserContext";
|
||||||
@@ -327,6 +330,48 @@ export function createMongoCollectionWithProxy(
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function createMongoCollectionWithARM(
|
||||||
|
armEndpoint: string,
|
||||||
|
databaseId: string,
|
||||||
|
analyticalStorageTtl: number,
|
||||||
|
collectionId: string,
|
||||||
|
offerThroughput: number,
|
||||||
|
shardKey: string,
|
||||||
|
createDatabase: boolean,
|
||||||
|
sharedThroughput: boolean,
|
||||||
|
isSharded: boolean,
|
||||||
|
additionalOptions?: DataModels.RpOptions
|
||||||
|
): Promise<DataModels.CreateCollectionWithRpResponse> {
|
||||||
|
const databaseAccount = userContext.databaseAccount;
|
||||||
|
const params: DataModels.MongoParameters = {
|
||||||
|
resourceUrl: databaseAccount.properties.mongoEndpoint || databaseAccount.properties.documentEndpoint,
|
||||||
|
db: databaseId,
|
||||||
|
coll: collectionId,
|
||||||
|
pk: shardKey,
|
||||||
|
offerThroughput,
|
||||||
|
cd: createDatabase,
|
||||||
|
st: sharedThroughput,
|
||||||
|
is: isSharded,
|
||||||
|
rid: "",
|
||||||
|
rtype: "colls",
|
||||||
|
sid: userContext.subscriptionId,
|
||||||
|
rg: userContext.resourceGroup,
|
||||||
|
dba: databaseAccount.name,
|
||||||
|
analyticalStorageTtl
|
||||||
|
};
|
||||||
|
|
||||||
|
if (createDatabase) {
|
||||||
|
return AddDbUtilities.createMongoDatabaseWithARM(
|
||||||
|
armEndpoint,
|
||||||
|
params,
|
||||||
|
sharedThroughput ? additionalOptions : {}
|
||||||
|
).then(() => {
|
||||||
|
return _createMongoCollectionWithARM(armEndpoint, params, sharedThroughput ? {} : additionalOptions);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return _createMongoCollectionWithARM(armEndpoint, params, additionalOptions);
|
||||||
|
}
|
||||||
|
|
||||||
export function getEndpoint(databaseAccount: DataModels.DatabaseAccount): string {
|
export function getEndpoint(databaseAccount: DataModels.DatabaseAccount): string {
|
||||||
const serverId = window.dataExplorer.serverId();
|
const serverId = window.dataExplorer.serverId();
|
||||||
const extensionEndpoint = window.dataExplorer.extensionEndpoint();
|
const extensionEndpoint = window.dataExplorer.extensionEndpoint();
|
||||||
@@ -359,3 +404,46 @@ async function errorHandling(response: Response, action: string, params: unknown
|
|||||||
export function getARMCreateCollectionEndpoint(params: DataModels.MongoParameters): string {
|
export function getARMCreateCollectionEndpoint(params: DataModels.MongoParameters): string {
|
||||||
return `subscriptions/${params.sid}/resourceGroups/${params.rg}/providers/Microsoft.DocumentDB/databaseAccounts/${userContext.databaseAccount.name}/mongodbDatabases/${params.db}/collections/${params.coll}`;
|
return `subscriptions/${params.sid}/resourceGroups/${params.rg}/providers/Microsoft.DocumentDB/databaseAccounts/${userContext.databaseAccount.name}/mongodbDatabases/${params.db}/collections/${params.coll}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function _createMongoCollectionWithARM(
|
||||||
|
armEndpoint: string,
|
||||||
|
params: DataModels.MongoParameters,
|
||||||
|
rpOptions: DataModels.RpOptions
|
||||||
|
): Promise<DataModels.CreateCollectionWithRpResponse> {
|
||||||
|
const rpPayloadToCreateCollection: DataModels.MongoCreationRequest = {
|
||||||
|
properties: {
|
||||||
|
resource: {
|
||||||
|
id: params.coll
|
||||||
|
},
|
||||||
|
options: {}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
if (params.is) {
|
||||||
|
rpPayloadToCreateCollection.properties.resource["shardKey"] = { [params.pk]: "Hash" };
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!params.st) {
|
||||||
|
if (rpOptions) {
|
||||||
|
rpPayloadToCreateCollection.properties.options = rpOptions;
|
||||||
|
} else {
|
||||||
|
rpPayloadToCreateCollection.properties.options["throughput"] =
|
||||||
|
params.offerThroughput && params.offerThroughput.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (params.analyticalStorageTtl) {
|
||||||
|
rpPayloadToCreateCollection.properties.resource.analyticalStorageTtl = params.analyticalStorageTtl;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
return new ResourceProviderClient<DataModels.CreateCollectionWithRpResponse>(armEndpoint).putAsync(
|
||||||
|
getARMCreateCollectionEndpoint(params),
|
||||||
|
DataExplorerConstants.ArmApiVersions.publicVersion,
|
||||||
|
rpPayloadToCreateCollection
|
||||||
|
);
|
||||||
|
} catch (response) {
|
||||||
|
errorHandling(response, "creating collection", undefined);
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -353,8 +353,7 @@ export enum CollectionTabKind {
|
|||||||
NotebookV2 = 15,
|
NotebookV2 = 15,
|
||||||
SparkMasterTab = 16,
|
SparkMasterTab = 16,
|
||||||
Gallery = 17,
|
Gallery = 17,
|
||||||
NotebookViewer = 18,
|
NotebookViewer = 18
|
||||||
QueryV2 = 19
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum TerminalKind {
|
export enum TerminalKind {
|
||||||
|
|||||||
@@ -35,7 +35,6 @@ ko.components.register("trigger-tab", new TabComponents.TriggerTab());
|
|||||||
ko.components.register("user-defined-function-tab", new TabComponents.UserDefinedFunctionTab());
|
ko.components.register("user-defined-function-tab", new TabComponents.UserDefinedFunctionTab());
|
||||||
ko.components.register("settings-tab", new TabComponents.SettingsTab());
|
ko.components.register("settings-tab", new TabComponents.SettingsTab());
|
||||||
ko.components.register("query-tab", new TabComponents.QueryTab());
|
ko.components.register("query-tab", new TabComponents.QueryTab());
|
||||||
ko.components.register("query-tab-v2", new TabComponents.QueryTabV2());
|
|
||||||
ko.components.register("tables-query-tab", new TabComponents.QueryTablesTab());
|
ko.components.register("tables-query-tab", new TabComponents.QueryTablesTab());
|
||||||
ko.components.register("graph-tab", new TabComponents.GraphTab());
|
ko.components.register("graph-tab", new TabComponents.GraphTab());
|
||||||
ko.components.register("mongo-shell-tab", new TabComponents.MongoShellTab());
|
ko.components.register("mongo-shell-tab", new TabComponents.MongoShellTab());
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { StringUtils } from "../../../Utils/StringUtils";
|
import { StringUtils } from "../../../Utils/StringUtils";
|
||||||
import { KeyCodes } from "../../../Common/Constants";
|
import { KeyCodes } from "../../../Common/Constants";
|
||||||
import * as TelemetryProcessor from "../../../Shared/Telemetry/TelemetryProcessor";
|
import TelemetryProcessor from "../../../Shared/Telemetry/TelemetryProcessor";
|
||||||
import { Action, ActionModifiers } from "../../../Shared/Telemetry/TelemetryConstants";
|
import { Action, ActionModifiers } from "../../../Shared/Telemetry/TelemetryConstants";
|
||||||
import CollapseChevronDownIcon from "../../../../images/QueryBuilder/CollapseChevronDown_16x.png";
|
import CollapseChevronDownIcon from "../../../../images/QueryBuilder/CollapseChevronDown_16x.png";
|
||||||
|
|
||||||
|
|||||||
@@ -265,9 +265,6 @@ exports[`test render renders with filters 1`] = `
|
|||||||
"buttonTextDisabled": "#a19f9d",
|
"buttonTextDisabled": "#a19f9d",
|
||||||
"buttonTextHovered": "#201f1e",
|
"buttonTextHovered": "#201f1e",
|
||||||
"buttonTextPressed": "#201f1e",
|
"buttonTextPressed": "#201f1e",
|
||||||
"cardShadow": "0 1.6px 3.6px 0 rgba(0, 0, 0, 0.132), 0 0.3px 0.9px 0 rgba(0, 0, 0, 0.108)",
|
|
||||||
"cardShadowHovered": "0 3.2px 7.2px 0 rgba(0, 0, 0, 0.132), 0 0.6px 1.8px 0 rgba(0, 0, 0, 0.108)",
|
|
||||||
"cardStandoutBackground": "#ffffff",
|
|
||||||
"defaultStateBackground": "#faf9f8",
|
"defaultStateBackground": "#faf9f8",
|
||||||
"disabledBackground": "#f3f2f1",
|
"disabledBackground": "#f3f2f1",
|
||||||
"disabledBodySubtext": "#c8c6c4",
|
"disabledBodySubtext": "#c8c6c4",
|
||||||
@@ -607,9 +604,6 @@ exports[`test render renders with filters 1`] = `
|
|||||||
"buttonTextDisabled": "#a19f9d",
|
"buttonTextDisabled": "#a19f9d",
|
||||||
"buttonTextHovered": "#201f1e",
|
"buttonTextHovered": "#201f1e",
|
||||||
"buttonTextPressed": "#201f1e",
|
"buttonTextPressed": "#201f1e",
|
||||||
"cardShadow": "0 1.6px 3.6px 0 rgba(0, 0, 0, 0.132), 0 0.3px 0.9px 0 rgba(0, 0, 0, 0.108)",
|
|
||||||
"cardShadowHovered": "0 3.2px 7.2px 0 rgba(0, 0, 0, 0.132), 0 0.6px 1.8px 0 rgba(0, 0, 0, 0.108)",
|
|
||||||
"cardStandoutBackground": "#ffffff",
|
|
||||||
"defaultStateBackground": "#faf9f8",
|
"defaultStateBackground": "#faf9f8",
|
||||||
"disabledBackground": "#f3f2f1",
|
"disabledBackground": "#f3f2f1",
|
||||||
"disabledBodySubtext": "#c8c6c4",
|
"disabledBodySubtext": "#c8c6c4",
|
||||||
@@ -1003,9 +997,6 @@ exports[`test render renders with filters 1`] = `
|
|||||||
"buttonTextDisabled": "#a19f9d",
|
"buttonTextDisabled": "#a19f9d",
|
||||||
"buttonTextHovered": "#201f1e",
|
"buttonTextHovered": "#201f1e",
|
||||||
"buttonTextPressed": "#201f1e",
|
"buttonTextPressed": "#201f1e",
|
||||||
"cardShadow": "0 1.6px 3.6px 0 rgba(0, 0, 0, 0.132), 0 0.3px 0.9px 0 rgba(0, 0, 0, 0.108)",
|
|
||||||
"cardShadowHovered": "0 3.2px 7.2px 0 rgba(0, 0, 0, 0.132), 0 0.6px 1.8px 0 rgba(0, 0, 0, 0.108)",
|
|
||||||
"cardStandoutBackground": "#ffffff",
|
|
||||||
"defaultStateBackground": "#faf9f8",
|
"defaultStateBackground": "#faf9f8",
|
||||||
"disabledBackground": "#f3f2f1",
|
"disabledBackground": "#f3f2f1",
|
||||||
"disabledBodySubtext": "#c8c6c4",
|
"disabledBodySubtext": "#c8c6c4",
|
||||||
@@ -1122,11 +1113,6 @@ exports[`test render renders with filters 1`] = `
|
|||||||
},
|
},
|
||||||
"iconDisabled": Object {
|
"iconDisabled": Object {
|
||||||
"color": "#a19f9d",
|
"color": "#a19f9d",
|
||||||
"selectors": Object {
|
|
||||||
"@media screen and (-ms-high-contrast: active)": Object {
|
|
||||||
"color": "GrayText",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
"label": Array [
|
"label": Array [
|
||||||
Object {
|
Object {
|
||||||
@@ -1148,11 +1134,6 @@ exports[`test render renders with filters 1`] = `
|
|||||||
},
|
},
|
||||||
"menuIconDisabled": Object {
|
"menuIconDisabled": Object {
|
||||||
"color": "#a19f9d",
|
"color": "#a19f9d",
|
||||||
"selectors": Object {
|
|
||||||
"@media screen and (-ms-high-contrast: active)": Object {
|
|
||||||
"color": "GrayText",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
"root": Array [
|
"root": Array [
|
||||||
Object {
|
Object {
|
||||||
@@ -1169,6 +1150,7 @@ exports[`test render renders with filters 1`] = `
|
|||||||
"right": 2,
|
"right": 2,
|
||||||
"selectors": Object {
|
"selectors": Object {
|
||||||
"@media screen and (-ms-high-contrast: active)": Object {
|
"@media screen and (-ms-high-contrast: active)": Object {
|
||||||
|
"border": "none",
|
||||||
"bottom": -2,
|
"bottom": -2,
|
||||||
"left": -2,
|
"left": -2,
|
||||||
"outlineColor": "ButtonText",
|
"outlineColor": "ButtonText",
|
||||||
@@ -1248,6 +1230,7 @@ exports[`test render renders with filters 1`] = `
|
|||||||
"right": 2,
|
"right": 2,
|
||||||
"selectors": Object {
|
"selectors": Object {
|
||||||
"@media screen and (-ms-high-contrast: active)": Object {
|
"@media screen and (-ms-high-contrast: active)": Object {
|
||||||
|
"border": "none",
|
||||||
"bottom": -2,
|
"bottom": -2,
|
||||||
"left": -2,
|
"left": -2,
|
||||||
"outlineColor": "ButtonText",
|
"outlineColor": "ButtonText",
|
||||||
@@ -1276,6 +1259,10 @@ exports[`test render renders with filters 1`] = `
|
|||||||
":hover": Object {
|
":hover": Object {
|
||||||
"outline": 0,
|
"outline": 0,
|
||||||
},
|
},
|
||||||
|
"@media screen and (-ms-high-contrast: active)": Object {
|
||||||
|
"borderColor": "grayText",
|
||||||
|
"color": "grayText",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Object {
|
Object {
|
||||||
@@ -1375,21 +1362,13 @@ exports[`test render renders with filters 1`] = `
|
|||||||
"selectors": Object {
|
"selectors": Object {
|
||||||
"@media screen and (-ms-high-contrast: active)": Object {
|
"@media screen and (-ms-high-contrast: active)": Object {
|
||||||
"MsHighContrastAdjust": "none",
|
"MsHighContrastAdjust": "none",
|
||||||
"backgroundColor": "Window",
|
"backgroundColor": "WindowText",
|
||||||
"border": "1px solid WindowText",
|
"color": "Window",
|
||||||
"borderRightWidth": "0",
|
|
||||||
"color": "WindowText",
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
".ms-Button--primary + .ms-Button": Object {
|
".ms-Button--primary + .ms-Button": Object {
|
||||||
"border": "none",
|
"border": "none",
|
||||||
"selectors": Object {
|
|
||||||
"@media screen and (-ms-high-contrast: active)": Object {
|
|
||||||
"border": "1px solid WindowText",
|
|
||||||
"borderLeftWidth": "0",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -1429,9 +1408,6 @@ exports[`test render renders with filters 1`] = `
|
|||||||
"borderColor": "GrayText",
|
"borderColor": "GrayText",
|
||||||
"color": "GrayText",
|
"color": "GrayText",
|
||||||
},
|
},
|
||||||
"@media screen and (forced-colors: active)": Object {
|
|
||||||
"forcedColorAdjust": "none",
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"splitButtonContainerFocused": Object {
|
"splitButtonContainerFocused": Object {
|
||||||
@@ -1578,13 +1554,6 @@ exports[`test render renders with filters 1`] = `
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
".ms-Button-menuIcon": Object {
|
|
||||||
"selectors": Object {
|
|
||||||
"@media screen and (-ms-high-contrast: active)": Object {
|
|
||||||
"color": "GrayText",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
":hover": Object {
|
":hover": Object {
|
||||||
"cursor": "default",
|
"cursor": "default",
|
||||||
},
|
},
|
||||||
@@ -1806,9 +1775,6 @@ exports[`test render renders with filters 1`] = `
|
|||||||
"buttonTextDisabled": "#a19f9d",
|
"buttonTextDisabled": "#a19f9d",
|
||||||
"buttonTextHovered": "#201f1e",
|
"buttonTextHovered": "#201f1e",
|
||||||
"buttonTextPressed": "#201f1e",
|
"buttonTextPressed": "#201f1e",
|
||||||
"cardShadow": "0 1.6px 3.6px 0 rgba(0, 0, 0, 0.132), 0 0.3px 0.9px 0 rgba(0, 0, 0, 0.108)",
|
|
||||||
"cardShadowHovered": "0 3.2px 7.2px 0 rgba(0, 0, 0, 0.132), 0 0.6px 1.8px 0 rgba(0, 0, 0, 0.108)",
|
|
||||||
"cardStandoutBackground": "#ffffff",
|
|
||||||
"defaultStateBackground": "#faf9f8",
|
"defaultStateBackground": "#faf9f8",
|
||||||
"disabledBackground": "#f3f2f1",
|
"disabledBackground": "#f3f2f1",
|
||||||
"disabledBodySubtext": "#c8c6c4",
|
"disabledBodySubtext": "#c8c6c4",
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import { RepoListItem } from "./GitHubReposComponent";
|
|||||||
import { ChildrenMargin } from "./GitHubStyleConstants";
|
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 TelemetryProcessor from "../../../Shared/Telemetry/TelemetryProcessor";
|
||||||
import UrlUtility from "../../../Common/UrlUtility";
|
import UrlUtility from "../../../Common/UrlUtility";
|
||||||
import Explorer from "../../Explorer";
|
import Explorer from "../../Explorer";
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ import {
|
|||||||
} from "office-ui-fabric-react/lib/utilities/selection/index";
|
} from "office-ui-fabric-react/lib/utilities/selection/index";
|
||||||
import { StyleConstants } from "../../../Common/Constants";
|
import { StyleConstants } from "../../../Common/Constants";
|
||||||
import { TextField, ITextFieldProps, ITextField } from "office-ui-fabric-react/lib/TextField";
|
import { TextField, ITextFieldProps, ITextField } from "office-ui-fabric-react/lib/TextField";
|
||||||
import * as TelemetryProcessor from "../../../Shared/Telemetry/TelemetryProcessor";
|
import TelemetryProcessor from "../../../Shared/Telemetry/TelemetryProcessor";
|
||||||
|
|
||||||
import SaveQueryBannerIcon from "../../../../images/save_query_banner.png";
|
import SaveQueryBannerIcon from "../../../../images/save_query_banner.png";
|
||||||
import { QueriesClient } from "../../../Common/QueriesClient";
|
import { QueriesClient } from "../../../Common/QueriesClient";
|
||||||
|
|||||||
@@ -1,20 +0,0 @@
|
|||||||
import * as React from "react";
|
|
||||||
import QueryTabV2 from "../../Tabs/QueryTabV2";
|
|
||||||
|
|
||||||
export interface QueryComponentProps {
|
|
||||||
queryTab: QueryTabV2
|
|
||||||
}
|
|
||||||
|
|
||||||
interface QueryComponentState {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
export class QueryComponent extends React.Component<QueryComponentProps, QueryComponentState> {
|
|
||||||
public render() : JSX.Element {
|
|
||||||
return (
|
|
||||||
<h1>
|
|
||||||
Query tab v2 is here
|
|
||||||
</h1>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
import ko from "knockout";
|
|
||||||
import * as React from "react";
|
|
||||||
import { ReactAdapter } from "../../../Bindings/ReactBindingHandler";
|
|
||||||
import { QueryComponent, QueryComponentProps } from "./QueryComponent";
|
|
||||||
|
|
||||||
export class QueryComponentAdapter implements ReactAdapter {
|
|
||||||
public parameters: ko.Observable<number>;
|
|
||||||
|
|
||||||
constructor(private props: QueryComponentProps) {
|
|
||||||
this.parameters = ko.observable<number>(Date.now());
|
|
||||||
console.log("adapter intiialized")
|
|
||||||
}
|
|
||||||
|
|
||||||
public renderComponent(): JSX.Element {
|
|
||||||
return <QueryComponent {...this.props} />;
|
|
||||||
}
|
|
||||||
|
|
||||||
public triggerRender(): void {
|
|
||||||
window.requestAnimationFrame(() => this.parameters(Date.now()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -26,7 +26,7 @@ import NewVertexPane from "./Panes/NewVertexPane";
|
|||||||
import NotebookV2Tab, { NotebookTabOptions } from "./Tabs/NotebookV2Tab";
|
import NotebookV2Tab, { NotebookTabOptions } from "./Tabs/NotebookV2Tab";
|
||||||
import Q from "q";
|
import Q from "q";
|
||||||
import ResourceTokenCollection from "./Tree/ResourceTokenCollection";
|
import ResourceTokenCollection from "./Tree/ResourceTokenCollection";
|
||||||
import * as TelemetryProcessor from "../Shared/Telemetry/TelemetryProcessor";
|
import TelemetryProcessor from "../Shared/Telemetry/TelemetryProcessor";
|
||||||
import TerminalTab from "./Tabs/TerminalTab";
|
import TerminalTab from "./Tabs/TerminalTab";
|
||||||
import { Action, ActionModifiers } from "../Shared/Telemetry/TelemetryConstants";
|
import { Action, ActionModifiers } from "../Shared/Telemetry/TelemetryConstants";
|
||||||
import { ActionContracts, MessageTypes } from "../Contracts/ExplorerContracts";
|
import { ActionContracts, MessageTypes } from "../Contracts/ExplorerContracts";
|
||||||
@@ -209,7 +209,6 @@ export default class Explorer {
|
|||||||
|
|
||||||
// features
|
// features
|
||||||
public isGalleryPublishEnabled: ko.Computed<boolean>;
|
public isGalleryPublishEnabled: ko.Computed<boolean>;
|
||||||
public isQueryTabV2Enabled: ko.Computed<boolean>;
|
|
||||||
public isCodeOfConductEnabled: ko.Computed<boolean>;
|
public isCodeOfConductEnabled: ko.Computed<boolean>;
|
||||||
public isLinkInjectionEnabled: ko.Computed<boolean>;
|
public isLinkInjectionEnabled: ko.Computed<boolean>;
|
||||||
public isGitHubPaneEnabled: ko.Observable<boolean>;
|
public isGitHubPaneEnabled: ko.Observable<boolean>;
|
||||||
@@ -415,9 +414,6 @@ export default class Explorer {
|
|||||||
this.isGalleryPublishEnabled = ko.computed<boolean>(() =>
|
this.isGalleryPublishEnabled = ko.computed<boolean>(() =>
|
||||||
this.isFeatureEnabled(Constants.Features.enableGalleryPublish)
|
this.isFeatureEnabled(Constants.Features.enableGalleryPublish)
|
||||||
);
|
);
|
||||||
this.isQueryTabV2Enabled = ko.computed<boolean>(() =>
|
|
||||||
this.isFeatureEnabled(Constants.Features.enableQueryTabV2)
|
|
||||||
);
|
|
||||||
this.isCodeOfConductEnabled = ko.computed<boolean>(() =>
|
this.isCodeOfConductEnabled = ko.computed<boolean>(() =>
|
||||||
this.isFeatureEnabled(Constants.Features.enableCodeOfConduct)
|
this.isFeatureEnabled(Constants.Features.enableCodeOfConduct)
|
||||||
);
|
);
|
||||||
@@ -1897,9 +1893,6 @@ export default class Explorer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public findSelectedDatabase(): ViewModels.Database {
|
public findSelectedDatabase(): ViewModels.Database {
|
||||||
if (!this.selectedNode()) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
if (this.selectedNode().nodeKind === "Database") {
|
if (this.selectedNode().nodeKind === "Database") {
|
||||||
return _.find(this.databases(), (database: ViewModels.Database) => database.rid === this.selectedNode().rid);
|
return _.find(this.databases(), (database: ViewModels.Database) => database.rid === this.selectedNode().rid);
|
||||||
}
|
}
|
||||||
@@ -3124,6 +3117,12 @@ export default class Explorer {
|
|||||||
} else {
|
} else {
|
||||||
loadingTitle.innerHTML = title;
|
loadingTitle.innerHTML = title;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TelemetryProcessor.trace(
|
||||||
|
Action.LoadingStatus,
|
||||||
|
ActionModifiers.Mark,
|
||||||
|
title !== "Welcome to Azure Cosmos DB" ? `Title: ${title}, Text: ${text}` : text
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private _openSetupNotebooksPaneForQuickstart(): void {
|
private _openSetupNotebooksPaneForQuickstart(): void {
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ import { GraphConfig } from "../../Tabs/GraphTab";
|
|||||||
import { EditorReact } from "../../Controls/Editor/EditorReact";
|
import { EditorReact } from "../../Controls/Editor/EditorReact";
|
||||||
import LoadGraphIcon from "../../../../images/LoadGraph.png";
|
import LoadGraphIcon from "../../../../images/LoadGraph.png";
|
||||||
import { Action } from "../../../Shared/Telemetry/TelemetryConstants";
|
import { Action } from "../../../Shared/Telemetry/TelemetryConstants";
|
||||||
import * as TelemetryProcessor from "../../../Shared/Telemetry/TelemetryProcessor";
|
import TelemetryProcessor from "../../../Shared/Telemetry/TelemetryProcessor";
|
||||||
import * as Constants from "../../../Common/Constants";
|
import * as Constants from "../../../Common/Constants";
|
||||||
import { InputProperty } from "../../../Contracts/ViewModels";
|
import { InputProperty } from "../../../Contracts/ViewModels";
|
||||||
import { QueryIterator, ItemDefinition, Resource } from "@azure/cosmos";
|
import { QueryIterator, ItemDefinition, Resource } from "@azure/cosmos";
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import * as ViewModels from "../../../Contracts/ViewModels";
|
|||||||
import { PlatformType } from "../../../PlatformType";
|
import { PlatformType } from "../../../PlatformType";
|
||||||
import { Action, ActionModifiers } from "../../../Shared/Telemetry/TelemetryConstants";
|
import { Action, ActionModifiers } from "../../../Shared/Telemetry/TelemetryConstants";
|
||||||
import { Areas } from "../../../Common/Constants";
|
import { Areas } from "../../../Common/Constants";
|
||||||
import * as TelemetryProcessor from "../../../Shared/Telemetry/TelemetryProcessor";
|
import TelemetryProcessor from "../../../Shared/Telemetry/TelemetryProcessor";
|
||||||
|
|
||||||
import AddDatabaseIcon from "../../../../images/AddDatabase.svg";
|
import AddDatabaseIcon from "../../../../images/AddDatabase.svg";
|
||||||
import AddCollectionIcon from "../../../../images/AddCollection.svg";
|
import AddCollectionIcon from "../../../../images/AddCollection.svg";
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ import { Store, AnyAction, MiddlewareAPI, Middleware, Dispatch } from "redux";
|
|||||||
import configureStore from "./NotebookComponent/store";
|
import configureStore from "./NotebookComponent/store";
|
||||||
|
|
||||||
import { Notification } from "react-notification-system";
|
import { Notification } from "react-notification-system";
|
||||||
import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
import TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
||||||
import { Action } from "../../Shared/Telemetry/TelemetryConstants";
|
import { Action } from "../../Shared/Telemetry/TelemetryConstants";
|
||||||
|
|
||||||
export type KernelSpecsDisplay = { name: string; displayName: string };
|
export type KernelSpecsDisplay = { name: string; displayName: string };
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ import * as Constants from "../../../Common/Constants";
|
|||||||
import * as NotificationConsoleUtils from "../../../Utils/NotificationConsoleUtils";
|
import * as NotificationConsoleUtils from "../../../Utils/NotificationConsoleUtils";
|
||||||
import { ConsoleDataType } from "../../Menus/NotificationConsole/NotificationConsoleComponent";
|
import { ConsoleDataType } from "../../Menus/NotificationConsole/NotificationConsoleComponent";
|
||||||
import * as CdbActions from "./actions";
|
import * as CdbActions from "./actions";
|
||||||
import * as TelemetryProcessor from "../../../Shared/Telemetry/TelemetryProcessor";
|
import TelemetryProcessor from "../../../Shared/Telemetry/TelemetryProcessor";
|
||||||
import { Action as TelemetryAction } from "../../../Shared/Telemetry/TelemetryConstants";
|
import { Action as TelemetryAction } from "../../../Shared/Telemetry/TelemetryConstants";
|
||||||
import { CdbAppState } from "./types";
|
import { CdbAppState } from "./types";
|
||||||
import { decryptJWTToken } from "../../../Utils/AuthorizationUtils";
|
import { decryptJWTToken } from "../../../Utils/AuthorizationUtils";
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { actions, CoreRecord, reducers as nteractReducers } from "@nteract/core";
|
import { actions, CoreRecord, reducers as nteractReducers } from "@nteract/core";
|
||||||
import { Action } from "redux";
|
import { Action } from "redux";
|
||||||
import { Areas } from "../../../Common/Constants";
|
import { Areas } from "../../../Common/Constants";
|
||||||
import * as TelemetryProcessor from "../../../Shared/Telemetry/TelemetryProcessor";
|
import TelemetryProcessor from "../../../Shared/Telemetry/TelemetryProcessor";
|
||||||
import * as cdbActions from "./actions";
|
import * as cdbActions from "./actions";
|
||||||
import { CdbRecord } from "./types";
|
import { CdbRecord } from "./types";
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import * as Logger from "../../Common/Logger";
|
|||||||
import { HttpStatusCodes, Areas } from "../../Common/Constants";
|
import { HttpStatusCodes, Areas } from "../../Common/Constants";
|
||||||
import { GitHubReposPane } from "../Panes/GitHubReposPane";
|
import { GitHubReposPane } from "../Panes/GitHubReposPane";
|
||||||
import ko from "knockout";
|
import ko from "knockout";
|
||||||
import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
import TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
||||||
import { Action, ActionModifiers } from "../../Shared/Telemetry/TelemetryConstants";
|
import { Action, ActionModifiers } from "../../Shared/Telemetry/TelemetryConstants";
|
||||||
import { IContentProvider } from "@nteract/core";
|
import { IContentProvider } from "@nteract/core";
|
||||||
import { NotebookContentProvider } from "./NotebookComponent/NotebookContentProvider";
|
import { NotebookContentProvider } from "./NotebookComponent/NotebookContentProvider";
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
<!-- Add collection header - Start -->
|
<!-- Add collection header - Start -->
|
||||||
<div class="firstdivbg headerline">
|
<div class="firstdivbg headerline">
|
||||||
<span id="containerTitle" data-bind="text: title"></span>
|
<span id="containerTitle" data-bind="text: title"></span>
|
||||||
<div class="closeImg" id="closeBtnAddCollection" role="button" aria-label="Add collection close pane"
|
<div class="closeImg" id="closeBtnAddCollection" role="button" aria-label="Close pane"
|
||||||
data-bind="click: cancel, event: { keypress: onCloseKeyPress }" tabindex="0">
|
data-bind="click: cancel, event: { keypress: onCloseKeyPress }" tabindex="0">
|
||||||
<img src="../../../images/close-black.svg" title="Close" alt="Close" />
|
<img src="../../../images/close-black.svg" title="Close" alt="Close" />
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import * as PricingUtils from "../../Utils/PricingUtils";
|
|||||||
import * as SharedConstants from "../../Shared/Constants";
|
import * as SharedConstants from "../../Shared/Constants";
|
||||||
import * as ViewModels from "../../Contracts/ViewModels";
|
import * as ViewModels from "../../Contracts/ViewModels";
|
||||||
import editable from "../../Common/EditableUtility";
|
import editable from "../../Common/EditableUtility";
|
||||||
import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
import TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
||||||
import { Action, ActionModifiers } from "../../Shared/Telemetry/TelemetryConstants";
|
import { Action, ActionModifiers } from "../../Shared/Telemetry/TelemetryConstants";
|
||||||
import { configContext, Platform } from "../../ConfigContext";
|
import { configContext, Platform } from "../../ConfigContext";
|
||||||
import { ContextualPaneBase } from "./ContextualPaneBase";
|
import { ContextualPaneBase } from "./ContextualPaneBase";
|
||||||
@@ -943,7 +943,7 @@ export default class AddCollectionPane extends ContextualPaneBase {
|
|||||||
const defaultThroughput = this.container.collectionCreationDefaults.throughput;
|
const defaultThroughput = this.container.collectionCreationDefaults.throughput;
|
||||||
this.throughputSinglePartition(defaultThroughput.fixed);
|
this.throughputSinglePartition(defaultThroughput.fixed);
|
||||||
this.throughputMultiPartition(
|
this.throughputMultiPartition(
|
||||||
AddCollectionUtility.getMaxThroughput(this.container.collectionCreationDefaults, this.container)
|
AddCollectionUtility.Utilities.getMaxThroughput(this.container.collectionCreationDefaults, this.container)
|
||||||
);
|
);
|
||||||
|
|
||||||
this.throughputDatabase(defaultThroughput.shared);
|
this.throughputDatabase(defaultThroughput.shared);
|
||||||
@@ -1167,19 +1167,17 @@ export default class AddCollectionPane extends ContextualPaneBase {
|
|||||||
|
|
||||||
private _updateThroughputLimitByCollectionStorage() {
|
private _updateThroughputLimitByCollectionStorage() {
|
||||||
const storage = this.storage();
|
const storage = this.storage();
|
||||||
const minThroughputRU =
|
const minThroughputRU = AddCollectionUtility.Utilities.getMinRUForStorageOption(
|
||||||
storage === SharedConstants.CollectionCreation.storage10Gb
|
this.container.collectionCreationDefaults,
|
||||||
? SharedConstants.CollectionCreation.DefaultCollectionRUs400
|
storage
|
||||||
: this.container.collectionCreationDefaults.throughput.unlimitedmin;
|
);
|
||||||
|
|
||||||
let maxThroughputRU;
|
let maxThroughputRU = AddCollectionUtility.Utilities.getMaxRUForStorageOption(
|
||||||
|
this.container.collectionCreationDefaults,
|
||||||
|
storage
|
||||||
|
);
|
||||||
if (this.isTryCosmosDBSubscription()) {
|
if (this.isTryCosmosDBSubscription()) {
|
||||||
maxThroughputRU = Constants.TryCosmosExperience.maxRU;
|
maxThroughputRU = Constants.TryCosmosExperience.maxRU;
|
||||||
} else {
|
|
||||||
maxThroughputRU =
|
|
||||||
storage === SharedConstants.CollectionCreation.storage10Gb
|
|
||||||
? SharedConstants.CollectionCreation.DefaultCollectionRUs10K
|
|
||||||
: this.container.collectionCreationDefaults.throughput.unlimitedmax;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.minThroughputRU(minThroughputRU);
|
this.minThroughputRU(minThroughputRU);
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import * as AddCollectionUtility from "../../Shared/AddCollectionUtility";
|
||||||
import * as AutoPilotUtils from "../../Utils/AutoPilotUtils";
|
import * as AutoPilotUtils from "../../Utils/AutoPilotUtils";
|
||||||
import * as Constants from "../../Common/Constants";
|
import * as Constants from "../../Common/Constants";
|
||||||
import * as DataModels from "../../Contracts/DataModels";
|
import * as DataModels from "../../Contracts/DataModels";
|
||||||
@@ -7,11 +8,15 @@ import * as PricingUtils from "../../Utils/PricingUtils";
|
|||||||
import * as SharedConstants from "../../Shared/Constants";
|
import * as SharedConstants from "../../Shared/Constants";
|
||||||
import * as ViewModels from "../../Contracts/ViewModels";
|
import * as ViewModels from "../../Contracts/ViewModels";
|
||||||
import editable from "../../Common/EditableUtility";
|
import editable from "../../Common/EditableUtility";
|
||||||
import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
import EnvironmentUtility from "../../Common/EnvironmentUtility";
|
||||||
|
import TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
||||||
import { Action, ActionModifiers } from "../../Shared/Telemetry/TelemetryConstants";
|
import { Action, ActionModifiers } from "../../Shared/Telemetry/TelemetryConstants";
|
||||||
|
import { AddDbUtilities } from "../../Shared/AddDatabaseUtility";
|
||||||
|
import { CassandraAPIDataClient } from "../Tables/TableDataClient";
|
||||||
import { ContextualPaneBase } from "./ContextualPaneBase";
|
import { ContextualPaneBase } from "./ContextualPaneBase";
|
||||||
import { createDatabase } from "../../Common/dataAccess/createDatabase";
|
import { createDatabase } from "../../Common/dataAccess/createDatabase";
|
||||||
import { PlatformType } from "../../PlatformType";
|
import { PlatformType } from "../../PlatformType";
|
||||||
|
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>;
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { Areas } from "../../Common/Constants";
|
|||||||
import { ContextualPaneBase } from "./ContextualPaneBase";
|
import { ContextualPaneBase } from "./ContextualPaneBase";
|
||||||
import * as Logger from "../../Common/Logger";
|
import * as Logger from "../../Common/Logger";
|
||||||
import { QueriesGridComponentAdapter } from "../Controls/QueriesGridReactComponent/QueriesGridComponentAdapter";
|
import { QueriesGridComponentAdapter } from "../Controls/QueriesGridReactComponent/QueriesGridComponentAdapter";
|
||||||
import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
import TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
||||||
import QueryTab from "../Tabs/QueryTab";
|
import QueryTab from "../Tabs/QueryTab";
|
||||||
|
|
||||||
export class BrowseQueriesPane extends ContextualPaneBase {
|
export class BrowseQueriesPane extends ContextualPaneBase {
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ 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 SharedConstants from "../../Shared/Constants";
|
||||||
import * as ViewModels from "../../Contracts/ViewModels";
|
import * as ViewModels from "../../Contracts/ViewModels";
|
||||||
import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
import TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
||||||
import { Action, ActionModifiers } from "../../Shared/Telemetry/TelemetryConstants";
|
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";
|
||||||
@@ -494,7 +494,9 @@ export default class CassandraAddCollectionPane extends ContextualPaneBase {
|
|||||||
this.selectedSharedAutoPilotTier(null);
|
this.selectedSharedAutoPilotTier(null);
|
||||||
this.selectedAutoPilotThroughput(AutoPilotUtils.minAutoPilotThroughput);
|
this.selectedAutoPilotThroughput(AutoPilotUtils.minAutoPilotThroughput);
|
||||||
this.sharedAutoPilotThroughput(AutoPilotUtils.minAutoPilotThroughput);
|
this.sharedAutoPilotThroughput(AutoPilotUtils.minAutoPilotThroughput);
|
||||||
this.throughput(AddCollectionUtility.getMaxThroughput(this.container.collectionCreationDefaults, this.container));
|
this.throughput(
|
||||||
|
AddCollectionUtility.Utilities.getMaxThroughput(this.container.collectionCreationDefaults, this.container)
|
||||||
|
);
|
||||||
this.keyspaceThroughput(throughputDefaults.shared);
|
this.keyspaceThroughput(throughputDefaults.shared);
|
||||||
this.maxThroughputRU(throughputDefaults.unlimitedmax);
|
this.maxThroughputRU(throughputDefaults.unlimitedmax);
|
||||||
this.minThroughputRU(throughputDefaults.unlimitedmin);
|
this.minThroughputRU(throughputDefaults.unlimitedmin);
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import * as Constants from "../../Common/Constants";
|
|||||||
import { Action, ActionModifiers } from "../../Shared/Telemetry/TelemetryConstants";
|
import { Action, ActionModifiers } from "../../Shared/Telemetry/TelemetryConstants";
|
||||||
import { KeyCodes } from "../../Common/Constants";
|
import { KeyCodes } from "../../Common/Constants";
|
||||||
import { WaitsForTemplateViewModel } from "../WaitsForTemplateViewModel";
|
import { WaitsForTemplateViewModel } from "../WaitsForTemplateViewModel";
|
||||||
import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
import TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
||||||
import Explorer from "../Explorer";
|
import Explorer from "../Explorer";
|
||||||
|
|
||||||
// TODO: Use specific actions for logging telemetry data
|
// TODO: Use specific actions for logging telemetry data
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import { Action, ActionModifiers } from "../../Shared/Telemetry/TelemetryConstan
|
|||||||
import DeleteCollectionConfirmationPane from "./DeleteCollectionConfirmationPane";
|
import DeleteCollectionConfirmationPane from "./DeleteCollectionConfirmationPane";
|
||||||
import DeleteFeedback from "../../Common/DeleteFeedback";
|
import DeleteFeedback from "../../Common/DeleteFeedback";
|
||||||
import Explorer from "../Explorer";
|
import Explorer from "../Explorer";
|
||||||
import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
import TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
||||||
import { TreeNode } from "../../Contracts/ViewModels";
|
import { TreeNode } from "../../Contracts/ViewModels";
|
||||||
import { deleteCollection } from "../../Common/dataAccess/deleteCollection";
|
import { deleteCollection } from "../../Common/dataAccess/deleteCollection";
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import { ContextualPaneBase } from "./ContextualPaneBase";
|
|||||||
import { DefaultExperienceUtility } from "../../Shared/DefaultExperienceUtility";
|
import { DefaultExperienceUtility } from "../../Shared/DefaultExperienceUtility";
|
||||||
import DeleteFeedback from "../../Common/DeleteFeedback";
|
import DeleteFeedback from "../../Common/DeleteFeedback";
|
||||||
import * as NotificationConsoleUtils from "../../Utils/NotificationConsoleUtils";
|
import * as NotificationConsoleUtils from "../../Utils/NotificationConsoleUtils";
|
||||||
import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
import TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
||||||
import { deleteCollection } from "../../Common/dataAccess/deleteCollection";
|
import { deleteCollection } from "../../Common/dataAccess/deleteCollection";
|
||||||
|
|
||||||
export default class DeleteCollectionConfirmationPane extends ContextualPaneBase {
|
export default class DeleteCollectionConfirmationPane extends ContextualPaneBase {
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import * as ViewModels from "../../Contracts/ViewModels";
|
|||||||
import DeleteDatabaseConfirmationPane from "./DeleteDatabaseConfirmationPane";
|
import DeleteDatabaseConfirmationPane from "./DeleteDatabaseConfirmationPane";
|
||||||
import DeleteFeedback from "../../Common/DeleteFeedback";
|
import DeleteFeedback from "../../Common/DeleteFeedback";
|
||||||
import Explorer from "../Explorer";
|
import Explorer from "../Explorer";
|
||||||
import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
import TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
||||||
import { TreeNode } from "../../Contracts/ViewModels";
|
import { TreeNode } from "../../Contracts/ViewModels";
|
||||||
import { TabsManager } from "../Tabs/TabsManager";
|
import { TabsManager } from "../Tabs/TabsManager";
|
||||||
import { deleteDatabase } from "../../Common/dataAccess/deleteDatabase";
|
import { deleteDatabase } from "../../Common/dataAccess/deleteDatabase";
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import { DefaultExperienceUtility } from "../../Shared/DefaultExperienceUtility"
|
|||||||
import DeleteFeedback from "../../Common/DeleteFeedback";
|
import DeleteFeedback from "../../Common/DeleteFeedback";
|
||||||
|
|
||||||
import * as NotificationConsoleUtils from "../../Utils/NotificationConsoleUtils";
|
import * as NotificationConsoleUtils from "../../Utils/NotificationConsoleUtils";
|
||||||
import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
import TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
||||||
import { deleteDatabase } from "../../Common/dataAccess/deleteDatabase";
|
import { deleteDatabase } from "../../Common/dataAccess/deleteDatabase";
|
||||||
|
|
||||||
export default class DeleteDatabaseConfirmationPane extends ContextualPaneBase {
|
export default class DeleteDatabaseConfirmationPane extends ContextualPaneBase {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import * as ViewModels from "../../Contracts/ViewModels";
|
|||||||
import { GitHubClient, IGitHubPageInfo, IGitHubRepo } from "../../GitHub/GitHubClient";
|
import { GitHubClient, IGitHubPageInfo, IGitHubRepo } from "../../GitHub/GitHubClient";
|
||||||
import { IPinnedRepo, JunoClient } from "../../Juno/JunoClient";
|
import { IPinnedRepo, JunoClient } from "../../Juno/JunoClient";
|
||||||
import { Action, ActionModifiers } from "../../Shared/Telemetry/TelemetryConstants";
|
import { Action, ActionModifiers } from "../../Shared/Telemetry/TelemetryConstants";
|
||||||
import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
import TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
||||||
import * as GitHubUtils from "../../Utils/GitHubUtils";
|
import * as GitHubUtils from "../../Utils/GitHubUtils";
|
||||||
import { JunoUtils } from "../../Utils/JunoUtils";
|
import { JunoUtils } from "../../Utils/JunoUtils";
|
||||||
import * as NotificationConsoleUtils from "../../Utils/NotificationConsoleUtils";
|
import * as NotificationConsoleUtils from "../../Utils/NotificationConsoleUtils";
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import { Action } from "../../Shared/Telemetry/TelemetryConstants";
|
|||||||
import { ContextualPaneBase } from "./ContextualPaneBase";
|
import { ContextualPaneBase } from "./ContextualPaneBase";
|
||||||
import { ConsoleDataType } from "../Menus/NotificationConsole/NotificationConsoleComponent";
|
import { ConsoleDataType } from "../Menus/NotificationConsole/NotificationConsoleComponent";
|
||||||
import * as NotificationConsoleUtils from "../../Utils/NotificationConsoleUtils";
|
import * as NotificationConsoleUtils from "../../Utils/NotificationConsoleUtils";
|
||||||
import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
import TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
||||||
import QueryTab from "../Tabs/QueryTab";
|
import QueryTab from "../Tabs/QueryTab";
|
||||||
|
|
||||||
export class SaveQueryPane extends ContextualPaneBase {
|
export class SaveQueryPane extends ContextualPaneBase {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { Areas, KeyCodes } from "../../Common/Constants";
|
|||||||
import { ConsoleDataType } from "../Menus/NotificationConsole/NotificationConsoleComponent";
|
import { ConsoleDataType } from "../Menus/NotificationConsole/NotificationConsoleComponent";
|
||||||
import { ContextualPaneBase } from "./ContextualPaneBase";
|
import { ContextualPaneBase } from "./ContextualPaneBase";
|
||||||
import * as NotificationConsoleUtils from "../../Utils/NotificationConsoleUtils";
|
import * as NotificationConsoleUtils from "../../Utils/NotificationConsoleUtils";
|
||||||
import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
import TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
||||||
import * as ko from "knockout";
|
import * as ko from "knockout";
|
||||||
|
|
||||||
export class SetupNotebooksPane extends ContextualPaneBase {
|
export class SetupNotebooksPane extends ContextualPaneBase {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { DirectoryListProps } from "../Controls/Directory/DirectoryListComponent
|
|||||||
import { DefaultDirectoryDropdownProps } from "../Controls/Directory/DefaultDirectoryDropdownComponent";
|
import { DefaultDirectoryDropdownProps } from "../Controls/Directory/DefaultDirectoryDropdownComponent";
|
||||||
import { DirectoryComponentAdapter } from "../Controls/Directory/DirectoryComponentAdapter";
|
import { DirectoryComponentAdapter } from "../Controls/Directory/DirectoryComponentAdapter";
|
||||||
import SwitchDirectoryPaneTemplate from "./SwitchDirectoryPane.html";
|
import SwitchDirectoryPaneTemplate from "./SwitchDirectoryPane.html";
|
||||||
import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
import TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
||||||
|
|
||||||
class PaneComponent {
|
class PaneComponent {
|
||||||
constructor(data: any) {
|
constructor(data: any) {
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import * as CommonConstants from "../../../Common/Constants";
|
|||||||
import * as Constants from "../Constants";
|
import * as Constants from "../Constants";
|
||||||
import * as Entities from "../Entities";
|
import * as Entities from "../Entities";
|
||||||
import QueryTablesTab from "../../Tabs/QueryTablesTab";
|
import QueryTablesTab from "../../Tabs/QueryTablesTab";
|
||||||
import * as TelemetryProcessor from "../../../Shared/Telemetry/TelemetryProcessor";
|
import TelemetryProcessor from "../../../Shared/Telemetry/TelemetryProcessor";
|
||||||
import { QueryIterator, ItemDefinition, Resource } from "@azure/cosmos";
|
import { QueryIterator, ItemDefinition, Resource } from "@azure/cosmos";
|
||||||
|
|
||||||
// This is the format of the data we will have to pass to Datatable render callback,
|
// This is the format of the data we will have to pass to Datatable render callback,
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import * as Utilities from "../Utilities";
|
|||||||
import * as Entities from "../Entities";
|
import * as Entities from "../Entities";
|
||||||
import QueryTablesTab from "../../Tabs/QueryTablesTab";
|
import QueryTablesTab from "../../Tabs/QueryTablesTab";
|
||||||
import * as TableEntityProcessor from "../TableEntityProcessor";
|
import * as TableEntityProcessor from "../TableEntityProcessor";
|
||||||
import * as TelemetryProcessor from "../../../Shared/Telemetry/TelemetryProcessor";
|
import TelemetryProcessor from "../../../Shared/Telemetry/TelemetryProcessor";
|
||||||
import * as ErrorParserUtility from "../../../Common/ErrorParserUtility";
|
import * as ErrorParserUtility from "../../../Common/ErrorParserUtility";
|
||||||
import * as DataModels from "../../../Contracts/DataModels";
|
import * as DataModels from "../../../Contracts/DataModels";
|
||||||
import * as ViewModels from "../../../Contracts/ViewModels";
|
import * as ViewModels from "../../../Contracts/ViewModels";
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import * as HeadersUtility from "../../Common/HeadersUtility";
|
|||||||
import TabsBase from "./TabsBase";
|
import TabsBase from "./TabsBase";
|
||||||
import { DocumentsGridMetrics } from "../../Common/Constants";
|
import { DocumentsGridMetrics } from "../../Common/Constants";
|
||||||
import { Splitter, SplitterBounds, SplitterDirection } from "../../Common/Splitter";
|
import { Splitter, SplitterBounds, SplitterDirection } from "../../Common/Splitter";
|
||||||
import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
import TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
||||||
import SaveIcon from "../../../images/save-cosmos.svg";
|
import SaveIcon from "../../../images/save-cosmos.svg";
|
||||||
import DiscardIcon from "../../../images/discard.svg";
|
import DiscardIcon from "../../../images/discard.svg";
|
||||||
import DeleteIcon from "../../../images/delete.svg";
|
import DeleteIcon from "../../../images/delete.svg";
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import editable from "../../Common/EditableUtility";
|
|||||||
import Q from "q";
|
import Q from "q";
|
||||||
import SaveIcon from "../../../images/save-cosmos.svg";
|
import SaveIcon from "../../../images/save-cosmos.svg";
|
||||||
import TabsBase from "./TabsBase";
|
import TabsBase from "./TabsBase";
|
||||||
import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
import TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
||||||
import { Action } from "../../Shared/Telemetry/TelemetryConstants";
|
import { Action } from "../../Shared/Telemetry/TelemetryConstants";
|
||||||
import { PlatformType } from "../../PlatformType";
|
import { PlatformType } from "../../PlatformType";
|
||||||
import { RequestOptions } from "@azure/cosmos/dist-esm";
|
import { RequestOptions } from "@azure/cosmos/dist-esm";
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import TabsBase from "./TabsBase";
|
|||||||
import { DocumentsGridMetrics } from "../../Common/Constants";
|
import { DocumentsGridMetrics } from "../../Common/Constants";
|
||||||
import { QueryUtils } from "../../Utils/QueryUtils";
|
import { QueryUtils } from "../../Utils/QueryUtils";
|
||||||
import { Splitter, SplitterBounds, SplitterDirection } from "../../Common/Splitter";
|
import { Splitter, SplitterBounds, SplitterDirection } from "../../Common/Splitter";
|
||||||
import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
import TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
||||||
import NewDocumentIcon from "../../../images/NewDocument.svg";
|
import NewDocumentIcon from "../../../images/NewDocument.svg";
|
||||||
import SaveIcon from "../../../images/save-cosmos.svg";
|
import SaveIcon from "../../../images/save-cosmos.svg";
|
||||||
import DiscardIcon from "../../../images/discard.svg";
|
import DiscardIcon from "../../../images/discard.svg";
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import * as ErrorParserUtility from "../../Common/ErrorParserUtility";
|
|||||||
import MongoUtility from "../../Common/MongoUtility";
|
import MongoUtility from "../../Common/MongoUtility";
|
||||||
import ObjectId from "../Tree/ObjectId";
|
import ObjectId from "../Tree/ObjectId";
|
||||||
import Q from "q";
|
import Q from "q";
|
||||||
import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
import TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
||||||
import { Action } from "../../Shared/Telemetry/TelemetryConstants";
|
import { Action } from "../../Shared/Telemetry/TelemetryConstants";
|
||||||
import {
|
import {
|
||||||
createDocument,
|
createDocument,
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import EnvironmentUtility from "../../Common/EnvironmentUtility";
|
|||||||
import { isInvalidParentFrameOrigin } from "../../Utils/MessageValidation";
|
import { isInvalidParentFrameOrigin } from "../../Utils/MessageValidation";
|
||||||
import Q from "q";
|
import Q from "q";
|
||||||
import TabsBase from "./TabsBase";
|
import TabsBase from "./TabsBase";
|
||||||
import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
import TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
||||||
import { Action, ActionModifiers } from "../../Shared/Telemetry/TelemetryConstants";
|
import { Action, ActionModifiers } from "../../Shared/Telemetry/TelemetryConstants";
|
||||||
import { ConsoleDataType } from "../Menus/NotificationConsole/NotificationConsoleComponent";
|
import { ConsoleDataType } from "../Menus/NotificationConsole/NotificationConsoleComponent";
|
||||||
import { HashMap } from "../../Common/HashMap";
|
import { HashMap } from "../../Common/HashMap";
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import SaveIcon from "../../../images/save-cosmos.svg";
|
|||||||
import ClearAllOutputsIcon from "../../../images/notebook/Notebook-clear-all-outputs.svg";
|
import ClearAllOutputsIcon from "../../../images/notebook/Notebook-clear-all-outputs.svg";
|
||||||
import InterruptKernelIcon from "../../../images/notebook/Notebook-stop.svg";
|
import InterruptKernelIcon from "../../../images/notebook/Notebook-stop.svg";
|
||||||
import KillKernelIcon from "../../../images/notebook/Notebook-stop.svg";
|
import KillKernelIcon from "../../../images/notebook/Notebook-stop.svg";
|
||||||
import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
import TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
||||||
import { Action, ActionModifiers } from "../../Shared/Telemetry/TelemetryConstants";
|
import { Action, ActionModifiers } from "../../Shared/Telemetry/TelemetryConstants";
|
||||||
import { Areas, ArmApiVersions } from "../../Common/Constants";
|
import { Areas, ArmApiVersions } from "../../Common/Constants";
|
||||||
import { CommandBarComponentButtonFactory } from "../Menus/CommandBar/CommandBarComponentButtonFactory";
|
import { CommandBarComponentButtonFactory } from "../Menus/CommandBar/CommandBarComponentButtonFactory";
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import { HashMap } from "../../Common/HashMap";
|
|||||||
import * as HeadersUtility from "../../Common/HeadersUtility";
|
import * as HeadersUtility from "../../Common/HeadersUtility";
|
||||||
import * as Logger from "../../Common/Logger";
|
import * as Logger from "../../Common/Logger";
|
||||||
import { Splitter, SplitterBounds, SplitterDirection } from "../../Common/Splitter";
|
import { Splitter, SplitterBounds, SplitterDirection } from "../../Common/Splitter";
|
||||||
import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
import TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
||||||
import ExecuteQueryIcon from "../../../images/ExecuteQuery.svg";
|
import ExecuteQueryIcon from "../../../images/ExecuteQuery.svg";
|
||||||
import { QueryUtils } from "../../Utils/QueryUtils";
|
import { QueryUtils } from "../../Utils/QueryUtils";
|
||||||
import SaveQueryIcon from "../../../images/save-cosmos.svg";
|
import SaveQueryIcon from "../../../images/save-cosmos.svg";
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
<div style="height: 100%" data-bind="react:queryComponentAdapter"></div>
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
import * as ViewModels from "../../Contracts/ViewModels";
|
|
||||||
import TabsBase from "./TabsBase";
|
|
||||||
import { QueryComponentAdapter } from "../Controls/Query/QueryComponentAdapter"
|
|
||||||
import { QueryComponentProps } from "../Controls/Query/QueryComponent";
|
|
||||||
|
|
||||||
export default class QueryTabV2 extends TabsBase {
|
|
||||||
public queryComponentAdapter: QueryComponentAdapter;
|
|
||||||
|
|
||||||
constructor(options: ViewModels.QueryTabOptions) {
|
|
||||||
super(options);
|
|
||||||
|
|
||||||
const props: QueryComponentProps = {
|
|
||||||
queryTab: this
|
|
||||||
};
|
|
||||||
this.queryComponentAdapter = new QueryComponentAdapter(props);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -12,7 +12,7 @@ import editable from "../../Common/EditableUtility";
|
|||||||
import Q from "q";
|
import Q from "q";
|
||||||
import SaveIcon from "../../../images/save-cosmos.svg";
|
import SaveIcon from "../../../images/save-cosmos.svg";
|
||||||
import TabsBase from "./TabsBase";
|
import TabsBase from "./TabsBase";
|
||||||
import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
import TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
||||||
import { Action } from "../../Shared/Telemetry/TelemetryConstants";
|
import { Action } from "../../Shared/Telemetry/TelemetryConstants";
|
||||||
import { PlatformType } from "../../PlatformType";
|
import { PlatformType } from "../../PlatformType";
|
||||||
import { RequestOptions } from "@azure/cosmos/dist-esm";
|
import { RequestOptions } from "@azure/cosmos/dist-esm";
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import * as ViewModels from "../../Contracts/ViewModels";
|
|||||||
import { Action } from "../../Shared/Telemetry/TelemetryConstants";
|
import { Action } from "../../Shared/Telemetry/TelemetryConstants";
|
||||||
import editable from "../../Common/EditableUtility";
|
import editable from "../../Common/EditableUtility";
|
||||||
import ScriptTabBase from "./ScriptTabBase";
|
import ScriptTabBase from "./ScriptTabBase";
|
||||||
import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
import TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
||||||
import ExecuteQueryIcon from "../../../images/ExecuteQuery.svg";
|
import ExecuteQueryIcon from "../../../images/ExecuteQuery.svg";
|
||||||
import StoredProcedure from "../Tree/StoredProcedure";
|
import StoredProcedure from "../Tree/StoredProcedure";
|
||||||
import { createStoredProcedure, updateStoredProcedure } from "../../Common/DocumentClientUtilityBase";
|
import { createStoredProcedure, updateStoredProcedure } from "../../Common/DocumentClientUtilityBase";
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ import UserDefinedFunctionTabTemplate from "./UserDefinedFunctionTab.html";
|
|||||||
import GalleryTabTemplate from "./GalleryTab.html";
|
import GalleryTabTemplate from "./GalleryTab.html";
|
||||||
import NotebookViewerTabTemplate from "./NotebookViewerTab.html";
|
import NotebookViewerTabTemplate from "./NotebookViewerTab.html";
|
||||||
import TabsManagerTemplate from "./TabsManager.html";
|
import TabsManagerTemplate from "./TabsManager.html";
|
||||||
import QueryTabV2Template from "./QueryTabV2.html";
|
|
||||||
|
|
||||||
export class TabComponent {
|
export class TabComponent {
|
||||||
constructor(data: any) {
|
constructor(data: any) {
|
||||||
@@ -124,15 +123,6 @@ export class QueryTab {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class QueryTabV2 {
|
|
||||||
constructor() {
|
|
||||||
return {
|
|
||||||
viewModel: TabComponent,
|
|
||||||
template: QueryTabV2Template
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class QueryTablesTab {
|
export class QueryTablesTab {
|
||||||
constructor() {
|
constructor() {
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import * as ViewModels from "../../Contracts/ViewModels";
|
|||||||
import { Action, ActionModifiers } from "../../Shared/Telemetry/TelemetryConstants";
|
import { Action, ActionModifiers } from "../../Shared/Telemetry/TelemetryConstants";
|
||||||
import { RouteHandler } from "../../RouteHandlers/RouteHandler";
|
import { RouteHandler } from "../../RouteHandlers/RouteHandler";
|
||||||
import { WaitsForTemplateViewModel } from "../WaitsForTemplateViewModel";
|
import { WaitsForTemplateViewModel } from "../WaitsForTemplateViewModel";
|
||||||
import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
import TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
||||||
import ThemeUtility from "../../Common/ThemeUtility";
|
import ThemeUtility from "../../Common/ThemeUtility";
|
||||||
import Explorer from "../Explorer";
|
import Explorer from "../Explorer";
|
||||||
import { CommandButtonComponentProps } from "../Controls/CommandButton/CommandButtonComponent";
|
import { CommandButtonComponentProps } from "../Controls/CommandButton/CommandButtonComponent";
|
||||||
|
|||||||
@@ -141,11 +141,6 @@
|
|||||||
<!-- ko if: $data.tabKind === 18 -->
|
<!-- ko if: $data.tabKind === 18 -->
|
||||||
<notebook-viewer-tab params="{data: $data}"></notebook-viewer-tab>
|
<notebook-viewer-tab params="{data: $data}"></notebook-viewer-tab>
|
||||||
<!-- /ko -->
|
<!-- /ko -->
|
||||||
|
|
||||||
<!-- ko if: $data.tabKind === 19 -->
|
|
||||||
<query-tab-v2 params="{data: $data}"></query-tab-v2>
|
|
||||||
<!-- /ko -->
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<!-- /ko -->
|
<!-- /ko -->
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import * as ViewModels from "../../Contracts/ViewModels";
|
|||||||
import { Action } from "../../Shared/Telemetry/TelemetryConstants";
|
import { Action } from "../../Shared/Telemetry/TelemetryConstants";
|
||||||
import ScriptTabBase from "./ScriptTabBase";
|
import ScriptTabBase from "./ScriptTabBase";
|
||||||
import editable from "../../Common/EditableUtility";
|
import editable from "../../Common/EditableUtility";
|
||||||
import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
import TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
||||||
import Trigger from "../Tree/Trigger";
|
import Trigger from "../Tree/Trigger";
|
||||||
import { createTrigger, updateTrigger } from "../../Common/DocumentClientUtilityBase";
|
import { createTrigger, updateTrigger } from "../../Common/DocumentClientUtilityBase";
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import * as DataModels from "../../Contracts/DataModels";
|
|||||||
import * as ViewModels from "../../Contracts/ViewModels";
|
import * as ViewModels from "../../Contracts/ViewModels";
|
||||||
import { Action } from "../../Shared/Telemetry/TelemetryConstants";
|
import { Action } from "../../Shared/Telemetry/TelemetryConstants";
|
||||||
import ScriptTabBase from "./ScriptTabBase";
|
import ScriptTabBase from "./ScriptTabBase";
|
||||||
import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
import TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
||||||
import UserDefinedFunction from "../Tree/UserDefinedFunction";
|
import UserDefinedFunction from "../Tree/UserDefinedFunction";
|
||||||
import { createUserDefinedFunction, updateUserDefinedFunction } from "../../Common/DocumentClientUtilityBase";
|
import { createUserDefinedFunction, updateUserDefinedFunction } from "../../Common/DocumentClientUtilityBase";
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import * as DataModels from "../../Contracts/DataModels";
|
|||||||
import * as ViewModels from "../../Contracts/ViewModels";
|
import * as ViewModels from "../../Contracts/ViewModels";
|
||||||
import { PlatformType } from "../../PlatformType";
|
import { PlatformType } from "../../PlatformType";
|
||||||
import { Action, ActionModifiers } from "../../Shared/Telemetry/TelemetryConstants";
|
import { Action, ActionModifiers } from "../../Shared/Telemetry/TelemetryConstants";
|
||||||
import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
import TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
||||||
import * as NotificationConsoleUtils from "../../Utils/NotificationConsoleUtils";
|
import * as NotificationConsoleUtils from "../../Utils/NotificationConsoleUtils";
|
||||||
import { OfferUtils } from "../../Utils/OfferUtils";
|
import { OfferUtils } from "../../Utils/OfferUtils";
|
||||||
import { StartUploadMessageParams, UploadDetails, UploadDetailsRecord } from "../../workers/upload/definitions";
|
import { StartUploadMessageParams, UploadDetails, UploadDetailsRecord } from "../../workers/upload/definitions";
|
||||||
@@ -42,8 +42,6 @@ import {
|
|||||||
readOffers
|
readOffers
|
||||||
} from "../../Common/DocumentClientUtilityBase";
|
} from "../../Common/DocumentClientUtilityBase";
|
||||||
import { userContext } from "../../UserContext";
|
import { userContext } from "../../UserContext";
|
||||||
import TabsBase from "../Tabs/TabsBase";
|
|
||||||
import QueryTabV2 from "../Tabs/QueryTabV2";
|
|
||||||
|
|
||||||
export default class Collection implements ViewModels.Collection {
|
export default class Collection implements ViewModels.Collection {
|
||||||
public nodeKind: string;
|
public nodeKind: string;
|
||||||
@@ -731,9 +729,8 @@ export default class Collection implements ViewModels.Collection {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public onNewQueryClick(source: any, event: MouseEvent, queryText?: string) {
|
public onNewQueryClick(source: any, event: MouseEvent, queryText?: string) {
|
||||||
const queryTabType = this.container.isQueryTabV2Enabled ? ViewModels.CollectionTabKind.QueryV2 : ViewModels.CollectionTabKind.Query
|
|
||||||
const collection: ViewModels.Collection = source.collection || source;
|
const collection: ViewModels.Collection = source.collection || source;
|
||||||
const id = this.container.tabsManager.getTabs(queryTabType).length + 1;
|
const id = this.container.tabsManager.getTabs(ViewModels.CollectionTabKind.Query).length + 1;
|
||||||
const title = "Query " + id;
|
const title = "Query " + id;
|
||||||
const startKey: number = TelemetryProcessor.traceStart(Action.Tab, {
|
const startKey: number = TelemetryProcessor.traceStart(Action.Tab, {
|
||||||
databaseAccountName: this.container.databaseAccount().name,
|
databaseAccountName: this.container.databaseAccount().name,
|
||||||
@@ -744,8 +741,8 @@ export default class Collection implements ViewModels.Collection {
|
|||||||
tabTitle: title
|
tabTitle: title
|
||||||
});
|
});
|
||||||
|
|
||||||
const queryTabProps : ViewModels.QueryTabOptions = {
|
const queryTab: QueryTab = new QueryTab({
|
||||||
tabKind: queryTabType,
|
tabKind: ViewModels.CollectionTabKind.Query,
|
||||||
title: title,
|
title: title,
|
||||||
tabPath: "",
|
tabPath: "",
|
||||||
collection: this,
|
collection: this,
|
||||||
@@ -757,9 +754,7 @@ export default class Collection implements ViewModels.Collection {
|
|||||||
partitionKey: collection.partitionKey,
|
partitionKey: collection.partitionKey,
|
||||||
onLoadStartKey: startKey,
|
onLoadStartKey: startKey,
|
||||||
onUpdateTabsButtons: this.container.onUpdateTabsButtons
|
onUpdateTabsButtons: this.container.onUpdateTabsButtons
|
||||||
}
|
});
|
||||||
|
|
||||||
const queryTab = this.container.isQueryTabV2Enabled ? new QueryTab(queryTabProps) : new QueryTabV2(queryTabProps)
|
|
||||||
|
|
||||||
this.container.tabsManager.activateNewTab(queryTab);
|
this.container.tabsManager.activateNewTab(queryTab);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import * as DataModels from "../../Contracts/DataModels";
|
|||||||
import { Action, ActionModifiers } from "../../Shared/Telemetry/TelemetryConstants";
|
import { Action, ActionModifiers } from "../../Shared/Telemetry/TelemetryConstants";
|
||||||
import DatabaseSettingsTab from "../Tabs/DatabaseSettingsTab";
|
import DatabaseSettingsTab from "../Tabs/DatabaseSettingsTab";
|
||||||
import Collection from "./Collection";
|
import Collection from "./Collection";
|
||||||
import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
import TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
||||||
import * as NotificationConsoleUtils from "../../Utils/NotificationConsoleUtils";
|
import * as NotificationConsoleUtils from "../../Utils/NotificationConsoleUtils";
|
||||||
import { ConsoleDataType } from "../Menus/NotificationConsole/NotificationConsoleComponent";
|
import { ConsoleDataType } from "../Menus/NotificationConsole/NotificationConsoleComponent";
|
||||||
import * as Logger from "../../Common/Logger";
|
import * as Logger from "../../Common/Logger";
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import DocumentId from "./DocumentId";
|
|||||||
import DocumentsTab from "../Tabs/DocumentsTab";
|
import DocumentsTab from "../Tabs/DocumentsTab";
|
||||||
import Q from "q";
|
import Q from "q";
|
||||||
import QueryTab from "../Tabs/QueryTab";
|
import QueryTab from "../Tabs/QueryTab";
|
||||||
import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
import TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
||||||
import Explorer from "../Explorer";
|
import Explorer from "../Explorer";
|
||||||
import TabsBase from "../Tabs/TabsBase";
|
import TabsBase from "../Tabs/TabsBase";
|
||||||
|
|
||||||
|
|||||||
@@ -1,112 +0,0 @@
|
|||||||
import Explorer from "../Explorer";
|
|
||||||
import * as ko from "knockout";
|
|
||||||
import { ResourceTreeAdapter } from "./ResourceTreeAdapter";
|
|
||||||
import * as ViewModels from "../../Contracts/ViewModels";
|
|
||||||
import TabsBase from "../Tabs/TabsBase";
|
|
||||||
|
|
||||||
describe("ResourceTreeAdapter", () => {
|
|
||||||
const mockContainer = (): Explorer =>
|
|
||||||
(({
|
|
||||||
selectedNode: ko.observable<ViewModels.TreeNode>({
|
|
||||||
nodeKind: "nodeKind",
|
|
||||||
rid: "rid",
|
|
||||||
id: ko.observable<string>("id")
|
|
||||||
}),
|
|
||||||
tabsManager: {
|
|
||||||
activeTab: ko.observable<TabsBase>({
|
|
||||||
tabKind: ViewModels.CollectionTabKind.Documents
|
|
||||||
} as TabsBase)
|
|
||||||
},
|
|
||||||
isNotebookEnabled: ko.observable<boolean>(true),
|
|
||||||
nonSystemDatabases: ko.observable<ViewModels.Database[]>([])
|
|
||||||
} as unknown) as Explorer);
|
|
||||||
|
|
||||||
// TODO isDataNodeSelected needs a better design and refactor, but for now, we protect some of the code paths
|
|
||||||
describe("isDataNodeSelected", () => {
|
|
||||||
it("it should not select if no selected node", () => {
|
|
||||||
const explorer = mockContainer();
|
|
||||||
explorer.selectedNode(undefined);
|
|
||||||
const resourceTreeAdapter = new ResourceTreeAdapter(explorer);
|
|
||||||
const isDataNodeSelected = resourceTreeAdapter.isDataNodeSelected("foo", "bar", undefined);
|
|
||||||
expect(isDataNodeSelected).toBeFalsy();
|
|
||||||
});
|
|
||||||
|
|
||||||
it("it should not select incorrect subnodekinds", () => {
|
|
||||||
const resourceTreeAdapter = new ResourceTreeAdapter(mockContainer());
|
|
||||||
const isDataNodeSelected = resourceTreeAdapter.isDataNodeSelected("foo", "bar", undefined);
|
|
||||||
expect(isDataNodeSelected).toBeFalsy();
|
|
||||||
});
|
|
||||||
|
|
||||||
it("it should not select if no active tab", () => {
|
|
||||||
const explorer = mockContainer();
|
|
||||||
explorer.tabsManager.activeTab(undefined);
|
|
||||||
const resourceTreeAdapter = new ResourceTreeAdapter(explorer);
|
|
||||||
const isDataNodeSelected = resourceTreeAdapter.isDataNodeSelected("foo", "bar", undefined);
|
|
||||||
expect(isDataNodeSelected).toBeFalsy();
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should select if correct database node regardless of subnodekinds", () => {
|
|
||||||
const subNodeKind = ViewModels.CollectionTabKind.Documents;
|
|
||||||
const explorer = mockContainer();
|
|
||||||
explorer.selectedNode(({
|
|
||||||
nodeKind: "Database",
|
|
||||||
rid: "dbrid",
|
|
||||||
id: ko.observable<string>("id"),
|
|
||||||
selectedSubnodeKind: ko.observable<ViewModels.CollectionTabKind>(subNodeKind)
|
|
||||||
} as unknown) as ViewModels.TreeNode);
|
|
||||||
const resourceTreeAdapter = new ResourceTreeAdapter(explorer);
|
|
||||||
const isDataNodeSelected = resourceTreeAdapter.isDataNodeSelected("dbrid", "Database", [
|
|
||||||
ViewModels.CollectionTabKind.Documents
|
|
||||||
]);
|
|
||||||
expect(isDataNodeSelected).toBeTruthy();
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should select correct collection node (documents or graph node)", () => {
|
|
||||||
let subNodeKind = ViewModels.CollectionTabKind.Documents;
|
|
||||||
const explorer = mockContainer();
|
|
||||||
explorer.tabsManager.activeTab({
|
|
||||||
tabKind: subNodeKind
|
|
||||||
} as TabsBase);
|
|
||||||
explorer.selectedNode(({
|
|
||||||
nodeKind: "Collection",
|
|
||||||
rid: "collrid",
|
|
||||||
id: ko.observable<string>("id"),
|
|
||||||
selectedSubnodeKind: ko.observable<ViewModels.CollectionTabKind>(subNodeKind)
|
|
||||||
} as unknown) as ViewModels.TreeNode);
|
|
||||||
const resourceTreeAdapter = new ResourceTreeAdapter(explorer);
|
|
||||||
let isDataNodeSelected = resourceTreeAdapter.isDataNodeSelected("collrid", "Collection", [subNodeKind]);
|
|
||||||
expect(isDataNodeSelected).toBeTruthy();
|
|
||||||
|
|
||||||
subNodeKind = ViewModels.CollectionTabKind.Graph;
|
|
||||||
explorer.tabsManager.activeTab({
|
|
||||||
tabKind: subNodeKind
|
|
||||||
} as TabsBase);
|
|
||||||
explorer.selectedNode(({
|
|
||||||
nodeKind: "Collection",
|
|
||||||
rid: "collrid",
|
|
||||||
id: ko.observable<string>("id"),
|
|
||||||
selectedSubnodeKind: ko.observable<ViewModels.CollectionTabKind>(subNodeKind)
|
|
||||||
} as unknown) as ViewModels.TreeNode);
|
|
||||||
isDataNodeSelected = resourceTreeAdapter.isDataNodeSelected("collrid", "Collection", [subNodeKind]);
|
|
||||||
expect(isDataNodeSelected).toBeTruthy();
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should not select incorrect collection node (e.g. Settings)", () => {
|
|
||||||
const explorer = mockContainer();
|
|
||||||
explorer.selectedNode(({
|
|
||||||
nodeKind: "Collection",
|
|
||||||
rid: "collrid",
|
|
||||||
id: ko.observable<string>("id"),
|
|
||||||
selectedSubnodeKind: ko.observable<ViewModels.CollectionTabKind>(ViewModels.CollectionTabKind.Documents)
|
|
||||||
} as unknown) as ViewModels.TreeNode);
|
|
||||||
explorer.tabsManager.activeTab({
|
|
||||||
tabKind: ViewModels.CollectionTabKind.Documents
|
|
||||||
} as TabsBase);
|
|
||||||
const resourceTreeAdapter = new ResourceTreeAdapter(explorer);
|
|
||||||
const isDataNodeSelected = resourceTreeAdapter.isDataNodeSelected("collrid", "Collection", [
|
|
||||||
ViewModels.CollectionTabKind.Settings
|
|
||||||
]);
|
|
||||||
expect(isDataNodeSelected).toBeFalsy();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@@ -19,7 +19,7 @@ import { ArrayHashMap } from "../../Common/ArrayHashMap";
|
|||||||
import { NotebookUtil } from "../Notebook/NotebookUtil";
|
import { NotebookUtil } from "../Notebook/NotebookUtil";
|
||||||
import _ from "underscore";
|
import _ from "underscore";
|
||||||
import { IPinnedRepo } from "../../Juno/JunoClient";
|
import { IPinnedRepo } from "../../Juno/JunoClient";
|
||||||
import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
import TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
||||||
import { Action, ActionModifiers } from "../../Shared/Telemetry/TelemetryConstants";
|
import { Action, ActionModifiers } from "../../Shared/Telemetry/TelemetryConstants";
|
||||||
import { Areas } from "../../Common/Constants";
|
import { Areas } from "../../Common/Constants";
|
||||||
import * as GitHubUtils from "../../Utils/GitHubUtils";
|
import * as GitHubUtils from "../../Utils/GitHubUtils";
|
||||||
@@ -191,7 +191,7 @@ export class ResourceTreeAdapter implements ReactAdapter {
|
|||||||
databaseNode.children.push({
|
databaseNode.children.push({
|
||||||
label: "Scale",
|
label: "Scale",
|
||||||
isSelected: () =>
|
isSelected: () =>
|
||||||
this.isDataNodeSelected(database.rid, "Database", [ViewModels.CollectionTabKind.DatabaseSettings]),
|
this.isDataNodeSelected(database.rid, "Database", ViewModels.CollectionTabKind.DatabaseSettings),
|
||||||
onClick: database.onSettingsClick.bind(database)
|
onClick: database.onSettingsClick.bind(database)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -235,18 +235,14 @@ export class ResourceTreeAdapter implements ReactAdapter {
|
|||||||
data: collection.rid
|
data: collection.rid
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
isSelected: () =>
|
isSelected: () => this.isDataNodeSelected(collection.rid, "Collection", ViewModels.CollectionTabKind.Documents),
|
||||||
this.isDataNodeSelected(collection.rid, "Collection", [
|
|
||||||
ViewModels.CollectionTabKind.Documents,
|
|
||||||
ViewModels.CollectionTabKind.Graph
|
|
||||||
]),
|
|
||||||
contextMenu: ResourceTreeContextMenuButtonFactory.createCollectionContextMenuButton(this.container, collection)
|
contextMenu: ResourceTreeContextMenuButtonFactory.createCollectionContextMenuButton(this.container, collection)
|
||||||
});
|
});
|
||||||
|
|
||||||
children.push({
|
children.push({
|
||||||
label: database.isDatabaseShared() || this.container.isServerlessEnabled() ? "Settings" : "Scale & Settings",
|
label: database.isDatabaseShared() || this.container.isServerlessEnabled() ? "Settings" : "Scale & Settings",
|
||||||
onClick: collection.onSettingsClick.bind(collection),
|
onClick: collection.onSettingsClick.bind(collection),
|
||||||
isSelected: () => this.isDataNodeSelected(collection.rid, "Collection", [ViewModels.CollectionTabKind.Settings])
|
isSelected: () => this.isDataNodeSelected(collection.rid, "Collection", ViewModels.CollectionTabKind.Settings)
|
||||||
});
|
});
|
||||||
|
|
||||||
if (ResourceTreeAdapter.showScriptNodes(this.container)) {
|
if (ResourceTreeAdapter.showScriptNodes(this.container)) {
|
||||||
@@ -268,8 +264,7 @@ export class ResourceTreeAdapter implements ReactAdapter {
|
|||||||
children.push({
|
children.push({
|
||||||
label: "Conflicts",
|
label: "Conflicts",
|
||||||
onClick: collection.onConflictsClick.bind(collection),
|
onClick: collection.onConflictsClick.bind(collection),
|
||||||
isSelected: () =>
|
isSelected: () => this.isDataNodeSelected(collection.rid, "Collection", ViewModels.CollectionTabKind.Conflicts)
|
||||||
this.isDataNodeSelected(collection.rid, "Collection", [ViewModels.CollectionTabKind.Conflicts])
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -307,7 +302,7 @@ export class ResourceTreeAdapter implements ReactAdapter {
|
|||||||
label: sp.id(),
|
label: sp.id(),
|
||||||
onClick: sp.open.bind(sp),
|
onClick: sp.open.bind(sp),
|
||||||
isSelected: () =>
|
isSelected: () =>
|
||||||
this.isDataNodeSelected(collection.rid, "Collection", [ViewModels.CollectionTabKind.StoredProcedures]),
|
this.isDataNodeSelected(collection.rid, "Collection", ViewModels.CollectionTabKind.StoredProcedures),
|
||||||
contextMenu: ResourceTreeContextMenuButtonFactory.createStoreProcedureContextMenuItems(this.container, sp)
|
contextMenu: ResourceTreeContextMenuButtonFactory.createStoreProcedureContextMenuItems(this.container, sp)
|
||||||
})),
|
})),
|
||||||
onClick: () => {
|
onClick: () => {
|
||||||
@@ -326,7 +321,7 @@ export class ResourceTreeAdapter implements ReactAdapter {
|
|||||||
label: udf.id(),
|
label: udf.id(),
|
||||||
onClick: udf.open.bind(udf),
|
onClick: udf.open.bind(udf),
|
||||||
isSelected: () =>
|
isSelected: () =>
|
||||||
this.isDataNodeSelected(collection.rid, "Collection", [ViewModels.CollectionTabKind.UserDefinedFunctions]),
|
this.isDataNodeSelected(collection.rid, "Collection", ViewModels.CollectionTabKind.UserDefinedFunctions),
|
||||||
contextMenu: ResourceTreeContextMenuButtonFactory.createUserDefinedFunctionContextMenuItems(this.container, udf)
|
contextMenu: ResourceTreeContextMenuButtonFactory.createUserDefinedFunctionContextMenuItems(this.container, udf)
|
||||||
})),
|
})),
|
||||||
onClick: () => {
|
onClick: () => {
|
||||||
@@ -344,8 +339,7 @@ export class ResourceTreeAdapter implements ReactAdapter {
|
|||||||
children: collection.triggers().map((trigger: Trigger) => ({
|
children: collection.triggers().map((trigger: Trigger) => ({
|
||||||
label: trigger.id(),
|
label: trigger.id(),
|
||||||
onClick: trigger.open.bind(trigger),
|
onClick: trigger.open.bind(trigger),
|
||||||
isSelected: () =>
|
isSelected: () => this.isDataNodeSelected(collection.rid, "Collection", ViewModels.CollectionTabKind.Triggers),
|
||||||
this.isDataNodeSelected(collection.rid, "Collection", [ViewModels.CollectionTabKind.Triggers]),
|
|
||||||
contextMenu: ResourceTreeContextMenuButtonFactory.createTriggerContextMenuItems(this.container, trigger)
|
contextMenu: ResourceTreeContextMenuButtonFactory.createTriggerContextMenuItems(this.container, trigger)
|
||||||
})),
|
})),
|
||||||
onClick: () => {
|
onClick: () => {
|
||||||
@@ -703,19 +697,13 @@ export class ResourceTreeAdapter implements ReactAdapter {
|
|||||||
window.requestAnimationFrame(() => this.parameters(Date.now()));
|
window.requestAnimationFrame(() => this.parameters(Date.now()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
private isDataNodeSelected(rid: string, nodeKind: string, subnodeKind: ViewModels.CollectionTabKind): boolean {
|
||||||
* public for testing purposes
|
|
||||||
* @param rid
|
|
||||||
* @param nodeKind
|
|
||||||
* @param subnodeKinds
|
|
||||||
*/
|
|
||||||
public isDataNodeSelected(rid: string, nodeKind: string, subnodeKinds: ViewModels.CollectionTabKind[]): boolean {
|
|
||||||
if (!this.container.selectedNode || !this.container.selectedNode()) {
|
if (!this.container.selectedNode || !this.container.selectedNode()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const selectedNode = this.container.selectedNode();
|
const selectedNode = this.container.selectedNode();
|
||||||
|
|
||||||
if (subnodeKinds === undefined || !Array.isArray(subnodeKinds)) {
|
if (subnodeKind === undefined) {
|
||||||
return selectedNode.rid === rid && selectedNode.nodeKind === nodeKind;
|
return selectedNode.rid === rid && selectedNode.nodeKind === nodeKind;
|
||||||
} else {
|
} else {
|
||||||
const activeTab = this.container.tabsManager.activeTab();
|
const activeTab = this.container.tabsManager.activeTab();
|
||||||
@@ -728,10 +716,10 @@ export class ResourceTreeAdapter implements ReactAdapter {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
activeTab &&
|
activeTab &&
|
||||||
subnodeKinds.includes(activeTab.tabKind) &&
|
activeTab.tabKind === subnodeKind &&
|
||||||
selectedNode.rid === rid &&
|
selectedNode.rid === rid &&
|
||||||
selectedSubnodeKind !== undefined &&
|
selectedSubnodeKind !== undefined &&
|
||||||
subnodeKinds.includes(selectedSubnodeKind)
|
selectedSubnodeKind === subnodeKind
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import * as DataModels from "../../Contracts/DataModels";
|
|||||||
import { Action, ActionModifiers } from "../../Shared/Telemetry/TelemetryConstants";
|
import { Action, ActionModifiers } from "../../Shared/Telemetry/TelemetryConstants";
|
||||||
|
|
||||||
import StoredProcedureTab from "../Tabs/StoredProcedureTab";
|
import StoredProcedureTab from "../Tabs/StoredProcedureTab";
|
||||||
import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
import TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
||||||
import Explorer from "../Explorer";
|
import Explorer from "../Explorer";
|
||||||
import { deleteStoredProcedure, executeStoredProcedure } from "../../Common/DocumentClientUtilityBase";
|
import { deleteStoredProcedure, executeStoredProcedure } from "../../Common/DocumentClientUtilityBase";
|
||||||
import TabsBase from "../Tabs/TabsBase";
|
import TabsBase from "../Tabs/TabsBase";
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import * as Constants from "../../Common/Constants";
|
|||||||
import * as DataModels from "../../Contracts/DataModels";
|
import * as DataModels from "../../Contracts/DataModels";
|
||||||
import { Action, ActionModifiers } from "../../Shared/Telemetry/TelemetryConstants";
|
import { Action, ActionModifiers } from "../../Shared/Telemetry/TelemetryConstants";
|
||||||
import TriggerTab from "../Tabs/TriggerTab";
|
import TriggerTab from "../Tabs/TriggerTab";
|
||||||
import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
import TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
||||||
import Explorer from "../Explorer";
|
import Explorer from "../Explorer";
|
||||||
import { deleteTrigger } from "../../Common/DocumentClientUtilityBase";
|
import { deleteTrigger } from "../../Common/DocumentClientUtilityBase";
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import * as Constants from "../../Common/Constants";
|
|||||||
import * as DataModels from "../../Contracts/DataModels";
|
import * as DataModels from "../../Contracts/DataModels";
|
||||||
import { Action, ActionModifiers } from "../../Shared/Telemetry/TelemetryConstants";
|
import { Action, ActionModifiers } from "../../Shared/Telemetry/TelemetryConstants";
|
||||||
import UserDefinedFunctionTab from "../Tabs/UserDefinedFunctionTab";
|
import UserDefinedFunctionTab from "../Tabs/UserDefinedFunctionTab";
|
||||||
import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
import TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
||||||
import Explorer from "../Explorer";
|
import Explorer from "../Explorer";
|
||||||
import { deleteUserDefinedFunction } from "../../Common/DocumentClientUtilityBase";
|
import { deleteUserDefinedFunction } from "../../Common/DocumentClientUtilityBase";
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ import { MeControlComponentAdapter } from "./Explorer/Menus/NavBar/MeControlComp
|
|||||||
import { MessageTypes } from "./Contracts/ExplorerContracts";
|
import { MessageTypes } from "./Contracts/ExplorerContracts";
|
||||||
import * as ReactBindingHandler from "./Bindings/ReactBindingHandler";
|
import * as ReactBindingHandler from "./Bindings/ReactBindingHandler";
|
||||||
import { SwitchDirectoryPane, SwitchDirectoryPaneComponent } from "./Explorer/Panes/SwitchDirectoryPane";
|
import { SwitchDirectoryPane, SwitchDirectoryPaneComponent } from "./Explorer/Panes/SwitchDirectoryPane";
|
||||||
import * as TelemetryProcessor from "./Shared/Telemetry/TelemetryProcessor";
|
import TelemetryProcessor from "./Shared/Telemetry/TelemetryProcessor";
|
||||||
import { isInvalidParentFrameOrigin } from "./Utils/MessageValidation";
|
import { isInvalidParentFrameOrigin } from "./Utils/MessageValidation";
|
||||||
import "../less/hostedexplorer.less";
|
import "../less/hostedexplorer.less";
|
||||||
import "./Explorer/Menus/NavBar/MeControlComponent.less";
|
import "./Explorer/Menus/NavBar/MeControlComponent.less";
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ import "url-polyfill/url-polyfill.min";
|
|||||||
// import "./ReactDevTools"
|
// import "./ReactDevTools"
|
||||||
|
|
||||||
import * as ko from "knockout";
|
import * as ko from "knockout";
|
||||||
import * as TelemetryProcessor from "./Shared/Telemetry/TelemetryProcessor";
|
import TelemetryProcessor from "./Shared/Telemetry/TelemetryProcessor";
|
||||||
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";
|
||||||
|
|
||||||
|
|||||||
@@ -1,64 +1,162 @@
|
|||||||
import * as ko from "knockout";
|
import * as SharedConstants from "../Shared/Constants";
|
||||||
import { Collection, Database } from "../Contracts/ViewModels";
|
import { AddDbUtilities } from "../Shared/AddDatabaseUtility";
|
||||||
import { getMaxThroughput } from "./AddCollectionUtility";
|
import { CreateCollectionUtilities, CreateSqlCollectionUtilities, Utilities } from "./AddCollectionUtility";
|
||||||
import Explorer from "../Explorer/Explorer";
|
jest.mock("AddDatabaseUtility");
|
||||||
|
|
||||||
describe("getMaxThroughput", () => {
|
const armEndpoint = "https://management.azure.com";
|
||||||
it("default unlimited throughput setting", () => {
|
|
||||||
const defaults = {
|
|
||||||
storage: "100",
|
|
||||||
throughput: {
|
|
||||||
fixed: 400,
|
|
||||||
unlimited: 400,
|
|
||||||
unlimitedmax: 1000000,
|
|
||||||
unlimitedmin: 400,
|
|
||||||
shared: 400
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
expect(getMaxThroughput(defaults, {} as Explorer)).toEqual(defaults.throughput.unlimited);
|
describe("Add Collection Utitlity", () => {
|
||||||
});
|
describe("createSqlCollection", () => {
|
||||||
|
it("should invoke createSqlCollectionWithARM if create database is false", () => {
|
||||||
describe("no unlimited throughput setting", () => {
|
const properties = {
|
||||||
const defaults = {
|
uniqueKeyPolicy: { uniqueKeys: [{ paths: [""] }] },
|
||||||
storage: "100",
|
cd: false,
|
||||||
throughput: {
|
coll: "abc-collection",
|
||||||
fixed: 400,
|
db: "a1-db",
|
||||||
unlimited: {
|
dba: "main",
|
||||||
collectionThreshold: 3,
|
offerThroughput: 50000,
|
||||||
lessThanOrEqualToThreshold: 400,
|
pk: "state",
|
||||||
greatThanThreshold: 500
|
sid: "a1",
|
||||||
},
|
rg: "b1",
|
||||||
unlimitedmax: 1000000,
|
st: true,
|
||||||
unlimitedmin: 400,
|
defaultTtl: -1,
|
||||||
shared: 400
|
indexingPolicy: SharedConstants.IndexingPolicies.AllPropertiesIndexed,
|
||||||
}
|
partitionKeyVersion: 2
|
||||||
};
|
};
|
||||||
|
const additionalOptions = {};
|
||||||
const mockCollection1 = { id: ko.observable("collection1") } as Collection;
|
const createSqlCollectionWithARMSpy = jest.spyOn(CreateSqlCollectionUtilities, "createSqlCollectionWithARM");
|
||||||
const mockCollection2 = { id: ko.observable("collection2") } as Collection;
|
CreateSqlCollectionUtilities.createSqlCollection(
|
||||||
const mockCollection3 = { id: ko.observable("collection3") } as Collection;
|
armEndpoint,
|
||||||
const mockCollection4 = { id: ko.observable("collection4") } as Collection;
|
properties.db,
|
||||||
const mockDatabase = {} as Database;
|
properties.defaultTtl,
|
||||||
const mockContainer = {
|
properties.coll,
|
||||||
databases: ko.observableArray([mockDatabase])
|
properties.indexingPolicy,
|
||||||
} as Explorer;
|
properties.offerThroughput,
|
||||||
|
properties.pk,
|
||||||
it("less than or equal to collection threshold", () => {
|
properties.partitionKeyVersion,
|
||||||
mockDatabase.collections = ko.observableArray([mockCollection1, mockCollection2]);
|
properties.cd,
|
||||||
expect(getMaxThroughput(defaults, mockContainer)).toEqual(
|
properties.st,
|
||||||
defaults.throughput.unlimited.lessThanOrEqualToThreshold
|
properties.sid,
|
||||||
|
properties.rg,
|
||||||
|
properties.dba,
|
||||||
|
properties.uniqueKeyPolicy,
|
||||||
|
additionalOptions
|
||||||
);
|
);
|
||||||
|
expect(createSqlCollectionWithARMSpy).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("exceeds collection threshold", () => {
|
it("should invoke createSqlDatabase + createSqlCollectionWithARM if create database is true", () => {
|
||||||
mockDatabase.collections = ko.observableArray([
|
const properties = {
|
||||||
mockCollection1,
|
uniqueKeyPolicy: { uniqueKeys: [{ paths: [""] }] },
|
||||||
mockCollection2,
|
cd: true,
|
||||||
mockCollection3,
|
coll: "abc-collection",
|
||||||
mockCollection4
|
db: "a1-db",
|
||||||
]);
|
dba: "main",
|
||||||
expect(getMaxThroughput(defaults, mockContainer)).toEqual(defaults.throughput.unlimited.greatThanThreshold);
|
offerThroughput: 50000,
|
||||||
|
pk: "state",
|
||||||
|
sid: "a1",
|
||||||
|
rg: "b1",
|
||||||
|
st: true,
|
||||||
|
analyticalStorageTtl: -1,
|
||||||
|
indexingPolicy: SharedConstants.IndexingPolicies.AllPropertiesIndexed,
|
||||||
|
partitionKeyVersion: 2
|
||||||
|
};
|
||||||
|
const additionalOptions = {};
|
||||||
|
const createSqlCollectionWithARMSpy = jest.spyOn(CreateSqlCollectionUtilities, "createSqlCollectionWithARM");
|
||||||
|
const createSqlDatabaseSpy = jest.spyOn(AddDbUtilities, "createSqlDatabase");
|
||||||
|
CreateSqlCollectionUtilities.createSqlCollection(
|
||||||
|
armEndpoint,
|
||||||
|
properties.db,
|
||||||
|
properties.analyticalStorageTtl,
|
||||||
|
properties.coll,
|
||||||
|
properties.indexingPolicy,
|
||||||
|
properties.offerThroughput,
|
||||||
|
properties.pk,
|
||||||
|
properties.partitionKeyVersion,
|
||||||
|
properties.cd,
|
||||||
|
properties.st,
|
||||||
|
properties.sid,
|
||||||
|
properties.rg,
|
||||||
|
properties.dba,
|
||||||
|
properties.uniqueKeyPolicy,
|
||||||
|
additionalOptions
|
||||||
|
);
|
||||||
|
expect(createSqlCollectionWithARMSpy).toHaveBeenCalled();
|
||||||
|
expect(createSqlDatabaseSpy).toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("Add Collection Utitlity", () => {
|
||||||
|
describe("createGremlinGraph", () => {
|
||||||
|
it("should invoke createGremlinGraphWithARM if create database is false", () => {
|
||||||
|
const properties = {
|
||||||
|
cd: false,
|
||||||
|
coll: "abc-collection",
|
||||||
|
db: "a1-db",
|
||||||
|
dba: "main",
|
||||||
|
offerThroughput: 50000,
|
||||||
|
pk: "state",
|
||||||
|
sid: "a1",
|
||||||
|
rg: "b1",
|
||||||
|
st: true,
|
||||||
|
indexingPolicy: SharedConstants.IndexingPolicies.AllPropertiesIndexed,
|
||||||
|
partitionKeyVersion: 2
|
||||||
|
};
|
||||||
|
const additionalOptions = {};
|
||||||
|
const createGremlinGraphWithARMSpy = jest.spyOn(CreateCollectionUtilities, "createGremlinGraphWithARM");
|
||||||
|
CreateCollectionUtilities.createGremlinGraph(
|
||||||
|
armEndpoint,
|
||||||
|
properties.db,
|
||||||
|
properties.coll,
|
||||||
|
properties.indexingPolicy,
|
||||||
|
properties.offerThroughput,
|
||||||
|
properties.pk,
|
||||||
|
properties.partitionKeyVersion,
|
||||||
|
properties.cd,
|
||||||
|
properties.st,
|
||||||
|
properties.sid,
|
||||||
|
properties.rg,
|
||||||
|
properties.dba,
|
||||||
|
additionalOptions
|
||||||
|
);
|
||||||
|
expect(createGremlinGraphWithARMSpy).toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should invoke createGremlinDatabase + createGremlinGraphWithARM if create database is true", () => {
|
||||||
|
const properties = {
|
||||||
|
cd: true,
|
||||||
|
coll: "abc-collection",
|
||||||
|
db: "a1-db",
|
||||||
|
dba: "main",
|
||||||
|
offerThroughput: 50000,
|
||||||
|
pk: "state",
|
||||||
|
sid: "a1",
|
||||||
|
rg: "b1",
|
||||||
|
st: true,
|
||||||
|
indexingPolicy: SharedConstants.IndexingPolicies.AllPropertiesIndexed,
|
||||||
|
partitionKeyVersion: 2
|
||||||
|
};
|
||||||
|
const additionalOptions = {};
|
||||||
|
const createGremlinGraphWithARMSpy = jest.spyOn(CreateCollectionUtilities, "createGremlinGraphWithARM");
|
||||||
|
const createGremlinDatabaseSpy = jest.spyOn(AddDbUtilities, "createGremlinDatabase");
|
||||||
|
CreateCollectionUtilities.createGremlinGraph(
|
||||||
|
armEndpoint,
|
||||||
|
properties.db,
|
||||||
|
properties.coll,
|
||||||
|
properties.indexingPolicy,
|
||||||
|
properties.offerThroughput,
|
||||||
|
properties.pk,
|
||||||
|
properties.partitionKeyVersion,
|
||||||
|
properties.cd,
|
||||||
|
properties.st,
|
||||||
|
properties.sid,
|
||||||
|
properties.rg,
|
||||||
|
properties.dba,
|
||||||
|
additionalOptions
|
||||||
|
);
|
||||||
|
expect(createGremlinDatabaseSpy).toHaveBeenCalled();
|
||||||
|
expect(createGremlinGraphWithARMSpy).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,23 +1,303 @@
|
|||||||
import { any } from "underscore";
|
import * as _ from "underscore";
|
||||||
import { CollectionCreationDefaults } from "../Contracts/ViewModels";
|
import * as DataExplorerConstants from "../Common/Constants";
|
||||||
|
import * as DataModels from "../Contracts/DataModels";
|
||||||
|
import * as SharedConstants from "./Constants";
|
||||||
|
import * as ViewModels from "../Contracts/ViewModels";
|
||||||
|
import { AddDbUtilities } from "../Shared/AddDatabaseUtility";
|
||||||
|
import { ConsoleDataType } from "../Explorer/Menus/NotificationConsole/NotificationConsoleComponent";
|
||||||
|
import { HttpStatusCodes } from "../Common/Constants";
|
||||||
|
import { sendMessage } from "../Common/MessageHandler";
|
||||||
|
import { MessageTypes } from "../Contracts/ExplorerContracts";
|
||||||
|
import * as NotificationConsoleUtils from "../Utils/NotificationConsoleUtils";
|
||||||
|
import { ResourceProviderClient } from "../ResourceProvider/ResourceProviderClient";
|
||||||
import Explorer from "../Explorer/Explorer";
|
import Explorer from "../Explorer/Explorer";
|
||||||
|
import { userContext } from "../UserContext";
|
||||||
|
|
||||||
export const getMaxThroughput = (defaults: CollectionCreationDefaults, container: Explorer): number => {
|
export class CreateSqlCollectionUtilities {
|
||||||
const throughput = defaults.throughput.unlimited;
|
public static createSqlCollection(
|
||||||
if (typeof throughput === "number") {
|
armEndpoint: string,
|
||||||
return throughput;
|
databaseId: string,
|
||||||
} else {
|
analyticalStorageTtl: number,
|
||||||
return _exceedsThreshold(throughput.collectionThreshold, container)
|
collectionId: string,
|
||||||
? throughput.greatThanThreshold
|
indexingPolicy: DataModels.IndexingPolicy,
|
||||||
: throughput.lessThanOrEqualToThreshold;
|
offerThroughput: number,
|
||||||
|
partitionKey: string,
|
||||||
|
partitionKeyVersion: number,
|
||||||
|
createDatabase: boolean,
|
||||||
|
useDatabaseSharedOffer: boolean,
|
||||||
|
sid: string,
|
||||||
|
rg: string,
|
||||||
|
dba: string,
|
||||||
|
uniqueKeyPolicy: DataModels.UniqueKeyPolicy,
|
||||||
|
additionalOptions: DataModels.RpOptions
|
||||||
|
): Promise<DataModels.CreateCollectionWithRpResponse> {
|
||||||
|
const params: DataModels.SqlCollectionParameters = {
|
||||||
|
uniqueKeyPolicy,
|
||||||
|
db: databaseId,
|
||||||
|
coll: collectionId,
|
||||||
|
pk: partitionKey,
|
||||||
|
offerThroughput,
|
||||||
|
cd: createDatabase,
|
||||||
|
st: useDatabaseSharedOffer,
|
||||||
|
sid,
|
||||||
|
rg,
|
||||||
|
dba,
|
||||||
|
analyticalStorageTtl,
|
||||||
|
indexingPolicy,
|
||||||
|
partitionKeyVersion
|
||||||
|
};
|
||||||
|
|
||||||
|
if (params.cd) {
|
||||||
|
return AddDbUtilities.createSqlDatabase(armEndpoint, params, additionalOptions).then(() => {
|
||||||
|
return CreateSqlCollectionUtilities.createSqlCollectionWithARM(armEndpoint, params, additionalOptions);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return CreateSqlCollectionUtilities.createSqlCollectionWithARM(armEndpoint, params, additionalOptions);
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
const _exceedsThreshold = (unlimitedThreshold: number, container: Explorer): boolean => {
|
public static async createSqlCollectionWithARM(
|
||||||
const databases = (container && container.databases && container.databases()) || [];
|
armEndpoint: string,
|
||||||
return any(
|
params: DataModels.SqlCollectionParameters,
|
||||||
databases,
|
rpOptions: DataModels.RpOptions
|
||||||
database =>
|
): Promise<DataModels.CreateCollectionWithRpResponse> {
|
||||||
database && database.collections && database.collections() && database.collections().length > unlimitedThreshold
|
const rpPayloadToCreateCollection: DataModels.SqlCollectionCreationRequest = {
|
||||||
);
|
properties: {
|
||||||
};
|
resource: {
|
||||||
|
id: params.coll,
|
||||||
|
partitionKey: {
|
||||||
|
paths: [params.pk],
|
||||||
|
kind: "Hash",
|
||||||
|
version: params.partitionKeyVersion
|
||||||
|
}
|
||||||
|
},
|
||||||
|
options: {}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
if (params.analyticalStorageTtl) {
|
||||||
|
rpPayloadToCreateCollection.properties.resource.analyticalStorageTtl = params.analyticalStorageTtl;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (params.indexingPolicy) {
|
||||||
|
rpPayloadToCreateCollection.properties.resource.indexingPolicy = params.indexingPolicy;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!params.st) {
|
||||||
|
if (rpOptions) {
|
||||||
|
rpPayloadToCreateCollection.properties.options = rpOptions;
|
||||||
|
} else {
|
||||||
|
rpPayloadToCreateCollection.properties.options["throughput"] =
|
||||||
|
params.offerThroughput && params.offerThroughput.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (params.uniqueKeyPolicy) {
|
||||||
|
rpPayloadToCreateCollection.properties.resource.uniqueKeyPolicy = params.uniqueKeyPolicy;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
let response = await new ResourceProviderClient<DataModels.CreateCollectionWithRpResponse>(armEndpoint).putAsync(
|
||||||
|
CreateSqlCollectionUtilities.getSqlCollectionUri(params),
|
||||||
|
DataExplorerConstants.ArmApiVersions.publicVersion,
|
||||||
|
rpPayloadToCreateCollection
|
||||||
|
);
|
||||||
|
return response;
|
||||||
|
} catch (response) {
|
||||||
|
NotificationConsoleUtils.logConsoleMessage(
|
||||||
|
ConsoleDataType.Error,
|
||||||
|
`Error creating collection: ${JSON.stringify(response)}`
|
||||||
|
);
|
||||||
|
if (response.status === HttpStatusCodes.Forbidden) {
|
||||||
|
sendMessage({ type: MessageTypes.ForbiddenError });
|
||||||
|
}
|
||||||
|
throw new Error(`Error creating collection`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static getSqlCollectionUri(params: DataModels.SqlCollectionParameters): string {
|
||||||
|
return `subscriptions/${params.sid}/resourceGroups/${params.rg}/providers/Microsoft.DocumentDB/databaseAccounts/${params.dba}/sqlDatabases/${params.db}/containers/${params.coll}`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class CreateCollectionUtilities {
|
||||||
|
public static createGremlinGraph(
|
||||||
|
armEndpoint: string,
|
||||||
|
databaseId: string,
|
||||||
|
collectionId: string,
|
||||||
|
indexingPolicy: DataModels.IndexingPolicy,
|
||||||
|
offerThroughput: number,
|
||||||
|
partitionKey: string,
|
||||||
|
partitionKeyVersion: number,
|
||||||
|
createDatabase: boolean,
|
||||||
|
useDatabaseSharedOffer: boolean,
|
||||||
|
sid: string,
|
||||||
|
rg: string,
|
||||||
|
dba: string,
|
||||||
|
additionalOptions: DataModels.RpOptions
|
||||||
|
): Promise<DataModels.CreateCollectionWithRpResponse> {
|
||||||
|
const params: DataModels.GraphParameters = {
|
||||||
|
db: databaseId,
|
||||||
|
coll: collectionId,
|
||||||
|
pk: partitionKey,
|
||||||
|
offerThroughput,
|
||||||
|
cd: createDatabase,
|
||||||
|
st: useDatabaseSharedOffer,
|
||||||
|
sid,
|
||||||
|
rg,
|
||||||
|
dba,
|
||||||
|
indexingPolicy,
|
||||||
|
partitionKeyVersion
|
||||||
|
};
|
||||||
|
|
||||||
|
if (params.cd) {
|
||||||
|
return AddDbUtilities.createGremlinDatabase(armEndpoint, params, additionalOptions).then(() => {
|
||||||
|
return CreateCollectionUtilities.createGremlinGraphWithARM(armEndpoint, params, additionalOptions);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return CreateCollectionUtilities.createGremlinGraphWithARM(armEndpoint, params, additionalOptions);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static async createGremlinGraphWithARM(
|
||||||
|
armEndpoint: string,
|
||||||
|
params: DataModels.GraphParameters,
|
||||||
|
rpOptions: DataModels.RpOptions
|
||||||
|
): Promise<DataModels.CreateCollectionWithRpResponse> {
|
||||||
|
const rpPayloadToCreateCollection: DataModels.GraphCreationRequest = {
|
||||||
|
properties: {
|
||||||
|
resource: {
|
||||||
|
id: params.coll,
|
||||||
|
partitionKey: {
|
||||||
|
paths: [params.pk],
|
||||||
|
kind: "Hash",
|
||||||
|
version: params.partitionKeyVersion
|
||||||
|
}
|
||||||
|
},
|
||||||
|
options: {}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
if (params.indexingPolicy) {
|
||||||
|
rpPayloadToCreateCollection.properties.resource.indexingPolicy = params.indexingPolicy;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!params.st) {
|
||||||
|
if (rpOptions) {
|
||||||
|
rpPayloadToCreateCollection.properties.options = rpOptions;
|
||||||
|
} else {
|
||||||
|
rpPayloadToCreateCollection.properties.options["throughput"] =
|
||||||
|
params.offerThroughput && params.offerThroughput.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
let response = await new ResourceProviderClient<DataModels.CreateCollectionWithRpResponse>(armEndpoint).putAsync(
|
||||||
|
CreateCollectionUtilities.getGremlinGraphUri(params),
|
||||||
|
DataExplorerConstants.ArmApiVersions.publicVersion,
|
||||||
|
rpPayloadToCreateCollection
|
||||||
|
);
|
||||||
|
return response;
|
||||||
|
} catch (response) {
|
||||||
|
NotificationConsoleUtils.logConsoleMessage(
|
||||||
|
ConsoleDataType.Error,
|
||||||
|
`Error creating graph: ${JSON.stringify(response)}`
|
||||||
|
);
|
||||||
|
if (response.status === HttpStatusCodes.Forbidden) {
|
||||||
|
sendMessage({ type: MessageTypes.ForbiddenError });
|
||||||
|
}
|
||||||
|
throw new Error(`Error creating graph`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static getGremlinGraphUri(params: DataModels.GraphParameters): string {
|
||||||
|
return `subscriptions/${params.sid}/resourceGroups/${params.rg}/providers/Microsoft.DocumentDB/databaseAccounts/${params.dba}/gremlinDatabases/${params.db}/graphs/${params.coll}`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export class Utilities {
|
||||||
|
public static async createAzureTableWithARM(
|
||||||
|
armEndpoint: string,
|
||||||
|
params: DataModels.CreateDatabaseAndCollectionRequest,
|
||||||
|
rpOptions: DataModels.RpOptions
|
||||||
|
): Promise<any> {
|
||||||
|
const rpPayloadToCreateDatabase: DataModels.CreationRequest = {
|
||||||
|
properties: {
|
||||||
|
resource: {
|
||||||
|
id: params.collectionId
|
||||||
|
},
|
||||||
|
options: {}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
if (!params.databaseLevelThroughput) {
|
||||||
|
if (rpOptions) {
|
||||||
|
rpPayloadToCreateDatabase.properties.options = rpOptions;
|
||||||
|
} else {
|
||||||
|
rpPayloadToCreateDatabase.properties.options["throughput"] =
|
||||||
|
params.offerThroughput && params.offerThroughput.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
await new ResourceProviderClient(armEndpoint).putAsync(
|
||||||
|
Utilities._getAzureTableUri(params),
|
||||||
|
DataExplorerConstants.ArmApiVersions.publicVersion,
|
||||||
|
rpPayloadToCreateDatabase
|
||||||
|
);
|
||||||
|
} catch (reason) {
|
||||||
|
NotificationConsoleUtils.logConsoleMessage(
|
||||||
|
ConsoleDataType.Error,
|
||||||
|
`Error creating table: ${JSON.stringify(reason)}, Payload: ${params}`
|
||||||
|
);
|
||||||
|
if (reason.status === HttpStatusCodes.Forbidden) {
|
||||||
|
sendMessage({ type: MessageTypes.ForbiddenError });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
throw new Error(`Error creating table`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static getMaxRUForStorageOption(
|
||||||
|
defaults: ViewModels.CollectionCreationDefaults,
|
||||||
|
storageOption: string
|
||||||
|
): number {
|
||||||
|
if (storageOption === SharedConstants.CollectionCreation.storage10Gb) {
|
||||||
|
return SharedConstants.CollectionCreation.DefaultCollectionRUs10K;
|
||||||
|
}
|
||||||
|
|
||||||
|
return defaults.throughput.unlimitedmax;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static getMinRUForStorageOption(
|
||||||
|
defaults: ViewModels.CollectionCreationDefaults,
|
||||||
|
storageOption: string
|
||||||
|
): number {
|
||||||
|
if (storageOption === SharedConstants.CollectionCreation.storage10Gb) {
|
||||||
|
return SharedConstants.CollectionCreation.DefaultCollectionRUs400;
|
||||||
|
}
|
||||||
|
|
||||||
|
return defaults.throughput.unlimitedmin;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static getMaxThroughput(defaults: ViewModels.CollectionCreationDefaults, container: Explorer): number {
|
||||||
|
const throughput = defaults.throughput.unlimited;
|
||||||
|
if (typeof throughput === "number") {
|
||||||
|
return throughput;
|
||||||
|
} else {
|
||||||
|
return this._exceedsThreshold(throughput.collectionThreshold, container)
|
||||||
|
? throughput.greatThanThreshold
|
||||||
|
: throughput.lessThanOrEqualToThreshold;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static _exceedsThreshold(unlimitedThreshold: number, container: Explorer): boolean {
|
||||||
|
const databases = (container && container.databases && container.databases()) || [];
|
||||||
|
return _.any(
|
||||||
|
databases,
|
||||||
|
database =>
|
||||||
|
database && database.collections && database.collections() && database.collections().length > unlimitedThreshold
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static _getAzureTableUri(params: DataModels.CreateDatabaseAndCollectionRequest): string {
|
||||||
|
return `subscriptions/${userContext.subscriptionId}/resourceGroups/${userContext.resourceGroup}/providers/Microsoft.DocumentDB/databaseAccounts/${userContext.databaseAccount.name}/tables/${params.collectionId}`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
153
src/Shared/AddDatabaseUtility.test.ts
Normal file
153
src/Shared/AddDatabaseUtility.test.ts
Normal file
@@ -0,0 +1,153 @@
|
|||||||
|
import { AddDbUtilities } from "./AddDatabaseUtility";
|
||||||
|
import { ResourceProviderClient } from "../ResourceProvider/ResourceProviderClient";
|
||||||
|
jest.mock("../ResourceProvider/ResourceProviderClient.ts");
|
||||||
|
|
||||||
|
describe("Add Database Utitlity", () => {
|
||||||
|
const armEndpoint = "https://management.azure.com";
|
||||||
|
const properties = {
|
||||||
|
pk: "state",
|
||||||
|
coll: "abc-collection",
|
||||||
|
cd: true,
|
||||||
|
db: "a1-db",
|
||||||
|
offerThroughput: 50000,
|
||||||
|
st: true,
|
||||||
|
sid: "a1",
|
||||||
|
rg: "b1",
|
||||||
|
dba: "main"
|
||||||
|
};
|
||||||
|
|
||||||
|
describe("getRpClient", () => {
|
||||||
|
it("should return an instance of ResourceProviderClient", () => {
|
||||||
|
expect(AddDbUtilities.getRpClient()).not.toBeFalsy();
|
||||||
|
expect(AddDbUtilities.getRpClient()).toBeInstanceOf(ResourceProviderClient);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("getGremlinDatabaseUri", () => {
|
||||||
|
it("should return a uri in the correct format", () => {
|
||||||
|
expect(AddDbUtilities.getGremlinDatabaseUri(properties)).toEqual(
|
||||||
|
"subscriptions/a1/resourceGroups/b1/providers/Microsoft.DocumentDB/databaseAccounts/main/gremlinDatabases/a1-db"
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("createGremlinDatabase", () => {
|
||||||
|
it("should utilize resource provider client", () => {
|
||||||
|
const resourceProviderClientSpy = spyOn<any>(AddDbUtilities, "getRpClient");
|
||||||
|
AddDbUtilities.createGremlinDatabase(armEndpoint, properties, undefined);
|
||||||
|
expect(resourceProviderClientSpy).toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should invoke getGremlinDatabaseUri", () => {
|
||||||
|
const getGremlinDatabaseUriSpy = spyOn<any>(AddDbUtilities, "getGremlinDatabaseUri");
|
||||||
|
AddDbUtilities.createGremlinDatabase(armEndpoint, properties, undefined);
|
||||||
|
expect(getGremlinDatabaseUriSpy).toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should invoke a put call via resource provider client to create a database and set throughput if shared throughtput is true", () => {
|
||||||
|
const resourceProviderClientPutAsyncSpy = jest.spyOn(ResourceProviderClient.prototype, "putAsync");
|
||||||
|
AddDbUtilities.createGremlinDatabase(armEndpoint, properties, undefined);
|
||||||
|
expect(
|
||||||
|
resourceProviderClientPutAsyncSpy
|
||||||
|
).toHaveBeenCalledWith(
|
||||||
|
"subscriptions/a1/resourceGroups/b1/providers/Microsoft.DocumentDB/databaseAccounts/main/gremlinDatabases/a1-db",
|
||||||
|
"2020-04-01",
|
||||||
|
{ properties: { options: { throughput: "50000" }, resource: { id: "a1-db" } } }
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should invoke a put call via resource provider client to create a database and set autopilot if shared throughtput is true and autopilot settings are passed", () => {
|
||||||
|
const resourceProviderClientPutAsyncSpy = jest.spyOn(ResourceProviderClient.prototype, "putAsync");
|
||||||
|
AddDbUtilities.createGremlinDatabase(armEndpoint, properties, { "x-ms-cosmos-offer-autopilot-tier": "1" });
|
||||||
|
expect(
|
||||||
|
resourceProviderClientPutAsyncSpy
|
||||||
|
).toHaveBeenCalledWith(
|
||||||
|
"subscriptions/a1/resourceGroups/b1/providers/Microsoft.DocumentDB/databaseAccounts/main/gremlinDatabases/a1-db",
|
||||||
|
"2020-04-01",
|
||||||
|
{ properties: { options: { "x-ms-cosmos-offer-autopilot-tier": "1" }, resource: { id: "a1-db" } } }
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should invoke a put call via resource provider client to create a database and not set throughput if shared throughtput is false", () => {
|
||||||
|
const properties = {
|
||||||
|
pk: "state",
|
||||||
|
coll: "abc-collection",
|
||||||
|
cd: true,
|
||||||
|
db: "a2-db",
|
||||||
|
st: false,
|
||||||
|
sid: "a2",
|
||||||
|
rg: "c1",
|
||||||
|
dba: "main"
|
||||||
|
};
|
||||||
|
const resourceProviderClientPutAsyncSpy = jest.spyOn(ResourceProviderClient.prototype, "putAsync");
|
||||||
|
AddDbUtilities.createGremlinDatabase(armEndpoint, properties, undefined);
|
||||||
|
expect(
|
||||||
|
resourceProviderClientPutAsyncSpy
|
||||||
|
).toHaveBeenCalledWith(
|
||||||
|
"subscriptions/a2/resourceGroups/c1/providers/Microsoft.DocumentDB/databaseAccounts/main/gremlinDatabases/a2-db",
|
||||||
|
"2020-04-01",
|
||||||
|
{ properties: { options: {}, resource: { id: "a2-db" } } }
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("createSqlDatabase", () => {
|
||||||
|
it("should utilize resource provider client", () => {
|
||||||
|
const resourceProviderClientSpy = spyOn<any>(AddDbUtilities, "getRpClient");
|
||||||
|
AddDbUtilities.createSqlDatabase(armEndpoint, properties, undefined);
|
||||||
|
expect(resourceProviderClientSpy).toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should invoke getSqlDatabaseUri", () => {
|
||||||
|
const getSqlDatabaseUriSpy = spyOn<any>(AddDbUtilities, "getSqlDatabaseUri");
|
||||||
|
AddDbUtilities.createSqlDatabase(armEndpoint, properties, undefined);
|
||||||
|
expect(getSqlDatabaseUriSpy).toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should invoke a put call via resource provider client to create a database and set throughput if shared throughtput is true", () => {
|
||||||
|
const resourceProviderClientPutAsyncSpy = jest.spyOn(ResourceProviderClient.prototype, "putAsync");
|
||||||
|
AddDbUtilities.createSqlDatabase(armEndpoint, properties, undefined);
|
||||||
|
expect(
|
||||||
|
resourceProviderClientPutAsyncSpy
|
||||||
|
).toHaveBeenCalledWith(
|
||||||
|
"subscriptions/a1/resourceGroups/b1/providers/Microsoft.DocumentDB/databaseAccounts/main/sqlDatabases/a1-db",
|
||||||
|
"2020-04-01",
|
||||||
|
{ properties: { options: { throughput: "50000" }, resource: { id: "a1-db" } } }
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should invoke a put call via resource provider client to create a database and set autopilot if shared throughtput is true and autopilot settings are passed", () => {
|
||||||
|
const resourceProviderClientPutAsyncSpy = jest.spyOn(ResourceProviderClient.prototype, "putAsync");
|
||||||
|
AddDbUtilities.createSqlDatabase(armEndpoint, properties, { "x-ms-cosmos-offer-autopilot-tier": "1" });
|
||||||
|
expect(
|
||||||
|
resourceProviderClientPutAsyncSpy
|
||||||
|
).toHaveBeenCalledWith(
|
||||||
|
"subscriptions/a1/resourceGroups/b1/providers/Microsoft.DocumentDB/databaseAccounts/main/sqlDatabases/a1-db",
|
||||||
|
"2020-04-01",
|
||||||
|
{ properties: { options: { "x-ms-cosmos-offer-autopilot-tier": "1" }, resource: { id: "a1-db" } } }
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should invoke a put call via resource provider client to create a database and not set throughput if shared throughtput is false", () => {
|
||||||
|
const properties = {
|
||||||
|
pk: "state",
|
||||||
|
coll: "abc-collection",
|
||||||
|
cd: true,
|
||||||
|
db: "a2-db",
|
||||||
|
st: false,
|
||||||
|
sid: "a2",
|
||||||
|
rg: "c1",
|
||||||
|
dba: "main"
|
||||||
|
};
|
||||||
|
const resourceProviderClientPutAsyncSpy = jest.spyOn(ResourceProviderClient.prototype, "putAsync");
|
||||||
|
AddDbUtilities.createSqlDatabase(armEndpoint, properties, undefined);
|
||||||
|
expect(
|
||||||
|
resourceProviderClientPutAsyncSpy
|
||||||
|
).toHaveBeenCalledWith(
|
||||||
|
"subscriptions/a2/resourceGroups/c1/providers/Microsoft.DocumentDB/databaseAccounts/main/sqlDatabases/a2-db",
|
||||||
|
"2020-04-01",
|
||||||
|
{ properties: { options: {}, resource: { id: "a2-db" } } }
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
187
src/Shared/AddDatabaseUtility.ts
Normal file
187
src/Shared/AddDatabaseUtility.ts
Normal file
@@ -0,0 +1,187 @@
|
|||||||
|
import * as DataExplorerConstants from "../Common/Constants";
|
||||||
|
import * as DataModels from "../Contracts/DataModels";
|
||||||
|
import { configContext } from "../ConfigContext";
|
||||||
|
import { ConsoleDataType } from "../Explorer/Menus/NotificationConsole/NotificationConsoleComponent";
|
||||||
|
import { HttpStatusCodes } from "../Common/Constants";
|
||||||
|
import { sendMessage } from "../Common/MessageHandler";
|
||||||
|
import { MessageTypes } from "../Contracts/ExplorerContracts";
|
||||||
|
import * as NotificationConsoleUtils from "../Utils/NotificationConsoleUtils";
|
||||||
|
import { ResourceProviderClient } from "../ResourceProvider/ResourceProviderClient";
|
||||||
|
import { userContext } from "../UserContext";
|
||||||
|
import { createUpdateCassandraKeyspace } from "../Utils/arm/generatedClients/2020-04-01/cassandraResources";
|
||||||
|
|
||||||
|
export class AddDbUtilities {
|
||||||
|
// todo - remove any
|
||||||
|
public static async createMongoDatabaseWithARM(
|
||||||
|
armEndpoint: string,
|
||||||
|
params: DataModels.RpParameters,
|
||||||
|
rpOptions: DataModels.RpOptions
|
||||||
|
): Promise<any> {
|
||||||
|
const rpPayloadToCreateDatabase: DataModels.MongoCreationRequest = {
|
||||||
|
properties: {
|
||||||
|
resource: {
|
||||||
|
id: params.db
|
||||||
|
},
|
||||||
|
options: {}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
if (params.st) {
|
||||||
|
if (rpOptions) {
|
||||||
|
rpPayloadToCreateDatabase.properties.options = rpOptions;
|
||||||
|
} else {
|
||||||
|
rpPayloadToCreateDatabase.properties.options["throughput"] =
|
||||||
|
params.offerThroughput && params.offerThroughput.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
await AddDbUtilities.getRpClient<DataModels.CreateDatabaseWithRpResponse>(armEndpoint).putAsync(
|
||||||
|
AddDbUtilities._getMongoDatabaseUri(params),
|
||||||
|
DataExplorerConstants.ArmApiVersions.publicVersion,
|
||||||
|
rpPayloadToCreateDatabase
|
||||||
|
);
|
||||||
|
} catch (reason) {
|
||||||
|
AddDbUtilities._handleCreationError(reason, params);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// todo - remove any
|
||||||
|
public static async createCassandraKeyspace(
|
||||||
|
params: DataModels.RpParameters,
|
||||||
|
rpOptions: DataModels.RpOptions
|
||||||
|
): Promise<any> {
|
||||||
|
const rpPayloadToCreateKeyspace: DataModels.CreationRequest = {
|
||||||
|
properties: {
|
||||||
|
resource: {
|
||||||
|
id: params.db
|
||||||
|
},
|
||||||
|
options: {}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
if (params.st) {
|
||||||
|
if (rpOptions) {
|
||||||
|
rpPayloadToCreateKeyspace.properties.options = rpOptions;
|
||||||
|
} else {
|
||||||
|
rpPayloadToCreateKeyspace.properties.options["throughput"] =
|
||||||
|
params.offerThroughput && params.offerThroughput.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
await createUpdateCassandraKeyspace(
|
||||||
|
userContext.subscriptionId,
|
||||||
|
userContext.resourceGroup,
|
||||||
|
userContext.databaseAccount?.name,
|
||||||
|
params.db,
|
||||||
|
rpPayloadToCreateKeyspace
|
||||||
|
);
|
||||||
|
} catch (reason) {
|
||||||
|
AddDbUtilities._handleCreationError(reason, params, "keyspace");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static async createSqlDatabase(
|
||||||
|
armEndpoint: string,
|
||||||
|
params: DataModels.RpParameters,
|
||||||
|
rpOptions: DataModels.RpOptions
|
||||||
|
): Promise<any> {
|
||||||
|
const rpPayloadToCreateSqlDatabase: DataModels.CreationRequest = {
|
||||||
|
properties: {
|
||||||
|
resource: {
|
||||||
|
id: params.db
|
||||||
|
},
|
||||||
|
options: {}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
if (params.st) {
|
||||||
|
if (rpOptions) {
|
||||||
|
rpPayloadToCreateSqlDatabase.properties.options = rpOptions;
|
||||||
|
} else {
|
||||||
|
rpPayloadToCreateSqlDatabase.properties.options["throughput"] =
|
||||||
|
params.offerThroughput && params.offerThroughput.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
await AddDbUtilities.getRpClient<DataModels.CreateDatabaseWithRpResponse>(armEndpoint).putAsync(
|
||||||
|
AddDbUtilities.getSqlDatabaseUri(params),
|
||||||
|
DataExplorerConstants.ArmApiVersions.publicVersion,
|
||||||
|
rpPayloadToCreateSqlDatabase
|
||||||
|
);
|
||||||
|
} catch (reason) {
|
||||||
|
AddDbUtilities._handleCreationError(reason, params, "database");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static getRpClient<T>(armEndpoint?: string): ResourceProviderClient<T> {
|
||||||
|
return new ResourceProviderClient<T>(armEndpoint || configContext.ARM_ENDPOINT);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static async createGremlinDatabase(
|
||||||
|
armEndpoint: string,
|
||||||
|
params: DataModels.RpParameters,
|
||||||
|
autoPilotSettings: DataModels.RpOptions
|
||||||
|
): Promise<DataModels.CreateDatabaseWithRpResponse> {
|
||||||
|
const rpPayloadToCreateDatabase: DataModels.CreationRequest = {
|
||||||
|
properties: {
|
||||||
|
resource: {
|
||||||
|
id: params.db
|
||||||
|
},
|
||||||
|
options: {}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const uri = AddDbUtilities.getGremlinDatabaseUri(params);
|
||||||
|
|
||||||
|
if (params.st) {
|
||||||
|
if (autoPilotSettings) {
|
||||||
|
rpPayloadToCreateDatabase.properties.options = autoPilotSettings;
|
||||||
|
} else {
|
||||||
|
rpPayloadToCreateDatabase.properties.options["throughput"] =
|
||||||
|
params.offerThroughput && params.offerThroughput.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Promise<DataModels.CreateDatabaseWithRpResponse>((resolve, reject) => {
|
||||||
|
AddDbUtilities.getRpClient<DataModels.CreateDatabaseWithRpResponse>(armEndpoint)
|
||||||
|
.putAsync(uri, DataExplorerConstants.ArmApiVersions.publicVersion, rpPayloadToCreateDatabase)
|
||||||
|
.then(
|
||||||
|
() => {
|
||||||
|
resolve();
|
||||||
|
},
|
||||||
|
reason => {
|
||||||
|
AddDbUtilities._handleCreationError(reason, params);
|
||||||
|
reject();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private static _handleCreationError(reason: any, params: DataModels.RpParameters, dbType: string = "database") {
|
||||||
|
NotificationConsoleUtils.logConsoleError(`Error creating ${dbType}: ${JSON.stringify(reason)}, Payload: ${params}`);
|
||||||
|
if (reason.status === HttpStatusCodes.Forbidden) {
|
||||||
|
sendMessage({ type: MessageTypes.ForbiddenError });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
throw new Error(`Error creating ${dbType}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static _getMongoDatabaseUri(params: DataModels.RpParameters): string {
|
||||||
|
return `subscriptions/${params.sid}/resourceGroups/${params.rg}/providers/Microsoft.DocumentDB/databaseAccounts/${userContext.databaseAccount.name}/mongodbDatabases/${params.db}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static _getCassandraKeyspaceUri(params: DataModels.RpParameters): string {
|
||||||
|
return `subscriptions/${params.sid}/resourceGroups/${params.rg}/providers/Microsoft.DocumentDB/databaseAccounts/${userContext.databaseAccount.name}/cassandraKeyspaces/${params.db}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static getGremlinDatabaseUri(params: DataModels.RpParameters): string {
|
||||||
|
return `subscriptions/${params.sid}/resourceGroups/${params.rg}/providers/Microsoft.DocumentDB/databaseAccounts/${params.dba}/gremlinDatabases/${params.db}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static getSqlDatabaseUri(params: DataModels.RpParameters): string {
|
||||||
|
return `subscriptions/${params.sid}/resourceGroups/${params.rg}/providers/Microsoft.DocumentDB/databaseAccounts/${params.dba}/sqlDatabases/${params.db}`;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,3 +1,13 @@
|
|||||||
|
/**
|
||||||
|
* Defines constants related to logging telemetry. Everything except Action should be kept in sync with the one in the Portal code as much as possible.
|
||||||
|
*
|
||||||
|
* TODO: Move this to ExplorerContracts (265329)
|
||||||
|
*/
|
||||||
|
export class General {
|
||||||
|
public static ExtensionName: string = "Microsoft_Azure_DocumentDB";
|
||||||
|
public static BladeNamePrefix: string = "Extension/Microsoft_Azure_DocumentDB/Blade/";
|
||||||
|
}
|
||||||
|
|
||||||
// Data Explorer specific actions. No need to keep this in sync with the one in Portal.
|
// Data Explorer specific actions. No need to keep this in sync with the one in Portal.
|
||||||
export enum Action {
|
export enum Action {
|
||||||
CollapseTreeNode,
|
CollapseTreeNode,
|
||||||
@@ -73,19 +83,24 @@ export enum Action {
|
|||||||
NotebooksGitHubDisconnect
|
NotebooksGitHubDisconnect
|
||||||
}
|
}
|
||||||
|
|
||||||
export const ActionModifiers = {
|
export class ActionModifiers {
|
||||||
Start: "start",
|
public static Start: string = "start";
|
||||||
Success: "success",
|
public static Success: string = "success";
|
||||||
Failed: "failed",
|
public static Failed: string = "failed";
|
||||||
Mark: "mark",
|
public static Mark: string = "mark";
|
||||||
Open: "open",
|
public static Open: string = "open";
|
||||||
IFrameReady: "iframeready",
|
public static IFrameReady: string = "iframeready";
|
||||||
Close: "close",
|
public static Close: string = "close";
|
||||||
Submit: "submit",
|
public static Submit: string = "submit";
|
||||||
IndexAll: "index all properties",
|
public static IndexAll: string = "index all properties";
|
||||||
NoIndex: "no indexing",
|
public static NoIndex: string = "no indexing";
|
||||||
Cancel: "cancel"
|
public static Cancel: string = "cancel";
|
||||||
} as const;
|
}
|
||||||
|
|
||||||
|
export class CosmosDBEndpointNames {
|
||||||
|
public static Gateway: string = "CosmosDBGateway";
|
||||||
|
public static ResourceProvider: string = "DocumentDBResourceProvider";
|
||||||
|
}
|
||||||
|
|
||||||
export enum SourceBlade {
|
export enum SourceBlade {
|
||||||
AddCollection,
|
AddCollection,
|
||||||
@@ -111,3 +126,17 @@ export enum SourceBlade {
|
|||||||
ScriptExplorer,
|
ScriptExplorer,
|
||||||
Keys
|
Keys
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class BladeLoadRequirements {
|
||||||
|
public static collections: string = "Collections";
|
||||||
|
public static collectionsWithOffers: string = "CollectionsWithOffers";
|
||||||
|
public static databaseAccount: string = "DatabaseAccount";
|
||||||
|
public static keys: string = "Keys";
|
||||||
|
public static metrics: string = "Metrics";
|
||||||
|
public static notifications: string = "Notifications";
|
||||||
|
public static singleCollection: string = "SingleCollection";
|
||||||
|
|
||||||
|
public static keysBlade: string[] = [BladeLoadRequirements.databaseAccount, BladeLoadRequirements.keys];
|
||||||
|
public static metricsBlade: string[] = [BladeLoadRequirements.databaseAccount];
|
||||||
|
public static overview: string[] = [BladeLoadRequirements.databaseAccount, BladeLoadRequirements.notifications];
|
||||||
|
}
|
||||||
|
|||||||
@@ -8,124 +8,123 @@ import { userContext } from "../../UserContext";
|
|||||||
/**
|
/**
|
||||||
* Class that persists telemetry data to the portal tables.
|
* Class that persists telemetry data to the portal tables.
|
||||||
*/
|
*/
|
||||||
|
// TODO: Move to a separate Diagnostics folder
|
||||||
|
// TODO: Log telemetry for StorageExplorer case/other clients as well
|
||||||
|
export default class TelemetryProcessor {
|
||||||
|
public static trace(action: Action, actionModifier: string = ActionModifiers.Mark, data?: any): void {
|
||||||
|
sendMessage({
|
||||||
|
type: MessageTypes.TelemetryInfo,
|
||||||
|
data: {
|
||||||
|
action: Action[action],
|
||||||
|
actionModifier: actionModifier,
|
||||||
|
data: JSON.stringify(data)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
export function trace(action: Action, actionModifier: string = ActionModifiers.Mark, data?: unknown): void {
|
appInsights.trackEvent({ name: Action[action] }, TelemetryProcessor.getData(data));
|
||||||
sendMessage({
|
|
||||||
type: MessageTypes.TelemetryInfo,
|
|
||||||
data: {
|
|
||||||
action: Action[action],
|
|
||||||
actionModifier: actionModifier,
|
|
||||||
data: JSON.stringify(data)
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
appInsights.trackEvent({ name: Action[action] }, getData(data));
|
|
||||||
}
|
|
||||||
|
|
||||||
export function traceStart(action: Action, data?: unknown): number {
|
|
||||||
const timestamp: number = Date.now();
|
|
||||||
sendMessage({
|
|
||||||
type: MessageTypes.TelemetryInfo,
|
|
||||||
data: {
|
|
||||||
action: Action[action],
|
|
||||||
actionModifier: ActionModifiers.Start,
|
|
||||||
timestamp: timestamp,
|
|
||||||
data: JSON.stringify(data)
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
appInsights.startTrackEvent(Action[action]);
|
|
||||||
return timestamp;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function traceSuccess(action: Action, data?: unknown, timestamp?: number): void {
|
|
||||||
sendMessage({
|
|
||||||
type: MessageTypes.TelemetryInfo,
|
|
||||||
data: {
|
|
||||||
action: Action[action],
|
|
||||||
actionModifier: ActionModifiers.Success,
|
|
||||||
timestamp: timestamp || Date.now(),
|
|
||||||
data: JSON.stringify(data)
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
appInsights.stopTrackEvent(Action[action], getData(data));
|
|
||||||
}
|
|
||||||
|
|
||||||
export function traceFailure(action: Action, data?: unknown, timestamp?: number): void {
|
|
||||||
sendMessage({
|
|
||||||
type: MessageTypes.TelemetryInfo,
|
|
||||||
data: {
|
|
||||||
action: Action[action],
|
|
||||||
actionModifier: ActionModifiers.Failed,
|
|
||||||
timestamp: timestamp || Date.now(),
|
|
||||||
data: JSON.stringify(data)
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
appInsights.stopTrackEvent(Action[action], getData(data));
|
|
||||||
}
|
|
||||||
|
|
||||||
export function traceCancel(action: Action, data?: unknown, timestamp?: number): void {
|
|
||||||
sendMessage({
|
|
||||||
type: MessageTypes.TelemetryInfo,
|
|
||||||
data: {
|
|
||||||
action: Action[action],
|
|
||||||
actionModifier: ActionModifiers.Cancel,
|
|
||||||
timestamp: timestamp || Date.now(),
|
|
||||||
data: JSON.stringify(data)
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
appInsights.stopTrackEvent(Action[action], getData(data));
|
|
||||||
}
|
|
||||||
|
|
||||||
export function traceOpen(action: Action, data?: unknown, timestamp?: number): number {
|
|
||||||
const validTimestamp = timestamp || Date.now();
|
|
||||||
sendMessage({
|
|
||||||
type: MessageTypes.TelemetryInfo,
|
|
||||||
data: {
|
|
||||||
action: Action[action],
|
|
||||||
actionModifier: ActionModifiers.Open,
|
|
||||||
timestamp: validTimestamp,
|
|
||||||
data: JSON.stringify(data)
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
appInsights.startTrackEvent(Action[action]);
|
|
||||||
return validTimestamp;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function traceMark(action: Action, data?: unknown, timestamp?: number): number {
|
|
||||||
const validTimestamp = timestamp || Date.now();
|
|
||||||
sendMessage({
|
|
||||||
type: MessageTypes.TelemetryInfo,
|
|
||||||
data: {
|
|
||||||
action: Action[action],
|
|
||||||
actionModifier: ActionModifiers.Mark,
|
|
||||||
timestamp: validTimestamp,
|
|
||||||
data: JSON.stringify(data)
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
appInsights.startTrackEvent(Action[action]);
|
|
||||||
return validTimestamp;
|
|
||||||
}
|
|
||||||
|
|
||||||
function getData(data: unknown = {}): { [key: string]: string } | undefined {
|
|
||||||
if (typeof data === "string") {
|
|
||||||
data = { message: data };
|
|
||||||
}
|
}
|
||||||
if (typeof data === "object") {
|
|
||||||
|
public static traceStart(action: Action, data?: any): number {
|
||||||
|
const timestamp: number = Date.now();
|
||||||
|
sendMessage({
|
||||||
|
type: MessageTypes.TelemetryInfo,
|
||||||
|
data: {
|
||||||
|
action: Action[action],
|
||||||
|
actionModifier: ActionModifiers.Start,
|
||||||
|
timestamp: timestamp,
|
||||||
|
data: JSON.stringify(data)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
appInsights.startTrackEvent(Action[action]);
|
||||||
|
return timestamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static traceSuccess(action: Action, data?: any, timestamp?: number): void {
|
||||||
|
sendMessage({
|
||||||
|
type: MessageTypes.TelemetryInfo,
|
||||||
|
data: {
|
||||||
|
action: Action[action],
|
||||||
|
actionModifier: ActionModifiers.Success,
|
||||||
|
timestamp: timestamp || Date.now(),
|
||||||
|
data: JSON.stringify(data)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
appInsights.stopTrackEvent(Action[action], TelemetryProcessor.getData(data));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static traceFailure(action: Action, data?: any, timestamp?: number): void {
|
||||||
|
sendMessage({
|
||||||
|
type: MessageTypes.TelemetryInfo,
|
||||||
|
data: {
|
||||||
|
action: Action[action],
|
||||||
|
actionModifier: ActionModifiers.Failed,
|
||||||
|
timestamp: timestamp || Date.now(),
|
||||||
|
data: JSON.stringify(data)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
appInsights.stopTrackEvent(Action[action], TelemetryProcessor.getData(data));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static traceCancel(action: Action, data?: any, timestamp?: number): void {
|
||||||
|
sendMessage({
|
||||||
|
type: MessageTypes.TelemetryInfo,
|
||||||
|
data: {
|
||||||
|
action: Action[action],
|
||||||
|
actionModifier: ActionModifiers.Cancel,
|
||||||
|
timestamp: timestamp || Date.now(),
|
||||||
|
data: JSON.stringify(data)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
appInsights.stopTrackEvent(Action[action], TelemetryProcessor.getData(data));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static traceOpen(action: Action, data?: any, timestamp?: number): number {
|
||||||
|
const validTimestamp = timestamp || Date.now();
|
||||||
|
sendMessage({
|
||||||
|
type: MessageTypes.TelemetryInfo,
|
||||||
|
data: {
|
||||||
|
action: Action[action],
|
||||||
|
actionModifier: ActionModifiers.Open,
|
||||||
|
timestamp: validTimestamp,
|
||||||
|
data: JSON.stringify(data)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
appInsights.startTrackEvent(Action[action]);
|
||||||
|
return validTimestamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static traceMark(action: Action, data?: any, timestamp?: number): number {
|
||||||
|
const validTimestamp = timestamp || Date.now();
|
||||||
|
sendMessage({
|
||||||
|
type: MessageTypes.TelemetryInfo,
|
||||||
|
data: {
|
||||||
|
action: Action[action],
|
||||||
|
actionModifier: ActionModifiers.Mark,
|
||||||
|
timestamp: validTimestamp,
|
||||||
|
data: JSON.stringify(data)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
appInsights.startTrackEvent(Action[action]);
|
||||||
|
return validTimestamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static getData(data: any = {}): any {
|
||||||
|
if (typeof data === "string") {
|
||||||
|
data = { message: data };
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
// TODO: Need to `any` here since the window imports Explorer which can't be in strict mode yet
|
// TODO: Need to `any` here since the window imports Explorer which can't be in strict mode yet
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
||||||
authType: (window as any).authType,
|
authType: (window as any).authType,
|
||||||
subscriptionId: userContext.subscriptionId as string,
|
subscriptionId: userContext.subscriptionId,
|
||||||
platform: configContext.platform,
|
platform: configContext.platform,
|
||||||
env: process.env.NODE_ENV as string,
|
env: process.env.NODE_ENV,
|
||||||
...data
|
...data
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
return undefined;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
import { ApplicationInsights } from "@microsoft/applicationinsights-web";
|
import { ApplicationInsights } from "@microsoft/applicationinsights-web";
|
||||||
|
|
||||||
const appInsights = new ApplicationInsights({
|
const appInsights = new ApplicationInsights({
|
||||||
config: {
|
config: {
|
||||||
instrumentationKey: "fa645d97-6237-4656-9559-0ee0cb55ee49",
|
instrumentationKey: "fa645d97-6237-4656-9559-0ee0cb55ee49"
|
||||||
disableFetchTracking: false
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
appInsights.loadAppInsights();
|
appInsights.loadAppInsights();
|
||||||
|
|||||||
@@ -3,10 +3,7 @@ import { ConsoleDataType } from "../Explorer/Menus/NotificationConsole/Notificat
|
|||||||
|
|
||||||
const _global = typeof self === "undefined" ? window : self;
|
const _global = typeof self === "undefined" ? window : self;
|
||||||
|
|
||||||
/**
|
// DEPRECATED: Use logConsoleInfo, logConsoleError, logConsoleProgress instead
|
||||||
* @deprecated
|
|
||||||
* Use logConsoleInfo, logConsoleError, logConsoleProgress instead
|
|
||||||
* */
|
|
||||||
export function logConsoleMessage(type: ConsoleDataType, message: string, id?: string): string {
|
export function logConsoleMessage(type: ConsoleDataType, message: string, id?: string): string {
|
||||||
const dataExplorer = _global.dataExplorer;
|
const dataExplorer = _global.dataExplorer;
|
||||||
if (dataExplorer) {
|
if (dataExplorer) {
|
||||||
|
|||||||
@@ -193,7 +193,7 @@ export function getAutoPilotV3SpendHtml(maxAutoPilotThroughputSet: number, isDat
|
|||||||
maxAutoPilotThroughputSet
|
maxAutoPilotThroughputSet
|
||||||
)} GB of data stored, the max RU/s will be automatically upgraded based on the new storage value. <a href='${
|
)} GB of data stored, the max RU/s will be automatically upgraded based on the new storage value. <a href='${
|
||||||
Constants.AutopilotDocumentation.Url
|
Constants.AutopilotDocumentation.Url
|
||||||
}' target='_blank' aria-label='Learn more about autoscale throughput'>Learn more</a>.`;
|
}' target='_blank'>Learn more</a>.`;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function computeAutoscaleUsagePriceHourly(
|
export function computeAutoscaleUsagePriceHourly(
|
||||||
|
|||||||
@@ -1,6 +1,13 @@
|
|||||||
import { armRequest } from "./request";
|
import { armRequest } from "./request";
|
||||||
|
import { updateUserContext } from "../../UserContext";
|
||||||
|
|
||||||
describe("ARM request", () => {
|
describe("ARM request", () => {
|
||||||
|
beforeAll(() => {
|
||||||
|
updateUserContext({
|
||||||
|
authorizationToken: "foo"
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it("should call window.fetch", async () => {
|
it("should call window.fetch", async () => {
|
||||||
window.fetch = jest.fn().mockResolvedValue({
|
window.fetch = jest.fn().mockResolvedValue({
|
||||||
ok: true,
|
ok: true,
|
||||||
|
|||||||
@@ -24,11 +24,15 @@ interface Options {
|
|||||||
// TODO: This is very similar to what is happening in ResourceProviderClient.ts. Should probably merge them.
|
// TODO: This is very similar to what is happening in ResourceProviderClient.ts. Should probably merge them.
|
||||||
export async function armRequest<T>({ host, path, apiVersion, method, body: requestBody }: Options): Promise<T> {
|
export async function armRequest<T>({ host, path, apiVersion, method, body: requestBody }: Options): Promise<T> {
|
||||||
const url = new URL(path, host);
|
const url = new URL(path, host);
|
||||||
|
const authHeader = userContext.authorizationToken;
|
||||||
|
if (!authHeader) {
|
||||||
|
throw new Error("No ARM authorization header provided");
|
||||||
|
}
|
||||||
url.searchParams.append("api-version", apiVersion);
|
url.searchParams.append("api-version", apiVersion);
|
||||||
const response = await window.fetch(url.href, {
|
const response = await window.fetch(url.href, {
|
||||||
method,
|
method,
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: userContext.authorizationToken
|
Authorization: authHeader
|
||||||
},
|
},
|
||||||
body: requestBody ? JSON.stringify(requestBody) : undefined
|
body: requestBody ? JSON.stringify(requestBody) : undefined
|
||||||
});
|
});
|
||||||
@@ -71,9 +75,13 @@ interface OperationResponse {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function getOperationStatus(operationStatusUrl: string) {
|
async function getOperationStatus(operationStatusUrl: string) {
|
||||||
|
const authHeader = userContext.authorizationToken;
|
||||||
|
if (!authHeader) {
|
||||||
|
throw new Error("No ARM authorization header provided");
|
||||||
|
}
|
||||||
const response = await window.fetch(operationStatusUrl, {
|
const response = await window.fetch(operationStatusUrl, {
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: userContext.authorizationToken
|
Authorization: authHeader
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
|
|||||||
@@ -1,106 +0,0 @@
|
|||||||
import "expect-puppeteer";
|
|
||||||
import crypto from 'crypto'
|
|
||||||
|
|
||||||
jest.setTimeout(300000);
|
|
||||||
|
|
||||||
describe('Collection Add and Delete SQL spec', () => {
|
|
||||||
it('creates a collection', async () => {
|
|
||||||
try {
|
|
||||||
const dbId = `TestDatabase${crypto.randomBytes(8).toString("hex")}`;
|
|
||||||
const collectionId = `TestCollection${crypto.randomBytes(8).toString("hex")}`;
|
|
||||||
const sharedKey = `SharedKey${crypto.randomBytes(8).toString("hex")}`;
|
|
||||||
const prodUrl = "https://localhost:1234/hostedExplorer.html";
|
|
||||||
page.goto(prodUrl);
|
|
||||||
|
|
||||||
// log in with connection string
|
|
||||||
const handle = await page.waitForSelector('iframe');
|
|
||||||
const frame = await handle.contentFrame();
|
|
||||||
await frame.waitFor('div > p.switchConnectTypeText', { visible: true });
|
|
||||||
await frame.click('div > p.switchConnectTypeText');
|
|
||||||
const connStr = process.env.PORTAL_RUNNER_CONNECTION_STRING;
|
|
||||||
await frame.type("input[class='inputToken']", connStr);
|
|
||||||
await frame.click("input[value='Connect']");
|
|
||||||
|
|
||||||
// create new collection
|
|
||||||
await frame.waitFor('button[data-test="New Container"]', { visible: true });
|
|
||||||
await frame.waitForSelector('div[class="splashScreen"] > div[class="title"]', { visible: true });
|
|
||||||
await frame.click('button[data-test="New Container"]');
|
|
||||||
|
|
||||||
// check new database
|
|
||||||
await frame.waitFor('input[data-test="addCollection-createNewDatabase"]');
|
|
||||||
await frame.click('input[data-test="addCollection-createNewDatabase"]');
|
|
||||||
|
|
||||||
// check shared throughput
|
|
||||||
await frame.waitFor('input[data-test="addCollectionPane-databaseSharedThroughput"]');
|
|
||||||
await frame.click('input[data-test="addCollectionPane-databaseSharedThroughput"]') ;
|
|
||||||
|
|
||||||
// type database id
|
|
||||||
await frame.waitFor('input[data-test="addCollection-newDatabaseId"]');
|
|
||||||
await frame.type('input[data-test="addCollection-newDatabaseId"]', dbId);
|
|
||||||
|
|
||||||
// type collection id
|
|
||||||
await frame.waitFor('input[data-test="addCollection-collectionId"]');
|
|
||||||
await frame.type('input[data-test="addCollection-collectionId"]', collectionId);
|
|
||||||
|
|
||||||
// type partition key value
|
|
||||||
await frame.waitFor('input[data-test="addCollection-partitionKeyValue"]');
|
|
||||||
await frame.type('input[data-test="addCollection-partitionKeyValue"]', sharedKey);
|
|
||||||
|
|
||||||
// click submit
|
|
||||||
await frame.waitFor('#submitBtnAddCollection');
|
|
||||||
await frame.click('#submitBtnAddCollection');
|
|
||||||
|
|
||||||
// validate created
|
|
||||||
// open database menu
|
|
||||||
await frame.waitFor(`span[title="${dbId}"]`);
|
|
||||||
await frame.waitForSelector('div[class="splashScreen"] > div[class="title"]', { visible: true });
|
|
||||||
|
|
||||||
await frame.click(`div[data-test="${dbId}"]`);
|
|
||||||
await frame.waitFor(`span[title="${collectionId}"]`);
|
|
||||||
|
|
||||||
// delete container
|
|
||||||
|
|
||||||
// click context menu for container
|
|
||||||
await frame.waitFor(`div[data-test="${collectionId}"] > div > button`);
|
|
||||||
await frame.click(`div[data-test="${collectionId}"] > div > button`);
|
|
||||||
|
|
||||||
// click delete container
|
|
||||||
await frame.waitForSelector('body > div.ms-Layer.ms-Layer--fixed');
|
|
||||||
await frame.waitFor(1000);
|
|
||||||
const elements = await frame.$$('span[class="treeComponentMenuItemLabel"]')
|
|
||||||
await elements[4].click();
|
|
||||||
|
|
||||||
// confirm delete container
|
|
||||||
await frame.type('input[data-test="confirmCollectionId"]', collectionId.trim());
|
|
||||||
|
|
||||||
// click delete
|
|
||||||
await frame.click('input[data-test="deleteCollection"]');
|
|
||||||
await frame.waitFor(5000);
|
|
||||||
await frame.waitForSelector('div[class="splashScreen"] > div[class="title"]', { visible: true });
|
|
||||||
|
|
||||||
await expect(page).not.toMatchElement(`div[data-test="${collectionId}"]`);
|
|
||||||
|
|
||||||
// click context menu for database
|
|
||||||
await frame.waitFor(`div[data-test="${dbId}"] > div > button`);
|
|
||||||
const button = await frame.$(`div[data-test="${dbId}"] > div > button`);
|
|
||||||
await button.focus();
|
|
||||||
await button.asElement().click();
|
|
||||||
|
|
||||||
// click delete database
|
|
||||||
await frame.waitFor(1000);
|
|
||||||
const dbElements = await frame.$$('span[class="treeComponentMenuItemLabel"]')
|
|
||||||
await dbElements[1].click();
|
|
||||||
|
|
||||||
// confirm delete database
|
|
||||||
await frame.type('input[data-test="confirmDatabaseId"]', dbId.trim());
|
|
||||||
|
|
||||||
// click delete
|
|
||||||
await frame.click('input[data-test="deleteDatabase"]');
|
|
||||||
await frame.waitForSelector('div[class="splashScreen"] > div[class="title"]', { visible: true });
|
|
||||||
await expect(page).not.toMatchElement(`div[data-test="${dbId}"]`);
|
|
||||||
} catch (error) {
|
|
||||||
await page.screenshot({path: 'failure.png'});
|
|
||||||
throw error;
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
@@ -3,7 +3,7 @@ import { trackEvent, trackException } from "./utils";
|
|||||||
|
|
||||||
jest.setTimeout(300000);
|
jest.setTimeout(300000);
|
||||||
|
|
||||||
describe.skip("Collection CRUD", () => {
|
describe("Collection CRUD", () => {
|
||||||
it("should complete collection crud", async () => {
|
it("should complete collection crud", async () => {
|
||||||
try {
|
try {
|
||||||
// Login to Azure Portal
|
// Login to Azure Portal
|
||||||
@@ -1,77 +1,100 @@
|
|||||||
{
|
{
|
||||||
"extends": "./tsconfig.json",
|
"extends": "./tsconfig.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"noEmit": true,
|
"noEmit": true,
|
||||||
"strictNullChecks": true,
|
"strictNullChecks": true,
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"noUnusedLocals": true
|
"noUnusedLocals": true
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"./src/AuthType.ts",
|
"./src/AuthType.ts",
|
||||||
"./src/Bindings/BindingHandlersRegisterer.ts",
|
"./src/Bindings/BindingHandlersRegisterer.ts",
|
||||||
"./src/Bindings/ReactBindingHandler.ts",
|
"./src/Bindings/ReactBindingHandler.ts",
|
||||||
"./src/Common/ArrayHashMap.ts",
|
"./src/Common/ArrayHashMap.ts",
|
||||||
"./src/Common/Constants.ts",
|
"./src/Common/Constants.ts",
|
||||||
"./src/Common/DeleteFeedback.ts",
|
"./src/Common/DeleteFeedback.ts",
|
||||||
"./src/Common/HashMap.ts",
|
"./src/Common/HashMap.ts",
|
||||||
"./src/Common/HeadersUtility.ts",
|
"./src/Common/HeadersUtility.ts",
|
||||||
"./src/Common/Logger.ts",
|
"./src/Common/Logger.ts",
|
||||||
"./src/Common/MessageHandler.ts",
|
"./src/Common/MessageHandler.ts",
|
||||||
"./src/Common/MongoUtility.ts",
|
"./src/Common/MongoUtility.ts",
|
||||||
"./src/Common/ObjectCache.ts",
|
"./src/Common/ObjectCache.ts",
|
||||||
"./src/Common/ThemeUtility.ts",
|
"./src/Common/ThemeUtility.ts",
|
||||||
"./src/Common/UrlUtility.ts",
|
"./src/Common/UrlUtility.ts",
|
||||||
"./src/Common/dataAccess/sendNotificationForError.ts",
|
"./src/Common/dataAccess/sendNotificationForError.ts",
|
||||||
"./src/ConfigContext.ts",
|
"./src/ConfigContext.ts",
|
||||||
"./src/Contracts/ActionContracts.ts",
|
"./src/Contracts/ActionContracts.ts",
|
||||||
"./src/Contracts/DataModels.ts",
|
"./src/Contracts/DataModels.ts",
|
||||||
"./src/Contracts/Diagnostics.ts",
|
"./src/Contracts/Diagnostics.ts",
|
||||||
"./src/Contracts/ExplorerContracts.ts",
|
"./src/Contracts/ExplorerContracts.ts",
|
||||||
"./src/Contracts/Versions.ts",
|
"./src/Contracts/Versions.ts",
|
||||||
"./src/Controls/Heatmap/Heatmap.ts",
|
"./src/Controls/Heatmap/Heatmap.ts",
|
||||||
"./src/Controls/Heatmap/HeatmapDatatypes.ts",
|
"./src/Controls/Heatmap/HeatmapDatatypes.ts",
|
||||||
"./src/Definitions/globals.d.ts",
|
"./src/DefaultAccountExperienceType.ts",
|
||||||
"./src/Definitions/html.d.ts",
|
"./src/Definitions/globals.d.ts",
|
||||||
"./src/Definitions/jquery-ui.d.ts",
|
"./src/Definitions/html.d.ts",
|
||||||
"./src/Definitions/jquery.d.ts",
|
"./src/Definitions/jquery-ui.d.ts",
|
||||||
"./src/Definitions/plotly.js-cartesian-dist.d-min.ts",
|
"./src/Definitions/jquery.d.ts",
|
||||||
"./src/Definitions/svg.d.ts",
|
"./src/Definitions/plotly.js-cartesian-dist.d-min.ts",
|
||||||
"./src/Explorer/Controls/ErrorDisplayComponent/ErrorDisplayComponent.ts",
|
"./src/Definitions/svg.d.ts",
|
||||||
"./src/Explorer/Controls/GitHub/GitHubStyleConstants.ts",
|
"./src/Explorer/Controls/ErrorDisplayComponent/ErrorDisplayComponent.ts",
|
||||||
"./src/Explorer/Controls/SmartUi/InputUtils.ts",
|
"./src/Explorer/Controls/GitHub/GitHubStyleConstants.ts",
|
||||||
"./src/Explorer/Notebook/FileSystemUtil.ts",
|
"./src/Explorer/Controls/SmartUi/InputUtils.ts",
|
||||||
"./src/Explorer/Notebook/NTeractUtil.ts",
|
"./src/Explorer/Notebook/FileSystemUtil.ts",
|
||||||
"./src/Explorer/Notebook/NotebookComponent/actions.ts",
|
"./src/Explorer/Notebook/NTeractUtil.ts",
|
||||||
"./src/Explorer/Notebook/NotebookComponent/loadTransform.ts",
|
"./src/Explorer/Notebook/NotebookComponent/actions.ts",
|
||||||
"./src/Explorer/Notebook/NotebookComponent/reducers.ts",
|
"./src/Explorer/Notebook/NotebookComponent/loadTransform.ts",
|
||||||
"./src/Explorer/Notebook/NotebookComponent/types.ts",
|
"./src/Explorer/Notebook/NotebookComponent/reducers.ts",
|
||||||
"./src/Explorer/Notebook/NotebookContentItem.ts",
|
"./src/Explorer/Notebook/NotebookComponent/types.ts",
|
||||||
"./src/Explorer/Notebook/NotebookUtil.ts",
|
"./src/Explorer/Notebook/NotebookContentItem.ts",
|
||||||
"./src/Explorer/Panes/PaneComponents.ts",
|
"./src/Explorer/Notebook/NotebookUtil.ts",
|
||||||
"./src/Explorer/Panes/Tables/Validators/EntityPropertyNameValidator.ts",
|
"./src/Explorer/Panes/PaneComponents.ts",
|
||||||
"./src/Explorer/Panes/Tables/Validators/EntityPropertyValidationCommon.ts",
|
"./src/Explorer/Panes/Tables/Validators/EntityPropertyNameValidator.ts",
|
||||||
"./src/Explorer/Tables/Constants.ts",
|
"./src/Explorer/Panes/Tables/Validators/EntityPropertyValidationCommon.ts",
|
||||||
"./src/Explorer/Tables/QueryBuilder/DateTimeUtilities.ts",
|
"./src/Explorer/Tables/Constants.ts",
|
||||||
"./src/Explorer/Tabs/TabComponents.ts",
|
"./src/Explorer/Tables/QueryBuilder/DateTimeUtilities.ts",
|
||||||
"./src/GitHub/GitHubConnector.ts",
|
"./src/Explorer/Tabs/TabComponents.ts",
|
||||||
"./src/Index.ts",
|
"./src/GitHub/GitHubConnector.ts",
|
||||||
"./src/NotebookWorkspaceManager/NotebookWorkspaceResourceProviderMockClients.ts",
|
"./src/Index.ts",
|
||||||
"./src/PlatformType.ts",
|
"./src/NotebookWorkspaceManager/NotebookWorkspaceResourceProviderMockClients.ts",
|
||||||
"./src/ReactDevTools.ts",
|
"./src/PlatformType.ts",
|
||||||
"./src/ResourceProvider/IResourceProviderClient.ts",
|
"./src/ReactDevTools.ts",
|
||||||
"./src/Shared/ExplorerSettings.ts",
|
"./src/ResourceProvider/IResourceProviderClient.ts",
|
||||||
"./src/Shared/StorageUtility.ts",
|
"./src/Shared/ExplorerSettings.ts",
|
||||||
"./src/Shared/StringUtility.ts",
|
"./src/Shared/StorageUtility.ts",
|
||||||
"./src/Shared/appInsights.ts",
|
"./src/Shared/StringUtility.ts",
|
||||||
"./src/UserContext.ts",
|
"./src/Shared/Telemetry/TelemetryConstants.ts",
|
||||||
"./src/Utils/GitHubUtils.ts",
|
"./src/Shared/Telemetry/TelemetryProcessor.ts",
|
||||||
"./src/Utils/MessageValidation.ts",
|
"./src/Shared/appInsights.ts",
|
||||||
"./src/Utils/OfferUtils.ts",
|
"./src/UserContext.ts",
|
||||||
"./src/Utils/StringUtils.ts",
|
"./src/Utils/Base64Utils.ts",
|
||||||
"./src/Utils/arm/generatedClients/2020-04-01/types.ts",
|
"./src/Utils/GitHubUtils.ts",
|
||||||
"./src/quickstart.ts",
|
"./src/Utils/MessageValidation.ts",
|
||||||
"./src/setupTests.ts",
|
"./src/Utils/OfferUtils.ts",
|
||||||
"./src/workers/upload/definitions.ts"
|
"./src/Utils/StringUtils.ts",
|
||||||
],
|
"./src/Utils/arm/generatedClients/2020-04-01/cassandraResources.ts",
|
||||||
"include": []
|
"./src/Utils/arm/generatedClients/2020-04-01/collection.ts",
|
||||||
|
"./src/Utils/arm/generatedClients/2020-04-01/collectionPartition.ts",
|
||||||
|
"./src/Utils/arm/generatedClients/2020-04-01/collectionPartitionRegion.ts",
|
||||||
|
"./src/Utils/arm/generatedClients/2020-04-01/collectionRegion.ts",
|
||||||
|
"./src/Utils/arm/generatedClients/2020-04-01/database.ts",
|
||||||
|
"./src/Utils/arm/generatedClients/2020-04-01/databaseAccountRegion.ts",
|
||||||
|
"./src/Utils/arm/generatedClients/2020-04-01/databaseAccounts.ts",
|
||||||
|
"./src/Utils/arm/generatedClients/2020-04-01/gremlinResources.ts",
|
||||||
|
"./src/Utils/arm/generatedClients/2020-04-01/mongoDBResources.ts",
|
||||||
|
"./src/Utils/arm/generatedClients/2020-04-01/operations.ts",
|
||||||
|
"./src/Utils/arm/generatedClients/2020-04-01/partitionKeyRangeId.ts",
|
||||||
|
"./src/Utils/arm/generatedClients/2020-04-01/partitionKeyRangeIdRegion.ts",
|
||||||
|
"./src/Utils/arm/generatedClients/2020-04-01/percentile.ts",
|
||||||
|
"./src/Utils/arm/generatedClients/2020-04-01/percentileSourceTarget.ts",
|
||||||
|
"./src/Utils/arm/generatedClients/2020-04-01/percentileTarget.ts",
|
||||||
|
"./src/Utils/arm/generatedClients/2020-04-01/sqlResources.ts",
|
||||||
|
"./src/Utils/arm/generatedClients/2020-04-01/tableResources.ts",
|
||||||
|
"./src/Utils/arm/generatedClients/2020-04-01/types.ts",
|
||||||
|
"./src/Utils/arm/request.ts",
|
||||||
|
"./src/quickstart.ts",
|
||||||
|
"./src/setupTests.ts",
|
||||||
|
"./src/workers/upload/definitions.ts"
|
||||||
|
],
|
||||||
|
"include": []
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user