mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-24 11:21:23 +00:00
Compare commits
1 Commits
Remove-Exp
...
languy-com
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8141799ffd |
@@ -24,6 +24,7 @@ src/Common/ObjectCache.test.ts
|
|||||||
src/Common/ObjectCache.ts
|
src/Common/ObjectCache.ts
|
||||||
src/Common/QueriesClient.ts
|
src/Common/QueriesClient.ts
|
||||||
src/Common/Splitter.ts
|
src/Common/Splitter.ts
|
||||||
|
src/Common/UrlUtility.ts
|
||||||
src/Config.ts
|
src/Config.ts
|
||||||
src/Contracts/ActionContracts.ts
|
src/Contracts/ActionContracts.ts
|
||||||
src/Contracts/DataModels.ts
|
src/Contracts/DataModels.ts
|
||||||
@@ -45,6 +46,7 @@ src/Definitions/jquery.d.ts
|
|||||||
src/Definitions/plotly.js-cartesian-dist.d-min.ts
|
src/Definitions/plotly.js-cartesian-dist.d-min.ts
|
||||||
src/Definitions/png.d.ts
|
src/Definitions/png.d.ts
|
||||||
src/Definitions/svg.d.ts
|
src/Definitions/svg.d.ts
|
||||||
|
src/Definitions/worker.d.ts
|
||||||
src/Explorer/ComponentRegisterer.test.ts
|
src/Explorer/ComponentRegisterer.test.ts
|
||||||
src/Explorer/ComponentRegisterer.ts
|
src/Explorer/ComponentRegisterer.ts
|
||||||
src/Explorer/ContextMenuButtonFactory.ts
|
src/Explorer/ContextMenuButtonFactory.ts
|
||||||
@@ -90,11 +92,13 @@ src/Explorer/Graph/GraphExplorerComponent/GremlinSimpleClient.test.ts
|
|||||||
src/Explorer/Graph/GraphExplorerComponent/GremlinSimpleClient.ts
|
src/Explorer/Graph/GraphExplorerComponent/GremlinSimpleClient.ts
|
||||||
src/Explorer/Graph/GraphStyleComponent/GraphStyle.test.ts
|
src/Explorer/Graph/GraphStyleComponent/GraphStyle.test.ts
|
||||||
src/Explorer/Graph/GraphStyleComponent/GraphStyleComponent.ts
|
src/Explorer/Graph/GraphStyleComponent/GraphStyleComponent.ts
|
||||||
|
src/Explorer/Graph/NewVertexComponent/NewVertex.test.ts
|
||||||
|
src/Explorer/Graph/NewVertexComponent/NewVertexComponent.ts
|
||||||
src/Explorer/Menus/CommandBar/CommandBarComponentButtonFactory.test.ts
|
src/Explorer/Menus/CommandBar/CommandBarComponentButtonFactory.test.ts
|
||||||
src/Explorer/Menus/CommandBar/CommandBarComponentButtonFactory.ts
|
src/Explorer/Menus/CommandBar/CommandBarComponentButtonFactory.ts
|
||||||
src/Explorer/Menus/ContextMenu.ts
|
src/Explorer/Menus/ContextMenu.ts
|
||||||
src/Explorer/MostRecentActivity/MostRecentActivity.ts
|
src/Explorer/MostRecentActivity/MostRecentActivity.ts
|
||||||
|
src/Explorer/Notebook/FileSystemUtil.ts
|
||||||
src/Explorer/Notebook/NotebookClientV2.ts
|
src/Explorer/Notebook/NotebookClientV2.ts
|
||||||
src/Explorer/Notebook/NotebookComponent/NotebookContentProvider.ts
|
src/Explorer/Notebook/NotebookComponent/NotebookContentProvider.ts
|
||||||
src/Explorer/Notebook/NotebookComponent/__mocks__/rx-jupyter.ts
|
src/Explorer/Notebook/NotebookComponent/__mocks__/rx-jupyter.ts
|
||||||
@@ -119,20 +123,33 @@ src/Explorer/Panes/AddDatabasePane.ts
|
|||||||
src/Explorer/Panes/BrowseQueriesPane.ts
|
src/Explorer/Panes/BrowseQueriesPane.ts
|
||||||
src/Explorer/Panes/CassandraAddCollectionPane.ts
|
src/Explorer/Panes/CassandraAddCollectionPane.ts
|
||||||
src/Explorer/Panes/ContextualPaneBase.ts
|
src/Explorer/Panes/ContextualPaneBase.ts
|
||||||
|
src/Explorer/Panes/DeleteCollectionConfirmationPane.test.ts
|
||||||
|
src/Explorer/Panes/DeleteCollectionConfirmationPane.ts
|
||||||
src/Explorer/Panes/DeleteDatabaseConfirmationPane.test.ts
|
src/Explorer/Panes/DeleteDatabaseConfirmationPane.test.ts
|
||||||
src/Explorer/Panes/DeleteDatabaseConfirmationPane.ts
|
src/Explorer/Panes/DeleteDatabaseConfirmationPane.ts
|
||||||
|
src/Explorer/Panes/ExecuteSprocParamsPane.ts
|
||||||
src/Explorer/Panes/GraphStylingPane.ts
|
src/Explorer/Panes/GraphStylingPane.ts
|
||||||
# src/Explorer/Panes/NewVertexPane.ts
|
src/Explorer/Panes/LoadQueryPane.ts
|
||||||
|
src/Explorer/Panes/NewVertexPane.ts
|
||||||
src/Explorer/Panes/PaneComponents.ts
|
src/Explorer/Panes/PaneComponents.ts
|
||||||
src/Explorer/Panes/RenewAdHocAccessPane.ts
|
src/Explorer/Panes/RenewAdHocAccessPane.ts
|
||||||
|
src/Explorer/Panes/SaveQueryPane.ts
|
||||||
|
src/Explorer/Panes/SettingsPane.test.ts
|
||||||
|
src/Explorer/Panes/SettingsPane.ts
|
||||||
|
src/Explorer/Panes/SetupNotebooksPane.ts
|
||||||
src/Explorer/Panes/StringInputPane.ts
|
src/Explorer/Panes/StringInputPane.ts
|
||||||
src/Explorer/Panes/SwitchDirectoryPane.ts
|
src/Explorer/Panes/SwitchDirectoryPane.ts
|
||||||
|
src/Explorer/Panes/Tables/AddTableEntityPane.ts
|
||||||
src/Explorer/Panes/Tables/EditTableEntityPane.ts
|
src/Explorer/Panes/Tables/EditTableEntityPane.ts
|
||||||
src/Explorer/Panes/Tables/EntityPropertyViewModel.ts
|
src/Explorer/Panes/Tables/EntityPropertyViewModel.ts
|
||||||
|
src/Explorer/Panes/Tables/QuerySelectPane.ts
|
||||||
|
src/Explorer/Panes/Tables/TableColumnOptionsPane.ts
|
||||||
src/Explorer/Panes/Tables/TableEntityPane.ts
|
src/Explorer/Panes/Tables/TableEntityPane.ts
|
||||||
src/Explorer/Panes/Tables/Validators/EntityPropertyNameValidator.ts
|
src/Explorer/Panes/Tables/Validators/EntityPropertyNameValidator.ts
|
||||||
src/Explorer/Panes/Tables/Validators/EntityPropertyValidationCommon.ts
|
src/Explorer/Panes/Tables/Validators/EntityPropertyValidationCommon.ts
|
||||||
src/Explorer/Panes/Tables/Validators/EntityPropertyValueValidator.ts
|
src/Explorer/Panes/Tables/Validators/EntityPropertyValueValidator.ts
|
||||||
|
src/Explorer/Panes/UploadFilePane.ts
|
||||||
|
src/Explorer/Panes/UploadItemsPane.ts
|
||||||
src/Explorer/SplashScreen/SplashScreen.test.ts
|
src/Explorer/SplashScreen/SplashScreen.test.ts
|
||||||
src/Explorer/Tables/Constants.ts
|
src/Explorer/Tables/Constants.ts
|
||||||
src/Explorer/Tables/DataTable/CacheBase.ts
|
src/Explorer/Tables/DataTable/CacheBase.ts
|
||||||
@@ -239,11 +256,15 @@ src/Terminal/NotebookAppContracts.d.ts
|
|||||||
src/Terminal/index.ts
|
src/Terminal/index.ts
|
||||||
src/TokenProviders/PortalTokenProvider.ts
|
src/TokenProviders/PortalTokenProvider.ts
|
||||||
src/TokenProviders/TokenProviderFactory.ts
|
src/TokenProviders/TokenProviderFactory.ts
|
||||||
|
src/Utils/DatabaseAccountUtils.test.ts
|
||||||
|
src/Utils/DatabaseAccountUtils.ts
|
||||||
src/Utils/PricingUtils.test.ts
|
src/Utils/PricingUtils.test.ts
|
||||||
src/Utils/QueryUtils.test.ts
|
src/Utils/QueryUtils.test.ts
|
||||||
|
src/Utils/QueryUtils.ts
|
||||||
src/applyExplorerBindings.ts
|
src/applyExplorerBindings.ts
|
||||||
src/global.d.ts
|
src/global.d.ts
|
||||||
src/setupTests.ts
|
src/setupTests.ts
|
||||||
|
src/workers/upload/index.ts
|
||||||
src/Explorer/Controls/AccessibleElement/AccessibleElement.tsx
|
src/Explorer/Controls/AccessibleElement/AccessibleElement.tsx
|
||||||
src/Explorer/Controls/Accordion/AccordionComponent.tsx
|
src/Explorer/Controls/Accordion/AccordionComponent.tsx
|
||||||
src/Explorer/Controls/AccountSwitch/AccountSwitchComponent.test.tsx
|
src/Explorer/Controls/AccountSwitch/AccountSwitchComponent.test.tsx
|
||||||
@@ -291,6 +312,8 @@ src/Explorer/Graph/GraphExplorerComponent/ReadOnlyNodePropertiesComponent.test.t
|
|||||||
src/Explorer/Graph/GraphExplorerComponent/ReadOnlyNodePropertiesComponent.tsx
|
src/Explorer/Graph/GraphExplorerComponent/ReadOnlyNodePropertiesComponent.tsx
|
||||||
src/Explorer/Menus/CommandBar/CommandBarUtil.tsx
|
src/Explorer/Menus/CommandBar/CommandBarUtil.tsx
|
||||||
src/Explorer/Menus/NotificationConsole/NotificationConsoleComponent.test.tsx
|
src/Explorer/Menus/NotificationConsole/NotificationConsoleComponent.test.tsx
|
||||||
|
src/Explorer/Menus/NotificationConsole/NotificationConsoleComponent.tsx
|
||||||
|
src/Explorer/Menus/NotificationConsole/NotificationConsoleComponentAdapter.tsx
|
||||||
src/Explorer/Notebook/NotebookComponent/NotebookComponent.tsx
|
src/Explorer/Notebook/NotebookComponent/NotebookComponent.tsx
|
||||||
src/Explorer/Notebook/NotebookComponent/NotebookComponentAdapter.tsx
|
src/Explorer/Notebook/NotebookComponent/NotebookComponentAdapter.tsx
|
||||||
src/Explorer/Notebook/NotebookComponent/NotebookComponentBootstrapper.tsx
|
src/Explorer/Notebook/NotebookComponent/NotebookComponentBootstrapper.tsx
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ module.exports = {
|
|||||||
browser: true,
|
browser: true,
|
||||||
es6: true,
|
es6: true,
|
||||||
},
|
},
|
||||||
plugins: ["@typescript-eslint", "no-null", "prefer-arrow", "react-hooks"],
|
plugins: ["@typescript-eslint", "no-null", "prefer-arrow"],
|
||||||
extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
|
extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
|
||||||
globals: {
|
globals: {
|
||||||
Atomics: "readonly",
|
Atomics: "readonly",
|
||||||
@@ -20,7 +20,7 @@ module.exports = {
|
|||||||
overrides: [
|
overrides: [
|
||||||
{
|
{
|
||||||
files: ["**/*.tsx"],
|
files: ["**/*.tsx"],
|
||||||
extends: ["plugin:react/recommended"],
|
extends: ["plugin:react/recommended"], // TODO: Add react-hooks
|
||||||
plugins: ["react"],
|
plugins: ["react"],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -42,8 +42,6 @@ module.exports = {
|
|||||||
"prefer-arrow/prefer-arrow-functions": ["error", { allowStandaloneDeclarations: true }],
|
"prefer-arrow/prefer-arrow-functions": ["error", { allowStandaloneDeclarations: true }],
|
||||||
eqeqeq: "error",
|
eqeqeq: "error",
|
||||||
"react/display-name": "off",
|
"react/display-name": "off",
|
||||||
"react-hooks/rules-of-hooks": "warn", // TODO: error
|
|
||||||
"react-hooks/exhaustive-deps": "warn", // TODO: error
|
|
||||||
"no-restricted-syntax": [
|
"no-restricted-syntax": [
|
||||||
"error",
|
"error",
|
||||||
{
|
{
|
||||||
|
|||||||
1
.github/PULL_REQUEST_TEMPLATE.md
vendored
1
.github/PULL_REQUEST_TEMPLATE.md
vendored
@@ -1 +0,0 @@
|
|||||||
[Preview this branch](https://cosmos-explorer-preview.azurewebsites.net/pull/EDIT_THIS_NUMBER_IN_THE_PR_DESCRIPTION?feature.someFeatureFlagYouMightNeed=true)
|
|
||||||
9
.github/dependabot.yml
vendored
9
.github/dependabot.yml
vendored
@@ -1,9 +0,0 @@
|
|||||||
# Please see the documentation for all configuration options:
|
|
||||||
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
|
|
||||||
|
|
||||||
version: 2
|
|
||||||
updates:
|
|
||||||
- package-ecosystem: "npm"
|
|
||||||
directory: "/"
|
|
||||||
schedule:
|
|
||||||
interval: "daily"
|
|
||||||
80
.github/workflows/ci.yml
vendored
80
.github/workflows/ci.yml
vendored
@@ -70,6 +70,7 @@ jobs:
|
|||||||
- run: npm run test
|
- run: npm run test
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
needs: [lint, format, compile, unittest]
|
||||||
name: "Build"
|
name: "Build"
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
@@ -91,18 +92,9 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
name: dist
|
name: dist
|
||||||
path: dist/
|
path: dist/
|
||||||
- name: Upload build to preview blob storage
|
|
||||||
run: az storage blob upload-batch -d '$web' -s 'dist' --account-name cosmosexplorerpreview --subscription cosmosdb-portalteam-generaldemo --destination-path "${{github.event.pull_request.head.sha}}" --account-key="${PREVIEW_STORAGE_KEY}"
|
|
||||||
env:
|
|
||||||
PREVIEW_STORAGE_KEY: ${{ secrets.PREVIEW_STORAGE_KEY }}
|
|
||||||
- name: Upload preview config to blob storage
|
|
||||||
run: az storage blob upload -c '$web' -f ./preview/config.json --account-name cosmosexplorerpreview --subscription cosmosdb-portalteam-generaldemo --name "${{github.event.pull_request.head.sha}}/config.json" --account-key="${PREVIEW_STORAGE_KEY}"
|
|
||||||
env:
|
|
||||||
PREVIEW_STORAGE_KEY: ${{ secrets.PREVIEW_STORAGE_KEY }}
|
|
||||||
endtoendemulator:
|
endtoendemulator:
|
||||||
name: "End To End Emulator Tests"
|
name: "End To End Emulator Tests"
|
||||||
# Temporarily disabled. This test needs to be rewritten in playwright
|
if: github.ref == 'refs/heads/master' || contains(github.ref, 'hotfix/') || contains(github.ref, 'release/')
|
||||||
if: false
|
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
@@ -127,21 +119,58 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
name: screenshots
|
name: screenshots
|
||||||
path: failed-*
|
path: failed-*
|
||||||
endtoend:
|
accessibility:
|
||||||
name: "E2E"
|
name: "Accessibility | Hosted"
|
||||||
|
needs: [lint, format, compile, unittest]
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Use Node.js 14.x
|
||||||
|
uses: actions/setup-node@v1
|
||||||
|
with:
|
||||||
|
node-version: 14.x
|
||||||
|
- name: Accessibility Check
|
||||||
|
run: |
|
||||||
|
# Ubuntu gets mad when webpack runs too many files watchers
|
||||||
|
cat /proc/sys/fs/inotify/max_user_watches
|
||||||
|
sudo sysctl fs.inotify.max_user_watches=524288
|
||||||
|
sudo sysctl -p
|
||||||
|
npm ci
|
||||||
|
npm start &
|
||||||
|
npx wait-on -i 5000 https-get://0.0.0.0:1234/
|
||||||
|
node utils/accesibilityCheck.js
|
||||||
|
shell: bash
|
||||||
|
env:
|
||||||
|
NODE_TLS_REJECT_UNAUTHORIZED: 0
|
||||||
|
endtoendhosted:
|
||||||
|
name: "End to End Tests"
|
||||||
|
needs: [cleanupaccounts]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
env:
|
env:
|
||||||
NODE_TLS_REJECT_UNAUTHORIZED: 0
|
NODE_TLS_REJECT_UNAUTHORIZED: 0
|
||||||
|
PORTAL_RUNNER_SUBSCRIPTION: ${{ secrets.PORTAL_RUNNER_SUBSCRIPTION }}
|
||||||
|
PORTAL_RUNNER_RESOURCE_GROUP: ${{ secrets.PORTAL_RUNNER_RESOURCE_GROUP }}
|
||||||
|
PORTAL_RUNNER_DATABASE_ACCOUNT: ${{ secrets.PORTAL_RUNNER_DATABASE_ACCOUNT }}
|
||||||
|
PORTAL_RUNNER_DATABASE_ACCOUNT_KEY: ${{ secrets.PORTAL_RUNNER_DATABASE_ACCOUNT_KEY }}
|
||||||
|
PORTAL_RUNNER_MONGO_DATABASE_ACCOUNT: ${{ secrets.PORTAL_RUNNER_MONGO_DATABASE_ACCOUNT }}
|
||||||
|
PORTAL_RUNNER_MONGO_DATABASE_ACCOUNT_KEY: ${{ secrets.PORTAL_RUNNER_MONGO_DATABASE_ACCOUNT_KEY }}
|
||||||
|
NOTEBOOKS_TEST_RUNNER_TENANT_ID: ${{ secrets.NOTEBOOKS_TEST_RUNNER_TENANT_ID }}
|
||||||
|
NOTEBOOKS_TEST_RUNNER_CLIENT_ID: ${{ secrets.NOTEBOOKS_TEST_RUNNER_CLIENT_ID }}
|
||||||
NOTEBOOKS_TEST_RUNNER_CLIENT_SECRET: ${{ secrets.NOTEBOOKS_TEST_RUNNER_CLIENT_SECRET }}
|
NOTEBOOKS_TEST_RUNNER_CLIENT_SECRET: ${{ secrets.NOTEBOOKS_TEST_RUNNER_CLIENT_SECRET }}
|
||||||
|
PORTAL_RUNNER_CONNECTION_STRING: ${{ secrets.CONNECTION_STRING_SQL }}
|
||||||
|
MONGO_CONNECTION_STRING: ${{ secrets.CONNECTION_STRING_MONGO }}
|
||||||
|
CASSANDRA_CONNECTION_STRING: ${{ secrets.CONNECTION_STRING_CASSANDRA }}
|
||||||
|
TABLES_CONNECTION_STRING: ${{ secrets.CONNECTION_STRING_TABLE }}
|
||||||
|
DATA_EXPLORER_ENDPOINT: "https://localhost:1234/hostedExplorer.html"
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
test-file:
|
test-file:
|
||||||
- ./test/cassandra/container.spec.ts
|
- ./test/cassandra/container.spec.ts
|
||||||
- ./test/sql/container.spec.ts
|
- ./test/mongo/mongoIndexPolicy.spec.ts
|
||||||
- ./test/mongo/container.spec.ts
|
- ./test/notebooks/uploadAndOpenNotebook.spec.ts
|
||||||
- ./test/selfServe/selfServeExample.spec.ts
|
- ./test/selfServe/selfServeExample.spec.ts
|
||||||
- ./test/notebooks/upload.spec.ts
|
- ./test/sql/container.spec.ts
|
||||||
- ./test/sql/resourceToken.spec.ts
|
- ./test/sql/resourceToken.spec.ts
|
||||||
- ./test/tables/container.spec.ts
|
- ./test/tables/container.spec.ts
|
||||||
steps:
|
steps:
|
||||||
@@ -152,17 +181,30 @@ jobs:
|
|||||||
node-version: 14.x
|
node-version: 14.x
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
- run: npm start &
|
- run: npm start &
|
||||||
|
- run: node utils/cleanupDBs.js
|
||||||
- run: npm run wait-for-server
|
- run: npm run wait-for-server
|
||||||
- name: ${{ matrix['test-file'] }}
|
- name: ${{ matrix['test-file'] }}
|
||||||
run: |
|
run: npx jest -c ./jest.config.e2e.js --detectOpenHandles ${{ matrix['test-file'] }}
|
||||||
# Run tests up to three times
|
|
||||||
for i in $(seq 1 3); do npx jest -c ./jest.config.playwright.js ${{ matrix['test-file'] }} && s=0 && break || s=$? && sleep 1; done; (exit $s)
|
|
||||||
shell: bash
|
shell: bash
|
||||||
- uses: actions/upload-artifact@v2
|
- uses: actions/upload-artifact@v2
|
||||||
if: failure()
|
if: failure()
|
||||||
with:
|
with:
|
||||||
name: screenshots
|
name: screenshots
|
||||||
path: screenshots/
|
path: failed-*
|
||||||
|
cleanupaccounts:
|
||||||
|
name: "Cleanup Test Database Accounts"
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
NOTEBOOKS_TEST_RUNNER_CLIENT_ID: ${{ secrets.NOTEBOOKS_TEST_RUNNER_CLIENT_ID }}
|
||||||
|
NOTEBOOKS_TEST_RUNNER_CLIENT_SECRET: ${{ secrets.NOTEBOOKS_TEST_RUNNER_CLIENT_SECRET }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Use Node.js 14.x
|
||||||
|
uses: actions/setup-node@v1
|
||||||
|
with:
|
||||||
|
node-version: 14.x
|
||||||
|
- run: npm ci
|
||||||
|
- run: node utils/cleanupDBs.js
|
||||||
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/')
|
||||||
|
|||||||
28
.github/workflows/cleanup.yml
vendored
28
.github/workflows/cleanup.yml
vendored
@@ -1,28 +0,0 @@
|
|||||||
# This is a basic workflow to help you get started with Actions
|
|
||||||
|
|
||||||
name: Cleanup End to End Account Resources
|
|
||||||
|
|
||||||
on:
|
|
||||||
# Allows you to run this workflow manually from the Actions tab
|
|
||||||
workflow_dispatch:
|
|
||||||
schedule:
|
|
||||||
# Once every hour
|
|
||||||
- cron: "0 * * * *"
|
|
||||||
|
|
||||||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
|
|
||||||
jobs:
|
|
||||||
# This workflow contains a single job called "build"
|
|
||||||
cleanupaccounts:
|
|
||||||
name: "Cleanup Test Database Accounts"
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
env:
|
|
||||||
NOTEBOOKS_TEST_RUNNER_CLIENT_ID: ${{ secrets.NOTEBOOKS_TEST_RUNNER_CLIENT_ID }}
|
|
||||||
NOTEBOOKS_TEST_RUNNER_CLIENT_SECRET: ${{ secrets.NOTEBOOKS_TEST_RUNNER_CLIENT_SECRET }}
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- name: Use Node.js 14.x
|
|
||||||
uses: actions/setup-node@v1
|
|
||||||
with:
|
|
||||||
node-version: 14.x
|
|
||||||
- run: npm ci
|
|
||||||
- run: node utils/cleanupDBs.js
|
|
||||||
4
.gitignore
vendored
4
.gitignore
vendored
@@ -14,6 +14,4 @@ Contracts/*
|
|||||||
.DS_Store
|
.DS_Store
|
||||||
.cache/
|
.cache/
|
||||||
.env
|
.env
|
||||||
failure.png
|
failure.png
|
||||||
screenshots/*
|
|
||||||
GettingStarted-ignore*.ipynb
|
|
||||||
@@ -153,7 +153,7 @@ Cosmos Explorer has been under constant development for over 5 years. As a resul
|
|||||||
|
|
||||||
✅ DO
|
✅ DO
|
||||||
|
|
||||||
- Use [Playwright](https://github.com/microsoft/playwright) and [Jest](https://jestjs.io/)
|
- Use [Puppeteer](https://developers.google.com/web/tools/puppeteer) and [Jest](https://jestjs.io/)
|
||||||
- Write or modify an existing E2E test that covers the primary use case of any major feature.
|
- Write or modify an existing E2E test that covers the primary use case of any major feature.
|
||||||
- Use caution. Do not try to cover every case. End to End tests can be slow and brittle.
|
- Use caution. Do not try to cover every case. End to End tests can be slow and brittle.
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ Run `npm start` to start the development server and automatically rebuild on cha
|
|||||||
### Hosted Development (https://cosmos.azure.com)
|
### Hosted Development (https://cosmos.azure.com)
|
||||||
|
|
||||||
- Visit: `https://localhost:1234/hostedExplorer.html`
|
- Visit: `https://localhost:1234/hostedExplorer.html`
|
||||||
|
- Local sign in via AAD will NOT work. Connection string only in dev mode. Use the Portal if you need AAD auth.
|
||||||
- The default webpack dev server configuration will proxy requests to the production portal backend: `https://main.documentdb.ext.azure.com`. This will allow you to use production connection strings on your local machine.
|
- The default webpack dev server configuration will proxy requests to the production portal backend: `https://main.documentdb.ext.azure.com`. This will allow you to use production connection strings on your local machine.
|
||||||
|
|
||||||
### Emulator Development
|
### Emulator Development
|
||||||
@@ -68,7 +69,7 @@ Jest and Puppeteer are used for end to end browser based tests and are contained
|
|||||||
|
|
||||||
We generally adhere to the release strategy [documented by the Azure SDK Guidelines](https://azure.github.io/azure-sdk/policies_repobranching.html#release-branches). Most releases should happen from the master branch. If master contains commits that cannot be released, you may create a release from a `release/` or `hotfix/` branch. See linked documentation for more details.
|
We generally adhere to the release strategy [documented by the Azure SDK Guidelines](https://azure.github.io/azure-sdk/policies_repobranching.html#release-branches). Most releases should happen from the master branch. If master contains commits that cannot be released, you may create a release from a `release/` or `hotfix/` branch. See linked documentation for more details.
|
||||||
|
|
||||||
### Architecture
|
### Architechture
|
||||||
|
|
||||||
[](https://mermaid-js.github.io/mermaid-live-editor/#/edit/eyJjb2RlIjoiZ3JhcGggTFJcbiAgaG9zdGVkKGh0dHBzOi8vY29zbW9zLmF6dXJlLmNvbSlcbiAgcG9ydGFsKFBvcnRhbClcbiAgZW11bGF0b3IoRW11bGF0b3IpXG4gIGFhZFtBQURdXG4gIHJlc291cmNlVG9rZW5bUmVzb3VyY2UgVG9rZW5dXG4gIGNvbm5lY3Rpb25TdHJpbmdbQ29ubmVjdGlvbiBTdHJpbmddXG4gIHBvcnRhbFRva2VuW0VuY3J5cHRlZCBQb3J0YWwgVG9rZW5dXG4gIG1hc3RlcktleVtNYXN0ZXIgS2V5XVxuICBhcm1bQVJNIFJlc291cmNlIFByb3ZpZGVyXVxuICBkYXRhcGxhbmVbRGF0YSBQbGFuZV1cbiAgcHJveHlbUG9ydGFsIEFQSSBQcm94eV1cbiAgc3FsW1NRTF1cbiAgbW9uZ29bTW9uZ29dXG4gIHRhYmxlc1tUYWJsZXNdXG4gIGNhc3NhbmRyYVtDYXNzYW5kcmFdXG4gIGdyYWZbR3JhcGhdXG5cblxuICBlbXVsYXRvciAtLT4gbWFzdGVyS2V5IC0tLS0-IGRhdGFwbGFuZVxuICBwb3J0YWwgLS0-IGFhZFxuICBob3N0ZWQgLS0-IHBvcnRhbFRva2VuICYgcmVzb3VyY2VUb2tlbiAmIGNvbm5lY3Rpb25TdHJpbmcgJiBhYWRcbiAgYWFkIC0tLT4gYXJtXG4gIGFhZCAtLS0-IGRhdGFwbGFuZVxuICBhYWQgLS0tPiBwcm94eVxuICByZXNvdXJjZVRva2VuIC0tLT4gc3FsIC0tPiBkYXRhcGxhbmVcbiAgcG9ydGFsVG9rZW4gLS0tPiBwcm94eVxuICBwcm94eSAtLT4gZGF0YXBsYW5lXG4gIGNvbm5lY3Rpb25TdHJpbmcgLS0-IHNxbCAmIG1vbmdvICYgY2Fzc2FuZHJhICYgZ3JhZiAmIHRhYmxlc1xuICBzcWwgLS0-IGRhdGFwbGFuZVxuICB0YWJsZXMgLS0-IGRhdGFwbGFuZVxuICBtb25nbyAtLT4gcHJveHlcbiAgY2Fzc2FuZHJhIC0tPiBwcm94eVxuICBncmFmIC0tPiBwcm94eVxuXG5cdFx0IiwibWVybWFpZCI6eyJ0aGVtZSI6ImRlZmF1bHQifSwidXBkYXRlRWRpdG9yIjpmYWxzZX0)
|
[](https://mermaid-js.github.io/mermaid-live-editor/#/edit/eyJjb2RlIjoiZ3JhcGggTFJcbiAgaG9zdGVkKGh0dHBzOi8vY29zbW9zLmF6dXJlLmNvbSlcbiAgcG9ydGFsKFBvcnRhbClcbiAgZW11bGF0b3IoRW11bGF0b3IpXG4gIGFhZFtBQURdXG4gIHJlc291cmNlVG9rZW5bUmVzb3VyY2UgVG9rZW5dXG4gIGNvbm5lY3Rpb25TdHJpbmdbQ29ubmVjdGlvbiBTdHJpbmddXG4gIHBvcnRhbFRva2VuW0VuY3J5cHRlZCBQb3J0YWwgVG9rZW5dXG4gIG1hc3RlcktleVtNYXN0ZXIgS2V5XVxuICBhcm1bQVJNIFJlc291cmNlIFByb3ZpZGVyXVxuICBkYXRhcGxhbmVbRGF0YSBQbGFuZV1cbiAgcHJveHlbUG9ydGFsIEFQSSBQcm94eV1cbiAgc3FsW1NRTF1cbiAgbW9uZ29bTW9uZ29dXG4gIHRhYmxlc1tUYWJsZXNdXG4gIGNhc3NhbmRyYVtDYXNzYW5kcmFdXG4gIGdyYWZbR3JhcGhdXG5cblxuICBlbXVsYXRvciAtLT4gbWFzdGVyS2V5IC0tLS0-IGRhdGFwbGFuZVxuICBwb3J0YWwgLS0-IGFhZFxuICBob3N0ZWQgLS0-IHBvcnRhbFRva2VuICYgcmVzb3VyY2VUb2tlbiAmIGNvbm5lY3Rpb25TdHJpbmcgJiBhYWRcbiAgYWFkIC0tLT4gYXJtXG4gIGFhZCAtLS0-IGRhdGFwbGFuZVxuICBhYWQgLS0tPiBwcm94eVxuICByZXNvdXJjZVRva2VuIC0tLT4gc3FsIC0tPiBkYXRhcGxhbmVcbiAgcG9ydGFsVG9rZW4gLS0tPiBwcm94eVxuICBwcm94eSAtLT4gZGF0YXBsYW5lXG4gIGNvbm5lY3Rpb25TdHJpbmcgLS0-IHNxbCAmIG1vbmdvICYgY2Fzc2FuZHJhICYgZ3JhZiAmIHRhYmxlc1xuICBzcWwgLS0-IGRhdGFwbGFuZVxuICB0YWJsZXMgLS0-IGRhdGFwbGFuZVxuICBtb25nbyAtLT4gcHJveHlcbiAgY2Fzc2FuZHJhIC0tPiBwcm94eVxuICBncmFmIC0tPiBwcm94eVxuXG5cdFx0IiwibWVybWFpZCI6eyJ0aGVtZSI6ImRlZmF1bHQifSwidXBkYXRlRWRpdG9yIjpmYWxzZX0)
|
||||||
|
|
||||||
|
|||||||
4
config.json
Normal file
4
config.json
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"GITHUB_CLIENT_ID": "167ea4b09801db1de03d",
|
||||||
|
"GITHUB_CLIENT_SECRET": "e7bb10a3a8da428815805c6fc483560a035a73c1"
|
||||||
|
}
|
||||||
10
externals/iframeResizer.contentWindow.min.js
vendored
10
externals/iframeResizer.contentWindow.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -1,13 +1,11 @@
|
|||||||
const isCI = require("is-ci");
|
const isCI = require("is-ci");
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
exitOnPageError: false,
|
launch: {
|
||||||
launchOptions: {
|
|
||||||
headless: isCI,
|
headless: isCI,
|
||||||
slowMo: 10,
|
slowMo: 55,
|
||||||
timeout: 60000,
|
defaultViewport: null,
|
||||||
},
|
|
||||||
contextOptions: {
|
|
||||||
ignoreHTTPSErrors: true,
|
ignoreHTTPSErrors: true,
|
||||||
|
args: ["--disable-web-security"],
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
5
jest.config.e2e.js
Normal file
5
jest.config.e2e.js
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
module.exports = {
|
||||||
|
preset: "jest-puppeteer",
|
||||||
|
testMatch: ["<rootDir>/test/**/*.spec.[jt]s?(x)"],
|
||||||
|
setupFiles: ["dotenv/config"],
|
||||||
|
};
|
||||||
@@ -21,13 +21,17 @@ module.exports = {
|
|||||||
collectCoverage: true,
|
collectCoverage: true,
|
||||||
|
|
||||||
// An array of glob patterns indicating a set of files for which coverage information should be collected
|
// An array of glob patterns indicating a set of files for which coverage information should be collected
|
||||||
collectCoverageFrom: ["src/**/*.{js,jsx,ts,tsx}"],
|
// collectCoverageFrom: [
|
||||||
|
// "src/Common/Headers*"
|
||||||
|
// ],
|
||||||
|
|
||||||
// The directory where Jest should output its coverage files
|
// The directory where Jest should output its coverage files
|
||||||
coverageDirectory: "coverage",
|
coverageDirectory: "coverage",
|
||||||
|
|
||||||
// An array of regexp pattern strings used to skip coverage collection
|
// An array of regexp pattern strings used to skip coverage collection
|
||||||
coveragePathIgnorePatterns: ["/node_modules/"],
|
// coveragePathIgnorePatterns: [
|
||||||
|
// "/node_modules/"
|
||||||
|
// ],
|
||||||
|
|
||||||
// A list of reporter names that Jest uses when writing coverage reports
|
// A list of reporter names that Jest uses when writing coverage reports
|
||||||
coverageReporters: ["json", "text", "cobertura"],
|
coverageReporters: ["json", "text", "cobertura"],
|
||||||
@@ -35,10 +39,10 @@ module.exports = {
|
|||||||
// An object that configures minimum threshold enforcement for coverage results
|
// An object that configures minimum threshold enforcement for coverage results
|
||||||
coverageThreshold: {
|
coverageThreshold: {
|
||||||
global: {
|
global: {
|
||||||
branches: 25,
|
branches: 22,
|
||||||
functions: 25,
|
functions: 28,
|
||||||
lines: 30,
|
lines: 33,
|
||||||
statements: 30,
|
statements: 31,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -67,8 +71,8 @@ module.exports = {
|
|||||||
|
|
||||||
// A map from regular expressions to module names that allow to stub out resources with a single module
|
// A map from regular expressions to module names that allow to stub out resources with a single module
|
||||||
moduleNameMapper: {
|
moduleNameMapper: {
|
||||||
"^.*[.](svg|png|gif|less|css)$": "<rootDir>/mockModule",
|
"^.*[.](svg|png|gif|less)$": "<rootDir>/mockModule",
|
||||||
"@nteract/stateful-components/(.*)$": "<rootDir>/mockModule",
|
"worker-loader": "<rootDir>/mockModule",
|
||||||
"office-ui-fabric-react/lib/(.*)$": "office-ui-fabric-react/lib-commonjs/$1", // https://github.com/OfficeDev/office-ui-fabric-react/wiki/Fabric-6-Release-Notes
|
"office-ui-fabric-react/lib/(.*)$": "office-ui-fabric-react/lib-commonjs/$1", // https://github.com/OfficeDev/office-ui-fabric-react/wiki/Fabric-6-Release-Notes
|
||||||
"^dnd-core$": "dnd-core/dist/cjs",
|
"^dnd-core$": "dnd-core/dist/cjs",
|
||||||
"^react-dnd$": "react-dnd/dist/cjs",
|
"^react-dnd$": "react-dnd/dist/cjs",
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
module.exports = {
|
|
||||||
preset: "jest-playwright-preset",
|
|
||||||
testMatch: ["<rootDir>/test/**/*.spec.[jt]s?(x)"],
|
|
||||||
setupFiles: ["dotenv/config"],
|
|
||||||
testEnvironment: "./test/playwrightEnv.js",
|
|
||||||
setupFilesAfterEnv: ["expect-playwright"],
|
|
||||||
};
|
|
||||||
@@ -718,7 +718,7 @@ execute-sproc-params-pane {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.stored-procedure-tab {
|
stored-procedure-tab {
|
||||||
@ToggleHeight: 30px;
|
@ToggleHeight: 30px;
|
||||||
@ToggleWidth: 180px;
|
@ToggleWidth: 180px;
|
||||||
|
|
||||||
|
|||||||
7584
package-lock.json
generated
7584
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
59
package.json
59
package.json
@@ -5,7 +5,7 @@
|
|||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@azure/arm-cosmosdb": "9.1.0",
|
"@azure/arm-cosmosdb": "9.1.0",
|
||||||
"@azure/cosmos": "3.10.5",
|
"@azure/cosmos": "3.9.0",
|
||||||
"@azure/cosmos-language-service": "0.0.5",
|
"@azure/cosmos-language-service": "0.0.5",
|
||||||
"@azure/identity": "1.2.1",
|
"@azure/identity": "1.2.1",
|
||||||
"@azure/ms-rest-nodeauth": "3.0.7",
|
"@azure/ms-rest-nodeauth": "3.0.7",
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
"@babel/plugin-proposal-decorators": "7.12.12",
|
"@babel/plugin-proposal-decorators": "7.12.12",
|
||||||
"@jupyterlab/services": "6.0.2",
|
"@jupyterlab/services": "6.0.2",
|
||||||
"@jupyterlab/terminal": "3.0.3",
|
"@jupyterlab/terminal": "3.0.3",
|
||||||
"@microsoft/applicationinsights-web": "2.6.1",
|
"@microsoft/applicationinsights-web": "2.5.9",
|
||||||
"@nteract/commutable": "7.4.2",
|
"@nteract/commutable": "7.4.2",
|
||||||
"@nteract/connected-components": "6.8.2",
|
"@nteract/connected-components": "6.8.2",
|
||||||
"@nteract/core": "15.1.0",
|
"@nteract/core": "15.1.0",
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
"@nteract/iron-icons": "1.0.0",
|
"@nteract/iron-icons": "1.0.0",
|
||||||
"@nteract/jupyter-widgets": "2.0.0",
|
"@nteract/jupyter-widgets": "2.0.0",
|
||||||
"@nteract/logos": "1.0.0",
|
"@nteract/logos": "1.0.0",
|
||||||
"@nteract/markdown": "4.6.0",
|
"@nteract/markdown": "4.4.0",
|
||||||
"@nteract/monaco-editor": "3.2.2",
|
"@nteract/monaco-editor": "3.2.2",
|
||||||
"@nteract/octicons": "2.0.0",
|
"@nteract/octicons": "2.0.0",
|
||||||
"@nteract/outputs": "3.0.9",
|
"@nteract/outputs": "3.0.9",
|
||||||
@@ -44,7 +44,9 @@
|
|||||||
"@types/node-fetch": "2.5.7",
|
"@types/node-fetch": "2.5.7",
|
||||||
"@uifabric/react-cards": "0.109.110",
|
"@uifabric/react-cards": "0.109.110",
|
||||||
"@uifabric/styling": "7.13.7",
|
"@uifabric/styling": "7.13.7",
|
||||||
|
"abort-controller": "3.0.0",
|
||||||
"applicationinsights": "1.8.0",
|
"applicationinsights": "1.8.0",
|
||||||
|
"babel-polyfill": "6.26.0",
|
||||||
"bootstrap": "3.4.1",
|
"bootstrap": "3.4.1",
|
||||||
"canvas": "file:./canvas",
|
"canvas": "file:./canvas",
|
||||||
"clean-webpack-plugin": "0.1.19",
|
"clean-webpack-plugin": "0.1.19",
|
||||||
@@ -58,6 +60,8 @@
|
|||||||
"date-fns": "1.29.0",
|
"date-fns": "1.29.0",
|
||||||
"dayjs": "1.8.19",
|
"dayjs": "1.8.19",
|
||||||
"dotenv": "8.2.0",
|
"dotenv": "8.2.0",
|
||||||
|
"es6-object-assign": "1.1.0",
|
||||||
|
"es6-symbol": "3.1.3",
|
||||||
"eslint-plugin-jest": "23.13.2",
|
"eslint-plugin-jest": "23.13.2",
|
||||||
"eslint-plugin-react": "7.20.0",
|
"eslint-plugin-react": "7.20.0",
|
||||||
"hasher": "1.2.0",
|
"hasher": "1.2.0",
|
||||||
@@ -65,7 +69,6 @@
|
|||||||
"i18next": "19.8.4",
|
"i18next": "19.8.4",
|
||||||
"i18next-browser-languagedetector": "6.0.1",
|
"i18next-browser-languagedetector": "6.0.1",
|
||||||
"i18next-http-backend": "1.0.23",
|
"i18next-http-backend": "1.0.23",
|
||||||
"iframe-resizer-react": "1.1.0",
|
|
||||||
"immutable": "4.0.0-rc.12",
|
"immutable": "4.0.0-rc.12",
|
||||||
"is-ci": "2.0.0",
|
"is-ci": "2.0.0",
|
||||||
"jquery": "3.5.1",
|
"jquery": "3.5.1",
|
||||||
@@ -76,10 +79,12 @@
|
|||||||
"monaco-editor": "0.18.1",
|
"monaco-editor": "0.18.1",
|
||||||
"ms": "2.1.3",
|
"ms": "2.1.3",
|
||||||
"msal": "1.4.4",
|
"msal": "1.4.4",
|
||||||
"office-ui-fabric-react": "7.164.2",
|
"object.entries": "1.1.0",
|
||||||
|
"office-ui-fabric-react": "7.134.1",
|
||||||
"p-retry": "4.2.0",
|
"p-retry": "4.2.0",
|
||||||
"plotly.js-cartesian-dist-min": "1.52.3",
|
"plotly.js-cartesian-dist-min": "1.52.3",
|
||||||
"post-robot": "10.0.42",
|
"promise-polyfill": "8.1.0",
|
||||||
|
"promise.prototype.finally": "3.1.0",
|
||||||
"q": "1.5.1",
|
"q": "1.5.1",
|
||||||
"react": "16.13.1",
|
"react": "16.13.1",
|
||||||
"react-animate-height": "2.0.8",
|
"react-animate-height": "2.0.8",
|
||||||
@@ -94,12 +99,15 @@
|
|||||||
"reflect-metadata": "0.1.13",
|
"reflect-metadata": "0.1.13",
|
||||||
"rx-jupyter": "5.5.12",
|
"rx-jupyter": "5.5.12",
|
||||||
"rxjs": "6.6.3",
|
"rxjs": "6.6.3",
|
||||||
"sanitize-html": "2.3.3",
|
|
||||||
"styled-components": "4.3.2",
|
"styled-components": "4.3.2",
|
||||||
"swr": "0.4.0",
|
"swr": "0.4.0",
|
||||||
"terser-webpack-plugin": "3.1.0",
|
"text-encoding": "0.7.0",
|
||||||
"underscore": "1.9.1",
|
"underscore": "1.9.1",
|
||||||
"utility-types": "3.10.0"
|
"url-polyfill": "1.1.7",
|
||||||
|
"utility-types": "3.10.0",
|
||||||
|
"webcrypto-liner": "1.1.4",
|
||||||
|
"webfontloader": "1.6.28",
|
||||||
|
"whatwg-fetch": "3.0.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "7.9.0",
|
"@babel/core": "7.9.0",
|
||||||
@@ -113,23 +121,28 @@
|
|||||||
"@types/d3": "5.9.2",
|
"@types/d3": "5.9.2",
|
||||||
"@types/enzyme": "3.10.7",
|
"@types/enzyme": "3.10.7",
|
||||||
"@types/enzyme-adapter-react-16": "1.0.6",
|
"@types/enzyme-adapter-react-16": "1.0.6",
|
||||||
|
"@types/expect-puppeteer": "4.4.3",
|
||||||
"@types/hasher": "0.0.31",
|
"@types/hasher": "0.0.31",
|
||||||
"@types/jest": "26.0.20",
|
"@types/jest": "26.0.20",
|
||||||
|
"@types/jest-environment-puppeteer": "4.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/post-robot": "10.0.1",
|
|
||||||
"@types/promise.prototype.finally": "2.0.3",
|
"@types/promise.prototype.finally": "2.0.3",
|
||||||
|
"@types/prop-types": "15.5.8",
|
||||||
|
"@types/puppeteer": "3.0.1",
|
||||||
"@types/q": "1.5.1",
|
"@types/q": "1.5.1",
|
||||||
"@types/react": "17.0.3",
|
"@types/react": "17.0.0",
|
||||||
"@types/react-dom": "17.0.3",
|
"@types/react-dom": "17.0.0",
|
||||||
"@types/react-notification-system": "0.2.39",
|
"@types/react-notification-system": "0.2.39",
|
||||||
"@types/react-redux": "7.1.7",
|
"@types/react-redux": "7.1.7",
|
||||||
"@types/sanitize-html": "1.27.2",
|
|
||||||
"@types/sinon": "2.3.3",
|
"@types/sinon": "2.3.3",
|
||||||
"@types/styled-components": "5.1.1",
|
"@types/styled-components": "5.1.1",
|
||||||
|
"@types/text-encoding": "0.0.33",
|
||||||
"@types/underscore": "1.7.36",
|
"@types/underscore": "1.7.36",
|
||||||
|
"@types/webfontloader": "1.6.29",
|
||||||
"@typescript-eslint/eslint-plugin": "4.0.1",
|
"@typescript-eslint/eslint-plugin": "4.0.1",
|
||||||
"@typescript-eslint/parser": "4.0.1",
|
"@typescript-eslint/parser": "4.0.1",
|
||||||
|
"axe-puppeteer": "1.1.0",
|
||||||
"babel-jest": "24.9.0",
|
"babel-jest": "24.9.0",
|
||||||
"babel-loader": "8.1.0",
|
"babel-loader": "8.1.0",
|
||||||
"buffer": "5.1.0",
|
"buffer": "5.1.0",
|
||||||
@@ -144,18 +157,17 @@
|
|||||||
"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",
|
||||||
"eslint-plugin-react-hooks": "4.2.0",
|
"eslint-plugin-react-hooks": "4.2.0",
|
||||||
"expect-playwright": "0.3.3",
|
|
||||||
"expose-loader": "0.7.5",
|
"expose-loader": "0.7.5",
|
||||||
"fast-glob": "3.2.5",
|
"fast-glob": "3.2.5",
|
||||||
"file-loader": "2.0.0",
|
"file-loader": "2.0.0",
|
||||||
"fs-extra": "7.0.0",
|
"fs-extra": "7.0.0",
|
||||||
"html-inline-css-webpack-plugin": "1.11.0",
|
|
||||||
"html-loader": "0.5.5",
|
"html-loader": "0.5.5",
|
||||||
"html-loader-jest": "0.2.1",
|
"html-loader-jest": "0.2.1",
|
||||||
"html-webpack-plugin": "4.5.2",
|
"html-webpack-plugin": "3.2.0",
|
||||||
|
"inline-css": "2.2.5",
|
||||||
"jest": "25.5.4",
|
"jest": "25.5.4",
|
||||||
"jest-canvas-mock": "2.1.0",
|
"jest-canvas-mock": "2.1.0",
|
||||||
"jest-playwright-preset": "1.5.1",
|
"jest-puppeteer": "4.4.0",
|
||||||
"jest-trx-results-processor": "0.0.7",
|
"jest-trx-results-processor": "0.0.7",
|
||||||
"less": "3.8.1",
|
"less": "3.8.1",
|
||||||
"less-loader": "4.1.0",
|
"less-loader": "4.1.0",
|
||||||
@@ -163,23 +175,24 @@
|
|||||||
"mini-css-extract-plugin": "0.4.3",
|
"mini-css-extract-plugin": "0.4.3",
|
||||||
"monaco-editor-webpack-plugin": "1.7.0",
|
"monaco-editor-webpack-plugin": "1.7.0",
|
||||||
"node-fetch": "2.6.1",
|
"node-fetch": "2.6.1",
|
||||||
"playwright": "1.10.0",
|
|
||||||
"prettier": "2.2.1",
|
"prettier": "2.2.1",
|
||||||
|
"puppeteer": "4.0.0",
|
||||||
"raw-loader": "0.5.1",
|
"raw-loader": "0.5.1",
|
||||||
"react-dev-utils": "11.0.4",
|
|
||||||
"rimraf": "3.0.0",
|
"rimraf": "3.0.0",
|
||||||
"sinon": "3.2.1",
|
"sinon": "3.2.1",
|
||||||
"style-loader": "0.23.0",
|
"style-loader": "0.23.0",
|
||||||
|
"terser-webpack-plugin": "3.0.5",
|
||||||
"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.2.4",
|
"typescript": "4.0.2",
|
||||||
"url-loader": "1.1.1",
|
"url-loader": "1.1.1",
|
||||||
"wait-on": "4.0.2",
|
"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",
|
||||||
"webpack-dev-server": "3.11.0"
|
"webpack-dev-server": "3.11.0",
|
||||||
|
"worker-loader": "2.0.0"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "node --max-old-space-size=10196 node_modules/webpack-dev-server/bin/webpack-dev-server.js",
|
"start": "node --max-old-space-size=10196 node_modules/webpack-dev-server/bin/webpack-dev-server.js",
|
||||||
@@ -202,8 +215,8 @@
|
|||||||
"format:check": "prettier --check \"{src,test}/**/*.{ts,tsx,html}\" \"*.{js,html}\"",
|
"format:check": "prettier --check \"{src,test}/**/*.{ts,tsx,html}\" \"*.{js,html}\"",
|
||||||
"lint": "tslint --project tsconfig.json && eslint \"**/*.{ts,tsx}\"",
|
"lint": "tslint --project tsconfig.json && eslint \"**/*.{ts,tsx}\"",
|
||||||
"build:contracts": "npm run compile:contracts",
|
"build:contracts": "npm run compile:contracts",
|
||||||
"strict:find": "node ./strict-null-checks/find.js",
|
"strictEligibleFiles": "node ./strict-migration-tools/index.js",
|
||||||
"strict:add": "node ./strict-null-checks/auto-add.js",
|
"autoAddStrictEligibleFiles": "node ./strict-migration-tools/autoAdd.js",
|
||||||
"compile:fullStrict": "tsc -p ./tsconfig.json --strictNullChecks",
|
"compile:fullStrict": "tsc -p ./tsconfig.json --strictNullChecks",
|
||||||
"generateARMClients": "ts-node --compiler-options '{\"module\":\"commonjs\"}' utils/armClientGenerator/generator.ts"
|
"generateARMClients": "ts-node --compiler-options '{\"module\":\"commonjs\"}' utils/armClientGenerator/generator.ts"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
[defaults]
|
|
||||||
group = stfaul
|
|
||||||
sku = P1v2
|
|
||||||
appserviceplan = stfaul_asp_Linux_centralus_0
|
|
||||||
location = centralus
|
|
||||||
web = cosmos-explorer-preview
|
|
||||||
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
# Cosmos Explorer Preview
|
|
||||||
|
|
||||||
Cosmos Explorer Preview makes it possible to try a working version of any commit on master or in a PR. No need to run the app locally or deploy to staging.
|
|
||||||
|
|
||||||
Initial support is for Hosted (Connection string only) or the Azure Portal. Examples:
|
|
||||||
|
|
||||||
Connection string URLs: https://cosmos-explorer-preview.azurewebsites.net/commit/COMMIT_SHA/hostedExplorer.html
|
|
||||||
Portal URLs: https://ms.portal.azure.com/?dataExplorerSource=https://cosmos-explorer-preview.azurewebsites.net/commit/COMMIT_SHA/explorer.html#home
|
|
||||||
|
|
||||||
In both cases replace `COMMIT_SHA` with the commit you want to view. It must have already completed its build on GitHub Actions.
|
|
||||||
|
|
||||||
### Architechture
|
|
||||||
|
|
||||||
- This folder contains a NodeJS app deployed to Azure App Service that powers preview URLs:
|
|
||||||
- Paths starting with `/commit/` are proxied to an Azure Storage account containing build artifacts
|
|
||||||
- Paths starting with `/proxy/` are proxied dynamically to Cosmos account endpoints. Required otherwise CORS would need to be configured for every account accessed.
|
|
||||||
- Paths starting with `/api/` are proxied to Portal APIs that do not support CORS.
|
|
||||||
- On GitHub Actions build completion:
|
|
||||||
- All files in dist are uploaded to an Azure Storage account namespaced by the SHA of the commit
|
|
||||||
- `/preview/config.json` is uploaded to the same folder with preview specific configuration
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"PROXY_PATH": "/proxy"
|
|
||||||
}
|
|
||||||
@@ -1,68 +0,0 @@
|
|||||||
const express = require("express");
|
|
||||||
const { createProxyMiddleware } = require("http-proxy-middleware");
|
|
||||||
const port = process.env.PORT || 3000;
|
|
||||||
const fetch = require("node-fetch");
|
|
||||||
|
|
||||||
const api = createProxyMiddleware("/api", {
|
|
||||||
target: "https://main.documentdb.ext.azure.com",
|
|
||||||
changeOrigin: true,
|
|
||||||
logLevel: "debug",
|
|
||||||
bypass: (req, res) => {
|
|
||||||
if (req.method === "OPTIONS") {
|
|
||||||
res.statusCode = 200;
|
|
||||||
res.send();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
const proxy = createProxyMiddleware("/proxy", {
|
|
||||||
target: "https://main.documentdb.ext.azure.com",
|
|
||||||
changeOrigin: true,
|
|
||||||
secure: false,
|
|
||||||
logLevel: "debug",
|
|
||||||
pathRewrite: { "^/proxy": "" },
|
|
||||||
router: (req) => {
|
|
||||||
let newTarget = req.headers["x-ms-proxy-target"];
|
|
||||||
return newTarget;
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
const commit = createProxyMiddleware("/commit", {
|
|
||||||
target: "https://cosmosexplorerpreview.blob.core.windows.net",
|
|
||||||
changeOrigin: true,
|
|
||||||
secure: false,
|
|
||||||
logLevel: "debug",
|
|
||||||
pathRewrite: { "^/commit": "$web/" },
|
|
||||||
});
|
|
||||||
|
|
||||||
const app = express();
|
|
||||||
|
|
||||||
app.use(api);
|
|
||||||
app.use(proxy);
|
|
||||||
app.use(commit);
|
|
||||||
app.get("/pull/:pr(\\d+)", (req, res) => {
|
|
||||||
const pr = req.params.pr;
|
|
||||||
const [, query] = req.originalUrl.split("?");
|
|
||||||
const search = new URLSearchParams(query);
|
|
||||||
|
|
||||||
fetch("https://api.github.com/repos/Azure/cosmos-explorer/pulls/" + pr)
|
|
||||||
.then((response) => response.json())
|
|
||||||
.then(({ head: { ref, sha } }) => {
|
|
||||||
const prUrl = new URL("https://github.com/Azure/cosmos-explorer/pull/" + pr);
|
|
||||||
prUrl.hash = ref;
|
|
||||||
search.set("feature.pr", prUrl.href);
|
|
||||||
|
|
||||||
const explorer = new URL("https://cosmos-explorer-preview.azurewebsites.net/commit/" + sha + "/explorer.html");
|
|
||||||
explorer.search = search.toString();
|
|
||||||
|
|
||||||
const portal = new URL("https://ms.portal.azure.com/");
|
|
||||||
portal.searchParams.set("dataExplorerSource", explorer.href);
|
|
||||||
|
|
||||||
return res.redirect(portal.href);
|
|
||||||
})
|
|
||||||
.catch(() => res.sendStatus(500));
|
|
||||||
});
|
|
||||||
|
|
||||||
app.listen(port, () => {
|
|
||||||
console.log(`Example app listening on port: ${port}`);
|
|
||||||
});
|
|
||||||
1146
preview/package-lock.json
generated
1146
preview/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -1,18 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "cosmos-explorer-preview",
|
|
||||||
"version": "1.0.0",
|
|
||||||
"description": "",
|
|
||||||
"main": "index.js",
|
|
||||||
"scripts": {
|
|
||||||
"deploy": "az webapp up -n cosmos-explorer-preview --subscription cosmosdb-portalteam-generaldemo -g stfaul",
|
|
||||||
"start": "node index.js",
|
|
||||||
"test": "echo \"Error: no test specified\" && exit 1"
|
|
||||||
},
|
|
||||||
"keywords": [],
|
|
||||||
"author": "Microsoft Corporation",
|
|
||||||
"dependencies": {
|
|
||||||
"express": "^4.17.1",
|
|
||||||
"http-proxy-middleware": "^1.1.0",
|
|
||||||
"node-fetch": "^2.6.1"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,68 +0,0 @@
|
|||||||
import { createImmutableOutput, JSONObject, OnDiskOutput } from "@nteract/commutable";
|
|
||||||
// import outputs individually to avoid increasing the bundle size
|
|
||||||
import { KernelOutputError } from "@nteract/outputs/lib/components/kernel-output-error";
|
|
||||||
import { Output } from "@nteract/outputs/lib/components/output";
|
|
||||||
import { StreamText } from "@nteract/outputs/lib/components/stream-text";
|
|
||||||
import { ContentRef } from "@nteract/types";
|
|
||||||
import "bootstrap/dist/css/bootstrap.css";
|
|
||||||
import postRobot from "post-robot";
|
|
||||||
import * as React from "react";
|
|
||||||
import * as ReactDOM from "react-dom";
|
|
||||||
import "../../externals/iframeResizer.contentWindow.min.js"; // Required for iFrameResizer to work
|
|
||||||
import "../Explorer/Notebook/NotebookRenderer/base.css";
|
|
||||||
import "../Explorer/Notebook/NotebookRenderer/default.css";
|
|
||||||
import { TransformMedia } from "./TransformMedia";
|
|
||||||
|
|
||||||
export interface CellOutputViewerProps {
|
|
||||||
id: string;
|
|
||||||
contentRef: ContentRef;
|
|
||||||
hidden: boolean;
|
|
||||||
expanded: boolean;
|
|
||||||
outputs: OnDiskOutput[];
|
|
||||||
onMetadataChange: (metadata: JSONObject, mediaType: string, index?: number) => void;
|
|
||||||
}
|
|
||||||
|
|
||||||
const onInit = async () => {
|
|
||||||
postRobot.on(
|
|
||||||
"props",
|
|
||||||
{
|
|
||||||
window: window.parent,
|
|
||||||
domain: window.location.origin,
|
|
||||||
},
|
|
||||||
(event) => {
|
|
||||||
// Typescript definition for event is wrong. So read props by casting to <any>
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
||||||
const props = (event as any).data as CellOutputViewerProps;
|
|
||||||
const outputs = (
|
|
||||||
<div
|
|
||||||
data-iframe-height
|
|
||||||
className={`nteract-cell-outputs ${props.hidden ? "hidden" : ""} ${props.expanded ? "expanded" : ""}`}
|
|
||||||
>
|
|
||||||
{props.outputs?.map((output, index) => (
|
|
||||||
<Output output={createImmutableOutput(output)} key={index}>
|
|
||||||
<TransformMedia
|
|
||||||
output_type={"display_data"}
|
|
||||||
id={props.id}
|
|
||||||
contentRef={props.contentRef}
|
|
||||||
onMetadataChange={(metadata, mediaType) => props.onMetadataChange(metadata, mediaType, index)}
|
|
||||||
/>
|
|
||||||
<TransformMedia
|
|
||||||
output_type={"execute_result"}
|
|
||||||
id={props.id}
|
|
||||||
contentRef={props.contentRef}
|
|
||||||
onMetadataChange={(metadata, mediaType) => props.onMetadataChange(metadata, mediaType, index)}
|
|
||||||
/>
|
|
||||||
<KernelOutputError />
|
|
||||||
<StreamText />
|
|
||||||
</Output>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
|
|
||||||
ReactDOM.render(outputs, document.getElementById("cellOutput"));
|
|
||||||
}
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
// Entry point
|
|
||||||
window.addEventListener("load", onInit);
|
|
||||||
@@ -1,138 +0,0 @@
|
|||||||
import { ImmutableDisplayData, ImmutableExecuteResult, JSONObject } from "@nteract/commutable";
|
|
||||||
// import outputs individually to avoid increasing the bundle size
|
|
||||||
import { HTML } from "@nteract/outputs/lib/components/media/html";
|
|
||||||
import { Image } from "@nteract/outputs/lib/components/media/image";
|
|
||||||
import { JavaScript } from "@nteract/outputs/lib/components/media/javascript";
|
|
||||||
import { Json } from "@nteract/outputs/lib/components/media/json";
|
|
||||||
import { LaTeX } from "@nteract/outputs/lib/components/media/latex";
|
|
||||||
import { Plain } from "@nteract/outputs/lib/components/media/plain";
|
|
||||||
import { SVG } from "@nteract/outputs/lib/components/media/svg";
|
|
||||||
import { ContentRef } from "@nteract/types";
|
|
||||||
import React, { Suspense } from "react";
|
|
||||||
|
|
||||||
const EmptyTransform = (): JSX.Element => <></>;
|
|
||||||
|
|
||||||
const displayOrder = [
|
|
||||||
"application/vnd.jupyter.widget-view+json",
|
|
||||||
"application/vnd.vega.v5+json",
|
|
||||||
"application/vnd.vega.v4+json",
|
|
||||||
"application/vnd.vega.v3+json",
|
|
||||||
"application/vnd.vega.v2+json",
|
|
||||||
"application/vnd.vegalite.v4+json",
|
|
||||||
"application/vnd.vegalite.v3+json",
|
|
||||||
"application/vnd.vegalite.v2+json",
|
|
||||||
"application/vnd.vegalite.v1+json",
|
|
||||||
"application/geo+json",
|
|
||||||
"application/vnd.plotly.v1+json",
|
|
||||||
"text/vnd.plotly.v1+html",
|
|
||||||
"application/x-nteract-model-debug+json",
|
|
||||||
"application/vnd.dataresource+json",
|
|
||||||
"application/vdom.v1+json",
|
|
||||||
"application/json",
|
|
||||||
"application/javascript",
|
|
||||||
"text/html",
|
|
||||||
"text/markdown",
|
|
||||||
"text/latex",
|
|
||||||
"image/svg+xml",
|
|
||||||
"image/gif",
|
|
||||||
"image/png",
|
|
||||||
"image/jpeg",
|
|
||||||
"text/plain",
|
|
||||||
];
|
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
||||||
const transformsById = new Map<string, React.ComponentType<any>>([
|
|
||||||
["text/vnd.plotly.v1+html", React.lazy(() => import("@nteract/transform-plotly"))],
|
|
||||||
["application/vnd.plotly.v1+json", React.lazy(() => import("@nteract/transform-plotly"))],
|
|
||||||
["application/geo+json", EmptyTransform], // TODO: The geojson transform will likely need some work because of the basemap URL(s)
|
|
||||||
["application/x-nteract-model-debug+json", React.lazy(() => import("@nteract/transform-model-debug"))],
|
|
||||||
["application/vnd.dataresource+json", React.lazy(() => import("@nteract/data-explorer"))],
|
|
||||||
["application/vnd.jupyter.widget-view+json", React.lazy(() => import("./transforms/WidgetDisplay"))],
|
|
||||||
["application/vnd.vegalite.v1+json", React.lazy(() => import("./transforms/VegaLite1"))],
|
|
||||||
["application/vnd.vegalite.v2+json", React.lazy(() => import("./transforms/VegaLite2"))],
|
|
||||||
["application/vnd.vegalite.v3+json", React.lazy(() => import("./transforms/VegaLite3"))],
|
|
||||||
["application/vnd.vegalite.v4+json", React.lazy(() => import("./transforms/VegaLite4"))],
|
|
||||||
["application/vnd.vega.v2+json", React.lazy(() => import("./transforms/Vega2"))],
|
|
||||||
["application/vnd.vega.v3+json", React.lazy(() => import("./transforms/Vega3"))],
|
|
||||||
["application/vnd.vega.v4+json", React.lazy(() => import("./transforms/Vega4"))],
|
|
||||||
["application/vnd.vega.v5+json", React.lazy(() => import("./transforms/Vega5"))],
|
|
||||||
["application/vdom.v1+json", React.lazy(() => import("@nteract/transform-vdom"))],
|
|
||||||
["application/json", Json],
|
|
||||||
["application/javascript", JavaScript],
|
|
||||||
["text/html", HTML],
|
|
||||||
["text/markdown", React.lazy(() => import("@nteract/outputs/lib/components/media/markdown"))], // Markdown increases the bundle size so lazy load it
|
|
||||||
["text/latex", LaTeX],
|
|
||||||
["image/svg+xml", SVG],
|
|
||||||
["image/gif", Image],
|
|
||||||
["image/png", Image],
|
|
||||||
["image/jpeg", Image],
|
|
||||||
["text/plain", Plain],
|
|
||||||
]);
|
|
||||||
|
|
||||||
interface TransformMediaProps {
|
|
||||||
output_type: string;
|
|
||||||
id: string;
|
|
||||||
contentRef: ContentRef;
|
|
||||||
output?: ImmutableDisplayData | ImmutableExecuteResult;
|
|
||||||
onMetadataChange: (metadata: JSONObject, mediaType: string) => void;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const TransformMedia = (props: TransformMediaProps): JSX.Element => {
|
|
||||||
const { Media, mediaType, data, metadata } = getMediaInfo(props);
|
|
||||||
|
|
||||||
// If we had no valid result, return an empty output
|
|
||||||
if (!mediaType || !data) {
|
|
||||||
return <></>;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Suspense fallback={<div>Loading...</div>}>
|
|
||||||
<Media
|
|
||||||
onMetadataChange={props.onMetadataChange}
|
|
||||||
data={data}
|
|
||||||
metadata={metadata}
|
|
||||||
contentRef={props.contentRef}
|
|
||||||
id={props.id}
|
|
||||||
/>
|
|
||||||
</Suspense>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
const getMediaInfo = (props: TransformMediaProps) => {
|
|
||||||
const { output, output_type } = props;
|
|
||||||
// This component should only be used with display data and execute result
|
|
||||||
if (!output || !(output_type === "display_data" || output_type === "execute_result")) {
|
|
||||||
console.warn("connected transform media managed to get a non media bundle output");
|
|
||||||
return {
|
|
||||||
Media: EmptyTransform,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
// Find the first mediaType in the output data that we support with a handler
|
|
||||||
const mediaType = displayOrder.find(
|
|
||||||
(key) =>
|
|
||||||
Object.prototype.hasOwnProperty.call(output.data, key) &&
|
|
||||||
(Object.prototype.hasOwnProperty.call(transformsById, key) || transformsById.get(key))
|
|
||||||
);
|
|
||||||
|
|
||||||
if (mediaType) {
|
|
||||||
const metadata = output.metadata.get(mediaType);
|
|
||||||
const data = output.data[mediaType];
|
|
||||||
|
|
||||||
const Media = transformsById.get(mediaType);
|
|
||||||
return {
|
|
||||||
Media,
|
|
||||||
mediaType,
|
|
||||||
data,
|
|
||||||
metadata,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
Media: EmptyTransform,
|
|
||||||
mediaType,
|
|
||||||
output,
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
export default TransformMedia;
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8" />
|
|
||||||
<meta name="viewport" content="height=device-height, width=device-width, initial-scale=1.0" />
|
|
||||||
<title>Cell Output Viewer</title>
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
<div class="cellOutput" id="cellOutput"></div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
export { Vega2 as default } from "@nteract/transform-vega";
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
export { Vega3 as default } from "@nteract/transform-vega";
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
export { Vega4 as default } from "@nteract/transform-vega";
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
export { Vega5 as default } from "@nteract/transform-vega";
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
export { VegaLite1 as default } from "@nteract/transform-vega";
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
export { VegaLite2 as default } from "@nteract/transform-vega";
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
export { VegaLite3 as default } from "@nteract/transform-vega";
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
export { VegaLite4 as default } from "@nteract/transform-vega";
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
export { WidgetDisplay as default } from "@nteract/jupyter-widgets";
|
|
||||||
@@ -98,6 +98,30 @@ export class CapabilityNames {
|
|||||||
public static readonly EnableServerless: string = "EnableServerless";
|
public static readonly EnableServerless: string = "EnableServerless";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class Features {
|
||||||
|
public static readonly cosmosdb = "cosmosdb";
|
||||||
|
public static readonly enableChangeFeedPolicy = "enablechangefeedpolicy";
|
||||||
|
public static readonly executeSproc = "dataexplorerexecutesproc";
|
||||||
|
public static readonly hostedDataExplorer = "hosteddataexplorerenabled";
|
||||||
|
public static readonly enableTtl = "enablettl";
|
||||||
|
public static readonly enableNotebooks = "enablenotebooks";
|
||||||
|
public static readonly enableSpark = "enablespark";
|
||||||
|
public static readonly livyEndpoint = "livyendpoint";
|
||||||
|
public static readonly notebookServerUrl = "notebookserverurl";
|
||||||
|
public static readonly notebookServerToken = "notebookservertoken";
|
||||||
|
public static readonly notebookBasePath = "notebookbasepath";
|
||||||
|
public static readonly canExceedMaximumValue = "canexceedmaximumvalue";
|
||||||
|
public static readonly enableFixedCollectionWithSharedThroughput = "enablefixedcollectionwithsharedthroughput";
|
||||||
|
public static readonly ttl90Days = "ttl90days";
|
||||||
|
public static readonly enableRightPanelV2 = "enablerightpanelv2";
|
||||||
|
public static readonly enableSchema = "enableschema";
|
||||||
|
public static readonly enableSDKoperations = "enablesdkoperations";
|
||||||
|
public static readonly showMinRUSurvey = "showminrusurvey";
|
||||||
|
public static readonly enableDatabaseSettingsTabV1 = "enabledbsettingsv1";
|
||||||
|
public static readonly selfServeType = "selfservetype";
|
||||||
|
public static readonly enableKOPanel = "enablekopanel";
|
||||||
|
}
|
||||||
|
|
||||||
// flight names returned from the portal are always lowercase
|
// flight names returned from the portal are always lowercase
|
||||||
export class Flights {
|
export class Flights {
|
||||||
public static readonly SettingsV2 = "settingsv2";
|
public static readonly SettingsV2 = "settingsv2";
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ export const tokenProvider = async (requestInfo: RequestInfo) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const requestPlugin: Cosmos.Plugin<any> = async (requestContext, next) => {
|
export const requestPlugin: Cosmos.Plugin<any> = async (requestContext, next) => {
|
||||||
requestContext.endpoint = new URL(configContext.PROXY_PATH, window.location.href).href;
|
requestContext.endpoint = configContext.PROXY_PATH;
|
||||||
requestContext.headers["x-ms-proxy-target"] = endpoint();
|
requestContext.headers["x-ms-proxy-target"] = endpoint();
|
||||||
return next(requestContext);
|
return next(requestContext);
|
||||||
};
|
};
|
||||||
@@ -75,10 +75,7 @@ export async function getTokenFromAuthService(verb: string, resourceType: string
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let _client: Cosmos.CosmosClient;
|
|
||||||
|
|
||||||
export function client(): Cosmos.CosmosClient {
|
export function client(): Cosmos.CosmosClient {
|
||||||
if (_client) return _client;
|
|
||||||
const options: Cosmos.CosmosClientOptions = {
|
const options: Cosmos.CosmosClientOptions = {
|
||||||
endpoint: endpoint() || "https://cosmos.azure.com", // CosmosClient gets upset if we pass a bad URL. This should never actually get called
|
endpoint: endpoint() || "https://cosmos.azure.com", // CosmosClient gets upset if we pass a bad URL. This should never actually get called
|
||||||
key: userContext.masterKey,
|
key: userContext.masterKey,
|
||||||
@@ -92,6 +89,5 @@ export function client(): Cosmos.CosmosClient {
|
|||||||
if (configContext.PROXY_PATH !== undefined) {
|
if (configContext.PROXY_PATH !== undefined) {
|
||||||
(options as any).plugins = [{ on: "request", plugin: requestPlugin }];
|
(options as any).plugins = [{ on: "request", plugin: requestPlugin }];
|
||||||
}
|
}
|
||||||
_client = new Cosmos.CosmosClient(options);
|
return new Cosmos.CosmosClient(options);
|
||||||
return _client;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,61 +0,0 @@
|
|||||||
import { DatePicker, TextField } from "office-ui-fabric-react";
|
|
||||||
import React, { FunctionComponent } from "react";
|
|
||||||
|
|
||||||
export interface TableEntityProps {
|
|
||||||
entityValueLabel?: string;
|
|
||||||
entityValuePlaceholder: string;
|
|
||||||
entityValue: string | Date;
|
|
||||||
isEntityTypeDate: boolean;
|
|
||||||
entityTimeValue: string;
|
|
||||||
entityValueType: string;
|
|
||||||
onEntityValueChange: (event: React.FormEvent<HTMLElement>, newInput?: string) => void;
|
|
||||||
onSelectDate: (date: Date | null | undefined) => void;
|
|
||||||
onEntityTimeValueChange: (event: React.FormEvent<HTMLElement>, newInput?: string) => void;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const EntityValue: FunctionComponent<TableEntityProps> = ({
|
|
||||||
entityValueLabel,
|
|
||||||
entityValuePlaceholder,
|
|
||||||
entityValue,
|
|
||||||
isEntityTypeDate,
|
|
||||||
entityTimeValue,
|
|
||||||
entityValueType,
|
|
||||||
onEntityValueChange,
|
|
||||||
onSelectDate,
|
|
||||||
onEntityTimeValueChange,
|
|
||||||
}: TableEntityProps): JSX.Element => {
|
|
||||||
if (isEntityTypeDate) {
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<DatePicker
|
|
||||||
className="addEntityDatePicker"
|
|
||||||
placeholder={entityValuePlaceholder}
|
|
||||||
value={entityValue && new Date(entityValue)}
|
|
||||||
ariaLabel={entityValuePlaceholder}
|
|
||||||
onSelectDate={onSelectDate}
|
|
||||||
/>
|
|
||||||
<TextField
|
|
||||||
label={entityValueLabel && entityValueLabel}
|
|
||||||
id="entityTimeId"
|
|
||||||
autoFocus
|
|
||||||
type="time"
|
|
||||||
value={entityTimeValue}
|
|
||||||
onChange={onEntityTimeValueChange}
|
|
||||||
/>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<TextField
|
|
||||||
label={entityValueLabel && entityValueLabel}
|
|
||||||
className="addEntityTextField"
|
|
||||||
id="entityValueId"
|
|
||||||
autoFocus
|
|
||||||
type={entityValueType}
|
|
||||||
placeholder={entityValuePlaceholder}
|
|
||||||
value={typeof entityValue === "string" && entityValue}
|
|
||||||
onChange={onEntityValueChange}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import { SeverityLevel } from "@microsoft/applicationinsights-web";
|
|
||||||
import { Diagnostics, MessageTypes } from "../Contracts/ExplorerContracts";
|
|
||||||
import { trackTrace } from "../Shared/appInsights";
|
|
||||||
import { sendMessage } from "./MessageHandler";
|
import { sendMessage } from "./MessageHandler";
|
||||||
|
import { Diagnostics, MessageTypes } from "../Contracts/ExplorerContracts";
|
||||||
|
import { appInsights } from "../Shared/appInsights";
|
||||||
|
import { SeverityLevel } from "@microsoft/applicationinsights-web";
|
||||||
|
|
||||||
// TODO: Move to a separate Diagnostics folder
|
// TODO: Move to a separate Diagnostics folder
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
@@ -46,7 +46,7 @@ function _logEntry(entry: Diagnostics.LogEntry): void {
|
|||||||
return SeverityLevel.Information;
|
return SeverityLevel.Information;
|
||||||
}
|
}
|
||||||
})(entry.level);
|
})(entry.level);
|
||||||
trackTrace({ message: entry.message, severityLevel }, { area: entry.area });
|
appInsights.trackTrace({ message: entry.message, severityLevel }, { area: entry.area });
|
||||||
}
|
}
|
||||||
|
|
||||||
function _generateLogEntry(
|
function _generateLogEntry(
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
|
import { MessageTypes } from "../Contracts/ExplorerContracts";
|
||||||
import Q from "q";
|
import Q from "q";
|
||||||
import * as _ from "underscore";
|
import * as _ from "underscore";
|
||||||
import { MessageTypes } from "../Contracts/ExplorerContracts";
|
|
||||||
import { getDataExplorerWindow } from "../Utils/WindowUtils";
|
|
||||||
import * as Constants from "./Constants";
|
import * as Constants from "./Constants";
|
||||||
|
import { getDataExplorerWindow } from "../Utils/WindowUtils";
|
||||||
|
|
||||||
export interface CachedDataPromise<T> {
|
export interface CachedDataPromise<T> {
|
||||||
deferred: Q.Deferred<T>;
|
deferred: Q.Deferred<T>;
|
||||||
@@ -48,18 +48,17 @@ export function sendCachedDataMessage<TResponseDataModel>(
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function sendMessage(data: any): void {
|
export function sendMessage(data: any): void {
|
||||||
_sendMessage({
|
if (canSendMessage()) {
|
||||||
signature: "pcIframe",
|
// We try to find data explorer window first, then fallback to current window
|
||||||
data: data,
|
const portalChildWindow = getDataExplorerWindow(window) || window;
|
||||||
});
|
portalChildWindow.parent.postMessage(
|
||||||
}
|
{
|
||||||
|
signature: "pcIframe",
|
||||||
export function sendReadyMessage(): void {
|
data: data,
|
||||||
_sendMessage({
|
},
|
||||||
signature: "pcIframe",
|
portalChildWindow.document.referrer
|
||||||
kind: "ready",
|
);
|
||||||
data: "ready",
|
}
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function canSendMessage(): boolean {
|
export function canSendMessage(): boolean {
|
||||||
@@ -75,17 +74,3 @@ export function runGarbageCollector() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const _sendMessage = (message: any): void => {
|
|
||||||
if (canSendMessage()) {
|
|
||||||
// Portal window can receive messages from only child windows
|
|
||||||
const portalChildWindow = getDataExplorerWindow(window) || window;
|
|
||||||
if (portalChildWindow === window) {
|
|
||||||
// Current window is a child of portal, send message to portal window
|
|
||||||
portalChildWindow.parent.postMessage(message, portalChildWindow.document.referrer || "*");
|
|
||||||
} else {
|
|
||||||
// Current window is not a child of portal, send message to the child window instead (which is data explorer)
|
|
||||||
portalChildWindow.postMessage(message, portalChildWindow.location.origin || "*");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|||||||
@@ -5,10 +5,11 @@ 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 DocumentId from "../Explorer/Tree/DocumentId";
|
import DocumentId from "../Explorer/Tree/DocumentId";
|
||||||
import { userContext } from "../UserContext";
|
import * as NotificationConsoleUtils from "../Utils/NotificationConsoleUtils";
|
||||||
import { logConsoleError } from "../Utils/NotificationConsoleUtils";
|
|
||||||
import { ApiType, HttpHeaders, HttpStatusCodes } from "./Constants";
|
import { ApiType, HttpHeaders, HttpStatusCodes } from "./Constants";
|
||||||
|
import { userContext } from "../UserContext";
|
||||||
import { MinimalQueryIterator } from "./IteratorUtilities";
|
import { MinimalQueryIterator } from "./IteratorUtilities";
|
||||||
import { sendMessage } from "./MessageHandler";
|
import { sendMessage } from "./MessageHandler";
|
||||||
|
|
||||||
@@ -347,7 +348,10 @@ export function getEndpoint(): string {
|
|||||||
async function errorHandling(response: Response, action: string, params: unknown): Promise<void> {
|
async function errorHandling(response: Response, action: string, params: unknown): Promise<void> {
|
||||||
const errorMessage = await response.text();
|
const errorMessage = await response.text();
|
||||||
// Log the error where the user can see it
|
// Log the error where the user can see it
|
||||||
logConsoleError(`Error ${action}: ${errorMessage}, Payload: ${JSON.stringify(params)}`);
|
NotificationConsoleUtils.logConsoleMessage(
|
||||||
|
ConsoleDataType.Error,
|
||||||
|
`Error ${action}: ${errorMessage}, Payload: ${JSON.stringify(params)}`
|
||||||
|
);
|
||||||
if (response.status === HttpStatusCodes.Forbidden) {
|
if (response.status === HttpStatusCodes.Forbidden) {
|
||||||
sendMessage({ type: MessageTypes.ForbiddenError, reason: errorMessage });
|
sendMessage({ type: MessageTypes.ForbiddenError, reason: errorMessage });
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import Explorer from "../Explorer/Explorer";
|
|||||||
import DocumentsTab from "../Explorer/Tabs/DocumentsTab";
|
import DocumentsTab from "../Explorer/Tabs/DocumentsTab";
|
||||||
import DocumentId from "../Explorer/Tree/DocumentId";
|
import DocumentId from "../Explorer/Tree/DocumentId";
|
||||||
import * as NotificationConsoleUtils from "../Utils/NotificationConsoleUtils";
|
import * as NotificationConsoleUtils from "../Utils/NotificationConsoleUtils";
|
||||||
import * as QueryUtils from "../Utils/QueryUtils";
|
import { QueryUtils } from "../Utils/QueryUtils";
|
||||||
import { BackendDefaults, HttpStatusCodes, SavedQueries } from "./Constants";
|
import { BackendDefaults, HttpStatusCodes, SavedQueries } from "./Constants";
|
||||||
import { userContext } from "../UserContext";
|
import { userContext } from "../UserContext";
|
||||||
import { queryDocumentsPage } from "./dataAccess/queryDocumentsPage";
|
import { queryDocumentsPage } from "./dataAccess/queryDocumentsPage";
|
||||||
|
|||||||
@@ -1,136 +0,0 @@
|
|||||||
import {
|
|
||||||
Dropdown,
|
|
||||||
IDropdownOption,
|
|
||||||
IDropdownStyles,
|
|
||||||
IImageProps,
|
|
||||||
Image,
|
|
||||||
IStackTokens,
|
|
||||||
Stack,
|
|
||||||
TextField,
|
|
||||||
TooltipHost,
|
|
||||||
} from "office-ui-fabric-react";
|
|
||||||
import React, { FunctionComponent } from "react";
|
|
||||||
import DeleteIcon from "../../images/delete.svg";
|
|
||||||
import EditIcon from "../../images/Edit_entity.svg";
|
|
||||||
import { CassandraType, TableType } from "../Explorer/Tables/Constants";
|
|
||||||
import { userContext } from "../UserContext";
|
|
||||||
import { EntityValue } from "./EntityValue";
|
|
||||||
|
|
||||||
const dropdownStyles: Partial<IDropdownStyles> = { dropdown: { width: 100 } };
|
|
||||||
|
|
||||||
export interface TableEntityProps {
|
|
||||||
entityTypeLabel?: string;
|
|
||||||
entityPropertyLabel?: string;
|
|
||||||
entityValueLabel?: string;
|
|
||||||
isDeleteOptionVisible: boolean;
|
|
||||||
entityProperty: string;
|
|
||||||
entityPropertyPlaceHolder: string;
|
|
||||||
selectedKey: string | number;
|
|
||||||
entityValuePlaceholder: string;
|
|
||||||
entityValue: string | Date;
|
|
||||||
isEntityTypeDate: boolean;
|
|
||||||
options: { key: string; text: string }[];
|
|
||||||
isPropertyTypeDisable: boolean;
|
|
||||||
entityTimeValue: string;
|
|
||||||
onDeleteEntity?: () => void;
|
|
||||||
onEditEntity?: () => void;
|
|
||||||
onEntityPropertyChange: (event: React.FormEvent<HTMLElement>, newInput?: string) => void;
|
|
||||||
onEntityTypeChange: (event: React.FormEvent<HTMLElement>, selectedParam: IDropdownOption) => void;
|
|
||||||
onEntityValueChange: (event: React.FormEvent<HTMLElement>, newInput?: string) => void;
|
|
||||||
onSelectDate: (date: Date | null | undefined) => void;
|
|
||||||
onEntityTimeValueChange: (event: React.FormEvent<HTMLElement>, newInput?: string) => void;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const TableEntity: FunctionComponent<TableEntityProps> = ({
|
|
||||||
entityTypeLabel,
|
|
||||||
entityPropertyLabel,
|
|
||||||
isDeleteOptionVisible,
|
|
||||||
entityProperty,
|
|
||||||
selectedKey,
|
|
||||||
entityPropertyPlaceHolder,
|
|
||||||
entityValueLabel,
|
|
||||||
entityValuePlaceholder,
|
|
||||||
entityValue,
|
|
||||||
options,
|
|
||||||
isPropertyTypeDisable,
|
|
||||||
isEntityTypeDate,
|
|
||||||
entityTimeValue,
|
|
||||||
onEditEntity,
|
|
||||||
onDeleteEntity,
|
|
||||||
onEntityPropertyChange,
|
|
||||||
onEntityTypeChange,
|
|
||||||
onEntityValueChange,
|
|
||||||
onSelectDate,
|
|
||||||
onEntityTimeValueChange,
|
|
||||||
}: TableEntityProps): JSX.Element => {
|
|
||||||
const imageProps: IImageProps = {
|
|
||||||
width: 16,
|
|
||||||
height: 30,
|
|
||||||
className: entityPropertyLabel ? "addRemoveIconLabel" : "addRemoveIcon",
|
|
||||||
};
|
|
||||||
|
|
||||||
const sectionStackTokens: IStackTokens = { childrenGap: 12 };
|
|
||||||
|
|
||||||
const getEntityValueType = (): string => {
|
|
||||||
const { Int, Smallint, Tinyint } = CassandraType;
|
|
||||||
const { Double, Int32, Int64 } = TableType;
|
|
||||||
|
|
||||||
if (
|
|
||||||
selectedKey === Double ||
|
|
||||||
selectedKey === Int32 ||
|
|
||||||
selectedKey === Int64 ||
|
|
||||||
selectedKey === Int ||
|
|
||||||
selectedKey === Smallint ||
|
|
||||||
selectedKey === Tinyint
|
|
||||||
) {
|
|
||||||
return "number";
|
|
||||||
}
|
|
||||||
return "string";
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<Stack horizontal tokens={sectionStackTokens}>
|
|
||||||
<TextField
|
|
||||||
label={entityPropertyLabel && entityPropertyLabel}
|
|
||||||
id="entityPropertyId"
|
|
||||||
autoFocus
|
|
||||||
disabled={isPropertyTypeDisable}
|
|
||||||
placeholder={entityPropertyPlaceHolder}
|
|
||||||
value={entityProperty}
|
|
||||||
onChange={onEntityPropertyChange}
|
|
||||||
required
|
|
||||||
/>
|
|
||||||
<Dropdown
|
|
||||||
label={entityTypeLabel && entityTypeLabel}
|
|
||||||
selectedKey={selectedKey}
|
|
||||||
onChange={onEntityTypeChange}
|
|
||||||
options={options}
|
|
||||||
disabled={isPropertyTypeDisable}
|
|
||||||
id="entityTypeId"
|
|
||||||
styles={dropdownStyles}
|
|
||||||
/>
|
|
||||||
<EntityValue
|
|
||||||
entityValueLabel={entityValueLabel}
|
|
||||||
entityValueType={getEntityValueType()}
|
|
||||||
entityValuePlaceholder={entityValuePlaceholder}
|
|
||||||
entityValue={entityValue}
|
|
||||||
isEntityTypeDate={isEntityTypeDate}
|
|
||||||
entityTimeValue={entityTimeValue}
|
|
||||||
onEntityValueChange={onEntityValueChange}
|
|
||||||
onSelectDate={onSelectDate}
|
|
||||||
onEntityTimeValueChange={onEntityTimeValueChange}
|
|
||||||
/>
|
|
||||||
<TooltipHost content="Edit property" id="editTooltip">
|
|
||||||
<Image {...imageProps} src={EditIcon} alt="editEntity" id="editEntity" onClick={onEditEntity} />
|
|
||||||
</TooltipHost>
|
|
||||||
|
|
||||||
{isDeleteOptionVisible && userContext.apiType !== "Cassandra" && (
|
|
||||||
<TooltipHost content="Delete property" id="deleteTooltip">
|
|
||||||
<Image {...imageProps} src={DeleteIcon} alt="delete entity" id="deleteEntity" onClick={onDeleteEntity} />
|
|
||||||
</TooltipHost>
|
|
||||||
)}
|
|
||||||
</Stack>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
import { useId } from "@uifabric/react-hooks";
|
|
||||||
import { ITooltipHostStyles, TooltipHost } from "office-ui-fabric-react/lib/Tooltip";
|
|
||||||
import * as React from "react";
|
|
||||||
import InfoBubble from "../../../images/info-bubble.svg";
|
|
||||||
|
|
||||||
const calloutProps = { gapSpace: 0 };
|
|
||||||
const hostStyles: Partial<ITooltipHostStyles> = { root: { display: "inline-block" } };
|
|
||||||
|
|
||||||
export interface TooltipProps {
|
|
||||||
children: string;
|
|
||||||
}
|
|
||||||
export const Tooltip: React.FunctionComponent = ({ children }: TooltipProps) => {
|
|
||||||
const tooltipId = useId("tooltip");
|
|
||||||
|
|
||||||
return children ? (
|
|
||||||
<span>
|
|
||||||
<TooltipHost content={children} id={tooltipId} calloutProps={calloutProps} styles={hostStyles}>
|
|
||||||
<img className="infoImg" src={InfoBubble} alt="More information" />
|
|
||||||
</TooltipHost>
|
|
||||||
</span>
|
|
||||||
) : (
|
|
||||||
<></>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
@@ -1,75 +0,0 @@
|
|||||||
import { Image, Stack, TextField } from "office-ui-fabric-react";
|
|
||||||
import React, { ChangeEvent, FunctionComponent, KeyboardEvent, useRef, useState } from "react";
|
|
||||||
import FolderIcon from "../../../images/folder_16x16.svg";
|
|
||||||
import * as Constants from "../Constants";
|
|
||||||
import { Tooltip } from "../Tooltip/Tooltip";
|
|
||||||
|
|
||||||
interface UploadProps {
|
|
||||||
label: string;
|
|
||||||
accept?: string;
|
|
||||||
tooltip?: string;
|
|
||||||
multiple?: boolean;
|
|
||||||
tabIndex?: number;
|
|
||||||
onUpload: (event: ChangeEvent<HTMLInputElement>) => void;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const Upload: FunctionComponent<UploadProps> = ({
|
|
||||||
label,
|
|
||||||
accept,
|
|
||||||
tooltip,
|
|
||||||
multiple,
|
|
||||||
tabIndex,
|
|
||||||
...props
|
|
||||||
}: UploadProps) => {
|
|
||||||
const [selectedFilesTitle, setSelectedFilesTitle] = useState<string[]>([]);
|
|
||||||
|
|
||||||
const fileRef = useRef<HTMLInputElement>();
|
|
||||||
|
|
||||||
const onImportLinkKeyPress = (event: KeyboardEvent<HTMLAnchorElement>): void => {
|
|
||||||
if (event.keyCode === Constants.KeyCodes.Enter || event.keyCode === Constants.KeyCodes.Space) {
|
|
||||||
onImportLinkClick();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const onImportLinkClick = (): void => {
|
|
||||||
fileRef?.current?.click();
|
|
||||||
};
|
|
||||||
|
|
||||||
const onUpload = (event: ChangeEvent<HTMLInputElement>): void => {
|
|
||||||
const { files } = event.target;
|
|
||||||
|
|
||||||
const newFileList = [];
|
|
||||||
for (let i = 0; i < files.length; i++) {
|
|
||||||
newFileList.push(files.item(i).name);
|
|
||||||
}
|
|
||||||
if (newFileList) {
|
|
||||||
setSelectedFilesTitle(newFileList);
|
|
||||||
props.onUpload(event);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
const title = label + " to upload";
|
|
||||||
return (
|
|
||||||
<div>
|
|
||||||
<span className="renewUploadItemsHeader">{label}</span>
|
|
||||||
<Tooltip>{tooltip}</Tooltip>
|
|
||||||
<Stack horizontal>
|
|
||||||
<TextField styles={{ fieldGroup: { width: 300 } }} readOnly value={selectedFilesTitle.toString()} />
|
|
||||||
<input
|
|
||||||
type="file"
|
|
||||||
id="importFileInput"
|
|
||||||
style={{ display: "none" }}
|
|
||||||
ref={fileRef}
|
|
||||||
accept={accept}
|
|
||||||
tabIndex={tabIndex}
|
|
||||||
multiple={multiple}
|
|
||||||
title="Upload Icon"
|
|
||||||
onChange={onUpload}
|
|
||||||
role="button"
|
|
||||||
/>
|
|
||||||
<a href="#" id="fileImportLinkNotebook" onClick={onImportLinkClick} onKeyPress={onImportLinkKeyPress}>
|
|
||||||
<Image className="fileImportImg" src={FolderIcon} alt={title} title={title} />
|
|
||||||
</a>
|
|
||||||
</Stack>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
@@ -1,61 +1,55 @@
|
|||||||
interface Result {
|
export default class UrlUtility {
|
||||||
type?: string;
|
public static parseDocumentsPath(resourcePath: string): any {
|
||||||
objectBody?: {
|
if (typeof resourcePath !== "string") {
|
||||||
id: string;
|
return {};
|
||||||
self: string;
|
}
|
||||||
};
|
|
||||||
}
|
if (resourcePath.length === 0) {
|
||||||
|
return {};
|
||||||
export function parseDocumentsPath(resourcePath: string): Result {
|
}
|
||||||
if (typeof resourcePath !== "string") {
|
|
||||||
return {};
|
if (resourcePath[resourcePath.length - 1] !== "/") {
|
||||||
}
|
resourcePath = resourcePath + "/";
|
||||||
|
}
|
||||||
if (resourcePath.length === 0) {
|
|
||||||
return {};
|
if (resourcePath[0] !== "/") {
|
||||||
}
|
resourcePath = "/" + resourcePath;
|
||||||
|
}
|
||||||
if (resourcePath[resourcePath.length - 1] !== "/") {
|
|
||||||
resourcePath = resourcePath + "/";
|
var id: string;
|
||||||
}
|
var type: string;
|
||||||
|
var pathParts = resourcePath.split("/");
|
||||||
if (resourcePath[0] !== "/") {
|
|
||||||
resourcePath = "/" + resourcePath;
|
if (pathParts.length % 2 === 0) {
|
||||||
}
|
id = pathParts[pathParts.length - 2];
|
||||||
|
type = pathParts[pathParts.length - 3];
|
||||||
let id: string;
|
} else {
|
||||||
let type: string;
|
id = pathParts[pathParts.length - 3];
|
||||||
const pathParts = resourcePath.split("/");
|
type = pathParts[pathParts.length - 2];
|
||||||
|
}
|
||||||
if (pathParts.length % 2 === 0) {
|
|
||||||
id = pathParts[pathParts.length - 2];
|
var result = {
|
||||||
type = pathParts[pathParts.length - 3];
|
type: type,
|
||||||
} else {
|
objectBody: {
|
||||||
id = pathParts[pathParts.length - 3];
|
id: id,
|
||||||
type = pathParts[pathParts.length - 2];
|
self: resourcePath,
|
||||||
}
|
},
|
||||||
|
};
|
||||||
const result = {
|
|
||||||
type: type,
|
return result;
|
||||||
objectBody: {
|
}
|
||||||
id: id,
|
|
||||||
self: resourcePath,
|
public static createUri(baseUri: string, relativeUri: string): string {
|
||||||
},
|
if (!baseUri) {
|
||||||
};
|
throw new Error("baseUri is null or empty");
|
||||||
|
}
|
||||||
return result;
|
|
||||||
}
|
var slashAtEndOfUriRegex = /\/$/,
|
||||||
|
slashAtStartOfUriRegEx = /^\//;
|
||||||
export function createUri(baseUri: string, relativeUri: string): string {
|
|
||||||
if (!baseUri) {
|
var normalizedBaseUri = baseUri.replace(slashAtEndOfUriRegex, "") + "/",
|
||||||
throw new Error("baseUri is null or empty");
|
normalizedRelativeUri = (relativeUri && relativeUri.replace(slashAtStartOfUriRegEx, "")) || "";
|
||||||
}
|
|
||||||
|
return normalizedBaseUri + normalizedRelativeUri;
|
||||||
const slashAtEndOfUriRegex = /\/$/,
|
}
|
||||||
slashAtStartOfUriRegEx = /^\//;
|
|
||||||
|
|
||||||
const normalizedBaseUri = baseUri.replace(slashAtEndOfUriRegex, "") + "/",
|
|
||||||
normalizedRelativeUri = (relativeUri && relativeUri.replace(slashAtStartOfUriRegEx, "")) || "";
|
|
||||||
|
|
||||||
return normalizedBaseUri + normalizedRelativeUri;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
exports[`requestPlugin Emulator builds a url for emulator proxy via webpack 1`] = `
|
exports[`requestPlugin Emulator builds a url for emulator proxy via webpack 1`] = `
|
||||||
Object {
|
Object {
|
||||||
"endpoint": "http://localhost/proxy",
|
"endpoint": "/proxy",
|
||||||
"headers": Object {
|
"headers": Object {
|
||||||
"x-ms-proxy-target": "http://localhost",
|
"x-ms-proxy-target": "http://localhost",
|
||||||
},
|
},
|
||||||
@@ -12,7 +12,7 @@ Object {
|
|||||||
|
|
||||||
exports[`requestPlugin Hosted builds a proxy URL in development 1`] = `
|
exports[`requestPlugin Hosted builds a proxy URL in development 1`] = `
|
||||||
Object {
|
Object {
|
||||||
"endpoint": "http://localhost/proxy",
|
"endpoint": "/proxy",
|
||||||
"headers": Object {
|
"headers": Object {
|
||||||
"x-ms-proxy-target": "baz",
|
"x-ms-proxy-target": "baz",
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,39 +0,0 @@
|
|||||||
import { JSONObject, OperationResponse } from "@azure/cosmos";
|
|
||||||
import { CollectionBase } from "../../Contracts/ViewModels";
|
|
||||||
import { logConsoleInfo, logConsoleProgress } from "../../Utils/NotificationConsoleUtils";
|
|
||||||
import { client } from "../CosmosClient";
|
|
||||||
import { handleError } from "../ErrorHandlingUtils";
|
|
||||||
|
|
||||||
export const bulkCreateDocument = async (
|
|
||||||
collection: CollectionBase,
|
|
||||||
documents: JSONObject[]
|
|
||||||
): Promise<OperationResponse[]> => {
|
|
||||||
const clearMessage = logConsoleProgress(
|
|
||||||
`Executing ${documents.length} bulk operations for container ${collection.id()}`
|
|
||||||
);
|
|
||||||
|
|
||||||
try {
|
|
||||||
const response = await client()
|
|
||||||
.database(collection.databaseId)
|
|
||||||
.container(collection.id())
|
|
||||||
.items.bulk(
|
|
||||||
documents.map((doc) => ({ operationType: "Create", resourceBody: doc })),
|
|
||||||
{ continueOnError: true }
|
|
||||||
);
|
|
||||||
|
|
||||||
const successCount = response.filter((r) => r.statusCode === 201).length;
|
|
||||||
const throttledCount = response.filter((r) => r.statusCode === 429).length;
|
|
||||||
|
|
||||||
logConsoleInfo(
|
|
||||||
`${
|
|
||||||
documents.length
|
|
||||||
} operations completed for container ${collection.id()}. ${successCount} operations succeeded. ${throttledCount} operations throttled`
|
|
||||||
);
|
|
||||||
return response;
|
|
||||||
} catch (error) {
|
|
||||||
handleError(error, "BulkCreateDocument", `Error bulk creating items for container ${collection.id()}`);
|
|
||||||
throw error;
|
|
||||||
} finally {
|
|
||||||
clearMessage();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@@ -1,15 +1,15 @@
|
|||||||
import { AuthType } from "../../AuthType";
|
|
||||||
import * as DataModels from "../../Contracts/DataModels";
|
import * as DataModels from "../../Contracts/DataModels";
|
||||||
|
import { AuthType } from "../../AuthType";
|
||||||
import { DefaultAccountExperienceType } from "../../DefaultAccountExperienceType";
|
import { DefaultAccountExperienceType } from "../../DefaultAccountExperienceType";
|
||||||
import { userContext } from "../../UserContext";
|
|
||||||
import { listCassandraTables } from "../../Utils/arm/generatedClients/2020-04-01/cassandraResources";
|
|
||||||
import { listGremlinGraphs } from "../../Utils/arm/generatedClients/2020-04-01/gremlinResources";
|
|
||||||
import { listMongoDBCollections } from "../../Utils/arm/generatedClients/2020-04-01/mongoDBResources";
|
|
||||||
import { listSqlContainers } from "../../Utils/arm/generatedClients/2020-04-01/sqlResources";
|
|
||||||
import { listTables } from "../../Utils/arm/generatedClients/2020-04-01/tableResources";
|
|
||||||
import { logConsoleProgress } from "../../Utils/NotificationConsoleUtils";
|
|
||||||
import { client } from "../CosmosClient";
|
import { client } from "../CosmosClient";
|
||||||
import { handleError } from "../ErrorHandlingUtils";
|
import { handleError } from "../ErrorHandlingUtils";
|
||||||
|
import { listSqlContainers } from "../../Utils/arm/generatedClients/2020-04-01/sqlResources";
|
||||||
|
import { listCassandraTables } from "../../Utils/arm/generatedClients/2020-04-01/cassandraResources";
|
||||||
|
import { listMongoDBCollections } from "../../Utils/arm/generatedClients/2020-04-01/mongoDBResources";
|
||||||
|
import { listGremlinGraphs } from "../../Utils/arm/generatedClients/2020-04-01/gremlinResources";
|
||||||
|
import { listTables } from "../../Utils/arm/generatedClients/2020-04-01/tableResources";
|
||||||
|
import { logConsoleProgress } from "../../Utils/NotificationConsoleUtils";
|
||||||
|
import { userContext } from "../../UserContext";
|
||||||
|
|
||||||
export async function readCollections(databaseId: string): Promise<DataModels.Collection[]> {
|
export async function readCollections(databaseId: string): Promise<DataModels.Collection[]> {
|
||||||
const clearMessage = logConsoleProgress(`Querying containers for database ${databaseId}`);
|
const clearMessage = logConsoleProgress(`Querying containers for database ${databaseId}`);
|
||||||
@@ -17,6 +17,7 @@ export async function readCollections(databaseId: string): Promise<DataModels.Co
|
|||||||
if (
|
if (
|
||||||
userContext.authType === AuthType.AAD &&
|
userContext.authType === AuthType.AAD &&
|
||||||
!userContext.useSDKOperations &&
|
!userContext.useSDKOperations &&
|
||||||
|
userContext.defaultExperience !== DefaultAccountExperienceType.MongoDB &&
|
||||||
userContext.defaultExperience !== DefaultAccountExperienceType.Table
|
userContext.defaultExperience !== DefaultAccountExperienceType.Table
|
||||||
) {
|
) {
|
||||||
return await readCollectionsWithARM(databaseId);
|
return await readCollectionsWithARM(databaseId);
|
||||||
|
|||||||
@@ -1,37 +1,39 @@
|
|||||||
import { ContainerDefinition } from "@azure/cosmos";
|
|
||||||
import { RequestOptions } from "@azure/cosmos/dist-esm";
|
|
||||||
import { AuthType } from "../../AuthType";
|
import { AuthType } from "../../AuthType";
|
||||||
import { Collection } from "../../Contracts/DataModels";
|
import { Collection } from "../../Contracts/DataModels";
|
||||||
|
import { ContainerDefinition } from "@azure/cosmos";
|
||||||
import { DefaultAccountExperienceType } from "../../DefaultAccountExperienceType";
|
import { DefaultAccountExperienceType } from "../../DefaultAccountExperienceType";
|
||||||
import { userContext } from "../../UserContext";
|
import {
|
||||||
|
CreateUpdateOptions,
|
||||||
|
ExtendedResourceProperties,
|
||||||
|
MongoDBCollectionCreateUpdateParameters,
|
||||||
|
MongoDBCollectionResource,
|
||||||
|
SqlContainerCreateUpdateParameters,
|
||||||
|
SqlContainerResource,
|
||||||
|
} from "../../Utils/arm/generatedClients/2020-04-01/types";
|
||||||
|
import { RequestOptions } from "@azure/cosmos/dist-esm";
|
||||||
|
import { client } from "../CosmosClient";
|
||||||
|
import { createUpdateSqlContainer, getSqlContainer } from "../../Utils/arm/generatedClients/2020-04-01/sqlResources";
|
||||||
import {
|
import {
|
||||||
createUpdateCassandraTable,
|
createUpdateCassandraTable,
|
||||||
getCassandraTable,
|
getCassandraTable,
|
||||||
} from "../../Utils/arm/generatedClients/2020-04-01/cassandraResources";
|
} from "../../Utils/arm/generatedClients/2020-04-01/cassandraResources";
|
||||||
import {
|
|
||||||
createUpdateGremlinGraph,
|
|
||||||
getGremlinGraph,
|
|
||||||
} from "../../Utils/arm/generatedClients/2020-04-01/gremlinResources";
|
|
||||||
import {
|
import {
|
||||||
createUpdateMongoDBCollection,
|
createUpdateMongoDBCollection,
|
||||||
getMongoDBCollection,
|
getMongoDBCollection,
|
||||||
} from "../../Utils/arm/generatedClients/2020-04-01/mongoDBResources";
|
} from "../../Utils/arm/generatedClients/2020-04-01/mongoDBResources";
|
||||||
import { createUpdateSqlContainer, getSqlContainer } from "../../Utils/arm/generatedClients/2020-04-01/sqlResources";
|
|
||||||
import { createUpdateTable, getTable } from "../../Utils/arm/generatedClients/2020-04-01/tableResources";
|
|
||||||
import {
|
import {
|
||||||
ExtendedResourceProperties,
|
createUpdateGremlinGraph,
|
||||||
MongoDBCollectionCreateUpdateParameters,
|
getGremlinGraph,
|
||||||
SqlContainerCreateUpdateParameters,
|
} from "../../Utils/arm/generatedClients/2020-04-01/gremlinResources";
|
||||||
SqlContainerResource,
|
import { createUpdateTable, getTable } from "../../Utils/arm/generatedClients/2020-04-01/tableResources";
|
||||||
} from "../../Utils/arm/generatedClients/2020-04-01/types";
|
|
||||||
import { logConsoleInfo, logConsoleProgress } from "../../Utils/NotificationConsoleUtils";
|
|
||||||
import { client } from "../CosmosClient";
|
|
||||||
import { handleError } from "../ErrorHandlingUtils";
|
import { handleError } from "../ErrorHandlingUtils";
|
||||||
|
import { logConsoleInfo, logConsoleProgress } from "../../Utils/NotificationConsoleUtils";
|
||||||
|
import { userContext } from "../../UserContext";
|
||||||
|
|
||||||
export async function updateCollection(
|
export async function updateCollection(
|
||||||
databaseId: string,
|
databaseId: string,
|
||||||
collectionId: string,
|
collectionId: string,
|
||||||
newCollection: Partial<Collection>,
|
newCollection: Collection,
|
||||||
options: RequestOptions = {}
|
options: RequestOptions = {}
|
||||||
): Promise<Collection> {
|
): Promise<Collection> {
|
||||||
let collection: Collection;
|
let collection: Collection;
|
||||||
@@ -41,6 +43,7 @@ export async function updateCollection(
|
|||||||
if (
|
if (
|
||||||
userContext.authType === AuthType.AAD &&
|
userContext.authType === AuthType.AAD &&
|
||||||
!userContext.useSDKOperations &&
|
!userContext.useSDKOperations &&
|
||||||
|
userContext.defaultExperience !== DefaultAccountExperienceType.MongoDB &&
|
||||||
userContext.defaultExperience !== DefaultAccountExperienceType.Table
|
userContext.defaultExperience !== DefaultAccountExperienceType.Table
|
||||||
) {
|
) {
|
||||||
collection = await updateCollectionWithARM(databaseId, collectionId, newCollection);
|
collection = await updateCollectionWithARM(databaseId, collectionId, newCollection);
|
||||||
@@ -66,7 +69,7 @@ export async function updateCollection(
|
|||||||
async function updateCollectionWithARM(
|
async function updateCollectionWithARM(
|
||||||
databaseId: string,
|
databaseId: string,
|
||||||
collectionId: string,
|
collectionId: string,
|
||||||
newCollection: Partial<Collection>
|
newCollection: Collection
|
||||||
): Promise<Collection> {
|
): Promise<Collection> {
|
||||||
const subscriptionId = userContext.subscriptionId;
|
const subscriptionId = userContext.subscriptionId;
|
||||||
const resourceGroup = userContext.resourceGroup;
|
const resourceGroup = userContext.resourceGroup;
|
||||||
@@ -82,15 +85,6 @@ async function updateCollectionWithARM(
|
|||||||
return updateGremlinGraph(databaseId, collectionId, subscriptionId, resourceGroup, accountName, newCollection);
|
return updateGremlinGraph(databaseId, collectionId, subscriptionId, resourceGroup, accountName, newCollection);
|
||||||
case DefaultAccountExperienceType.Table:
|
case DefaultAccountExperienceType.Table:
|
||||||
return updateTable(collectionId, subscriptionId, resourceGroup, accountName, newCollection);
|
return updateTable(collectionId, subscriptionId, resourceGroup, accountName, newCollection);
|
||||||
case DefaultAccountExperienceType.MongoDB:
|
|
||||||
return updateMongoDBCollection(
|
|
||||||
databaseId,
|
|
||||||
collectionId,
|
|
||||||
subscriptionId,
|
|
||||||
resourceGroup,
|
|
||||||
accountName,
|
|
||||||
newCollection
|
|
||||||
);
|
|
||||||
default:
|
default:
|
||||||
throw new Error(`Unsupported default experience type: ${defaultExperience}`);
|
throw new Error(`Unsupported default experience type: ${defaultExperience}`);
|
||||||
}
|
}
|
||||||
@@ -102,7 +96,7 @@ async function updateSqlContainer(
|
|||||||
subscriptionId: string,
|
subscriptionId: string,
|
||||||
resourceGroup: string,
|
resourceGroup: string,
|
||||||
accountName: string,
|
accountName: string,
|
||||||
newCollection: Partial<Collection>
|
newCollection: Collection
|
||||||
): Promise<Collection> {
|
): Promise<Collection> {
|
||||||
const getResponse = await getSqlContainer(subscriptionId, resourceGroup, accountName, databaseId, collectionId);
|
const getResponse = await getSqlContainer(subscriptionId, resourceGroup, accountName, databaseId, collectionId);
|
||||||
if (getResponse && getResponse.properties && getResponse.properties.resource) {
|
if (getResponse && getResponse.properties && getResponse.properties.resource) {
|
||||||
@@ -121,26 +115,35 @@ async function updateSqlContainer(
|
|||||||
throw new Error(`Sql container to update does not exist. Database id: ${databaseId} Collection id: ${collectionId}`);
|
throw new Error(`Sql container to update does not exist. Database id: ${databaseId} Collection id: ${collectionId}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function updateMongoDBCollection(
|
export async function updateMongoDBCollectionThroughRP(
|
||||||
databaseId: string,
|
databaseId: string,
|
||||||
collectionId: string,
|
collectionId: string,
|
||||||
subscriptionId: string,
|
newCollection: MongoDBCollectionResource,
|
||||||
resourceGroup: string,
|
updateOptions?: CreateUpdateOptions
|
||||||
accountName: string,
|
): Promise<MongoDBCollectionResource> {
|
||||||
newCollection: Partial<Collection>
|
const subscriptionId = userContext.subscriptionId;
|
||||||
): Promise<Collection> {
|
const resourceGroup = userContext.resourceGroup;
|
||||||
|
const accountName = userContext.databaseAccount.name;
|
||||||
|
|
||||||
const getResponse = await getMongoDBCollection(subscriptionId, resourceGroup, accountName, databaseId, collectionId);
|
const getResponse = await getMongoDBCollection(subscriptionId, resourceGroup, accountName, databaseId, collectionId);
|
||||||
if (getResponse && getResponse.properties && getResponse.properties.resource) {
|
if (getResponse && getResponse.properties && getResponse.properties.resource) {
|
||||||
getResponse.properties.resource = newCollection as SqlContainerResource & ExtendedResourceProperties;
|
const updateParams: MongoDBCollectionCreateUpdateParameters = {
|
||||||
|
properties: {
|
||||||
|
resource: newCollection,
|
||||||
|
options: updateOptions,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
const updateResponse = await createUpdateMongoDBCollection(
|
const updateResponse = await createUpdateMongoDBCollection(
|
||||||
subscriptionId,
|
subscriptionId,
|
||||||
resourceGroup,
|
resourceGroup,
|
||||||
accountName,
|
accountName,
|
||||||
databaseId,
|
databaseId,
|
||||||
collectionId,
|
collectionId,
|
||||||
getResponse as MongoDBCollectionCreateUpdateParameters
|
updateParams
|
||||||
);
|
);
|
||||||
return updateResponse && (updateResponse.properties.resource as Collection);
|
|
||||||
|
return updateResponse && (updateResponse.properties.resource as MongoDBCollectionResource);
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new Error(
|
throw new Error(
|
||||||
@@ -154,7 +157,7 @@ async function updateCassandraTable(
|
|||||||
subscriptionId: string,
|
subscriptionId: string,
|
||||||
resourceGroup: string,
|
resourceGroup: string,
|
||||||
accountName: string,
|
accountName: string,
|
||||||
newCollection: Partial<Collection>
|
newCollection: Collection
|
||||||
): Promise<Collection> {
|
): Promise<Collection> {
|
||||||
const getResponse = await getCassandraTable(subscriptionId, resourceGroup, accountName, databaseId, collectionId);
|
const getResponse = await getCassandraTable(subscriptionId, resourceGroup, accountName, databaseId, collectionId);
|
||||||
if (getResponse && getResponse.properties && getResponse.properties.resource) {
|
if (getResponse && getResponse.properties && getResponse.properties.resource) {
|
||||||
@@ -181,7 +184,7 @@ async function updateGremlinGraph(
|
|||||||
subscriptionId: string,
|
subscriptionId: string,
|
||||||
resourceGroup: string,
|
resourceGroup: string,
|
||||||
accountName: string,
|
accountName: string,
|
||||||
newCollection: Partial<Collection>
|
newCollection: Collection
|
||||||
): Promise<Collection> {
|
): Promise<Collection> {
|
||||||
const getResponse = await getGremlinGraph(subscriptionId, resourceGroup, accountName, databaseId, collectionId);
|
const getResponse = await getGremlinGraph(subscriptionId, resourceGroup, accountName, databaseId, collectionId);
|
||||||
if (getResponse && getResponse.properties && getResponse.properties.resource) {
|
if (getResponse && getResponse.properties && getResponse.properties.resource) {
|
||||||
@@ -205,7 +208,7 @@ async function updateTable(
|
|||||||
subscriptionId: string,
|
subscriptionId: string,
|
||||||
resourceGroup: string,
|
resourceGroup: string,
|
||||||
accountName: string,
|
accountName: string,
|
||||||
newCollection: Partial<Collection>
|
newCollection: Collection
|
||||||
): Promise<Collection> {
|
): Promise<Collection> {
|
||||||
const getResponse = await getTable(subscriptionId, resourceGroup, accountName, collectionId);
|
const getResponse = await getTable(subscriptionId, resourceGroup, accountName, collectionId);
|
||||||
if (getResponse && getResponse.properties && getResponse.properties.resource) {
|
if (getResponse && getResponse.properties && getResponse.properties.resource) {
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ export interface ConfigContext {
|
|||||||
GITHUB_CLIENT_SECRET?: string; // No need to inject secret for prod. Juno already knows it.
|
GITHUB_CLIENT_SECRET?: string; // No need to inject secret for prod. Juno already knows it.
|
||||||
hostedExplorerURL: string;
|
hostedExplorerURL: string;
|
||||||
armAPIVersion?: string;
|
armAPIVersion?: string;
|
||||||
allowedJunoOrigins: string[];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Default configuration
|
// Default configuration
|
||||||
@@ -54,13 +53,6 @@ let configContext: Readonly<ConfigContext> = {
|
|||||||
GITHUB_CLIENT_ID: "6cb2f63cf6f7b5cbdeca", // Registered OAuth app: https://github.com/settings/applications/1189306
|
GITHUB_CLIENT_ID: "6cb2f63cf6f7b5cbdeca", // Registered OAuth app: https://github.com/settings/applications/1189306
|
||||||
JUNO_ENDPOINT: "https://tools.cosmos.azure.com",
|
JUNO_ENDPOINT: "https://tools.cosmos.azure.com",
|
||||||
BACKEND_ENDPOINT: "https://main.documentdb.ext.azure.com",
|
BACKEND_ENDPOINT: "https://main.documentdb.ext.azure.com",
|
||||||
allowedJunoOrigins: [
|
|
||||||
"https://juno-test.documents-dev.windows-int.net",
|
|
||||||
"https://juno-test2.documents-dev.windows-int.net",
|
|
||||||
"https://tools.cosmos.azure.com",
|
|
||||||
"https://tools-staging.cosmos.azure.com",
|
|
||||||
"https://localhost",
|
|
||||||
],
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export function resetConfigContext(): void {
|
export function resetConfigContext(): void {
|
||||||
@@ -94,18 +86,13 @@ export async function initializeConfiguration(): Promise<ConfigContext> {
|
|||||||
});
|
});
|
||||||
if (response.status === 200) {
|
if (response.status === 200) {
|
||||||
try {
|
try {
|
||||||
const { allowedParentFrameOrigins, allowedJunoOrigins, ...externalConfig } = await response.json();
|
const { allowedParentFrameOrigins, ...externalConfig } = await response.json();
|
||||||
Object.assign(configContext, externalConfig);
|
Object.assign(configContext, externalConfig);
|
||||||
if (allowedParentFrameOrigins && allowedParentFrameOrigins.length > 0) {
|
if (allowedParentFrameOrigins && allowedParentFrameOrigins.length > 0) {
|
||||||
updateConfigContext({
|
updateConfigContext({
|
||||||
allowedParentFrameOrigins: [...configContext.allowedParentFrameOrigins, ...allowedParentFrameOrigins],
|
allowedParentFrameOrigins: [...configContext.allowedParentFrameOrigins, ...allowedParentFrameOrigins],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (allowedJunoOrigins && allowedJunoOrigins.length > 0) {
|
|
||||||
updateConfigContext({
|
|
||||||
allowedJunoOrigins: [...configContext.allowedJunoOrigins, ...allowedJunoOrigins],
|
|
||||||
});
|
|
||||||
}
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Unable to parse json in config file");
|
console.error("Unable to parse json in config file");
|
||||||
console.error(error);
|
console.error(error);
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
export enum TabKind {
|
export enum TabKind {
|
||||||
SQLDocuments,
|
SQLDocuments,
|
||||||
MongoDocuments,
|
MongoDocuments,
|
||||||
SchemaAnalyzer,
|
|
||||||
TableEntities,
|
TableEntities,
|
||||||
Graph,
|
Graph,
|
||||||
SQLQuery,
|
SQLQuery,
|
||||||
|
|||||||
@@ -121,10 +121,6 @@ export interface ISchemaRequest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface Collection extends Resource {
|
export interface Collection extends Resource {
|
||||||
// Only in Mongo collections loaded via ARM
|
|
||||||
shardKey?: {
|
|
||||||
[key: string]: string;
|
|
||||||
};
|
|
||||||
defaultTtl?: number;
|
defaultTtl?: number;
|
||||||
indexingPolicy?: IndexingPolicy;
|
indexingPolicy?: IndexingPolicy;
|
||||||
partitionKey?: PartitionKey;
|
partitionKey?: PartitionKey;
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import StoredProcedure from "../Explorer/Tree/StoredProcedure";
|
|||||||
import Trigger from "../Explorer/Tree/Trigger";
|
import Trigger from "../Explorer/Tree/Trigger";
|
||||||
import UserDefinedFunction from "../Explorer/Tree/UserDefinedFunction";
|
import UserDefinedFunction from "../Explorer/Tree/UserDefinedFunction";
|
||||||
import { SelfServeType } from "../SelfServe/SelfServeUtils";
|
import { SelfServeType } from "../SelfServe/SelfServeUtils";
|
||||||
|
import { UploadDetails } from "../workers/upload/definitions";
|
||||||
import * as DataModels from "./DataModels";
|
import * as DataModels from "./DataModels";
|
||||||
import { SubscriptionType } from "./SubscriptionType";
|
import { SubscriptionType } from "./SubscriptionType";
|
||||||
|
|
||||||
@@ -22,14 +23,6 @@ export interface TokenProvider {
|
|||||||
getAuthHeader(): Promise<Headers>;
|
getAuthHeader(): Promise<Headers>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface UploadDetailsRecord {
|
|
||||||
fileName: string;
|
|
||||||
numSucceeded: number;
|
|
||||||
numFailed: number;
|
|
||||||
numThrottled: number;
|
|
||||||
errors: string[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface QueryResultsMetadata {
|
export interface QueryResultsMetadata {
|
||||||
hasMoreResults: boolean;
|
hasMoreResults: boolean;
|
||||||
firstItemIndex: number;
|
firstItemIndex: number;
|
||||||
@@ -95,6 +88,7 @@ export interface Database extends TreeNode {
|
|||||||
loadCollections(): Promise<void>;
|
loadCollections(): Promise<void>;
|
||||||
findCollectionWithId(collectionId: string): Collection;
|
findCollectionWithId(collectionId: string): Collection;
|
||||||
openAddCollection(database: Database, event: MouseEvent): void;
|
openAddCollection(database: Database, event: MouseEvent): void;
|
||||||
|
onDeleteDatabaseContextMenuClick(source: Database, event: MouseEvent | KeyboardEvent): void;
|
||||||
onSettingsClick: () => void;
|
onSettingsClick: () => void;
|
||||||
loadOffer(): Promise<void>;
|
loadOffer(): Promise<void>;
|
||||||
getPendingThroughputSplitNotification(): Promise<DataModels.Notification>;
|
getPendingThroughputSplitNotification(): Promise<DataModels.Notification>;
|
||||||
@@ -141,7 +135,6 @@ export interface Collection extends CollectionBase {
|
|||||||
onTableEntitiesClick(): void;
|
onTableEntitiesClick(): void;
|
||||||
onGraphDocumentsClick(): void;
|
onGraphDocumentsClick(): void;
|
||||||
onMongoDBDocumentsClick(): void;
|
onMongoDBDocumentsClick(): void;
|
||||||
onSchemaAnalyzerClick(): void;
|
|
||||||
openTab(): void;
|
openTab(): void;
|
||||||
|
|
||||||
onSettingsClick: () => Promise<void>;
|
onSettingsClick: () => Promise<void>;
|
||||||
@@ -182,7 +175,7 @@ export interface Collection extends CollectionBase {
|
|||||||
|
|
||||||
onDragOver(source: Collection, event: { originalEvent: DragEvent }): void;
|
onDragOver(source: Collection, event: { originalEvent: DragEvent }): void;
|
||||||
onDrop(source: Collection, event: { originalEvent: DragEvent }): void;
|
onDrop(source: Collection, event: { originalEvent: DragEvent }): void;
|
||||||
uploadFiles(fileList: FileList): Promise<{ data: UploadDetailsRecord[] }>;
|
uploadFiles(fileList: FileList): Promise<UploadDetails>;
|
||||||
|
|
||||||
getLabel(): string;
|
getLabel(): string;
|
||||||
getPendingThroughputSplitNotification(): Promise<DataModels.Notification>;
|
getPendingThroughputSplitNotification(): Promise<DataModels.Notification>;
|
||||||
@@ -277,6 +270,7 @@ export interface TabOptions {
|
|||||||
tabKind: CollectionTabKind;
|
tabKind: CollectionTabKind;
|
||||||
title: string;
|
title: string;
|
||||||
tabPath: string;
|
tabPath: string;
|
||||||
|
isActive: ko.Observable<boolean>;
|
||||||
hashLocation: string;
|
hashLocation: string;
|
||||||
onUpdateTabsButtons: (buttons: CommandButtonComponentProps[]) => void;
|
onUpdateTabsButtons: (buttons: CommandButtonComponentProps[]) => void;
|
||||||
isTabsContentExpanded?: ko.Observable<boolean>;
|
isTabsContentExpanded?: ko.Observable<boolean>;
|
||||||
@@ -367,7 +361,6 @@ export enum CollectionTabKind {
|
|||||||
Schema = 19,
|
Schema = 19,
|
||||||
CollectionSettingsV2 = 20,
|
CollectionSettingsV2 = 20,
|
||||||
DatabaseSettingsV2 = 21,
|
DatabaseSettingsV2 = 21,
|
||||||
SchemaAnalyzer = 22,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum TerminalKind {
|
export enum TerminalKind {
|
||||||
@@ -383,6 +376,7 @@ export interface DataExplorerInputsFrame {
|
|||||||
masterKey?: string;
|
masterKey?: string;
|
||||||
hasWriteAccess?: boolean;
|
hasWriteAccess?: boolean;
|
||||||
authorizationToken?: string;
|
authorizationToken?: string;
|
||||||
|
features: { [key: string]: string };
|
||||||
csmEndpoint?: string;
|
csmEndpoint?: string;
|
||||||
dnsSuffix?: string;
|
dnsSuffix?: string;
|
||||||
serverId?: string;
|
serverId?: string;
|
||||||
@@ -396,11 +390,9 @@ export interface DataExplorerInputsFrame {
|
|||||||
sharedThroughputMaximum?: number;
|
sharedThroughputMaximum?: number;
|
||||||
sharedThroughputDefault?: number;
|
sharedThroughputDefault?: number;
|
||||||
dataExplorerVersion?: string;
|
dataExplorerVersion?: string;
|
||||||
|
isAuthWithresourceToken?: boolean;
|
||||||
defaultCollectionThroughput?: CollectionCreationDefaults;
|
defaultCollectionThroughput?: CollectionCreationDefaults;
|
||||||
flights?: readonly string[];
|
flights?: readonly string[];
|
||||||
features?: {
|
|
||||||
[key: string]: string;
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SelfServeFrameInputs {
|
export interface SelfServeFrameInputs {
|
||||||
|
|||||||
@@ -1,10 +1,5 @@
|
|||||||
import dayjs from "dayjs";
|
|
||||||
import * as Plotly from "plotly.js-cartesian-dist-min";
|
import * as Plotly from "plotly.js-cartesian-dist-min";
|
||||||
import { StyleConstants } from "../../Common/Constants";
|
import dayjs from "dayjs";
|
||||||
import { sendCachedDataMessage, sendReadyMessage } from "../../Common/MessageHandler";
|
|
||||||
import { MessageTypes } from "../../Contracts/ExplorerContracts";
|
|
||||||
import { isInvalidParentFrameOrigin } from "../../Utils/MessageValidation";
|
|
||||||
import "./Heatmap.less";
|
|
||||||
import {
|
import {
|
||||||
ChartSettings,
|
ChartSettings,
|
||||||
DataPayload,
|
DataPayload,
|
||||||
@@ -16,6 +11,11 @@ import {
|
|||||||
PartitionTimeStampToData,
|
PartitionTimeStampToData,
|
||||||
PortalTheme,
|
PortalTheme,
|
||||||
} from "./HeatmapDatatypes";
|
} from "./HeatmapDatatypes";
|
||||||
|
import { isInvalidParentFrameOrigin } from "../../Utils/MessageValidation";
|
||||||
|
import { sendCachedDataMessage, sendMessage } from "../../Common/MessageHandler";
|
||||||
|
import { MessageTypes } from "../../Contracts/ExplorerContracts";
|
||||||
|
import { StyleConstants } from "../../Common/Constants";
|
||||||
|
import "./Heatmap.less";
|
||||||
|
|
||||||
export class Heatmap {
|
export class Heatmap {
|
||||||
public static readonly elementId: string = "heatmap";
|
public static readonly elementId: string = "heatmap";
|
||||||
@@ -266,4 +266,4 @@ export function handleMessage(event: MessageEvent) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
window.addEventListener("message", handleMessage, false);
|
window.addEventListener("message", handleMessage, false);
|
||||||
sendReadyMessage();
|
sendMessage("ready");
|
||||||
|
|||||||
7
src/Definitions/worker.d.ts
vendored
Normal file
7
src/Definitions/worker.d.ts
vendored
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
declare module "worker-loader!*" {
|
||||||
|
class WebpackWorker extends Worker {
|
||||||
|
constructor();
|
||||||
|
}
|
||||||
|
|
||||||
|
export default WebpackWorker;
|
||||||
|
}
|
||||||
@@ -8,6 +8,10 @@ describe("Component Registerer", () => {
|
|||||||
expect(ko.components.isRegistered("input-typeahead")).toBe(true);
|
expect(ko.components.isRegistered("input-typeahead")).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("should register new-vertex-form component", () => {
|
||||||
|
expect(ko.components.isRegistered("new-vertex-form")).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
it("should register error-display component", () => {
|
it("should register error-display component", () => {
|
||||||
expect(ko.components.isRegistered("error-display")).toBe(true);
|
expect(ko.components.isRegistered("error-display")).toBe(true);
|
||||||
});
|
});
|
||||||
@@ -69,14 +73,42 @@ describe("Component Registerer", () => {
|
|||||||
expect(ko.components.isRegistered("add-collection-pane")).toBe(true);
|
expect(ko.components.isRegistered("add-collection-pane")).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("should register delete-collection-confirmation-pane component", () => {
|
||||||
|
expect(ko.components.isRegistered("delete-collection-confirmation-pane")).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should register delete-database-confirmation-pane component", () => {
|
||||||
|
expect(ko.components.isRegistered("delete-database-confirmation-pane")).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should register save-query-pane component", () => {
|
||||||
|
expect(ko.components.isRegistered("save-query-pane")).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should register browse-queries-pane component", () => {
|
||||||
|
expect(ko.components.isRegistered("browse-queries-pane")).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should register graph-new-vertex-pane component", () => {
|
||||||
|
expect(ko.components.isRegistered("graph-new-vertex-pane")).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
it("should register graph-styling-pane component", () => {
|
it("should register graph-styling-pane component", () => {
|
||||||
expect(ko.components.isRegistered("graph-styling-pane")).toBe(true);
|
expect(ko.components.isRegistered("graph-styling-pane")).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("should register upload-file-pane component", () => {
|
||||||
|
expect(ko.components.isRegistered("upload-file-pane")).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
it("should register string-input-pane component", () => {
|
it("should register string-input-pane component", () => {
|
||||||
expect(ko.components.isRegistered("string-input-pane")).toBe(true);
|
expect(ko.components.isRegistered("string-input-pane")).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("should register setup-notebooks-pane component", () => {
|
||||||
|
expect(ko.components.isRegistered("setup-notebooks-pane")).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
it("should register dynamic-list component", () => {
|
it("should register dynamic-list component", () => {
|
||||||
expect(ko.components.isRegistered("dynamic-list")).toBe(true);
|
expect(ko.components.isRegistered("dynamic-list")).toBe(true);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,30 +1,19 @@
|
|||||||
import * as ko from "knockout";
|
import * as ko from "knockout";
|
||||||
|
import * as PaneComponents from "./Panes/PaneComponents";
|
||||||
|
import * as TabComponents from "./Tabs/TabComponents";
|
||||||
import { DiffEditorComponent } from "./Controls/DiffEditor/DiffEditorComponent";
|
import { DiffEditorComponent } from "./Controls/DiffEditor/DiffEditorComponent";
|
||||||
import { DynamicListComponent } from "./Controls/DynamicList/DynamicListComponent";
|
import { DynamicListComponent } from "./Controls/DynamicList/DynamicListComponent";
|
||||||
import { EditorComponent } from "./Controls/Editor/EditorComponent";
|
import { EditorComponent } from "./Controls/Editor/EditorComponent";
|
||||||
import { ErrorDisplayComponent } from "./Controls/ErrorDisplayComponent/ErrorDisplayComponent";
|
import { ErrorDisplayComponent } from "./Controls/ErrorDisplayComponent/ErrorDisplayComponent";
|
||||||
|
import { GraphStyleComponent } from "./Graph/GraphStyleComponent/GraphStyleComponent";
|
||||||
import { InputTypeaheadComponent } from "./Controls/InputTypeahead/InputTypeahead";
|
import { InputTypeaheadComponent } from "./Controls/InputTypeahead/InputTypeahead";
|
||||||
import { JsonEditorComponent } from "./Controls/JsonEditor/JsonEditorComponent";
|
import { JsonEditorComponent } from "./Controls/JsonEditor/JsonEditorComponent";
|
||||||
|
import { NewVertexComponent } from "./Graph/NewVertexComponent/NewVertexComponent";
|
||||||
|
import { TabsManagerKOComponent } from "./Tabs/TabsManager";
|
||||||
import { ThroughputInputComponentAutoPilotV3 } from "./Controls/ThroughputInput/ThroughputInputComponentAutoPilotV3";
|
import { ThroughputInputComponentAutoPilotV3 } from "./Controls/ThroughputInput/ThroughputInputComponentAutoPilotV3";
|
||||||
import { GraphStyleComponent } from "./Graph/GraphStyleComponent/GraphStyleComponent";
|
|
||||||
import * as PaneComponents from "./Panes/PaneComponents";
|
|
||||||
import ConflictsTab from "./Tabs/ConflictsTab";
|
|
||||||
import DocumentsTab from "./Tabs/DocumentsTab";
|
|
||||||
import GalleryTab from "./Tabs/GalleryTab";
|
|
||||||
import GraphTab from "./Tabs/GraphTab";
|
|
||||||
import MongoShellTab from "./Tabs/MongoShellTab";
|
|
||||||
import NotebookTabV2 from "./Tabs/NotebookV2Tab";
|
|
||||||
import NotebookViewerTab from "./Tabs/NotebookViewerTab";
|
|
||||||
import QueryTab from "./Tabs/QueryTab";
|
|
||||||
import QueryTablesTab from "./Tabs/QueryTablesTab";
|
|
||||||
import SchemaAnalyzerTab from "./Tabs/SchemaAnalyzerTab";
|
|
||||||
import { DatabaseSettingsTabV2, SettingsTabV2 } from "./Tabs/SettingsTabV2";
|
|
||||||
import StoredProcedureTab from "./Tabs/StoredProcedureTab";
|
|
||||||
import TerminalTab from "./Tabs/TerminalTab";
|
|
||||||
import TriggerTab from "./Tabs/TriggerTab";
|
|
||||||
import UserDefinedFunctionTab from "./Tabs/UserDefinedFunctionTab";
|
|
||||||
|
|
||||||
ko.components.register("input-typeahead", new InputTypeaheadComponent());
|
ko.components.register("input-typeahead", new InputTypeaheadComponent());
|
||||||
|
ko.components.register("new-vertex-form", NewVertexComponent);
|
||||||
ko.components.register("error-display", new ErrorDisplayComponent());
|
ko.components.register("error-display", new ErrorDisplayComponent());
|
||||||
ko.components.register("graph-style", GraphStyleComponent);
|
ko.components.register("graph-style", GraphStyleComponent);
|
||||||
ko.components.register("editor", new EditorComponent());
|
ko.components.register("editor", new EditorComponent());
|
||||||
@@ -32,33 +21,54 @@ ko.components.register("json-editor", new JsonEditorComponent());
|
|||||||
ko.components.register("diff-editor", new DiffEditorComponent());
|
ko.components.register("diff-editor", new DiffEditorComponent());
|
||||||
ko.components.register("dynamic-list", DynamicListComponent);
|
ko.components.register("dynamic-list", DynamicListComponent);
|
||||||
ko.components.register("throughput-input-autopilot-v3", ThroughputInputComponentAutoPilotV3);
|
ko.components.register("throughput-input-autopilot-v3", ThroughputInputComponentAutoPilotV3);
|
||||||
|
ko.components.register("tabs-manager", TabsManagerKOComponent());
|
||||||
|
|
||||||
// Collection Tabs
|
// Collection Tabs
|
||||||
[
|
ko.components.register("documents-tab", new TabComponents.DocumentsTab());
|
||||||
DocumentsTab,
|
ko.components.register("mongo-documents-tab", new TabComponents.MongoDocumentsTab());
|
||||||
StoredProcedureTab,
|
ko.components.register("stored-procedure-tab", new TabComponents.StoredProcedureTab());
|
||||||
TriggerTab,
|
ko.components.register("trigger-tab", new TabComponents.TriggerTab());
|
||||||
UserDefinedFunctionTab,
|
ko.components.register("user-defined-function-tab", new TabComponents.UserDefinedFunctionTab());
|
||||||
SettingsTabV2,
|
ko.components.register("collection-settings-tab-v2", new TabComponents.SettingsTabV2());
|
||||||
QueryTab,
|
ko.components.register("query-tab", new TabComponents.QueryTab());
|
||||||
QueryTablesTab,
|
ko.components.register("tables-query-tab", new TabComponents.QueryTablesTab());
|
||||||
GraphTab,
|
ko.components.register("graph-tab", new TabComponents.GraphTab());
|
||||||
MongoShellTab,
|
ko.components.register("mongo-shell-tab", new TabComponents.MongoShellTab());
|
||||||
ConflictsTab,
|
ko.components.register("conflicts-tab", new TabComponents.ConflictsTab());
|
||||||
NotebookTabV2,
|
ko.components.register("notebookv2-tab", new TabComponents.NotebookV2Tab());
|
||||||
TerminalTab,
|
ko.components.register("terminal-tab", new TabComponents.TerminalTab());
|
||||||
GalleryTab,
|
ko.components.register("gallery-tab", new TabComponents.GalleryTab());
|
||||||
NotebookViewerTab,
|
ko.components.register("notebook-viewer-tab", new TabComponents.NotebookViewerTab());
|
||||||
DatabaseSettingsTabV2,
|
|
||||||
SchemaAnalyzerTab,
|
// Database Tabs
|
||||||
].forEach(({ component: { name, template } }) => ko.components.register(name, { template }));
|
ko.components.register("database-settings-tab", new TabComponents.DatabaseSettingsTab());
|
||||||
|
ko.components.register("database-settings-tab-v2", new TabComponents.SettingsTabV2());
|
||||||
|
|
||||||
// Panes
|
// Panes
|
||||||
ko.components.register("add-database-pane", new PaneComponents.AddDatabasePaneComponent());
|
ko.components.register("add-database-pane", new PaneComponents.AddDatabasePaneComponent());
|
||||||
ko.components.register("add-collection-pane", new PaneComponents.AddCollectionPaneComponent());
|
ko.components.register("add-collection-pane", new PaneComponents.AddCollectionPaneComponent());
|
||||||
|
ko.components.register(
|
||||||
|
"delete-collection-confirmation-pane",
|
||||||
|
new PaneComponents.DeleteCollectionConfirmationPaneComponent()
|
||||||
|
);
|
||||||
|
ko.components.register(
|
||||||
|
"delete-database-confirmation-pane",
|
||||||
|
new PaneComponents.DeleteDatabaseConfirmationPaneComponent()
|
||||||
|
);
|
||||||
|
ko.components.register("graph-new-vertex-pane", new PaneComponents.GraphNewVertexPaneComponent());
|
||||||
ko.components.register("graph-styling-pane", new PaneComponents.GraphStylingPaneComponent());
|
ko.components.register("graph-styling-pane", new PaneComponents.GraphStylingPaneComponent());
|
||||||
ko.components.register("table-add-entity-pane", new PaneComponents.TableAddEntityPaneComponent());
|
ko.components.register("table-add-entity-pane", new PaneComponents.TableAddEntityPaneComponent());
|
||||||
ko.components.register("table-edit-entity-pane", new PaneComponents.TableEditEntityPaneComponent());
|
ko.components.register("table-edit-entity-pane", new PaneComponents.TableEditEntityPaneComponent());
|
||||||
|
ko.components.register("table-column-options-pane", new PaneComponents.TableColumnOptionsPaneComponent());
|
||||||
|
ko.components.register("table-query-select-pane", new PaneComponents.TableQuerySelectPaneComponent());
|
||||||
ko.components.register("cassandra-add-collection-pane", new PaneComponents.CassandraAddCollectionPaneComponent());
|
ko.components.register("cassandra-add-collection-pane", new PaneComponents.CassandraAddCollectionPaneComponent());
|
||||||
|
ko.components.register("settings-pane", new PaneComponents.SettingsPaneComponent());
|
||||||
|
ko.components.register("execute-sproc-params-pane", new PaneComponents.ExecuteSprocParamsComponent());
|
||||||
|
ko.components.register("upload-items-pane", new PaneComponents.UploadItemsPaneComponent());
|
||||||
|
ko.components.register("load-query-pane", new PaneComponents.LoadQueryPaneComponent());
|
||||||
|
ko.components.register("save-query-pane", new PaneComponents.SaveQueryPaneComponent());
|
||||||
|
ko.components.register("browse-queries-pane", new PaneComponents.BrowseQueriesPaneComponent());
|
||||||
|
ko.components.register("upload-file-pane", new PaneComponents.UploadFilePaneComponent());
|
||||||
ko.components.register("string-input-pane", new PaneComponents.StringInputPaneComponent());
|
ko.components.register("string-input-pane", new PaneComponents.StringInputPaneComponent());
|
||||||
|
ko.components.register("setup-notebooks-pane", new PaneComponents.SetupNotebooksPaneComponent());
|
||||||
ko.components.register("github-repos-pane", new PaneComponents.GitHubReposPaneComponent());
|
ko.components.register("github-repos-pane", new PaneComponents.GitHubReposPaneComponent());
|
||||||
|
|||||||
@@ -1,22 +1,23 @@
|
|||||||
|
import * as ko from "knockout";
|
||||||
|
import * as ViewModels from "../Contracts/ViewModels";
|
||||||
|
import { TreeNodeMenuItem } from "./Controls/TreeComponent/TreeComponent";
|
||||||
import AddCollectionIcon from "../../images/AddCollection.svg";
|
import AddCollectionIcon from "../../images/AddCollection.svg";
|
||||||
import AddSqlQueryIcon from "../../images/AddSqlQuery_16x16.svg";
|
import AddSqlQueryIcon from "../../images/AddSqlQuery_16x16.svg";
|
||||||
|
import HostedTerminalIcon from "../../images/Hosted-Terminal.svg";
|
||||||
import AddStoredProcedureIcon from "../../images/AddStoredProcedure.svg";
|
import AddStoredProcedureIcon from "../../images/AddStoredProcedure.svg";
|
||||||
import AddTriggerIcon from "../../images/AddTrigger.svg";
|
|
||||||
import AddUdfIcon from "../../images/AddUdf.svg";
|
|
||||||
import DeleteCollectionIcon from "../../images/DeleteCollection.svg";
|
import DeleteCollectionIcon from "../../images/DeleteCollection.svg";
|
||||||
import DeleteDatabaseIcon from "../../images/DeleteDatabase.svg";
|
import DeleteDatabaseIcon from "../../images/DeleteDatabase.svg";
|
||||||
import DeleteSprocIcon from "../../images/DeleteSproc.svg";
|
import AddUdfIcon from "../../images/AddUdf.svg";
|
||||||
|
import AddTriggerIcon from "../../images/AddTrigger.svg";
|
||||||
import DeleteTriggerIcon from "../../images/DeleteTrigger.svg";
|
import DeleteTriggerIcon from "../../images/DeleteTrigger.svg";
|
||||||
import DeleteUDFIcon from "../../images/DeleteUDF.svg";
|
import DeleteUDFIcon from "../../images/DeleteUDF.svg";
|
||||||
import HostedTerminalIcon from "../../images/Hosted-Terminal.svg";
|
import DeleteSprocIcon from "../../images/DeleteSproc.svg";
|
||||||
import * as ViewModels from "../Contracts/ViewModels";
|
|
||||||
import { DefaultAccountExperienceType } from "../DefaultAccountExperienceType";
|
|
||||||
import { userContext } from "../UserContext";
|
|
||||||
import { TreeNodeMenuItem } from "./Controls/TreeComponent/TreeComponent";
|
|
||||||
import Explorer from "./Explorer";
|
import Explorer from "./Explorer";
|
||||||
|
import UserDefinedFunction from "./Tree/UserDefinedFunction";
|
||||||
import StoredProcedure from "./Tree/StoredProcedure";
|
import StoredProcedure from "./Tree/StoredProcedure";
|
||||||
import Trigger from "./Tree/Trigger";
|
import Trigger from "./Tree/Trigger";
|
||||||
import UserDefinedFunction from "./Tree/UserDefinedFunction";
|
import { userContext } from "../UserContext";
|
||||||
|
import { DefaultAccountExperienceType } from "../DefaultAccountExperienceType";
|
||||||
|
|
||||||
export interface CollectionContextMenuButtonParams {
|
export interface CollectionContextMenuButtonParams {
|
||||||
databaseId: string;
|
databaseId: string;
|
||||||
@@ -42,7 +43,7 @@ export class ResourceTreeContextMenuButtonFactory {
|
|||||||
if (userContext.defaultExperience !== DefaultAccountExperienceType.Table) {
|
if (userContext.defaultExperience !== DefaultAccountExperienceType.Table) {
|
||||||
items.push({
|
items.push({
|
||||||
iconSrc: DeleteDatabaseIcon,
|
iconSrc: DeleteDatabaseIcon,
|
||||||
onClick: () => container.openDeleteDatabaseConfirmationPane(),
|
onClick: () => container.deleteDatabaseConfirmationPane.open(),
|
||||||
label: container.deleteDatabaseText(),
|
label: container.deleteDatabaseText(),
|
||||||
styleClass: "deleteDatabaseMenuItem",
|
styleClass: "deleteDatabaseMenuItem",
|
||||||
});
|
});
|
||||||
@@ -55,7 +56,7 @@ export class ResourceTreeContextMenuButtonFactory {
|
|||||||
selectedCollection: ViewModels.Collection
|
selectedCollection: ViewModels.Collection
|
||||||
): TreeNodeMenuItem[] {
|
): TreeNodeMenuItem[] {
|
||||||
const items: TreeNodeMenuItem[] = [];
|
const items: TreeNodeMenuItem[] = [];
|
||||||
if (userContext.apiType === "SQL" || userContext.apiType === "Gremlin") {
|
if (container.isPreferredApiDocumentDB() || container.isPreferredApiGraph()) {
|
||||||
items.push({
|
items.push({
|
||||||
iconSrc: AddSqlQueryIcon,
|
iconSrc: AddSqlQueryIcon,
|
||||||
onClick: () => selectedCollection && selectedCollection.onNewQueryClick(selectedCollection, null),
|
onClick: () => selectedCollection && selectedCollection.onNewQueryClick(selectedCollection, null),
|
||||||
@@ -80,7 +81,7 @@ export class ResourceTreeContextMenuButtonFactory {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (userContext.apiType === "SQL" || userContext.apiType === "Gremlin") {
|
if (container.isPreferredApiDocumentDB() || container.isPreferredApiGraph()) {
|
||||||
items.push({
|
items.push({
|
||||||
iconSrc: AddStoredProcedureIcon,
|
iconSrc: AddStoredProcedureIcon,
|
||||||
onClick: () => {
|
onClick: () => {
|
||||||
@@ -123,7 +124,7 @@ export class ResourceTreeContextMenuButtonFactory {
|
|||||||
container: Explorer,
|
container: Explorer,
|
||||||
storedProcedure: StoredProcedure
|
storedProcedure: StoredProcedure
|
||||||
): TreeNodeMenuItem[] {
|
): TreeNodeMenuItem[] {
|
||||||
if (userContext.apiType === "Cassandra") {
|
if (container.isPreferredApiCassandra()) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -137,7 +138,7 @@ export class ResourceTreeContextMenuButtonFactory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static createTriggerContextMenuItems(container: Explorer, trigger: Trigger): TreeNodeMenuItem[] {
|
public static createTriggerContextMenuItems(container: Explorer, trigger: Trigger): TreeNodeMenuItem[] {
|
||||||
if (userContext.apiType === "Cassandra") {
|
if (container.isPreferredApiCassandra()) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -154,7 +155,7 @@ export class ResourceTreeContextMenuButtonFactory {
|
|||||||
container: Explorer,
|
container: Explorer,
|
||||||
userDefinedFunction: UserDefinedFunction
|
userDefinedFunction: UserDefinedFunction
|
||||||
): TreeNodeMenuItem[] {
|
): TreeNodeMenuItem[] {
|
||||||
if (userContext.apiType === "Cassandra") {
|
if (container.isPreferredApiCassandra()) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ describe("CollapsibleSectionComponent", () => {
|
|||||||
it("renders", () => {
|
it("renders", () => {
|
||||||
const props: CollapsibleSectionProps = {
|
const props: CollapsibleSectionProps = {
|
||||||
title: "Sample title",
|
title: "Sample title",
|
||||||
isExpandedByDefault: true,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const wrapper = shallow(<CollapsibleSectionComponent {...props} />);
|
const wrapper = shallow(<CollapsibleSectionComponent {...props} />);
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
import { Icon, Label, Stack } from "office-ui-fabric-react";
|
import { Icon, Label, Stack } from "office-ui-fabric-react";
|
||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
import { accordionStackTokens } from "../Settings/SettingsRenderUtils";
|
import { accordionIconStyles, accordionStackTokens } from "../Settings/SettingsRenderUtils";
|
||||||
|
|
||||||
export interface CollapsibleSectionProps {
|
export interface CollapsibleSectionProps {
|
||||||
title: string;
|
title: string;
|
||||||
isExpandedByDefault: boolean;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CollapsibleSectionState {
|
export interface CollapsibleSectionState {
|
||||||
@@ -15,7 +14,7 @@ export class CollapsibleSectionComponent extends React.Component<CollapsibleSect
|
|||||||
constructor(props: CollapsibleSectionProps) {
|
constructor(props: CollapsibleSectionProps) {
|
||||||
super(props);
|
super(props);
|
||||||
this.state = {
|
this.state = {
|
||||||
isExpanded: this.props.isExpandedByDefault,
|
isExpanded: true,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -26,14 +25,8 @@ export class CollapsibleSectionComponent extends React.Component<CollapsibleSect
|
|||||||
public render(): JSX.Element {
|
public render(): JSX.Element {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Stack
|
<Stack className="collapsibleSection" horizontal tokens={accordionStackTokens} onClick={this.toggleCollapsed}>
|
||||||
className="collapsibleSection"
|
<Icon iconName={this.state.isExpanded ? "ChevronDown" : "ChevronRight"} styles={accordionIconStyles} />
|
||||||
horizontal
|
|
||||||
verticalAlign="center"
|
|
||||||
tokens={accordionStackTokens}
|
|
||||||
onClick={this.toggleCollapsed}
|
|
||||||
>
|
|
||||||
<Icon iconName={this.state.isExpanded ? "ChevronDown" : "ChevronRight"} />
|
|
||||||
<Label>{this.props.title}</Label>
|
<Label>{this.props.title}</Label>
|
||||||
</Stack>
|
</Stack>
|
||||||
{this.state.isExpanded && this.props.children}
|
{this.state.isExpanded && this.props.children}
|
||||||
|
|||||||
@@ -11,10 +11,16 @@ exports[`CollapsibleSectionComponent renders 1`] = `
|
|||||||
"childrenGap": 10,
|
"childrenGap": 10,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
verticalAlign="center"
|
|
||||||
>
|
>
|
||||||
<Icon
|
<StyledIconBase
|
||||||
iconName="ChevronDown"
|
iconName="ChevronDown"
|
||||||
|
styles={
|
||||||
|
Object {
|
||||||
|
"root": Object {
|
||||||
|
"paddingTop": 7,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
<StyledLabelBase>
|
<StyledLabelBase>
|
||||||
Sample title
|
Sample title
|
||||||
|
|||||||
@@ -1,3 +1,8 @@
|
|||||||
|
import * as React from "react";
|
||||||
|
import { Dialog as FluentDialog, DialogType, DialogFooter, IDialogProps } from "office-ui-fabric-react/lib/Dialog";
|
||||||
|
import { IButtonProps, PrimaryButton, DefaultButton } from "office-ui-fabric-react/lib/Button";
|
||||||
|
import { ITextFieldProps, TextField } from "office-ui-fabric-react/lib/TextField";
|
||||||
|
import { Link } from "office-ui-fabric-react/lib/Link";
|
||||||
import {
|
import {
|
||||||
ChoiceGroup,
|
ChoiceGroup,
|
||||||
FontIcon,
|
FontIcon,
|
||||||
@@ -5,11 +10,6 @@ import {
|
|||||||
IProgressIndicatorProps,
|
IProgressIndicatorProps,
|
||||||
ProgressIndicator,
|
ProgressIndicator,
|
||||||
} from "office-ui-fabric-react";
|
} from "office-ui-fabric-react";
|
||||||
import { DefaultButton, IButtonProps, PrimaryButton } from "office-ui-fabric-react/lib/Button";
|
|
||||||
import { Dialog as FluentDialog, DialogFooter, DialogType, IDialogProps } from "office-ui-fabric-react/lib/Dialog";
|
|
||||||
import { Link } from "office-ui-fabric-react/lib/Link";
|
|
||||||
import { ITextFieldProps, TextField } from "office-ui-fabric-react/lib/TextField";
|
|
||||||
import React, { FunctionComponent } from "react";
|
|
||||||
|
|
||||||
export interface TextFieldProps extends ITextFieldProps {
|
export interface TextFieldProps extends ITextFieldProps {
|
||||||
label: string;
|
label: string;
|
||||||
@@ -50,69 +50,61 @@ const DIALOG_TITLE_FONT_SIZE = "17px";
|
|||||||
const DIALOG_TITLE_FONT_WEIGHT = 400;
|
const DIALOG_TITLE_FONT_WEIGHT = 400;
|
||||||
const DIALOG_SUBTEXT_FONT_SIZE = "15px";
|
const DIALOG_SUBTEXT_FONT_SIZE = "15px";
|
||||||
|
|
||||||
export const Dialog: FunctionComponent<DialogProps> = ({
|
export class Dialog extends React.Component<DialogProps> {
|
||||||
title,
|
constructor(props: DialogProps) {
|
||||||
subText,
|
super(props);
|
||||||
isModal,
|
}
|
||||||
visible,
|
|
||||||
choiceGroupProps,
|
public render(): JSX.Element {
|
||||||
textFieldProps,
|
const dialogProps: IDialogProps = {
|
||||||
linkProps,
|
hidden: !this.props.visible,
|
||||||
progressIndicatorProps,
|
dialogContentProps: {
|
||||||
primaryButtonText,
|
type: this.props.type || DialogType.normal,
|
||||||
secondaryButtonText,
|
title: this.props.title,
|
||||||
onPrimaryButtonClick,
|
subText: this.props.subText,
|
||||||
onSecondaryButtonClick,
|
styles: {
|
||||||
primaryButtonDisabled,
|
title: { fontSize: DIALOG_TITLE_FONT_SIZE, fontWeight: DIALOG_TITLE_FONT_WEIGHT },
|
||||||
type,
|
subText: { fontSize: DIALOG_SUBTEXT_FONT_SIZE },
|
||||||
showCloseButton,
|
},
|
||||||
onDismiss,
|
showCloseButton: this.props.showCloseButton || false,
|
||||||
}: DialogProps) => {
|
onDismiss: this.props.onDismiss,
|
||||||
const dialogProps: IDialogProps = {
|
|
||||||
hidden: !visible,
|
|
||||||
dialogContentProps: {
|
|
||||||
type: type || DialogType.normal,
|
|
||||||
title,
|
|
||||||
subText,
|
|
||||||
styles: {
|
|
||||||
title: { fontSize: DIALOG_TITLE_FONT_SIZE, fontWeight: DIALOG_TITLE_FONT_WEIGHT },
|
|
||||||
subText: { fontSize: DIALOG_SUBTEXT_FONT_SIZE },
|
|
||||||
},
|
},
|
||||||
showCloseButton: showCloseButton || false,
|
modalProps: { isBlocking: this.props.isModal, isDarkOverlay: false },
|
||||||
onDismiss,
|
minWidth: DIALOG_MIN_WIDTH,
|
||||||
},
|
maxWidth: DIALOG_MAX_WIDTH,
|
||||||
modalProps: { isBlocking: isModal, isDarkOverlay: false },
|
};
|
||||||
minWidth: DIALOG_MIN_WIDTH,
|
const choiceGroupProps: IChoiceGroupProps = this.props.choiceGroupProps;
|
||||||
maxWidth: DIALOG_MAX_WIDTH,
|
const textFieldProps: ITextFieldProps = this.props.textFieldProps;
|
||||||
};
|
const linkProps: LinkProps = this.props.linkProps;
|
||||||
|
const progressIndicatorProps: IProgressIndicatorProps = this.props.progressIndicatorProps;
|
||||||
|
const primaryButtonProps: IButtonProps = {
|
||||||
|
text: this.props.primaryButtonText,
|
||||||
|
disabled: this.props.primaryButtonDisabled || false,
|
||||||
|
onClick: this.props.onPrimaryButtonClick,
|
||||||
|
};
|
||||||
|
const secondaryButtonProps: IButtonProps =
|
||||||
|
this.props.secondaryButtonText && this.props.onSecondaryButtonClick
|
||||||
|
? {
|
||||||
|
text: this.props.secondaryButtonText,
|
||||||
|
onClick: this.props.onSecondaryButtonClick,
|
||||||
|
}
|
||||||
|
: undefined;
|
||||||
|
|
||||||
const primaryButtonProps: IButtonProps = {
|
return (
|
||||||
text: primaryButtonText,
|
<FluentDialog {...dialogProps}>
|
||||||
disabled: primaryButtonDisabled || false,
|
{choiceGroupProps && <ChoiceGroup {...choiceGroupProps} />}
|
||||||
onClick: onPrimaryButtonClick,
|
{textFieldProps && <TextField {...textFieldProps} />}
|
||||||
};
|
{linkProps && (
|
||||||
const secondaryButtonProps: IButtonProps =
|
<Link href={linkProps.linkUrl} target="_blank">
|
||||||
secondaryButtonText && onSecondaryButtonClick
|
{linkProps.linkText} <FontIcon iconName="NavigateExternalInline" />
|
||||||
? {
|
</Link>
|
||||||
text: secondaryButtonText,
|
)}
|
||||||
onClick: onSecondaryButtonClick,
|
{progressIndicatorProps && <ProgressIndicator {...progressIndicatorProps} />}
|
||||||
}
|
<DialogFooter>
|
||||||
: undefined;
|
<PrimaryButton {...primaryButtonProps} />
|
||||||
|
{secondaryButtonProps && <DefaultButton {...secondaryButtonProps} />}
|
||||||
return (
|
</DialogFooter>
|
||||||
<FluentDialog {...dialogProps}>
|
</FluentDialog>
|
||||||
{choiceGroupProps && <ChoiceGroup {...choiceGroupProps} />}
|
);
|
||||||
{textFieldProps && <TextField {...textFieldProps} />}
|
}
|
||||||
{linkProps && (
|
}
|
||||||
<Link href={linkProps.linkUrl} target="_blank">
|
|
||||||
{linkProps.linkText} <FontIcon iconName="NavigateExternalInline" />
|
|
||||||
</Link>
|
|
||||||
)}
|
|
||||||
{progressIndicatorProps && <ProgressIndicator {...progressIndicatorProps} />}
|
|
||||||
<DialogFooter>
|
|
||||||
<PrimaryButton {...primaryButtonProps} />
|
|
||||||
{secondaryButtonProps && <DefaultButton {...secondaryButtonProps} />}
|
|
||||||
</DialogFooter>
|
|
||||||
</FluentDialog>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|||||||
@@ -354,6 +354,7 @@ exports[`test render renders with filters 1`] = `
|
|||||||
data-is-scrollable="true"
|
data-is-scrollable="true"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
|
aria-hidden="true"
|
||||||
className="stickyAbove-42"
|
className="stickyAbove-42"
|
||||||
style={
|
style={
|
||||||
Object {
|
Object {
|
||||||
@@ -374,6 +375,7 @@ exports[`test render renders with filters 1`] = `
|
|||||||
>
|
>
|
||||||
<div>
|
<div>
|
||||||
<div
|
<div
|
||||||
|
aria-hidden={true}
|
||||||
style={
|
style={
|
||||||
Object {
|
Object {
|
||||||
"pointerEvents": "none",
|
"pointerEvents": "none",
|
||||||
@@ -393,6 +395,7 @@ exports[`test render renders with filters 1`] = `
|
|||||||
style={Object {}}
|
style={Object {}}
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
|
aria-hidden={false}
|
||||||
style={
|
style={
|
||||||
Object {
|
Object {
|
||||||
"backgroundColor": "",
|
"backgroundColor": "",
|
||||||
@@ -408,7 +411,6 @@ exports[`test render renders with filters 1`] = `
|
|||||||
>
|
>
|
||||||
<TextFieldBase
|
<TextFieldBase
|
||||||
ariaLabel="Directory filter text box"
|
ariaLabel="Directory filter text box"
|
||||||
canRevealPassword={false}
|
|
||||||
className="directoryListFilterTextBox"
|
className="directoryListFilterTextBox"
|
||||||
deferredValidationTime={200}
|
deferredValidationTime={200}
|
||||||
onChange={[Function]}
|
onChange={[Function]}
|
||||||
@@ -1121,7 +1123,7 @@ exports[`test render renders with filters 1`] = `
|
|||||||
"iconDisabled": Object {
|
"iconDisabled": Object {
|
||||||
"color": "#a19f9d",
|
"color": "#a19f9d",
|
||||||
"selectors": Object {
|
"selectors": Object {
|
||||||
"@media screen and (-ms-high-contrast: active), (forced-colors: active)": Object {
|
"@media screen and (-ms-high-contrast: active)": Object {
|
||||||
"color": "GrayText",
|
"color": "GrayText",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -1147,7 +1149,7 @@ exports[`test render renders with filters 1`] = `
|
|||||||
"menuIconDisabled": Object {
|
"menuIconDisabled": Object {
|
||||||
"color": "#a19f9d",
|
"color": "#a19f9d",
|
||||||
"selectors": Object {
|
"selectors": Object {
|
||||||
"@media screen and (-ms-high-contrast: active), (forced-colors: active)": Object {
|
"@media screen and (-ms-high-contrast: active)": Object {
|
||||||
"color": "GrayText",
|
"color": "GrayText",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -1166,7 +1168,7 @@ exports[`test render renders with filters 1`] = `
|
|||||||
"position": "absolute",
|
"position": "absolute",
|
||||||
"right": 2,
|
"right": 2,
|
||||||
"selectors": Object {
|
"selectors": Object {
|
||||||
"@media screen and (-ms-high-contrast: active), (forced-colors: active)": Object {
|
"@media screen and (-ms-high-contrast: active)": Object {
|
||||||
"bottom": -2,
|
"bottom": -2,
|
||||||
"left": -2,
|
"left": -2,
|
||||||
"outlineColor": "ButtonText",
|
"outlineColor": "ButtonText",
|
||||||
@@ -1245,7 +1247,7 @@ exports[`test render renders with filters 1`] = `
|
|||||||
"position": "absolute",
|
"position": "absolute",
|
||||||
"right": 2,
|
"right": 2,
|
||||||
"selectors": Object {
|
"selectors": Object {
|
||||||
"@media screen and (-ms-high-contrast: active), (forced-colors: active)": Object {
|
"@media screen and (-ms-high-contrast: active)": Object {
|
||||||
"bottom": -2,
|
"bottom": -2,
|
||||||
"left": -2,
|
"left": -2,
|
||||||
"outlineColor": "ButtonText",
|
"outlineColor": "ButtonText",
|
||||||
@@ -1277,10 +1279,8 @@ exports[`test render renders with filters 1`] = `
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
Object {
|
Object {
|
||||||
"backgroundColor": "#f3f2f1",
|
|
||||||
"color": "#a19f9d",
|
|
||||||
"selectors": Object {
|
"selectors": Object {
|
||||||
"@media screen and (-ms-high-contrast: active), (forced-colors: active)": Object {
|
"@media screen and (-ms-high-contrast: active)": Object {
|
||||||
"backgroundColor": "Window",
|
"backgroundColor": "Window",
|
||||||
"borderColor": "GrayText",
|
"borderColor": "GrayText",
|
||||||
"color": "GrayText",
|
"color": "GrayText",
|
||||||
@@ -1300,7 +1300,7 @@ exports[`test render renders with filters 1`] = `
|
|||||||
"backgroundColor": "#f3f2f1",
|
"backgroundColor": "#f3f2f1",
|
||||||
"color": "#201f1e",
|
"color": "#201f1e",
|
||||||
"selectors": Object {
|
"selectors": Object {
|
||||||
"@media screen and (-ms-high-contrast: active), (forced-colors: active)": Object {
|
"@media screen and (-ms-high-contrast: active)": Object {
|
||||||
"borderColor": "Highlight",
|
"borderColor": "Highlight",
|
||||||
"color": "Highlight",
|
"color": "Highlight",
|
||||||
},
|
},
|
||||||
@@ -1326,7 +1326,7 @@ exports[`test render renders with filters 1`] = `
|
|||||||
"splitButtonContainer": Array [
|
"splitButtonContainer": Array [
|
||||||
Object {
|
Object {
|
||||||
"selectors": Object {
|
"selectors": Object {
|
||||||
"@media screen and (-ms-high-contrast: active), (forced-colors: active)": Object {
|
"@media screen and (-ms-high-contrast: active)": Object {
|
||||||
"border": "none",
|
"border": "none",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -1344,7 +1344,7 @@ exports[`test render renders with filters 1`] = `
|
|||||||
"position": "absolute",
|
"position": "absolute",
|
||||||
"right": 3,
|
"right": 3,
|
||||||
"selectors": Object {
|
"selectors": Object {
|
||||||
"@media screen and (-ms-high-contrast: active), (forced-colors: active)": Object {
|
"@media screen and (-ms-high-contrast: active)": Object {
|
||||||
"border": "none",
|
"border": "none",
|
||||||
"bottom": -2,
|
"bottom": -2,
|
||||||
"left": -2,
|
"left": -2,
|
||||||
@@ -1373,20 +1373,19 @@ exports[`test render renders with filters 1`] = `
|
|||||||
"borderBottomRightRadius": "0",
|
"borderBottomRightRadius": "0",
|
||||||
"borderTopRightRadius": "0",
|
"borderTopRightRadius": "0",
|
||||||
"selectors": Object {
|
"selectors": Object {
|
||||||
"@media screen and (-ms-high-contrast: active), (forced-colors: active)": Object {
|
"@media screen and (-ms-high-contrast: active)": Object {
|
||||||
"MsHighContrastAdjust": "none",
|
"MsHighContrastAdjust": "none",
|
||||||
"backgroundColor": "Window",
|
"backgroundColor": "Window",
|
||||||
"border": "1px solid WindowText",
|
"border": "1px solid WindowText",
|
||||||
"borderRightWidth": "0",
|
"borderRightWidth": "0",
|
||||||
"color": "WindowText",
|
"color": "WindowText",
|
||||||
"forcedColorAdjust": "none",
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
".ms-Button--primary + .ms-Button": Object {
|
".ms-Button--primary + .ms-Button": Object {
|
||||||
"border": "none",
|
"border": "none",
|
||||||
"selectors": Object {
|
"selectors": Object {
|
||||||
"@media screen and (-ms-high-contrast: active), (forced-colors: active)": Object {
|
"@media screen and (-ms-high-contrast: active)": Object {
|
||||||
"border": "1px solid WindowText",
|
"border": "1px solid WindowText",
|
||||||
"borderLeftWidth": "0",
|
"borderLeftWidth": "0",
|
||||||
},
|
},
|
||||||
@@ -1399,11 +1398,10 @@ exports[`test render renders with filters 1`] = `
|
|||||||
"selectors": Object {
|
"selectors": Object {
|
||||||
".ms-Button--primary": Object {
|
".ms-Button--primary": Object {
|
||||||
"selectors": Object {
|
"selectors": Object {
|
||||||
"@media screen and (-ms-high-contrast: active), (forced-colors: active)": Object {
|
"@media screen and (-ms-high-contrast: active)": Object {
|
||||||
"MsHighContrastAdjust": "none",
|
"MsHighContrastAdjust": "none",
|
||||||
"backgroundColor": "WindowText",
|
"backgroundColor": "WindowText",
|
||||||
"color": "Window",
|
"color": "Window",
|
||||||
"forcedColorAdjust": "none",
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -1413,11 +1411,10 @@ exports[`test render renders with filters 1`] = `
|
|||||||
"selectors": Object {
|
"selectors": Object {
|
||||||
".ms-Button--primary": Object {
|
".ms-Button--primary": Object {
|
||||||
"selectors": Object {
|
"selectors": Object {
|
||||||
"@media screen and (-ms-high-contrast: active), (forced-colors: active)": Object {
|
"@media screen and (-ms-high-contrast: active)": Object {
|
||||||
"MsHighContrastAdjust": "none",
|
"MsHighContrastAdjust": "none",
|
||||||
"backgroundColor": "WindowText",
|
"backgroundColor": "WindowText",
|
||||||
"color": "Window",
|
"color": "Window",
|
||||||
"forcedColorAdjust": "none",
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -1427,11 +1424,12 @@ exports[`test render renders with filters 1`] = `
|
|||||||
"border": "none",
|
"border": "none",
|
||||||
"outline": "none",
|
"outline": "none",
|
||||||
"selectors": Object {
|
"selectors": Object {
|
||||||
"@media screen and (-ms-high-contrast: active), (forced-colors: active)": Object {
|
"@media screen and (-ms-high-contrast: active)": Object {
|
||||||
"MsHighContrastAdjust": "none",
|
|
||||||
"backgroundColor": "Window",
|
"backgroundColor": "Window",
|
||||||
"borderColor": "GrayText",
|
"borderColor": "GrayText",
|
||||||
"color": "GrayText",
|
"color": "GrayText",
|
||||||
|
},
|
||||||
|
"@media screen and (forced-colors: active)": Object {
|
||||||
"forcedColorAdjust": "none",
|
"forcedColorAdjust": "none",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -1443,7 +1441,7 @@ exports[`test render renders with filters 1`] = `
|
|||||||
"selectors": Object {
|
"selectors": Object {
|
||||||
".ms-Button--primary": Object {
|
".ms-Button--primary": Object {
|
||||||
"selectors": Object {
|
"selectors": Object {
|
||||||
"@media screen and (-ms-high-contrast: active), (forced-colors: active)": Object {
|
"@media screen and (-ms-high-contrast: active)": Object {
|
||||||
"backgroundColor": "Highlight",
|
"backgroundColor": "Highlight",
|
||||||
"color": "Window",
|
"color": "Window",
|
||||||
},
|
},
|
||||||
@@ -1452,7 +1450,7 @@ exports[`test render renders with filters 1`] = `
|
|||||||
".ms-Button.is-disabled": Object {
|
".ms-Button.is-disabled": Object {
|
||||||
"color": "#a19f9d",
|
"color": "#a19f9d",
|
||||||
"selectors": Object {
|
"selectors": Object {
|
||||||
"@media screen and (-ms-high-contrast: active), (forced-colors: active)": Object {
|
"@media screen and (-ms-high-contrast: active)": Object {
|
||||||
"backgroundColor": "Window",
|
"backgroundColor": "Window",
|
||||||
"borderColor": "GrayText",
|
"borderColor": "GrayText",
|
||||||
"color": "GrayText",
|
"color": "GrayText",
|
||||||
@@ -1468,7 +1466,7 @@ exports[`test render renders with filters 1`] = `
|
|||||||
"position": "absolute",
|
"position": "absolute",
|
||||||
"right": 31,
|
"right": 31,
|
||||||
"selectors": Object {
|
"selectors": Object {
|
||||||
"@media screen and (-ms-high-contrast: active), (forced-colors: active)": Object {
|
"@media screen and (-ms-high-contrast: active)": Object {
|
||||||
"backgroundColor": "WindowText",
|
"backgroundColor": "WindowText",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -1480,7 +1478,7 @@ exports[`test render renders with filters 1`] = `
|
|||||||
"position": "absolute",
|
"position": "absolute",
|
||||||
"right": 31,
|
"right": 31,
|
||||||
"selectors": Object {
|
"selectors": Object {
|
||||||
"@media screen and (-ms-high-contrast: active), (forced-colors: active)": Object {
|
"@media screen and (-ms-high-contrast: active)": Object {
|
||||||
"backgroundColor": "WindowText",
|
"backgroundColor": "WindowText",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -1497,7 +1495,7 @@ exports[`test render renders with filters 1`] = `
|
|||||||
"position": "absolute",
|
"position": "absolute",
|
||||||
"right": 31,
|
"right": 31,
|
||||||
"selectors": Object {
|
"selectors": Object {
|
||||||
"@media screen and (-ms-high-contrast: active), (forced-colors: active)": Object {
|
"@media screen and (-ms-high-contrast: active)": Object {
|
||||||
"backgroundColor": "GrayText",
|
"backgroundColor": "GrayText",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -1520,7 +1518,7 @@ exports[`test render renders with filters 1`] = `
|
|||||||
":hover": Object {
|
":hover": Object {
|
||||||
"backgroundColor": "#edebe9",
|
"backgroundColor": "#edebe9",
|
||||||
"selectors": Object {
|
"selectors": Object {
|
||||||
"@media screen and (-ms-high-contrast: active), (forced-colors: active)": Object {
|
"@media screen and (-ms-high-contrast: active)": Object {
|
||||||
"color": "Highlight",
|
"color": "Highlight",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -1528,11 +1526,6 @@ exports[`test render renders with filters 1`] = `
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
Object {
|
Object {
|
||||||
"@media screen and (-ms-high-contrast: active), (forced-colors: active)": Object {
|
|
||||||
".ms-Button-menuIcon": Object {
|
|
||||||
"color": "WindowText",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"border": "1px solid #8a8886",
|
"border": "1px solid #8a8886",
|
||||||
"borderBottomRightRadius": "2px",
|
"borderBottomRightRadius": "2px",
|
||||||
"borderLeft": "none",
|
"borderLeft": "none",
|
||||||
@@ -1578,7 +1571,7 @@ exports[`test render renders with filters 1`] = `
|
|||||||
"selectors": Object {
|
"selectors": Object {
|
||||||
".ms-Button--primary": Object {
|
".ms-Button--primary": Object {
|
||||||
"selectors": Object {
|
"selectors": Object {
|
||||||
"@media screen and (-ms-high-contrast: active), (forced-colors: active)": Object {
|
"@media screen and (-ms-high-contrast: active)": Object {
|
||||||
"backgroundColor": "Window",
|
"backgroundColor": "Window",
|
||||||
"borderColor": "GrayText",
|
"borderColor": "GrayText",
|
||||||
"color": "GrayText",
|
"color": "GrayText",
|
||||||
@@ -1587,7 +1580,7 @@ exports[`test render renders with filters 1`] = `
|
|||||||
},
|
},
|
||||||
".ms-Button-menuIcon": Object {
|
".ms-Button-menuIcon": Object {
|
||||||
"selectors": Object {
|
"selectors": Object {
|
||||||
"@media screen and (-ms-high-contrast: active), (forced-colors: active)": Object {
|
"@media screen and (-ms-high-contrast: active)": Object {
|
||||||
"color": "GrayText",
|
"color": "GrayText",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -1595,7 +1588,7 @@ exports[`test render renders with filters 1`] = `
|
|||||||
":hover": Object {
|
":hover": Object {
|
||||||
"cursor": "default",
|
"cursor": "default",
|
||||||
},
|
},
|
||||||
"@media screen and (-ms-high-contrast: active), (forced-colors: active)": Object {
|
"@media screen and (-ms-high-contrast: active)": Object {
|
||||||
"backgroundColor": "Window",
|
"backgroundColor": "Window",
|
||||||
"border": "1px solid GrayText",
|
"border": "1px solid GrayText",
|
||||||
"color": "GrayText",
|
"color": "GrayText",
|
||||||
@@ -1900,7 +1893,7 @@ exports[`test render renders with filters 1`] = `
|
|||||||
>
|
>
|
||||||
<button
|
<button
|
||||||
aria-disabled={true}
|
aria-disabled={true}
|
||||||
className="ms-Button ms-Button--default is-disabled directoryListButton root-57"
|
className="ms-Button ms-Button--default is-disabled directoryListButton root-54"
|
||||||
data-is-focusable={false}
|
data-is-focusable={false}
|
||||||
disabled={true}
|
disabled={true}
|
||||||
onClick={[Function]}
|
onClick={[Function]}
|
||||||
@@ -1912,7 +1905,7 @@ exports[`test render renders with filters 1`] = `
|
|||||||
type="button"
|
type="button"
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
className="ms-Button-flexContainer flexContainer-58"
|
className="ms-Button-flexContainer flexContainer-55"
|
||||||
data-automationid="splitbuttonprimary"
|
data-automationid="splitbuttonprimary"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
@@ -1943,6 +1936,7 @@ exports[`test render renders with filters 1`] = `
|
|||||||
</List>
|
</List>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
|
aria-hidden="true"
|
||||||
className="stickyBelow-43"
|
className="stickyBelow-43"
|
||||||
style={
|
style={
|
||||||
Object {
|
Object {
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import { ChildrenMargin } from "./GitHubStyleConstants";
|
|||||||
import * as GitHubUtils from "../../../Utils/GitHubUtils";
|
import * as GitHubUtils from "../../../Utils/GitHubUtils";
|
||||||
import { IGitHubRepo } from "../../../GitHub/GitHubClient";
|
import { IGitHubRepo } from "../../../GitHub/GitHubClient";
|
||||||
import * as TelemetryProcessor from "../../../Shared/Telemetry/TelemetryProcessor";
|
import * as TelemetryProcessor from "../../../Shared/Telemetry/TelemetryProcessor";
|
||||||
import * as UrlUtility from "../../../Common/UrlUtility";
|
import UrlUtility from "../../../Common/UrlUtility";
|
||||||
import Explorer from "../../Explorer";
|
import Explorer from "../../Explorer";
|
||||||
|
|
||||||
export interface AddRepoComponentProps {
|
export interface AddRepoComponentProps {
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import {
|
|||||||
} from "office-ui-fabric-react";
|
} from "office-ui-fabric-react";
|
||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
import { IGalleryItem } from "../../../../Juno/JunoClient";
|
import { IGalleryItem } from "../../../../Juno/JunoClient";
|
||||||
import * as FileSystemUtil from "../../../Notebook/FileSystemUtil";
|
import { FileSystemUtil } from "../../../Notebook/FileSystemUtil";
|
||||||
import CosmosDBLogo from "../../../../../images/CosmosDB-logo.svg";
|
import CosmosDBLogo from "../../../../../images/CosmosDB-logo.svg";
|
||||||
|
|
||||||
export interface GalleryCardComponentProps {
|
export interface GalleryCardComponentProps {
|
||||||
@@ -47,7 +47,6 @@ export class GalleryCardComponent extends React.Component<GalleryCardComponentPr
|
|||||||
private static readonly cardItemGapBig = 10;
|
private static readonly cardItemGapBig = 10;
|
||||||
private static readonly cardItemGapSmall = 8;
|
private static readonly cardItemGapSmall = 8;
|
||||||
private static readonly cardDeleteSpinnerHeight = 360;
|
private static readonly cardDeleteSpinnerHeight = 360;
|
||||||
private static readonly smallTextLineHeight = 18;
|
|
||||||
|
|
||||||
constructor(props: GalleryCardComponentProps) {
|
constructor(props: GalleryCardComponentProps) {
|
||||||
super(props);
|
super(props);
|
||||||
@@ -104,7 +103,7 @@ export class GalleryCardComponent extends React.Component<GalleryCardComponentPr
|
|||||||
</Card.Item>
|
</Card.Item>
|
||||||
|
|
||||||
<Card.Section styles={{ root: { padding: GalleryCardComponent.cardItemGapBig } }}>
|
<Card.Section styles={{ root: { padding: GalleryCardComponent.cardItemGapBig } }}>
|
||||||
<Text variant="small" nowrap styles={{ root: { height: GalleryCardComponent.smallTextLineHeight } }}>
|
<Text variant="small" nowrap>
|
||||||
{this.props.data.tags ? (
|
{this.props.data.tags ? (
|
||||||
this.props.data.tags.map((tag, index, array) => (
|
this.props.data.tags.map((tag, index, array) => (
|
||||||
<span key={tag}>
|
<span key={tag}>
|
||||||
@@ -130,7 +129,7 @@ export class GalleryCardComponent extends React.Component<GalleryCardComponentPr
|
|||||||
{cardTitle}
|
{cardTitle}
|
||||||
</Text>
|
</Text>
|
||||||
|
|
||||||
<Text variant="small" styles={{ root: { height: GalleryCardComponent.smallTextLineHeight * 2 } }}>
|
<Text variant="small" styles={{ root: { height: 36 } }}>
|
||||||
{this.renderTruncatedDescription()}
|
{this.renderTruncatedDescription()}
|
||||||
</Text>
|
</Text>
|
||||||
|
|
||||||
|
|||||||
@@ -50,13 +50,6 @@ exports[`GalleryCardComponent renders 1`] = `
|
|||||||
>
|
>
|
||||||
<Text
|
<Text
|
||||||
nowrap={true}
|
nowrap={true}
|
||||||
styles={
|
|
||||||
Object {
|
|
||||||
"root": Object {
|
|
||||||
"height": 18,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
variant="small"
|
variant="small"
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
@@ -107,7 +100,7 @@ exports[`GalleryCardComponent renders 1`] = `
|
|||||||
}
|
}
|
||||||
variant="tiny"
|
variant="tiny"
|
||||||
>
|
>
|
||||||
<Icon
|
<StyledIconBase
|
||||||
iconName="RedEye"
|
iconName="RedEye"
|
||||||
styles={
|
styles={
|
||||||
Object {
|
Object {
|
||||||
@@ -131,7 +124,7 @@ exports[`GalleryCardComponent renders 1`] = `
|
|||||||
}
|
}
|
||||||
variant="tiny"
|
variant="tiny"
|
||||||
>
|
>
|
||||||
<Icon
|
<StyledIconBase
|
||||||
iconName="Download"
|
iconName="Download"
|
||||||
styles={
|
styles={
|
||||||
Object {
|
Object {
|
||||||
@@ -155,7 +148,7 @@ exports[`GalleryCardComponent renders 1`] = `
|
|||||||
}
|
}
|
||||||
variant="tiny"
|
variant="tiny"
|
||||||
>
|
>
|
||||||
<Icon
|
<StyledIconBase
|
||||||
iconName="Heart"
|
iconName="Heart"
|
||||||
styles={
|
styles={
|
||||||
Object {
|
Object {
|
||||||
@@ -180,7 +173,7 @@ exports[`GalleryCardComponent renders 1`] = `
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<Separator
|
<Styled
|
||||||
styles={
|
styles={
|
||||||
Object {
|
Object {
|
||||||
"root": Object {
|
"root": Object {
|
||||||
|
|||||||
@@ -21,18 +21,18 @@ import {
|
|||||||
Text,
|
Text,
|
||||||
} from "office-ui-fabric-react";
|
} from "office-ui-fabric-react";
|
||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
import { HttpStatusCodes } from "../../../Common/Constants";
|
|
||||||
import { handleError } from "../../../Common/ErrorHandlingUtils";
|
|
||||||
import { IGalleryItem, IJunoResponse, IPublicGalleryData, JunoClient } from "../../../Juno/JunoClient";
|
import { IGalleryItem, IJunoResponse, IPublicGalleryData, JunoClient } from "../../../Juno/JunoClient";
|
||||||
import { Action, ActionModifiers } from "../../../Shared/Telemetry/TelemetryConstants";
|
|
||||||
import { trace } from "../../../Shared/Telemetry/TelemetryProcessor";
|
|
||||||
import * as GalleryUtils from "../../../Utils/GalleryUtils";
|
import * as GalleryUtils from "../../../Utils/GalleryUtils";
|
||||||
import Explorer from "../../Explorer";
|
|
||||||
import { Dialog, DialogProps } from "../Dialog";
|
import { Dialog, DialogProps } from "../Dialog";
|
||||||
import { GalleryCardComponent, GalleryCardComponentProps } from "./Cards/GalleryCardComponent";
|
import { GalleryCardComponent, GalleryCardComponentProps } from "./Cards/GalleryCardComponent";
|
||||||
import { CodeOfConductComponent } from "./CodeOfConductComponent";
|
|
||||||
import "./GalleryViewerComponent.less";
|
import "./GalleryViewerComponent.less";
|
||||||
|
import { HttpStatusCodes } from "../../../Common/Constants";
|
||||||
|
import Explorer from "../../Explorer";
|
||||||
|
import { CodeOfConductComponent } from "./CodeOfConductComponent";
|
||||||
import { InfoComponent } from "./InfoComponent/InfoComponent";
|
import { InfoComponent } from "./InfoComponent/InfoComponent";
|
||||||
|
import { handleError } from "../../../Common/ErrorHandlingUtils";
|
||||||
|
import { trace } from "../../../Shared/Telemetry/TelemetryProcessor";
|
||||||
|
import { Action, ActionModifiers } from "../../../Shared/Telemetry/TelemetryConstants";
|
||||||
|
|
||||||
export interface GalleryViewerComponentProps {
|
export interface GalleryViewerComponentProps {
|
||||||
container?: Explorer;
|
container?: Explorer;
|
||||||
@@ -138,11 +138,11 @@ export class GalleryViewerComponent extends React.Component<GalleryViewerCompone
|
|||||||
key: SortBy.MostRecent,
|
key: SortBy.MostRecent,
|
||||||
text: GalleryViewerComponent.mostRecentText,
|
text: GalleryViewerComponent.mostRecentText,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
key: SortBy.MostFavorited,
|
|
||||||
text: GalleryViewerComponent.mostFavoritedText,
|
|
||||||
},
|
|
||||||
];
|
];
|
||||||
|
this.sortingOptions.push({
|
||||||
|
key: SortBy.MostFavorited,
|
||||||
|
text: GalleryViewerComponent.mostFavoritedText,
|
||||||
|
});
|
||||||
|
|
||||||
this.loadTabContent(this.state.selectedTab, this.state.searchText, this.state.sortBy, false);
|
this.loadTabContent(this.state.selectedTab, this.state.searchText, this.state.sortBy, false);
|
||||||
this.loadFavoriteNotebooks(this.state.searchText, this.state.sortBy, false); // Need this to show correct favorite button state
|
this.loadFavoriteNotebooks(this.state.searchText, this.state.sortBy, false); // Need this to show correct favorite button state
|
||||||
@@ -654,8 +654,7 @@ export class GalleryViewerComponent extends React.Component<GalleryViewerCompone
|
|||||||
};
|
};
|
||||||
|
|
||||||
private onRenderCell = (data?: IGalleryItem): JSX.Element => {
|
private onRenderCell = (data?: IGalleryItem): JSX.Element => {
|
||||||
const isFavorite =
|
const isFavorite = this.favoriteNotebooks?.find((item) => item.id === data.id) !== undefined;
|
||||||
this.props.container && this.favoriteNotebooks?.find((item) => item.id === data.id) !== undefined;
|
|
||||||
const props: GalleryCardComponentProps = {
|
const props: GalleryCardComponentProps = {
|
||||||
data,
|
data,
|
||||||
isFavorite,
|
isFavorite,
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ exports[`InfoComponent renders 1`] = `
|
|||||||
<div
|
<div
|
||||||
className="infoPanelMain"
|
className="infoPanelMain"
|
||||||
>
|
>
|
||||||
<Icon
|
<StyledIconBase
|
||||||
className="infoIconMain"
|
className="infoIconMain"
|
||||||
iconName="Help"
|
iconName="Help"
|
||||||
styles={
|
styles={
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import {
|
|||||||
} from "office-ui-fabric-react";
|
} from "office-ui-fabric-react";
|
||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
import { IGalleryItem } from "../../../Juno/JunoClient";
|
import { IGalleryItem } from "../../../Juno/JunoClient";
|
||||||
import * as FileSystemUtil from "../../Notebook/FileSystemUtil";
|
import { FileSystemUtil } from "../../Notebook/FileSystemUtil";
|
||||||
import "./NotebookViewerComponent.less";
|
import "./NotebookViewerComponent.less";
|
||||||
import CosmosDBLogo from "../../../../images/CosmosDB-logo.svg";
|
import CosmosDBLogo from "../../../../images/CosmosDB-logo.svg";
|
||||||
import { InfoComponent } from "../NotebookGallery/InfoComponent/InfoComponent";
|
import { InfoComponent } from "../NotebookGallery/InfoComponent/InfoComponent";
|
||||||
|
|||||||
@@ -68,14 +68,14 @@ exports[`NotebookMetadataComponent renders liked notebook 1`] = `
|
|||||||
Invalid Date
|
Invalid Date
|
||||||
</Text>
|
</Text>
|
||||||
<Text>
|
<Text>
|
||||||
<Icon
|
<StyledIconBase
|
||||||
iconName="RedEye"
|
iconName="RedEye"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
0
|
0
|
||||||
</Text>
|
</Text>
|
||||||
<Text>
|
<Text>
|
||||||
<Icon
|
<StyledIconBase
|
||||||
iconName="Download"
|
iconName="Download"
|
||||||
/>
|
/>
|
||||||
0
|
0
|
||||||
@@ -180,14 +180,14 @@ exports[`NotebookMetadataComponent renders un-liked notebook 1`] = `
|
|||||||
Invalid Date
|
Invalid Date
|
||||||
</Text>
|
</Text>
|
||||||
<Text>
|
<Text>
|
||||||
<Icon
|
<StyledIconBase
|
||||||
iconName="RedEye"
|
iconName="RedEye"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
0
|
0
|
||||||
</Text>
|
</Text>
|
||||||
<Text>
|
<Text>
|
||||||
<Icon
|
<StyledIconBase
|
||||||
iconName="Download"
|
iconName="Download"
|
||||||
/>
|
/>
|
||||||
0
|
0
|
||||||
|
|||||||
@@ -1,15 +1,20 @@
|
|||||||
import { IButtonProps, IconButton } from "office-ui-fabric-react/lib/Button";
|
import * as _ from "underscore";
|
||||||
import { ContextualMenu, IContextualMenuProps } from "office-ui-fabric-react/lib/ContextualMenu";
|
import * as React from "react";
|
||||||
|
import * as Constants from "../../../Common/Constants";
|
||||||
|
import * as DataModels from "../../../Contracts/DataModels";
|
||||||
|
import * as ViewModels from "../../../Contracts/ViewModels";
|
||||||
|
import { Action } from "../../../Shared/Telemetry/TelemetryConstants";
|
||||||
import {
|
import {
|
||||||
DetailsList,
|
DetailsList,
|
||||||
DetailsListLayoutMode,
|
DetailsListLayoutMode,
|
||||||
DetailsRow,
|
|
||||||
IColumn,
|
|
||||||
IDetailsListProps,
|
IDetailsListProps,
|
||||||
IDetailsRowProps,
|
IDetailsRowProps,
|
||||||
|
DetailsRow,
|
||||||
} from "office-ui-fabric-react/lib/DetailsList";
|
} from "office-ui-fabric-react/lib/DetailsList";
|
||||||
import { FocusZone } from "office-ui-fabric-react/lib/FocusZone";
|
import { FocusZone } from "office-ui-fabric-react/lib/FocusZone";
|
||||||
import { ITextField, ITextFieldProps, TextField } from "office-ui-fabric-react/lib/TextField";
|
import { IconButton, IButtonProps } from "office-ui-fabric-react/lib/Button";
|
||||||
|
import { IColumn } from "office-ui-fabric-react/lib/DetailsList";
|
||||||
|
import { IContextualMenuProps, ContextualMenu } from "office-ui-fabric-react/lib/ContextualMenu";
|
||||||
import {
|
import {
|
||||||
IObjectWithKey,
|
IObjectWithKey,
|
||||||
ISelectionZoneProps,
|
ISelectionZoneProps,
|
||||||
@@ -17,18 +22,13 @@ import {
|
|||||||
SelectionMode,
|
SelectionMode,
|
||||||
SelectionZone,
|
SelectionZone,
|
||||||
} from "office-ui-fabric-react/lib/utilities/selection/index";
|
} from "office-ui-fabric-react/lib/utilities/selection/index";
|
||||||
import * as React from "react";
|
|
||||||
import * as _ from "underscore";
|
|
||||||
import SaveQueryBannerIcon from "../../../../images/save_query_banner.png";
|
|
||||||
import * as Constants from "../../../Common/Constants";
|
|
||||||
import { StyleConstants } from "../../../Common/Constants";
|
import { StyleConstants } from "../../../Common/Constants";
|
||||||
import { getErrorMessage, getErrorStack } from "../../../Common/ErrorHandlingUtils";
|
import { TextField, ITextFieldProps, ITextField } from "office-ui-fabric-react/lib/TextField";
|
||||||
import { QueriesClient } from "../../../Common/QueriesClient";
|
|
||||||
import * as DataModels from "../../../Contracts/DataModels";
|
|
||||||
import { Action } from "../../../Shared/Telemetry/TelemetryConstants";
|
|
||||||
import * as TelemetryProcessor from "../../../Shared/Telemetry/TelemetryProcessor";
|
import * as TelemetryProcessor from "../../../Shared/Telemetry/TelemetryProcessor";
|
||||||
|
|
||||||
const title: string = "Open Saved Queries";
|
import SaveQueryBannerIcon from "../../../../images/save_query_banner.png";
|
||||||
|
import { QueriesClient } from "../../../Common/QueriesClient";
|
||||||
|
import { getErrorMessage, getErrorStack } from "../../../Common/ErrorHandlingUtils";
|
||||||
|
|
||||||
export interface QueriesGridComponentProps {
|
export interface QueriesGridComponentProps {
|
||||||
queriesClient: QueriesClient;
|
queriesClient: QueriesClient;
|
||||||
@@ -76,11 +76,6 @@ export class QueriesGridComponent extends React.Component<QueriesGridComponentPr
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// fetched saved queries when panel open
|
|
||||||
public componentDidMount() {
|
|
||||||
this.fetchSavedQueries();
|
|
||||||
}
|
|
||||||
|
|
||||||
public render(): JSX.Element {
|
public render(): JSX.Element {
|
||||||
if (this.state.queries.length === 0) {
|
if (this.state.queries.length === 0) {
|
||||||
return this.renderBannerComponent();
|
return this.renderBannerComponent();
|
||||||
@@ -141,7 +136,7 @@ export class QueriesGridComponent extends React.Component<QueriesGridComponentPr
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
return (
|
return (
|
||||||
<div id="emptyQueryBanner">
|
<div>
|
||||||
<div>
|
<div>
|
||||||
You have not saved any queries yet. <br /> <br />
|
You have not saved any queries yet. <br /> <br />
|
||||||
To write a new query, open a new query tab and enter the desired query. Once ready to save, click on Save
|
To write a new query, open a new query tab and enter the desired query. Once ready to save, click on Save
|
||||||
@@ -227,7 +222,7 @@ export class QueriesGridComponent extends React.Component<QueriesGridComponentPr
|
|||||||
const container = window.dataExplorer;
|
const container = window.dataExplorer;
|
||||||
const startKey: number = TelemetryProcessor.traceStart(Action.DeleteSavedQuery, {
|
const startKey: number = TelemetryProcessor.traceStart(Action.DeleteSavedQuery, {
|
||||||
dataExplorerArea: Constants.Areas.ContextualPane,
|
dataExplorerArea: Constants.Areas.ContextualPane,
|
||||||
paneTitle: title,
|
paneTitle: container && container.browseQueriesPane.title(),
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
await this.props.queriesClient.deleteQuery(query);
|
await this.props.queriesClient.deleteQuery(query);
|
||||||
@@ -235,7 +230,7 @@ export class QueriesGridComponent extends React.Component<QueriesGridComponentPr
|
|||||||
Action.DeleteSavedQuery,
|
Action.DeleteSavedQuery,
|
||||||
{
|
{
|
||||||
dataExplorerArea: Constants.Areas.ContextualPane,
|
dataExplorerArea: Constants.Areas.ContextualPane,
|
||||||
paneTitle: title,
|
paneTitle: container && container.browseQueriesPane.title(),
|
||||||
},
|
},
|
||||||
startKey
|
startKey
|
||||||
);
|
);
|
||||||
@@ -244,7 +239,7 @@ export class QueriesGridComponent extends React.Component<QueriesGridComponentPr
|
|||||||
Action.DeleteSavedQuery,
|
Action.DeleteSavedQuery,
|
||||||
{
|
{
|
||||||
dataExplorerArea: Constants.Areas.ContextualPane,
|
dataExplorerArea: Constants.Areas.ContextualPane,
|
||||||
paneTitle: title,
|
paneTitle: container && container.browseQueriesPane.title(),
|
||||||
error: getErrorMessage(error),
|
error: getErrorMessage(error),
|
||||||
errorStack: getErrorStack(error),
|
errorStack: getErrorStack(error),
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -0,0 +1,33 @@
|
|||||||
|
/**
|
||||||
|
* This adapter is responsible to render the QueriesGrid React component
|
||||||
|
* If the component signals a change through the callback passed in the properties, it must render the React component when appropriate
|
||||||
|
* and update any knockout observables passed from the parent.
|
||||||
|
*/
|
||||||
|
import * as ko from "knockout";
|
||||||
|
import * as React from "react";
|
||||||
|
import * as ViewModels from "../../../Contracts/ViewModels";
|
||||||
|
import { QueriesGridComponent, QueriesGridComponentProps } from "./QueriesGridComponent";
|
||||||
|
import { ReactAdapter } from "../../../Bindings/ReactBindingHandler";
|
||||||
|
import Explorer from "../../Explorer";
|
||||||
|
|
||||||
|
export class QueriesGridComponentAdapter implements ReactAdapter {
|
||||||
|
public parameters: ko.Observable<number>;
|
||||||
|
|
||||||
|
constructor(private container: Explorer) {
|
||||||
|
this.parameters = ko.observable<number>(Date.now());
|
||||||
|
}
|
||||||
|
|
||||||
|
public renderComponent(): JSX.Element {
|
||||||
|
const props: QueriesGridComponentProps = {
|
||||||
|
queriesClient: this.container.queriesClient,
|
||||||
|
onQuerySelect: this.container.browseQueriesPane.loadSavedQuery,
|
||||||
|
containerVisible: this.container.browseQueriesPane.visible(),
|
||||||
|
saveQueryEnabled: this.container.canSaveQueries(),
|
||||||
|
};
|
||||||
|
return <QueriesGridComponent {...props} />;
|
||||||
|
}
|
||||||
|
|
||||||
|
public forceRender(): void {
|
||||||
|
window.requestAnimationFrame(() => this.parameters(Date.now()));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,19 +1,17 @@
|
|||||||
import { shallow } from "enzyme";
|
import { shallow } from "enzyme";
|
||||||
import ko from "knockout";
|
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { updateCollection } from "../../../Common/dataAccess/updateCollection";
|
import { SettingsComponentProps, SettingsComponent, SettingsComponentState } from "./SettingsComponent";
|
||||||
import { updateOffer } from "../../../Common/dataAccess/updateOffer";
|
|
||||||
import * as DataModels from "../../../Contracts/DataModels";
|
|
||||||
import * as ViewModels from "../../../Contracts/ViewModels";
|
import * as ViewModels from "../../../Contracts/ViewModels";
|
||||||
import { updateUserContext } from "../../../UserContext";
|
|
||||||
import Explorer from "../../Explorer";
|
|
||||||
import { CollectionSettingsTabV2 } from "../../Tabs/SettingsTabV2";
|
import { CollectionSettingsTabV2 } from "../../Tabs/SettingsTabV2";
|
||||||
import { SettingsComponent, SettingsComponentProps, SettingsComponentState } from "./SettingsComponent";
|
|
||||||
import { isDirty, TtlType } from "./SettingsUtils";
|
|
||||||
import { collection } from "./TestUtils";
|
import { collection } from "./TestUtils";
|
||||||
|
import * as DataModels from "../../../Contracts/DataModels";
|
||||||
|
import ko from "knockout";
|
||||||
|
import { TtlType, isDirty } from "./SettingsUtils";
|
||||||
|
import Explorer from "../../Explorer";
|
||||||
jest.mock("../../../Common/dataAccess/getIndexTransformationProgress", () => ({
|
jest.mock("../../../Common/dataAccess/getIndexTransformationProgress", () => ({
|
||||||
getIndexTransformationProgress: jest.fn().mockReturnValue(undefined),
|
getIndexTransformationProgress: jest.fn().mockReturnValue(undefined),
|
||||||
}));
|
}));
|
||||||
|
import { updateCollection, updateMongoDBCollectionThroughRP } from "../../../Common/dataAccess/updateCollection";
|
||||||
jest.mock("../../../Common/dataAccess/updateCollection", () => ({
|
jest.mock("../../../Common/dataAccess/updateCollection", () => ({
|
||||||
updateCollection: jest.fn().mockReturnValue({
|
updateCollection: jest.fn().mockReturnValue({
|
||||||
id: undefined,
|
id: undefined,
|
||||||
@@ -23,9 +21,16 @@ jest.mock("../../../Common/dataAccess/updateCollection", () => ({
|
|||||||
changeFeedPolicy: undefined,
|
changeFeedPolicy: undefined,
|
||||||
analyticalStorageTtl: undefined,
|
analyticalStorageTtl: undefined,
|
||||||
geospatialConfig: undefined,
|
geospatialConfig: undefined,
|
||||||
|
} as DataModels.Collection),
|
||||||
|
updateMongoDBCollectionThroughRP: jest.fn().mockReturnValue({
|
||||||
|
id: undefined,
|
||||||
|
shardKey: undefined,
|
||||||
indexes: [],
|
indexes: [],
|
||||||
}),
|
analyticalStorageTtl: undefined,
|
||||||
|
} as MongoDBCollectionResource),
|
||||||
}));
|
}));
|
||||||
|
import { updateOffer } from "../../../Common/dataAccess/updateOffer";
|
||||||
|
import { MongoDBCollectionResource } from "../../../Utils/arm/generatedClients/2020-04-01/types";
|
||||||
jest.mock("../../../Common/dataAccess/updateOffer", () => ({
|
jest.mock("../../../Common/dataAccess/updateOffer", () => ({
|
||||||
updateOffer: jest.fn().mockReturnValue({} as DataModels.Offer),
|
updateOffer: jest.fn().mockReturnValue({} as DataModels.Offer),
|
||||||
}));
|
}));
|
||||||
@@ -39,6 +44,7 @@ describe("SettingsComponent", () => {
|
|||||||
tabPath: "",
|
tabPath: "",
|
||||||
node: undefined,
|
node: undefined,
|
||||||
hashLocation: "settings",
|
hashLocation: "settings",
|
||||||
|
isActive: ko.observable(false),
|
||||||
onUpdateTabsButtons: undefined,
|
onUpdateTabsButtons: undefined,
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
@@ -107,13 +113,7 @@ describe("SettingsComponent", () => {
|
|||||||
expect(settingsComponentInstance.shouldShowKeyspaceSharedThroughputMessage()).toEqual(false);
|
expect(settingsComponentInstance.shouldShowKeyspaceSharedThroughputMessage()).toEqual(false);
|
||||||
|
|
||||||
const newContainer = new Explorer();
|
const newContainer = new Explorer();
|
||||||
updateUserContext({
|
newContainer.isPreferredApiCassandra = ko.computed(() => true);
|
||||||
databaseAccount: {
|
|
||||||
properties: {
|
|
||||||
capabilities: [{ name: "EnableCassandra" }],
|
|
||||||
},
|
|
||||||
} as DataModels.DatabaseAccount,
|
|
||||||
});
|
|
||||||
|
|
||||||
const newCollection = { ...collection };
|
const newCollection = { ...collection };
|
||||||
newCollection.container = newContainer;
|
newCollection.container = newContainer;
|
||||||
@@ -134,6 +134,7 @@ describe("SettingsComponent", () => {
|
|||||||
loadCollections: undefined,
|
loadCollections: undefined,
|
||||||
findCollectionWithId: undefined,
|
findCollectionWithId: undefined,
|
||||||
openAddCollection: undefined,
|
openAddCollection: undefined,
|
||||||
|
onDeleteDatabaseContextMenuClick: undefined,
|
||||||
readSettings: undefined,
|
readSettings: undefined,
|
||||||
onSettingsClick: undefined,
|
onSettingsClick: undefined,
|
||||||
loadOffer: undefined,
|
loadOffer: undefined,
|
||||||
@@ -193,6 +194,7 @@ describe("SettingsComponent", () => {
|
|||||||
};
|
};
|
||||||
await settingsComponentInstance.onSaveClick();
|
await settingsComponentInstance.onSaveClick();
|
||||||
expect(updateCollection).toBeCalled();
|
expect(updateCollection).toBeCalled();
|
||||||
|
expect(updateMongoDBCollectionThroughRP).toBeCalled();
|
||||||
expect(updateOffer).toBeCalled();
|
expect(updateOffer).toBeCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -1,51 +1,49 @@
|
|||||||
import { IPivotItemProps, IPivotProps, Pivot, PivotItem } from "office-ui-fabric-react";
|
|
||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
import DiscardIcon from "../../../../images/discard.svg";
|
import * as AutoPilotUtils from "../../../Utils/AutoPilotUtils";
|
||||||
import SaveIcon from "../../../../images/save-cosmos.svg";
|
|
||||||
import { AuthType } from "../../../AuthType";
|
|
||||||
import * as Constants from "../../../Common/Constants";
|
import * as Constants from "../../../Common/Constants";
|
||||||
import { getIndexTransformationProgress } from "../../../Common/dataAccess/getIndexTransformationProgress";
|
|
||||||
import { readMongoDBCollectionThroughRP } from "../../../Common/dataAccess/readMongoDBCollection";
|
|
||||||
import { updateCollection } from "../../../Common/dataAccess/updateCollection";
|
|
||||||
import { updateOffer } from "../../../Common/dataAccess/updateOffer";
|
|
||||||
import { getErrorMessage, getErrorStack } from "../../../Common/ErrorHandlingUtils";
|
|
||||||
import * as DataModels from "../../../Contracts/DataModels";
|
import * as DataModels from "../../../Contracts/DataModels";
|
||||||
import * as ViewModels from "../../../Contracts/ViewModels";
|
import * as ViewModels from "../../../Contracts/ViewModels";
|
||||||
|
import DiscardIcon from "../../../../images/discard.svg";
|
||||||
|
import SaveIcon from "../../../../images/save-cosmos.svg";
|
||||||
|
import { traceStart, traceFailure, traceSuccess, trace } from "../../../Shared/Telemetry/TelemetryProcessor";
|
||||||
import { Action, ActionModifiers } from "../../../Shared/Telemetry/TelemetryConstants";
|
import { Action, ActionModifiers } from "../../../Shared/Telemetry/TelemetryConstants";
|
||||||
import { trace, traceFailure, traceStart, traceSuccess } from "../../../Shared/Telemetry/TelemetryProcessor";
|
|
||||||
import { userContext } from "../../../UserContext";
|
|
||||||
import { MongoDBCollectionResource, MongoIndex } from "../../../Utils/arm/generatedClients/2020-04-01/types";
|
|
||||||
import * as AutoPilotUtils from "../../../Utils/AutoPilotUtils";
|
|
||||||
import { CommandButtonComponentProps } from "../../Controls/CommandButton/CommandButtonComponent";
|
|
||||||
import Explorer from "../../Explorer";
|
import Explorer from "../../Explorer";
|
||||||
|
import { updateOffer } from "../../../Common/dataAccess/updateOffer";
|
||||||
|
import { updateCollection, updateMongoDBCollectionThroughRP } from "../../../Common/dataAccess/updateCollection";
|
||||||
|
import { CommandButtonComponentProps } from "../../Controls/CommandButton/CommandButtonComponent";
|
||||||
import { SettingsTabV2 } from "../../Tabs/SettingsTabV2";
|
import { SettingsTabV2 } from "../../Tabs/SettingsTabV2";
|
||||||
import "./SettingsComponent.less";
|
|
||||||
import { mongoIndexingPolicyAADError } from "./SettingsRenderUtils";
|
import { mongoIndexingPolicyAADError } from "./SettingsRenderUtils";
|
||||||
import {
|
import { ScaleComponent, ScaleComponentProps } from "./SettingsSubComponents/ScaleComponent";
|
||||||
ConflictResolutionComponent,
|
|
||||||
ConflictResolutionComponentProps,
|
|
||||||
} from "./SettingsSubComponents/ConflictResolutionComponent";
|
|
||||||
import { IndexingPolicyComponent, IndexingPolicyComponentProps } from "./SettingsSubComponents/IndexingPolicyComponent";
|
|
||||||
import {
|
import {
|
||||||
MongoIndexingPolicyComponent,
|
MongoIndexingPolicyComponent,
|
||||||
MongoIndexingPolicyComponentProps,
|
MongoIndexingPolicyComponentProps,
|
||||||
} from "./SettingsSubComponents/MongoIndexingPolicy/MongoIndexingPolicyComponent";
|
} from "./SettingsSubComponents/MongoIndexingPolicy/MongoIndexingPolicyComponent";
|
||||||
import { ScaleComponent, ScaleComponentProps } from "./SettingsSubComponents/ScaleComponent";
|
|
||||||
import { SubSettingsComponent, SubSettingsComponentProps } from "./SettingsSubComponents/SubSettingsComponent";
|
|
||||||
import {
|
import {
|
||||||
AddMongoIndexProps,
|
|
||||||
ChangeFeedPolicyState,
|
|
||||||
GeospatialConfigType,
|
|
||||||
getMongoNotification,
|
|
||||||
getTabTitle,
|
|
||||||
hasDatabaseSharedThroughput,
|
hasDatabaseSharedThroughput,
|
||||||
|
GeospatialConfigType,
|
||||||
|
TtlType,
|
||||||
|
ChangeFeedPolicyState,
|
||||||
|
SettingsV2TabTypes,
|
||||||
|
getTabTitle,
|
||||||
isDirty,
|
isDirty,
|
||||||
|
AddMongoIndexProps,
|
||||||
MongoIndexTypes,
|
MongoIndexTypes,
|
||||||
parseConflictResolutionMode,
|
parseConflictResolutionMode,
|
||||||
parseConflictResolutionProcedure,
|
parseConflictResolutionProcedure,
|
||||||
SettingsV2TabTypes,
|
getMongoNotification,
|
||||||
TtlType,
|
|
||||||
} from "./SettingsUtils";
|
} from "./SettingsUtils";
|
||||||
|
import {
|
||||||
|
ConflictResolutionComponent,
|
||||||
|
ConflictResolutionComponentProps,
|
||||||
|
} from "./SettingsSubComponents/ConflictResolutionComponent";
|
||||||
|
import { SubSettingsComponent, SubSettingsComponentProps } from "./SettingsSubComponents/SubSettingsComponent";
|
||||||
|
import { Pivot, PivotItem, IPivotProps, IPivotItemProps } from "office-ui-fabric-react";
|
||||||
|
import "./SettingsComponent.less";
|
||||||
|
import { IndexingPolicyComponent, IndexingPolicyComponentProps } from "./SettingsSubComponents/IndexingPolicyComponent";
|
||||||
|
import { MongoDBCollectionResource, MongoIndex } from "../../../Utils/arm/generatedClients/2020-04-01/types";
|
||||||
|
import { readMongoDBCollectionThroughRP } from "../../../Common/dataAccess/readMongoDBCollection";
|
||||||
|
import { getIndexTransformationProgress } from "../../../Common/dataAccess/getIndexTransformationProgress";
|
||||||
|
import { getErrorMessage, getErrorStack } from "../../../Common/ErrorHandlingUtils";
|
||||||
|
|
||||||
interface SettingsV2TabInfo {
|
interface SettingsV2TabInfo {
|
||||||
tab: SettingsV2TabTypes;
|
tab: SettingsV2TabTypes;
|
||||||
@@ -137,9 +135,11 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
|
|||||||
this.offer = this.collection?.offer();
|
this.offer = this.collection?.offer();
|
||||||
this.isAnalyticalStorageEnabled = !!this.collection?.analyticalStorageTtl();
|
this.isAnalyticalStorageEnabled = !!this.collection?.analyticalStorageTtl();
|
||||||
this.shouldShowIndexingPolicyEditor =
|
this.shouldShowIndexingPolicyEditor =
|
||||||
this.container && userContext.apiType !== "Cassandra" && !this.container.isPreferredApiMongoDB();
|
this.container && !this.container.isPreferredApiCassandra() && !this.container.isPreferredApiMongoDB();
|
||||||
|
|
||||||
this.changeFeedPolicyVisible = userContext.features.enableChangeFeedPolicy;
|
this.changeFeedPolicyVisible = this.collection?.container.isFeatureEnabled(
|
||||||
|
Constants.Features.enableChangeFeedPolicy
|
||||||
|
);
|
||||||
|
|
||||||
// Mongo container with system partition key still treat as "Fixed"
|
// Mongo container with system partition key still treat as "Fixed"
|
||||||
this.isFixedContainer =
|
this.isFixedContainer =
|
||||||
@@ -299,7 +299,7 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
|
|||||||
this.state.wasAutopilotOriginallySet !== this.state.isAutoPilotSelected;
|
this.state.wasAutopilotOriginallySet !== this.state.isAutoPilotSelected;
|
||||||
|
|
||||||
public shouldShowKeyspaceSharedThroughputMessage = (): boolean =>
|
public shouldShowKeyspaceSharedThroughputMessage = (): boolean =>
|
||||||
this.container && userContext.apiType === "Cassandra" && hasDatabaseSharedThroughput(this.collection);
|
this.container && this.container.isPreferredApiCassandra() && hasDatabaseSharedThroughput(this.collection);
|
||||||
|
|
||||||
public hasConflictResolution = (): boolean =>
|
public hasConflictResolution = (): boolean =>
|
||||||
this.container?.databaseAccount &&
|
this.container?.databaseAccount &&
|
||||||
@@ -325,6 +325,7 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
|
|||||||
? this.saveCollectionSettings(startKey)
|
? this.saveCollectionSettings(startKey)
|
||||||
: this.saveDatabaseSettings(startKey));
|
: this.saveDatabaseSettings(startKey));
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
this.container.isRefreshingExplorer(false);
|
||||||
this.props.settingsTab.isExecutionError(true);
|
this.props.settingsTab.isExecutionError(true);
|
||||||
console.error(error);
|
console.error(error);
|
||||||
traceFailure(
|
traceFailure(
|
||||||
@@ -698,6 +699,7 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.container.isRefreshingExplorer(false);
|
||||||
this.setBaseline();
|
this.setBaseline();
|
||||||
this.setState({ wasAutopilotOriginallySet: this.state.isAutoPilotSelected });
|
this.setState({ wasAutopilotOriginallySet: this.state.isAutoPilotSelected });
|
||||||
traceSuccess(
|
traceSuccess(
|
||||||
@@ -782,12 +784,12 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
|
|||||||
if (this.state.isMongoIndexingPolicySaveable && this.mongoDBCollectionResource) {
|
if (this.state.isMongoIndexingPolicySaveable && this.mongoDBCollectionResource) {
|
||||||
try {
|
try {
|
||||||
const newMongoIndexes = this.getMongoIndexesToSave();
|
const newMongoIndexes = this.getMongoIndexesToSave();
|
||||||
const newMongoCollection = {
|
const newMongoCollection: MongoDBCollectionResource = {
|
||||||
...this.mongoDBCollectionResource,
|
...this.mongoDBCollectionResource,
|
||||||
indexes: newMongoIndexes,
|
indexes: newMongoIndexes,
|
||||||
};
|
};
|
||||||
|
|
||||||
this.mongoDBCollectionResource = await updateCollection(
|
this.mongoDBCollectionResource = await updateMongoDBCollectionThroughRP(
|
||||||
this.collection.databaseId,
|
this.collection.databaseId,
|
||||||
this.collection.id(),
|
this.collection.id(),
|
||||||
newMongoCollection
|
newMongoCollection
|
||||||
@@ -860,6 +862,7 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
this.container.isRefreshingExplorer(false);
|
||||||
this.setBaseline();
|
this.setBaseline();
|
||||||
this.setState({ wasAutopilotOriginallySet: this.state.isAutoPilotSelected });
|
this.setState({ wasAutopilotOriginallySet: this.state.isAutoPilotSelected });
|
||||||
traceSuccess(
|
traceSuccess(
|
||||||
@@ -874,18 +877,6 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
public getMongoIndexTabContent = (
|
|
||||||
mongoIndexingPolicyComponentProps: MongoIndexingPolicyComponentProps
|
|
||||||
): JSX.Element => {
|
|
||||||
if (userContext.authType === AuthType.AAD) {
|
|
||||||
if (this.container.isEnableMongoCapabilityPresent()) {
|
|
||||||
return <MongoIndexingPolicyComponent {...mongoIndexingPolicyComponentProps} />;
|
|
||||||
}
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
return mongoIndexingPolicyAADError;
|
|
||||||
};
|
|
||||||
|
|
||||||
public render(): JSX.Element {
|
public render(): JSX.Element {
|
||||||
const scaleComponentProps: ScaleComponentProps = {
|
const scaleComponentProps: ScaleComponentProps = {
|
||||||
collection: this.collection,
|
collection: this.collection,
|
||||||
@@ -1003,11 +994,15 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
|
|||||||
content: <IndexingPolicyComponent {...indexingPolicyComponentProps} />,
|
content: <IndexingPolicyComponent {...indexingPolicyComponentProps} />,
|
||||||
});
|
});
|
||||||
} else if (this.container.isPreferredApiMongoDB()) {
|
} else if (this.container.isPreferredApiMongoDB()) {
|
||||||
const mongoIndexTabContext = this.getMongoIndexTabContent(mongoIndexingPolicyComponentProps);
|
if (this.container.isEnableMongoCapabilityPresent()) {
|
||||||
if (mongoIndexTabContext) {
|
|
||||||
tabs.push({
|
tabs.push({
|
||||||
tab: SettingsV2TabTypes.IndexingPolicyTab,
|
tab: SettingsV2TabTypes.IndexingPolicyTab,
|
||||||
content: mongoIndexTabContext,
|
content: <MongoIndexingPolicyComponent {...mongoIndexingPolicyComponentProps} />,
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
tabs.push({
|
||||||
|
tab: SettingsV2TabTypes.IndexingPolicyTab,
|
||||||
|
content: mongoIndexingPolicyAADError,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import {
|
|||||||
ITextStyles,
|
ITextStyles,
|
||||||
IDetailsRowStyles,
|
IDetailsRowStyles,
|
||||||
IStackStyles,
|
IStackStyles,
|
||||||
|
IIconStyles,
|
||||||
IDetailsListStyles,
|
IDetailsListStyles,
|
||||||
IDropdownStyles,
|
IDropdownStyles,
|
||||||
ISeparatorStyles,
|
ISeparatorStyles,
|
||||||
@@ -115,6 +116,8 @@ export const addMongoIndexSubElementsTokens: IStackTokens = {
|
|||||||
childrenGap: 20,
|
childrenGap: 20,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const accordionIconStyles: IIconStyles = { root: { paddingTop: 7 } };
|
||||||
|
|
||||||
export const mediumWidthStackStyles: IStackStyles = { root: { width: 600 } };
|
export const mediumWidthStackStyles: IStackStyles = { root: { width: 600 } };
|
||||||
|
|
||||||
export const shortWidthTextFieldStyles: Partial<ITextFieldStyles> = { root: { paddingLeft: 10, width: 210 } };
|
export const shortWidthTextFieldStyles: Partial<ITextFieldStyles> = { root: { paddingLeft: 10, width: 210 } };
|
||||||
|
|||||||
@@ -239,7 +239,7 @@ export class MongoIndexingPolicyComponent extends React.Component<MongoIndexingP
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Stack {...createAndAddMongoIndexStackProps} styles={mediumWidthStackStyles}>
|
<Stack {...createAndAddMongoIndexStackProps} styles={mediumWidthStackStyles}>
|
||||||
<CollapsibleSectionComponent title="Current index(es)" isExpandedByDefault={true}>
|
<CollapsibleSectionComponent title="Current index(es)">
|
||||||
{
|
{
|
||||||
<>
|
<>
|
||||||
<DetailsList
|
<DetailsList
|
||||||
@@ -266,7 +266,7 @@ export class MongoIndexingPolicyComponent extends React.Component<MongoIndexingP
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Stack styles={mediumWidthStackStyles}>
|
<Stack styles={mediumWidthStackStyles}>
|
||||||
<CollapsibleSectionComponent title="Index(es) to be dropped" isExpandedByDefault={true}>
|
<CollapsibleSectionComponent title="Index(es) to be dropped">
|
||||||
{indexesToBeDropped.length > 0 && (
|
{indexesToBeDropped.length > 0 && (
|
||||||
<DetailsList
|
<DetailsList
|
||||||
styles={customDetailsListStyles}
|
styles={customDetailsListStyles}
|
||||||
|
|||||||
@@ -42,7 +42,6 @@ exports[`MongoIndexingPolicyComponent renders 1`] = `
|
|||||||
}
|
}
|
||||||
>
|
>
|
||||||
<CollapsibleSectionComponent
|
<CollapsibleSectionComponent
|
||||||
isExpandedByDefault={true}
|
|
||||||
title="Current index(es)"
|
title="Current index(es)"
|
||||||
>
|
>
|
||||||
<StyledWithViewportComponent
|
<StyledWithViewportComponent
|
||||||
@@ -115,7 +114,7 @@ exports[`MongoIndexingPolicyComponent renders 1`] = `
|
|||||||
</Stack>
|
</Stack>
|
||||||
</CollapsibleSectionComponent>
|
</CollapsibleSectionComponent>
|
||||||
</Stack>
|
</Stack>
|
||||||
<Separator
|
<Styled
|
||||||
styles={
|
styles={
|
||||||
Object {
|
Object {
|
||||||
"root": Array [
|
"root": Array [
|
||||||
@@ -140,7 +139,6 @@ exports[`MongoIndexingPolicyComponent renders 1`] = `
|
|||||||
}
|
}
|
||||||
>
|
>
|
||||||
<CollapsibleSectionComponent
|
<CollapsibleSectionComponent
|
||||||
isExpandedByDefault={true}
|
|
||||||
title="Index(es) to be dropped"
|
title="Index(es) to be dropped"
|
||||||
/>
|
/>
|
||||||
</Stack>
|
</Stack>
|
||||||
|
|||||||
@@ -1,24 +1,23 @@
|
|||||||
import { Label, Link, MessageBar, MessageBarType, Stack, Text, TextField } from "office-ui-fabric-react";
|
|
||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
import * as Constants from "../../../../Common/Constants";
|
import * as Constants from "../../../../Common/Constants";
|
||||||
import { configContext, Platform } from "../../../../ConfigContext";
|
import { ThroughputInputAutoPilotV3Component } from "./ThroughputInputComponents/ThroughputInputAutoPilotV3Component";
|
||||||
import * as DataModels from "../../../../Contracts/DataModels";
|
|
||||||
import * as ViewModels from "../../../../Contracts/ViewModels";
|
import * as ViewModels from "../../../../Contracts/ViewModels";
|
||||||
|
import * as DataModels from "../../../../Contracts/DataModels";
|
||||||
import * as SharedConstants from "../../../../Shared/Constants";
|
import * as SharedConstants from "../../../../Shared/Constants";
|
||||||
import { userContext } from "../../../../UserContext";
|
|
||||||
import * as AutoPilotUtils from "../../../../Utils/AutoPilotUtils";
|
|
||||||
import Explorer from "../../../Explorer";
|
import Explorer from "../../../Explorer";
|
||||||
import {
|
import {
|
||||||
getTextFieldStyles,
|
getTextFieldStyles,
|
||||||
|
subComponentStackProps,
|
||||||
|
titleAndInputStackProps,
|
||||||
|
throughputUnit,
|
||||||
getThroughputApplyLongDelayMessage,
|
getThroughputApplyLongDelayMessage,
|
||||||
getThroughputApplyShortDelayMessage,
|
getThroughputApplyShortDelayMessage,
|
||||||
subComponentStackProps,
|
|
||||||
throughputUnit,
|
|
||||||
titleAndInputStackProps,
|
|
||||||
updateThroughputBeyondLimitWarningMessage,
|
updateThroughputBeyondLimitWarningMessage,
|
||||||
} from "../SettingsRenderUtils";
|
} from "../SettingsRenderUtils";
|
||||||
import { hasDatabaseSharedThroughput } from "../SettingsUtils";
|
import { hasDatabaseSharedThroughput } from "../SettingsUtils";
|
||||||
import { ThroughputInputAutoPilotV3Component } from "./ThroughputInputComponents/ThroughputInputAutoPilotV3Component";
|
import * as AutoPilotUtils from "../../../../Utils/AutoPilotUtils";
|
||||||
|
import { Link, Text, TextField, Stack, Label, MessageBar, MessageBarType } from "office-ui-fabric-react";
|
||||||
|
import { configContext, Platform } from "../../../../ConfigContext";
|
||||||
|
|
||||||
export interface ScaleComponentProps {
|
export interface ScaleComponentProps {
|
||||||
collection: ViewModels.Collection;
|
collection: ViewModels.Collection;
|
||||||
@@ -80,7 +79,7 @@ export class ScaleComponent extends React.Component<ScaleComponentProps> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
public getMaxRUs = (): number => {
|
public getMaxRUs = (): number => {
|
||||||
if (userContext.isTryCosmosDBSubscription) {
|
if (this.props.container?.isTryCosmosDBSubscription()) {
|
||||||
return Constants.TryCosmosExperience.maxRU;
|
return Constants.TryCosmosExperience.maxRU;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,7 +91,7 @@ export class ScaleComponent extends React.Component<ScaleComponentProps> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
public getMinRUs = (): number => {
|
public getMinRUs = (): number => {
|
||||||
if (userContext.isTryCosmosDBSubscription) {
|
if (this.props.container?.isTryCosmosDBSubscription()) {
|
||||||
return SharedConstants.CollectionCreation.DefaultCollectionRUs400;
|
return SharedConstants.CollectionCreation.DefaultCollectionRUs400;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -173,6 +172,7 @@ export class ScaleComponent extends React.Component<ScaleComponentProps> {
|
|||||||
databaseAccount={this.props.container.databaseAccount()}
|
databaseAccount={this.props.container.databaseAccount()}
|
||||||
databaseName={this.databaseId}
|
databaseName={this.databaseId}
|
||||||
collectionName={this.collectionId}
|
collectionName={this.collectionId}
|
||||||
|
serverId={this.props.container.serverId()}
|
||||||
throughput={this.props.throughput}
|
throughput={this.props.throughput}
|
||||||
throughputBaseline={this.props.throughputBaseline}
|
throughputBaseline={this.props.throughputBaseline}
|
||||||
onThroughputChange={this.props.onThroughputChange}
|
onThroughputChange={this.props.onThroughputChange}
|
||||||
|
|||||||
@@ -1,13 +1,14 @@
|
|||||||
import { shallow } from "enzyme";
|
import { shallow } from "enzyme";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { DatabaseAccount } from "../../../../Contracts/DataModels";
|
|
||||||
import { updateUserContext } from "../../../../UserContext";
|
|
||||||
import Explorer from "../../../Explorer";
|
|
||||||
import { ChangeFeedPolicyState, GeospatialConfigType, TtlOff, TtlOn, TtlOnNoDefault, TtlType } from "../SettingsUtils";
|
|
||||||
import { collection, container } from "../TestUtils";
|
|
||||||
import { SubSettingsComponent, SubSettingsComponentProps } from "./SubSettingsComponent";
|
import { SubSettingsComponent, SubSettingsComponentProps } from "./SubSettingsComponent";
|
||||||
|
import { container, collection } from "../TestUtils";
|
||||||
|
import { TtlType, GeospatialConfigType, ChangeFeedPolicyState, TtlOnNoDefault, TtlOn, TtlOff } from "../SettingsUtils";
|
||||||
|
import ko from "knockout";
|
||||||
|
import Explorer from "../../../Explorer";
|
||||||
|
|
||||||
describe("SubSettingsComponent", () => {
|
describe("SubSettingsComponent", () => {
|
||||||
|
container.isPreferredApiDocumentDB = ko.computed(() => true);
|
||||||
|
|
||||||
const baseProps: SubSettingsComponentProps = {
|
const baseProps: SubSettingsComponentProps = {
|
||||||
collection: collection,
|
collection: collection,
|
||||||
container: container,
|
container: container,
|
||||||
@@ -105,13 +106,8 @@ describe("SubSettingsComponent", () => {
|
|||||||
|
|
||||||
it("partitionKey not visible", () => {
|
it("partitionKey not visible", () => {
|
||||||
const newContainer = new Explorer();
|
const newContainer = new Explorer();
|
||||||
updateUserContext({
|
|
||||||
databaseAccount: {
|
newContainer.isPreferredApiCassandra = ko.computed(() => true);
|
||||||
properties: {
|
|
||||||
capabilities: [{ name: "EnableCassandra" }],
|
|
||||||
},
|
|
||||||
} as DatabaseAccount,
|
|
||||||
});
|
|
||||||
const props = { ...baseProps, container: newContainer };
|
const props = { ...baseProps, container: newContainer };
|
||||||
const subSettingsComponent = new SubSettingsComponent(props);
|
const subSettingsComponent = new SubSettingsComponent(props);
|
||||||
expect(subSettingsComponent.getPartitionKeyVisible()).toEqual(false);
|
expect(subSettingsComponent.getPartitionKeyVisible()).toEqual(false);
|
||||||
|
|||||||
@@ -1,38 +1,28 @@
|
|||||||
import {
|
|
||||||
ChoiceGroup,
|
|
||||||
IChoiceGroupOption,
|
|
||||||
Label,
|
|
||||||
Link,
|
|
||||||
MessageBar,
|
|
||||||
Stack,
|
|
||||||
Text,
|
|
||||||
TextField,
|
|
||||||
} from "office-ui-fabric-react";
|
|
||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
import * as ViewModels from "../../../../Contracts/ViewModels";
|
import * as ViewModels from "../../../../Contracts/ViewModels";
|
||||||
import { userContext } from "../../../../UserContext";
|
import {
|
||||||
|
GeospatialConfigType,
|
||||||
|
TtlType,
|
||||||
|
ChangeFeedPolicyState,
|
||||||
|
isDirty,
|
||||||
|
IsComponentDirtyResult,
|
||||||
|
TtlOn,
|
||||||
|
TtlOff,
|
||||||
|
TtlOnNoDefault,
|
||||||
|
getSanitizedInputValue,
|
||||||
|
} from "../SettingsUtils";
|
||||||
import Explorer from "../../../Explorer";
|
import Explorer from "../../../Explorer";
|
||||||
import { Int32 } from "../../../Panes/Tables/Validators/EntityPropertyValidationCommon";
|
import { Int32 } from "../../../Panes/Tables/Validators/EntityPropertyValidationCommon";
|
||||||
|
import { Label, Text, TextField, Stack, IChoiceGroupOption, ChoiceGroup, MessageBar } from "office-ui-fabric-react";
|
||||||
import {
|
import {
|
||||||
changeFeedPolicyToolTip,
|
|
||||||
getChoiceGroupStyles,
|
|
||||||
getTextFieldStyles,
|
getTextFieldStyles,
|
||||||
messageBarStyles,
|
changeFeedPolicyToolTip,
|
||||||
subComponentStackProps,
|
subComponentStackProps,
|
||||||
titleAndInputStackProps,
|
titleAndInputStackProps,
|
||||||
|
getChoiceGroupStyles,
|
||||||
ttlWarning,
|
ttlWarning,
|
||||||
|
messageBarStyles,
|
||||||
} from "../SettingsRenderUtils";
|
} from "../SettingsRenderUtils";
|
||||||
import {
|
|
||||||
ChangeFeedPolicyState,
|
|
||||||
GeospatialConfigType,
|
|
||||||
getSanitizedInputValue,
|
|
||||||
IsComponentDirtyResult,
|
|
||||||
isDirty,
|
|
||||||
TtlOff,
|
|
||||||
TtlOn,
|
|
||||||
TtlOnNoDefault,
|
|
||||||
TtlType,
|
|
||||||
} from "../SettingsUtils";
|
|
||||||
import { ToolTipLabelComponent } from "./ToolTipLabelComponent";
|
import { ToolTipLabelComponent } from "./ToolTipLabelComponent";
|
||||||
|
|
||||||
export interface SubSettingsComponentProps {
|
export interface SubSettingsComponentProps {
|
||||||
@@ -70,15 +60,17 @@ export interface SubSettingsComponentProps {
|
|||||||
|
|
||||||
export class SubSettingsComponent extends React.Component<SubSettingsComponentProps> {
|
export class SubSettingsComponent extends React.Component<SubSettingsComponentProps> {
|
||||||
private shouldCheckComponentIsDirty = true;
|
private shouldCheckComponentIsDirty = true;
|
||||||
|
private ttlVisible: boolean;
|
||||||
private geospatialVisible: boolean;
|
private geospatialVisible: boolean;
|
||||||
private partitionKeyValue: string;
|
private partitionKeyValue: string;
|
||||||
private partitionKeyName: string;
|
private partitionKeyName: string;
|
||||||
|
|
||||||
constructor(props: SubSettingsComponentProps) {
|
constructor(props: SubSettingsComponentProps) {
|
||||||
super(props);
|
super(props);
|
||||||
this.geospatialVisible = userContext.apiType === "SQL";
|
this.ttlVisible = (this.props.container && !this.props.container.isPreferredApiCassandra()) || false;
|
||||||
|
this.geospatialVisible = this.props.container.isPreferredApiDocumentDB();
|
||||||
this.partitionKeyValue = "/" + this.props.collection.partitionKeyProperty;
|
this.partitionKeyValue = "/" + this.props.collection.partitionKeyProperty;
|
||||||
this.partitionKeyName = userContext.apiType === "Mongo" ? "Shard key" : "Partition key";
|
this.partitionKeyName = this.props.container.isPreferredApiMongoDB() ? "Shard key" : "Partition key";
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount(): void {
|
componentDidMount(): void {
|
||||||
@@ -178,51 +170,39 @@ export class SubSettingsComponent extends React.Component<SubSettingsComponentPr
|
|||||||
): void =>
|
): void =>
|
||||||
this.props.onChangeFeedPolicyChange(ChangeFeedPolicyState[option.key as keyof typeof ChangeFeedPolicyState]);
|
this.props.onChangeFeedPolicyChange(ChangeFeedPolicyState[option.key as keyof typeof ChangeFeedPolicyState]);
|
||||||
|
|
||||||
private getTtlComponent = (): JSX.Element =>
|
private getTtlComponent = (): JSX.Element => (
|
||||||
userContext.apiType === "Mongo" ? (
|
<Stack {...titleAndInputStackProps}>
|
||||||
<MessageBar
|
<ChoiceGroup
|
||||||
messageBarIconProps={{ iconName: "InfoSolid", className: "messageBarInfoIcon" }}
|
id="timeToLive"
|
||||||
styles={{ text: { fontSize: 14 } }}
|
label="Time to Live"
|
||||||
>
|
selectedKey={this.props.timeToLive}
|
||||||
To enable time-to-live (TTL) for your collection/documents,
|
options={this.ttlChoiceGroupOptions}
|
||||||
<Link href="https://docs.microsoft.com/en-us/azure/cosmos-db/mongodb-time-to-live" target="_blank">
|
onChange={this.onTtlChange}
|
||||||
create a TTL index
|
styles={getChoiceGroupStyles(this.props.timeToLive, this.props.timeToLiveBaseline)}
|
||||||
</Link>
|
/>
|
||||||
.
|
{isDirty(this.props.timeToLive, this.props.timeToLiveBaseline) && this.props.timeToLive === TtlType.On && (
|
||||||
</MessageBar>
|
<MessageBar
|
||||||
) : (
|
messageBarIconProps={{ iconName: "InfoSolid", className: "messageBarInfoIcon" }}
|
||||||
<Stack {...titleAndInputStackProps}>
|
styles={messageBarStyles}
|
||||||
<ChoiceGroup
|
>
|
||||||
id="timeToLive"
|
{ttlWarning}
|
||||||
label="Time to Live"
|
</MessageBar>
|
||||||
selectedKey={this.props.timeToLive}
|
)}
|
||||||
options={this.ttlChoiceGroupOptions}
|
{this.props.timeToLive === TtlType.On && (
|
||||||
onChange={this.onTtlChange}
|
<TextField
|
||||||
styles={getChoiceGroupStyles(this.props.timeToLive, this.props.timeToLiveBaseline)}
|
id="timeToLiveSeconds"
|
||||||
|
styles={getTextFieldStyles(this.props.timeToLiveSeconds, this.props.timeToLiveSecondsBaseline)}
|
||||||
|
type="number"
|
||||||
|
required
|
||||||
|
min={1}
|
||||||
|
max={Int32.Max}
|
||||||
|
value={this.props.timeToLiveSeconds?.toString()}
|
||||||
|
onChange={this.onTimeToLiveSecondsChange}
|
||||||
|
suffix="second(s)"
|
||||||
/>
|
/>
|
||||||
{isDirty(this.props.timeToLive, this.props.timeToLiveBaseline) && this.props.timeToLive === TtlType.On && (
|
)}
|
||||||
<MessageBar
|
</Stack>
|
||||||
messageBarIconProps={{ iconName: "InfoSolid", className: "messageBarInfoIcon" }}
|
);
|
||||||
styles={messageBarStyles}
|
|
||||||
>
|
|
||||||
{ttlWarning}
|
|
||||||
</MessageBar>
|
|
||||||
)}
|
|
||||||
{this.props.timeToLive === TtlType.On && (
|
|
||||||
<TextField
|
|
||||||
id="timeToLiveSeconds"
|
|
||||||
styles={getTextFieldStyles(this.props.timeToLiveSeconds, this.props.timeToLiveSecondsBaseline)}
|
|
||||||
type="number"
|
|
||||||
required
|
|
||||||
min={1}
|
|
||||||
max={Int32.Max}
|
|
||||||
value={this.props.timeToLiveSeconds?.toString()}
|
|
||||||
onChange={this.onTimeToLiveSecondsChange}
|
|
||||||
suffix="second(s)"
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</Stack>
|
|
||||||
);
|
|
||||||
|
|
||||||
private analyticalTtlChoiceGroupOptions: IChoiceGroupOption[] = [
|
private analyticalTtlChoiceGroupOptions: IChoiceGroupOption[] = [
|
||||||
{ key: TtlType.Off, text: "Off", disabled: true },
|
{ key: TtlType.Off, text: "Off", disabled: true },
|
||||||
@@ -320,8 +300,8 @@ export class SubSettingsComponent extends React.Component<SubSettingsComponentPr
|
|||||||
|
|
||||||
public getPartitionKeyVisible = (): boolean => {
|
public getPartitionKeyVisible = (): boolean => {
|
||||||
if (
|
if (
|
||||||
userContext.apiType === "Cassandra" ||
|
this.props.container.isPreferredApiCassandra() ||
|
||||||
userContext.apiType === "Tables" ||
|
this.props.container.isPreferredApiTable() ||
|
||||||
!this.props.collection.partitionKeyProperty ||
|
!this.props.collection.partitionKeyProperty ||
|
||||||
(this.props.container.isPreferredApiMongoDB() && this.props.collection.partitionKey.systemKey)
|
(this.props.container.isPreferredApiMongoDB() && this.props.collection.partitionKey.systemKey)
|
||||||
) {
|
) {
|
||||||
@@ -335,7 +315,7 @@ export class SubSettingsComponent extends React.Component<SubSettingsComponentPr
|
|||||||
public render(): JSX.Element {
|
public render(): JSX.Element {
|
||||||
return (
|
return (
|
||||||
<Stack {...subComponentStackProps}>
|
<Stack {...subComponentStackProps}>
|
||||||
{userContext.apiType !== "Cassandra" && this.getTtlComponent()}
|
{this.ttlVisible && this.getTtlComponent()}
|
||||||
|
|
||||||
{this.geospatialVisible && this.getGeoSpatialComponent()}
|
{this.geospatialVisible && this.getGeoSpatialComponent()}
|
||||||
|
|
||||||
|
|||||||
@@ -1,16 +1,17 @@
|
|||||||
import { shallow } from "enzyme";
|
import { shallow } from "enzyme";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import * as DataModels from "../../../../../Contracts/DataModels";
|
|
||||||
import {
|
import {
|
||||||
ThroughputInputAutoPilotV3Component,
|
ThroughputInputAutoPilotV3Component,
|
||||||
ThroughputInputAutoPilotV3Props,
|
ThroughputInputAutoPilotV3Props,
|
||||||
} from "./ThroughputInputAutoPilotV3Component";
|
} from "./ThroughputInputAutoPilotV3Component";
|
||||||
|
import * as DataModels from "../../../../../Contracts/DataModels";
|
||||||
|
|
||||||
describe("ThroughputInputAutoPilotV3Component", () => {
|
describe("ThroughputInputAutoPilotV3Component", () => {
|
||||||
const baseProps: ThroughputInputAutoPilotV3Props = {
|
const baseProps: ThroughputInputAutoPilotV3Props = {
|
||||||
databaseAccount: {} as DataModels.DatabaseAccount,
|
databaseAccount: {} as DataModels.DatabaseAccount,
|
||||||
databaseName: "test",
|
databaseName: "test",
|
||||||
collectionName: "test",
|
collectionName: "test",
|
||||||
|
serverId: undefined,
|
||||||
wasAutopilotOriginallySet: false,
|
wasAutopilotOriginallySet: false,
|
||||||
throughput: 100,
|
throughput: 100,
|
||||||
throughputBaseline: 100,
|
throughputBaseline: 100,
|
||||||
|
|||||||
@@ -1,52 +1,55 @@
|
|||||||
|
import React from "react";
|
||||||
|
import * as AutoPilotUtils from "../../../../../Utils/AutoPilotUtils";
|
||||||
import {
|
import {
|
||||||
Checkbox,
|
getTextFieldStyles,
|
||||||
|
getToolTipContainer,
|
||||||
|
noLeftPaddingCheckBoxStyle,
|
||||||
|
titleAndInputStackProps,
|
||||||
|
checkBoxAndInputStackProps,
|
||||||
|
getChoiceGroupStyles,
|
||||||
|
messageBarStyles,
|
||||||
|
getEstimatedSpendingElement,
|
||||||
|
getAutoPilotV3SpendElement,
|
||||||
|
manualToAutoscaleDisclaimerElement,
|
||||||
|
saveThroughputWarningMessage,
|
||||||
|
ManualEstimatedSpendingDisplayProps,
|
||||||
|
AutoscaleEstimatedSpendingDisplayProps,
|
||||||
|
PriceBreakdown,
|
||||||
|
getRuPriceBreakdown,
|
||||||
|
transparentDetailsHeaderStyle,
|
||||||
|
} from "../../SettingsRenderUtils";
|
||||||
|
import {
|
||||||
|
Text,
|
||||||
|
TextField,
|
||||||
ChoiceGroup,
|
ChoiceGroup,
|
||||||
FontIcon,
|
|
||||||
IChoiceGroupOption,
|
IChoiceGroupOption,
|
||||||
IColumn,
|
Checkbox,
|
||||||
|
Stack,
|
||||||
Label,
|
Label,
|
||||||
Link,
|
Link,
|
||||||
MessageBar,
|
MessageBar,
|
||||||
Stack,
|
FontIcon,
|
||||||
Text,
|
IColumn,
|
||||||
TextField,
|
|
||||||
} from "office-ui-fabric-react";
|
} from "office-ui-fabric-react";
|
||||||
import React from "react";
|
|
||||||
import * as DataModels from "../../../../../Contracts/DataModels";
|
|
||||||
import { SubscriptionType } from "../../../../../Contracts/SubscriptionType";
|
|
||||||
import * as SharedConstants from "../../../../../Shared/Constants";
|
|
||||||
import { Action, ActionModifiers } from "../../../../../Shared/Telemetry/TelemetryConstants";
|
|
||||||
import * as TelemetryProcessor from "../../../../../Shared/Telemetry/TelemetryProcessor";
|
|
||||||
import { userContext } from "../../../../../UserContext";
|
|
||||||
import * as AutoPilotUtils from "../../../../../Utils/AutoPilotUtils";
|
|
||||||
import { minAutoPilotThroughput } from "../../../../../Utils/AutoPilotUtils";
|
|
||||||
import { calculateEstimateNumber, usageInGB } from "../../../../../Utils/PricingUtils";
|
|
||||||
import { Int32 } from "../../../../Panes/Tables/Validators/EntityPropertyValidationCommon";
|
|
||||||
import {
|
|
||||||
AutoscaleEstimatedSpendingDisplayProps,
|
|
||||||
checkBoxAndInputStackProps,
|
|
||||||
getAutoPilotV3SpendElement,
|
|
||||||
getChoiceGroupStyles,
|
|
||||||
getEstimatedSpendingElement,
|
|
||||||
getRuPriceBreakdown,
|
|
||||||
getTextFieldStyles,
|
|
||||||
getToolTipContainer,
|
|
||||||
ManualEstimatedSpendingDisplayProps,
|
|
||||||
manualToAutoscaleDisclaimerElement,
|
|
||||||
messageBarStyles,
|
|
||||||
noLeftPaddingCheckBoxStyle,
|
|
||||||
PriceBreakdown,
|
|
||||||
saveThroughputWarningMessage,
|
|
||||||
titleAndInputStackProps,
|
|
||||||
transparentDetailsHeaderStyle,
|
|
||||||
} from "../../SettingsRenderUtils";
|
|
||||||
import { getSanitizedInputValue, IsComponentDirtyResult, isDirty } from "../../SettingsUtils";
|
|
||||||
import { ToolTipLabelComponent } from "../ToolTipLabelComponent";
|
import { ToolTipLabelComponent } from "../ToolTipLabelComponent";
|
||||||
|
import { getSanitizedInputValue, IsComponentDirtyResult, isDirty } from "../../SettingsUtils";
|
||||||
|
import * as SharedConstants from "../../../../../Shared/Constants";
|
||||||
|
import * as DataModels from "../../../../../Contracts/DataModels";
|
||||||
|
import { Int32 } from "../../../../Panes/Tables/Validators/EntityPropertyValidationCommon";
|
||||||
|
import { userContext } from "../../../../../UserContext";
|
||||||
|
import { SubscriptionType } from "../../../../../Contracts/SubscriptionType";
|
||||||
|
import { usageInGB, calculateEstimateNumber } from "../../../../../Utils/PricingUtils";
|
||||||
|
import { Features } from "../../../../../Common/Constants";
|
||||||
|
import { minAutoPilotThroughput } from "../../../../../Utils/AutoPilotUtils";
|
||||||
|
|
||||||
|
import * as TelemetryProcessor from "../../../../../Shared/Telemetry/TelemetryProcessor";
|
||||||
|
import { Action, ActionModifiers } from "../../../../../Shared/Telemetry/TelemetryConstants";
|
||||||
|
|
||||||
export interface ThroughputInputAutoPilotV3Props {
|
export interface ThroughputInputAutoPilotV3Props {
|
||||||
databaseAccount: DataModels.DatabaseAccount;
|
databaseAccount: DataModels.DatabaseAccount;
|
||||||
databaseName: string;
|
databaseName: string;
|
||||||
collectionName: string;
|
collectionName: string;
|
||||||
|
serverId: string;
|
||||||
throughput: number;
|
throughput: number;
|
||||||
throughputBaseline: number;
|
throughputBaseline: number;
|
||||||
onThroughputChange: (newThroughput: number) => void;
|
onThroughputChange: (newThroughput: number) => void;
|
||||||
@@ -179,6 +182,7 @@ export class ThroughputInputAutoPilotV3Component extends React.Component<
|
|||||||
}
|
}
|
||||||
|
|
||||||
const isDirty: boolean = this.IsComponentDirty().isDiscardable;
|
const isDirty: boolean = this.IsComponentDirty().isDiscardable;
|
||||||
|
const serverId: string = this.props.serverId;
|
||||||
const regions = account?.properties?.readLocations?.length || 1;
|
const regions = account?.properties?.readLocations?.length || 1;
|
||||||
const multimaster = account?.properties?.enableMultipleWriteLocations || false;
|
const multimaster = account?.properties?.enableMultipleWriteLocations || false;
|
||||||
|
|
||||||
@@ -188,7 +192,7 @@ export class ThroughputInputAutoPilotV3Component extends React.Component<
|
|||||||
estimatedSpend = this.getEstimatedManualSpendElement(
|
estimatedSpend = this.getEstimatedManualSpendElement(
|
||||||
// if migrating from autoscale to manual, we use the autoscale RUs value as that is what will be set...
|
// if migrating from autoscale to manual, we use the autoscale RUs value as that is what will be set...
|
||||||
this.overrideWithAutoPilotSettings() ? this.props.maxAutoPilotThroughput : this.props.throughputBaseline,
|
this.overrideWithAutoPilotSettings() ? this.props.maxAutoPilotThroughput : this.props.throughputBaseline,
|
||||||
userContext.portalEnv,
|
serverId,
|
||||||
regions,
|
regions,
|
||||||
multimaster,
|
multimaster,
|
||||||
isDirty ? this.props.throughput : undefined
|
isDirty ? this.props.throughput : undefined
|
||||||
@@ -196,7 +200,7 @@ export class ThroughputInputAutoPilotV3Component extends React.Component<
|
|||||||
} else {
|
} else {
|
||||||
estimatedSpend = this.getEstimatedAutoscaleSpendElement(
|
estimatedSpend = this.getEstimatedAutoscaleSpendElement(
|
||||||
this.props.maxAutoPilotThroughputBaseline,
|
this.props.maxAutoPilotThroughputBaseline,
|
||||||
userContext.portalEnv,
|
serverId,
|
||||||
regions,
|
regions,
|
||||||
multimaster,
|
multimaster,
|
||||||
isDirty ? this.props.maxAutoPilotThroughput : undefined
|
isDirty ? this.props.maxAutoPilotThroughput : undefined
|
||||||
@@ -464,7 +468,7 @@ export class ThroughputInputAutoPilotV3Component extends React.Component<
|
|||||||
const href = `https://ncv.microsoft.com/vRBTO37jmO?ctx={"AzureSubscriptionId":"${userContext.subscriptionId}","CosmosDBAccountName":"${userContext.databaseAccount?.name}"}`;
|
const href = `https://ncv.microsoft.com/vRBTO37jmO?ctx={"AzureSubscriptionId":"${userContext.subscriptionId}","CosmosDBAccountName":"${userContext.databaseAccount?.name}"}`;
|
||||||
const oneTBinKB = 1000000000;
|
const oneTBinKB = 1000000000;
|
||||||
const minRUperGB = 10;
|
const minRUperGB = 10;
|
||||||
const featureFlagEnabled = userContext.features.showMinRUSurvey;
|
const featureFlagEnabled = window.dataExplorer?.isFeatureEnabled(Features.showMinRUSurvey);
|
||||||
const collectionIsEligible =
|
const collectionIsEligible =
|
||||||
userContext.subscriptionType !== SubscriptionType.Internal &&
|
userContext.subscriptionType !== SubscriptionType.Internal &&
|
||||||
this.props.usageSizeInKB > oneTBinKB &&
|
this.props.usageSizeInKB > oneTBinKB &&
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ exports[`ToolTipLabelComponent renders 1`] = `
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<Icon
|
<StyledIconBase
|
||||||
ariaLabel="Info"
|
ariaLabel="Info"
|
||||||
iconName="Info"
|
iconName="Info"
|
||||||
styles={
|
styles={
|
||||||
|
|||||||
@@ -1,23 +1,23 @@
|
|||||||
import ko from "knockout";
|
import { collection } from "./TestUtils";
|
||||||
import * as DataModels from "../../../Contracts/DataModels";
|
|
||||||
import * as ViewModels from "../../../Contracts/ViewModels";
|
|
||||||
import {
|
import {
|
||||||
getMongoIndexType,
|
getMongoIndexType,
|
||||||
getMongoIndexTypeText,
|
|
||||||
getMongoNotification,
|
getMongoNotification,
|
||||||
getSanitizedInputValue,
|
getSanitizedInputValue,
|
||||||
hasDatabaseSharedThroughput,
|
hasDatabaseSharedThroughput,
|
||||||
isDirty,
|
isDirty,
|
||||||
isIndexTransforming,
|
|
||||||
MongoIndexTypes,
|
MongoIndexTypes,
|
||||||
MongoNotificationType,
|
MongoNotificationType,
|
||||||
MongoWildcardPlaceHolder,
|
|
||||||
parseConflictResolutionMode,
|
parseConflictResolutionMode,
|
||||||
parseConflictResolutionProcedure,
|
parseConflictResolutionProcedure,
|
||||||
|
MongoWildcardPlaceHolder,
|
||||||
|
getMongoIndexTypeText,
|
||||||
SingleFieldText,
|
SingleFieldText,
|
||||||
WildcardText,
|
WildcardText,
|
||||||
|
isIndexTransforming,
|
||||||
} from "./SettingsUtils";
|
} from "./SettingsUtils";
|
||||||
import { collection } from "./TestUtils";
|
import * as DataModels from "../../../Contracts/DataModels";
|
||||||
|
import * as ViewModels from "../../../Contracts/ViewModels";
|
||||||
|
import ko from "knockout";
|
||||||
|
|
||||||
describe("SettingsUtils", () => {
|
describe("SettingsUtils", () => {
|
||||||
it("hasDatabaseSharedThroughput", () => {
|
it("hasDatabaseSharedThroughput", () => {
|
||||||
@@ -42,6 +42,7 @@ describe("SettingsUtils", () => {
|
|||||||
loadCollections: undefined,
|
loadCollections: undefined,
|
||||||
findCollectionWithId: undefined,
|
findCollectionWithId: undefined,
|
||||||
openAddCollection: undefined,
|
openAddCollection: undefined,
|
||||||
|
onDeleteDatabaseContextMenuClick: undefined,
|
||||||
readSettings: undefined,
|
readSettings: undefined,
|
||||||
onSettingsClick: undefined,
|
onSettingsClick: undefined,
|
||||||
loadOffer: undefined,
|
loadOffer: undefined,
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,7 @@
|
|||||||
import { shallow } from "enzyme";
|
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { DescriptionType, NumberUiType, SmartUiInput } from "../../../SelfServe/SelfServeTypes";
|
import { shallow } from "enzyme";
|
||||||
import { SmartUiComponent, SmartUiDescriptor } from "./SmartUiComponent";
|
import { SmartUiComponent, SmartUiDescriptor } from "./SmartUiComponent";
|
||||||
|
import { NumberUiType, SmartUiInput, DescriptionType } from "../../../SelfServe/SelfServeTypes";
|
||||||
|
|
||||||
describe("SmartUiComponent", () => {
|
describe("SmartUiComponent", () => {
|
||||||
const exampleData: SmartUiDescriptor = {
|
const exampleData: SmartUiDescriptor = {
|
||||||
@@ -97,9 +97,9 @@ describe("SmartUiComponent", () => {
|
|||||||
dataFieldName: "database",
|
dataFieldName: "database",
|
||||||
type: "object",
|
type: "object",
|
||||||
choices: [
|
choices: [
|
||||||
{ labelTKey: "Database 1", key: "db1" },
|
{ label: "Database 1", key: "db1" },
|
||||||
{ labelTKey: "Database 2", key: "db2" },
|
{ label: "Database 2", key: "db2" },
|
||||||
{ labelTKey: "Database 3", key: "db3" },
|
{ label: "Database 3", key: "db3" },
|
||||||
],
|
],
|
||||||
defaultKey: "db2",
|
defaultKey: "db2",
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,13 +1,14 @@
|
|||||||
import { TFunction } from "i18next";
|
import * as React from "react";
|
||||||
import { Label, Link, MessageBar, MessageBarType, Toggle } from "office-ui-fabric-react";
|
import { Position } from "office-ui-fabric-react/lib/utilities/positioning";
|
||||||
import { Dropdown, IDropdownOption } from "office-ui-fabric-react/lib/Dropdown";
|
|
||||||
import { Slider } from "office-ui-fabric-react/lib/Slider";
|
import { Slider } from "office-ui-fabric-react/lib/Slider";
|
||||||
import { SpinButton } from "office-ui-fabric-react/lib/SpinButton";
|
import { SpinButton } from "office-ui-fabric-react/lib/SpinButton";
|
||||||
import { IStackTokens, Stack } from "office-ui-fabric-react/lib/Stack";
|
import { Dropdown, IDropdownOption } from "office-ui-fabric-react/lib/Dropdown";
|
||||||
import { Text } from "office-ui-fabric-react/lib/Text";
|
|
||||||
import { TextField } from "office-ui-fabric-react/lib/TextField";
|
import { TextField } from "office-ui-fabric-react/lib/TextField";
|
||||||
import { Position } from "office-ui-fabric-react/lib/utilities/positioning";
|
import { Text } from "office-ui-fabric-react/lib/Text";
|
||||||
import * as React from "react";
|
import { Stack, IStackTokens } from "office-ui-fabric-react/lib/Stack";
|
||||||
|
import { Label, Link, MessageBar, MessageBarType, Toggle } from "office-ui-fabric-react";
|
||||||
|
import * as InputUtils from "./InputUtils";
|
||||||
|
import "./SmartUiComponent.less";
|
||||||
import {
|
import {
|
||||||
ChoiceItem,
|
ChoiceItem,
|
||||||
Description,
|
Description,
|
||||||
@@ -18,9 +19,8 @@ import {
|
|||||||
NumberUiType,
|
NumberUiType,
|
||||||
SmartUiInput,
|
SmartUiInput,
|
||||||
} from "../../../SelfServe/SelfServeTypes";
|
} from "../../../SelfServe/SelfServeTypes";
|
||||||
|
import { TFunction } from "i18next";
|
||||||
import { ToolTipLabelComponent } from "../Settings/SettingsSubComponents/ToolTipLabelComponent";
|
import { ToolTipLabelComponent } from "../Settings/SettingsSubComponents/ToolTipLabelComponent";
|
||||||
import * as InputUtils from "./InputUtils";
|
|
||||||
import "./SmartUiComponent.less";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generic UX renderer
|
* Generic UX renderer
|
||||||
@@ -138,12 +138,11 @@ export class SmartUiComponent extends React.Component<SmartUiComponentProps, Sma
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private renderTextInput(input: StringInput, labelId: string, labelElement: JSX.Element): JSX.Element {
|
private renderTextInput(input: StringInput, labelId: string): JSX.Element {
|
||||||
const value = this.props.currentValues.get(input.dataFieldName)?.value as string;
|
const value = this.props.currentValues.get(input.dataFieldName)?.value as string;
|
||||||
const disabled = this.props.disabled || this.props.currentValues.get(input.dataFieldName)?.disabled;
|
const disabled = this.props.disabled || this.props.currentValues.get(input.dataFieldName)?.disabled;
|
||||||
return (
|
return (
|
||||||
<Stack>
|
<div className="stringInputContainer">
|
||||||
{labelElement}
|
|
||||||
<TextField
|
<TextField
|
||||||
id={`${input.dataFieldName}-textField-input`}
|
id={`${input.dataFieldName}-textField-input`}
|
||||||
aria-labelledby={labelId}
|
aria-labelledby={labelId}
|
||||||
@@ -156,32 +155,25 @@ export class SmartUiComponent extends React.Component<SmartUiComponentProps, Sma
|
|||||||
root: { width: 400 },
|
root: { width: 400 },
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</Stack>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private renderDescription(input: DescriptionDisplay, labelId: string, labelElement: JSX.Element): JSX.Element {
|
private renderDescription(input: DescriptionDisplay, labelId: string): JSX.Element {
|
||||||
const dataFieldName = input.dataFieldName;
|
const dataFieldName = input.dataFieldName;
|
||||||
const description = input.description || (this.props.currentValues.get(dataFieldName)?.value as Description);
|
const description = input.description || (this.props.currentValues.get(dataFieldName)?.value as Description);
|
||||||
if (!description) {
|
if (!description) {
|
||||||
if (!input.isDynamicDescription) {
|
return this.renderError("Description is not provided.");
|
||||||
return this.renderError("Description is not provided.");
|
|
||||||
}
|
|
||||||
// If input is a dynamic description and description is not available, empty element is rendered
|
|
||||||
return <></>;
|
|
||||||
}
|
}
|
||||||
const descriptionElement = (
|
const descriptionElement = (
|
||||||
<Stack>
|
<Text id={`${dataFieldName}-text-display`} aria-labelledby={labelId}>
|
||||||
{labelElement}
|
{this.props.getTranslation(description.textTKey)}{" "}
|
||||||
<Text id={`${dataFieldName}-text-display`} aria-labelledby={labelId}>
|
{description.link && (
|
||||||
{this.props.getTranslation(description.textTKey)}{" "}
|
<Link target="_blank" href={description.link.href}>
|
||||||
{description.link && (
|
{this.props.getTranslation(description.link.textTKey)}
|
||||||
<Link target="_blank" href={description.link.href}>
|
</Link>
|
||||||
{this.props.getTranslation(description.link.textTKey)}
|
)}
|
||||||
</Link>
|
</Text>
|
||||||
)}
|
|
||||||
</Text>
|
|
||||||
</Stack>
|
|
||||||
);
|
);
|
||||||
|
|
||||||
if (description.type === DescriptionType.Text) {
|
if (description.type === DescriptionType.Text) {
|
||||||
@@ -235,7 +227,7 @@ export class SmartUiComponent extends React.Component<SmartUiComponentProps, Sma
|
|||||||
return undefined;
|
return undefined;
|
||||||
};
|
};
|
||||||
|
|
||||||
private renderNumberInput(input: NumberInput, labelId: string, labelElement: JSX.Element): JSX.Element {
|
private renderNumberInput(input: NumberInput, labelId: string): JSX.Element {
|
||||||
const { labelTKey, min, max, dataFieldName, step } = input;
|
const { labelTKey, min, max, dataFieldName, step } = input;
|
||||||
const props = {
|
const props = {
|
||||||
min: min,
|
min: min,
|
||||||
@@ -248,72 +240,61 @@ export class SmartUiComponent extends React.Component<SmartUiComponentProps, Sma
|
|||||||
const disabled = this.props.disabled || this.props.currentValues.get(dataFieldName)?.disabled;
|
const disabled = this.props.disabled || this.props.currentValues.get(dataFieldName)?.disabled;
|
||||||
if (input.uiType === NumberUiType.Spinner) {
|
if (input.uiType === NumberUiType.Spinner) {
|
||||||
return (
|
return (
|
||||||
<Stack>
|
<Stack styles={{ root: { width: 400 } }} tokens={{ childrenGap: 2 }}>
|
||||||
{labelElement}
|
<SpinButton
|
||||||
<Stack styles={{ root: { width: 400 } }} tokens={{ childrenGap: 2 }}>
|
{...props}
|
||||||
<SpinButton
|
id={`${input.dataFieldName}-spinner-input`}
|
||||||
{...props}
|
value={value?.toString()}
|
||||||
id={`${input.dataFieldName}-spinner-input`}
|
onValidate={(newValue) => this.onValidate(input, newValue, props.min, props.max)}
|
||||||
value={value?.toString()}
|
onIncrement={(newValue) => this.onIncrement(input, newValue, props.step, props.max)}
|
||||||
onValidate={(newValue) => this.onValidate(input, newValue, props.min, props.max)}
|
onDecrement={(newValue) => this.onDecrement(input, newValue, props.step, props.min)}
|
||||||
onIncrement={(newValue) => this.onIncrement(input, newValue, props.step, props.max)}
|
labelPosition={Position.top}
|
||||||
onDecrement={(newValue) => this.onDecrement(input, newValue, props.step, props.min)}
|
aria-labelledby={labelId}
|
||||||
labelPosition={Position.top}
|
disabled={disabled}
|
||||||
aria-labelledby={labelId}
|
/>
|
||||||
disabled={disabled}
|
{this.state.errors.has(dataFieldName) && (
|
||||||
/>
|
<MessageBar messageBarType={MessageBarType.error}>Error: {this.state.errors.get(dataFieldName)}</MessageBar>
|
||||||
{this.state.errors.has(dataFieldName) && (
|
)}
|
||||||
<MessageBar messageBarType={MessageBarType.error}>
|
|
||||||
Error: {this.state.errors.get(dataFieldName)}
|
|
||||||
</MessageBar>
|
|
||||||
)}
|
|
||||||
</Stack>
|
|
||||||
</Stack>
|
</Stack>
|
||||||
);
|
);
|
||||||
} else if (input.uiType === NumberUiType.Slider) {
|
} else if (input.uiType === NumberUiType.Slider) {
|
||||||
return (
|
return (
|
||||||
<Stack>
|
<div id={`${input.dataFieldName}-slider-input`}>
|
||||||
{labelElement}
|
<Slider
|
||||||
<div id={`${input.dataFieldName}-slider-input`}>
|
{...props}
|
||||||
<Slider
|
value={value}
|
||||||
{...props}
|
disabled={disabled}
|
||||||
value={value}
|
onChange={(newValue) => this.props.onInputChange(input, newValue)}
|
||||||
disabled={disabled}
|
styles={{
|
||||||
onChange={(newValue) => this.props.onInputChange(input, newValue)}
|
root: { width: 400 },
|
||||||
styles={{
|
valueLabel: SmartUiComponent.labelStyle,
|
||||||
root: { width: 400 },
|
}}
|
||||||
valueLabel: SmartUiComponent.labelStyle,
|
/>
|
||||||
}}
|
</div>
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</Stack>
|
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return <>Unsupported number UI type {input.uiType}</>;
|
return <>Unsupported number UI type {input.uiType}</>;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private renderBooleanInput(input: BooleanInput, labelId: string, labelElement: JSX.Element): JSX.Element {
|
private renderBooleanInput(input: BooleanInput, labelId: string): JSX.Element {
|
||||||
const value = this.props.currentValues.get(input.dataFieldName)?.value as boolean;
|
const value = this.props.currentValues.get(input.dataFieldName)?.value as boolean;
|
||||||
const disabled = this.props.disabled || this.props.currentValues.get(input.dataFieldName)?.disabled;
|
const disabled = this.props.disabled || this.props.currentValues.get(input.dataFieldName)?.disabled;
|
||||||
return (
|
return (
|
||||||
<Stack>
|
<Toggle
|
||||||
{labelElement}
|
id={`${input.dataFieldName}-toggle-input`}
|
||||||
<Toggle
|
aria-labelledby={labelId}
|
||||||
id={`${input.dataFieldName}-toggle-input`}
|
checked={value || false}
|
||||||
aria-labelledby={labelId}
|
onText={this.props.getTranslation(input.trueLabelTKey)}
|
||||||
checked={value || false}
|
offText={this.props.getTranslation(input.falseLabelTKey)}
|
||||||
onText={this.props.getTranslation(input.trueLabelTKey)}
|
disabled={disabled}
|
||||||
offText={this.props.getTranslation(input.falseLabelTKey)}
|
onChange={(event, checked: boolean) => this.props.onInputChange(input, checked)}
|
||||||
disabled={disabled}
|
styles={{ root: { width: 400 } }}
|
||||||
onChange={(event, checked: boolean) => this.props.onInputChange(input, checked)}
|
/>
|
||||||
styles={{ root: { width: 400 } }}
|
|
||||||
/>
|
|
||||||
</Stack>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private renderChoiceInput(input: ChoiceInput, labelId: string, labelElement: JSX.Element): JSX.Element {
|
private renderChoiceInput(input: ChoiceInput, labelId: string): JSX.Element {
|
||||||
const { defaultKey, dataFieldName, choices, placeholderTKey } = input;
|
const { defaultKey, dataFieldName, choices, placeholderTKey } = input;
|
||||||
const value = this.props.currentValues.get(dataFieldName)?.value as string;
|
const value = this.props.currentValues.get(dataFieldName)?.value as string;
|
||||||
const disabled = this.props.disabled || this.props.currentValues.get(dataFieldName)?.disabled;
|
const disabled = this.props.disabled || this.props.currentValues.get(dataFieldName)?.disabled;
|
||||||
@@ -322,26 +303,22 @@ export class SmartUiComponent extends React.Component<SmartUiComponentProps, Sma
|
|||||||
selectedKey = "";
|
selectedKey = "";
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<Stack>
|
<Dropdown
|
||||||
{labelElement}
|
id={`${input.dataFieldName}-dropdown-input`}
|
||||||
<Dropdown
|
aria-labelledby={labelId}
|
||||||
id={`${input.dataFieldName}-dropdown-input`}
|
selectedKey={selectedKey}
|
||||||
aria-labelledby={labelId}
|
onChange={(_, item: IDropdownOption) => this.props.onInputChange(input, item.key.toString())}
|
||||||
selectedKey={selectedKey}
|
placeholder={this.props.getTranslation(placeholderTKey)}
|
||||||
onChange={(_, item: IDropdownOption) => this.props.onInputChange(input, item.key.toString())}
|
disabled={disabled}
|
||||||
placeholder={this.props.getTranslation(placeholderTKey)}
|
options={choices.map((c) => ({
|
||||||
disabled={disabled}
|
key: c.key,
|
||||||
// Removed dropdownWidth="auto" as dropdown accept only number
|
text: this.props.getTranslation(c.label),
|
||||||
options={choices.map((c) => ({
|
}))}
|
||||||
key: c.key,
|
styles={{
|
||||||
text: this.props.getTranslation(c.labelTKey),
|
root: { width: 400 },
|
||||||
}))}
|
dropdown: SmartUiComponent.labelStyle,
|
||||||
styles={{
|
}}
|
||||||
root: { width: 400 },
|
/>
|
||||||
dropdown: SmartUiComponent.labelStyle,
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</Stack>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -349,7 +326,7 @@ export class SmartUiComponent extends React.Component<SmartUiComponentProps, Sma
|
|||||||
return <MessageBar messageBarType={MessageBarType.error}>Error: {errorMessage}</MessageBar>;
|
return <MessageBar messageBarType={MessageBarType.error}>Error: {errorMessage}</MessageBar>;
|
||||||
}
|
}
|
||||||
|
|
||||||
private renderElement(input: AnyDisplay, info: Info): JSX.Element {
|
private renderDisplayWithInfoBubble(input: AnyDisplay, info: Info): JSX.Element {
|
||||||
if (input.errorMessage) {
|
if (input.errorMessage) {
|
||||||
return this.renderError(input.errorMessage);
|
return this.renderError(input.errorMessage);
|
||||||
}
|
}
|
||||||
@@ -358,31 +335,34 @@ export class SmartUiComponent extends React.Component<SmartUiComponentProps, Sma
|
|||||||
return <></>;
|
return <></>;
|
||||||
}
|
}
|
||||||
const labelId = `${input.dataFieldName}-label`;
|
const labelId = `${input.dataFieldName}-label`;
|
||||||
const labelElement: JSX.Element = input.labelTKey && (
|
return (
|
||||||
<Label id={labelId}>
|
<Stack>
|
||||||
<ToolTipLabelComponent
|
{input.labelTKey && (
|
||||||
label={this.props.getTranslation(input.labelTKey)}
|
<Label id={labelId}>
|
||||||
toolTipElement={this.renderInfo(info)}
|
<ToolTipLabelComponent
|
||||||
/>
|
label={this.props.getTranslation(input.labelTKey)}
|
||||||
</Label>
|
toolTipElement={this.renderInfo(info)}
|
||||||
|
/>
|
||||||
|
</Label>
|
||||||
|
)}
|
||||||
|
{this.renderDisplay(input, labelId)}
|
||||||
|
</Stack>
|
||||||
);
|
);
|
||||||
|
|
||||||
return <Stack>{this.renderControl(input, labelId, labelElement)}</Stack>;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private renderControl(input: AnyDisplay, labelId: string, labelElement: JSX.Element): JSX.Element {
|
private renderDisplay(input: AnyDisplay, labelId: string): JSX.Element {
|
||||||
switch (input.type) {
|
switch (input.type) {
|
||||||
case "string":
|
case "string":
|
||||||
if ("description" in input || "isDynamicDescription" in input) {
|
if ("description" in input || "isDynamicDescription" in input) {
|
||||||
return this.renderDescription(input as DescriptionDisplay, labelId, labelElement);
|
return this.renderDescription(input as DescriptionDisplay, labelId);
|
||||||
}
|
}
|
||||||
return this.renderTextInput(input as StringInput, labelId, labelElement);
|
return this.renderTextInput(input as StringInput, labelId);
|
||||||
case "number":
|
case "number":
|
||||||
return this.renderNumberInput(input as NumberInput, labelId, labelElement);
|
return this.renderNumberInput(input as NumberInput, labelId);
|
||||||
case "boolean":
|
case "boolean":
|
||||||
return this.renderBooleanInput(input as BooleanInput, labelId, labelElement);
|
return this.renderBooleanInput(input as BooleanInput, labelId);
|
||||||
case "object":
|
case "object":
|
||||||
return this.renderChoiceInput(input as ChoiceInput, labelId, labelElement);
|
return this.renderChoiceInput(input as ChoiceInput, labelId);
|
||||||
default:
|
default:
|
||||||
throw new Error(`Unknown input type: ${input.type}`);
|
throw new Error(`Unknown input type: ${input.type}`);
|
||||||
}
|
}
|
||||||
@@ -393,7 +373,7 @@ export class SmartUiComponent extends React.Component<SmartUiComponentProps, Sma
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Stack tokens={containerStackTokens} className="widgetRendererContainer">
|
<Stack tokens={containerStackTokens} className="widgetRendererContainer">
|
||||||
<Stack.Item>{node.input && this.renderElement(node.input, node.info as Info)}</Stack.Item>
|
<Stack.Item>{node.input && this.renderDisplayWithInfoBubble(node.input, node.info as Info)}</Stack.Item>
|
||||||
{node.children && node.children.map((child) => <div key={child.id}>{this.renderNode(child)}</div>)}
|
{node.children && node.children.map((child) => <div key={child.id}>{this.renderNode(child)}</div>)}
|
||||||
</Stack>
|
</Stack>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -23,21 +23,19 @@ exports[`SmartUiComponent disable all inputs 1`] = `
|
|||||||
>
|
>
|
||||||
<StackItem>
|
<StackItem>
|
||||||
<Stack>
|
<Stack>
|
||||||
<Stack>
|
<Text
|
||||||
<Text
|
aria-labelledby="description-label"
|
||||||
aria-labelledby="description-label"
|
id="description-text-display"
|
||||||
id="description-text-display"
|
>
|
||||||
|
this is an example description text.
|
||||||
|
|
||||||
|
<StyledLinkBase
|
||||||
|
href="https://docs.microsoft.com/en-us/azure/cosmos-db/introduction"
|
||||||
|
target="_blank"
|
||||||
>
|
>
|
||||||
this is an example description text.
|
Click here for more information.
|
||||||
|
</StyledLinkBase>
|
||||||
<StyledLinkBase
|
</Text>
|
||||||
href="https://docs.microsoft.com/en-us/azure/cosmos-db/introduction"
|
|
||||||
target="_blank"
|
|
||||||
>
|
|
||||||
Click here for more information.
|
|
||||||
</StyledLinkBase>
|
|
||||||
</Text>
|
|
||||||
</Stack>
|
|
||||||
</Stack>
|
</Stack>
|
||||||
</StackItem>
|
</StackItem>
|
||||||
</Stack>
|
</Stack>
|
||||||
@@ -55,53 +53,51 @@ exports[`SmartUiComponent disable all inputs 1`] = `
|
|||||||
>
|
>
|
||||||
<StackItem>
|
<StackItem>
|
||||||
<Stack>
|
<Stack>
|
||||||
<Stack>
|
<StyledLabelBase
|
||||||
<StyledLabelBase
|
id="throughput-label"
|
||||||
id="throughput-label"
|
>
|
||||||
>
|
<ToolTipLabelComponent
|
||||||
<ToolTipLabelComponent
|
label="Throughput (input)"
|
||||||
label="Throughput (input)"
|
/>
|
||||||
/>
|
</StyledLabelBase>
|
||||||
</StyledLabelBase>
|
<Stack
|
||||||
<Stack
|
styles={
|
||||||
styles={
|
Object {
|
||||||
|
"root": Object {
|
||||||
|
"width": 400,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
tokens={
|
||||||
|
Object {
|
||||||
|
"childrenGap": 2,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<CustomizedSpinButton
|
||||||
|
aria-labelledby="throughput-label"
|
||||||
|
ariaLabel="Throughput (input)"
|
||||||
|
decrementButtonIcon={
|
||||||
Object {
|
Object {
|
||||||
"root": Object {
|
"iconName": "ChevronDownSmall",
|
||||||
"width": 400,
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tokens={
|
disabled={true}
|
||||||
|
id="throughput-spinner-input"
|
||||||
|
incrementButtonIcon={
|
||||||
Object {
|
Object {
|
||||||
"childrenGap": 2,
|
"iconName": "ChevronUpSmall",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
>
|
label=""
|
||||||
<CustomizedSpinButton
|
labelPosition={0}
|
||||||
aria-labelledby="throughput-label"
|
max={500}
|
||||||
ariaLabel="Throughput (input)"
|
min={400}
|
||||||
decrementButtonIcon={
|
onDecrement={[Function]}
|
||||||
Object {
|
onIncrement={[Function]}
|
||||||
"iconName": "ChevronDownSmall",
|
onValidate={[Function]}
|
||||||
}
|
step={10}
|
||||||
}
|
/>
|
||||||
disabled={true}
|
|
||||||
id="throughput-spinner-input"
|
|
||||||
incrementButtonIcon={
|
|
||||||
Object {
|
|
||||||
"iconName": "ChevronUpSmall",
|
|
||||||
}
|
|
||||||
}
|
|
||||||
label=""
|
|
||||||
labelPosition={0}
|
|
||||||
max={500}
|
|
||||||
min={400}
|
|
||||||
onDecrement={[Function]}
|
|
||||||
onIncrement={[Function]}
|
|
||||||
onValidate={[Function]}
|
|
||||||
step={10}
|
|
||||||
/>
|
|
||||||
</Stack>
|
|
||||||
</Stack>
|
</Stack>
|
||||||
</Stack>
|
</Stack>
|
||||||
</StackItem>
|
</StackItem>
|
||||||
@@ -120,39 +116,37 @@ exports[`SmartUiComponent disable all inputs 1`] = `
|
|||||||
>
|
>
|
||||||
<StackItem>
|
<StackItem>
|
||||||
<Stack>
|
<Stack>
|
||||||
<Stack>
|
<StyledLabelBase
|
||||||
<StyledLabelBase
|
id="throughput2-label"
|
||||||
id="throughput2-label"
|
>
|
||||||
>
|
<ToolTipLabelComponent
|
||||||
<ToolTipLabelComponent
|
label="Throughput (Slider)"
|
||||||
label="Throughput (Slider)"
|
/>
|
||||||
/>
|
</StyledLabelBase>
|
||||||
</StyledLabelBase>
|
<div
|
||||||
<div
|
id="throughput2-slider-input"
|
||||||
id="throughput2-slider-input"
|
>
|
||||||
>
|
<StyledSliderBase
|
||||||
<StyledSliderBase
|
ariaLabel="Throughput (Slider)"
|
||||||
ariaLabel="Throughput (Slider)"
|
disabled={true}
|
||||||
disabled={true}
|
max={500}
|
||||||
max={500}
|
min={400}
|
||||||
min={400}
|
onChange={[Function]}
|
||||||
onChange={[Function]}
|
step={10}
|
||||||
step={10}
|
styles={
|
||||||
styles={
|
Object {
|
||||||
Object {
|
"root": Object {
|
||||||
"root": Object {
|
"width": 400,
|
||||||
"width": 400,
|
},
|
||||||
},
|
"valueLabel": Object {
|
||||||
"valueLabel": Object {
|
"color": "#393939",
|
||||||
"color": "#393939",
|
"fontFamily": "wf_segoe-ui_normal, 'Segoe UI', 'Segoe WP', Tahoma, Arial, sans-serif",
|
||||||
"fontFamily": "wf_segoe-ui_normal, 'Segoe UI', 'Segoe WP', Tahoma, Arial, sans-serif",
|
"fontSize": 12,
|
||||||
"fontSize": 12,
|
},
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
/>
|
}
|
||||||
</div>
|
/>
|
||||||
</Stack>
|
</div>
|
||||||
</Stack>
|
</Stack>
|
||||||
</StackItem>
|
</StackItem>
|
||||||
</Stack>
|
</Stack>
|
||||||
@@ -191,14 +185,16 @@ exports[`SmartUiComponent disable all inputs 1`] = `
|
|||||||
>
|
>
|
||||||
<StackItem>
|
<StackItem>
|
||||||
<Stack>
|
<Stack>
|
||||||
<Stack>
|
<StyledLabelBase
|
||||||
<StyledLabelBase
|
id="containerId-label"
|
||||||
id="containerId-label"
|
>
|
||||||
>
|
<ToolTipLabelComponent
|
||||||
<ToolTipLabelComponent
|
label="Container id"
|
||||||
label="Container id"
|
/>
|
||||||
/>
|
</StyledLabelBase>
|
||||||
</StyledLabelBase>
|
<div
|
||||||
|
className="stringInputContainer"
|
||||||
|
>
|
||||||
<StyledTextFieldBase
|
<StyledTextFieldBase
|
||||||
aria-labelledby="containerId-label"
|
aria-labelledby="containerId-label"
|
||||||
disabled={true}
|
disabled={true}
|
||||||
@@ -214,7 +210,7 @@ exports[`SmartUiComponent disable all inputs 1`] = `
|
|||||||
type="text"
|
type="text"
|
||||||
value=""
|
value=""
|
||||||
/>
|
/>
|
||||||
</Stack>
|
</div>
|
||||||
</Stack>
|
</Stack>
|
||||||
</StackItem>
|
</StackItem>
|
||||||
</Stack>
|
</Stack>
|
||||||
@@ -232,31 +228,29 @@ exports[`SmartUiComponent disable all inputs 1`] = `
|
|||||||
>
|
>
|
||||||
<StackItem>
|
<StackItem>
|
||||||
<Stack>
|
<Stack>
|
||||||
<Stack>
|
<StyledLabelBase
|
||||||
<StyledLabelBase
|
id="analyticalStore-label"
|
||||||
id="analyticalStore-label"
|
>
|
||||||
>
|
<ToolTipLabelComponent
|
||||||
<ToolTipLabelComponent
|
label="Analytical Store"
|
||||||
label="Analytical Store"
|
|
||||||
/>
|
|
||||||
</StyledLabelBase>
|
|
||||||
<StyledToggleBase
|
|
||||||
aria-labelledby="analyticalStore-label"
|
|
||||||
checked={false}
|
|
||||||
disabled={true}
|
|
||||||
id="analyticalStore-toggle-input"
|
|
||||||
offText="Disabled"
|
|
||||||
onChange={[Function]}
|
|
||||||
onText="Enabled"
|
|
||||||
styles={
|
|
||||||
Object {
|
|
||||||
"root": Object {
|
|
||||||
"width": 400,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/>
|
/>
|
||||||
</Stack>
|
</StyledLabelBase>
|
||||||
|
<StyledToggleBase
|
||||||
|
aria-labelledby="analyticalStore-label"
|
||||||
|
checked={false}
|
||||||
|
disabled={true}
|
||||||
|
id="analyticalStore-toggle-input"
|
||||||
|
offText="Disabled"
|
||||||
|
onChange={[Function]}
|
||||||
|
onText="Enabled"
|
||||||
|
styles={
|
||||||
|
Object {
|
||||||
|
"root": Object {
|
||||||
|
"width": 400,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/>
|
||||||
</Stack>
|
</Stack>
|
||||||
</StackItem>
|
</StackItem>
|
||||||
</Stack>
|
</Stack>
|
||||||
@@ -274,50 +268,48 @@ exports[`SmartUiComponent disable all inputs 1`] = `
|
|||||||
>
|
>
|
||||||
<StackItem>
|
<StackItem>
|
||||||
<Stack>
|
<Stack>
|
||||||
<Stack>
|
<StyledLabelBase
|
||||||
<StyledLabelBase
|
id="database-label"
|
||||||
id="database-label"
|
>
|
||||||
>
|
<ToolTipLabelComponent
|
||||||
<ToolTipLabelComponent
|
label="Database"
|
||||||
label="Database"
|
|
||||||
/>
|
|
||||||
</StyledLabelBase>
|
|
||||||
<StyledWithResponsiveMode
|
|
||||||
aria-labelledby="database-label"
|
|
||||||
disabled={true}
|
|
||||||
id="database-dropdown-input"
|
|
||||||
onChange={[Function]}
|
|
||||||
options={
|
|
||||||
Array [
|
|
||||||
Object {
|
|
||||||
"key": "db1",
|
|
||||||
"text": "Database 1",
|
|
||||||
},
|
|
||||||
Object {
|
|
||||||
"key": "db2",
|
|
||||||
"text": "Database 2",
|
|
||||||
},
|
|
||||||
Object {
|
|
||||||
"key": "db3",
|
|
||||||
"text": "Database 3",
|
|
||||||
},
|
|
||||||
]
|
|
||||||
}
|
|
||||||
selectedKey="db2"
|
|
||||||
styles={
|
|
||||||
Object {
|
|
||||||
"dropdown": Object {
|
|
||||||
"color": "#393939",
|
|
||||||
"fontFamily": "wf_segoe-ui_normal, 'Segoe UI', 'Segoe WP', Tahoma, Arial, sans-serif",
|
|
||||||
"fontSize": 12,
|
|
||||||
},
|
|
||||||
"root": Object {
|
|
||||||
"width": 400,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/>
|
/>
|
||||||
</Stack>
|
</StyledLabelBase>
|
||||||
|
<StyledWithResponsiveMode
|
||||||
|
aria-labelledby="database-label"
|
||||||
|
disabled={true}
|
||||||
|
id="database-dropdown-input"
|
||||||
|
onChange={[Function]}
|
||||||
|
options={
|
||||||
|
Array [
|
||||||
|
Object {
|
||||||
|
"key": "db1",
|
||||||
|
"text": "Database 1",
|
||||||
|
},
|
||||||
|
Object {
|
||||||
|
"key": "db2",
|
||||||
|
"text": "Database 2",
|
||||||
|
},
|
||||||
|
Object {
|
||||||
|
"key": "db3",
|
||||||
|
"text": "Database 3",
|
||||||
|
},
|
||||||
|
]
|
||||||
|
}
|
||||||
|
selectedKey="db2"
|
||||||
|
styles={
|
||||||
|
Object {
|
||||||
|
"dropdown": Object {
|
||||||
|
"color": "#393939",
|
||||||
|
"fontFamily": "wf_segoe-ui_normal, 'Segoe UI', 'Segoe WP', Tahoma, Arial, sans-serif",
|
||||||
|
"fontSize": 12,
|
||||||
|
},
|
||||||
|
"root": Object {
|
||||||
|
"width": 400,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/>
|
||||||
</Stack>
|
</Stack>
|
||||||
</StackItem>
|
</StackItem>
|
||||||
</Stack>
|
</Stack>
|
||||||
@@ -348,21 +340,19 @@ exports[`SmartUiComponent should render and honor input's hidden, disabled state
|
|||||||
>
|
>
|
||||||
<StackItem>
|
<StackItem>
|
||||||
<Stack>
|
<Stack>
|
||||||
<Stack>
|
<Text
|
||||||
<Text
|
aria-labelledby="description-label"
|
||||||
aria-labelledby="description-label"
|
id="description-text-display"
|
||||||
id="description-text-display"
|
>
|
||||||
|
this is an example description text.
|
||||||
|
|
||||||
|
<StyledLinkBase
|
||||||
|
href="https://docs.microsoft.com/en-us/azure/cosmos-db/introduction"
|
||||||
|
target="_blank"
|
||||||
>
|
>
|
||||||
this is an example description text.
|
Click here for more information.
|
||||||
|
</StyledLinkBase>
|
||||||
<StyledLinkBase
|
</Text>
|
||||||
href="https://docs.microsoft.com/en-us/azure/cosmos-db/introduction"
|
|
||||||
target="_blank"
|
|
||||||
>
|
|
||||||
Click here for more information.
|
|
||||||
</StyledLinkBase>
|
|
||||||
</Text>
|
|
||||||
</Stack>
|
|
||||||
</Stack>
|
</Stack>
|
||||||
</StackItem>
|
</StackItem>
|
||||||
</Stack>
|
</Stack>
|
||||||
@@ -380,53 +370,51 @@ exports[`SmartUiComponent should render and honor input's hidden, disabled state
|
|||||||
>
|
>
|
||||||
<StackItem>
|
<StackItem>
|
||||||
<Stack>
|
<Stack>
|
||||||
<Stack>
|
<StyledLabelBase
|
||||||
<StyledLabelBase
|
id="throughput-label"
|
||||||
id="throughput-label"
|
>
|
||||||
>
|
<ToolTipLabelComponent
|
||||||
<ToolTipLabelComponent
|
label="Throughput (input)"
|
||||||
label="Throughput (input)"
|
/>
|
||||||
/>
|
</StyledLabelBase>
|
||||||
</StyledLabelBase>
|
<Stack
|
||||||
<Stack
|
styles={
|
||||||
styles={
|
Object {
|
||||||
|
"root": Object {
|
||||||
|
"width": 400,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
tokens={
|
||||||
|
Object {
|
||||||
|
"childrenGap": 2,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<CustomizedSpinButton
|
||||||
|
aria-labelledby="throughput-label"
|
||||||
|
ariaLabel="Throughput (input)"
|
||||||
|
decrementButtonIcon={
|
||||||
Object {
|
Object {
|
||||||
"root": Object {
|
"iconName": "ChevronDownSmall",
|
||||||
"width": 400,
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tokens={
|
disabled={false}
|
||||||
|
id="throughput-spinner-input"
|
||||||
|
incrementButtonIcon={
|
||||||
Object {
|
Object {
|
||||||
"childrenGap": 2,
|
"iconName": "ChevronUpSmall",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
>
|
label=""
|
||||||
<CustomizedSpinButton
|
labelPosition={0}
|
||||||
aria-labelledby="throughput-label"
|
max={500}
|
||||||
ariaLabel="Throughput (input)"
|
min={400}
|
||||||
decrementButtonIcon={
|
onDecrement={[Function]}
|
||||||
Object {
|
onIncrement={[Function]}
|
||||||
"iconName": "ChevronDownSmall",
|
onValidate={[Function]}
|
||||||
}
|
step={10}
|
||||||
}
|
/>
|
||||||
disabled={false}
|
|
||||||
id="throughput-spinner-input"
|
|
||||||
incrementButtonIcon={
|
|
||||||
Object {
|
|
||||||
"iconName": "ChevronUpSmall",
|
|
||||||
}
|
|
||||||
}
|
|
||||||
label=""
|
|
||||||
labelPosition={0}
|
|
||||||
max={500}
|
|
||||||
min={400}
|
|
||||||
onDecrement={[Function]}
|
|
||||||
onIncrement={[Function]}
|
|
||||||
onValidate={[Function]}
|
|
||||||
step={10}
|
|
||||||
/>
|
|
||||||
</Stack>
|
|
||||||
</Stack>
|
</Stack>
|
||||||
</Stack>
|
</Stack>
|
||||||
</StackItem>
|
</StackItem>
|
||||||
@@ -445,38 +433,36 @@ exports[`SmartUiComponent should render and honor input's hidden, disabled state
|
|||||||
>
|
>
|
||||||
<StackItem>
|
<StackItem>
|
||||||
<Stack>
|
<Stack>
|
||||||
<Stack>
|
<StyledLabelBase
|
||||||
<StyledLabelBase
|
id="throughput2-label"
|
||||||
id="throughput2-label"
|
>
|
||||||
>
|
<ToolTipLabelComponent
|
||||||
<ToolTipLabelComponent
|
label="Throughput (Slider)"
|
||||||
label="Throughput (Slider)"
|
/>
|
||||||
/>
|
</StyledLabelBase>
|
||||||
</StyledLabelBase>
|
<div
|
||||||
<div
|
id="throughput2-slider-input"
|
||||||
id="throughput2-slider-input"
|
>
|
||||||
>
|
<StyledSliderBase
|
||||||
<StyledSliderBase
|
ariaLabel="Throughput (Slider)"
|
||||||
ariaLabel="Throughput (Slider)"
|
max={500}
|
||||||
max={500}
|
min={400}
|
||||||
min={400}
|
onChange={[Function]}
|
||||||
onChange={[Function]}
|
step={10}
|
||||||
step={10}
|
styles={
|
||||||
styles={
|
Object {
|
||||||
Object {
|
"root": Object {
|
||||||
"root": Object {
|
"width": 400,
|
||||||
"width": 400,
|
},
|
||||||
},
|
"valueLabel": Object {
|
||||||
"valueLabel": Object {
|
"color": "#393939",
|
||||||
"color": "#393939",
|
"fontFamily": "wf_segoe-ui_normal, 'Segoe UI', 'Segoe WP', Tahoma, Arial, sans-serif",
|
||||||
"fontFamily": "wf_segoe-ui_normal, 'Segoe UI', 'Segoe WP', Tahoma, Arial, sans-serif",
|
"fontSize": 12,
|
||||||
"fontSize": 12,
|
},
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
/>
|
}
|
||||||
</div>
|
/>
|
||||||
</Stack>
|
</div>
|
||||||
</Stack>
|
</Stack>
|
||||||
</StackItem>
|
</StackItem>
|
||||||
</Stack>
|
</Stack>
|
||||||
@@ -515,14 +501,16 @@ exports[`SmartUiComponent should render and honor input's hidden, disabled state
|
|||||||
>
|
>
|
||||||
<StackItem>
|
<StackItem>
|
||||||
<Stack>
|
<Stack>
|
||||||
<Stack>
|
<StyledLabelBase
|
||||||
<StyledLabelBase
|
id="containerId-label"
|
||||||
id="containerId-label"
|
>
|
||||||
>
|
<ToolTipLabelComponent
|
||||||
<ToolTipLabelComponent
|
label="Container id"
|
||||||
label="Container id"
|
/>
|
||||||
/>
|
</StyledLabelBase>
|
||||||
</StyledLabelBase>
|
<div
|
||||||
|
className="stringInputContainer"
|
||||||
|
>
|
||||||
<StyledTextFieldBase
|
<StyledTextFieldBase
|
||||||
aria-labelledby="containerId-label"
|
aria-labelledby="containerId-label"
|
||||||
id="containerId-textField-input"
|
id="containerId-textField-input"
|
||||||
@@ -537,7 +525,7 @@ exports[`SmartUiComponent should render and honor input's hidden, disabled state
|
|||||||
type="text"
|
type="text"
|
||||||
value=""
|
value=""
|
||||||
/>
|
/>
|
||||||
</Stack>
|
</div>
|
||||||
</Stack>
|
</Stack>
|
||||||
</StackItem>
|
</StackItem>
|
||||||
</Stack>
|
</Stack>
|
||||||
@@ -555,30 +543,28 @@ exports[`SmartUiComponent should render and honor input's hidden, disabled state
|
|||||||
>
|
>
|
||||||
<StackItem>
|
<StackItem>
|
||||||
<Stack>
|
<Stack>
|
||||||
<Stack>
|
<StyledLabelBase
|
||||||
<StyledLabelBase
|
id="analyticalStore-label"
|
||||||
id="analyticalStore-label"
|
>
|
||||||
>
|
<ToolTipLabelComponent
|
||||||
<ToolTipLabelComponent
|
label="Analytical Store"
|
||||||
label="Analytical Store"
|
|
||||||
/>
|
|
||||||
</StyledLabelBase>
|
|
||||||
<StyledToggleBase
|
|
||||||
aria-labelledby="analyticalStore-label"
|
|
||||||
checked={false}
|
|
||||||
id="analyticalStore-toggle-input"
|
|
||||||
offText="Disabled"
|
|
||||||
onChange={[Function]}
|
|
||||||
onText="Enabled"
|
|
||||||
styles={
|
|
||||||
Object {
|
|
||||||
"root": Object {
|
|
||||||
"width": 400,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/>
|
/>
|
||||||
</Stack>
|
</StyledLabelBase>
|
||||||
|
<StyledToggleBase
|
||||||
|
aria-labelledby="analyticalStore-label"
|
||||||
|
checked={false}
|
||||||
|
id="analyticalStore-toggle-input"
|
||||||
|
offText="Disabled"
|
||||||
|
onChange={[Function]}
|
||||||
|
onText="Enabled"
|
||||||
|
styles={
|
||||||
|
Object {
|
||||||
|
"root": Object {
|
||||||
|
"width": 400,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/>
|
||||||
</Stack>
|
</Stack>
|
||||||
</StackItem>
|
</StackItem>
|
||||||
</Stack>
|
</Stack>
|
||||||
@@ -596,49 +582,47 @@ exports[`SmartUiComponent should render and honor input's hidden, disabled state
|
|||||||
>
|
>
|
||||||
<StackItem>
|
<StackItem>
|
||||||
<Stack>
|
<Stack>
|
||||||
<Stack>
|
<StyledLabelBase
|
||||||
<StyledLabelBase
|
id="database-label"
|
||||||
id="database-label"
|
>
|
||||||
>
|
<ToolTipLabelComponent
|
||||||
<ToolTipLabelComponent
|
label="Database"
|
||||||
label="Database"
|
|
||||||
/>
|
|
||||||
</StyledLabelBase>
|
|
||||||
<StyledWithResponsiveMode
|
|
||||||
aria-labelledby="database-label"
|
|
||||||
id="database-dropdown-input"
|
|
||||||
onChange={[Function]}
|
|
||||||
options={
|
|
||||||
Array [
|
|
||||||
Object {
|
|
||||||
"key": "db1",
|
|
||||||
"text": "Database 1",
|
|
||||||
},
|
|
||||||
Object {
|
|
||||||
"key": "db2",
|
|
||||||
"text": "Database 2",
|
|
||||||
},
|
|
||||||
Object {
|
|
||||||
"key": "db3",
|
|
||||||
"text": "Database 3",
|
|
||||||
},
|
|
||||||
]
|
|
||||||
}
|
|
||||||
selectedKey="db2"
|
|
||||||
styles={
|
|
||||||
Object {
|
|
||||||
"dropdown": Object {
|
|
||||||
"color": "#393939",
|
|
||||||
"fontFamily": "wf_segoe-ui_normal, 'Segoe UI', 'Segoe WP', Tahoma, Arial, sans-serif",
|
|
||||||
"fontSize": 12,
|
|
||||||
},
|
|
||||||
"root": Object {
|
|
||||||
"width": 400,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/>
|
/>
|
||||||
</Stack>
|
</StyledLabelBase>
|
||||||
|
<StyledWithResponsiveMode
|
||||||
|
aria-labelledby="database-label"
|
||||||
|
id="database-dropdown-input"
|
||||||
|
onChange={[Function]}
|
||||||
|
options={
|
||||||
|
Array [
|
||||||
|
Object {
|
||||||
|
"key": "db1",
|
||||||
|
"text": "Database 1",
|
||||||
|
},
|
||||||
|
Object {
|
||||||
|
"key": "db2",
|
||||||
|
"text": "Database 2",
|
||||||
|
},
|
||||||
|
Object {
|
||||||
|
"key": "db3",
|
||||||
|
"text": "Database 3",
|
||||||
|
},
|
||||||
|
]
|
||||||
|
}
|
||||||
|
selectedKey="db2"
|
||||||
|
styles={
|
||||||
|
Object {
|
||||||
|
"dropdown": Object {
|
||||||
|
"color": "#393939",
|
||||||
|
"fontFamily": "wf_segoe-ui_normal, 'Segoe UI', 'Segoe WP', Tahoma, Arial, sans-serif",
|
||||||
|
"fontSize": 12,
|
||||||
|
},
|
||||||
|
"root": Object {
|
||||||
|
"width": 400,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/>
|
||||||
</Stack>
|
</Stack>
|
||||||
</StackItem>
|
</StackItem>
|
||||||
</Stack>
|
</Stack>
|
||||||
|
|||||||
@@ -1,20 +0,0 @@
|
|||||||
@import "../../../../less/Common/Constants";
|
|
||||||
|
|
||||||
.throughputInputContainer {
|
|
||||||
.throughputInputRadioBtn {
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.throughputInputRadioBtnLabel {
|
|
||||||
font-size: @mediumFontSize;
|
|
||||||
padding: 0 @LargeSpace 0 @SmallSpace;
|
|
||||||
}
|
|
||||||
|
|
||||||
.throughputInputSpacing {
|
|
||||||
margin-bottom: @SmallSpace;
|
|
||||||
|
|
||||||
& > * {
|
|
||||||
margin-bottom: @SmallSpace;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,302 +0,0 @@
|
|||||||
import { Checkbox, DirectionalHint, Icon, Link, Stack, Text, TextField, TooltipHost } from "office-ui-fabric-react";
|
|
||||||
import React from "react";
|
|
||||||
import * as Constants from "../../../Common/Constants";
|
|
||||||
import * as SharedConstants from "../../../Shared/Constants";
|
|
||||||
import { userContext } from "../../../UserContext";
|
|
||||||
import * as AutoPilotUtils from "../../../Utils/AutoPilotUtils";
|
|
||||||
import * as PricingUtils from "../../../Utils/PricingUtils";
|
|
||||||
|
|
||||||
export interface ThroughputInputProps {
|
|
||||||
isDatabase: boolean;
|
|
||||||
showFreeTierExceedThroughputTooltip: boolean;
|
|
||||||
setThroughputValue: (throughput: number) => void;
|
|
||||||
setIsAutoscale: (isAutoscale: boolean) => void;
|
|
||||||
onCostAcknowledgeChange: (isAcknowledged: boolean) => void;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ThroughputInputState {
|
|
||||||
isAutoscaleSelected: boolean;
|
|
||||||
throughput: number;
|
|
||||||
isCostAcknowledged: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
export class ThroughputInput extends React.Component<ThroughputInputProps, ThroughputInputState> {
|
|
||||||
constructor(props: ThroughputInputProps) {
|
|
||||||
super(props);
|
|
||||||
|
|
||||||
this.state = {
|
|
||||||
isAutoscaleSelected: true,
|
|
||||||
throughput: AutoPilotUtils.minAutoPilotThroughput,
|
|
||||||
isCostAcknowledged: false,
|
|
||||||
};
|
|
||||||
|
|
||||||
this.props.setThroughputValue(AutoPilotUtils.minAutoPilotThroughput);
|
|
||||||
this.props.setIsAutoscale(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
render(): JSX.Element {
|
|
||||||
return (
|
|
||||||
<div className="throughputInputContainer throughputInputSpacing">
|
|
||||||
<Stack horizontal>
|
|
||||||
<span className="mandatoryStar">* </span>
|
|
||||||
<Text variant="small" style={{ lineHeight: "20px" }}>
|
|
||||||
{this.getThroughputLabelText()}
|
|
||||||
</Text>
|
|
||||||
<TooltipHost directionalHint={DirectionalHint.bottomLeftEdge} content={PricingUtils.getRuToolTipText()}>
|
|
||||||
<Icon iconName="InfoSolid" className="panelInfoIcon" />
|
|
||||||
</TooltipHost>
|
|
||||||
</Stack>
|
|
||||||
|
|
||||||
<Stack horizontal verticalAlign="center">
|
|
||||||
<input
|
|
||||||
className="throughputInputRadioBtn"
|
|
||||||
aria-label="Autoscale mode"
|
|
||||||
checked={this.state.isAutoscaleSelected}
|
|
||||||
type="radio"
|
|
||||||
role="radio"
|
|
||||||
tabIndex={0}
|
|
||||||
onChange={this.onAutoscaleRadioBtnChange.bind(this)}
|
|
||||||
/>
|
|
||||||
<span className="throughputInputRadioBtnLabel">Autoscale</span>
|
|
||||||
|
|
||||||
<input
|
|
||||||
className="throughputInputRadioBtn"
|
|
||||||
aria-label="Manual mode"
|
|
||||||
checked={!this.state.isAutoscaleSelected}
|
|
||||||
type="radio"
|
|
||||||
role="radio"
|
|
||||||
tabIndex={0}
|
|
||||||
onChange={this.onManualRadioBtnChange.bind(this)}
|
|
||||||
/>
|
|
||||||
<span className="throughputInputRadioBtnLabel">Manual</span>
|
|
||||||
</Stack>
|
|
||||||
|
|
||||||
{this.state.isAutoscaleSelected && (
|
|
||||||
<Stack className="throughputInputSpacing">
|
|
||||||
<Text variant="small">
|
|
||||||
Provision maximum RU/s required by this resource. Estimate your required RU/s with
|
|
||||||
<Link target="_blank" href="https://cosmos.azure.com/capacitycalculator/">
|
|
||||||
capacity calculator
|
|
||||||
</Link>
|
|
||||||
.
|
|
||||||
</Text>
|
|
||||||
|
|
||||||
<Stack horizontal>
|
|
||||||
<Text variant="small" style={{ lineHeight: "20px" }}>
|
|
||||||
Max RU/s
|
|
||||||
</Text>
|
|
||||||
<TooltipHost directionalHint={DirectionalHint.bottomLeftEdge} content={this.getAutoScaleTooltip()}>
|
|
||||||
<Icon iconName="InfoSolid" className="panelInfoIcon" />
|
|
||||||
</TooltipHost>
|
|
||||||
</Stack>
|
|
||||||
|
|
||||||
<TextField
|
|
||||||
type="number"
|
|
||||||
styles={{
|
|
||||||
fieldGroup: { width: 300, height: 27 },
|
|
||||||
field: { fontSize: 12 },
|
|
||||||
}}
|
|
||||||
onChange={(event, newInput?: string) => this.onThroughputValueChange(newInput)}
|
|
||||||
step={AutoPilotUtils.autoPilotIncrementStep}
|
|
||||||
min={AutoPilotUtils.minAutoPilotThroughput}
|
|
||||||
value={this.state.throughput.toString()}
|
|
||||||
aria-label="Max request units per second"
|
|
||||||
required={true}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<Text variant="small">
|
|
||||||
Your {this.props.isDatabase ? "database" : "container"} throughput will automatically scale from{" "}
|
|
||||||
<b>
|
|
||||||
{AutoPilotUtils.getMinRUsBasedOnUserInput(this.state.throughput)} RU/s (10% of max RU/s) -{" "}
|
|
||||||
{this.state.throughput} RU/s
|
|
||||||
</b>{" "}
|
|
||||||
based on usage.
|
|
||||||
</Text>
|
|
||||||
</Stack>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{!this.state.isAutoscaleSelected && (
|
|
||||||
<Stack className="throughputInputSpacing">
|
|
||||||
<Text variant="small">
|
|
||||||
Estimate your required RU/s with
|
|
||||||
<Link target="_blank" href="https://cosmos.azure.com/capacitycalculator/">
|
|
||||||
capacity calculator
|
|
||||||
</Link>
|
|
||||||
.
|
|
||||||
</Text>
|
|
||||||
|
|
||||||
<TooltipHost
|
|
||||||
directionalHint={DirectionalHint.topLeftEdge}
|
|
||||||
content={
|
|
||||||
this.props.showFreeTierExceedThroughputTooltip &&
|
|
||||||
this.state.throughput > SharedConstants.CollectionCreation.DefaultCollectionRUs400
|
|
||||||
? "The first 400 RU/s in this account are free. Billing will apply to any throughput beyond 400 RU/s."
|
|
||||||
: undefined
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<TextField
|
|
||||||
type="number"
|
|
||||||
styles={{
|
|
||||||
fieldGroup: { width: 300, height: 27 },
|
|
||||||
field: { fontSize: 12 },
|
|
||||||
}}
|
|
||||||
onChange={(event, newInput?: string) => this.onThroughputValueChange(newInput)}
|
|
||||||
step={100}
|
|
||||||
min={SharedConstants.CollectionCreation.DefaultCollectionRUs400}
|
|
||||||
max={userContext.isTryCosmosDBSubscription ? Constants.TryCosmosExperience.maxRU : Infinity}
|
|
||||||
value={this.state.throughput.toString()}
|
|
||||||
aria-label="Max request units per second"
|
|
||||||
required={true}
|
|
||||||
/>
|
|
||||||
</TooltipHost>
|
|
||||||
</Stack>
|
|
||||||
)}
|
|
||||||
|
|
||||||
<CostEstimateText requestUnits={this.state.throughput} isAutoscale={this.state.isAutoscaleSelected} />
|
|
||||||
|
|
||||||
{this.state.throughput > SharedConstants.CollectionCreation.DefaultCollectionRUs100K && (
|
|
||||||
<Stack horizontal verticalAlign="start">
|
|
||||||
<Checkbox
|
|
||||||
checked={this.state.isCostAcknowledged}
|
|
||||||
styles={{
|
|
||||||
checkbox: { width: 12, height: 12 },
|
|
||||||
label: { padding: 0, margin: "4px 4px 0 0" },
|
|
||||||
}}
|
|
||||||
onChange={(ev: React.FormEvent<HTMLElement>, isChecked: boolean) => {
|
|
||||||
this.setState({ isCostAcknowledged: isChecked });
|
|
||||||
this.props.onCostAcknowledgeChange(isChecked);
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
<Text variant="small" style={{ lineHeight: "20px" }}>
|
|
||||||
{this.getCostAcknowledgeText()}
|
|
||||||
</Text>
|
|
||||||
</Stack>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
private getThroughputLabelText(): string {
|
|
||||||
if (this.state.isAutoscaleSelected) {
|
|
||||||
return AutoPilotUtils.getAutoPilotHeaderText();
|
|
||||||
}
|
|
||||||
|
|
||||||
const minRU: string = SharedConstants.CollectionCreation.DefaultCollectionRUs400.toLocaleString();
|
|
||||||
const maxRU: string = userContext.isTryCosmosDBSubscription
|
|
||||||
? Constants.TryCosmosExperience.maxRU.toLocaleString()
|
|
||||||
: "unlimited";
|
|
||||||
return this.state.isAutoscaleSelected
|
|
||||||
? AutoPilotUtils.getAutoPilotHeaderText()
|
|
||||||
: `Throughput (${minRU} - ${maxRU} RU/s)`;
|
|
||||||
}
|
|
||||||
|
|
||||||
private onThroughputValueChange(newInput: string): void {
|
|
||||||
const newThroughput = parseInt(newInput);
|
|
||||||
this.setState({ throughput: newThroughput });
|
|
||||||
this.props.setThroughputValue(newThroughput);
|
|
||||||
}
|
|
||||||
|
|
||||||
private getAutoScaleTooltip(): string {
|
|
||||||
return `After the first ${AutoPilotUtils.getStorageBasedOnUserInput(
|
|
||||||
this.state.throughput
|
|
||||||
)} GB of data stored, the max
|
|
||||||
RU/s will be automatically upgraded based on the new storage value.`;
|
|
||||||
}
|
|
||||||
|
|
||||||
private getCostAcknowledgeText(): string {
|
|
||||||
const databaseAccount = userContext.databaseAccount;
|
|
||||||
if (!databaseAccount || !databaseAccount.properties) {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
const numberOfRegions: number = databaseAccount.properties.readLocations?.length || 1;
|
|
||||||
const multimasterEnabled: boolean = databaseAccount.properties.enableMultipleWriteLocations;
|
|
||||||
|
|
||||||
return PricingUtils.getEstimatedSpendAcknowledgeString(
|
|
||||||
this.state.throughput,
|
|
||||||
userContext.portalEnv,
|
|
||||||
numberOfRegions,
|
|
||||||
multimasterEnabled,
|
|
||||||
this.state.isAutoscaleSelected
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
private onAutoscaleRadioBtnChange(event: React.ChangeEvent<HTMLInputElement>): void {
|
|
||||||
if (event.target.checked && !this.state.isAutoscaleSelected) {
|
|
||||||
this.setState({ isAutoscaleSelected: true, throughput: AutoPilotUtils.minAutoPilotThroughput });
|
|
||||||
this.props.setIsAutoscale(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private onManualRadioBtnChange(event: React.ChangeEvent<HTMLInputElement>): void {
|
|
||||||
if (event.target.checked && this.state.isAutoscaleSelected) {
|
|
||||||
this.setState({
|
|
||||||
isAutoscaleSelected: false,
|
|
||||||
throughput: SharedConstants.CollectionCreation.DefaultCollectionRUs400,
|
|
||||||
});
|
|
||||||
this.props.setIsAutoscale(false);
|
|
||||||
this.props.setThroughputValue(SharedConstants.CollectionCreation.DefaultCollectionRUs400);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
interface CostEstimateTextProps {
|
|
||||||
requestUnits: number;
|
|
||||||
isAutoscale: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
const CostEstimateText: React.FunctionComponent<CostEstimateTextProps> = (props: CostEstimateTextProps) => {
|
|
||||||
const { requestUnits, isAutoscale } = props;
|
|
||||||
const databaseAccount = userContext.databaseAccount;
|
|
||||||
if (!databaseAccount || !databaseAccount.properties) {
|
|
||||||
return <></>;
|
|
||||||
}
|
|
||||||
|
|
||||||
const serverId: string = userContext.portalEnv;
|
|
||||||
const numberOfRegions: number = databaseAccount.properties.readLocations?.length || 1;
|
|
||||||
const multimasterEnabled: boolean = databaseAccount.properties.enableMultipleWriteLocations;
|
|
||||||
const hourlyPrice: number = PricingUtils.computeRUUsagePriceHourly({
|
|
||||||
serverId,
|
|
||||||
requestUnits,
|
|
||||||
numberOfRegions,
|
|
||||||
multimasterEnabled,
|
|
||||||
isAutoscale,
|
|
||||||
});
|
|
||||||
const dailyPrice: number = hourlyPrice * 24;
|
|
||||||
const monthlyPrice: number = hourlyPrice * SharedConstants.hoursInAMonth;
|
|
||||||
const currency: string = PricingUtils.getPriceCurrency(serverId);
|
|
||||||
const currencySign: string = PricingUtils.getCurrencySign(serverId);
|
|
||||||
const multiplier = PricingUtils.getMultimasterMultiplier(numberOfRegions, multimasterEnabled);
|
|
||||||
const pricePerRu = isAutoscale
|
|
||||||
? PricingUtils.getAutoscalePricePerRu(serverId, multiplier) * multiplier
|
|
||||||
: PricingUtils.getPricePerRu(serverId) * multiplier;
|
|
||||||
|
|
||||||
if (isAutoscale) {
|
|
||||||
return (
|
|
||||||
<Text variant="small">
|
|
||||||
Estimated monthly cost ({currency}):{" "}
|
|
||||||
<b>
|
|
||||||
{currencySign + PricingUtils.calculateEstimateNumber(monthlyPrice / 10)} -{" "}
|
|
||||||
{currencySign + PricingUtils.calculateEstimateNumber(monthlyPrice)}{" "}
|
|
||||||
</b>
|
|
||||||
({numberOfRegions + (numberOfRegions === 1 ? " region" : " regions")}, {requestUnits / 10} - {requestUnits}{" "}
|
|
||||||
RU/s, {currencySign + pricePerRu}/RU)
|
|
||||||
</Text>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Text variant="small">
|
|
||||||
Cost ({currency}):{" "}
|
|
||||||
<b>
|
|
||||||
{currencySign + PricingUtils.calculateEstimateNumber(hourlyPrice)} hourly /{" "}
|
|
||||||
{currencySign + PricingUtils.calculateEstimateNumber(dailyPrice)} daily /{" "}
|
|
||||||
{currencySign + PricingUtils.calculateEstimateNumber(monthlyPrice)} monthly{" "}
|
|
||||||
</b>
|
|
||||||
({numberOfRegions + (numberOfRegions === 1 ? " region" : " regions")}, {requestUnits}RU/s,{" "}
|
|
||||||
{currencySign + pricePerRu}/RU)
|
|
||||||
<br />
|
|
||||||
<em>{PricingUtils.estimatedCostDisclaimer}</em>
|
|
||||||
</Text>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
@@ -2,19 +2,22 @@ jest.mock("../Graph/GraphExplorerComponent/GremlinClient");
|
|||||||
jest.mock("../../Common/dataAccess/createCollection");
|
jest.mock("../../Common/dataAccess/createCollection");
|
||||||
jest.mock("../../Common/dataAccess/createDocument");
|
jest.mock("../../Common/dataAccess/createDocument");
|
||||||
import * as ko from "knockout";
|
import * as ko from "knockout";
|
||||||
import Q from "q";
|
|
||||||
import { createDocument } from "../../Common/dataAccess/createDocument";
|
|
||||||
import { DatabaseAccount } from "../../Contracts/DataModels";
|
|
||||||
import * as ViewModels from "../../Contracts/ViewModels";
|
import * as ViewModels from "../../Contracts/ViewModels";
|
||||||
import { updateUserContext } from "../../UserContext";
|
import Q from "q";
|
||||||
import Explorer from "../Explorer";
|
|
||||||
import { ContainerSampleGenerator } from "./ContainerSampleGenerator";
|
import { ContainerSampleGenerator } from "./ContainerSampleGenerator";
|
||||||
|
import { createDocument } from "../../Common/dataAccess/createDocument";
|
||||||
|
import Explorer from "../Explorer";
|
||||||
|
import { updateUserContext } from "../../UserContext";
|
||||||
|
|
||||||
describe("ContainerSampleGenerator", () => {
|
describe("ContainerSampleGenerator", () => {
|
||||||
const createExplorerStub = (database: ViewModels.Database): Explorer => {
|
const createExplorerStub = (database: ViewModels.Database): Explorer => {
|
||||||
const explorerStub = {} as Explorer;
|
const explorerStub = {} as Explorer;
|
||||||
explorerStub.databases = ko.observableArray<ViewModels.Database>([database]);
|
explorerStub.nonSystemDatabases = ko.computed(() => [database]);
|
||||||
|
explorerStub.isPreferredApiGraph = ko.computed<boolean>(() => false);
|
||||||
explorerStub.isPreferredApiMongoDB = ko.computed<boolean>(() => false);
|
explorerStub.isPreferredApiMongoDB = ko.computed<boolean>(() => false);
|
||||||
|
explorerStub.isPreferredApiDocumentDB = ko.computed<boolean>(() => false);
|
||||||
|
explorerStub.isPreferredApiTable = ko.computed<boolean>(() => false);
|
||||||
|
explorerStub.isPreferredApiCassandra = ko.computed<boolean>(() => false);
|
||||||
explorerStub.canExceedMaximumValue = ko.computed<boolean>(() => false);
|
explorerStub.canExceedMaximumValue = ko.computed<boolean>(() => false);
|
||||||
explorerStub.findDatabaseWithId = () => database;
|
explorerStub.findDatabaseWithId = () => database;
|
||||||
explorerStub.refreshAllDatabases = () => Q.resolve();
|
explorerStub.refreshAllDatabases = () => Q.resolve();
|
||||||
@@ -28,7 +31,7 @@ describe("ContainerSampleGenerator", () => {
|
|||||||
it("should insert documents for sql API account", async () => {
|
it("should insert documents for sql API account", async () => {
|
||||||
const sampleCollectionId = "SampleCollection";
|
const sampleCollectionId = "SampleCollection";
|
||||||
const sampleDatabaseId = "SampleDB";
|
const sampleDatabaseId = "SampleDB";
|
||||||
updateUserContext({});
|
|
||||||
const sampleData = {
|
const sampleData = {
|
||||||
databaseId: sampleDatabaseId,
|
databaseId: sampleDatabaseId,
|
||||||
offerThroughput: 400,
|
offerThroughput: 400,
|
||||||
@@ -63,7 +66,7 @@ describe("ContainerSampleGenerator", () => {
|
|||||||
database.findCollectionWithId = () => collection;
|
database.findCollectionWithId = () => collection;
|
||||||
|
|
||||||
const explorerStub = createExplorerStub(database);
|
const explorerStub = createExplorerStub(database);
|
||||||
|
explorerStub.isPreferredApiDocumentDB = ko.computed<boolean>(() => true);
|
||||||
const generator = await ContainerSampleGenerator.createSampleGeneratorAsync(explorerStub);
|
const generator = await ContainerSampleGenerator.createSampleGeneratorAsync(explorerStub);
|
||||||
generator.setData(sampleData);
|
generator.setData(sampleData);
|
||||||
|
|
||||||
@@ -113,13 +116,7 @@ describe("ContainerSampleGenerator", () => {
|
|||||||
collection.databaseId = database.id();
|
collection.databaseId = database.id();
|
||||||
|
|
||||||
const explorerStub = createExplorerStub(database);
|
const explorerStub = createExplorerStub(database);
|
||||||
updateUserContext({
|
explorerStub.isPreferredApiGraph = ko.computed<boolean>(() => true);
|
||||||
databaseAccount: {
|
|
||||||
properties: {
|
|
||||||
capabilities: [{ name: "EnableGremlin" }],
|
|
||||||
},
|
|
||||||
} as DatabaseAccount,
|
|
||||||
});
|
|
||||||
|
|
||||||
const generator = await ContainerSampleGenerator.createSampleGeneratorAsync(explorerStub);
|
const generator = await ContainerSampleGenerator.createSampleGeneratorAsync(explorerStub);
|
||||||
generator.setData(sampleData);
|
generator.setData(sampleData);
|
||||||
@@ -128,45 +125,31 @@ describe("ContainerSampleGenerator", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("should not create any sample for Mongo API account", async () => {
|
it("should not create any sample for Mongo API account", async () => {
|
||||||
const experience = "Sample generation not supported for this API Mongo";
|
const experience = "not supported api";
|
||||||
const explorerStub = createExplorerStub(undefined);
|
const explorerStub = createExplorerStub(undefined);
|
||||||
updateUserContext({
|
explorerStub.isPreferredApiMongoDB = ko.computed<boolean>(() => true);
|
||||||
databaseAccount: {
|
explorerStub.defaultExperience = ko.observable<string>(experience);
|
||||||
properties: {
|
|
||||||
capabilities: [{ name: "EnableMongo" }],
|
|
||||||
},
|
|
||||||
} as DatabaseAccount,
|
|
||||||
});
|
|
||||||
|
|
||||||
// Rejects with error that contains experience
|
// Rejects with error that contains experience
|
||||||
expect(ContainerSampleGenerator.createSampleGeneratorAsync(explorerStub)).rejects.toMatch(experience);
|
expect(ContainerSampleGenerator.createSampleGeneratorAsync(explorerStub)).rejects.toMatch(experience);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should not create any sample for Table API account", async () => {
|
it("should not create any sample for Table API account", async () => {
|
||||||
const experience = "Sample generation not supported for this API Tables";
|
const experience = "not supported api";
|
||||||
const explorerStub = createExplorerStub(undefined);
|
const explorerStub = createExplorerStub(undefined);
|
||||||
updateUserContext({
|
explorerStub.isPreferredApiTable = ko.computed<boolean>(() => true);
|
||||||
databaseAccount: {
|
explorerStub.defaultExperience = ko.observable<string>(experience);
|
||||||
properties: {
|
|
||||||
capabilities: [{ name: "EnableTable" }],
|
|
||||||
},
|
|
||||||
} as DatabaseAccount,
|
|
||||||
});
|
|
||||||
|
|
||||||
// Rejects with error that contains experience
|
// Rejects with error that contains experience
|
||||||
await expect(ContainerSampleGenerator.createSampleGeneratorAsync(explorerStub)).rejects.toMatch(experience);
|
await expect(ContainerSampleGenerator.createSampleGeneratorAsync(explorerStub)).rejects.toMatch(experience);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should not create any sample for Cassandra API account", async () => {
|
it("should not create any sample for Cassandra API account", async () => {
|
||||||
const experience = "Sample generation not supported for this API Cassandra";
|
const experience = "not supported api";
|
||||||
updateUserContext({
|
|
||||||
databaseAccount: {
|
|
||||||
properties: {
|
|
||||||
capabilities: [{ name: "EnableCassandra" }],
|
|
||||||
},
|
|
||||||
} as DatabaseAccount,
|
|
||||||
});
|
|
||||||
const explorerStub = createExplorerStub(undefined);
|
const explorerStub = createExplorerStub(undefined);
|
||||||
|
explorerStub.isPreferredApiCassandra = ko.computed<boolean>(() => true);
|
||||||
|
explorerStub.defaultExperience = ko.observable<string>(experience);
|
||||||
|
|
||||||
// Rejects with error that contains experience
|
// Rejects with error that contains experience
|
||||||
await expect(ContainerSampleGenerator.createSampleGeneratorAsync(explorerStub)).rejects.toMatch(experience);
|
await expect(ContainerSampleGenerator.createSampleGeneratorAsync(explorerStub)).rejects.toMatch(experience);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
import { createCollection } from "../../Common/dataAccess/createCollection";
|
|
||||||
import { createDocument } from "../../Common/dataAccess/createDocument";
|
|
||||||
import * as DataModels from "../../Contracts/DataModels";
|
import * as DataModels from "../../Contracts/DataModels";
|
||||||
import * as ViewModels from "../../Contracts/ViewModels";
|
import * as ViewModels from "../../Contracts/ViewModels";
|
||||||
import { userContext } from "../../UserContext";
|
|
||||||
import * as NotificationConsoleUtils from "../../Utils/NotificationConsoleUtils";
|
|
||||||
import GraphTab from ".././Tabs/GraphTab";
|
import GraphTab from ".././Tabs/GraphTab";
|
||||||
import Explorer from "../Explorer";
|
|
||||||
import { GremlinClient } from "../Graph/GraphExplorerComponent/GremlinClient";
|
import { GremlinClient } from "../Graph/GraphExplorerComponent/GremlinClient";
|
||||||
|
import * as NotificationConsoleUtils from "../../Utils/NotificationConsoleUtils";
|
||||||
|
import Explorer from "../Explorer";
|
||||||
|
import { createCollection } from "../../Common/dataAccess/createCollection";
|
||||||
|
import { createDocument } from "../../Common/dataAccess/createDocument";
|
||||||
|
import { userContext } from "../../UserContext";
|
||||||
|
|
||||||
interface SampleDataFile extends DataModels.CreateCollectionParams {
|
interface SampleDataFile extends DataModels.CreateCollectionParams {
|
||||||
data: any[];
|
data: any[];
|
||||||
@@ -23,16 +23,16 @@ export class ContainerSampleGenerator {
|
|||||||
public static async createSampleGeneratorAsync(container: Explorer): Promise<ContainerSampleGenerator> {
|
public static async createSampleGeneratorAsync(container: Explorer): Promise<ContainerSampleGenerator> {
|
||||||
const generator = new ContainerSampleGenerator(container);
|
const generator = new ContainerSampleGenerator(container);
|
||||||
let dataFileContent: any;
|
let dataFileContent: any;
|
||||||
if (userContext.apiType === "Gremlin") {
|
if (container.isPreferredApiGraph()) {
|
||||||
dataFileContent = await import(
|
dataFileContent = await import(
|
||||||
/* webpackChunkName: "gremlinSampleJsonData" */ "../../../sampleData/gremlinSampleData.json"
|
/* webpackChunkName: "gremlinSampleJsonData" */ "../../../sampleData/gremlinSampleData.json"
|
||||||
);
|
);
|
||||||
} else if (userContext.apiType === "SQL") {
|
} else if (container.isPreferredApiDocumentDB()) {
|
||||||
dataFileContent = await import(
|
dataFileContent = await import(
|
||||||
/* webpackChunkName: "sqlSampleJsonData" */ "../../../sampleData/sqlSampleData.json"
|
/* webpackChunkName: "sqlSampleJsonData" */ "../../../sampleData/sqlSampleData.json"
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return Promise.reject(`Sample generation not supported for this API ${userContext.apiType}`);
|
return Promise.reject(`Sample generation not supported for this API ${container.defaultExperience()}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
generator.setData(dataFileContent);
|
generator.setData(dataFileContent);
|
||||||
@@ -73,7 +73,7 @@ export class ContainerSampleGenerator {
|
|||||||
}
|
}
|
||||||
const promises: Q.Promise<any>[] = [];
|
const promises: Q.Promise<any>[] = [];
|
||||||
|
|
||||||
if (userContext.apiType === "Gremlin") {
|
if (this.container.isPreferredApiGraph()) {
|
||||||
// For Gremlin, all queries are executed sequentially, because some queries might be dependent on other queries
|
// For Gremlin, all queries are executed sequentially, because some queries might be dependent on other queries
|
||||||
// (e.g. adding edge requires vertices to be present)
|
// (e.g. adding edge requires vertices to be present)
|
||||||
const queries: string[] = this.sampleDataFile.data;
|
const queries: string[] = this.sampleDataFile.data;
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import * as ko from "knockout";
|
|
||||||
import * as sinon from "sinon";
|
|
||||||
import { Collection, Database } from "../../Contracts/ViewModels";
|
|
||||||
import Explorer from "../Explorer";
|
|
||||||
import { ContainerSampleGenerator } from "./ContainerSampleGenerator";
|
|
||||||
import { DataSamplesUtil } from "./DataSamplesUtil";
|
import { DataSamplesUtil } from "./DataSamplesUtil";
|
||||||
|
import * as sinon from "sinon";
|
||||||
|
import { ContainerSampleGenerator } from "./ContainerSampleGenerator";
|
||||||
|
import * as ko from "knockout";
|
||||||
|
import Explorer from "../Explorer";
|
||||||
|
import { Database, Collection } from "../../Contracts/ViewModels";
|
||||||
|
|
||||||
describe("DataSampleUtils", () => {
|
describe("DataSampleUtils", () => {
|
||||||
const sampleCollectionId = "sampleCollectionId";
|
const sampleCollectionId = "sampleCollectionId";
|
||||||
@@ -16,7 +16,7 @@ describe("DataSampleUtils", () => {
|
|||||||
collections: ko.observableArray<Collection>([collection]),
|
collections: ko.observableArray<Collection>([collection]),
|
||||||
} as Database;
|
} as Database;
|
||||||
const explorer = {} as Explorer;
|
const explorer = {} as Explorer;
|
||||||
explorer.databases = ko.observableArray<Database>([database]);
|
explorer.nonSystemDatabases = ko.computed(() => [database]);
|
||||||
explorer.showOkModalDialog = () => {};
|
explorer.showOkModalDialog = () => {};
|
||||||
const dataSamplesUtil = new DataSamplesUtil(explorer);
|
const dataSamplesUtil = new DataSamplesUtil(explorer);
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import * as ViewModels from "../../Contracts/ViewModels";
|
import * as ViewModels from "../../Contracts/ViewModels";
|
||||||
import { userContext } from "../../UserContext";
|
|
||||||
import { logConsoleError, logConsoleInfo } from "../../Utils/NotificationConsoleUtils";
|
|
||||||
import Explorer from "../Explorer";
|
|
||||||
import { ContainerSampleGenerator } from "./ContainerSampleGenerator";
|
import { ContainerSampleGenerator } from "./ContainerSampleGenerator";
|
||||||
|
import * as NotificationConsoleUtils from "../../Utils/NotificationConsoleUtils";
|
||||||
|
import { ConsoleDataType } from "../Menus/NotificationConsole/NotificationConsoleComponent";
|
||||||
|
import Explorer from "../Explorer";
|
||||||
|
|
||||||
export class DataSamplesUtil {
|
export class DataSamplesUtil {
|
||||||
private static readonly DialogTitle = "Create Sample Container";
|
private static readonly DialogTitle = "Create Sample Container";
|
||||||
@@ -17,19 +17,21 @@ export class DataSamplesUtil {
|
|||||||
|
|
||||||
const databaseName = generator.getDatabaseId();
|
const databaseName = generator.getDatabaseId();
|
||||||
const containerName = generator.getCollectionId();
|
const containerName = generator.getCollectionId();
|
||||||
if (this.hasContainer(databaseName, containerName, this.container.databases())) {
|
if (this.hasContainer(databaseName, containerName, this.container.nonSystemDatabases())) {
|
||||||
const msg = `The container ${containerName} in database ${databaseName} already exists. Please delete it and retry.`;
|
const msg = `The container ${containerName} in database ${databaseName} already exists. Please delete it and retry.`;
|
||||||
this.container.showOkModalDialog(DataSamplesUtil.DialogTitle, msg);
|
this.container.showOkModalDialog(DataSamplesUtil.DialogTitle, msg);
|
||||||
logConsoleError(msg);
|
NotificationConsoleUtils.logConsoleMessage(ConsoleDataType.Error, msg);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
await generator
|
await generator
|
||||||
.createSampleContainerAsync()
|
.createSampleContainerAsync()
|
||||||
.catch((error) => logConsoleError(`Error creating sample container: ${error}`));
|
.catch((error) =>
|
||||||
|
NotificationConsoleUtils.logConsoleMessage(ConsoleDataType.Error, `Error creating sample container: ${error}`)
|
||||||
|
);
|
||||||
const msg = `The sample ${containerName} in database ${databaseName} has been successfully created.`;
|
const msg = `The sample ${containerName} in database ${databaseName} has been successfully created.`;
|
||||||
this.container.showOkModalDialog(DataSamplesUtil.DialogTitle, msg);
|
this.container.showOkModalDialog(DataSamplesUtil.DialogTitle, msg);
|
||||||
logConsoleInfo(msg);
|
NotificationConsoleUtils.logConsoleMessage(ConsoleDataType.Info, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -54,6 +56,6 @@ export class DataSamplesUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public isSampleContainerCreationSupported(): boolean {
|
public isSampleContainerCreationSupported(): boolean {
|
||||||
return userContext.apiType === "SQL" || userContext.apiType === "Gremlin";
|
return this.container.isPreferredApiDocumentDB() || this.container.isPreferredApiGraph();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,43 +0,0 @@
|
|||||||
jest.mock("./../Common/dataAccess/deleteDatabase");
|
|
||||||
jest.mock("./../Shared/Telemetry/TelemetryProcessor");
|
|
||||||
import * as ko from "knockout";
|
|
||||||
import { deleteDatabase } from "./../Common/dataAccess/deleteDatabase";
|
|
||||||
import * as ViewModels from "./../Contracts/ViewModels";
|
|
||||||
import Explorer from "./Explorer";
|
|
||||||
|
|
||||||
describe("Explorer.isLastDatabase() and Explorer.isLastNonEmptyDatabase()", () => {
|
|
||||||
let explorer: Explorer;
|
|
||||||
beforeAll(() => {
|
|
||||||
(deleteDatabase as jest.Mock).mockResolvedValue(undefined);
|
|
||||||
});
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
explorer = new Explorer();
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be true if only 1 database", () => {
|
|
||||||
const database = {} as ViewModels.Database;
|
|
||||||
explorer.databases = ko.observableArray<ViewModels.Database>([database]);
|
|
||||||
expect(explorer.isLastDatabase()).toBe(true);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be false if only 2 databases", () => {
|
|
||||||
const database = {} as ViewModels.Database;
|
|
||||||
const database2 = {} as ViewModels.Database;
|
|
||||||
explorer.databases = ko.observableArray<ViewModels.Database>([database, database2]);
|
|
||||||
expect(explorer.isLastDatabase()).toBe(false);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be false if not last empty database", () => {
|
|
||||||
const database = {} as ViewModels.Database;
|
|
||||||
explorer.databases = ko.observableArray<ViewModels.Database>([database]);
|
|
||||||
expect(explorer.isLastNonEmptyDatabase()).toBe(false);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be true if last non empty database", () => {
|
|
||||||
const database = {} as ViewModels.Database;
|
|
||||||
database.collections = ko.observableArray<ViewModels.Collection>([{} as ViewModels.Collection]);
|
|
||||||
explorer.databases = ko.observableArray<ViewModels.Database>([database]);
|
|
||||||
expect(explorer.isLastNonEmptyDatabase()).toBe(true);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,22 +1,24 @@
|
|||||||
import { BaseType } from "d3";
|
import * as ko from "knockout";
|
||||||
import { map as d3Map } from "d3-collection";
|
|
||||||
import { D3DragEvent, drag } from "d3-drag";
|
|
||||||
import { forceCollide, forceLink, forceManyBody, forceSimulation } from "d3-force";
|
|
||||||
import { interpolate, interpolateNumber } from "d3-interpolate";
|
|
||||||
import { scaleOrdinal } from "d3-scale";
|
|
||||||
import { schemeCategory10 } from "d3-scale-chromatic";
|
|
||||||
import { select, selectAll } from "d3-selection";
|
|
||||||
import { zoom, zoomIdentity } from "d3-zoom";
|
|
||||||
import * as ko from "knockout";
|
|
||||||
import Q from "q";
|
import Q from "q";
|
||||||
|
import { schemeCategory10 } from "d3-scale-chromatic";
|
||||||
|
import { selectAll, select } from "d3-selection";
|
||||||
|
import { zoom, zoomIdentity } from "d3-zoom";
|
||||||
|
import { scaleOrdinal } from "d3-scale";
|
||||||
|
import { forceSimulation, forceLink, forceCollide, forceManyBody } from "d3-force";
|
||||||
|
import { interpolateNumber, interpolate } from "d3-interpolate";
|
||||||
|
import { map as d3Map } from "d3-collection";
|
||||||
|
import { drag, D3DragEvent } from "d3-drag";
|
||||||
|
|
||||||
import _ from "underscore";
|
import _ from "underscore";
|
||||||
import * as Constants from "../../../Common/Constants";
|
|
||||||
import { HashMap } from "../../../Common/HashMap";
|
|
||||||
import { NeighborType } from "../../../Contracts/ViewModels";
|
import { NeighborType } from "../../../Contracts/ViewModels";
|
||||||
import { logConsoleError } from "../../../Utils/NotificationConsoleUtils";
|
import { GraphData, D3Node, D3Link } from "./GraphData";
|
||||||
|
import { HashMap } from "../../../Common/HashMap";
|
||||||
|
import { BaseType } from "d3";
|
||||||
|
import { ConsoleDataType } from "../../Menus/NotificationConsole/NotificationConsoleComponent";
|
||||||
|
import * as NotificationConsoleUtils from "../../../Utils/NotificationConsoleUtils";
|
||||||
import { GraphConfig } from "../../Tabs/GraphTab";
|
import { GraphConfig } from "../../Tabs/GraphTab";
|
||||||
import { D3Link, D3Node, GraphData } from "./GraphData";
|
|
||||||
import { GraphExplorer } from "./GraphExplorer";
|
import { GraphExplorer } from "./GraphExplorer";
|
||||||
|
import * as Constants from "../../../Common/Constants";
|
||||||
|
|
||||||
export interface D3GraphIconMap {
|
export interface D3GraphIconMap {
|
||||||
[key: string]: { data: string; format: string };
|
[key: string]: { data: string; format: string };
|
||||||
@@ -1003,7 +1005,7 @@ export class D3ForceGraph implements GraphRenderer {
|
|||||||
*/
|
*/
|
||||||
private loadNeighbors(v: D3Node, pageAction: PAGE_ACTION) {
|
private loadNeighbors(v: D3Node, pageAction: PAGE_ACTION) {
|
||||||
if (!this.graphDataWrapper.hasVertexId(v.id)) {
|
if (!this.graphDataWrapper.hasVertexId(v.id)) {
|
||||||
logConsoleError(`Clicked node not in graph data. id: ${v.id}`);
|
NotificationConsoleUtils.logConsoleMessage(ConsoleDataType.Error, `Clicked node not in graph data. id: ${v.id}`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,36 +1,37 @@
|
|||||||
import { FeedOptions, ItemDefinition, QueryIterator, Resource } from "@azure/cosmos";
|
|
||||||
import * as Q from "q";
|
import * as Q from "q";
|
||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
|
import * as LeftPane from "./LeftPaneComponent";
|
||||||
|
import { MiddlePaneComponent } from "./MiddlePaneComponent";
|
||||||
|
import * as InputTypeaheadComponent from "../../Controls/InputTypeahead/InputTypeaheadComponent";
|
||||||
|
import * as NodeProperties from "./NodePropertiesComponent";
|
||||||
|
import * as D3ForceGraph from "./D3ForceGraph";
|
||||||
|
import { GraphVizComponentProps } from "./GraphVizComponent";
|
||||||
|
import * as GraphData from "./GraphData";
|
||||||
|
import { ConsoleDataType } from "../../Menus/NotificationConsole/NotificationConsoleComponent";
|
||||||
|
import * as NotificationConsoleUtils from "../../../Utils/NotificationConsoleUtils";
|
||||||
|
import * as GraphUtil from "./GraphUtil";
|
||||||
|
import * as DataModels from "../../../Contracts/DataModels";
|
||||||
|
import * as ViewModels from "../../../Contracts/ViewModels";
|
||||||
|
import * as GremlinClient from "./GremlinClient";
|
||||||
|
import * as StorageUtility from "../../../Shared/StorageUtility";
|
||||||
|
import { ArraysByKeyCache } from "./ArraysByKeyCache";
|
||||||
|
import { EdgeInfoCache } from "./EdgeInfoCache";
|
||||||
|
import * as TabComponent from "../../Controls/Tabs/TabComponent";
|
||||||
|
import { LocalStorageUtility, StorageKey } from "../../../Shared/StorageUtility";
|
||||||
|
import { QueryContainerComponent } from "./QueryContainerComponent";
|
||||||
|
import { GraphConfig } from "../../Tabs/GraphTab";
|
||||||
|
import { EditorReact } from "../../Controls/Editor/EditorReact";
|
||||||
import LoadGraphIcon from "../../../../images/LoadGraph.png";
|
import LoadGraphIcon from "../../../../images/LoadGraph.png";
|
||||||
import LoadingIndicatorIcon from "../../../../images/LoadingIndicator_3Squares.gif";
|
import { Action } from "../../../Shared/Telemetry/TelemetryConstants";
|
||||||
|
import * as TelemetryProcessor from "../../../Shared/Telemetry/TelemetryProcessor";
|
||||||
import * as Constants from "../../../Common/Constants";
|
import * as Constants from "../../../Common/Constants";
|
||||||
|
import { InputProperty } from "../../../Contracts/ViewModels";
|
||||||
|
import { QueryIterator, ItemDefinition, Resource } from "@azure/cosmos";
|
||||||
|
import LoadingIndicatorIcon from "../../../../images/LoadingIndicator_3Squares.gif";
|
||||||
import { queryDocuments } from "../../../Common/dataAccess/queryDocuments";
|
import { queryDocuments } from "../../../Common/dataAccess/queryDocuments";
|
||||||
import { queryDocumentsPage } from "../../../Common/dataAccess/queryDocumentsPage";
|
import { queryDocumentsPage } from "../../../Common/dataAccess/queryDocumentsPage";
|
||||||
import { getErrorMessage } from "../../../Common/ErrorHandlingUtils";
|
import { getErrorMessage } from "../../../Common/ErrorHandlingUtils";
|
||||||
import * as DataModels from "../../../Contracts/DataModels";
|
import { FeedOptions } from "@azure/cosmos";
|
||||||
import * as ViewModels from "../../../Contracts/ViewModels";
|
|
||||||
import { InputProperty } from "../../../Contracts/ViewModels";
|
|
||||||
import * as StorageUtility from "../../../Shared/StorageUtility";
|
|
||||||
import { LocalStorageUtility, StorageKey } from "../../../Shared/StorageUtility";
|
|
||||||
import { Action } from "../../../Shared/Telemetry/TelemetryConstants";
|
|
||||||
import * as TelemetryProcessor from "../../../Shared/Telemetry/TelemetryProcessor";
|
|
||||||
import { logConsoleError, logConsoleInfo, logConsoleProgress } from "../../../Utils/NotificationConsoleUtils";
|
|
||||||
import { EditorReact } from "../../Controls/Editor/EditorReact";
|
|
||||||
import * as InputTypeaheadComponent from "../../Controls/InputTypeahead/InputTypeaheadComponent";
|
|
||||||
import * as TabComponent from "../../Controls/Tabs/TabComponent";
|
|
||||||
import { ConsoleDataType } from "../../Menus/NotificationConsole/NotificationConsoleComponent";
|
|
||||||
import { GraphConfig } from "../../Tabs/GraphTab";
|
|
||||||
import { ArraysByKeyCache } from "./ArraysByKeyCache";
|
|
||||||
import * as D3ForceGraph from "./D3ForceGraph";
|
|
||||||
import { EdgeInfoCache } from "./EdgeInfoCache";
|
|
||||||
import * as GraphData from "./GraphData";
|
|
||||||
import * as GraphUtil from "./GraphUtil";
|
|
||||||
import { GraphVizComponentProps } from "./GraphVizComponent";
|
|
||||||
import * as GremlinClient from "./GremlinClient";
|
|
||||||
import * as LeftPane from "./LeftPaneComponent";
|
|
||||||
import { MiddlePaneComponent } from "./MiddlePaneComponent";
|
|
||||||
import * as NodeProperties from "./NodePropertiesComponent";
|
|
||||||
import { QueryContainerComponent } from "./QueryContainerComponent";
|
|
||||||
|
|
||||||
export interface GraphAccessor {
|
export interface GraphAccessor {
|
||||||
applyFilter: () => void;
|
applyFilter: () => void;
|
||||||
@@ -696,13 +697,13 @@ export class GraphExplorer extends React.Component<GraphExplorerProps, GraphExpl
|
|||||||
* @param cmd
|
* @param cmd
|
||||||
*/
|
*/
|
||||||
public submitToBackend(cmd: string): Q.Promise<GremlinClient.GremlinRequestResult> {
|
public submitToBackend(cmd: string): Q.Promise<GremlinClient.GremlinRequestResult> {
|
||||||
const clearConsoleProgress = GraphExplorer.reportToConsole(ConsoleDataType.InProgress, `Executing: ${cmd}`);
|
const id = GraphExplorer.reportToConsole(ConsoleDataType.InProgress, `Executing: ${cmd}`);
|
||||||
this.setExecuteCounter(this.executeCounter + 1);
|
this.setExecuteCounter(this.executeCounter + 1);
|
||||||
|
|
||||||
return this.gremlinClient.execute(cmd).then(
|
return this.gremlinClient.execute(cmd).then(
|
||||||
(result: GremlinClient.GremlinRequestResult) => {
|
(result: GremlinClient.GremlinRequestResult) => {
|
||||||
this.setExecuteCounter(this.executeCounter - 1);
|
this.setExecuteCounter(this.executeCounter - 1);
|
||||||
clearConsoleProgress();
|
GraphExplorer.clearConsoleProgress(id);
|
||||||
if (result.isIncomplete) {
|
if (result.isIncomplete) {
|
||||||
const msg = `The query results are too large and only partial results are displayed for: ${cmd}`;
|
const msg = `The query results are too large and only partial results are displayed for: ${cmd}`;
|
||||||
GraphExplorer.reportToConsole(ConsoleDataType.Error, msg);
|
GraphExplorer.reportToConsole(ConsoleDataType.Error, msg);
|
||||||
@@ -717,7 +718,7 @@ export class GraphExplorer extends React.Component<GraphExplorerProps, GraphExpl
|
|||||||
(err: string) => {
|
(err: string) => {
|
||||||
this.setExecuteCounter(this.executeCounter - 1);
|
this.setExecuteCounter(this.executeCounter - 1);
|
||||||
GraphExplorer.reportToConsole(ConsoleDataType.Error, `Gremlin query failed: ${cmd}`, err);
|
GraphExplorer.reportToConsole(ConsoleDataType.Error, `Gremlin query failed: ${cmd}`, err);
|
||||||
clearConsoleProgress();
|
GraphExplorer.clearConsoleProgress(id);
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@@ -1082,26 +1083,13 @@ export class GraphExplorer extends React.Component<GraphExplorerProps, GraphExpl
|
|||||||
* @param errorData additional errors
|
* @param errorData additional errors
|
||||||
* @return id
|
* @return id
|
||||||
*/
|
*/
|
||||||
public static reportToConsole(type: ConsoleDataType.InProgress, msg: string, ...errorData: any[]): () => void;
|
public static reportToConsole(type: ConsoleDataType, msg: string, ...errorData: any[]): string {
|
||||||
public static reportToConsole(type: ConsoleDataType.Info, msg: string, ...errorData: any[]): void;
|
|
||||||
public static reportToConsole(type: ConsoleDataType.Error, msg: string, ...errorData: any[]): void;
|
|
||||||
public static reportToConsole(type: ConsoleDataType, msg: string, ...errorData: any[]): void | (() => void) {
|
|
||||||
let errorDataStr: string = "";
|
let errorDataStr: string = "";
|
||||||
if (errorData && errorData.length > 0) {
|
if (errorData && errorData.length > 0) {
|
||||||
console.error(msg, errorData);
|
console.error(msg, errorData);
|
||||||
errorDataStr = ": " + JSON.stringify(errorData);
|
errorDataStr = ": " + JSON.stringify(errorData);
|
||||||
}
|
}
|
||||||
|
return NotificationConsoleUtils.logConsoleMessage(type, `${msg}${errorDataStr}`);
|
||||||
const consoleMessage = `${msg}${errorDataStr}`;
|
|
||||||
|
|
||||||
switch (type) {
|
|
||||||
case ConsoleDataType.Error:
|
|
||||||
return logConsoleError(consoleMessage);
|
|
||||||
case ConsoleDataType.Info:
|
|
||||||
return logConsoleInfo(consoleMessage);
|
|
||||||
case ConsoleDataType.InProgress:
|
|
||||||
return logConsoleProgress(consoleMessage);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private setNodePropertiesViewMode(viewMode: NodeProperties.Mode) {
|
private setNodePropertiesViewMode(viewMode: NodeProperties.Mode) {
|
||||||
@@ -1380,7 +1368,7 @@ export class GraphExplorer extends React.Component<GraphExplorerProps, GraphExpl
|
|||||||
let { id } = d;
|
let { id } = d;
|
||||||
if (typeof id !== "string") {
|
if (typeof id !== "string") {
|
||||||
const error = `Vertex id is not a string: ${JSON.stringify(id)}.`;
|
const error = `Vertex id is not a string: ${JSON.stringify(id)}.`;
|
||||||
logConsoleError(error);
|
NotificationConsoleUtils.logConsoleMessage(ConsoleDataType.Error, error);
|
||||||
throw new Error(error);
|
throw new Error(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1392,7 +1380,7 @@ export class GraphExplorer extends React.Component<GraphExplorerProps, GraphExpl
|
|||||||
pk = pk[0]["_value"];
|
pk = pk[0]["_value"];
|
||||||
} else {
|
} else {
|
||||||
const error = `Vertex pk is not a string nor a non-empty array: ${JSON.stringify(pk)}.`;
|
const error = `Vertex pk is not a string nor a non-empty array: ${JSON.stringify(pk)}.`;
|
||||||
logConsoleError(error);
|
NotificationConsoleUtils.logConsoleMessage(ConsoleDataType.Error, error);
|
||||||
throw new Error(error);
|
throw new Error(error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1779,10 +1767,7 @@ export class GraphExplorer extends React.Component<GraphExplorerProps, GraphExpl
|
|||||||
const queryInfoStr = `${this.currentDocDBQueryInfo.query} (${this.currentDocDBQueryInfo.index + 1}-${
|
const queryInfoStr = `${this.currentDocDBQueryInfo.query} (${this.currentDocDBQueryInfo.index + 1}-${
|
||||||
this.currentDocDBQueryInfo.index + GraphExplorer.ROOT_LIST_PAGE_SIZE
|
this.currentDocDBQueryInfo.index + GraphExplorer.ROOT_LIST_PAGE_SIZE
|
||||||
})`;
|
})`;
|
||||||
const clearConsoleProgress = GraphExplorer.reportToConsole(
|
const id = GraphExplorer.reportToConsole(ConsoleDataType.InProgress, `Executing: ${queryInfoStr}`);
|
||||||
ConsoleDataType.InProgress,
|
|
||||||
`Executing: ${queryInfoStr}`
|
|
||||||
);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const results: ViewModels.QueryResults = await queryDocumentsPage(
|
const results: ViewModels.QueryResults = await queryDocumentsPage(
|
||||||
@@ -1791,7 +1776,7 @@ export class GraphExplorer extends React.Component<GraphExplorerProps, GraphExpl
|
|||||||
this.currentDocDBQueryInfo.index
|
this.currentDocDBQueryInfo.index
|
||||||
);
|
);
|
||||||
|
|
||||||
clearConsoleProgress();
|
GraphExplorer.clearConsoleProgress(id);
|
||||||
this.currentDocDBQueryInfo.index = results.lastItemIndex + 1;
|
this.currentDocDBQueryInfo.index = results.lastItemIndex + 1;
|
||||||
this.setState({ hasMoreRoots: results.hasMoreResults });
|
this.setState({ hasMoreRoots: results.hasMoreResults });
|
||||||
RU = results.requestCharge.toString();
|
RU = results.requestCharge.toString();
|
||||||
@@ -1808,7 +1793,7 @@ export class GraphExplorer extends React.Component<GraphExplorerProps, GraphExpl
|
|||||||
|
|
||||||
return { requestCharge: RU };
|
return { requestCharge: RU };
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
clearConsoleProgress();
|
GraphExplorer.clearConsoleProgress(id);
|
||||||
const errorMsg = `Failed to query: ${this.currentDocDBQueryInfo.query}. Reason:${getErrorMessage(error)}`;
|
const errorMsg = `Failed to query: ${this.currentDocDBQueryInfo.query}. Reason:${getErrorMessage(error)}`;
|
||||||
GraphExplorer.reportToConsole(ConsoleDataType.Error, errorMsg);
|
GraphExplorer.reportToConsole(ConsoleDataType.Error, errorMsg);
|
||||||
this.setState({
|
this.setState({
|
||||||
@@ -2018,4 +2003,8 @@ export class GraphExplorer extends React.Component<GraphExplorerProps, GraphExpl
|
|||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static clearConsoleProgress(id: string) {
|
||||||
|
NotificationConsoleUtils.clearInProgressMessageWithId(id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user