mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-23 10:51:30 +00:00
Compare commits
1 Commits
release/mo
...
revert-173
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
00c05fce8a |
@@ -1,10 +0,0 @@
|
|||||||
# NOTE: Prettier reads EditorConfig settings, so be careful adjusting settings here and assuming they'll only affect your editor ;).
|
|
||||||
|
|
||||||
# top-most EditorConfig file
|
|
||||||
root = true
|
|
||||||
|
|
||||||
[*.yml]
|
|
||||||
indent_size = 2
|
|
||||||
|
|
||||||
[*.{js,jsx,ts,tsx}]
|
|
||||||
indent_size = 2
|
|
||||||
@@ -1,5 +1,3 @@
|
|||||||
playwright.config.ts
|
|
||||||
|
|
||||||
**/node_modules/
|
**/node_modules/
|
||||||
src/**/__mocks__/**/*
|
src/**/__mocks__/**/*
|
||||||
dist/
|
dist/
|
||||||
@@ -91,7 +89,10 @@ src/Explorer/Tables/TableEntityProcessor.ts
|
|||||||
src/Explorer/Tables/Utilities.ts
|
src/Explorer/Tables/Utilities.ts
|
||||||
src/Explorer/Tabs/ConflictsTab.ts
|
src/Explorer/Tabs/ConflictsTab.ts
|
||||||
src/Explorer/Tabs/DatabaseSettingsTab.ts
|
src/Explorer/Tabs/DatabaseSettingsTab.ts
|
||||||
|
src/Explorer/Tabs/DocumentsTab.test.ts
|
||||||
|
src/Explorer/Tabs/DocumentsTab.ts
|
||||||
src/Explorer/Tabs/GraphTab.ts
|
src/Explorer/Tabs/GraphTab.ts
|
||||||
|
src/Explorer/Tabs/MongoDocumentsTab.ts
|
||||||
src/Explorer/Tabs/NotebookV2Tab.ts
|
src/Explorer/Tabs/NotebookV2Tab.ts
|
||||||
src/Explorer/Tabs/ScriptTabBase.ts
|
src/Explorer/Tabs/ScriptTabBase.ts
|
||||||
src/Explorer/Tabs/TabComponents.ts
|
src/Explorer/Tabs/TabComponents.ts
|
||||||
@@ -127,7 +128,7 @@ src/Explorer/Controls/InputTypeahead/InputTypeaheadComponent.tsx
|
|||||||
src/Explorer/Controls/Notebook/NotebookTerminalComponent.test.tsx
|
src/Explorer/Controls/Notebook/NotebookTerminalComponent.test.tsx
|
||||||
src/Explorer/Controls/Notebook/NotebookTerminalComponent.tsx
|
src/Explorer/Controls/Notebook/NotebookTerminalComponent.tsx
|
||||||
src/Explorer/Controls/NotebookViewer/NotebookViewerComponent.tsx
|
src/Explorer/Controls/NotebookViewer/NotebookViewerComponent.tsx
|
||||||
src/Explorer/Controls/TreeComponent/LegacyTreeComponent.tsx
|
src/Explorer/Controls/TreeComponent/TreeComponent.tsx
|
||||||
src/Explorer/Graph/GraphExplorerComponent/GraphExplorer.test.tsx
|
src/Explorer/Graph/GraphExplorerComponent/GraphExplorer.test.tsx
|
||||||
src/Explorer/Graph/GraphExplorerComponent/NodePropertiesComponent.tsx
|
src/Explorer/Graph/GraphExplorerComponent/NodePropertiesComponent.tsx
|
||||||
src/Explorer/Graph/GraphExplorerComponent/ReadOnlyNodePropertiesComponent.test.tsx
|
src/Explorer/Graph/GraphExplorerComponent/ReadOnlyNodePropertiesComponent.test.tsx
|
||||||
|
|||||||
136
.github/workflows/ci.yml
vendored
136
.github/workflows/ci.yml
vendored
@@ -8,9 +8,6 @@ on:
|
|||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches:
|
||||||
- master
|
- master
|
||||||
permissions:
|
|
||||||
id-token: write
|
|
||||||
contents: read
|
|
||||||
jobs:
|
jobs:
|
||||||
codemetrics:
|
codemetrics:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@@ -104,6 +101,72 @@ jobs:
|
|||||||
run: az storage blob upload -c '$web' -f ./preview/config.json --account-name cosmosexplorerpreview --name "${{github.event.pull_request.head.sha || github.sha}}/config.json" --account-key="${PREVIEW_STORAGE_KEY}" --overwrite true
|
run: az storage blob upload -c '$web' -f ./preview/config.json --account-name cosmosexplorerpreview --name "${{github.event.pull_request.head.sha || github.sha}}/config.json" --account-key="${PREVIEW_STORAGE_KEY}" --overwrite true
|
||||||
env:
|
env:
|
||||||
PREVIEW_STORAGE_KEY: ${{ secrets.PREVIEW_STORAGE_KEY }}
|
PREVIEW_STORAGE_KEY: ${{ secrets.PREVIEW_STORAGE_KEY }}
|
||||||
|
endtoendemulator:
|
||||||
|
name: "End To End Emulator Tests"
|
||||||
|
# Temporarily disabled. This test needs to be rewritten in playwright
|
||||||
|
if: false
|
||||||
|
runs-on: windows-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Use Node.js 18.x
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: 18.x
|
||||||
|
- uses: southpolesteve/cosmos-emulator-github-action@v1
|
||||||
|
- name: End to End Tests
|
||||||
|
run: |
|
||||||
|
npm ci
|
||||||
|
npm start &
|
||||||
|
npm run wait-for-server
|
||||||
|
npx jest -c ./jest.config.e2e.js --detectOpenHandles test/sql/container.spec.ts
|
||||||
|
shell: bash
|
||||||
|
env:
|
||||||
|
DATA_EXPLORER_ENDPOINT: "https://localhost:1234/explorer.html?platform=Emulator"
|
||||||
|
PLATFORM: "Emulator"
|
||||||
|
NODE_TLS_REJECT_UNAUTHORIZED: 0
|
||||||
|
- uses: actions/upload-artifact@v3
|
||||||
|
if: failure()
|
||||||
|
with:
|
||||||
|
name: screenshots
|
||||||
|
path: failed-*
|
||||||
|
endtoend:
|
||||||
|
name: "E2E"
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
NODE_TLS_REJECT_UNAUTHORIZED: 0
|
||||||
|
NOTEBOOKS_TEST_RUNNER_CLIENT_SECRET: ${{ secrets.NOTEBOOKS_TEST_RUNNER_CLIENT_SECRET }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
test-file:
|
||||||
|
- ./test/cassandra/container.spec.ts
|
||||||
|
- ./test/graph/container.spec.ts
|
||||||
|
- ./test/sql/container.spec.ts
|
||||||
|
- ./test/mongo/container.spec.ts
|
||||||
|
- ./test/mongo/container32.spec.ts
|
||||||
|
- ./test/selfServe/selfServeExample.spec.ts
|
||||||
|
# - ./test/notebooks/upload.spec.ts // TEMP disabled since notebooks service is off
|
||||||
|
- ./test/sql/resourceToken.spec.ts
|
||||||
|
- ./test/tables/container.spec.ts
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Use Node.js 18.x
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: 18.x
|
||||||
|
- run: npm ci
|
||||||
|
- run: npm start &
|
||||||
|
- run: npm run wait-for-server
|
||||||
|
- name: ${{ matrix['test-file'] }}
|
||||||
|
run: |
|
||||||
|
# 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
|
||||||
|
- uses: actions/upload-artifact@v3
|
||||||
|
if: failure()
|
||||||
|
with:
|
||||||
|
name: screenshots
|
||||||
|
path: screenshots/
|
||||||
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/')
|
||||||
@@ -153,70 +216,3 @@ jobs:
|
|||||||
name: packages
|
name: packages
|
||||||
with:
|
with:
|
||||||
path: "*.nupkg"
|
path: "*.nupkg"
|
||||||
|
|
||||||
playwright-tests:
|
|
||||||
name: "Run Playwright Tests (Shard ${{ matrix.shardIndex }} of ${{ matrix.shardTotal }})"
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
env:
|
|
||||||
NODE_TLS_REJECT_UNAUTHORIZED: 0
|
|
||||||
AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
shardIndex: [1, 2, 3, 4, 5, 6, 7, 8]
|
|
||||||
shardTotal: [8]
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- name: "Az CLI login"
|
|
||||||
uses: azure/login@v1
|
|
||||||
with:
|
|
||||||
client-id: ${{ secrets.AZURE_CLIENT_ID }}
|
|
||||||
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
|
|
||||||
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
|
|
||||||
- name: Use Node.js 18.x
|
|
||||||
uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version: 18.x
|
|
||||||
- run: npm ci
|
|
||||||
- run: npx playwright install --with-deps
|
|
||||||
- name: Run test shard ${{ matrix['shardIndex'] }} of ${{ matrix['shardTotal']}}
|
|
||||||
run: npx playwright test --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
|
|
||||||
- name: Upload blob report to GitHub Actions Artifacts
|
|
||||||
if: ${{ !cancelled() }}
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: blob-report-${{ matrix.shardIndex }}
|
|
||||||
path: blob-report
|
|
||||||
retention-days: 1
|
|
||||||
|
|
||||||
merge-playwright-reports:
|
|
||||||
name: "Merge Playwright Reports"
|
|
||||||
# Merge reports after playwright-tests, even if some shards have failed
|
|
||||||
if: ${{ !cancelled() }}
|
|
||||||
needs: [playwright-tests]
|
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version: 18
|
|
||||||
- name: Install dependencies
|
|
||||||
run: npm ci
|
|
||||||
|
|
||||||
- name: Download blob reports from GitHub Actions Artifacts
|
|
||||||
uses: actions/download-artifact@v4
|
|
||||||
with:
|
|
||||||
path: all-blob-reports
|
|
||||||
pattern: blob-report-*
|
|
||||||
merge-multiple: true
|
|
||||||
|
|
||||||
- name: Merge into HTML Report
|
|
||||||
run: npx playwright merge-reports --reporter html ./all-blob-reports
|
|
||||||
|
|
||||||
- name: Upload HTML report
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: html-report--attempt-${{ github.run_attempt }}
|
|
||||||
path: playwright-report
|
|
||||||
retention-days: 14
|
|
||||||
15
.github/workflows/cleanup.yml
vendored
15
.github/workflows/cleanup.yml
vendored
@@ -9,10 +9,6 @@ on:
|
|||||||
# Once every hour
|
# Once every hour
|
||||||
- cron: "0 15 * * *"
|
- cron: "0 15 * * *"
|
||||||
|
|
||||||
permissions:
|
|
||||||
id-token: write
|
|
||||||
contents: read
|
|
||||||
|
|
||||||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
|
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
|
||||||
jobs:
|
jobs:
|
||||||
# This workflow contains a single job called "build"
|
# This workflow contains a single job called "build"
|
||||||
@@ -20,17 +16,10 @@ jobs:
|
|||||||
name: "Cleanup Test Database Accounts"
|
name: "Cleanup Test Database Accounts"
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
env:
|
env:
|
||||||
AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
|
NOTEBOOKS_TEST_RUNNER_CLIENT_ID: ${{ secrets.NOTEBOOKS_TEST_RUNNER_CLIENT_ID }}
|
||||||
|
NOTEBOOKS_TEST_RUNNER_CLIENT_SECRET: ${{ secrets.NOTEBOOKS_TEST_RUNNER_CLIENT_SECRET }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: "Az CLI login"
|
|
||||||
uses: azure/login@v1
|
|
||||||
with:
|
|
||||||
client-id: ${{ secrets.AZURE_CLIENT_ID }}
|
|
||||||
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
|
|
||||||
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
|
|
||||||
|
|
||||||
- name: Use Node.js 18.x
|
- name: Use Node.js 18.x
|
||||||
uses: actions/setup-node@v1
|
uses: actions/setup-node@v1
|
||||||
with:
|
with:
|
||||||
|
|||||||
4
.gitignore
vendored
4
.gitignore
vendored
@@ -17,7 +17,3 @@ Contracts/*
|
|||||||
failure.png
|
failure.png
|
||||||
screenshots/*
|
screenshots/*
|
||||||
GettingStarted-ignore*.ipynb
|
GettingStarted-ignore*.ipynb
|
||||||
/test-results/
|
|
||||||
/playwright-report/
|
|
||||||
/blob-report/
|
|
||||||
/playwright/.cache/
|
|
||||||
|
|||||||
4
.vscode/settings.json
vendored
4
.vscode/settings.json
vendored
@@ -20,8 +20,8 @@
|
|||||||
"typescript.tsdk": "node_modules/typescript/lib",
|
"typescript.tsdk": "node_modules/typescript/lib",
|
||||||
"editor.formatOnSave": true,
|
"editor.formatOnSave": true,
|
||||||
"editor.codeActionsOnSave": {
|
"editor.codeActionsOnSave": {
|
||||||
"source.fixAll.eslint": "explicit",
|
"source.fixAll.eslint": true,
|
||||||
"source.organizeImports": "explicit"
|
"source.organizeImports": true
|
||||||
},
|
},
|
||||||
"typescript.preferences.importModuleSpecifier": "non-relative",
|
"typescript.preferences.importModuleSpecifier": "non-relative",
|
||||||
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"JUNO_ENDPOINT": "https://tools.cosmos.azure.com",
|
"JUNO_ENDPOINT": "https://tools-staging.cosmos.azure.com",
|
||||||
"isTerminalEnabled": true,
|
"isTerminalEnabled" : true,
|
||||||
"isPhoenixEnabled": true
|
"isPhoenixEnabled" : true
|
||||||
}
|
}
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
||||||
<path d="M7.31299 1.26164C7.69849 0.897163 8.30151 0.897163 8.68701 1.26164L13.5305 5.84098C13.8302 6.12431 14 6.51853 14 6.93094V12.5002C14 13.3286 13.3284 14.0002 12.5 14.0002H10.5C9.67157 14.0002 9 13.3286 9 12.5002V10.0002C9 9.72407 8.77614 9.50021 8.5 9.50021H7.5C7.22386 9.50021 7 9.72407 7 10.0002V12.5002C7 13.3286 6.32843 14.0002 5.5 14.0002H3.5C2.67157 14.0002 2 13.3286 2 12.5002V6.93094C2 6.51853 2.1698 6.12431 2.46948 5.84098L7.31299 1.26164ZM8 1.98828L3.15649 6.56762C3.0566 6.66207 3 6.79347 3 6.93094V12.5002C3 12.7763 3.22386 13.0002 3.5 13.0002H5.5C5.77614 13.0002 6 12.7763 6 12.5002V10.0002C6 9.17179 6.67157 8.50022 7.5 8.50022H8.5C9.32843 8.50022 10 9.17179 10 10.0002V12.5002C10 12.7763 10.2239 13.0002 10.5 13.0002H12.5C12.7761 13.0002 13 12.7763 13 12.5002V6.93094C13 6.79347 12.9434 6.66207 12.8435 6.56762L8 1.98828Z" fill="#0078D4" />
|
|
||||||
</svg>
|
|
||||||
|
Before Width: | Height: | Size: 968 B |
13
jest-playwright.config.js
Normal file
13
jest-playwright.config.js
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
const isCI = require("is-ci");
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
exitOnPageError: false,
|
||||||
|
launchOptions: {
|
||||||
|
headless: isCI,
|
||||||
|
slowMo: 10,
|
||||||
|
timeout: 60000,
|
||||||
|
},
|
||||||
|
contextOptions: {
|
||||||
|
ignoreHTTPSErrors: true,
|
||||||
|
},
|
||||||
|
};
|
||||||
@@ -31,7 +31,7 @@ module.exports = {
|
|||||||
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", "lcov"],
|
coverageReporters: ["json", "text", "cobertura"],
|
||||||
|
|
||||||
// An object that configures minimum threshold enforcement for coverage results
|
// An object that configures minimum threshold enforcement for coverage results
|
||||||
coverageThreshold: {
|
coverageThreshold: {
|
||||||
@@ -76,10 +76,6 @@ module.exports = {
|
|||||||
"^dnd-core$": "dnd-core/dist/cjs",
|
"^dnd-core$": "dnd-core/dist/cjs",
|
||||||
"^react-dnd$": "react-dnd/dist/cjs",
|
"^react-dnd$": "react-dnd/dist/cjs",
|
||||||
"^react-dnd-html5-backend$": "react-dnd-html5-backend/dist/cjs",
|
"^react-dnd-html5-backend$": "react-dnd-html5-backend/dist/cjs",
|
||||||
"d3-force": "<rootDir>/node_modules/d3-force/dist/d3-force.min.js",
|
|
||||||
"d3-quadtree": "<rootDir>/node_modules/d3-quadtree/dist/d3-quadtree.min.js",
|
|
||||||
"d3-scale-chromatic": "<rootDir>/node_modules/d3-scale-chromatic/dist/d3-scale-chromatic.min.js",
|
|
||||||
"d3-zoom": "<rootDir>/node_modules/d3-zoom/dist/d3-zoom.min.js",
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader
|
// An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader
|
||||||
@@ -134,6 +130,7 @@ module.exports = {
|
|||||||
|
|
||||||
// The test environment that will be used for testing
|
// The test environment that will be used for testing
|
||||||
// testEnvironment: "jest-environment-jsdom",
|
// testEnvironment: "jest-environment-jsdom",
|
||||||
|
|
||||||
modulePaths: ["node_modules", "<rootDir>/src"],
|
modulePaths: ["node_modules", "<rootDir>/src"],
|
||||||
|
|
||||||
// Options that will be passed to the testEnvironment
|
// Options that will be passed to the testEnvironment
|
||||||
|
|||||||
7
jest.config.playwright.js
Normal file
7
jest.config.playwright.js
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
module.exports = {
|
||||||
|
preset: "jest-playwright-preset",
|
||||||
|
testMatch: ["<rootDir>/test/**/*.spec.[jt]s?(x)"],
|
||||||
|
setupFiles: ["dotenv/config"],
|
||||||
|
testEnvironment: "./test/playwrightEnv.js",
|
||||||
|
setupFilesAfterEnv: ["expect-playwright"],
|
||||||
|
};
|
||||||
@@ -130,7 +130,6 @@
|
|||||||
@ActiveTabWidth: 141px;
|
@ActiveTabWidth: 141px;
|
||||||
@TabsHeight: 30px;
|
@TabsHeight: 30px;
|
||||||
@TabsWidth: 140px;
|
@TabsWidth: 140px;
|
||||||
@ContentWrapper: 111px;
|
|
||||||
@StatusIconContainerSize: 18px;
|
@StatusIconContainerSize: 18px;
|
||||||
@LoadingErrorIconSize: 14px;
|
@LoadingErrorIconSize: 14px;
|
||||||
@ErrorIconContainer: 16px;
|
@ErrorIconContainer: 16px;
|
||||||
@@ -164,7 +163,6 @@
|
|||||||
/**********************************************************************************/
|
/**********************************************************************************/
|
||||||
|
|
||||||
@FabricFont: "Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif;
|
@FabricFont: "Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif;
|
||||||
@FabricToolbarIconColor: "brightness(0) saturate(100%) invert(50%) sepia(17%) saturate(1459%) hue-rotate(81deg) brightness(99%) contrast(94%)";
|
|
||||||
|
|
||||||
@FabricBoxBorderRadius: 8px;
|
@FabricBoxBorderRadius: 8px;
|
||||||
@FabricBoxBorderShadow: rgba(0, 0, 0, 0.133) 0px 1.6px 3.6px 0px, rgba(0, 0, 0, 0.11) 0px 0.3px 0.9px 0px;
|
@FabricBoxBorderShadow: rgba(0, 0, 0, 0.133) 0px 1.6px 3.6px 0px, rgba(0, 0, 0, 0.11) 0px 0.3px 0.9px 0px;
|
||||||
@@ -337,10 +335,3 @@
|
|||||||
height: 0;
|
height: 0;
|
||||||
border-color: @InfoPointerColor transparent;
|
border-color: @InfoPointerColor transparent;
|
||||||
}
|
}
|
||||||
/*********************************************************************************************************
|
|
||||||
Screen Reader Only
|
|
||||||
**********************************************************************************************************/
|
|
||||||
.screenReaderOnly {
|
|
||||||
position: absolute;
|
|
||||||
left: -9999px;
|
|
||||||
}
|
|
||||||
@@ -2264,49 +2264,38 @@ a:link {
|
|||||||
width: 82px;
|
width: 82px;
|
||||||
}
|
}
|
||||||
|
|
||||||
// .tabdocuments .scrollable {
|
.tabdocuments .scrollable {
|
||||||
// height: 100%;
|
height: 100%;
|
||||||
// overflow-y: auto;
|
overflow-y: auto;
|
||||||
// overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
// padding-left: 5px;
|
padding-left: 5px;
|
||||||
// padding-right: 5px;
|
padding-right: 5px;
|
||||||
// width: 100%;
|
width: 100%;
|
||||||
// }
|
}
|
||||||
|
|
||||||
// .tabdocuments > .tabdocumentsGridElement {
|
.tabdocuments > .tabdocumentsGridElement {
|
||||||
// width: 50%;
|
width: 50%;
|
||||||
// }
|
}
|
||||||
|
|
||||||
// .tabdocuments > .evenlySpacedHeader {
|
.tabdocuments > .evenlySpacedHeader {
|
||||||
// width: 30%;
|
width: 30%;
|
||||||
// }
|
}
|
||||||
|
|
||||||
// .tabdocuments.scrollable:focus,
|
.tabdocuments.scrollable:focus,
|
||||||
// .tabdocuments.scrollable:active {
|
.tabdocuments.scrollable:active {
|
||||||
// outline: 1px dotted;
|
outline: 1px dotted;
|
||||||
// }
|
}
|
||||||
|
|
||||||
// .tabdocuments .scrollable table td {
|
.tabdocuments .scrollable table td {
|
||||||
// white-space: nowrap;
|
white-space: nowrap;
|
||||||
// overflow: hidden;
|
overflow: hidden;
|
||||||
// text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
// }
|
}
|
||||||
|
|
||||||
.mongoDocumentEditor .monaco-editor.vs .redsquiggly {
|
.mongoDocumentEditor .monaco-editor.vs .redsquiggly {
|
||||||
display: none !important;
|
display: none !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.monaco-editor .quick-input-list-label {
|
|
||||||
/* Restore some of Monaco's default styles that are clobbered by our global styles */
|
|
||||||
padding: 0;
|
|
||||||
line-height: 22px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.monaco-editor .quick-input-list .highlight {
|
|
||||||
/* Padding in highlighted text within the quick input list breaks the flow of the text */
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
td a {
|
td a {
|
||||||
color: #393939;
|
color: #393939;
|
||||||
}
|
}
|
||||||
@@ -2316,9 +2305,10 @@ td a:hover {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.loadMore {
|
.loadMore {
|
||||||
display: block;
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
text-align: center;
|
padding-left: 30%;
|
||||||
|
padding-top: 2px;
|
||||||
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
.loadMore > a:focus {
|
.loadMore > a:focus {
|
||||||
@@ -2366,9 +2356,9 @@ a:link {
|
|||||||
.tabsManagerContainer {
|
.tabsManagerContainer {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
display: flex;
|
overflow: hidden;
|
||||||
flex-direction: column;
|
|
||||||
min-height: 300px;
|
min-height: 300px;
|
||||||
|
overflow-y: scroll;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tabs {
|
.tabs {
|
||||||
@@ -2557,12 +2547,10 @@ a:link {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.filterdivs {
|
.filterdivs {
|
||||||
margin: 10px 0px;
|
padding-top: 15px;
|
||||||
|
height: 45px;
|
||||||
|
margin-bottom: 8px;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
input {
|
|
||||||
line-height: 14px; // To correct vertical position of the down arrow of the input
|
|
||||||
outline: none; // Remove the dotted border on focus, because fluent has its own focus style (underlined)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.editFilterContainer {
|
.editFilterContainer {
|
||||||
@@ -2579,18 +2567,6 @@ a:link {
|
|||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
.documentsTab {
|
|
||||||
.documentsTable {
|
|
||||||
.documentsTableCell {
|
|
||||||
border-left: 1px solid @BaseMedium;
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
.documentsTableHeader {
|
|
||||||
border-bottom: 1px solid @BaseMedium;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.querydropdown {
|
.querydropdown {
|
||||||
border: 1px solid @BaseMedium;
|
border: 1px solid @BaseMedium;
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
@@ -2671,7 +2647,7 @@ a:link {
|
|||||||
width: @ActiveTabWidth;
|
width: @ActiveTabWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
.nav-tabs > li.active > .tabNavContentContainer > .tab_Content > .contentWrapper > .tabNavText {
|
.nav-tabs > li.active > .tabNavContentContainer > .tab_Content > .tabNavText {
|
||||||
font-weight: bolder;
|
font-weight: bolder;
|
||||||
border-bottom: 2px solid rgba(0, 120, 212, 1);
|
border-bottom: 2px solid rgba(0, 120, 212, 1);
|
||||||
}
|
}
|
||||||
@@ -2707,9 +2683,6 @@ a:link {
|
|||||||
width: @TabsWidth;
|
width: @TabsWidth;
|
||||||
border-right: @ButtonBorderWidth solid @BaseMedium;
|
border-right: @ButtonBorderWidth solid @BaseMedium;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
.contentWrapper {
|
|
||||||
.flex-display();
|
|
||||||
width: @ContentWrapper;
|
|
||||||
|
|
||||||
.statusIconContainer {
|
.statusIconContainer {
|
||||||
width: @StatusIconContainerSize;
|
width: @StatusIconContainerSize;
|
||||||
@@ -2768,10 +2741,9 @@ a:link {
|
|||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
.tabIconSection {
|
.tabIconSection {
|
||||||
width: 29px;
|
width: 30px;
|
||||||
position: relative;
|
position: relative;
|
||||||
padding-top: 2px;
|
padding-top: 2px;
|
||||||
|
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ a:focus {
|
|||||||
border-bottom: 2px solid @FabricAccentMedium;
|
border-bottom: 2px solid @FabricAccentMedium;
|
||||||
}
|
}
|
||||||
|
|
||||||
.nav-tabs>li.active>.tabNavContentContainer>.tab_Content>.contentWrapper>.tabNavText {
|
.nav-tabs>li.active>.tabNavContentContainer>.tab_Content>.tabNavText {
|
||||||
border-bottom: 0px none transparent;
|
border-bottom: 0px none transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -93,11 +93,9 @@ a:focus {
|
|||||||
width: calc(@TabsWidth - (@SmallSpace * 2));
|
width: calc(@TabsWidth - (@SmallSpace * 2));
|
||||||
padding-bottom: @SmallSpace;
|
padding-bottom: @SmallSpace;
|
||||||
|
|
||||||
.contentWrapper {
|
|
||||||
.statusIconContainer {
|
.statusIconContainer {
|
||||||
margin-left: 0px;
|
margin-left: 0px;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
.tabIconSection {
|
.tabIconSection {
|
||||||
.cancelButton {
|
.cancelButton {
|
||||||
|
|||||||
3969
package-lock.json
generated
3969
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
41
package.json
41
package.json
@@ -5,10 +5,10 @@
|
|||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@azure/arm-cosmosdb": "9.1.0",
|
"@azure/arm-cosmosdb": "9.1.0",
|
||||||
"@azure/cosmos": "4.0.1-beta.3",
|
"@azure/cosmos": "4.0.1-beta.2",
|
||||||
"@azure/cosmos-language-service": "0.0.5",
|
"@azure/cosmos-language-service": "0.0.5",
|
||||||
"@azure/identity": "1.5.2",
|
"@azure/identity": "1.2.1",
|
||||||
"@azure/ms-rest-nodeauth": "3.1.1",
|
"@azure/ms-rest-nodeauth": "3.0.7",
|
||||||
"@azure/msal-browser": "2.14.2",
|
"@azure/msal-browser": "2.14.2",
|
||||||
"@babel/plugin-proposal-class-properties": "7.12.1",
|
"@babel/plugin-proposal-class-properties": "7.12.1",
|
||||||
"@babel/plugin-proposal-decorators": "7.12.12",
|
"@babel/plugin-proposal-decorators": "7.12.12",
|
||||||
@@ -46,8 +46,6 @@
|
|||||||
"@types/lodash": "4.14.171",
|
"@types/lodash": "4.14.171",
|
||||||
"@types/mkdirp": "1.0.1",
|
"@types/mkdirp": "1.0.1",
|
||||||
"@types/node-fetch": "2.5.7",
|
"@types/node-fetch": "2.5.7",
|
||||||
"@uiw/react-split": "5.9.3",
|
|
||||||
"@xmldom/xmldom": "0.7.13",
|
|
||||||
"applicationinsights": "1.8.0",
|
"applicationinsights": "1.8.0",
|
||||||
"bootstrap": "3.4.1",
|
"bootstrap": "3.4.1",
|
||||||
"canvas": "file:./canvas",
|
"canvas": "file:./canvas",
|
||||||
@@ -56,7 +54,7 @@
|
|||||||
"copy-webpack-plugin": "11.0.0",
|
"copy-webpack-plugin": "11.0.0",
|
||||||
"crossroads": "0.12.2",
|
"crossroads": "0.12.2",
|
||||||
"css-element-queries": "1.1.1",
|
"css-element-queries": "1.1.1",
|
||||||
"d3": "7.8.5",
|
"d3": "6.1.1",
|
||||||
"datatables.net-colreorder-dt": "1.7.0",
|
"datatables.net-colreorder-dt": "1.7.0",
|
||||||
"datatables.net-dt": "1.13.8",
|
"datatables.net-dt": "1.13.8",
|
||||||
"date-fns": "1.29.0",
|
"date-fns": "1.29.0",
|
||||||
@@ -71,19 +69,17 @@
|
|||||||
"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",
|
"iframe-resizer-react": "1.1.0",
|
||||||
"immer": "9.0.6",
|
|
||||||
"immutable": "4.0.0-rc.12",
|
"immutable": "4.0.0-rc.12",
|
||||||
"is-ci": "2.0.0",
|
"is-ci": "2.0.0",
|
||||||
"jquery": "3.7.1",
|
"jquery": "3.7.1",
|
||||||
"jquery-typeahead": "2.11.1",
|
"jquery-typeahead": "2.11.1",
|
||||||
"jquery-ui-dist": "1.13.2",
|
"jquery-ui-dist": "1.13.2",
|
||||||
"knockout": "3.5.1",
|
"knockout": "3.5.1",
|
||||||
"loader-utils": "2.0.3",
|
|
||||||
"mkdirp": "1.0.4",
|
"mkdirp": "1.0.4",
|
||||||
"monaco-editor": "0.44.0",
|
"monaco-editor": "0.44.0",
|
||||||
"ms": "2.1.3",
|
"ms": "2.1.3",
|
||||||
"p-retry": "4.6.2",
|
|
||||||
"patch-package": "8.0.0",
|
"patch-package": "8.0.0",
|
||||||
|
"p-retry": "4.6.2",
|
||||||
"plotly.js-cartesian-dist-min": "1.52.3",
|
"plotly.js-cartesian-dist-min": "1.52.3",
|
||||||
"post-robot": "10.0.42",
|
"post-robot": "10.0.42",
|
||||||
"q": "1.5.1",
|
"q": "1.5.1",
|
||||||
@@ -99,16 +95,13 @@
|
|||||||
"react-splitter-layout": "4.0.0",
|
"react-splitter-layout": "4.0.0",
|
||||||
"react-string-format": "1.0.1",
|
"react-string-format": "1.0.1",
|
||||||
"react-youtube": "9.0.1",
|
"react-youtube": "9.0.1",
|
||||||
"react-window": "1.8.10",
|
|
||||||
"reflect-metadata": "0.1.13",
|
"reflect-metadata": "0.1.13",
|
||||||
"rx-jupyter": "5.5.12",
|
"rx-jupyter": "5.5.12",
|
||||||
"sanitize-html": "2.3.3",
|
"sanitize-html": "2.3.3",
|
||||||
"shell-quote": "1.7.3",
|
|
||||||
"styled-components": "5.0.1",
|
"styled-components": "5.0.1",
|
||||||
"swr": "0.4.0",
|
"swr": "0.4.0",
|
||||||
"terser-webpack-plugin": "5.3.9",
|
"terser-webpack-plugin": "5.3.9",
|
||||||
"tinykeys": "2.1.0",
|
"underscore": "1.9.1",
|
||||||
"underscore": "1.12.1",
|
|
||||||
"utility-types": "3.10.0",
|
"utility-types": "3.10.0",
|
||||||
"zustand": "3.5.0"
|
"zustand": "3.5.0"
|
||||||
},
|
},
|
||||||
@@ -117,7 +110,6 @@
|
|||||||
"@babel/preset-env": "7.9.0",
|
"@babel/preset-env": "7.9.0",
|
||||||
"@babel/preset-react": "7.9.4",
|
"@babel/preset-react": "7.9.4",
|
||||||
"@babel/preset-typescript": "7.9.0",
|
"@babel/preset-typescript": "7.9.0",
|
||||||
"@playwright/test": "1.44.0",
|
|
||||||
"@testing-library/react": "11.2.3",
|
"@testing-library/react": "11.2.3",
|
||||||
"@types/applicationinsights-js": "1.0.7",
|
"@types/applicationinsights-js": "1.0.7",
|
||||||
"@types/codemirror": "0.0.56",
|
"@types/codemirror": "0.0.56",
|
||||||
@@ -126,8 +118,8 @@
|
|||||||
"@types/datatables.net": "1.10.28",
|
"@types/datatables.net": "1.10.28",
|
||||||
"@types/datatables.net-colreorder": "1.4.5",
|
"@types/datatables.net-colreorder": "1.4.5",
|
||||||
"@types/dom-to-image": "2.6.2",
|
"@types/dom-to-image": "2.6.2",
|
||||||
"@types/enzyme": "3.10.12",
|
"@types/enzyme": "3.10.7",
|
||||||
"@types/enzyme-adapter-react-16": "1.0.9",
|
"@types/enzyme-adapter-react-16": "1.0.6",
|
||||||
"@types/hasher": "0.0.31",
|
"@types/hasher": "0.0.31",
|
||||||
"@types/jest": "26.0.20",
|
"@types/jest": "26.0.20",
|
||||||
"@types/jquery": "3.5.29",
|
"@types/jquery": "3.5.29",
|
||||||
@@ -139,7 +131,6 @@
|
|||||||
"@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/react-splitter-layout": "3.0.1",
|
"@types/react-splitter-layout": "3.0.1",
|
||||||
"@types/react-window": "1.8.8",
|
|
||||||
"@types/sanitize-html": "1.27.2",
|
"@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",
|
||||||
@@ -155,13 +146,14 @@
|
|||||||
"create-file-webpack": "1.0.2",
|
"create-file-webpack": "1.0.2",
|
||||||
"css-loader": "6.8.1",
|
"css-loader": "6.8.1",
|
||||||
"enzyme": "3.11.0",
|
"enzyme": "3.11.0",
|
||||||
"enzyme-adapter-react-16": "1.15.8",
|
"enzyme-adapter-react-16": "1.15.5",
|
||||||
"enzyme-to-json": "3.6.2",
|
"enzyme-to-json": "3.6.1",
|
||||||
"eslint": "8.50.0",
|
"eslint": "8.50.0",
|
||||||
"eslint-cli": "1.1.1",
|
"eslint-cli": "1.1.1",
|
||||||
"eslint-plugin-no-null": "1.0.2",
|
"eslint-plugin-no-null": "1.0.2",
|
||||||
"eslint-plugin-prefer-arrow": "1.2.3",
|
"eslint-plugin-prefer-arrow": "1.2.3",
|
||||||
"eslint-plugin-react-hooks": "4.6.0",
|
"eslint-plugin-react-hooks": "4.6.0",
|
||||||
|
"expect-playwright": "0.3.3",
|
||||||
"fast-glob": "3.2.5",
|
"fast-glob": "3.2.5",
|
||||||
"fs-extra": "7.0.0",
|
"fs-extra": "7.0.0",
|
||||||
"html-inline-css-webpack-plugin": "1.11.2",
|
"html-inline-css-webpack-plugin": "1.11.2",
|
||||||
@@ -170,6 +162,7 @@
|
|||||||
"html-webpack-plugin": "5.5.3",
|
"html-webpack-plugin": "5.5.3",
|
||||||
"jest": "26.6.3",
|
"jest": "26.6.3",
|
||||||
"jest-canvas-mock": "2.3.1",
|
"jest-canvas-mock": "2.3.1",
|
||||||
|
"jest-playwright-preset": "1.5.1",
|
||||||
"jest-react-hooks-shallow": "1.5.1",
|
"jest-react-hooks-shallow": "1.5.1",
|
||||||
"jest-trx-results-processor": "0.0.7",
|
"jest-trx-results-processor": "0.0.7",
|
||||||
"less": "3.8.1",
|
"less": "3.8.1",
|
||||||
@@ -177,24 +170,25 @@
|
|||||||
"less-vars-loader": "1.1.0",
|
"less-vars-loader": "1.1.0",
|
||||||
"mini-css-extract-plugin": "2.1.0",
|
"mini-css-extract-plugin": "2.1.0",
|
||||||
"monaco-editor-webpack-plugin": "7.1.0",
|
"monaco-editor-webpack-plugin": "7.1.0",
|
||||||
"node-fetch": "2.6.7",
|
"node-fetch": "2.6.1",
|
||||||
|
"playwright": "1.13.0",
|
||||||
"prettier": "3.0.3",
|
"prettier": "3.0.3",
|
||||||
"process": "0.11.10",
|
"process": "0.11.10",
|
||||||
"querystring-es3": "0.2.1",
|
"querystring-es3": "0.2.1",
|
||||||
"raw-loader": "0.5.1",
|
"raw-loader": "0.5.1",
|
||||||
"react-dev-utils": "12.0.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",
|
||||||
"ts-loader": "9.2.4",
|
"ts-loader": "9.2.4",
|
||||||
"typedoc": "0.22.15",
|
"typedoc": "0.21.5",
|
||||||
"typescript": "4.3.5",
|
"typescript": "4.3.5",
|
||||||
"url-loader": "4.1.1",
|
"url-loader": "4.1.1",
|
||||||
"wait-on": "4.0.2",
|
"wait-on": "4.0.2",
|
||||||
"webpack": "5.88.2",
|
"webpack": "5.88.2",
|
||||||
"webpack-bundle-analyzer": "4.9.1",
|
"webpack-bundle-analyzer": "4.9.1",
|
||||||
"webpack-cli": "5.1.4",
|
"webpack-cli": "5.1.4",
|
||||||
"webpack-dev-server": "4.15.2"
|
"webpack-dev-server": "4.15.1"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"postinstall": "patch-package",
|
"postinstall": "patch-package",
|
||||||
@@ -209,7 +203,6 @@
|
|||||||
"test": "rimraf coverage && jest",
|
"test": "rimraf coverage && jest",
|
||||||
"test:debug": "jest --runInBand",
|
"test:debug": "jest --runInBand",
|
||||||
"test:e2e": "jest -c ./jest.config.playwright.js --detectOpenHandles",
|
"test:e2e": "jest -c ./jest.config.playwright.js --detectOpenHandles",
|
||||||
"test:file": "jest --coverage=false",
|
|
||||||
"watch": "npm run start",
|
"watch": "npm run start",
|
||||||
"wait-for-server": "wait-on -t 240000 -i 5000 -v https-get://0.0.0.0:1234/",
|
"wait-for-server": "wait-on -t 240000 -i 5000 -v https-get://0.0.0.0:1234/",
|
||||||
"build:ase": "gulp build:ase",
|
"build:ase": "gulp build:ase",
|
||||||
|
|||||||
@@ -1,11 +0,0 @@
|
|||||||
diff --git a/node_modules/@uiw/react-split/cjs/index.d.ts b/node_modules/@uiw/react-split/cjs/index.d.ts
|
|
||||||
index 644bcc3..f794760 100644
|
|
||||||
--- a/node_modules/@uiw/react-split/cjs/index.d.ts
|
|
||||||
+++ b/node_modules/@uiw/react-split/cjs/index.d.ts
|
|
||||||
@@ -56,5 +56,5 @@ export default class Split extends React.Component<SplitProps, SplitState> {
|
|
||||||
onMouseDown(paneNumber: number, env: React.MouseEvent<HTMLDivElement, MouseEvent>): void;
|
|
||||||
onDragging(env: Event): void;
|
|
||||||
onDragEnd(): void;
|
|
||||||
- render(): import("react/jsx-runtime").JSX.Element;
|
|
||||||
+ render(): JSX.Element;
|
|
||||||
}
|
|
||||||
@@ -1,53 +0,0 @@
|
|||||||
import { defineConfig, devices } from '@playwright/test';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* See https://playwright.dev/docs/test-configuration.
|
|
||||||
*/
|
|
||||||
export default defineConfig({
|
|
||||||
testDir: 'test',
|
|
||||||
fullyParallel: true,
|
|
||||||
forbidOnly: !!process.env.CI,
|
|
||||||
retries: process.env.CI ? 3 : 0,
|
|
||||||
workers: process.env.CI ? 1 : undefined,
|
|
||||||
reporter: process.env.CI ? 'blob' : 'html',
|
|
||||||
timeout: 10 * 60 * 1000,
|
|
||||||
use: {
|
|
||||||
actionTimeout: 5 * 60 * 1000,
|
|
||||||
trace: 'off',
|
|
||||||
video: 'off',
|
|
||||||
screenshot: 'on',
|
|
||||||
testIdAttribute: 'data-test',
|
|
||||||
contextOptions: {
|
|
||||||
ignoreHTTPSErrors: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
expect: {
|
|
||||||
timeout: 5 * 60 * 1000,
|
|
||||||
},
|
|
||||||
|
|
||||||
projects: [
|
|
||||||
{
|
|
||||||
name: 'chromium',
|
|
||||||
use: { ...devices['Desktop Chrome'] },
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
name: 'firefox',
|
|
||||||
use: { ...devices['Desktop Firefox'] },
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
name: 'webkit',
|
|
||||||
use: { ...devices['Desktop Safari'] },
|
|
||||||
},
|
|
||||||
],
|
|
||||||
|
|
||||||
webServer: {
|
|
||||||
command: 'npm run start',
|
|
||||||
url: 'https://127.0.0.1:1234/_ready',
|
|
||||||
timeout: 120 * 1000,
|
|
||||||
ignoreHTTPSErrors: true,
|
|
||||||
reuseExistingServer: !process.env.CI,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
@@ -88,12 +88,6 @@ export class CapabilityNames {
|
|||||||
public static readonly EnableStorageAnalytics: string = "EnableStorageAnalytics";
|
public static readonly EnableStorageAnalytics: string = "EnableStorageAnalytics";
|
||||||
public static readonly EnableMongo: string = "EnableMongo";
|
public static readonly EnableMongo: string = "EnableMongo";
|
||||||
public static readonly EnableServerless: string = "EnableServerless";
|
public static readonly EnableServerless: string = "EnableServerless";
|
||||||
public static readonly EnableNoSQLVectorSearch: string = "EnableNoSQLVectorSearch";
|
|
||||||
}
|
|
||||||
|
|
||||||
export enum CapacityMode {
|
|
||||||
Provisioned = "Provisioned",
|
|
||||||
Serverless = "Serverless",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// flight names returned from the portal are always lowercase
|
// flight names returned from the portal are always lowercase
|
||||||
@@ -130,37 +124,7 @@ export enum MongoBackendEndpointType {
|
|||||||
remote,
|
remote,
|
||||||
}
|
}
|
||||||
|
|
||||||
export class BackendApi {
|
// TODO: 435619 Add default endpoints per cloud and use regional only when available
|
||||||
public static readonly GenerateToken: string = "GenerateToken";
|
|
||||||
public static readonly PortalSettings: string = "PortalSettings";
|
|
||||||
public static readonly AccountRestrictions: string = "AccountRestrictions";
|
|
||||||
}
|
|
||||||
|
|
||||||
export class PortalBackendEndpoints {
|
|
||||||
public static readonly Development: string = "https://localhost:7235";
|
|
||||||
public static readonly Mpac: string = "https://cdb-ms-mpac-pbe.cosmos.azure.com";
|
|
||||||
public static readonly Prod: string = "https://cdb-ms-prod-pbe.cosmos.azure.com";
|
|
||||||
public static readonly Fairfax: string = "https://cdb-ff-prod-pbe.cosmos.azure.us";
|
|
||||||
public static readonly Mooncake: string = "https://cdb-mc-prod-pbe.cosmos.azure.cn";
|
|
||||||
}
|
|
||||||
|
|
||||||
export class MongoProxyEndpoints {
|
|
||||||
public static readonly Local: string = "https://localhost:7238";
|
|
||||||
public static readonly Mpac: string = "https://cdb-ms-mpac-mp.cosmos.azure.com";
|
|
||||||
public static readonly Prod: string = "https://cdb-ms-prod-mp.cosmos.azure.com";
|
|
||||||
public static readonly Fairfax: string = "https://cdb-ff-prod-mp.cosmos.azure.us";
|
|
||||||
public static readonly Mooncake: string = "https://cdb-mc-prod-mp.cosmos.azure.cn";
|
|
||||||
}
|
|
||||||
|
|
||||||
export class CassandraProxyEndpoints {
|
|
||||||
public static readonly Development: string = "https://localhost:7240";
|
|
||||||
public static readonly Mpac: string = "https://cdb-ms-mpac-cp.cosmos.azure.com";
|
|
||||||
public static readonly Prod: string = "https://cdb-ms-prod-cp.cosmos.azure.com";
|
|
||||||
public static readonly Fairfax: string = "https://cdb-ff-prod-cp.cosmos.azure.us";
|
|
||||||
public static readonly Mooncake: string = "https://cdb-mc-prod-cp.cosmos.azure.cn";
|
|
||||||
}
|
|
||||||
|
|
||||||
//TODO: Remove this when new backend is migrated over
|
|
||||||
export class CassandraBackend {
|
export class CassandraBackend {
|
||||||
public static readonly createOrDeleteApi: string = "api/cassandra/createordelete";
|
public static readonly createOrDeleteApi: string = "api/cassandra/createordelete";
|
||||||
public static readonly guestCreateOrDeleteApi: string = "api/guest/cassandra/createordelete";
|
public static readonly guestCreateOrDeleteApi: string = "api/guest/cassandra/createordelete";
|
||||||
@@ -172,17 +136,6 @@ export class CassandraBackend {
|
|||||||
public static readonly guestSchemaApi: string = "api/guest/cassandra/schema";
|
public static readonly guestSchemaApi: string = "api/guest/cassandra/schema";
|
||||||
}
|
}
|
||||||
|
|
||||||
export class CassandraProxyAPIs {
|
|
||||||
public static readonly createOrDeleteApi: string = "api/cassandra/createordelete";
|
|
||||||
public static readonly connectionStringCreateOrDeleteApi: string = "api/connectionstring/cassandra/createordelete";
|
|
||||||
public static readonly queryApi: string = "api/cassandra";
|
|
||||||
public static readonly connectionStringQueryApi: string = "api/connectionstring/cassandra";
|
|
||||||
public static readonly keysApi: string = "api/cassandra/keys";
|
|
||||||
public static readonly connectionStringKeysApi: string = "api/connectionstring/cassandra/keys";
|
|
||||||
public static readonly schemaApi: string = "api/cassandra/schema";
|
|
||||||
public static readonly connectionStringSchemaApi: string = "api/connectionstring/cassandra/schema";
|
|
||||||
}
|
|
||||||
|
|
||||||
export class Queries {
|
export class Queries {
|
||||||
public static CustomPageOption: string = "custom";
|
public static CustomPageOption: string = "custom";
|
||||||
public static UnlimitedPageOption: string = "unlimited";
|
public static UnlimitedPageOption: string = "unlimited";
|
||||||
@@ -256,7 +209,6 @@ export class HttpHeaders {
|
|||||||
public static partitionKey: string = "x-ms-documentdb-partitionkey";
|
public static partitionKey: string = "x-ms-documentdb-partitionkey";
|
||||||
public static migrateOfferToManualThroughput: string = "x-ms-cosmos-migrate-offer-to-manual-throughput";
|
public static migrateOfferToManualThroughput: string = "x-ms-cosmos-migrate-offer-to-manual-throughput";
|
||||||
public static migrateOfferToAutopilot: string = "x-ms-cosmos-migrate-offer-to-autopilot";
|
public static migrateOfferToAutopilot: string = "x-ms-cosmos-migrate-offer-to-autopilot";
|
||||||
public static xAPIKey: string = "X-API-Key";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ContentType {
|
export class ContentType {
|
||||||
@@ -483,6 +435,22 @@ export class JunoEndpoints {
|
|||||||
public static readonly Stage = "https://tools-staging.cosmos.azure.com";
|
public static readonly Stage = "https://tools-staging.cosmos.azure.com";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class MongoProxyEndpoints {
|
||||||
|
public static readonly Development: string = "https://localhost:7238";
|
||||||
|
public static readonly Mpac: string = "https://cdb-ms-mpac-mp.cosmos.azure.com";
|
||||||
|
public static readonly Prod: string = "https://cdb-ms-prod-mp.cosmos.azure.com";
|
||||||
|
public static readonly Fairfax: string = "https://cdb-ff-prod-mp.cosmos.azure.us";
|
||||||
|
public static readonly Mooncake: string = "https://cdb-mc-prod-mp.cosmos.azure.cn";
|
||||||
|
}
|
||||||
|
|
||||||
|
export class CassandraProxyEndpoints {
|
||||||
|
public static readonly Development: string = "https://localhost:7240";
|
||||||
|
public static readonly Mpac: string = "https://cdb-ms-mpac-cp.cosmos.azure.com";
|
||||||
|
public static readonly Prod: string = "https://cdb-ms-prod-cp.cosmos.azure.com";
|
||||||
|
public static readonly Fairfax: string = "https://cdb-ff-prod-cp.cosmos.azure.us";
|
||||||
|
public static readonly Mooncake: string = "https://cdb-mc-prod-cp.cosmos.azure.cn";
|
||||||
|
}
|
||||||
|
|
||||||
export class PriorityLevel {
|
export class PriorityLevel {
|
||||||
public static readonly High = "high";
|
public static readonly High = "high";
|
||||||
public static readonly Low = "low";
|
public static readonly Low = "low";
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import * as Cosmos from "@azure/cosmos";
|
import * as Cosmos from "@azure/cosmos";
|
||||||
|
import { sendCachedDataMessage } from "Common/MessageHandler";
|
||||||
import { getAuthorizationTokenUsingResourceTokens } from "Common/getAuthorizationTokenUsingResourceTokens";
|
import { getAuthorizationTokenUsingResourceTokens } from "Common/getAuthorizationTokenUsingResourceTokens";
|
||||||
import { AuthorizationToken } from "Contracts/FabricMessageTypes";
|
import { AuthorizationToken, MessageTypes } from "Contracts/MessageTypes";
|
||||||
import { checkDatabaseResourceTokensValidity } from "Platform/Fabric/FabricUtil";
|
import { checkDatabaseResourceTokensValidity } from "Platform/Fabric/FabricUtil";
|
||||||
import { LocalStorageUtility, StorageKey } from "Shared/StorageUtility";
|
import { LocalStorageUtility, StorageKey } from "Shared/StorageUtility";
|
||||||
import { AuthType } from "../AuthType";
|
import { AuthType } from "../AuthType";
|
||||||
@@ -50,23 +51,15 @@ export const tokenProvider = async (requestInfo: Cosmos.RequestInfo) => {
|
|||||||
case Cosmos.ResourceType.offer:
|
case Cosmos.ResourceType.offer:
|
||||||
case Cosmos.ResourceType.user:
|
case Cosmos.ResourceType.user:
|
||||||
case Cosmos.ResourceType.permission:
|
case Cosmos.ResourceType.permission:
|
||||||
// For now, these operations aren't used, so fetching the authorization token is commented out.
|
|
||||||
// This provider must return a real token to pass validation by the client, so we return the cached resource token
|
|
||||||
// (which is a valid token, but won't work for these operations).
|
|
||||||
const resourceTokens2 = userContext.fabricContext.databaseConnectionInfo.resourceTokens;
|
|
||||||
return getAuthorizationTokenUsingResourceTokens(resourceTokens2, requestInfo.path, requestInfo.resourceId);
|
|
||||||
|
|
||||||
/* ************** TODO: Uncomment this code if we need to support these operations **************
|
|
||||||
// User master tokens
|
// User master tokens
|
||||||
const authorizationToken = await sendCachedDataMessage<AuthorizationToken>(
|
const authorizationToken = await sendCachedDataMessage<AuthorizationToken>(
|
||||||
FabricMessageTypes.GetAuthorizationToken,
|
MessageTypes.GetAuthorizationToken,
|
||||||
[requestInfo],
|
[requestInfo],
|
||||||
userContext.fabricContext.connectionId,
|
userContext.fabricContext.connectionId,
|
||||||
);
|
);
|
||||||
console.log("Response from Fabric: ", authorizationToken);
|
console.log("Response from Fabric: ", authorizationToken);
|
||||||
headers[HttpHeaders.msDate] = authorizationToken.XDate;
|
headers[HttpHeaders.msDate] = authorizationToken.XDate;
|
||||||
return decodeURIComponent(authorizationToken.PrimaryReadWriteToken);
|
return decodeURIComponent(authorizationToken.PrimaryReadWriteToken);
|
||||||
***********************************************************************************************/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import { userContext } from "../UserContext";
|
import { userContext } from "../UserContext";
|
||||||
|
|
||||||
export const getEntityName = (multiple?: boolean): string => {
|
export const getEntityName = (): string => {
|
||||||
if (userContext.apiType === "Mongo") {
|
if (userContext.apiType === "Mongo") {
|
||||||
return multiple ? "documents" : "document";
|
return "document";
|
||||||
}
|
}
|
||||||
|
|
||||||
return multiple ? "items" : "item";
|
return "item";
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
import { FabricMessageTypes } from "Contracts/FabricMessageTypes";
|
|
||||||
import Q from "q";
|
import Q from "q";
|
||||||
import * as _ from "underscore";
|
import * as _ from "underscore";
|
||||||
import * as Logger from "../Common/Logger";
|
|
||||||
import { MessageTypes } from "../Contracts/ExplorerContracts";
|
import { MessageTypes } from "../Contracts/ExplorerContracts";
|
||||||
import { getDataExplorerWindow } from "../Utils/WindowUtils";
|
import { getDataExplorerWindow } from "../Utils/WindowUtils";
|
||||||
import * as Constants from "./Constants";
|
import * as Constants from "./Constants";
|
||||||
@@ -38,7 +36,7 @@ export function handleCachedDataMessage(message: any): void {
|
|||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
export function sendCachedDataMessage<TResponseDataModel>(
|
export function sendCachedDataMessage<TResponseDataModel>(
|
||||||
messageType: MessageTypes | FabricMessageTypes,
|
messageType: MessageTypes,
|
||||||
params: Object[],
|
params: Object[],
|
||||||
scope?: string,
|
scope?: string,
|
||||||
timeoutInMs?: number,
|
timeoutInMs?: number,
|
||||||
@@ -97,18 +95,10 @@ const _sendMessage = (message: any): void => {
|
|||||||
const portalChildWindow = getDataExplorerWindow(window) || window;
|
const portalChildWindow = getDataExplorerWindow(window) || window;
|
||||||
if (portalChildWindow === window) {
|
if (portalChildWindow === window) {
|
||||||
// Current window is a child of portal, send message to portal window
|
// Current window is a child of portal, send message to portal window
|
||||||
if (portalChildWindow.document.referrer) {
|
portalChildWindow.parent.postMessage(message, portalChildWindow.document.referrer || "*");
|
||||||
portalChildWindow.parent.postMessage(message, portalChildWindow.document.referrer);
|
|
||||||
} else {
|
|
||||||
Logger.logError("Iframe failed to send message to portal", "MessageHandler");
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
// Current window is not a child of portal, send message to the child window instead (which is data explorer)
|
// Current window is not a child of portal, send message to the child window instead (which is data explorer)
|
||||||
if (portalChildWindow.location.origin) {
|
portalChildWindow.postMessage(message, portalChildWindow.location.origin || "*");
|
||||||
portalChildWindow.postMessage(message, portalChildWindow.location.origin);
|
|
||||||
} else {
|
|
||||||
Logger.logError("Iframe failed to send message to data explorer", "MessageHandler");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ export function queryDocuments(
|
|||||||
query: string,
|
query: string,
|
||||||
continuationToken?: string,
|
continuationToken?: string,
|
||||||
): Promise<QueryResponse> {
|
): Promise<QueryResponse> {
|
||||||
if (!useMongoProxyEndpoint("resourcelist") || !useMongoProxyEndpoint("queryDocuments")) {
|
if (!useMongoProxyEndpoint("resourcelist")) {
|
||||||
return queryDocuments_ToBeDeprecated(databaseId, collection, isResourceList, query, continuationToken);
|
return queryDocuments_ToBeDeprecated(databaseId, collection, isResourceList, query, continuationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -106,7 +106,7 @@ export function queryDocuments(
|
|||||||
headers[CosmosSDKConstants.HttpHeaders.Continuation] = continuationToken;
|
headers[CosmosSDKConstants.HttpHeaders.Continuation] = continuationToken;
|
||||||
}
|
}
|
||||||
|
|
||||||
const path = isResourceList ? "/resourcelist" : "/queryDocuments";
|
const path = isResourceList ? "/resourcelist" : "";
|
||||||
|
|
||||||
return window
|
return window
|
||||||
.fetch(`${endpoint}${path}`, {
|
.fetch(`${endpoint}${path}`, {
|
||||||
@@ -672,28 +672,6 @@ export function getEndpoint(endpoint: string): string {
|
|||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function useMongoProxyEndpoint(api: string): boolean {
|
|
||||||
const activeMongoProxyEndpoints: string[] = [
|
|
||||||
MongoProxyEndpoints.Local,
|
|
||||||
MongoProxyEndpoints.Mpac,
|
|
||||||
MongoProxyEndpoints.Prod,
|
|
||||||
MongoProxyEndpoints.Fairfax,
|
|
||||||
];
|
|
||||||
let canAccessMongoProxy: boolean = userContext.databaseAccount.properties.publicNetworkAccess === "Enabled";
|
|
||||||
if (
|
|
||||||
configContext.MONGO_PROXY_ENDPOINT !== MongoProxyEndpoints.Local &&
|
|
||||||
userContext.databaseAccount.properties.ipRules?.length > 0
|
|
||||||
) {
|
|
||||||
canAccessMongoProxy = canAccessMongoProxy && configContext.MONGO_PROXY_OUTBOUND_IPS_ALLOWLISTED;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
canAccessMongoProxy &&
|
|
||||||
configContext.NEW_MONGO_APIS?.includes(api) &&
|
|
||||||
activeMongoProxyEndpoints.includes(configContext.MONGO_PROXY_ENDPOINT)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: This function throws most of the time except on Forbidden which is a bit strange
|
// TODO: This function throws most of the time except on Forbidden which is a bit strange
|
||||||
// It causes problems for TypeScript understanding the types
|
// It causes problems for TypeScript understanding the types
|
||||||
async function errorHandling(response: Response, action: string, params: unknown): Promise<void> {
|
async function errorHandling(response: Response, action: string, params: unknown): Promise<void> {
|
||||||
@@ -710,3 +688,16 @@ async function errorHandling(response: Response, action: string, params: unknown
|
|||||||
export function getARMCreateCollectionEndpoint(params: DataModels.MongoParameters): string {
|
export function getARMCreateCollectionEndpoint(params: DataModels.MongoParameters): string {
|
||||||
return `subscriptions/${params.sid}/resourceGroups/${params.rg}/providers/Microsoft.DocumentDB/databaseAccounts/${userContext.databaseAccount.name}/mongodbDatabases/${params.db}/collections/${params.coll}`;
|
return `subscriptions/${params.sid}/resourceGroups/${params.rg}/providers/Microsoft.DocumentDB/databaseAccounts/${userContext.databaseAccount.name}/mongodbDatabases/${params.db}/collections/${params.coll}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function useMongoProxyEndpoint(api: string): boolean {
|
||||||
|
let canAccessMongoProxy: boolean = userContext.databaseAccount.properties.publicNetworkAccess === "Enabled";
|
||||||
|
if (userContext.databaseAccount.properties.ipRules?.length > 0) {
|
||||||
|
canAccessMongoProxy = canAccessMongoProxy && configContext.MONGO_PROXY_OUTBOUND_IPS_ALLOWLISTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
canAccessMongoProxy &&
|
||||||
|
configContext.NEW_MONGO_APIS?.includes(api) &&
|
||||||
|
[MongoProxyEndpoints.Development, MongoProxyEndpoints.Mpac].includes(configContext.MONGO_PROXY_ENDPOINT)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|||||||
@@ -3,7 +3,8 @@ import * as _ from "underscore";
|
|||||||
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 Explorer from "../Explorer/Explorer";
|
import Explorer from "../Explorer/Explorer";
|
||||||
import DocumentId, { IDocumentIdContainer } from "../Explorer/Tree/DocumentId";
|
import DocumentsTab from "../Explorer/Tabs/DocumentsTab";
|
||||||
|
import DocumentId from "../Explorer/Tree/DocumentId";
|
||||||
import { useDatabases } from "../Explorer/useDatabases";
|
import { useDatabases } from "../Explorer/useDatabases";
|
||||||
import { userContext } from "../UserContext";
|
import { userContext } from "../UserContext";
|
||||||
import * as NotificationConsoleUtils from "../Utils/NotificationConsoleUtils";
|
import * as NotificationConsoleUtils from "../Utils/NotificationConsoleUtils";
|
||||||
@@ -161,10 +162,10 @@ export class QueriesClient {
|
|||||||
{
|
{
|
||||||
partitionKey: QueriesClient.PartitionKey,
|
partitionKey: QueriesClient.PartitionKey,
|
||||||
partitionKeyProperties: ["id"],
|
partitionKeyProperties: ["id"],
|
||||||
} as IDocumentIdContainer,
|
} as DocumentsTab,
|
||||||
query,
|
query,
|
||||||
[query.queryName],
|
[query.queryName],
|
||||||
);
|
); // TODO: Remove DocumentId's dependency on DocumentsTab
|
||||||
const options: any = { partitionKey: query.resourceId };
|
const options: any = { partitionKey: query.resourceId };
|
||||||
return deleteDocument(queriesCollection, documentId)
|
return deleteDocument(queriesCollection, documentId)
|
||||||
.then(
|
.then(
|
||||||
|
|||||||
@@ -1,10 +1,14 @@
|
|||||||
|
import { ResourceTree } from "Explorer/Tree/ResourceTree";
|
||||||
import React, { FunctionComponent, MutableRefObject, useEffect, useRef } from "react";
|
import React, { FunctionComponent, MutableRefObject, useEffect, useRef } from "react";
|
||||||
import arrowLeftImg from "../../images/imgarrowlefticon.svg";
|
import arrowLeftImg from "../../images/imgarrowlefticon.svg";
|
||||||
import refreshImg from "../../images/refresh-cosmos.svg";
|
import refreshImg from "../../images/refresh-cosmos.svg";
|
||||||
|
import { AuthType } from "../AuthType";
|
||||||
import Explorer from "../Explorer/Explorer";
|
import Explorer from "../Explorer/Explorer";
|
||||||
import { ResourceTree } from "../Explorer/Tree/ResourceTree";
|
import { ResourceTokenTree } from "../Explorer/Tree/ResourceTokenTree";
|
||||||
|
import { ResourceTree2 } from "../Explorer/Tree2/ResourceTree";
|
||||||
import { userContext } from "../UserContext";
|
import { userContext } from "../UserContext";
|
||||||
import { getApiShortDisplayName } from "../Utils/APITypeUtils";
|
import { getApiShortDisplayName } from "../Utils/APITypeUtils";
|
||||||
|
import { Platform, configContext } from "./../ConfigContext";
|
||||||
import { NormalizedEventKey } from "./Constants";
|
import { NormalizedEventKey } from "./Constants";
|
||||||
|
|
||||||
export interface ResourceTreeContainerProps {
|
export interface ResourceTreeContainerProps {
|
||||||
@@ -70,8 +74,12 @@ export const ResourceTreeContainer: FunctionComponent<ResourceTreeContainerProps
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{userContext.features.enableKoResourceTree ? (
|
{userContext.authType === AuthType.ResourceToken ? (
|
||||||
|
<ResourceTokenTree />
|
||||||
|
) : userContext.features.enableKoResourceTree ? (
|
||||||
<div style={{ overflowY: "auto" }} data-bind="react:resourceTree" />
|
<div style={{ overflowY: "auto" }} data-bind="react:resourceTree" />
|
||||||
|
) : configContext.platform === Platform.Fabric ? (
|
||||||
|
<ResourceTree2 container={container} />
|
||||||
) : (
|
) : (
|
||||||
<ResourceTree container={container} />
|
<ResourceTree container={container} />
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -142,7 +142,7 @@ export const TableEntity: FunctionComponent<TableEntityProps> = ({
|
|||||||
<Image
|
<Image
|
||||||
{...imageProps}
|
{...imageProps}
|
||||||
src={EditIcon}
|
src={EditIcon}
|
||||||
alt={`Edit ${entityProperty} entity`}
|
alt="editEntity"
|
||||||
onClick={onEditEntity}
|
onClick={onEditEntity}
|
||||||
tabIndex={0}
|
tabIndex={0}
|
||||||
onKeyPress={handleKeyPress}
|
onKeyPress={handleKeyPress}
|
||||||
@@ -156,7 +156,7 @@ export const TableEntity: FunctionComponent<TableEntityProps> = ({
|
|||||||
<Image
|
<Image
|
||||||
{...imageProps}
|
{...imageProps}
|
||||||
src={DeleteIcon}
|
src={DeleteIcon}
|
||||||
alt={`Delete ${entityProperty} entity`}
|
alt="delete entity"
|
||||||
id="deleteEntity"
|
id="deleteEntity"
|
||||||
onClick={onDeleteEntity}
|
onClick={onDeleteEntity}
|
||||||
tabIndex={0}
|
tabIndex={0}
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
exports[`getCommonQueryOptions builds the correct default options objects 1`] = `
|
exports[`getCommonQueryOptions builds the correct default options objects 1`] = `
|
||||||
Object {
|
Object {
|
||||||
"disableNonStreamingOrderByQuery": true,
|
|
||||||
"enableScanInQuery": true,
|
"enableScanInQuery": true,
|
||||||
"forceQueryPlan": true,
|
"forceQueryPlan": true,
|
||||||
"maxDegreeOfParallelism": 0,
|
"maxDegreeOfParallelism": 0,
|
||||||
@@ -13,7 +12,6 @@ Object {
|
|||||||
|
|
||||||
exports[`getCommonQueryOptions reads from localStorage 1`] = `
|
exports[`getCommonQueryOptions reads from localStorage 1`] = `
|
||||||
Object {
|
Object {
|
||||||
"disableNonStreamingOrderByQuery": true,
|
|
||||||
"enableScanInQuery": true,
|
"enableScanInQuery": true,
|
||||||
"forceQueryPlan": true,
|
"forceQueryPlan": true,
|
||||||
"maxDegreeOfParallelism": 17,
|
"maxDegreeOfParallelism": 17,
|
||||||
|
|||||||
@@ -6,13 +6,13 @@ import { Action, ActionModifiers } from "../../Shared/Telemetry/TelemetryConstan
|
|||||||
import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
||||||
import { userContext } from "../../UserContext";
|
import { userContext } from "../../UserContext";
|
||||||
import { getCollectionName } from "../../Utils/APITypeUtils";
|
import { getCollectionName } from "../../Utils/APITypeUtils";
|
||||||
import { logConsoleInfo, logConsoleProgress } from "../../Utils/NotificationConsoleUtils";
|
|
||||||
import { createUpdateCassandraTable } from "../../Utils/arm/generatedClients/cosmos/cassandraResources";
|
import { createUpdateCassandraTable } from "../../Utils/arm/generatedClients/cosmos/cassandraResources";
|
||||||
import { createUpdateGremlinGraph } from "../../Utils/arm/generatedClients/cosmos/gremlinResources";
|
import { createUpdateGremlinGraph } from "../../Utils/arm/generatedClients/cosmos/gremlinResources";
|
||||||
import { createUpdateMongoDBCollection } from "../../Utils/arm/generatedClients/cosmos/mongoDBResources";
|
import { createUpdateMongoDBCollection } from "../../Utils/arm/generatedClients/cosmos/mongoDBResources";
|
||||||
import { createUpdateSqlContainer } from "../../Utils/arm/generatedClients/cosmos/sqlResources";
|
import { createUpdateSqlContainer } from "../../Utils/arm/generatedClients/cosmos/sqlResources";
|
||||||
import { createUpdateTable } from "../../Utils/arm/generatedClients/cosmos/tableResources";
|
import { createUpdateTable } from "../../Utils/arm/generatedClients/cosmos/tableResources";
|
||||||
import * as ARMTypes from "../../Utils/arm/generatedClients/cosmos/types";
|
import * as ARMTypes from "../../Utils/arm/generatedClients/cosmos/types";
|
||||||
|
import { logConsoleInfo, logConsoleProgress } from "../../Utils/NotificationConsoleUtils";
|
||||||
import { client } from "../CosmosClient";
|
import { client } from "../CosmosClient";
|
||||||
import { handleError } from "../ErrorHandlingUtils";
|
import { handleError } from "../ErrorHandlingUtils";
|
||||||
import { createMongoCollectionWithProxy } from "../MongoProxyClient";
|
import { createMongoCollectionWithProxy } from "../MongoProxyClient";
|
||||||
@@ -96,9 +96,6 @@ const createSqlContainer = async (params: DataModels.CreateCollectionParams): Pr
|
|||||||
if (params.uniqueKeyPolicy) {
|
if (params.uniqueKeyPolicy) {
|
||||||
resource.uniqueKeyPolicy = params.uniqueKeyPolicy;
|
resource.uniqueKeyPolicy = params.uniqueKeyPolicy;
|
||||||
}
|
}
|
||||||
if (params.vectorEmbeddingPolicy) {
|
|
||||||
resource.vectorEmbeddingPolicy = params.vectorEmbeddingPolicy;
|
|
||||||
}
|
|
||||||
|
|
||||||
const rpPayload: ARMTypes.SqlDatabaseCreateUpdateParameters = {
|
const rpPayload: ARMTypes.SqlDatabaseCreateUpdateParameters = {
|
||||||
properties: {
|
properties: {
|
||||||
|
|||||||
@@ -122,21 +122,14 @@ const pollDataTransferJobOperation = async (
|
|||||||
|
|
||||||
updateDataTransferJob(body);
|
updateDataTransferJob(body);
|
||||||
|
|
||||||
if (status === "Cancelled") {
|
if (status === "Cancelled" || status === "Failed" || status === "Faulted") {
|
||||||
removeFromPolling(jobName);
|
|
||||||
clearMessage && clearMessage();
|
|
||||||
const cancelMessage = `Data transfer job ${jobName} cancelled`;
|
|
||||||
NotificationConsoleUtils.logConsoleError(cancelMessage);
|
|
||||||
throw new AbortError(cancelMessage);
|
|
||||||
}
|
|
||||||
if (status === "Failed" || status === "Faulted") {
|
|
||||||
removeFromPolling(jobName);
|
removeFromPolling(jobName);
|
||||||
const errorMessage = body?.properties?.error
|
const errorMessage = body?.properties?.error
|
||||||
? JSON.stringify(body?.properties?.error)
|
? JSON.stringify(body?.properties?.error)
|
||||||
: "Operation could not be completed";
|
: "Operation could not be completed";
|
||||||
const error = new Error(errorMessage);
|
const error = new Error(errorMessage);
|
||||||
clearMessage && clearMessage();
|
clearMessage && clearMessage();
|
||||||
NotificationConsoleUtils.logConsoleError(`Data transfer job ${jobName} failed: ${errorMessage}`);
|
NotificationConsoleUtils.logConsoleError(`Data transfer job ${jobName} Failed`);
|
||||||
throw new AbortError(error);
|
throw new AbortError(error);
|
||||||
}
|
}
|
||||||
if (status === "Completed") {
|
if (status === "Completed") {
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import { BulkOperationType, OperationInput } from "@azure/cosmos";
|
|
||||||
import { CollectionBase } from "../../Contracts/ViewModels";
|
import { CollectionBase } from "../../Contracts/ViewModels";
|
||||||
import DocumentId from "../../Explorer/Tree/DocumentId";
|
import DocumentId from "../../Explorer/Tree/DocumentId";
|
||||||
import { logConsoleInfo, logConsoleProgress } from "../../Utils/NotificationConsoleUtils";
|
import { logConsoleInfo, logConsoleProgress } from "../../Utils/NotificationConsoleUtils";
|
||||||
@@ -25,58 +24,3 @@ export const deleteDocument = async (collection: CollectionBase, documentId: Doc
|
|||||||
clearMessage();
|
clearMessage();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* Bulk delete documents
|
|
||||||
* @param collection
|
|
||||||
* @param documentId
|
|
||||||
* @returns array of ids that were successfully deleted
|
|
||||||
*/
|
|
||||||
export const deleteDocuments = async (collection: CollectionBase, documentIds: DocumentId[]): Promise<DocumentId[]> => {
|
|
||||||
const nbDocuments = documentIds.length;
|
|
||||||
const clearMessage = logConsoleProgress(`Deleting ${documentIds.length} ${getEntityName(true)}`);
|
|
||||||
try {
|
|
||||||
const v2Container = await client().database(collection.databaseId).container(collection.id());
|
|
||||||
|
|
||||||
// Bulk can only delete 100 documents at a time
|
|
||||||
const BULK_DELETE_LIMIT = 100;
|
|
||||||
const promiseArray = [];
|
|
||||||
|
|
||||||
while (documentIds.length > 0) {
|
|
||||||
const documentIdsChunk = documentIds.splice(0, BULK_DELETE_LIMIT);
|
|
||||||
const operations: OperationInput[] = documentIdsChunk.map((documentId) => ({
|
|
||||||
id: documentId.id(),
|
|
||||||
// bulk delete: if not partition key is specified, do not pass empty array, but undefined
|
|
||||||
partitionKey:
|
|
||||||
documentId.partitionKeyValue &&
|
|
||||||
Array.isArray(documentId.partitionKeyValue) &&
|
|
||||||
documentId.partitionKeyValue.length === 0
|
|
||||||
? undefined
|
|
||||||
: documentId.partitionKeyValue,
|
|
||||||
operationType: BulkOperationType.Delete,
|
|
||||||
}));
|
|
||||||
|
|
||||||
const promise = v2Container.items.bulk(operations).then((bulkResult) => {
|
|
||||||
return documentIdsChunk.filter((_, index) => bulkResult[index].statusCode === 204);
|
|
||||||
});
|
|
||||||
promiseArray.push(promise);
|
|
||||||
}
|
|
||||||
|
|
||||||
const allResult = await Promise.all(promiseArray);
|
|
||||||
const flatAllResult = Array.prototype.concat.apply([], allResult);
|
|
||||||
logConsoleInfo(
|
|
||||||
`Successfully deleted ${getEntityName(flatAllResult.length > 1)}: ${flatAllResult.length} out of ${nbDocuments}`,
|
|
||||||
);
|
|
||||||
// TODO: handle case result.length != nbDocuments
|
|
||||||
return flatAllResult;
|
|
||||||
} catch (error) {
|
|
||||||
handleError(
|
|
||||||
error,
|
|
||||||
"DeleteDocuments",
|
|
||||||
`Error while deleting ${documentIds.length} ${getEntityName(documentIds.length > 1)}`,
|
|
||||||
);
|
|
||||||
throw error;
|
|
||||||
} finally {
|
|
||||||
clearMessage();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import { FeedOptions, ItemDefinition, QueryIterator, Resource } from "@azure/cosmos";
|
import { FeedOptions, ItemDefinition, QueryIterator, Resource } from "@azure/cosmos";
|
||||||
import { isVectorSearchEnabled } from "Utils/CapabilityUtils";
|
|
||||||
import { LocalStorageUtility, StorageKey } from "../../Shared/StorageUtility";
|
import { LocalStorageUtility, StorageKey } from "../../Shared/StorageUtility";
|
||||||
import { Queries } from "../Constants";
|
import { Queries } from "../Constants";
|
||||||
import { client } from "../CosmosClient";
|
import { client } from "../CosmosClient";
|
||||||
@@ -27,6 +26,5 @@ export const getCommonQueryOptions = (options: FeedOptions): FeedOptions => {
|
|||||||
(storedItemPerPageSetting !== undefined && storedItemPerPageSetting) ||
|
(storedItemPerPageSetting !== undefined && storedItemPerPageSetting) ||
|
||||||
Queries.itemsPerPage;
|
Queries.itemsPerPage;
|
||||||
options.maxDegreeOfParallelism = LocalStorageUtility.getEntryNumber(StorageKey.MaxDegreeOfParellism);
|
options.maxDegreeOfParallelism = LocalStorageUtility.getEntryNumber(StorageKey.MaxDegreeOfParellism);
|
||||||
options.disableNonStreamingOrderByQuery = !isVectorSearchEnabled();
|
|
||||||
return options;
|
return options;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { CosmosClient } from "@azure/cosmos";
|
|||||||
import { sampleDataClient } from "Common/SampleDataClient";
|
import { sampleDataClient } from "Common/SampleDataClient";
|
||||||
import { userContext } from "UserContext";
|
import { userContext } from "UserContext";
|
||||||
import * as DataModels from "../../Contracts/DataModels";
|
import * as DataModels from "../../Contracts/DataModels";
|
||||||
|
import { logConsoleProgress } from "../../Utils/NotificationConsoleUtils";
|
||||||
import { client } from "../CosmosClient";
|
import { client } from "../CosmosClient";
|
||||||
import { handleError } from "../ErrorHandlingUtils";
|
import { handleError } from "../ErrorHandlingUtils";
|
||||||
|
|
||||||
@@ -30,6 +31,7 @@ export async function readCollectionInternal(
|
|||||||
collectionId: string,
|
collectionId: string,
|
||||||
): Promise<DataModels.Collection> {
|
): Promise<DataModels.Collection> {
|
||||||
let collection: DataModels.Collection;
|
let collection: DataModels.Collection;
|
||||||
|
const clearMessage = logConsoleProgress(`Querying container ${collectionId}`);
|
||||||
try {
|
try {
|
||||||
const response = await cosmosClient.database(databaseId).container(collectionId).read();
|
const response = await cosmosClient.database(databaseId).container(collectionId).read();
|
||||||
collection = response.resource as DataModels.Collection;
|
collection = response.resource as DataModels.Collection;
|
||||||
@@ -37,5 +39,6 @@ export async function readCollectionInternal(
|
|||||||
handleError(error, "ReadCollection", `Error while querying container ${collectionId}`);
|
handleError(error, "ReadCollection", `Error while querying container ${collectionId}`);
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
|
clearMessage();
|
||||||
return collection;
|
return collection;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,4 @@
|
|||||||
import {
|
import { CassandraProxyEndpoints, JunoEndpoints, MongoProxyEndpoints } from "Common/Constants";
|
||||||
BackendApi,
|
|
||||||
CassandraProxyEndpoints,
|
|
||||||
JunoEndpoints,
|
|
||||||
MongoProxyEndpoints,
|
|
||||||
PortalBackendEndpoints,
|
|
||||||
} from "Common/Constants";
|
|
||||||
import {
|
import {
|
||||||
allowedAadEndpoints,
|
allowedAadEndpoints,
|
||||||
allowedArcadiaEndpoints,
|
allowedArcadiaEndpoints,
|
||||||
@@ -42,22 +36,14 @@ export interface ConfigContext {
|
|||||||
ARM_API_VERSION: string;
|
ARM_API_VERSION: string;
|
||||||
GRAPH_ENDPOINT: string;
|
GRAPH_ENDPOINT: string;
|
||||||
GRAPH_API_VERSION: string;
|
GRAPH_API_VERSION: string;
|
||||||
// This is the endpoint to get offering Ids to be used to fetch prices. Refer to this doc: https://learn.microsoft.com/en-us/rest/api/marketplacecatalog/dataplane/skus/list?view=rest-marketplacecatalog-dataplane-2023-05-01-preview&tabs=HTTP
|
|
||||||
CATALOG_ENDPOINT: string;
|
|
||||||
CATALOG_API_VERSION: string;
|
|
||||||
CATALOG_API_KEY: string;
|
|
||||||
ARCADIA_ENDPOINT: string;
|
ARCADIA_ENDPOINT: string;
|
||||||
ARCADIA_LIVY_ENDPOINT_DNS_ZONE: string;
|
ARCADIA_LIVY_ENDPOINT_DNS_ZONE: string;
|
||||||
BACKEND_ENDPOINT?: string;
|
BACKEND_ENDPOINT?: string;
|
||||||
PORTAL_BACKEND_ENDPOINT?: string;
|
|
||||||
NEW_BACKEND_APIS?: BackendApi[];
|
|
||||||
MONGO_BACKEND_ENDPOINT?: string;
|
MONGO_BACKEND_ENDPOINT?: string;
|
||||||
MONGO_PROXY_ENDPOINT?: string;
|
MONGO_PROXY_ENDPOINT?: string;
|
||||||
MONGO_PROXY_OUTBOUND_IPS_ALLOWLISTED?: boolean;
|
MONGO_PROXY_OUTBOUND_IPS_ALLOWLISTED?: boolean;
|
||||||
NEW_MONGO_APIS?: string[];
|
NEW_MONGO_APIS?: string[];
|
||||||
CASSANDRA_PROXY_ENDPOINT?: string;
|
CASSANDRA_PROXY_ENDPOINT?: string;
|
||||||
CASSANDRA_PROXY_OUTBOUND_IPS_ALLOWLISTED: boolean;
|
|
||||||
NEW_CASSANDRA_APIS?: string[];
|
|
||||||
PROXY_PATH?: string;
|
PROXY_PATH?: string;
|
||||||
JUNO_ENDPOINT: string;
|
JUNO_ENDPOINT: string;
|
||||||
GITHUB_CLIENT_ID: string;
|
GITHUB_CLIENT_ID: string;
|
||||||
@@ -87,7 +73,6 @@ let configContext: Readonly<ConfigContext> = {
|
|||||||
`^https:\\/\\/.*\\.analysis-df\\.net$`,
|
`^https:\\/\\/.*\\.analysis-df\\.net$`,
|
||||||
`^https:\\/\\/.*\\.analysis-df\\.windows\\.net$`,
|
`^https:\\/\\/.*\\.analysis-df\\.windows\\.net$`,
|
||||||
`^https:\\/\\/.*\\.azure-test\\.net$`,
|
`^https:\\/\\/.*\\.azure-test\\.net$`,
|
||||||
`^https:\\/\\/cosmos-explorer-preview\\.azurewebsites\\.net`,
|
|
||||||
], // Webpack injects this at build time
|
], // Webpack injects this at build time
|
||||||
gitSha: process.env.GIT_SHA,
|
gitSha: process.env.GIT_SHA,
|
||||||
hostedExplorerURL: "https://cosmos.azure.com/",
|
hostedExplorerURL: "https://cosmos.azure.com/",
|
||||||
@@ -97,31 +82,23 @@ let configContext: Readonly<ConfigContext> = {
|
|||||||
ARM_API_VERSION: "2016-06-01",
|
ARM_API_VERSION: "2016-06-01",
|
||||||
GRAPH_ENDPOINT: "https://graph.microsoft.com",
|
GRAPH_ENDPOINT: "https://graph.microsoft.com",
|
||||||
GRAPH_API_VERSION: "1.6",
|
GRAPH_API_VERSION: "1.6",
|
||||||
CATALOG_ENDPOINT: "https://catalogapi.azure.com/",
|
|
||||||
CATALOG_API_VERSION: "2023-05-01-preview",
|
|
||||||
CATALOG_API_KEY: "",
|
|
||||||
ARCADIA_ENDPOINT: "https://workspaceartifacts.projectarcadia.net",
|
ARCADIA_ENDPOINT: "https://workspaceartifacts.projectarcadia.net",
|
||||||
ARCADIA_LIVY_ENDPOINT_DNS_ZONE: "dev.azuresynapse.net",
|
ARCADIA_LIVY_ENDPOINT_DNS_ZONE: "dev.azuresynapse.net",
|
||||||
GITHUB_CLIENT_ID: "6cb2f63cf6f7b5cbdeca", // Registered OAuth app: https://github.com/organizations/AzureCosmosDBNotebooks/settings/applications/1189306
|
GITHUB_CLIENT_ID: "6cb2f63cf6f7b5cbdeca", // Registered OAuth app: https://github.com/organizations/AzureCosmosDBNotebooks/settings/applications/1189306
|
||||||
GITHUB_TEST_ENV_CLIENT_ID: "b63fc8cbf87fd3c6e2eb", // Registered OAuth app: https://github.com/organizations/AzureCosmosDBNotebooks/settings/applications/1777772
|
GITHUB_TEST_ENV_CLIENT_ID: "b63fc8cbf87fd3c6e2eb", // Registered OAuth app: https://github.com/organizations/AzureCosmosDBNotebooks/settings/applications/1777772
|
||||||
JUNO_ENDPOINT: JunoEndpoints.Prod,
|
JUNO_ENDPOINT: JunoEndpoints.Prod,
|
||||||
BACKEND_ENDPOINT: "https://main.documentdb.ext.azure.com",
|
BACKEND_ENDPOINT: "https://main.documentdb.ext.azure.com",
|
||||||
PORTAL_BACKEND_ENDPOINT: PortalBackendEndpoints.Prod,
|
|
||||||
MONGO_PROXY_ENDPOINT: MongoProxyEndpoints.Prod,
|
MONGO_PROXY_ENDPOINT: MongoProxyEndpoints.Prod,
|
||||||
NEW_MONGO_APIS: [
|
NEW_MONGO_APIS: [
|
||||||
// "resourcelist",
|
// "resourcelist",
|
||||||
// "queryDocuments",
|
|
||||||
// "createDocument",
|
// "createDocument",
|
||||||
// "readDocument",
|
// "readDocument",
|
||||||
// "updateDocument",
|
// "updateDocument",
|
||||||
// "deleteDocument",
|
// "deleteDocument",
|
||||||
// "createCollectionWithProxy",
|
// "createCollectionWithProxy",
|
||||||
// "legacyMongoShell",
|
|
||||||
],
|
],
|
||||||
MONGO_PROXY_OUTBOUND_IPS_ALLOWLISTED: false,
|
MONGO_PROXY_OUTBOUND_IPS_ALLOWLISTED: false,
|
||||||
CASSANDRA_PROXY_ENDPOINT: CassandraProxyEndpoints.Prod,
|
CASSANDRA_PROXY_ENDPOINT: CassandraProxyEndpoints.Prod,
|
||||||
NEW_CASSANDRA_APIS: ["postQuery", "createOrDelete", "getKeys", "getSchema"],
|
|
||||||
CASSANDRA_PROXY_OUTBOUND_IPS_ALLOWLISTED: false,
|
|
||||||
isTerminalEnabled: false,
|
isTerminalEnabled: false,
|
||||||
isPhoenixEnabled: false,
|
isPhoenixEnabled: false,
|
||||||
};
|
};
|
||||||
@@ -199,9 +176,6 @@ if (process.env.NODE_ENV === "development") {
|
|||||||
updateConfigContext({
|
updateConfigContext({
|
||||||
PROXY_PATH: "/proxy",
|
PROXY_PATH: "/proxy",
|
||||||
EMULATOR_ENDPOINT: "https://localhost:8081",
|
EMULATOR_ENDPOINT: "https://localhost:8081",
|
||||||
PORTAL_BACKEND_ENDPOINT: PortalBackendEndpoints.Mpac,
|
|
||||||
MONGO_PROXY_ENDPOINT: MongoProxyEndpoints.Mpac,
|
|
||||||
CASSANDRA_PROXY_ENDPOINT: CassandraProxyEndpoints.Mpac,
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
export interface QueryRequestOptions {
|
export interface QueryRequestOptions {
|
||||||
$skipToken?: string;
|
$skipToken?: string;
|
||||||
$top?: number;
|
$top?: number;
|
||||||
$allowPartialScopes: boolean;
|
subscriptions: string[];
|
||||||
subscriptions?: string[];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface QueryResponse {
|
export interface QueryResponse {
|
||||||
|
|||||||
@@ -1,22 +1,37 @@
|
|||||||
import { FabricMessageTypes } from "./FabricMessageTypes";
|
import { MessageTypes } from "./MessageTypes";
|
||||||
|
|
||||||
// This is the current version of these messages
|
// This is the current version of these messages
|
||||||
export const DATA_EXPLORER_RPC_VERSION = "3";
|
export const DATA_EXPLORER_RPC_VERSION = "2";
|
||||||
|
|
||||||
// Data Explorer to Fabric
|
// Data Explorer to Fabric
|
||||||
export type DataExploreMessageV3 =
|
|
||||||
|
// TODO Remove when upgrading to Fabric v2
|
||||||
|
export type DataExploreMessageV1 =
|
||||||
|
| "ready"
|
||||||
| {
|
| {
|
||||||
type: FabricMessageTypes.Ready;
|
type: MessageTypes.GetAuthorizationToken;
|
||||||
id: string;
|
|
||||||
params: [string]; // version
|
|
||||||
}
|
|
||||||
| {
|
|
||||||
type: FabricMessageTypes.GetAuthorizationToken;
|
|
||||||
id: string;
|
id: string;
|
||||||
params: GetCosmosTokenMessageOptions[];
|
params: GetCosmosTokenMessageOptions[];
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
type: FabricMessageTypes.GetAllResourceTokens;
|
type: MessageTypes.GetAllResourceTokens;
|
||||||
|
id: string;
|
||||||
|
};
|
||||||
|
// -----------------------------
|
||||||
|
|
||||||
|
export type DataExploreMessageV2 =
|
||||||
|
| {
|
||||||
|
type: MessageTypes.Ready;
|
||||||
|
id: string;
|
||||||
|
params: [string]; // version
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
type: MessageTypes.GetAuthorizationToken;
|
||||||
|
id: string;
|
||||||
|
params: GetCosmosTokenMessageOptions[];
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
type: MessageTypes.GetAllResourceTokens;
|
||||||
id: string;
|
id: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { CapacityMode, ConnectionStatusType, ContainerStatusType } from "../Common/Constants";
|
import { ConnectionStatusType, ContainerStatusType } from "../Common/Constants";
|
||||||
|
|
||||||
export interface ArmEntity {
|
export interface ArmEntity {
|
||||||
id: string;
|
id: string;
|
||||||
@@ -35,7 +35,6 @@ export interface DatabaseAccountExtendedProperties {
|
|||||||
ipRules?: IpRule[];
|
ipRules?: IpRule[];
|
||||||
privateEndpointConnections?: unknown[];
|
privateEndpointConnections?: unknown[];
|
||||||
capacity?: { totalThroughputLimit: number };
|
capacity?: { totalThroughputLimit: number };
|
||||||
capacityMode?: CapacityMode;
|
|
||||||
locations?: DatabaseAccountResponseLocation[];
|
locations?: DatabaseAccountResponseLocation[];
|
||||||
postgresqlEndpoint?: string;
|
postgresqlEndpoint?: string;
|
||||||
publicNetworkAccess?: string;
|
publicNetworkAccess?: string;
|
||||||
@@ -158,10 +157,8 @@ export interface Collection extends Resource {
|
|||||||
changeFeedPolicy?: ChangeFeedPolicy;
|
changeFeedPolicy?: ChangeFeedPolicy;
|
||||||
analyticalStorageTtl?: number;
|
analyticalStorageTtl?: number;
|
||||||
geospatialConfig?: GeospatialConfig;
|
geospatialConfig?: GeospatialConfig;
|
||||||
vectorEmbeddingPolicy?: VectorEmbeddingPolicy;
|
|
||||||
schema?: ISchema;
|
schema?: ISchema;
|
||||||
requestSchema?: () => void;
|
requestSchema?: () => void;
|
||||||
computedProperties?: ComputedProperties;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CollectionsWithPagination {
|
export interface CollectionsWithPagination {
|
||||||
@@ -196,23 +193,10 @@ export interface IndexingPolicy {
|
|||||||
indexingMode: "consistent" | "lazy" | "none";
|
indexingMode: "consistent" | "lazy" | "none";
|
||||||
includedPaths: any;
|
includedPaths: any;
|
||||||
excludedPaths: any;
|
excludedPaths: any;
|
||||||
compositeIndexes?: any[];
|
compositeIndexes?: any;
|
||||||
spatialIndexes?: any[];
|
spatialIndexes?: any;
|
||||||
vectorIndexes?: VectorIndex[];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface VectorIndex {
|
|
||||||
path: string;
|
|
||||||
type: "flat" | "diskANN" | "quantizedFlat";
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ComputedProperty {
|
|
||||||
name: string;
|
|
||||||
query: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export type ComputedProperties = ComputedProperty[];
|
|
||||||
|
|
||||||
export interface PartitionKey {
|
export interface PartitionKey {
|
||||||
paths: string[];
|
paths: string[];
|
||||||
kind: "Hash" | "Range" | "MultiHash";
|
kind: "Hash" | "Range" | "MultiHash";
|
||||||
@@ -341,18 +325,6 @@ export interface CreateCollectionParams {
|
|||||||
partitionKey?: PartitionKey;
|
partitionKey?: PartitionKey;
|
||||||
uniqueKeyPolicy?: UniqueKeyPolicy;
|
uniqueKeyPolicy?: UniqueKeyPolicy;
|
||||||
createMongoWildcardIndex?: boolean;
|
createMongoWildcardIndex?: boolean;
|
||||||
vectorEmbeddingPolicy?: VectorEmbeddingPolicy;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface VectorEmbeddingPolicy {
|
|
||||||
vectorEmbeddings: VectorEmbedding[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface VectorEmbedding {
|
|
||||||
dataType: "float16" | "float32" | "uint8" | "int8";
|
|
||||||
dimensions: number;
|
|
||||||
distanceFunction: "euclidean" | "cosine" | "dotproduct";
|
|
||||||
path: string;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ReadDatabaseOfferParams {
|
export interface ReadDatabaseOfferParams {
|
||||||
|
|||||||
@@ -1,13 +0,0 @@
|
|||||||
/**
|
|
||||||
* Data Explorer -> Fabric communication.
|
|
||||||
*/
|
|
||||||
export enum FabricMessageTypes {
|
|
||||||
GetAuthorizationToken = "GetAuthorizationToken",
|
|
||||||
GetAllResourceTokens = "GetAllResourceTokens",
|
|
||||||
Ready = "Ready",
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface AuthorizationToken {
|
|
||||||
XDate: string;
|
|
||||||
PrimaryReadWriteToken: string;
|
|
||||||
}
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import { AuthorizationToken } from "Contracts/FabricMessageTypes";
|
import { AuthorizationToken } from "./MessageTypes";
|
||||||
|
|
||||||
// This is the version of these messages
|
// This is the version of these messages
|
||||||
export const FABRIC_RPC_VERSION = "2";
|
export const FABRIC_RPC_VERSION = "2";
|
||||||
@@ -53,7 +53,6 @@ export type FabricMessageV2 =
|
|||||||
id: string;
|
id: string;
|
||||||
message: {
|
message: {
|
||||||
connectionId: string;
|
connectionId: string;
|
||||||
isVisible: boolean;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
@@ -73,7 +72,7 @@ export type FabricMessageV2 =
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
type: "explorerVisible";
|
type: "setToolbarStatus";
|
||||||
message: {
|
message: {
|
||||||
visible: boolean;
|
visible: boolean;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,13 +1,12 @@
|
|||||||
/**
|
/**
|
||||||
* Messaging types used with Data Explorer <-> Portal communication,
|
* Messaging types used with Data Explorer <-> Portal communication,
|
||||||
* Hosted <-> Explorer communication
|
* Hosted <-> Explorer communication and Data Explorer -> Fabric communication.
|
||||||
*
|
*
|
||||||
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
* WARNING: !!!!!!! YOU CAN ONLY ADD NEW TYPES TO THE END OF THIS ENUM !!!!!!!
|
* WARNING: !!!!!!! YOU CAN ONLY ADD NEW TYPES TO THE END OF THIS ENUM !!!!!!!
|
||||||
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
*
|
*
|
||||||
* Enum are integers, so inserting or deleting a type will break the communication.
|
* Enum are integers, so inserting or deleting a type will break the communication.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
export enum MessageTypes {
|
export enum MessageTypes {
|
||||||
TelemetryInfo,
|
TelemetryInfo,
|
||||||
@@ -44,9 +43,13 @@ export enum MessageTypes {
|
|||||||
DisplayNPSSurvey,
|
DisplayNPSSurvey,
|
||||||
OpenVCoreMongoNetworkingBlade,
|
OpenVCoreMongoNetworkingBlade,
|
||||||
OpenVCoreMongoConnectionStringsBlade,
|
OpenVCoreMongoConnectionStringsBlade,
|
||||||
GetAuthorizationToken, // unused. Can be removed if the portal uses the same list of enums.
|
GetAuthorizationToken, // Data Explorer -> Fabric
|
||||||
GetAllResourceTokens, // unused. Can be removed if the portal uses the same list of enums.
|
GetAllResourceTokens, // Data Explorer -> Fabric
|
||||||
Ready, // unused. Can be removed if the portal uses the same list of enums.
|
Ready, // Data Explorer -> Fabric
|
||||||
OpenCESCVAFeedbackBlade,
|
OpenCESCVAFeedbackBlade,
|
||||||
ActivateTab,
|
}
|
||||||
|
|
||||||
|
export interface AuthorizationToken {
|
||||||
|
XDate: string;
|
||||||
|
PrimaryReadWriteToken: string;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -135,7 +135,6 @@ export interface Collection extends CollectionBase {
|
|||||||
changeFeedPolicy: ko.Observable<DataModels.ChangeFeedPolicy>;
|
changeFeedPolicy: ko.Observable<DataModels.ChangeFeedPolicy>;
|
||||||
geospatialConfig: ko.Observable<DataModels.GeospatialConfig>;
|
geospatialConfig: ko.Observable<DataModels.GeospatialConfig>;
|
||||||
documentIds: ko.ObservableArray<DocumentId>;
|
documentIds: ko.ObservableArray<DocumentId>;
|
||||||
computedProperties: ko.Observable<DataModels.ComputedProperties>;
|
|
||||||
|
|
||||||
cassandraKeys: CassandraTableKeys;
|
cassandraKeys: CassandraTableKeys;
|
||||||
cassandraSchema: CassandraTableKey[];
|
cassandraSchema: CassandraTableKey[];
|
||||||
@@ -176,11 +175,6 @@ export interface Collection extends CollectionBase {
|
|||||||
loadTriggers(): Promise<any>;
|
loadTriggers(): Promise<any>;
|
||||||
loadOffer(): Promise<void>;
|
loadOffer(): Promise<void>;
|
||||||
|
|
||||||
showStoredProcedures: ko.Observable<boolean>;
|
|
||||||
showTriggers: ko.Observable<boolean>;
|
|
||||||
showUserDefinedFunctions: ko.Observable<boolean>;
|
|
||||||
showConflicts: ko.Observable<boolean>;
|
|
||||||
|
|
||||||
createStoredProcedureNode(data: StoredProcedureDefinition & Resource): StoredProcedure;
|
createStoredProcedureNode(data: StoredProcedureDefinition & Resource): StoredProcedure;
|
||||||
createUserDefinedFunctionNode(data: UserDefinedFunctionDefinition & Resource): UserDefinedFunction;
|
createUserDefinedFunctionNode(data: UserDefinedFunctionDefinition & Resource): UserDefinedFunction;
|
||||||
createTriggerNode(data: TriggerDefinition | SqlTriggerResource): Trigger;
|
createTriggerNode(data: TriggerDefinition | SqlTriggerResource): Trigger;
|
||||||
@@ -329,9 +323,9 @@ export enum DocumentExplorerState {
|
|||||||
noDocumentSelected,
|
noDocumentSelected,
|
||||||
newDocumentValid,
|
newDocumentValid,
|
||||||
newDocumentInvalid,
|
newDocumentInvalid,
|
||||||
existingDocumentNoEdits,
|
exisitingDocumentNoEdits,
|
||||||
existingDocumentDirtyValid,
|
exisitingDocumentDirtyValid,
|
||||||
existingDocumentDirtyInvalid,
|
exisitingDocumentDirtyInvalid,
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum IndexingPolicyEditorState {
|
export enum IndexingPolicyEditorState {
|
||||||
@@ -344,9 +338,9 @@ export enum IndexingPolicyEditorState {
|
|||||||
export enum ScriptEditorState {
|
export enum ScriptEditorState {
|
||||||
newInvalid,
|
newInvalid,
|
||||||
newValid,
|
newValid,
|
||||||
existingNoEdits,
|
exisitingNoEdits,
|
||||||
existingDirtyValid,
|
exisitingDirtyValid,
|
||||||
existingDirtyInvalid,
|
exisitingDirtyInvalid,
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum CollectionTabKind {
|
export enum CollectionTabKind {
|
||||||
@@ -392,7 +386,6 @@ export interface DataExplorerInputsFrame {
|
|||||||
dnsSuffix?: string;
|
dnsSuffix?: string;
|
||||||
serverId?: string;
|
serverId?: string;
|
||||||
extensionEndpoint?: string;
|
extensionEndpoint?: string;
|
||||||
portalBackendEndpoint?: string;
|
|
||||||
mongoProxyEndpoint?: string;
|
mongoProxyEndpoint?: string;
|
||||||
cassandraProxyEndpoint?: string;
|
cassandraProxyEndpoint?: string;
|
||||||
subscriptionType?: SubscriptionType;
|
subscriptionType?: SubscriptionType;
|
||||||
@@ -414,7 +407,6 @@ export interface DataExplorerInputsFrame {
|
|||||||
features?: {
|
features?: {
|
||||||
[key: string]: string;
|
[key: string]: string;
|
||||||
};
|
};
|
||||||
feedbackPolicies?: any;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SelfServeFrameInputs {
|
export interface SelfServeFrameInputs {
|
||||||
@@ -425,7 +417,6 @@ export interface SelfServeFrameInputs {
|
|||||||
authorizationToken: string;
|
authorizationToken: string;
|
||||||
csmEndpoint: string;
|
csmEndpoint: string;
|
||||||
flights?: readonly string[];
|
flights?: readonly string[];
|
||||||
catalogAPIKey: string;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class MonacoEditorSettings {
|
export class MonacoEditorSettings {
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import { TreeNodeMenuItem } from "Explorer/Controls/TreeComponent/TreeNodeComponent";
|
|
||||||
import { useDatabases } from "Explorer/useDatabases";
|
import { useDatabases } from "Explorer/useDatabases";
|
||||||
import { Action } from "Shared/Telemetry/TelemetryConstants";
|
import { Action } from "Shared/Telemetry/TelemetryConstants";
|
||||||
import { traceOpen } from "Shared/Telemetry/TelemetryProcessor";
|
import { traceOpen } from "Shared/Telemetry/TelemetryProcessor";
|
||||||
@@ -20,6 +19,7 @@ import { userContext } from "../UserContext";
|
|||||||
import { getCollectionName, getDatabaseName } from "../Utils/APITypeUtils";
|
import { getCollectionName, getDatabaseName } from "../Utils/APITypeUtils";
|
||||||
import { useSidePanel } from "../hooks/useSidePanel";
|
import { useSidePanel } from "../hooks/useSidePanel";
|
||||||
import { Platform, configContext } from "./../ConfigContext";
|
import { Platform, configContext } from "./../ConfigContext";
|
||||||
|
import { TreeNodeMenuItem } from "./Controls/TreeComponent/TreeComponent";
|
||||||
import Explorer from "./Explorer";
|
import Explorer from "./Explorer";
|
||||||
import { useNotebook } from "./Notebook/useNotebook";
|
import { useNotebook } from "./Notebook/useNotebook";
|
||||||
import { DeleteCollectionConfirmationPane } from "./Panes/DeleteCollectionConfirmationPane/DeleteCollectionConfirmationPane";
|
import { DeleteCollectionConfirmationPane } from "./Panes/DeleteCollectionConfirmationPane/DeleteCollectionConfirmationPane";
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { DirectionalHint, Icon, Label, Stack, TooltipHost } from "@fluentui/react";
|
import { Icon, Label, Stack } from "@fluentui/react";
|
||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
import { NormalizedEventKey } from "../../../Common/Constants";
|
import { NormalizedEventKey } from "../../../Common/Constants";
|
||||||
import { accordionStackTokens } from "../Settings/SettingsRenderUtils";
|
import { accordionStackTokens } from "../Settings/SettingsRenderUtils";
|
||||||
@@ -8,7 +8,6 @@ export interface CollapsibleSectionProps {
|
|||||||
isExpandedByDefault: boolean;
|
isExpandedByDefault: boolean;
|
||||||
onExpand?: () => void;
|
onExpand?: () => void;
|
||||||
children: JSX.Element;
|
children: JSX.Element;
|
||||||
tooltipContent?: string | JSX.Element | JSX.Element[];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CollapsibleSectionState {
|
export interface CollapsibleSectionState {
|
||||||
@@ -27,8 +26,8 @@ export class CollapsibleSectionComponent extends React.Component<CollapsibleSect
|
|||||||
this.setState({ isExpanded: !this.state.isExpanded });
|
this.setState({ isExpanded: !this.state.isExpanded });
|
||||||
};
|
};
|
||||||
|
|
||||||
public componentDidUpdate(_prevProps: CollapsibleSectionProps, prevState: CollapsibleSectionState): void {
|
public componentDidUpdate(): void {
|
||||||
if (!prevState.isExpanded && this.state.isExpanded && this.props.onExpand) {
|
if (this.state.isExpanded && this.props.onExpand) {
|
||||||
this.props.onExpand();
|
this.props.onExpand();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -44,7 +43,7 @@ export class CollapsibleSectionComponent extends React.Component<CollapsibleSect
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Stack
|
<Stack
|
||||||
className={"collapsibleSection"}
|
className="collapsibleSection"
|
||||||
horizontal
|
horizontal
|
||||||
verticalAlign="center"
|
verticalAlign="center"
|
||||||
tokens={accordionStackTokens}
|
tokens={accordionStackTokens}
|
||||||
@@ -56,19 +55,6 @@ export class CollapsibleSectionComponent extends React.Component<CollapsibleSect
|
|||||||
>
|
>
|
||||||
<Icon iconName={this.state.isExpanded ? "ChevronDown" : "ChevronRight"} />
|
<Icon iconName={this.state.isExpanded ? "ChevronDown" : "ChevronRight"} />
|
||||||
<Label>{this.props.title}</Label>
|
<Label>{this.props.title}</Label>
|
||||||
{this.props.tooltipContent && (
|
|
||||||
<TooltipHost
|
|
||||||
directionalHint={DirectionalHint.bottomLeftEdge}
|
|
||||||
content={this.props.tooltipContent}
|
|
||||||
styles={{
|
|
||||||
root: {
|
|
||||||
marginLeft: "0 !important",
|
|
||||||
},
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Icon iconName="Info" className="panelInfoIcon" tabIndex={0} />
|
|
||||||
</TooltipHost>
|
|
||||||
)}
|
|
||||||
</Stack>
|
</Stack>
|
||||||
{this.state.isExpanded && this.props.children}
|
{this.state.isExpanded && this.props.children}
|
||||||
</>
|
</>
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* React component for Command button component.
|
* React component for Command button component.
|
||||||
*/
|
*/
|
||||||
import { KeyboardAction } from "KeyboardShortcuts";
|
|
||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
import CollapseChevronDownIcon from "../../../../images/QueryBuilder/CollapseChevronDown_16x.png";
|
import CollapseChevronDownIcon from "../../../../images/QueryBuilder/CollapseChevronDown_16x.png";
|
||||||
import { KeyCodes } from "../../../Common/Constants";
|
import { KeyCodes } from "../../../Common/Constants";
|
||||||
@@ -31,7 +30,7 @@ export interface CommandButtonComponentProps {
|
|||||||
/**
|
/**
|
||||||
* Click handler for command button click
|
* Click handler for command button click
|
||||||
*/
|
*/
|
||||||
onCommandClick?: (e: React.SyntheticEvent | KeyboardEvent) => void;
|
onCommandClick: (e: React.SyntheticEvent) => void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Label for the button
|
* Label for the button
|
||||||
@@ -108,17 +107,10 @@ export interface CommandButtonComponentProps {
|
|||||||
* Vertical bar to divide buttons
|
* Vertical bar to divide buttons
|
||||||
*/
|
*/
|
||||||
isDivider?: boolean;
|
isDivider?: boolean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Aria-label for the button
|
* Aria-label for the button
|
||||||
*/
|
*/
|
||||||
ariaLabel: string;
|
ariaLabel: string;
|
||||||
|
|
||||||
/**
|
|
||||||
* If specified, a keyboard action that should trigger this button's onCommandClick handler when activated.
|
|
||||||
* If not specified, the button will not be triggerable by keyboard shortcuts.
|
|
||||||
*/
|
|
||||||
keyboardAction?: KeyboardAction;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class CommandButtonComponent extends React.Component<CommandButtonComponentProps> {
|
export class CommandButtonComponent extends React.Component<CommandButtonComponentProps> {
|
||||||
|
|||||||
@@ -20,10 +20,7 @@ export interface EditorReactProps {
|
|||||||
lineDecorationsWidth?: monaco.editor.IEditorOptions["lineDecorationsWidth"];
|
lineDecorationsWidth?: monaco.editor.IEditorOptions["lineDecorationsWidth"];
|
||||||
minimap?: monaco.editor.IEditorOptions["minimap"];
|
minimap?: monaco.editor.IEditorOptions["minimap"];
|
||||||
scrollBeyondLastLine?: monaco.editor.IEditorOptions["scrollBeyondLastLine"];
|
scrollBeyondLastLine?: monaco.editor.IEditorOptions["scrollBeyondLastLine"];
|
||||||
fontSize?: monaco.editor.IEditorOptions["fontSize"];
|
|
||||||
monacoContainerStyles?: React.CSSProperties;
|
monacoContainerStyles?: React.CSSProperties;
|
||||||
className?: string;
|
|
||||||
spinnerClassName?: string;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class EditorReact extends React.Component<EditorReactProps, EditorReactStates> {
|
export class EditorReact extends React.Component<EditorReactProps, EditorReactStates> {
|
||||||
@@ -49,25 +46,9 @@ export class EditorReact extends React.Component<EditorReactProps, EditorReactSt
|
|||||||
}, 100);
|
}, 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
public componentDidUpdate() {
|
public componentDidUpdate(previous: EditorReactProps) {
|
||||||
if (!this.editor) {
|
if (this.props.content !== previous.content) {
|
||||||
return;
|
this.editor?.setValue(this.props.content);
|
||||||
}
|
|
||||||
|
|
||||||
const existingContent = this.editor.getModel().getValue();
|
|
||||||
|
|
||||||
if (this.props.content !== existingContent) {
|
|
||||||
if (this.props.isReadOnly) {
|
|
||||||
this.editor.setValue(this.props.content);
|
|
||||||
} else {
|
|
||||||
this.editor.pushUndoStop();
|
|
||||||
this.editor.executeEdits("", [
|
|
||||||
{
|
|
||||||
range: this.editor.getModel().getFullModelRange(),
|
|
||||||
text: this.props.content,
|
|
||||||
},
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -78,11 +59,9 @@ export class EditorReact extends React.Component<EditorReactProps, EditorReactSt
|
|||||||
public render(): JSX.Element {
|
public render(): JSX.Element {
|
||||||
return (
|
return (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
{!this.state.showEditor && (
|
{!this.state.showEditor && <Spinner size={SpinnerSize.large} className="spinner" />}
|
||||||
<Spinner size={SpinnerSize.large} className={this.props.spinnerClassName || "spinner"} />
|
|
||||||
)}
|
|
||||||
<div
|
<div
|
||||||
className={this.props.className || "jsonEditor"}
|
className="jsonEditor"
|
||||||
style={this.props.monacoContainerStyles}
|
style={this.props.monacoContainerStyles}
|
||||||
ref={(elt: HTMLElement) => this.setRef(elt)}
|
ref={(elt: HTMLElement) => this.setRef(elt)}
|
||||||
/>
|
/>
|
||||||
@@ -92,14 +71,9 @@ export class EditorReact extends React.Component<EditorReactProps, EditorReactSt
|
|||||||
|
|
||||||
protected configureEditor(editor: monaco.editor.IStandaloneCodeEditor) {
|
protected configureEditor(editor: monaco.editor.IStandaloneCodeEditor) {
|
||||||
this.editor = editor;
|
this.editor = editor;
|
||||||
|
const queryEditorModel = this.editor.getModel();
|
||||||
if (!this.props.isReadOnly && this.props.onContentChanged) {
|
if (!this.props.isReadOnly && this.props.onContentChanged) {
|
||||||
// Hooking the model's onDidChangeContent event because of some event ordering issues.
|
queryEditorModel.onDidChangeContent(() => {
|
||||||
// If a single user input causes BOTH the editor content to change AND the cursor selection to change (which is likely),
|
|
||||||
// then there are some inconsistencies as to which event fires first.
|
|
||||||
// But the editor.onDidChangeModelContent event seems to always fire before the cursor selection event.
|
|
||||||
// (This is NOT true for the model's onDidChangeContent event, which sometimes fires after the cursor selection event.)
|
|
||||||
// If the cursor selection event fires first, then the calling component may re-render the component with old content, so we want to ensure the model content changed event always fires first.
|
|
||||||
this.editor.onDidChangeModelContent(() => {
|
|
||||||
const queryEditorModel = this.editor.getModel();
|
const queryEditorModel = this.editor.getModel();
|
||||||
this.props.onContentChanged(queryEditorModel.getValue());
|
this.props.onContentChanged(queryEditorModel.getValue());
|
||||||
});
|
});
|
||||||
@@ -124,7 +98,7 @@ export class EditorReact extends React.Component<EditorReactProps, EditorReactSt
|
|||||||
value: this.props.content,
|
value: this.props.content,
|
||||||
readOnly: this.props.isReadOnly,
|
readOnly: this.props.isReadOnly,
|
||||||
ariaLabel: this.props.ariaLabel,
|
ariaLabel: this.props.ariaLabel,
|
||||||
fontSize: this.props.fontSize || 12,
|
fontSize: 12,
|
||||||
automaticLayout: true,
|
automaticLayout: true,
|
||||||
theme: this.props.theme,
|
theme: this.props.theme,
|
||||||
wordWrap: this.props.wordWrap || "off",
|
wordWrap: this.props.wordWrap || "off",
|
||||||
@@ -137,13 +111,7 @@ export class EditorReact extends React.Component<EditorReactProps, EditorReactSt
|
|||||||
|
|
||||||
this.rootNode.innerHTML = "";
|
this.rootNode.innerHTML = "";
|
||||||
const monaco = await loadMonaco();
|
const monaco = await loadMonaco();
|
||||||
try {
|
|
||||||
createCallback(monaco?.editor?.create(this.rootNode, options));
|
createCallback(monaco?.editor?.create(this.rootNode, options));
|
||||||
} catch (error) {
|
|
||||||
// This could happen if the parent node suddenly disappears during create()
|
|
||||||
console.error("Unable to create EditorReact", error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.rootNode.innerHTML) {
|
if (this.rootNode.innerHTML) {
|
||||||
this.setState({
|
this.setState({
|
||||||
|
|||||||
@@ -25,14 +25,7 @@
|
|||||||
font-family: @DataExplorerFont;
|
font-family: @DataExplorerFont;
|
||||||
}
|
}
|
||||||
|
|
||||||
.settingsV2Editor {
|
.settingsV2IndexingPolicyEditor {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 60vh;
|
height: 60vh;
|
||||||
}
|
}
|
||||||
|
|
||||||
.settingsV2EditorSpinner {
|
|
||||||
position: absolute;
|
|
||||||
top: 50%;
|
|
||||||
left: 50%;
|
|
||||||
transform: translate(-50%, -50%);
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,14 +1,5 @@
|
|||||||
import { IPivotItemProps, IPivotProps, Pivot, PivotItem } from "@fluentui/react";
|
import { IPivotItemProps, IPivotProps, Pivot, PivotItem } from "@fluentui/react";
|
||||||
import {
|
|
||||||
ComputedPropertiesComponent,
|
|
||||||
ComputedPropertiesComponentProps,
|
|
||||||
} from "Explorer/Controls/Settings/SettingsSubComponents/ComputedPropertiesComponent";
|
|
||||||
import {
|
|
||||||
ContainerVectorPolicyComponent,
|
|
||||||
ContainerVectorPolicyComponentProps,
|
|
||||||
} from "Explorer/Controls/Settings/SettingsSubComponents/ContainerVectorPolicyComponent";
|
|
||||||
import { useDatabases } from "Explorer/useDatabases";
|
import { useDatabases } from "Explorer/useDatabases";
|
||||||
import { isVectorSearchEnabled } from "Utils/CapabilityUtils";
|
|
||||||
import { isRunningOnPublicCloud } from "Utils/CloudUtils";
|
import { isRunningOnPublicCloud } from "Utils/CloudUtils";
|
||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
import DiscardIcon from "../../../../images/discard.svg";
|
import DiscardIcon from "../../../../images/discard.svg";
|
||||||
@@ -117,11 +108,6 @@ export interface SettingsComponentState {
|
|||||||
indexesToAdd: AddMongoIndexProps[];
|
indexesToAdd: AddMongoIndexProps[];
|
||||||
indexTransformationProgress: number;
|
indexTransformationProgress: number;
|
||||||
|
|
||||||
computedPropertiesContent: DataModels.ComputedProperties;
|
|
||||||
computedPropertiesContentBaseline: DataModels.ComputedProperties;
|
|
||||||
shouldDiscardComputedProperties: boolean;
|
|
||||||
isComputedPropertiesDirty: boolean;
|
|
||||||
|
|
||||||
conflictResolutionPolicyMode: DataModels.ConflictResolutionMode;
|
conflictResolutionPolicyMode: DataModels.ConflictResolutionMode;
|
||||||
conflictResolutionPolicyModeBaseline: DataModels.ConflictResolutionMode;
|
conflictResolutionPolicyModeBaseline: DataModels.ConflictResolutionMode;
|
||||||
conflictResolutionPolicyPath: string;
|
conflictResolutionPolicyPath: string;
|
||||||
@@ -146,10 +132,8 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
|
|||||||
private offer: DataModels.Offer;
|
private offer: DataModels.Offer;
|
||||||
private changeFeedPolicyVisible: boolean;
|
private changeFeedPolicyVisible: boolean;
|
||||||
private isFixedContainer: boolean;
|
private isFixedContainer: boolean;
|
||||||
private shouldShowComputedPropertiesEditor: boolean;
|
|
||||||
private shouldShowIndexingPolicyEditor: boolean;
|
private shouldShowIndexingPolicyEditor: boolean;
|
||||||
private shouldShowPartitionKeyEditor: boolean;
|
private shouldShowPartitionKeyEditor: boolean;
|
||||||
private isVectorSearchEnabled: boolean;
|
|
||||||
private totalThroughputUsed: number;
|
private totalThroughputUsed: number;
|
||||||
public mongoDBCollectionResource: MongoDBCollectionResource;
|
public mongoDBCollectionResource: MongoDBCollectionResource;
|
||||||
|
|
||||||
@@ -161,10 +145,8 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
|
|||||||
this.collection = this.props.settingsTab.collection as ViewModels.Collection;
|
this.collection = this.props.settingsTab.collection as ViewModels.Collection;
|
||||||
this.offer = this.collection?.offer();
|
this.offer = this.collection?.offer();
|
||||||
this.isAnalyticalStorageEnabled = !!this.collection?.analyticalStorageTtl();
|
this.isAnalyticalStorageEnabled = !!this.collection?.analyticalStorageTtl();
|
||||||
this.shouldShowComputedPropertiesEditor = userContext.apiType === "SQL";
|
|
||||||
this.shouldShowIndexingPolicyEditor = userContext.apiType !== "Cassandra" && userContext.apiType !== "Mongo";
|
this.shouldShowIndexingPolicyEditor = userContext.apiType !== "Cassandra" && userContext.apiType !== "Mongo";
|
||||||
this.shouldShowPartitionKeyEditor = userContext.apiType === "SQL" && isRunningOnPublicCloud();
|
this.shouldShowPartitionKeyEditor = userContext.apiType === "SQL" && isRunningOnPublicCloud();
|
||||||
this.isVectorSearchEnabled = isVectorSearchEnabled() && !hasDatabaseSharedThroughput(this.collection);
|
|
||||||
|
|
||||||
this.changeFeedPolicyVisible = userContext.features.enableChangeFeedPolicy;
|
this.changeFeedPolicyVisible = userContext.features.enableChangeFeedPolicy;
|
||||||
|
|
||||||
@@ -216,11 +198,6 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
|
|||||||
isMongoIndexingPolicyDiscardable: false,
|
isMongoIndexingPolicyDiscardable: false,
|
||||||
indexTransformationProgress: undefined,
|
indexTransformationProgress: undefined,
|
||||||
|
|
||||||
computedPropertiesContent: undefined,
|
|
||||||
computedPropertiesContentBaseline: undefined,
|
|
||||||
shouldDiscardComputedProperties: false,
|
|
||||||
isComputedPropertiesDirty: false,
|
|
||||||
|
|
||||||
conflictResolutionPolicyMode: undefined,
|
conflictResolutionPolicyMode: undefined,
|
||||||
conflictResolutionPolicyModeBaseline: undefined,
|
conflictResolutionPolicyModeBaseline: undefined,
|
||||||
conflictResolutionPolicyPath: undefined,
|
conflictResolutionPolicyPath: undefined,
|
||||||
@@ -311,7 +288,6 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
|
|||||||
this.state.isSubSettingsSaveable ||
|
this.state.isSubSettingsSaveable ||
|
||||||
this.state.isIndexingPolicyDirty ||
|
this.state.isIndexingPolicyDirty ||
|
||||||
this.state.isConflictResolutionDirty ||
|
this.state.isConflictResolutionDirty ||
|
||||||
this.state.isComputedPropertiesDirty ||
|
|
||||||
(!!this.state.currentMongoIndexes && this.state.isMongoIndexingPolicySaveable)
|
(!!this.state.currentMongoIndexes && this.state.isMongoIndexingPolicySaveable)
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@@ -322,7 +298,6 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
|
|||||||
this.state.isSubSettingsDiscardable ||
|
this.state.isSubSettingsDiscardable ||
|
||||||
this.state.isIndexingPolicyDirty ||
|
this.state.isIndexingPolicyDirty ||
|
||||||
this.state.isConflictResolutionDirty ||
|
this.state.isConflictResolutionDirty ||
|
||||||
this.state.isComputedPropertiesDirty ||
|
|
||||||
(!!this.state.currentMongoIndexes && this.state.isMongoIndexingPolicyDiscardable)
|
(!!this.state.currentMongoIndexes && this.state.isMongoIndexingPolicyDiscardable)
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@@ -427,9 +402,6 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
|
|||||||
isMongoIndexingPolicySaveable: false,
|
isMongoIndexingPolicySaveable: false,
|
||||||
isMongoIndexingPolicyDiscardable: false,
|
isMongoIndexingPolicyDiscardable: false,
|
||||||
isConflictResolutionDirty: false,
|
isConflictResolutionDirty: false,
|
||||||
computedPropertiesContent: this.state.computedPropertiesContentBaseline,
|
|
||||||
shouldDiscardComputedProperties: true,
|
|
||||||
isComputedPropertiesDirty: false,
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -549,31 +521,6 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
|
|||||||
private onMongoIndexingPolicyDiscardableChange = (isMongoIndexingPolicyDiscardable: boolean): void =>
|
private onMongoIndexingPolicyDiscardableChange = (isMongoIndexingPolicyDiscardable: boolean): void =>
|
||||||
this.setState({ isMongoIndexingPolicyDiscardable });
|
this.setState({ isMongoIndexingPolicyDiscardable });
|
||||||
|
|
||||||
private onComputedPropertiesContentChange = (newComputedProperties: DataModels.ComputedProperties): void =>
|
|
||||||
this.setState({ computedPropertiesContent: newComputedProperties });
|
|
||||||
|
|
||||||
private resetShouldDiscardComputedProperties = (): void => this.setState({ shouldDiscardComputedProperties: false });
|
|
||||||
|
|
||||||
private logComputedPropertiesSuccessMessage = (): void => {
|
|
||||||
if (this.props.settingsTab.onLoadStartKey) {
|
|
||||||
traceSuccess(
|
|
||||||
Action.Tab,
|
|
||||||
{
|
|
||||||
databaseName: this.collection.databaseId,
|
|
||||||
collectionName: this.collection.id(),
|
|
||||||
|
|
||||||
dataExplorerArea: Constants.Areas.Tab,
|
|
||||||
tabTitle: this.props.settingsTab.tabTitle(),
|
|
||||||
},
|
|
||||||
this.props.settingsTab.onLoadStartKey,
|
|
||||||
);
|
|
||||||
this.props.settingsTab.onLoadStartKey = undefined;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
private onComputedPropertiesDirtyChange = (isComputedPropertiesDirty: boolean): void =>
|
|
||||||
this.setState({ isComputedPropertiesDirty: isComputedPropertiesDirty });
|
|
||||||
|
|
||||||
private calculateTotalThroughputUsed = (): void => {
|
private calculateTotalThroughputUsed = (): void => {
|
||||||
this.totalThroughputUsed = 0;
|
this.totalThroughputUsed = 0;
|
||||||
(useDatabases.getState().databases || []).forEach(async (database) => {
|
(useDatabases.getState().databases || []).forEach(async (database) => {
|
||||||
@@ -696,6 +643,7 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
|
|||||||
const indexingPolicyContent = this.collection.indexingPolicy();
|
const indexingPolicyContent = this.collection.indexingPolicy();
|
||||||
const conflictResolutionPolicy: DataModels.ConflictResolutionPolicy =
|
const conflictResolutionPolicy: DataModels.ConflictResolutionPolicy =
|
||||||
this.collection.conflictResolutionPolicy && this.collection.conflictResolutionPolicy();
|
this.collection.conflictResolutionPolicy && this.collection.conflictResolutionPolicy();
|
||||||
|
|
||||||
const conflictResolutionPolicyMode = parseConflictResolutionMode(conflictResolutionPolicy?.mode);
|
const conflictResolutionPolicyMode = parseConflictResolutionMode(conflictResolutionPolicy?.mode);
|
||||||
const conflictResolutionPolicyPath = conflictResolutionPolicy?.conflictResolutionPath;
|
const conflictResolutionPolicyPath = conflictResolutionPolicy?.conflictResolutionPath;
|
||||||
const conflictResolutionPolicyProcedure = parseConflictResolutionProcedure(
|
const conflictResolutionPolicyProcedure = parseConflictResolutionProcedure(
|
||||||
@@ -704,12 +652,6 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
|
|||||||
const geospatialConfigTypeString: string =
|
const geospatialConfigTypeString: string =
|
||||||
(this.collection.geospatialConfig && this.collection.geospatialConfig()?.type) || GeospatialConfigType.Geometry;
|
(this.collection.geospatialConfig && this.collection.geospatialConfig()?.type) || GeospatialConfigType.Geometry;
|
||||||
const geoSpatialConfigType = GeospatialConfigType[geospatialConfigTypeString as keyof typeof GeospatialConfigType];
|
const geoSpatialConfigType = GeospatialConfigType[geospatialConfigTypeString as keyof typeof GeospatialConfigType];
|
||||||
let computedPropertiesContent = this.collection.computedProperties();
|
|
||||||
if (!computedPropertiesContent || computedPropertiesContent.length === 0) {
|
|
||||||
computedPropertiesContent = [
|
|
||||||
{ name: "name_of_property", query: "query_to_compute_property" },
|
|
||||||
] as DataModels.ComputedProperties;
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
throughput: offerThroughput,
|
throughput: offerThroughput,
|
||||||
@@ -736,8 +678,6 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
|
|||||||
conflictResolutionPolicyProcedureBaseline: conflictResolutionPolicyProcedure,
|
conflictResolutionPolicyProcedureBaseline: conflictResolutionPolicyProcedure,
|
||||||
geospatialConfigType: geoSpatialConfigType,
|
geospatialConfigType: geoSpatialConfigType,
|
||||||
geospatialConfigTypeBaseline: geoSpatialConfigType,
|
geospatialConfigTypeBaseline: geoSpatialConfigType,
|
||||||
computedPropertiesContent: computedPropertiesContent,
|
|
||||||
computedPropertiesContentBaseline: computedPropertiesContent,
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -854,12 +794,7 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
|
|||||||
private saveCollectionSettings = async (startKey: number): Promise<void> => {
|
private saveCollectionSettings = async (startKey: number): Promise<void> => {
|
||||||
const newCollection: DataModels.Collection = { ...this.collection.rawDataModel };
|
const newCollection: DataModels.Collection = { ...this.collection.rawDataModel };
|
||||||
|
|
||||||
if (
|
if (this.state.isSubSettingsSaveable || this.state.isIndexingPolicyDirty || this.state.isConflictResolutionDirty) {
|
||||||
this.state.isSubSettingsSaveable ||
|
|
||||||
this.state.isIndexingPolicyDirty ||
|
|
||||||
this.state.isConflictResolutionDirty ||
|
|
||||||
this.state.isComputedPropertiesDirty
|
|
||||||
) {
|
|
||||||
let defaultTtl: number;
|
let defaultTtl: number;
|
||||||
switch (this.state.timeToLive) {
|
switch (this.state.timeToLive) {
|
||||||
case TtlType.On:
|
case TtlType.On:
|
||||||
@@ -897,10 +832,6 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
|
|||||||
newCollection.conflictResolutionPolicy = conflictResolutionChanges;
|
newCollection.conflictResolutionPolicy = conflictResolutionChanges;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.state.isComputedPropertiesDirty) {
|
|
||||||
newCollection.computedProperties = this.state.computedPropertiesContent;
|
|
||||||
}
|
|
||||||
|
|
||||||
const updatedCollection: DataModels.Collection = await updateCollection(
|
const updatedCollection: DataModels.Collection = await updateCollection(
|
||||||
this.collection.databaseId,
|
this.collection.databaseId,
|
||||||
this.collection.id(),
|
this.collection.id(),
|
||||||
@@ -914,7 +845,6 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
|
|||||||
this.collection.conflictResolutionPolicy(updatedCollection.conflictResolutionPolicy);
|
this.collection.conflictResolutionPolicy(updatedCollection.conflictResolutionPolicy);
|
||||||
this.collection.changeFeedPolicy(updatedCollection.changeFeedPolicy);
|
this.collection.changeFeedPolicy(updatedCollection.changeFeedPolicy);
|
||||||
this.collection.geospatialConfig(updatedCollection.geospatialConfig);
|
this.collection.geospatialConfig(updatedCollection.geospatialConfig);
|
||||||
this.collection.computedProperties(updatedCollection.computedProperties);
|
|
||||||
|
|
||||||
if (wasIndexingPolicyModified) {
|
if (wasIndexingPolicyModified) {
|
||||||
await this.refreshIndexTransformationProgress();
|
await this.refreshIndexTransformationProgress();
|
||||||
@@ -925,7 +855,6 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
|
|||||||
isSubSettingsDiscardable: false,
|
isSubSettingsDiscardable: false,
|
||||||
isIndexingPolicyDirty: false,
|
isIndexingPolicyDirty: false,
|
||||||
isConflictResolutionDirty: false,
|
isConflictResolutionDirty: false,
|
||||||
isComputedPropertiesDirty: false,
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1104,7 +1033,6 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
|
|||||||
indexTransformationProgress: this.state.indexTransformationProgress,
|
indexTransformationProgress: this.state.indexTransformationProgress,
|
||||||
refreshIndexTransformationProgress: this.refreshIndexTransformationProgress,
|
refreshIndexTransformationProgress: this.refreshIndexTransformationProgress,
|
||||||
onIndexingPolicyDirtyChange: this.onIndexingPolicyDirtyChange,
|
onIndexingPolicyDirtyChange: this.onIndexingPolicyDirtyChange,
|
||||||
isVectorSearchEnabled: this.isVectorSearchEnabled,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const mongoIndexingPolicyComponentProps: MongoIndexingPolicyComponentProps = {
|
const mongoIndexingPolicyComponentProps: MongoIndexingPolicyComponentProps = {
|
||||||
@@ -1121,16 +1049,6 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
|
|||||||
onMongoIndexingPolicyDiscardableChange: this.onMongoIndexingPolicyDiscardableChange,
|
onMongoIndexingPolicyDiscardableChange: this.onMongoIndexingPolicyDiscardableChange,
|
||||||
};
|
};
|
||||||
|
|
||||||
const computedPropertiesComponentProps: ComputedPropertiesComponentProps = {
|
|
||||||
computedPropertiesContent: this.state.computedPropertiesContent,
|
|
||||||
computedPropertiesContentBaseline: this.state.computedPropertiesContentBaseline,
|
|
||||||
logComputedPropertiesSuccessMessage: this.logComputedPropertiesSuccessMessage,
|
|
||||||
onComputedPropertiesContentChange: this.onComputedPropertiesContentChange,
|
|
||||||
onComputedPropertiesDirtyChange: this.onComputedPropertiesDirtyChange,
|
|
||||||
resetShouldDiscardComputedProperties: this.resetShouldDiscardComputedProperties,
|
|
||||||
shouldDiscardComputedProperties: this.state.shouldDiscardComputedProperties,
|
|
||||||
};
|
|
||||||
|
|
||||||
const conflictResolutionPolicyComponentProps: ConflictResolutionComponentProps = {
|
const conflictResolutionPolicyComponentProps: ConflictResolutionComponentProps = {
|
||||||
collection: this.collection,
|
collection: this.collection,
|
||||||
conflictResolutionPolicyMode: this.state.conflictResolutionPolicyMode,
|
conflictResolutionPolicyMode: this.state.conflictResolutionPolicyMode,
|
||||||
@@ -1151,10 +1069,6 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
|
|||||||
explorer: this.props.settingsTab.getContainer(),
|
explorer: this.props.settingsTab.getContainer(),
|
||||||
};
|
};
|
||||||
|
|
||||||
const containerVectorPolicyProps: ContainerVectorPolicyComponentProps = {
|
|
||||||
vectorEmbeddingPolicy: this.collection.rawDataModel?.vectorEmbeddingPolicy,
|
|
||||||
};
|
|
||||||
|
|
||||||
const tabs: SettingsV2TabInfo[] = [];
|
const tabs: SettingsV2TabInfo[] = [];
|
||||||
if (!hasDatabaseSharedThroughput(this.collection) && this.offer) {
|
if (!hasDatabaseSharedThroughput(this.collection) && this.offer) {
|
||||||
tabs.push({
|
tabs.push({
|
||||||
@@ -1168,13 +1082,6 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
|
|||||||
content: <SubSettingsComponent {...subSettingsComponentProps} />,
|
content: <SubSettingsComponent {...subSettingsComponentProps} />,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (this.isVectorSearchEnabled) {
|
|
||||||
tabs.push({
|
|
||||||
tab: SettingsV2TabTypes.ContainerVectorPolicyTab,
|
|
||||||
content: <ContainerVectorPolicyComponent {...containerVectorPolicyProps} />,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.shouldShowIndexingPolicyEditor) {
|
if (this.shouldShowIndexingPolicyEditor) {
|
||||||
tabs.push({
|
tabs.push({
|
||||||
tab: SettingsV2TabTypes.IndexingPolicyTab,
|
tab: SettingsV2TabTypes.IndexingPolicyTab,
|
||||||
@@ -1204,13 +1111,6 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.shouldShowComputedPropertiesEditor) {
|
|
||||||
tabs.push({
|
|
||||||
tab: SettingsV2TabTypes.ComputedPropertiesTab,
|
|
||||||
content: <ComputedPropertiesComponent {...computedPropertiesComponentProps} />,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
const pivotProps: IPivotProps = {
|
const pivotProps: IPivotProps = {
|
||||||
onLinkClick: this.onPivotChange,
|
onLinkClick: this.onPivotChange,
|
||||||
selectedKey: SettingsV2TabTypes[this.state.selectedTab],
|
selectedKey: SettingsV2TabTypes[this.state.selectedTab],
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import {
|
|||||||
getThroughputApplyLongDelayMessage,
|
getThroughputApplyLongDelayMessage,
|
||||||
getThroughputApplyShortDelayMessage,
|
getThroughputApplyShortDelayMessage,
|
||||||
getToolTipContainer,
|
getToolTipContainer,
|
||||||
|
indexingPolicynUnsavedWarningMessage,
|
||||||
manualToAutoscaleDisclaimerElement,
|
manualToAutoscaleDisclaimerElement,
|
||||||
mongoIndexTransformationRefreshingMessage,
|
mongoIndexTransformationRefreshingMessage,
|
||||||
mongoIndexingPolicyAADError,
|
mongoIndexingPolicyAADError,
|
||||||
@@ -38,6 +39,7 @@ class SettingsRenderUtilsTestComponent extends React.Component {
|
|||||||
|
|
||||||
{manualToAutoscaleDisclaimerElement}
|
{manualToAutoscaleDisclaimerElement}
|
||||||
{ttlWarning}
|
{ttlWarning}
|
||||||
|
{indexingPolicynUnsavedWarningMessage}
|
||||||
{updateThroughputDelayedApplyWarningMessage}
|
{updateThroughputDelayedApplyWarningMessage}
|
||||||
|
|
||||||
{getThroughputApplyDelayedMessage(false, 1000, "RU/s", "sampleDb", "sampleCollection", 2000)}
|
{getThroughputApplyDelayedMessage(false, 1000, "RU/s", "sampleDb", "sampleCollection", 2000)}
|
||||||
|
|||||||
@@ -61,8 +61,6 @@ export interface PriceBreakdown {
|
|||||||
currencySign: string;
|
currencySign: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type editorType = "indexPolicy" | "computedProperties";
|
|
||||||
|
|
||||||
export const infoAndToolTipTextStyle: ITextStyles = { root: { fontSize: 14, color: "windowtext" } };
|
export const infoAndToolTipTextStyle: ITextStyles = { root: { fontSize: 14, color: "windowtext" } };
|
||||||
|
|
||||||
export const noLeftPaddingCheckBoxStyle: ICheckboxStyles = {
|
export const noLeftPaddingCheckBoxStyle: ICheckboxStyles = {
|
||||||
@@ -256,10 +254,9 @@ export const ttlWarning: JSX.Element = (
|
|||||||
</Text>
|
</Text>
|
||||||
);
|
);
|
||||||
|
|
||||||
export const unsavedEditorWarningMessage = (editor: editorType): JSX.Element => (
|
export const indexingPolicynUnsavedWarningMessage: JSX.Element = (
|
||||||
<Text styles={infoAndToolTipTextStyle}>
|
<Text styles={infoAndToolTipTextStyle}>
|
||||||
You have not saved the latest changes made to your{" "}
|
You have not saved the latest changes made to your indexing policy. Please click save to confirm the changes.
|
||||||
{editor === "indexPolicy" ? "indexing policy" : "computed properties"}. Please click save to confirm the changes.
|
|
||||||
</Text>
|
</Text>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -1,56 +0,0 @@
|
|||||||
import * as DataModels from "Contracts/DataModels";
|
|
||||||
import { shallow } from "enzyme";
|
|
||||||
import React from "react";
|
|
||||||
import { ComputedPropertiesComponent, ComputedPropertiesComponentProps } from "./ComputedPropertiesComponent";
|
|
||||||
|
|
||||||
describe("ComputedPropertiesComponent", () => {
|
|
||||||
const initialComputedPropertiesContent: DataModels.ComputedProperties = [
|
|
||||||
{
|
|
||||||
name: "prop1",
|
|
||||||
query: "query1",
|
|
||||||
},
|
|
||||||
];
|
|
||||||
const baseProps: ComputedPropertiesComponentProps = {
|
|
||||||
computedPropertiesContent: initialComputedPropertiesContent,
|
|
||||||
computedPropertiesContentBaseline: initialComputedPropertiesContent,
|
|
||||||
logComputedPropertiesSuccessMessage: () => {
|
|
||||||
return;
|
|
||||||
},
|
|
||||||
onComputedPropertiesContentChange: () => {
|
|
||||||
return;
|
|
||||||
},
|
|
||||||
onComputedPropertiesDirtyChange: () => {
|
|
||||||
return;
|
|
||||||
},
|
|
||||||
resetShouldDiscardComputedProperties: () => {
|
|
||||||
return;
|
|
||||||
},
|
|
||||||
shouldDiscardComputedProperties: false,
|
|
||||||
};
|
|
||||||
|
|
||||||
it("renders", () => {
|
|
||||||
const wrapper = shallow(<ComputedPropertiesComponent {...baseProps} />);
|
|
||||||
expect(wrapper).toMatchSnapshot();
|
|
||||||
});
|
|
||||||
|
|
||||||
it("computed properties are reset", () => {
|
|
||||||
const wrapper = shallow(<ComputedPropertiesComponent {...baseProps} />);
|
|
||||||
|
|
||||||
const computedPropertiesComponentInstance = wrapper.instance() as ComputedPropertiesComponent;
|
|
||||||
const resetComputedPropertiesEditorMockFn = jest.fn();
|
|
||||||
computedPropertiesComponentInstance.resetComputedPropertiesEditor = resetComputedPropertiesEditorMockFn;
|
|
||||||
|
|
||||||
wrapper.setProps({ shouldDiscardComputedProperties: true });
|
|
||||||
wrapper.update();
|
|
||||||
expect(resetComputedPropertiesEditorMockFn.mock.calls.length).toEqual(1);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("dirty is set", () => {
|
|
||||||
let computedPropertiesComponent = new ComputedPropertiesComponent(baseProps);
|
|
||||||
expect(computedPropertiesComponent.IsComponentDirty()).toEqual(false);
|
|
||||||
|
|
||||||
const newProps = { ...baseProps, computedPropertiesContent: undefined as DataModels.ComputedProperties };
|
|
||||||
computedPropertiesComponent = new ComputedPropertiesComponent(newProps);
|
|
||||||
expect(computedPropertiesComponent.IsComponentDirty()).toEqual(true);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@@ -1,128 +0,0 @@
|
|||||||
import { FontIcon, Link, MessageBar, MessageBarType, Stack, Text } from "@fluentui/react";
|
|
||||||
import * as DataModels from "Contracts/DataModels";
|
|
||||||
import { titleAndInputStackProps, unsavedEditorWarningMessage } from "Explorer/Controls/Settings/SettingsRenderUtils";
|
|
||||||
import { isDirty } from "Explorer/Controls/Settings/SettingsUtils";
|
|
||||||
import { loadMonaco } from "Explorer/LazyMonaco";
|
|
||||||
import * as monaco from "monaco-editor";
|
|
||||||
import * as React from "react";
|
|
||||||
|
|
||||||
export interface ComputedPropertiesComponentProps {
|
|
||||||
computedPropertiesContent: DataModels.ComputedProperties;
|
|
||||||
computedPropertiesContentBaseline: DataModels.ComputedProperties;
|
|
||||||
logComputedPropertiesSuccessMessage: () => void;
|
|
||||||
onComputedPropertiesContentChange: (newComputedProperties: DataModels.ComputedProperties) => void;
|
|
||||||
onComputedPropertiesDirtyChange: (isComputedPropertiesDirty: boolean) => void;
|
|
||||||
resetShouldDiscardComputedProperties: () => void;
|
|
||||||
shouldDiscardComputedProperties: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface ComputedPropertiesComponentState {
|
|
||||||
computedPropertiesContentIsValid: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
export class ComputedPropertiesComponent extends React.Component<
|
|
||||||
ComputedPropertiesComponentProps,
|
|
||||||
ComputedPropertiesComponentState
|
|
||||||
> {
|
|
||||||
private shouldCheckComponentIsDirty = true;
|
|
||||||
private computedPropertiesDiv = React.createRef<HTMLDivElement>();
|
|
||||||
private computedPropertiesEditor: monaco.editor.IStandaloneCodeEditor;
|
|
||||||
|
|
||||||
constructor(props: ComputedPropertiesComponentProps) {
|
|
||||||
super(props);
|
|
||||||
this.state = {
|
|
||||||
computedPropertiesContentIsValid: true,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
componentDidUpdate(): void {
|
|
||||||
if (this.props.shouldDiscardComputedProperties) {
|
|
||||||
this.resetComputedPropertiesEditor();
|
|
||||||
this.props.resetShouldDiscardComputedProperties();
|
|
||||||
}
|
|
||||||
this.onComponentUpdate();
|
|
||||||
}
|
|
||||||
|
|
||||||
componentDidMount(): void {
|
|
||||||
this.resetComputedPropertiesEditor();
|
|
||||||
this.onComponentUpdate();
|
|
||||||
}
|
|
||||||
|
|
||||||
public resetComputedPropertiesEditor = (): void => {
|
|
||||||
if (!this.computedPropertiesEditor) {
|
|
||||||
this.createComputedPropertiesEditor();
|
|
||||||
} else {
|
|
||||||
const indexingPolicyEditorModel = this.computedPropertiesEditor.getModel();
|
|
||||||
const value: string = JSON.stringify(this.props.computedPropertiesContent, undefined, 4);
|
|
||||||
indexingPolicyEditorModel.setValue(value);
|
|
||||||
}
|
|
||||||
this.onComponentUpdate();
|
|
||||||
};
|
|
||||||
|
|
||||||
private onComponentUpdate = (): void => {
|
|
||||||
if (!this.shouldCheckComponentIsDirty) {
|
|
||||||
this.shouldCheckComponentIsDirty = true;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.props.onComputedPropertiesDirtyChange(this.IsComponentDirty());
|
|
||||||
this.shouldCheckComponentIsDirty = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
public IsComponentDirty = (): boolean => {
|
|
||||||
if (
|
|
||||||
isDirty(this.props.computedPropertiesContent, this.props.computedPropertiesContentBaseline) &&
|
|
||||||
this.state.computedPropertiesContentIsValid
|
|
||||||
) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
};
|
|
||||||
|
|
||||||
private async createComputedPropertiesEditor(): Promise<void> {
|
|
||||||
const value: string = JSON.stringify(this.props.computedPropertiesContent, undefined, 4);
|
|
||||||
const monaco = await loadMonaco();
|
|
||||||
this.computedPropertiesEditor = monaco.editor.create(this.computedPropertiesDiv.current, {
|
|
||||||
value: value,
|
|
||||||
language: "json",
|
|
||||||
ariaLabel: "Computed properties",
|
|
||||||
});
|
|
||||||
if (this.computedPropertiesEditor) {
|
|
||||||
const computedPropertiesEditorModel = this.computedPropertiesEditor.getModel();
|
|
||||||
computedPropertiesEditorModel.onDidChangeContent(this.onEditorContentChange.bind(this));
|
|
||||||
this.props.logComputedPropertiesSuccessMessage();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private onEditorContentChange = (): void => {
|
|
||||||
const computedPropertiesEditorModel = this.computedPropertiesEditor.getModel();
|
|
||||||
try {
|
|
||||||
const newComputedPropertiesContent = JSON.parse(
|
|
||||||
computedPropertiesEditorModel.getValue(),
|
|
||||||
) as DataModels.ComputedProperties;
|
|
||||||
this.props.onComputedPropertiesContentChange(newComputedPropertiesContent);
|
|
||||||
this.setState({ computedPropertiesContentIsValid: true });
|
|
||||||
} catch (e) {
|
|
||||||
this.setState({ computedPropertiesContentIsValid: false });
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
public render(): JSX.Element {
|
|
||||||
return (
|
|
||||||
<Stack {...titleAndInputStackProps}>
|
|
||||||
{isDirty(this.props.computedPropertiesContent, this.props.computedPropertiesContentBaseline) && (
|
|
||||||
<MessageBar messageBarType={MessageBarType.warning}>
|
|
||||||
{unsavedEditorWarningMessage("computedProperties")}
|
|
||||||
</MessageBar>
|
|
||||||
)}
|
|
||||||
<Text style={{ marginLeft: "30px", marginBottom: "10px" }}>
|
|
||||||
<Link target="_blank" href="https://aka.ms/computed-properties-preview/">
|
|
||||||
{"Learn more"} <FontIcon iconName="NavigateExternalInline" />
|
|
||||||
</Link>
|
|
||||||
  about how to define computed properties and how to use them.
|
|
||||||
</Text>
|
|
||||||
<div className="settingsV2Editor" tabIndex={0} ref={this.computedPropertiesDiv}></div>
|
|
||||||
</Stack>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
import { Stack } from "@fluentui/react";
|
|
||||||
import { VectorEmbeddingPolicy } from "Contracts/DataModels";
|
|
||||||
import { EditorReact } from "Explorer/Controls/Editor/EditorReact";
|
|
||||||
import { titleAndInputStackProps } from "Explorer/Controls/Settings/SettingsRenderUtils";
|
|
||||||
import React from "react";
|
|
||||||
|
|
||||||
export interface ContainerVectorPolicyComponentProps {
|
|
||||||
vectorEmbeddingPolicy: VectorEmbeddingPolicy;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const ContainerVectorPolicyComponent: React.FC<ContainerVectorPolicyComponentProps> = ({
|
|
||||||
vectorEmbeddingPolicy,
|
|
||||||
}) => {
|
|
||||||
return (
|
|
||||||
<Stack {...titleAndInputStackProps} styles={{ root: { position: "relative" } }}>
|
|
||||||
<EditorReact
|
|
||||||
language={"json"}
|
|
||||||
content={JSON.stringify(vectorEmbeddingPolicy || {}, null, 4)}
|
|
||||||
isReadOnly={true}
|
|
||||||
wordWrap={"on"}
|
|
||||||
ariaLabel={"Container vector policy"}
|
|
||||||
lineNumbers={"on"}
|
|
||||||
scrollBeyondLastLine={false}
|
|
||||||
className={"settingsV2Editor"}
|
|
||||||
spinnerClassName={"settingsV2EditorSpinner"}
|
|
||||||
fontSize={14}
|
|
||||||
/>
|
|
||||||
</Stack>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
@@ -3,7 +3,7 @@ import * as monaco from "monaco-editor";
|
|||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
import * as DataModels from "../../../../Contracts/DataModels";
|
import * as DataModels from "../../../../Contracts/DataModels";
|
||||||
import { loadMonaco } from "../../../LazyMonaco";
|
import { loadMonaco } from "../../../LazyMonaco";
|
||||||
import { titleAndInputStackProps, unsavedEditorWarningMessage } from "../SettingsRenderUtils";
|
import { indexingPolicynUnsavedWarningMessage, titleAndInputStackProps } from "../SettingsRenderUtils";
|
||||||
import { isDirty, isIndexTransforming } from "../SettingsUtils";
|
import { isDirty, isIndexTransforming } from "../SettingsUtils";
|
||||||
import { IndexingPolicyRefreshComponent } from "./IndexingPolicyRefresh/IndexingPolicyRefreshComponent";
|
import { IndexingPolicyRefreshComponent } from "./IndexingPolicyRefresh/IndexingPolicyRefreshComponent";
|
||||||
|
|
||||||
@@ -16,7 +16,6 @@ export interface IndexingPolicyComponentProps {
|
|||||||
logIndexingPolicySuccessMessage: () => void;
|
logIndexingPolicySuccessMessage: () => void;
|
||||||
indexTransformationProgress: number;
|
indexTransformationProgress: number;
|
||||||
refreshIndexTransformationProgress: () => Promise<void>;
|
refreshIndexTransformationProgress: () => Promise<void>;
|
||||||
isVectorSearchEnabled?: boolean;
|
|
||||||
onIndexingPolicyDirtyChange: (isIndexingPolicyDirty: boolean) => void;
|
onIndexingPolicyDirtyChange: (isIndexingPolicyDirty: boolean) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -120,15 +119,10 @@ export class IndexingPolicyComponent extends React.Component<
|
|||||||
indexTransformationProgress={this.props.indexTransformationProgress}
|
indexTransformationProgress={this.props.indexTransformationProgress}
|
||||||
refreshIndexTransformationProgress={this.props.refreshIndexTransformationProgress}
|
refreshIndexTransformationProgress={this.props.refreshIndexTransformationProgress}
|
||||||
/>
|
/>
|
||||||
{this.props.isVectorSearchEnabled && (
|
|
||||||
<MessageBar messageBarType={MessageBarType.severeWarning}>
|
|
||||||
Container vector policies and vector indexes are not modifiable after container creation
|
|
||||||
</MessageBar>
|
|
||||||
)}
|
|
||||||
{isDirty(this.props.indexingPolicyContent, this.props.indexingPolicyContentBaseline) && (
|
{isDirty(this.props.indexingPolicyContent, this.props.indexingPolicyContentBaseline) && (
|
||||||
<MessageBar messageBarType={MessageBarType.warning}>{unsavedEditorWarningMessage("indexPolicy")}</MessageBar>
|
<MessageBar messageBarType={MessageBarType.warning}>{indexingPolicynUnsavedWarningMessage}</MessageBar>
|
||||||
)}
|
)}
|
||||||
<div className="settingsV2Editor" tabIndex={0} ref={this.indexingPolicyDiv}></div>
|
<div className="settingsV2IndexingPolicyEditor" tabIndex={0} ref={this.indexingPolicyDiv}></div>
|
||||||
</Stack>
|
</Stack>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import {
|
|||||||
addMongoIndexStackProps,
|
addMongoIndexStackProps,
|
||||||
createAndAddMongoIndexStackProps,
|
createAndAddMongoIndexStackProps,
|
||||||
customDetailsListStyles,
|
customDetailsListStyles,
|
||||||
|
indexingPolicynUnsavedWarningMessage,
|
||||||
infoAndToolTipTextStyle,
|
infoAndToolTipTextStyle,
|
||||||
mediumWidthStackStyles,
|
mediumWidthStackStyles,
|
||||||
mongoCompoundIndexNotSupportedMessage,
|
mongoCompoundIndexNotSupportedMessage,
|
||||||
@@ -26,16 +27,15 @@ import {
|
|||||||
onRenderRow,
|
onRenderRow,
|
||||||
separatorStyles,
|
separatorStyles,
|
||||||
subComponentStackProps,
|
subComponentStackProps,
|
||||||
unsavedEditorWarningMessage,
|
|
||||||
} from "../../SettingsRenderUtils";
|
} from "../../SettingsRenderUtils";
|
||||||
import {
|
import {
|
||||||
AddMongoIndexProps,
|
AddMongoIndexProps,
|
||||||
MongoIndexIdField,
|
|
||||||
MongoIndexTypes,
|
|
||||||
MongoNotificationType,
|
|
||||||
getMongoIndexType,
|
getMongoIndexType,
|
||||||
getMongoIndexTypeText,
|
getMongoIndexTypeText,
|
||||||
isIndexTransforming,
|
isIndexTransforming,
|
||||||
|
MongoIndexIdField,
|
||||||
|
MongoIndexTypes,
|
||||||
|
MongoNotificationType,
|
||||||
} from "../../SettingsUtils";
|
} from "../../SettingsUtils";
|
||||||
import { IndexingPolicyRefreshComponent } from "../IndexingPolicyRefresh/IndexingPolicyRefreshComponent";
|
import { IndexingPolicyRefreshComponent } from "../IndexingPolicyRefresh/IndexingPolicyRefreshComponent";
|
||||||
import { AddMongoIndexComponent } from "./AddMongoIndexComponent";
|
import { AddMongoIndexComponent } from "./AddMongoIndexComponent";
|
||||||
@@ -297,7 +297,7 @@ export class MongoIndexingPolicyComponent extends React.Component<MongoIndexingP
|
|||||||
if (this.getMongoWarningNotificationMessage()) {
|
if (this.getMongoWarningNotificationMessage()) {
|
||||||
warningMessage = this.getMongoWarningNotificationMessage();
|
warningMessage = this.getMongoWarningNotificationMessage();
|
||||||
} else if (this.isMongoIndexingPolicySaveable()) {
|
} else if (this.isMongoIndexingPolicySaveable()) {
|
||||||
warningMessage = unsavedEditorWarningMessage("indexPolicy");
|
warningMessage = indexingPolicynUnsavedWarningMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -136,15 +136,15 @@ export const PartitionKeyComponent: React.FC<PartitionKeyComponentProps> = ({ da
|
|||||||
};
|
};
|
||||||
|
|
||||||
const getPercentageComplete = () => {
|
const getPercentageComplete = () => {
|
||||||
const jobStatus = portalDataTransferJob?.properties?.status;
|
|
||||||
const isCompleted = jobStatus === "Completed";
|
|
||||||
if (isCompleted) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
const processedCount = portalDataTransferJob?.properties?.processedCount;
|
const processedCount = portalDataTransferJob?.properties?.processedCount;
|
||||||
const totalCount = portalDataTransferJob?.properties?.totalCount;
|
const totalCount = portalDataTransferJob?.properties?.totalCount;
|
||||||
const isJobInProgress = isCurrentJobInProgress(portalDataTransferJob);
|
const jobStatus = portalDataTransferJob?.properties?.status;
|
||||||
return isJobInProgress ? (totalCount > 0 ? processedCount / totalCount : null) : 0;
|
const isCancelled = jobStatus === "Cancelled";
|
||||||
|
const isCompleted = jobStatus === "Completed";
|
||||||
|
if (totalCount <= 0 && !isCompleted) {
|
||||||
|
return isCancelled ? 0 : null;
|
||||||
|
}
|
||||||
|
return isCompleted ? 1 : processedCount / totalCount;
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -1,36 +0,0 @@
|
|||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
||||||
|
|
||||||
exports[`ComputedPropertiesComponent renders 1`] = `
|
|
||||||
<Stack
|
|
||||||
tokens={
|
|
||||||
Object {
|
|
||||||
"childrenGap": 5,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<Text
|
|
||||||
style={
|
|
||||||
Object {
|
|
||||||
"marginBottom": "10px",
|
|
||||||
"marginLeft": "30px",
|
|
||||||
}
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<StyledLinkBase
|
|
||||||
href="https://aka.ms/computed-properties-preview/"
|
|
||||||
target="_blank"
|
|
||||||
>
|
|
||||||
Learn more
|
|
||||||
|
|
||||||
<FontIcon
|
|
||||||
iconName="NavigateExternalInline"
|
|
||||||
/>
|
|
||||||
</StyledLinkBase>
|
|
||||||
about how to define computed properties and how to use them.
|
|
||||||
</Text>
|
|
||||||
<div
|
|
||||||
className="settingsV2Editor"
|
|
||||||
tabIndex={0}
|
|
||||||
/>
|
|
||||||
</Stack>
|
|
||||||
`;
|
|
||||||
@@ -12,7 +12,7 @@ exports[`IndexingPolicyComponent renders 1`] = `
|
|||||||
refreshIndexTransformationProgress={[Function]}
|
refreshIndexTransformationProgress={[Function]}
|
||||||
/>
|
/>
|
||||||
<div
|
<div
|
||||||
className="settingsV2Editor"
|
className="settingsV2IndexingPolicyEditor"
|
||||||
tabIndex={0}
|
tabIndex={0}
|
||||||
/>
|
/>
|
||||||
</Stack>
|
</Stack>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import * as ViewModels from "../../../Contracts/ViewModels";
|
|||||||
import { MongoIndex } from "../../../Utils/arm/generatedClients/cosmos/types";
|
import { MongoIndex } from "../../../Utils/arm/generatedClients/cosmos/types";
|
||||||
|
|
||||||
const zeroValue = 0;
|
const zeroValue = 0;
|
||||||
export type isDirtyTypes = boolean | string | number | DataModels.IndexingPolicy | DataModels.ComputedProperties;
|
export type isDirtyTypes = boolean | string | number | DataModels.IndexingPolicy;
|
||||||
export const TtlOff = "off";
|
export const TtlOff = "off";
|
||||||
export const TtlOn = "on";
|
export const TtlOn = "on";
|
||||||
export const TtlOnNoDefault = "on-nodefault";
|
export const TtlOnNoDefault = "on-nodefault";
|
||||||
@@ -46,8 +46,6 @@ export enum SettingsV2TabTypes {
|
|||||||
SubSettingsTab,
|
SubSettingsTab,
|
||||||
IndexingPolicyTab,
|
IndexingPolicyTab,
|
||||||
PartitionKeyTab,
|
PartitionKeyTab,
|
||||||
ComputedPropertiesTab,
|
|
||||||
ContainerVectorPolicyTab,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IsComponentDirtyResult {
|
export interface IsComponentDirtyResult {
|
||||||
@@ -150,11 +148,7 @@ export const getTabTitle = (tab: SettingsV2TabTypes): string => {
|
|||||||
case SettingsV2TabTypes.IndexingPolicyTab:
|
case SettingsV2TabTypes.IndexingPolicyTab:
|
||||||
return "Indexing Policy";
|
return "Indexing Policy";
|
||||||
case SettingsV2TabTypes.PartitionKeyTab:
|
case SettingsV2TabTypes.PartitionKeyTab:
|
||||||
return "Partition Keys (preview)";
|
return "Partition Keys";
|
||||||
case SettingsV2TabTypes.ComputedPropertiesTab:
|
|
||||||
return "Computed Properties";
|
|
||||||
case SettingsV2TabTypes.ContainerVectorPolicyTab:
|
|
||||||
return "Container Vector Policy (preview)";
|
|
||||||
default:
|
default:
|
||||||
throw new Error(`Unknown tab ${tab}`);
|
throw new Error(`Unknown tab ${tab}`);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,12 +40,6 @@ export const collection = {
|
|||||||
version: 2,
|
version: 2,
|
||||||
},
|
},
|
||||||
partitionKeyProperties: ["partitionKey"],
|
partitionKeyProperties: ["partitionKey"],
|
||||||
computedProperties: ko.observable<DataModels.ComputedProperties>([
|
|
||||||
{
|
|
||||||
name: "queryName",
|
|
||||||
query: "query",
|
|
||||||
},
|
|
||||||
]),
|
|
||||||
readSettings: () => {
|
readSettings: () => {
|
||||||
return;
|
return;
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -26,10 +26,10 @@ exports[`SettingsComponent renders 1`] = `
|
|||||||
Object {
|
Object {
|
||||||
"analyticalStorageTtl": [Function],
|
"analyticalStorageTtl": [Function],
|
||||||
"changeFeedPolicy": [Function],
|
"changeFeedPolicy": [Function],
|
||||||
"computedProperties": [Function],
|
|
||||||
"conflictResolutionPolicy": [Function],
|
"conflictResolutionPolicy": [Function],
|
||||||
"container": Explorer {
|
"container": Explorer {
|
||||||
"_isInitializingNotebooks": false,
|
"_isInitializingNotebooks": false,
|
||||||
|
"_resetNotebookWorkspace": [Function],
|
||||||
"isFixedCollectionWithSharedThroughputSupported": [Function],
|
"isFixedCollectionWithSharedThroughputSupported": [Function],
|
||||||
"isTabsContentExpanded": [Function],
|
"isTabsContentExpanded": [Function],
|
||||||
"onRefreshDatabasesKeyPress": [Function],
|
"onRefreshDatabasesKeyPress": [Function],
|
||||||
@@ -103,10 +103,10 @@ exports[`SettingsComponent renders 1`] = `
|
|||||||
Object {
|
Object {
|
||||||
"analyticalStorageTtl": [Function],
|
"analyticalStorageTtl": [Function],
|
||||||
"changeFeedPolicy": [Function],
|
"changeFeedPolicy": [Function],
|
||||||
"computedProperties": [Function],
|
|
||||||
"conflictResolutionPolicy": [Function],
|
"conflictResolutionPolicy": [Function],
|
||||||
"container": Explorer {
|
"container": Explorer {
|
||||||
"_isInitializingNotebooks": false,
|
"_isInitializingNotebooks": false,
|
||||||
|
"_resetNotebookWorkspace": [Function],
|
||||||
"isFixedCollectionWithSharedThroughputSupported": [Function],
|
"isFixedCollectionWithSharedThroughputSupported": [Function],
|
||||||
"isTabsContentExpanded": [Function],
|
"isTabsContentExpanded": [Function],
|
||||||
"onRefreshDatabasesKeyPress": [Function],
|
"onRefreshDatabasesKeyPress": [Function],
|
||||||
@@ -196,7 +196,6 @@ exports[`SettingsComponent renders 1`] = `
|
|||||||
"indexingMode": "consistent",
|
"indexingMode": "consistent",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
isVectorSearchEnabled={false}
|
|
||||||
logIndexingPolicySuccessMessage={[Function]}
|
logIndexingPolicySuccessMessage={[Function]}
|
||||||
onIndexingPolicyContentChange={[Function]}
|
onIndexingPolicyContentChange={[Function]}
|
||||||
onIndexingPolicyDirtyChange={[Function]}
|
onIndexingPolicyDirtyChange={[Function]}
|
||||||
@@ -206,7 +205,7 @@ exports[`SettingsComponent renders 1`] = `
|
|||||||
/>
|
/>
|
||||||
</PivotItem>
|
</PivotItem>
|
||||||
<PivotItem
|
<PivotItem
|
||||||
headerText="Partition Keys (preview)"
|
headerText="Partition Keys"
|
||||||
itemKey="PartitionKeyTab"
|
itemKey="PartitionKeyTab"
|
||||||
key="PartitionKeyTab"
|
key="PartitionKeyTab"
|
||||||
style={
|
style={
|
||||||
@@ -220,10 +219,10 @@ exports[`SettingsComponent renders 1`] = `
|
|||||||
Object {
|
Object {
|
||||||
"analyticalStorageTtl": [Function],
|
"analyticalStorageTtl": [Function],
|
||||||
"changeFeedPolicy": [Function],
|
"changeFeedPolicy": [Function],
|
||||||
"computedProperties": [Function],
|
|
||||||
"conflictResolutionPolicy": [Function],
|
"conflictResolutionPolicy": [Function],
|
||||||
"container": Explorer {
|
"container": Explorer {
|
||||||
"_isInitializingNotebooks": false,
|
"_isInitializingNotebooks": false,
|
||||||
|
"_resetNotebookWorkspace": [Function],
|
||||||
"isFixedCollectionWithSharedThroughputSupported": [Function],
|
"isFixedCollectionWithSharedThroughputSupported": [Function],
|
||||||
"isTabsContentExpanded": [Function],
|
"isTabsContentExpanded": [Function],
|
||||||
"onRefreshDatabasesKeyPress": [Function],
|
"onRefreshDatabasesKeyPress": [Function],
|
||||||
@@ -270,6 +269,7 @@ exports[`SettingsComponent renders 1`] = `
|
|||||||
explorer={
|
explorer={
|
||||||
Explorer {
|
Explorer {
|
||||||
"_isInitializingNotebooks": false,
|
"_isInitializingNotebooks": false,
|
||||||
|
"_resetNotebookWorkspace": [Function],
|
||||||
"isFixedCollectionWithSharedThroughputSupported": [Function],
|
"isFixedCollectionWithSharedThroughputSupported": [Function],
|
||||||
"isTabsContentExpanded": [Function],
|
"isTabsContentExpanded": [Function],
|
||||||
"onRefreshDatabasesKeyPress": [Function],
|
"onRefreshDatabasesKeyPress": [Function],
|
||||||
@@ -296,40 +296,6 @@ exports[`SettingsComponent renders 1`] = `
|
|||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
</PivotItem>
|
</PivotItem>
|
||||||
<PivotItem
|
|
||||||
headerText="Computed Properties"
|
|
||||||
itemKey="ComputedPropertiesTab"
|
|
||||||
key="ComputedPropertiesTab"
|
|
||||||
style={
|
|
||||||
Object {
|
|
||||||
"marginTop": 20,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<ComputedPropertiesComponent
|
|
||||||
computedPropertiesContent={
|
|
||||||
Array [
|
|
||||||
Object {
|
|
||||||
"name": "queryName",
|
|
||||||
"query": "query",
|
|
||||||
},
|
|
||||||
]
|
|
||||||
}
|
|
||||||
computedPropertiesContentBaseline={
|
|
||||||
Array [
|
|
||||||
Object {
|
|
||||||
"name": "queryName",
|
|
||||||
"query": "query",
|
|
||||||
},
|
|
||||||
]
|
|
||||||
}
|
|
||||||
logComputedPropertiesSuccessMessage={[Function]}
|
|
||||||
onComputedPropertiesContentChange={[Function]}
|
|
||||||
onComputedPropertiesDirtyChange={[Function]}
|
|
||||||
resetShouldDiscardComputedProperties={[Function]}
|
|
||||||
shouldDiscardComputedProperties={false}
|
|
||||||
/>
|
|
||||||
</PivotItem>
|
|
||||||
</StyledPivot>
|
</StyledPivot>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -99,6 +99,18 @@ exports[`SettingsUtils functions render 1`] = `
|
|||||||
</StyledLinkBase>
|
</StyledLinkBase>
|
||||||
.
|
.
|
||||||
</Text>
|
</Text>
|
||||||
|
<Text
|
||||||
|
styles={
|
||||||
|
Object {
|
||||||
|
"root": Object {
|
||||||
|
"color": "windowtext",
|
||||||
|
"fontSize": 14,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
>
|
||||||
|
You have not saved the latest changes made to your indexing policy. Please click save to confirm the changes.
|
||||||
|
</Text>
|
||||||
<Text
|
<Text
|
||||||
id="updateThroughputDelayedApplyWarningMessage"
|
id="updateThroughputDelayedApplyWarningMessage"
|
||||||
styles={
|
styles={
|
||||||
|
|||||||
@@ -14,17 +14,7 @@
|
|||||||
.throughputInputSpacing > :not(:last-child) {
|
.throughputInputSpacing > :not(:last-child) {
|
||||||
margin-bottom: @DefaultSpace;
|
margin-bottom: @DefaultSpace;
|
||||||
}
|
}
|
||||||
|
.capacitycalculator-link:focus{
|
||||||
.capacitycalculator-link:focus {
|
|
||||||
text-decoration: underline;
|
text-decoration: underline;
|
||||||
outline-offset: 2px;
|
outline-offset: 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.outlineNone{
|
|
||||||
outline: none !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.copyQuery:focus::after,
|
|
||||||
.deleteQuery:focus::after {
|
|
||||||
outline: none !important;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -223,7 +223,6 @@ export const ThroughputInput: FunctionComponent<ThroughputInputProps> = ({
|
|||||||
<Text variant="small" aria-label="capacity calculator of azure cosmos db">
|
<Text variant="small" aria-label="capacity calculator of azure cosmos db">
|
||||||
Estimate your required RU/s with{" "}
|
Estimate your required RU/s with{" "}
|
||||||
<Link
|
<Link
|
||||||
className="underlinedLink outlineNone"
|
|
||||||
target="_blank"
|
target="_blank"
|
||||||
href="https://cosmos.azure.com/capacitycalculator/"
|
href="https://cosmos.azure.com/capacitycalculator/"
|
||||||
aria-label="capacity calculator of azure cosmos db"
|
aria-label="capacity calculator of azure cosmos db"
|
||||||
@@ -272,12 +271,7 @@ export const ThroughputInput: FunctionComponent<ThroughputInputProps> = ({
|
|||||||
<Stack className="throughputInputSpacing">
|
<Stack className="throughputInputSpacing">
|
||||||
<Text variant="small" aria-label="ruDescription">
|
<Text variant="small" aria-label="ruDescription">
|
||||||
Estimate your required RU/s with
|
Estimate your required RU/s with
|
||||||
<Link
|
<Link target="_blank" href="https://cosmos.azure.com/capacitycalculator/" aria-label="Capacity calculator">
|
||||||
className="underlinedLink"
|
|
||||||
target="_blank"
|
|
||||||
href="https://cosmos.azure.com/capacitycalculator/"
|
|
||||||
aria-label="Capacity calculator"
|
|
||||||
>
|
|
||||||
capacity calculator
|
capacity calculator
|
||||||
</Link>
|
</Link>
|
||||||
.
|
.
|
||||||
|
|||||||
@@ -733,13 +733,11 @@ exports[`ThroughputInput Pane should render Default properly 1`] = `
|
|||||||
|
|
||||||
<StyledLinkBase
|
<StyledLinkBase
|
||||||
aria-label="capacity calculator of azure cosmos db"
|
aria-label="capacity calculator of azure cosmos db"
|
||||||
className="underlinedLink outlineNone"
|
|
||||||
href="https://cosmos.azure.com/capacitycalculator/"
|
href="https://cosmos.azure.com/capacitycalculator/"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
>
|
>
|
||||||
<LinkBase
|
<LinkBase
|
||||||
aria-label="capacity calculator of azure cosmos db"
|
aria-label="capacity calculator of azure cosmos db"
|
||||||
className="underlinedLink outlineNone"
|
|
||||||
href="https://cosmos.azure.com/capacitycalculator/"
|
href="https://cosmos.azure.com/capacitycalculator/"
|
||||||
styles={[Function]}
|
styles={[Function]}
|
||||||
target="_blank"
|
target="_blank"
|
||||||
@@ -1019,7 +1017,7 @@ exports[`ThroughputInput Pane should render Default properly 1`] = `
|
|||||||
>
|
>
|
||||||
<a
|
<a
|
||||||
aria-label="capacity calculator of azure cosmos db"
|
aria-label="capacity calculator of azure cosmos db"
|
||||||
className="ms-Link underlinedLink outlineNone root-117"
|
className="ms-Link root-117"
|
||||||
href="https://cosmos.azure.com/capacitycalculator/"
|
href="https://cosmos.azure.com/capacitycalculator/"
|
||||||
onClick={[Function]}
|
onClick={[Function]}
|
||||||
target="_blank"
|
target="_blank"
|
||||||
|
|||||||
@@ -1,48 +1,48 @@
|
|||||||
import { shallow } from "enzyme";
|
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { LegacyTreeComponent, LegacyTreeNode, LegacyTreeNodeComponent } from "./LegacyTreeComponent";
|
import { shallow } from "enzyme";
|
||||||
|
import { TreeComponent, TreeNode, TreeNodeComponent } from "./TreeComponent";
|
||||||
|
|
||||||
const buildChildren = (): LegacyTreeNode[] => {
|
const buildChildren = (): TreeNode[] => {
|
||||||
const grandChild11: LegacyTreeNode = {
|
const grandChild11: TreeNode = {
|
||||||
label: "ZgrandChild11",
|
label: "ZgrandChild11",
|
||||||
};
|
};
|
||||||
const grandChild12: LegacyTreeNode = {
|
const grandChild12: TreeNode = {
|
||||||
label: "AgrandChild12",
|
label: "AgrandChild12",
|
||||||
};
|
};
|
||||||
const child1: LegacyTreeNode = {
|
const child1: TreeNode = {
|
||||||
label: "Bchild1",
|
label: "Bchild1",
|
||||||
children: [grandChild11, grandChild12],
|
children: [grandChild11, grandChild12],
|
||||||
};
|
};
|
||||||
|
|
||||||
const child2: LegacyTreeNode = {
|
const child2: TreeNode = {
|
||||||
label: "2child2",
|
label: "2child2",
|
||||||
};
|
};
|
||||||
|
|
||||||
return [child1, child2];
|
return [child1, child2];
|
||||||
};
|
};
|
||||||
|
|
||||||
const buildChildren2 = (): LegacyTreeNode[] => {
|
const buildChildren2 = (): TreeNode[] => {
|
||||||
const grandChild11: LegacyTreeNode = {
|
const grandChild11: TreeNode = {
|
||||||
label: "ZgrandChild11",
|
label: "ZgrandChild11",
|
||||||
};
|
};
|
||||||
const grandChild12: LegacyTreeNode = {
|
const grandChild12: TreeNode = {
|
||||||
label: "AgrandChild12",
|
label: "AgrandChild12",
|
||||||
};
|
};
|
||||||
|
|
||||||
const child1: LegacyTreeNode = {
|
const child1: TreeNode = {
|
||||||
label: "aChild",
|
label: "aChild",
|
||||||
};
|
};
|
||||||
|
|
||||||
const child2: LegacyTreeNode = {
|
const child2: TreeNode = {
|
||||||
label: "bchild",
|
label: "bchild",
|
||||||
children: [grandChild11, grandChild12],
|
children: [grandChild11, grandChild12],
|
||||||
};
|
};
|
||||||
|
|
||||||
const child3: LegacyTreeNode = {
|
const child3: TreeNode = {
|
||||||
label: "cchild",
|
label: "cchild",
|
||||||
};
|
};
|
||||||
|
|
||||||
const child4: LegacyTreeNode = {
|
const child4: TreeNode = {
|
||||||
label: "dchild",
|
label: "dchild",
|
||||||
children: [grandChild11, grandChild12],
|
children: [grandChild11, grandChild12],
|
||||||
};
|
};
|
||||||
@@ -50,7 +50,7 @@ const buildChildren2 = (): LegacyTreeNode[] => {
|
|||||||
return [child1, child2, child3, child4];
|
return [child1, child2, child3, child4];
|
||||||
};
|
};
|
||||||
|
|
||||||
describe("LegacyTreeComponent", () => {
|
describe("TreeComponent", () => {
|
||||||
it("renders a simple tree", () => {
|
it("renders a simple tree", () => {
|
||||||
const root = {
|
const root = {
|
||||||
label: "root",
|
label: "root",
|
||||||
@@ -62,14 +62,14 @@ describe("LegacyTreeComponent", () => {
|
|||||||
className: "tree",
|
className: "tree",
|
||||||
};
|
};
|
||||||
|
|
||||||
const wrapper = shallow(<LegacyTreeComponent {...props} />);
|
const wrapper = shallow(<TreeComponent {...props} />);
|
||||||
expect(wrapper).toMatchSnapshot();
|
expect(wrapper).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("LegacyTreeNodeComponent", () => {
|
describe("TreeNodeComponent", () => {
|
||||||
it("renders a simple node (sorted children, expanded)", () => {
|
it("renders a simple node (sorted children, expanded)", () => {
|
||||||
const node: LegacyTreeNode = {
|
const node: TreeNode = {
|
||||||
label: "label",
|
label: "label",
|
||||||
id: "id",
|
id: "id",
|
||||||
children: buildChildren(),
|
children: buildChildren(),
|
||||||
@@ -98,12 +98,12 @@ describe("LegacyTreeNodeComponent", () => {
|
|||||||
generation: 12,
|
generation: 12,
|
||||||
paddingLeft: 23,
|
paddingLeft: 23,
|
||||||
};
|
};
|
||||||
const wrapper = shallow(<LegacyTreeNodeComponent {...props} />);
|
const wrapper = shallow(<TreeNodeComponent {...props} />);
|
||||||
expect(wrapper).toMatchSnapshot();
|
expect(wrapper).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("renders unsorted children by default", () => {
|
it("renders unsorted children by default", () => {
|
||||||
const node: LegacyTreeNode = {
|
const node: TreeNode = {
|
||||||
label: "label",
|
label: "label",
|
||||||
children: buildChildren(),
|
children: buildChildren(),
|
||||||
isExpanded: true,
|
isExpanded: true,
|
||||||
@@ -113,12 +113,12 @@ describe("LegacyTreeNodeComponent", () => {
|
|||||||
generation: 2,
|
generation: 2,
|
||||||
paddingLeft: 9,
|
paddingLeft: 9,
|
||||||
};
|
};
|
||||||
const wrapper = shallow(<LegacyTreeNodeComponent {...props} />);
|
const wrapper = shallow(<TreeNodeComponent {...props} />);
|
||||||
expect(wrapper).toMatchSnapshot();
|
expect(wrapper).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("does not render children by default", () => {
|
it("does not render children by default", () => {
|
||||||
const node: LegacyTreeNode = {
|
const node: TreeNode = {
|
||||||
label: "label",
|
label: "label",
|
||||||
children: buildChildren(),
|
children: buildChildren(),
|
||||||
isAlphaSorted: false,
|
isAlphaSorted: false,
|
||||||
@@ -128,12 +128,12 @@ describe("LegacyTreeNodeComponent", () => {
|
|||||||
generation: 2,
|
generation: 2,
|
||||||
paddingLeft: 9,
|
paddingLeft: 9,
|
||||||
};
|
};
|
||||||
const wrapper = shallow(<LegacyTreeNodeComponent {...props} />);
|
const wrapper = shallow(<TreeNodeComponent {...props} />);
|
||||||
expect(wrapper).toMatchSnapshot();
|
expect(wrapper).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("renders sorted children, expanded, leaves and parents separated", () => {
|
it("renders sorted children, expanded, leaves and parents separated", () => {
|
||||||
const node: LegacyTreeNode = {
|
const node: TreeNode = {
|
||||||
label: "label",
|
label: "label",
|
||||||
id: "id",
|
id: "id",
|
||||||
children: buildChildren2(),
|
children: buildChildren2(),
|
||||||
@@ -156,12 +156,12 @@ describe("LegacyTreeNodeComponent", () => {
|
|||||||
generation: 12,
|
generation: 12,
|
||||||
paddingLeft: 23,
|
paddingLeft: 23,
|
||||||
};
|
};
|
||||||
const wrapper = shallow(<LegacyTreeNodeComponent {...props} />);
|
const wrapper = shallow(<TreeNodeComponent {...props} />);
|
||||||
expect(wrapper).toMatchSnapshot();
|
expect(wrapper).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("renders loading icon", () => {
|
it("renders loading icon", () => {
|
||||||
const node: LegacyTreeNode = {
|
const node: TreeNode = {
|
||||||
label: "label",
|
label: "label",
|
||||||
children: [],
|
children: [],
|
||||||
isExpanded: true,
|
isExpanded: true,
|
||||||
@@ -172,7 +172,7 @@ describe("LegacyTreeNodeComponent", () => {
|
|||||||
generation: 2,
|
generation: 2,
|
||||||
paddingLeft: 9,
|
paddingLeft: 9,
|
||||||
};
|
};
|
||||||
const wrapper = shallow(<LegacyTreeNodeComponent {...props} />);
|
const wrapper = shallow(<TreeNodeComponent {...props} />);
|
||||||
expect(wrapper).toMatchSnapshot();
|
expect(wrapper).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -12,7 +12,6 @@ import {
|
|||||||
IContextualMenuItemProps,
|
IContextualMenuItemProps,
|
||||||
IContextualMenuProps,
|
IContextualMenuProps,
|
||||||
} from "@fluentui/react";
|
} from "@fluentui/react";
|
||||||
import { TreeNodeMenuItem } from "Explorer/Controls/TreeComponent/TreeNodeComponent";
|
|
||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
import AnimateHeight from "react-animate-height";
|
import AnimateHeight from "react-animate-height";
|
||||||
import LoadingIndicator_3Squares from "../../../../images/LoadingIndicator_3Squares.gif";
|
import LoadingIndicator_3Squares from "../../../../images/LoadingIndicator_3Squares.gif";
|
||||||
@@ -23,10 +22,18 @@ import { StyleConstants } from "../../../Common/StyleConstants";
|
|||||||
import { Action, ActionModifiers } from "../../../Shared/Telemetry/TelemetryConstants";
|
import { Action, ActionModifiers } from "../../../Shared/Telemetry/TelemetryConstants";
|
||||||
import * as TelemetryProcessor from "../../../Shared/Telemetry/TelemetryProcessor";
|
import * as TelemetryProcessor from "../../../Shared/Telemetry/TelemetryProcessor";
|
||||||
|
|
||||||
export interface LegacyTreeNode {
|
export interface TreeNodeMenuItem {
|
||||||
|
label: string;
|
||||||
|
onClick: () => void;
|
||||||
|
iconSrc?: string;
|
||||||
|
isDisabled?: boolean;
|
||||||
|
styleClass?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface TreeNode {
|
||||||
label: string;
|
label: string;
|
||||||
id?: string;
|
id?: string;
|
||||||
children?: LegacyTreeNode[];
|
children?: TreeNode[];
|
||||||
contextMenu?: TreeNodeMenuItem[];
|
contextMenu?: TreeNodeMenuItem[];
|
||||||
iconSrc?: string;
|
iconSrc?: string;
|
||||||
isExpanded?: boolean;
|
isExpanded?: boolean;
|
||||||
@@ -43,37 +50,34 @@ export interface LegacyTreeNode {
|
|||||||
onContextMenuOpen?: () => void;
|
onContextMenuOpen?: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface LegacyTreeComponentProps {
|
export interface TreeComponentProps {
|
||||||
rootNode: LegacyTreeNode;
|
rootNode: TreeNode;
|
||||||
style?: any;
|
style?: any;
|
||||||
className?: string;
|
className?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class LegacyTreeComponent extends React.Component<LegacyTreeComponentProps> {
|
export class TreeComponent extends React.Component<TreeComponentProps> {
|
||||||
public render(): JSX.Element {
|
public render(): JSX.Element {
|
||||||
return (
|
return (
|
||||||
<div style={this.props.style} className={`treeComponent ${this.props.className}`} role="tree">
|
<div style={this.props.style} className={`treeComponent ${this.props.className}`} role="tree">
|
||||||
<LegacyTreeNodeComponent paddingLeft={0} node={this.props.rootNode} generation={0} />
|
<TreeNodeComponent paddingLeft={0} node={this.props.rootNode} generation={0} />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Tree node is a react component */
|
/* Tree node is a react component */
|
||||||
interface LegacyTreeNodeComponentProps {
|
interface TreeNodeComponentProps {
|
||||||
node: LegacyTreeNode;
|
node: TreeNode;
|
||||||
generation: number;
|
generation: number;
|
||||||
paddingLeft: number;
|
paddingLeft: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface LegacyTreeNodeComponentState {
|
interface TreeNodeComponentState {
|
||||||
isExpanded: boolean;
|
isExpanded: boolean;
|
||||||
isMenuShowing: boolean;
|
isMenuShowing: boolean;
|
||||||
}
|
}
|
||||||
export class LegacyTreeNodeComponent extends React.Component<
|
export class TreeNodeComponent extends React.Component<TreeNodeComponentProps, TreeNodeComponentState> {
|
||||||
LegacyTreeNodeComponentProps,
|
|
||||||
LegacyTreeNodeComponentState
|
|
||||||
> {
|
|
||||||
private static readonly paddingPerGenerationPx = 16;
|
private static readonly paddingPerGenerationPx = 16;
|
||||||
private static readonly iconOffset = 22;
|
private static readonly iconOffset = 22;
|
||||||
private static readonly transitionDurationMS = 200;
|
private static readonly transitionDurationMS = 200;
|
||||||
@@ -81,7 +85,7 @@ export class LegacyTreeNodeComponent extends React.Component<
|
|||||||
private contextMenuRef = React.createRef<HTMLDivElement>();
|
private contextMenuRef = React.createRef<HTMLDivElement>();
|
||||||
private isExpanded: boolean;
|
private isExpanded: boolean;
|
||||||
|
|
||||||
constructor(props: LegacyTreeNodeComponentProps) {
|
constructor(props: TreeNodeComponentProps) {
|
||||||
super(props);
|
super(props);
|
||||||
this.isExpanded = props.node.isExpanded;
|
this.isExpanded = props.node.isExpanded;
|
||||||
this.state = {
|
this.state = {
|
||||||
@@ -90,13 +94,13 @@ export class LegacyTreeNodeComponent extends React.Component<
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidUpdate(prevProps: LegacyTreeNodeComponentProps, prevState: LegacyTreeNodeComponentState) {
|
componentDidUpdate(prevProps: TreeNodeComponentProps, prevState: TreeNodeComponentState) {
|
||||||
// Only call when expand has actually changed
|
// Only call when expand has actually changed
|
||||||
if (this.state.isExpanded !== prevState.isExpanded) {
|
if (this.state.isExpanded !== prevState.isExpanded) {
|
||||||
if (this.state.isExpanded) {
|
if (this.state.isExpanded) {
|
||||||
this.props.node.onExpanded && setTimeout(this.props.node.onExpanded, LegacyTreeNodeComponent.callbackDelayMS);
|
this.props.node.onExpanded && setTimeout(this.props.node.onExpanded, TreeNodeComponent.callbackDelayMS);
|
||||||
} else {
|
} else {
|
||||||
this.props.node.onCollapsed && setTimeout(this.props.node.onCollapsed, LegacyTreeNodeComponent.callbackDelayMS);
|
this.props.node.onCollapsed && setTimeout(this.props.node.onCollapsed, TreeNodeComponent.callbackDelayMS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (this.props.node.isExpanded !== this.isExpanded) {
|
if (this.props.node.isExpanded !== this.isExpanded) {
|
||||||
@@ -111,18 +115,18 @@ export class LegacyTreeNodeComponent extends React.Component<
|
|||||||
return this.renderNode(this.props.node, this.props.generation);
|
return this.renderNode(this.props.node, this.props.generation);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static getSortedChildren(treeNode: LegacyTreeNode): LegacyTreeNode[] {
|
private static getSortedChildren(treeNode: TreeNode): TreeNode[] {
|
||||||
if (!treeNode || !treeNode.children) {
|
if (!treeNode || !treeNode.children) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
const compareFct = (a: LegacyTreeNode, b: LegacyTreeNode) => a.label.localeCompare(b.label);
|
const compareFct = (a: TreeNode, b: TreeNode) => a.label.localeCompare(b.label);
|
||||||
|
|
||||||
let unsortedChildren;
|
let unsortedChildren;
|
||||||
if (treeNode.isLeavesParentsSeparate) {
|
if (treeNode.isLeavesParentsSeparate) {
|
||||||
// Separate parents and leave
|
// Separate parents and leave
|
||||||
const parents: LegacyTreeNode[] = treeNode.children.filter((node) => node.children);
|
const parents: TreeNode[] = treeNode.children.filter((node) => node.children);
|
||||||
const leaves: LegacyTreeNode[] = treeNode.children.filter((node) => !node.children);
|
const leaves: TreeNode[] = treeNode.children.filter((node) => !node.children);
|
||||||
|
|
||||||
if (treeNode.isAlphaSorted) {
|
if (treeNode.isAlphaSorted) {
|
||||||
parents.sort(compareFct);
|
parents.sort(compareFct);
|
||||||
@@ -137,18 +141,18 @@ export class LegacyTreeNodeComponent extends React.Component<
|
|||||||
return unsortedChildren;
|
return unsortedChildren;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static isNodeHeaderBlank(node: LegacyTreeNode): boolean {
|
private static isNodeHeaderBlank(node: TreeNode): boolean {
|
||||||
return (node.label === undefined || node.label === null) && !node.contextMenu;
|
return (node.label === undefined || node.label === null) && !node.contextMenu;
|
||||||
}
|
}
|
||||||
|
|
||||||
private renderNode(node: LegacyTreeNode, generation: number): JSX.Element {
|
private renderNode(node: TreeNode, generation: number): JSX.Element {
|
||||||
const paddingLeft = generation * LegacyTreeNodeComponent.paddingPerGenerationPx;
|
let paddingLeft = generation * TreeNodeComponent.paddingPerGenerationPx;
|
||||||
let additionalOffsetPx = 15;
|
let additionalOffsetPx = 15;
|
||||||
|
|
||||||
if (node.children) {
|
if (node.children) {
|
||||||
const childrenWithSubChildren = node.children.filter((child: LegacyTreeNode) => !!child.children);
|
const childrenWithSubChildren = node.children.filter((child: TreeNode) => !!child.children);
|
||||||
if (childrenWithSubChildren.length > 0) {
|
if (childrenWithSubChildren.length > 0) {
|
||||||
additionalOffsetPx = LegacyTreeNodeComponent.iconOffset;
|
additionalOffsetPx = TreeNodeComponent.iconOffset;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -156,17 +160,16 @@ export class LegacyTreeNodeComponent extends React.Component<
|
|||||||
const showSelected =
|
const showSelected =
|
||||||
this.props.node.isSelected &&
|
this.props.node.isSelected &&
|
||||||
this.props.node.isSelected() &&
|
this.props.node.isSelected() &&
|
||||||
!LegacyTreeNodeComponent.isAnyDescendantSelected(this.props.node);
|
!TreeNodeComponent.isAnyDescendantSelected(this.props.node);
|
||||||
|
|
||||||
const headerStyle: React.CSSProperties = { paddingLeft: this.props.paddingLeft };
|
const headerStyle: React.CSSProperties = { paddingLeft: this.props.paddingLeft };
|
||||||
if (LegacyTreeNodeComponent.isNodeHeaderBlank(node)) {
|
if (TreeNodeComponent.isNodeHeaderBlank(node)) {
|
||||||
headerStyle.height = 0;
|
headerStyle.height = 0;
|
||||||
headerStyle.padding = 0;
|
headerStyle.padding = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
data-test={`Tree/TreeNode:${node.label}`}
|
|
||||||
className={`${this.props.node.className || ""} main${generation} nodeItem ${showSelected ? "selected" : ""}`}
|
className={`${this.props.node.className || ""} main${generation} nodeItem ${showSelected ? "selected" : ""}`}
|
||||||
onClick={(event: React.MouseEvent<HTMLDivElement>) => this.onNodeClick(event, node)}
|
onClick={(event: React.MouseEvent<HTMLDivElement>) => this.onNodeClick(event, node)}
|
||||||
onKeyPress={(event: React.KeyboardEvent<HTMLDivElement>) => this.onNodeKeyPress(event, node)}
|
onKeyPress={(event: React.KeyboardEvent<HTMLDivElement>) => this.onNodeKeyPress(event, node)}
|
||||||
@@ -175,9 +178,9 @@ export class LegacyTreeNodeComponent extends React.Component<
|
|||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
className={`treeNodeHeader ${this.state.isMenuShowing ? "showingMenu" : ""}`}
|
className={`treeNodeHeader ${this.state.isMenuShowing ? "showingMenu" : ""}`}
|
||||||
data-test={`Tree/TreeNode/Header:${node.label}`}
|
|
||||||
style={headerStyle}
|
style={headerStyle}
|
||||||
tabIndex={node.children ? -1 : 0}
|
tabIndex={node.children ? -1 : 0}
|
||||||
|
data-test={node.label}
|
||||||
>
|
>
|
||||||
{this.renderCollapseExpandIcon(node)}
|
{this.renderCollapseExpandIcon(node)}
|
||||||
{node.iconSrc && <img className="nodeIcon" src={node.iconSrc} alt="" />}
|
{node.iconSrc && <img className="nodeIcon" src={node.iconSrc} alt="" />}
|
||||||
@@ -192,13 +195,10 @@ export class LegacyTreeNodeComponent extends React.Component<
|
|||||||
<img className="loadingIcon" src={LoadingIndicator_3Squares} hidden={!this.props.node.isLoading} />
|
<img className="loadingIcon" src={LoadingIndicator_3Squares} hidden={!this.props.node.isLoading} />
|
||||||
</div>
|
</div>
|
||||||
{node.children && (
|
{node.children && (
|
||||||
<AnimateHeight
|
<AnimateHeight duration={TreeNodeComponent.transitionDurationMS} height={this.state.isExpanded ? "auto" : 0}>
|
||||||
duration={LegacyTreeNodeComponent.transitionDurationMS}
|
|
||||||
height={this.state.isExpanded ? "auto" : 0}
|
|
||||||
>
|
|
||||||
<div className="nodeChildren" data-test={node.label} role="group">
|
<div className="nodeChildren" data-test={node.label} role="group">
|
||||||
{LegacyTreeNodeComponent.getSortedChildren(node).map((childNode: LegacyTreeNode) => (
|
{TreeNodeComponent.getSortedChildren(node).map((childNode: TreeNode) => (
|
||||||
<LegacyTreeNodeComponent
|
<TreeNodeComponent
|
||||||
key={`${childNode.label}-${generation + 1}-${childNode.timestamp}`}
|
key={`${childNode.label}-${generation + 1}-${childNode.timestamp}`}
|
||||||
node={childNode}
|
node={childNode}
|
||||||
generation={generation + 1}
|
generation={generation + 1}
|
||||||
@@ -216,14 +216,12 @@ export class LegacyTreeNodeComponent extends React.Component<
|
|||||||
* Recursive: is the node or any descendant selected
|
* Recursive: is the node or any descendant selected
|
||||||
* @param node
|
* @param node
|
||||||
*/
|
*/
|
||||||
private static isAnyDescendantSelected(node: LegacyTreeNode): boolean {
|
private static isAnyDescendantSelected(node: TreeNode): boolean {
|
||||||
return (
|
return (
|
||||||
node.children &&
|
node.children &&
|
||||||
node.children.reduce(
|
node.children.reduce(
|
||||||
(previous: boolean, child: LegacyTreeNode) =>
|
(previous: boolean, child: TreeNode) =>
|
||||||
previous ||
|
previous || (child.isSelected && child.isSelected()) || TreeNodeComponent.isAnyDescendantSelected(child),
|
||||||
(child.isSelected && child.isSelected()) ||
|
|
||||||
LegacyTreeNodeComponent.isAnyDescendantSelected(child),
|
|
||||||
false,
|
false,
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@@ -234,10 +232,10 @@ export class LegacyTreeNodeComponent extends React.Component<
|
|||||||
}
|
}
|
||||||
|
|
||||||
private onRightClick = (): void => {
|
private onRightClick = (): void => {
|
||||||
this.contextMenuRef.current.firstChild.dispatchEvent(LegacyTreeNodeComponent.createClickEvent());
|
this.contextMenuRef.current.firstChild.dispatchEvent(TreeNodeComponent.createClickEvent());
|
||||||
};
|
};
|
||||||
|
|
||||||
private renderContextMenuButton(node: LegacyTreeNode): JSX.Element {
|
private renderContextMenuButton(node: TreeNode): JSX.Element {
|
||||||
const menuItemLabel = "More";
|
const menuItemLabel = "More";
|
||||||
const buttonStyles: Partial<IButtonStyles> = {
|
const buttonStyles: Partial<IButtonStyles> = {
|
||||||
rootFocused: { outline: `1px dashed ${StyleConstants.FocusColor}` },
|
rootFocused: { outline: `1px dashed ${StyleConstants.FocusColor}` },
|
||||||
@@ -249,7 +247,7 @@ export class LegacyTreeNodeComponent extends React.Component<
|
|||||||
name="More"
|
name="More"
|
||||||
title="More"
|
title="More"
|
||||||
className="treeMenuEllipsis"
|
className="treeMenuEllipsis"
|
||||||
ariaLabel={`${menuItemLabel} options`}
|
ariaLabel={menuItemLabel}
|
||||||
menuIconProps={{
|
menuIconProps={{
|
||||||
iconName: menuItemLabel,
|
iconName: menuItemLabel,
|
||||||
styles: { root: { fontSize: "18px", fontWeight: "bold" } },
|
styles: { root: { fontSize: "18px", fontWeight: "bold" } },
|
||||||
@@ -265,9 +263,9 @@ export class LegacyTreeNodeComponent extends React.Component<
|
|||||||
onMenuDismissed: (contextualMenu?: IContextualMenuProps) => this.setState({ isMenuShowing: false }),
|
onMenuDismissed: (contextualMenu?: IContextualMenuProps) => this.setState({ isMenuShowing: false }),
|
||||||
contextualMenuItemAs: (props: IContextualMenuItemProps) => (
|
contextualMenuItemAs: (props: IContextualMenuItemProps) => (
|
||||||
<div
|
<div
|
||||||
data-test={`Tree/TreeNode/MenuItem:${props.item.text}`}
|
data-test={`treeComponentMenuItemContainer`}
|
||||||
className="treeComponentMenuItemContainer"
|
className="treeComponentMenuItemContainer"
|
||||||
onContextMenu={(e) => e.target.dispatchEvent(LegacyTreeNodeComponent.createClickEvent())}
|
onContextMenu={(e) => e.target.dispatchEvent(TreeNodeComponent.createClickEvent())}
|
||||||
>
|
>
|
||||||
{props.item.onRenderIcon()}
|
{props.item.onRenderIcon()}
|
||||||
<span
|
<span
|
||||||
@@ -299,7 +297,7 @@ export class LegacyTreeNodeComponent extends React.Component<
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private renderCollapseExpandIcon(node: LegacyTreeNode): JSX.Element {
|
private renderCollapseExpandIcon(node: TreeNode): JSX.Element {
|
||||||
if (!node.children || !node.label) {
|
if (!node.children || !node.label) {
|
||||||
return <></>;
|
return <></>;
|
||||||
}
|
}
|
||||||
@@ -316,12 +314,12 @@ export class LegacyTreeNodeComponent extends React.Component<
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private onNodeClick = (event: React.MouseEvent<HTMLDivElement>, node: LegacyTreeNode): void => {
|
private onNodeClick = (event: React.MouseEvent<HTMLDivElement>, node: TreeNode): void => {
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
if (node.children) {
|
if (node.children) {
|
||||||
const isExpanded = !this.state.isExpanded;
|
const isExpanded = !this.state.isExpanded;
|
||||||
// Prevent collapsing if node header is blank
|
// Prevent collapsing if node header is blank
|
||||||
if (!(LegacyTreeNodeComponent.isNodeHeaderBlank(node) && !isExpanded)) {
|
if (!(TreeNodeComponent.isNodeHeaderBlank(node) && !isExpanded)) {
|
||||||
this.setState({ isExpanded });
|
this.setState({ isExpanded });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -329,14 +327,14 @@ export class LegacyTreeNodeComponent extends React.Component<
|
|||||||
this.props.node.onClick && this.props.node.onClick(this.state.isExpanded);
|
this.props.node.onClick && this.props.node.onClick(this.state.isExpanded);
|
||||||
};
|
};
|
||||||
|
|
||||||
private onNodeKeyPress = (event: React.KeyboardEvent<HTMLDivElement>, node: LegacyTreeNode): void => {
|
private onNodeKeyPress = (event: React.KeyboardEvent<HTMLDivElement>, node: TreeNode): void => {
|
||||||
if (event.charCode === Constants.KeyCodes.Space || event.charCode === Constants.KeyCodes.Enter) {
|
if (event.charCode === Constants.KeyCodes.Space || event.charCode === Constants.KeyCodes.Enter) {
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
this.props.node.onClick && this.props.node.onClick(this.state.isExpanded);
|
this.props.node.onClick && this.props.node.onClick(this.state.isExpanded);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private onCollapseExpandIconKeyPress = (event: React.KeyboardEvent<HTMLDivElement>, node: LegacyTreeNode): void => {
|
private onCollapseExpandIconKeyPress = (event: React.KeyboardEvent<HTMLDivElement>, node: TreeNode): void => {
|
||||||
if (event.charCode === Constants.KeyCodes.Space || event.charCode === Constants.KeyCodes.Enter) {
|
if (event.charCode === Constants.KeyCodes.Space || event.charCode === Constants.KeyCodes.Enter) {
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
if (node.children) {
|
if (node.children) {
|
||||||
@@ -1,194 +0,0 @@
|
|||||||
import { TreeItem, TreeItemLayout, tokens } from "@fluentui/react-components";
|
|
||||||
import PromiseSource from "Utils/PromiseSource";
|
|
||||||
import { mount, shallow } from "enzyme";
|
|
||||||
import React from "react";
|
|
||||||
import { act } from "react-dom/test-utils";
|
|
||||||
import { TreeNode, TreeNodeComponent } from "./TreeNodeComponent";
|
|
||||||
|
|
||||||
function generateTestNode(id: string, additionalProps?: Partial<TreeNode>): TreeNode {
|
|
||||||
const node: TreeNode = {
|
|
||||||
id,
|
|
||||||
label: `${id}Label`,
|
|
||||||
className: `${id}Class`,
|
|
||||||
iconSrc: `${id}Icon`,
|
|
||||||
onClick: jest.fn().mockName(`${id}Click`),
|
|
||||||
...additionalProps,
|
|
||||||
};
|
|
||||||
return node;
|
|
||||||
}
|
|
||||||
|
|
||||||
describe("TreeNodeComponent", () => {
|
|
||||||
it("renders a single node", () => {
|
|
||||||
const node = generateTestNode("root");
|
|
||||||
const component = shallow(<TreeNodeComponent node={node} treeNodeId={node.id} />);
|
|
||||||
expect(component).toMatchSnapshot();
|
|
||||||
|
|
||||||
// The "click" handler is actually attached to onOpenChange, with a type of "Click".
|
|
||||||
component
|
|
||||||
.find(TreeItem)
|
|
||||||
.props()
|
|
||||||
.onOpenChange(null!, { open: true, value: "borp", target: null!, event: null!, type: "Click" });
|
|
||||||
expect(node.onClick).toHaveBeenCalled();
|
|
||||||
});
|
|
||||||
|
|
||||||
it("renders a node with a menu", () => {
|
|
||||||
const node = generateTestNode("root", {
|
|
||||||
contextMenu: [
|
|
||||||
{
|
|
||||||
label: "enabledItem",
|
|
||||||
onClick: jest.fn().mockName("enabledItemClick"),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "disabledItem",
|
|
||||||
onClick: jest.fn().mockName("disabledItemClick"),
|
|
||||||
isDisabled: true,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
});
|
|
||||||
const component = shallow(<TreeNodeComponent node={node} treeNodeId={node.id} />);
|
|
||||||
expect(component).toMatchSnapshot();
|
|
||||||
});
|
|
||||||
|
|
||||||
it("renders a loading spinner if the node is loading", async () => {
|
|
||||||
const loading = new PromiseSource();
|
|
||||||
const node = generateTestNode("root", {
|
|
||||||
onExpanded: () => loading.promise,
|
|
||||||
});
|
|
||||||
const component = shallow(<TreeNodeComponent node={node} treeNodeId={node.id} />);
|
|
||||||
|
|
||||||
act(() => {
|
|
||||||
component
|
|
||||||
.find(TreeItem)
|
|
||||||
.props()
|
|
||||||
.onOpenChange(null!, { open: true, value: "borp", target: null!, event: null!, type: "ExpandIconClick" });
|
|
||||||
});
|
|
||||||
|
|
||||||
expect(component).toMatchSnapshot("loading");
|
|
||||||
await loading.resolveAndWait();
|
|
||||||
expect(component).toMatchSnapshot("loaded");
|
|
||||||
});
|
|
||||||
|
|
||||||
it("renders single selected leaf node as selected", () => {
|
|
||||||
const node = generateTestNode("root", {
|
|
||||||
isSelected: () => true,
|
|
||||||
});
|
|
||||||
const component = shallow(<TreeNodeComponent node={node} treeNodeId={node.id} />);
|
|
||||||
expect(component.find(TreeItemLayout).props().style?.backgroundColor).toStrictEqual(
|
|
||||||
tokens.colorNeutralBackground1Selected,
|
|
||||||
);
|
|
||||||
expect(component).toMatchSnapshot();
|
|
||||||
});
|
|
||||||
|
|
||||||
it("renders selected parent node as selected if no descendant nodes are selected", () => {
|
|
||||||
const node = generateTestNode("root", {
|
|
||||||
isSelected: () => true,
|
|
||||||
children: [
|
|
||||||
generateTestNode("child1", {
|
|
||||||
children: [generateTestNode("grandchild1"), generateTestNode("grandchild2")],
|
|
||||||
}),
|
|
||||||
generateTestNode("child2"),
|
|
||||||
],
|
|
||||||
});
|
|
||||||
const component = shallow(<TreeNodeComponent node={node} treeNodeId={node.id} />);
|
|
||||||
expect(component.find(TreeItemLayout).props().style?.backgroundColor).toStrictEqual(
|
|
||||||
tokens.colorNeutralBackground1Selected,
|
|
||||||
);
|
|
||||||
expect(component).toMatchSnapshot();
|
|
||||||
});
|
|
||||||
|
|
||||||
it("renders selected parent node as unselected if any descendant node is selected", () => {
|
|
||||||
const node = generateTestNode("root", {
|
|
||||||
isSelected: () => true,
|
|
||||||
children: [
|
|
||||||
generateTestNode("child1", {
|
|
||||||
children: [
|
|
||||||
generateTestNode("grandchild1", {
|
|
||||||
isSelected: () => true,
|
|
||||||
}),
|
|
||||||
generateTestNode("grandchild2"),
|
|
||||||
],
|
|
||||||
}),
|
|
||||||
generateTestNode("child2"),
|
|
||||||
],
|
|
||||||
});
|
|
||||||
const component = shallow(<TreeNodeComponent node={node} treeNodeId={node.id} />);
|
|
||||||
expect(component.find(TreeItemLayout).props().style?.backgroundColor).toBeUndefined();
|
|
||||||
expect(component).toMatchSnapshot();
|
|
||||||
});
|
|
||||||
|
|
||||||
it("renders an icon if the node has one", () => {
|
|
||||||
const node = generateTestNode("root", {
|
|
||||||
iconSrc: "the-icon.svg",
|
|
||||||
});
|
|
||||||
const component = shallow(<TreeNodeComponent node={node} treeNodeId={node.id} />);
|
|
||||||
expect(component).toMatchSnapshot();
|
|
||||||
});
|
|
||||||
|
|
||||||
it("renders a node as expandable if it has empty, but defined, children array", () => {
|
|
||||||
const node = generateTestNode("root", {
|
|
||||||
isLoading: true,
|
|
||||||
children: [
|
|
||||||
generateTestNode("child1", {
|
|
||||||
children: [],
|
|
||||||
}),
|
|
||||||
generateTestNode("child2"),
|
|
||||||
],
|
|
||||||
});
|
|
||||||
const component = shallow(<TreeNodeComponent node={node} treeNodeId={node.id} />);
|
|
||||||
expect(component).toMatchSnapshot();
|
|
||||||
});
|
|
||||||
|
|
||||||
it("does not render children if the node is loading", () => {
|
|
||||||
const node = generateTestNode("root", {
|
|
||||||
isLoading: true,
|
|
||||||
children: [
|
|
||||||
generateTestNode("child1", {
|
|
||||||
children: [generateTestNode("grandchild1"), generateTestNode("grandchild2")],
|
|
||||||
}),
|
|
||||||
generateTestNode("child2"),
|
|
||||||
],
|
|
||||||
});
|
|
||||||
const component = shallow(<TreeNodeComponent node={node} treeNodeId={node.id} />);
|
|
||||||
expect(component).toMatchSnapshot();
|
|
||||||
});
|
|
||||||
|
|
||||||
it("fully renders a tree", () => {
|
|
||||||
const child3Loading = new PromiseSource();
|
|
||||||
const node = generateTestNode("root", {
|
|
||||||
isSelected: () => true,
|
|
||||||
children: [
|
|
||||||
generateTestNode("child1", {
|
|
||||||
children: [
|
|
||||||
generateTestNode("grandchild1", {
|
|
||||||
iconSrc: "grandchild1Icon.svg",
|
|
||||||
isSelected: () => true,
|
|
||||||
}),
|
|
||||||
generateTestNode("grandchild2"),
|
|
||||||
],
|
|
||||||
}),
|
|
||||||
generateTestNode("child2Loading", {
|
|
||||||
isLoading: true,
|
|
||||||
children: [generateTestNode("grandchild3NotRendered")],
|
|
||||||
}),
|
|
||||||
generateTestNode("child3Expanding", {
|
|
||||||
onExpanded: () => child3Loading.promise,
|
|
||||||
}),
|
|
||||||
],
|
|
||||||
});
|
|
||||||
const component = mount(<TreeNodeComponent node={node} treeNodeId={node.id} />);
|
|
||||||
|
|
||||||
// Find and expand the child3Expanding node
|
|
||||||
const expandingChild = component.find(TreeItem).filterWhere((n) => n.props().value === "root/child3ExpandingLabel");
|
|
||||||
act(() => {
|
|
||||||
expandingChild.props().onOpenChange(null!, {
|
|
||||||
open: true,
|
|
||||||
value: "root/child3ExpandingLabel",
|
|
||||||
target: null!,
|
|
||||||
event: null!,
|
|
||||||
type: "Click",
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
expect(component).toMatchSnapshot();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@@ -1,207 +0,0 @@
|
|||||||
import {
|
|
||||||
Button,
|
|
||||||
Menu,
|
|
||||||
MenuItem,
|
|
||||||
MenuList,
|
|
||||||
MenuOpenChangeData,
|
|
||||||
MenuOpenEvent,
|
|
||||||
MenuPopover,
|
|
||||||
MenuTrigger,
|
|
||||||
Spinner,
|
|
||||||
Tree,
|
|
||||||
TreeItem,
|
|
||||||
TreeItemLayout,
|
|
||||||
TreeOpenChangeData,
|
|
||||||
TreeOpenChangeEvent,
|
|
||||||
} from "@fluentui/react-components";
|
|
||||||
import { MoreHorizontal20Regular } from "@fluentui/react-icons";
|
|
||||||
import { tokens } from "@fluentui/react-theme";
|
|
||||||
import * as React from "react";
|
|
||||||
import { useCallback } from "react";
|
|
||||||
|
|
||||||
export interface TreeNodeMenuItem {
|
|
||||||
label: string;
|
|
||||||
onClick: () => void;
|
|
||||||
iconSrc?: string;
|
|
||||||
isDisabled?: boolean;
|
|
||||||
styleClass?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface TreeNode {
|
|
||||||
label: string;
|
|
||||||
id?: string;
|
|
||||||
children?: TreeNode[];
|
|
||||||
contextMenu?: TreeNodeMenuItem[];
|
|
||||||
iconSrc?: string;
|
|
||||||
isExpanded?: boolean;
|
|
||||||
className?: string;
|
|
||||||
isAlphaSorted?: boolean;
|
|
||||||
// data?: any; // Piece of data corresponding to this node
|
|
||||||
timestamp?: number;
|
|
||||||
isLeavesParentsSeparate?: boolean; // Display parents together first, then leaves
|
|
||||||
isLoading?: boolean;
|
|
||||||
isScrollable?: boolean;
|
|
||||||
isSelected?: () => boolean;
|
|
||||||
onClick?: () => void; // Only if a leaf, other click will expand/collapse
|
|
||||||
onExpanded?: () => Promise<void>;
|
|
||||||
onCollapsed?: () => void;
|
|
||||||
onContextMenuOpen?: () => void;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface TreeNodeComponentProps {
|
|
||||||
node: TreeNode;
|
|
||||||
className?: string;
|
|
||||||
treeNodeId: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Function that returns true if any descendant (at any depth) of this node is selected. */
|
|
||||||
function isAnyDescendantSelected(node: TreeNode): boolean {
|
|
||||||
return (
|
|
||||||
node.children &&
|
|
||||||
node.children.reduce(
|
|
||||||
(previous: boolean, child: TreeNode) =>
|
|
||||||
previous || (child.isSelected && child.isSelected()) || isAnyDescendantSelected(child),
|
|
||||||
false,
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
const getTreeIcon = (iconSrc: string): JSX.Element => <img src={iconSrc} alt="" style={{ width: 16, height: 16 }} />;
|
|
||||||
|
|
||||||
export const TreeNodeComponent: React.FC<TreeNodeComponentProps> = ({
|
|
||||||
node,
|
|
||||||
treeNodeId,
|
|
||||||
}: TreeNodeComponentProps): JSX.Element => {
|
|
||||||
const [isLoading, setIsLoading] = React.useState<boolean>(false);
|
|
||||||
|
|
||||||
const getSortedChildren = (treeNode: TreeNode): TreeNode[] => {
|
|
||||||
if (!treeNode || !treeNode.children) {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
const compareFct = (a: TreeNode, b: TreeNode) => a.label.localeCompare(b.label);
|
|
||||||
|
|
||||||
let unsortedChildren;
|
|
||||||
if (treeNode.isLeavesParentsSeparate) {
|
|
||||||
// Separate parents and leave
|
|
||||||
const parents: TreeNode[] = treeNode.children.filter((node) => node.children);
|
|
||||||
const leaves: TreeNode[] = treeNode.children.filter((node) => !node.children);
|
|
||||||
|
|
||||||
if (treeNode.isAlphaSorted) {
|
|
||||||
parents.sort(compareFct);
|
|
||||||
leaves.sort(compareFct);
|
|
||||||
}
|
|
||||||
|
|
||||||
unsortedChildren = parents.concat(leaves);
|
|
||||||
} else {
|
|
||||||
unsortedChildren = treeNode.isAlphaSorted ? treeNode.children.sort(compareFct) : treeNode.children;
|
|
||||||
}
|
|
||||||
|
|
||||||
return unsortedChildren;
|
|
||||||
};
|
|
||||||
|
|
||||||
// A branch node is any node with a defined children array, even if the array is empty.
|
|
||||||
const isBranch = !!node.children;
|
|
||||||
|
|
||||||
const onOpenChange = useCallback(
|
|
||||||
(_: TreeOpenChangeEvent, data: TreeOpenChangeData) => {
|
|
||||||
if (data.type === "Click" && !isBranch && node.onClick) {
|
|
||||||
node.onClick();
|
|
||||||
}
|
|
||||||
if (!node.isExpanded && data.open && node.onExpanded) {
|
|
||||||
// Catch the transition non-expanded to expanded
|
|
||||||
setIsLoading(true);
|
|
||||||
node.onExpanded?.().then(() => setIsLoading(false));
|
|
||||||
} else if (node.isExpanded && !data.open && node.onCollapsed) {
|
|
||||||
// Catch the transition expanded to non-expanded
|
|
||||||
node.onCollapsed?.();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
[isBranch, node, setIsLoading],
|
|
||||||
);
|
|
||||||
|
|
||||||
const onMenuOpenChange = useCallback(
|
|
||||||
(e: MenuOpenEvent, data: MenuOpenChangeData) => {
|
|
||||||
if (data.open) {
|
|
||||||
node.onContextMenuOpen?.();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
[node],
|
|
||||||
);
|
|
||||||
|
|
||||||
// We show a node as selected if it is selected AND no descendant is selected.
|
|
||||||
// We want to show only the deepest selected node as selected.
|
|
||||||
const isCurrentNodeSelected = node.isSelected && node.isSelected();
|
|
||||||
const shouldShowAsSelected = isCurrentNodeSelected && !isAnyDescendantSelected(node);
|
|
||||||
|
|
||||||
const contextMenuItems = (node.contextMenu ?? []).map((menuItem) => (
|
|
||||||
<MenuItem
|
|
||||||
data-test={`TreeNode/ContextMenuItem:${menuItem.label}`}
|
|
||||||
disabled={menuItem.isDisabled}
|
|
||||||
key={menuItem.label}
|
|
||||||
onClick={menuItem.onClick}
|
|
||||||
>
|
|
||||||
{menuItem.label}
|
|
||||||
</MenuItem>
|
|
||||||
));
|
|
||||||
|
|
||||||
const treeItem = (
|
|
||||||
<TreeItem
|
|
||||||
data-test={`TreeNodeContainer:${treeNodeId}`}
|
|
||||||
value={treeNodeId}
|
|
||||||
itemType={isBranch ? "branch" : "leaf"}
|
|
||||||
onOpenChange={onOpenChange}
|
|
||||||
>
|
|
||||||
<TreeItemLayout
|
|
||||||
className={node.className}
|
|
||||||
data-test={`TreeNode:${treeNodeId}`}
|
|
||||||
actions={
|
|
||||||
contextMenuItems.length > 0 && (
|
|
||||||
<Menu onOpenChange={onMenuOpenChange}>
|
|
||||||
<MenuTrigger disableButtonEnhancement>
|
|
||||||
<Button
|
|
||||||
aria-label="More options"
|
|
||||||
data-test="TreeNode/ContextMenuTrigger"
|
|
||||||
appearance="subtle"
|
|
||||||
icon={<MoreHorizontal20Regular />}
|
|
||||||
/>
|
|
||||||
</MenuTrigger>
|
|
||||||
<MenuPopover data-test={`TreeNode/ContextMenu:${treeNodeId}`}>
|
|
||||||
<MenuList>{contextMenuItems}</MenuList>
|
|
||||||
</MenuPopover>
|
|
||||||
</Menu>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
expandIcon={isLoading ? <Spinner size="extra-tiny" /> : undefined}
|
|
||||||
iconBefore={node.iconSrc && getTreeIcon(node.iconSrc)}
|
|
||||||
style={{
|
|
||||||
backgroundColor: shouldShowAsSelected ? tokens.colorNeutralBackground1Selected : undefined,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{node.label}
|
|
||||||
</TreeItemLayout>
|
|
||||||
{!node.isLoading && node.children?.length > 0 && (
|
|
||||||
<Tree style={{ overflow: node.isScrollable ? "auto" : undefined }}>
|
|
||||||
{getSortedChildren(node).map((childNode: TreeNode) => (
|
|
||||||
<TreeNodeComponent key={childNode.label} node={childNode} treeNodeId={`${treeNodeId}/${childNode.label}`} />
|
|
||||||
))}
|
|
||||||
</Tree>
|
|
||||||
)}
|
|
||||||
</TreeItem>
|
|
||||||
);
|
|
||||||
|
|
||||||
if (contextMenuItems.length === 0) {
|
|
||||||
return treeItem;
|
|
||||||
}
|
|
||||||
|
|
||||||
// For accessibility, it's highly recommended that any 'actions' also be available in the context menu.
|
|
||||||
// See https://react.fluentui.dev/?path=/docs/components-tree--default#actions
|
|
||||||
return (
|
|
||||||
<Menu positioning="below-end" openOnContext onOpenChange={onMenuOpenChange}>
|
|
||||||
<MenuTrigger disableButtonEnhancement>{treeItem}</MenuTrigger>
|
|
||||||
<MenuPopover>
|
|
||||||
<MenuList>{contextMenuItems}</MenuList>
|
|
||||||
</MenuPopover>
|
|
||||||
</Menu>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
exports[`LegacyTreeComponent renders a simple tree 1`] = `
|
exports[`TreeComponent renders a simple tree 1`] = `
|
||||||
<div
|
<div
|
||||||
className="treeComponent tree"
|
className="treeComponent tree"
|
||||||
role="tree"
|
role="tree"
|
||||||
>
|
>
|
||||||
<LegacyTreeNodeComponent
|
<TreeNodeComponent
|
||||||
generation={0}
|
generation={0}
|
||||||
node={
|
node={
|
||||||
Object {
|
Object {
|
||||||
@@ -33,17 +33,16 @@ exports[`LegacyTreeComponent renders a simple tree 1`] = `
|
|||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`LegacyTreeNodeComponent does not render children by default 1`] = `
|
exports[`TreeNodeComponent does not render children by default 1`] = `
|
||||||
<div
|
<div
|
||||||
className=" main2 nodeItem "
|
className=" main2 nodeItem "
|
||||||
data-test="Tree/TreeNode:label"
|
|
||||||
onClick={[Function]}
|
onClick={[Function]}
|
||||||
onKeyPress={[Function]}
|
onKeyPress={[Function]}
|
||||||
role="treeitem"
|
role="treeitem"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
className="treeNodeHeader "
|
className="treeNodeHeader "
|
||||||
data-test="Tree/TreeNode/Header:label"
|
data-test="label"
|
||||||
style={
|
style={
|
||||||
Object {
|
Object {
|
||||||
"paddingLeft": 9,
|
"paddingLeft": 9,
|
||||||
@@ -103,7 +102,7 @@ exports[`LegacyTreeNodeComponent does not render children by default 1`] = `
|
|||||||
data-test="label"
|
data-test="label"
|
||||||
role="group"
|
role="group"
|
||||||
>
|
>
|
||||||
<LegacyTreeNodeComponent
|
<TreeNodeComponent
|
||||||
generation={3}
|
generation={3}
|
||||||
key="Bchild1-3-undefined"
|
key="Bchild1-3-undefined"
|
||||||
node={
|
node={
|
||||||
@@ -121,7 +120,7 @@ exports[`LegacyTreeNodeComponent does not render children by default 1`] = `
|
|||||||
}
|
}
|
||||||
paddingLeft={32}
|
paddingLeft={32}
|
||||||
/>
|
/>
|
||||||
<LegacyTreeNodeComponent
|
<TreeNodeComponent
|
||||||
generation={3}
|
generation={3}
|
||||||
key="2child2-3-undefined"
|
key="2child2-3-undefined"
|
||||||
node={
|
node={
|
||||||
@@ -136,10 +135,9 @@ exports[`LegacyTreeNodeComponent does not render children by default 1`] = `
|
|||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`LegacyTreeNodeComponent renders a simple node (sorted children, expanded) 1`] = `
|
exports[`TreeNodeComponent renders a simple node (sorted children, expanded) 1`] = `
|
||||||
<div
|
<div
|
||||||
className="nodeClassname main12 nodeItem "
|
className="nodeClassname main12 nodeItem "
|
||||||
data-test="Tree/TreeNode:label"
|
|
||||||
id="id"
|
id="id"
|
||||||
onClick={[Function]}
|
onClick={[Function]}
|
||||||
onKeyPress={[Function]}
|
onKeyPress={[Function]}
|
||||||
@@ -147,7 +145,7 @@ exports[`LegacyTreeNodeComponent renders a simple node (sorted children, expande
|
|||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
className="treeNodeHeader "
|
className="treeNodeHeader "
|
||||||
data-test="Tree/TreeNode/Header:label"
|
data-test="label"
|
||||||
style={
|
style={
|
||||||
Object {
|
Object {
|
||||||
"paddingLeft": 23,
|
"paddingLeft": 23,
|
||||||
@@ -174,7 +172,7 @@ exports[`LegacyTreeNodeComponent renders a simple node (sorted children, expande
|
|||||||
onKeyPress={[Function]}
|
onKeyPress={[Function]}
|
||||||
>
|
>
|
||||||
<CustomizedIconButton
|
<CustomizedIconButton
|
||||||
ariaLabel="More options"
|
ariaLabel="More"
|
||||||
className="treeMenuEllipsis"
|
className="treeMenuEllipsis"
|
||||||
menuIconProps={
|
menuIconProps={
|
||||||
Object {
|
Object {
|
||||||
@@ -256,7 +254,7 @@ exports[`LegacyTreeNodeComponent renders a simple node (sorted children, expande
|
|||||||
data-test="label"
|
data-test="label"
|
||||||
role="group"
|
role="group"
|
||||||
>
|
>
|
||||||
<LegacyTreeNodeComponent
|
<TreeNodeComponent
|
||||||
generation={13}
|
generation={13}
|
||||||
key="2child2-13-undefined"
|
key="2child2-13-undefined"
|
||||||
node={
|
node={
|
||||||
@@ -266,7 +264,7 @@ exports[`LegacyTreeNodeComponent renders a simple node (sorted children, expande
|
|||||||
}
|
}
|
||||||
paddingLeft={214}
|
paddingLeft={214}
|
||||||
/>
|
/>
|
||||||
<LegacyTreeNodeComponent
|
<TreeNodeComponent
|
||||||
generation={13}
|
generation={13}
|
||||||
key="Bchild1-13-undefined"
|
key="Bchild1-13-undefined"
|
||||||
node={
|
node={
|
||||||
@@ -289,17 +287,16 @@ exports[`LegacyTreeNodeComponent renders a simple node (sorted children, expande
|
|||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`LegacyTreeNodeComponent renders loading icon 1`] = `
|
exports[`TreeNodeComponent renders loading icon 1`] = `
|
||||||
<div
|
<div
|
||||||
className=" main2 nodeItem "
|
className=" main2 nodeItem "
|
||||||
data-test="Tree/TreeNode:label"
|
|
||||||
onClick={[Function]}
|
onClick={[Function]}
|
||||||
onKeyPress={[Function]}
|
onKeyPress={[Function]}
|
||||||
role="treeitem"
|
role="treeitem"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
className="treeNodeHeader "
|
className="treeNodeHeader "
|
||||||
data-test="Tree/TreeNode/Header:label"
|
data-test="label"
|
||||||
style={
|
style={
|
||||||
Object {
|
Object {
|
||||||
"paddingLeft": 9,
|
"paddingLeft": 9,
|
||||||
@@ -363,10 +360,9 @@ exports[`LegacyTreeNodeComponent renders loading icon 1`] = `
|
|||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`LegacyTreeNodeComponent renders sorted children, expanded, leaves and parents separated 1`] = `
|
exports[`TreeNodeComponent renders sorted children, expanded, leaves and parents separated 1`] = `
|
||||||
<div
|
<div
|
||||||
className="nodeClassname main12 nodeItem "
|
className="nodeClassname main12 nodeItem "
|
||||||
data-test="Tree/TreeNode:label"
|
|
||||||
id="id"
|
id="id"
|
||||||
onClick={[Function]}
|
onClick={[Function]}
|
||||||
onKeyPress={[Function]}
|
onKeyPress={[Function]}
|
||||||
@@ -374,7 +370,7 @@ exports[`LegacyTreeNodeComponent renders sorted children, expanded, leaves and p
|
|||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
className="treeNodeHeader "
|
className="treeNodeHeader "
|
||||||
data-test="Tree/TreeNode/Header:label"
|
data-test="label"
|
||||||
style={
|
style={
|
||||||
Object {
|
Object {
|
||||||
"paddingLeft": 23,
|
"paddingLeft": 23,
|
||||||
@@ -401,7 +397,7 @@ exports[`LegacyTreeNodeComponent renders sorted children, expanded, leaves and p
|
|||||||
onKeyPress={[Function]}
|
onKeyPress={[Function]}
|
||||||
>
|
>
|
||||||
<CustomizedIconButton
|
<CustomizedIconButton
|
||||||
ariaLabel="More options"
|
ariaLabel="More"
|
||||||
className="treeMenuEllipsis"
|
className="treeMenuEllipsis"
|
||||||
menuIconProps={
|
menuIconProps={
|
||||||
Object {
|
Object {
|
||||||
@@ -474,7 +470,7 @@ exports[`LegacyTreeNodeComponent renders sorted children, expanded, leaves and p
|
|||||||
data-test="label"
|
data-test="label"
|
||||||
role="group"
|
role="group"
|
||||||
>
|
>
|
||||||
<LegacyTreeNodeComponent
|
<TreeNodeComponent
|
||||||
generation={13}
|
generation={13}
|
||||||
key="bchild-13-undefined"
|
key="bchild-13-undefined"
|
||||||
node={
|
node={
|
||||||
@@ -492,7 +488,7 @@ exports[`LegacyTreeNodeComponent renders sorted children, expanded, leaves and p
|
|||||||
}
|
}
|
||||||
paddingLeft={192}
|
paddingLeft={192}
|
||||||
/>
|
/>
|
||||||
<LegacyTreeNodeComponent
|
<TreeNodeComponent
|
||||||
generation={13}
|
generation={13}
|
||||||
key="dchild-13-undefined"
|
key="dchild-13-undefined"
|
||||||
node={
|
node={
|
||||||
@@ -510,7 +506,7 @@ exports[`LegacyTreeNodeComponent renders sorted children, expanded, leaves and p
|
|||||||
}
|
}
|
||||||
paddingLeft={192}
|
paddingLeft={192}
|
||||||
/>
|
/>
|
||||||
<LegacyTreeNodeComponent
|
<TreeNodeComponent
|
||||||
generation={13}
|
generation={13}
|
||||||
key="aChild-13-undefined"
|
key="aChild-13-undefined"
|
||||||
node={
|
node={
|
||||||
@@ -520,7 +516,7 @@ exports[`LegacyTreeNodeComponent renders sorted children, expanded, leaves and p
|
|||||||
}
|
}
|
||||||
paddingLeft={214}
|
paddingLeft={214}
|
||||||
/>
|
/>
|
||||||
<LegacyTreeNodeComponent
|
<TreeNodeComponent
|
||||||
generation={13}
|
generation={13}
|
||||||
key="cchild-13-undefined"
|
key="cchild-13-undefined"
|
||||||
node={
|
node={
|
||||||
@@ -535,17 +531,16 @@ exports[`LegacyTreeNodeComponent renders sorted children, expanded, leaves and p
|
|||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`LegacyTreeNodeComponent renders unsorted children by default 1`] = `
|
exports[`TreeNodeComponent renders unsorted children by default 1`] = `
|
||||||
<div
|
<div
|
||||||
className=" main2 nodeItem "
|
className=" main2 nodeItem "
|
||||||
data-test="Tree/TreeNode:label"
|
|
||||||
onClick={[Function]}
|
onClick={[Function]}
|
||||||
onKeyPress={[Function]}
|
onKeyPress={[Function]}
|
||||||
role="treeitem"
|
role="treeitem"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
className="treeNodeHeader "
|
className="treeNodeHeader "
|
||||||
data-test="Tree/TreeNode/Header:label"
|
data-test="label"
|
||||||
style={
|
style={
|
||||||
Object {
|
Object {
|
||||||
"paddingLeft": 9,
|
"paddingLeft": 9,
|
||||||
@@ -605,7 +600,7 @@ exports[`LegacyTreeNodeComponent renders unsorted children by default 1`] = `
|
|||||||
data-test="label"
|
data-test="label"
|
||||||
role="group"
|
role="group"
|
||||||
>
|
>
|
||||||
<LegacyTreeNodeComponent
|
<TreeNodeComponent
|
||||||
generation={3}
|
generation={3}
|
||||||
key="Bchild1-3-undefined"
|
key="Bchild1-3-undefined"
|
||||||
node={
|
node={
|
||||||
@@ -623,7 +618,7 @@ exports[`LegacyTreeNodeComponent renders unsorted children by default 1`] = `
|
|||||||
}
|
}
|
||||||
paddingLeft={32}
|
paddingLeft={32}
|
||||||
/>
|
/>
|
||||||
<LegacyTreeNodeComponent
|
<TreeNodeComponent
|
||||||
generation={3}
|
generation={3}
|
||||||
key="2child2-3-undefined"
|
key="2child2-3-undefined"
|
||||||
node={
|
node={
|
||||||
File diff suppressed because it is too large
Load Diff
147
src/Explorer/Controls/TreeComponent2/TreeNode2Component.tsx
Normal file
147
src/Explorer/Controls/TreeComponent2/TreeNode2Component.tsx
Normal file
@@ -0,0 +1,147 @@
|
|||||||
|
import {
|
||||||
|
Button,
|
||||||
|
Menu,
|
||||||
|
MenuItem,
|
||||||
|
MenuList,
|
||||||
|
MenuPopover,
|
||||||
|
MenuTrigger,
|
||||||
|
Spinner,
|
||||||
|
Tree,
|
||||||
|
TreeItem,
|
||||||
|
TreeItemLayout,
|
||||||
|
TreeOpenChangeData,
|
||||||
|
TreeOpenChangeEvent,
|
||||||
|
} from "@fluentui/react-components";
|
||||||
|
import { MoreHorizontal20Regular } from "@fluentui/react-icons";
|
||||||
|
import { tokens } from "@fluentui/react-theme";
|
||||||
|
import * as React from "react";
|
||||||
|
|
||||||
|
export interface TreeNode2MenuItem {
|
||||||
|
label: string;
|
||||||
|
onClick: () => void;
|
||||||
|
iconSrc?: string;
|
||||||
|
isDisabled?: boolean;
|
||||||
|
styleClass?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface TreeNode2 {
|
||||||
|
label: string;
|
||||||
|
id?: string;
|
||||||
|
children?: TreeNode2[];
|
||||||
|
contextMenu?: TreeNode2MenuItem[];
|
||||||
|
iconSrc?: string;
|
||||||
|
isExpanded?: boolean;
|
||||||
|
className?: string;
|
||||||
|
isAlphaSorted?: boolean;
|
||||||
|
// data?: any; // Piece of data corresponding to this node
|
||||||
|
timestamp?: number;
|
||||||
|
isLeavesParentsSeparate?: boolean; // Display parents together first, then leaves
|
||||||
|
isLoading?: boolean;
|
||||||
|
isScrollable?: boolean;
|
||||||
|
isSelected?: () => boolean;
|
||||||
|
onClick?: () => void; // Only if a leaf, other click will expand/collapse
|
||||||
|
onExpanded?: () => Promise<void>;
|
||||||
|
onCollapsed?: () => void;
|
||||||
|
onContextMenuOpen?: () => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface TreeNode2ComponentProps {
|
||||||
|
node: TreeNode2;
|
||||||
|
className?: string;
|
||||||
|
treeNodeId: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
const getTreeIcon = (iconSrc: string): JSX.Element => <img src={iconSrc} alt="" style={{ width: 20, height: 20 }} />;
|
||||||
|
|
||||||
|
export const TreeNode2Component: React.FC<TreeNode2ComponentProps> = ({
|
||||||
|
node,
|
||||||
|
treeNodeId,
|
||||||
|
}: TreeNode2ComponentProps): JSX.Element => {
|
||||||
|
const [isLoading, setIsLoading] = React.useState<boolean>(false);
|
||||||
|
|
||||||
|
const getSortedChildren = (treeNode: TreeNode2): TreeNode2[] => {
|
||||||
|
if (!treeNode || !treeNode.children) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
const compareFct = (a: TreeNode2, b: TreeNode2) => a.label.localeCompare(b.label);
|
||||||
|
|
||||||
|
let unsortedChildren;
|
||||||
|
if (treeNode.isLeavesParentsSeparate) {
|
||||||
|
// Separate parents and leave
|
||||||
|
const parents: TreeNode2[] = treeNode.children.filter((node) => node.children);
|
||||||
|
const leaves: TreeNode2[] = treeNode.children.filter((node) => !node.children);
|
||||||
|
|
||||||
|
if (treeNode.isAlphaSorted) {
|
||||||
|
parents.sort(compareFct);
|
||||||
|
leaves.sort(compareFct);
|
||||||
|
}
|
||||||
|
|
||||||
|
unsortedChildren = parents.concat(leaves);
|
||||||
|
} else {
|
||||||
|
unsortedChildren = treeNode.isAlphaSorted ? treeNode.children.sort(compareFct) : treeNode.children;
|
||||||
|
}
|
||||||
|
|
||||||
|
return unsortedChildren;
|
||||||
|
};
|
||||||
|
|
||||||
|
const onOpenChange = (_: TreeOpenChangeEvent, data: TreeOpenChangeData) => {
|
||||||
|
if (!node.isExpanded && data.open && node.onExpanded) {
|
||||||
|
// Catch the transition non-expanded to expanded
|
||||||
|
setIsLoading(true);
|
||||||
|
node.onExpanded?.().then(() => setIsLoading(false));
|
||||||
|
} else if (node.isExpanded && !data.open && node.onCollapsed) {
|
||||||
|
// Catch the transition expanded to non-expanded
|
||||||
|
node.onCollapsed?.();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<TreeItem
|
||||||
|
value={treeNodeId}
|
||||||
|
itemType={node.children !== undefined ? "branch" : "leaf"}
|
||||||
|
style={{ height: "100%" }}
|
||||||
|
onOpenChange={onOpenChange}
|
||||||
|
>
|
||||||
|
<TreeItemLayout
|
||||||
|
className={node.className}
|
||||||
|
actions={
|
||||||
|
node.contextMenu && (
|
||||||
|
<Menu>
|
||||||
|
<MenuTrigger disableButtonEnhancement>
|
||||||
|
<Button aria-label="More options" appearance="subtle" icon={<MoreHorizontal20Regular />} />
|
||||||
|
</MenuTrigger>
|
||||||
|
<MenuPopover>
|
||||||
|
<MenuList>
|
||||||
|
{node.contextMenu.map((menuItem) => (
|
||||||
|
<MenuItem disabled={menuItem.isDisabled} key={menuItem.label} onClick={menuItem.onClick}>
|
||||||
|
{menuItem.label}
|
||||||
|
</MenuItem>
|
||||||
|
))}
|
||||||
|
</MenuList>
|
||||||
|
</MenuPopover>
|
||||||
|
</Menu>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
expandIcon={isLoading ? <Spinner size="extra-tiny" /> : undefined}
|
||||||
|
iconBefore={node.iconSrc && getTreeIcon(node.iconSrc)}
|
||||||
|
style={{
|
||||||
|
backgroundColor: node.isSelected && node.isSelected() ? tokens.colorNeutralBackground1Selected : undefined,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<span onClick={() => node.onClick?.()}>{node.label}</span>
|
||||||
|
</TreeItemLayout>
|
||||||
|
{!node.isLoading && node.children?.length > 0 && (
|
||||||
|
<Tree style={{ overflow: node.isScrollable ? "auto" : undefined }}>
|
||||||
|
{getSortedChildren(node).map((childNode: TreeNode2) => (
|
||||||
|
<TreeNode2Component
|
||||||
|
key={childNode.label}
|
||||||
|
node={childNode}
|
||||||
|
treeNodeId={`${treeNodeId}/${childNode.label}`}
|
||||||
|
/>
|
||||||
|
))}
|
||||||
|
</Tree>
|
||||||
|
)}
|
||||||
|
</TreeItem>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -38,6 +38,7 @@ import { fromContentUri, toRawContentUri } from "../Utils/GitHubUtils";
|
|||||||
import * as NotificationConsoleUtils from "../Utils/NotificationConsoleUtils";
|
import * as NotificationConsoleUtils from "../Utils/NotificationConsoleUtils";
|
||||||
import { logConsoleError, logConsoleInfo, logConsoleProgress } from "../Utils/NotificationConsoleUtils";
|
import { logConsoleError, logConsoleInfo, logConsoleProgress } from "../Utils/NotificationConsoleUtils";
|
||||||
import { update } from "../Utils/arm/generatedClients/cosmos/databaseAccounts";
|
import { update } from "../Utils/arm/generatedClients/cosmos/databaseAccounts";
|
||||||
|
import { listByDatabaseAccount } from "../Utils/arm/generatedClients/cosmosNotebooks/notebookWorkspaces";
|
||||||
import { useSidePanel } from "../hooks/useSidePanel";
|
import { useSidePanel } from "../hooks/useSidePanel";
|
||||||
import { useTabs } from "../hooks/useTabs";
|
import { useTabs } from "../hooks/useTabs";
|
||||||
import "./ComponentRegisterer";
|
import "./ComponentRegisterer";
|
||||||
@@ -55,6 +56,7 @@ import { AddCollectionPanel } from "./Panes/AddCollectionPanel";
|
|||||||
import { CassandraAddCollectionPane } from "./Panes/CassandraAddCollectionPane/CassandraAddCollectionPane";
|
import { CassandraAddCollectionPane } from "./Panes/CassandraAddCollectionPane/CassandraAddCollectionPane";
|
||||||
import { ExecuteSprocParamsPane } from "./Panes/ExecuteSprocParamsPane/ExecuteSprocParamsPane";
|
import { ExecuteSprocParamsPane } from "./Panes/ExecuteSprocParamsPane/ExecuteSprocParamsPane";
|
||||||
import { StringInputPane } from "./Panes/StringInputPane/StringInputPane";
|
import { StringInputPane } from "./Panes/StringInputPane/StringInputPane";
|
||||||
|
import { UploadFilePane } from "./Panes/UploadFilePane/UploadFilePane";
|
||||||
import { UploadItemsPane } from "./Panes/UploadItemsPane/UploadItemsPane";
|
import { UploadItemsPane } from "./Panes/UploadItemsPane/UploadItemsPane";
|
||||||
import { CassandraAPIDataClient, TableDataClient, TablesAPIDataClient } from "./Tables/TableDataClient";
|
import { CassandraAPIDataClient, TableDataClient, TablesAPIDataClient } from "./Tables/TableDataClient";
|
||||||
import NotebookV2Tab, { NotebookTabOptions } from "./Tabs/NotebookV2Tab";
|
import NotebookV2Tab, { NotebookTabOptions } from "./Tabs/NotebookV2Tab";
|
||||||
@@ -136,6 +138,14 @@ export default class Explorer {
|
|||||||
|
|
||||||
this.isTabsContentExpanded = ko.observable(false);
|
this.isTabsContentExpanded = ko.observable(false);
|
||||||
|
|
||||||
|
document.addEventListener(
|
||||||
|
"contextmenu",
|
||||||
|
(e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
},
|
||||||
|
false,
|
||||||
|
);
|
||||||
|
|
||||||
$(() => {
|
$(() => {
|
||||||
$(document.body).click(() => $(".commandDropdownContainer").hide());
|
$(document.body).click(() => $(".commandDropdownContainer").hide());
|
||||||
});
|
});
|
||||||
@@ -286,14 +296,6 @@ export default class Explorer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async openCESCVAFeedbackBlade(): Promise<void> {
|
|
||||||
sendMessage({ type: MessageTypes.OpenCESCVAFeedbackBlade });
|
|
||||||
Logger.logInfo(
|
|
||||||
`CES CVA Feedback logging current date when survey is shown ${Date.now().toString()}`,
|
|
||||||
"Explorer/openCESCVAFeedbackBlade",
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
public async refreshDatabaseForResourceToken(): Promise<void> {
|
public async refreshDatabaseForResourceToken(): Promise<void> {
|
||||||
const databaseId = userContext.parsedResourceToken?.databaseId;
|
const databaseId = userContext.parsedResourceToken?.databaseId;
|
||||||
const collectionId = userContext.parsedResourceToken?.collectionId;
|
const collectionId = userContext.parsedResourceToken?.collectionId;
|
||||||
@@ -500,6 +502,104 @@ export default class Explorer {
|
|||||||
.then((memoryUsageInfo) => useNotebook.getState().setMemoryUsageInfo(memoryUsageInfo));
|
.then((memoryUsageInfo) => useNotebook.getState().setMemoryUsageInfo(memoryUsageInfo));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public resetNotebookWorkspace(): void {
|
||||||
|
if (!useNotebook.getState().isNotebookEnabled || !this.notebookManager?.notebookClient) {
|
||||||
|
handleError(
|
||||||
|
"Attempt to reset notebook workspace, but notebook is not enabled",
|
||||||
|
"Explorer/resetNotebookWorkspace",
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const dialogContent = useNotebook.getState().isPhoenixNotebooks
|
||||||
|
? "Notebooks saved in the temporary workspace will be deleted. Do you want to proceed?"
|
||||||
|
: "This lets you keep your notebook files and the workspace will be restored to default. Proceed anyway?";
|
||||||
|
|
||||||
|
const resetConfirmationDialogProps: DialogProps = {
|
||||||
|
isModal: true,
|
||||||
|
title: "Reset Workspace",
|
||||||
|
subText: dialogContent,
|
||||||
|
primaryButtonText: "OK",
|
||||||
|
secondaryButtonText: "Cancel",
|
||||||
|
onPrimaryButtonClick: this._resetNotebookWorkspace,
|
||||||
|
onSecondaryButtonClick: () => useDialog.getState().closeDialog(),
|
||||||
|
};
|
||||||
|
useDialog.getState().openDialog(resetConfirmationDialogProps);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async _containsDefaultNotebookWorkspace(databaseAccount: DataModels.DatabaseAccount): Promise<boolean> {
|
||||||
|
if (!databaseAccount) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
const { value: workspaces } = await listByDatabaseAccount(
|
||||||
|
userContext.subscriptionId,
|
||||||
|
userContext.resourceGroup,
|
||||||
|
userContext.databaseAccount.name,
|
||||||
|
);
|
||||||
|
return workspaces && workspaces.length > 0 && workspaces.some((workspace) => workspace.name === "default");
|
||||||
|
} catch (error) {
|
||||||
|
Logger.logError(getErrorMessage(error), "Explorer/_containsDefaultNotebookWorkspace");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private _resetNotebookWorkspace = async () => {
|
||||||
|
useDialog.getState().closeDialog();
|
||||||
|
const clearInProgressMessage = logConsoleProgress("Resetting notebook workspace");
|
||||||
|
let connectionStatus: ContainerConnectionInfo;
|
||||||
|
try {
|
||||||
|
const notebookServerInfo = useNotebook.getState().notebookServerInfo;
|
||||||
|
if (!notebookServerInfo || !notebookServerInfo.notebookServerEndpoint) {
|
||||||
|
const error = "No server endpoint detected";
|
||||||
|
Logger.logError(error, "NotebookContainerClient/resetWorkspace");
|
||||||
|
logConsoleError(error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
TelemetryProcessor.traceStart(Action.PhoenixResetWorkspace, {
|
||||||
|
dataExplorerArea: Areas.Notebook,
|
||||||
|
});
|
||||||
|
if (useNotebook.getState().isPhoenixNotebooks) {
|
||||||
|
useTabs.getState().closeAllNotebookTabs(true);
|
||||||
|
connectionStatus = {
|
||||||
|
status: ConnectionStatusType.Connecting,
|
||||||
|
};
|
||||||
|
useNotebook.getState().setConnectionInfo(connectionStatus);
|
||||||
|
}
|
||||||
|
const connectionInfo = await this.notebookManager?.notebookClient.resetWorkspace();
|
||||||
|
if (connectionInfo?.status !== HttpStatusCodes.OK) {
|
||||||
|
throw new Error(`Reset Workspace: Received status code- ${connectionInfo?.status}`);
|
||||||
|
}
|
||||||
|
if (!connectionInfo?.data?.phoenixServiceUrl) {
|
||||||
|
throw new Error(`Reset Workspace: PhoenixServiceUrl is invalid!`);
|
||||||
|
}
|
||||||
|
if (useNotebook.getState().isPhoenixNotebooks) {
|
||||||
|
await this.setNotebookInfo(true, connectionInfo, connectionStatus);
|
||||||
|
useNotebook.getState().setIsRefreshed(!useNotebook.getState().isRefreshed);
|
||||||
|
}
|
||||||
|
logConsoleInfo("Successfully reset notebook workspace");
|
||||||
|
TelemetryProcessor.traceSuccess(Action.PhoenixResetWorkspace, {
|
||||||
|
dataExplorerArea: Areas.Notebook,
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
logConsoleError(`Failed to reset notebook workspace: ${error}`);
|
||||||
|
TelemetryProcessor.traceFailure(Action.PhoenixResetWorkspace, {
|
||||||
|
dataExplorerArea: Areas.Notebook,
|
||||||
|
error: getErrorMessage(error),
|
||||||
|
errorStack: getErrorStack(error),
|
||||||
|
});
|
||||||
|
if (useNotebook.getState().isPhoenixNotebooks) {
|
||||||
|
connectionStatus = {
|
||||||
|
status: ConnectionStatusType.Failed,
|
||||||
|
};
|
||||||
|
useNotebook.getState().resetContainerConnection(connectionStatus);
|
||||||
|
useNotebook.getState().setIsRefreshed(!useNotebook.getState().isRefreshed);
|
||||||
|
}
|
||||||
|
throw error;
|
||||||
|
} finally {
|
||||||
|
clearInProgressMessage();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
private getDeltaDatabases(
|
private getDeltaDatabases(
|
||||||
updatedDatabaseList: DataModels.Database[],
|
updatedDatabaseList: DataModels.Database[],
|
||||||
databases: ViewModels.Database[],
|
databases: ViewModels.Database[],
|
||||||
@@ -902,6 +1002,92 @@ export default class Explorer {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This creates a new notebook file, then opens the notebook
|
||||||
|
*/
|
||||||
|
public async onNewNotebookClicked(parent?: NotebookContentItem, isGithubTree?: boolean): Promise<void> {
|
||||||
|
if (!useNotebook.getState().isNotebookEnabled || !this.notebookManager?.notebookContentClient) {
|
||||||
|
const error = "Attempt to create new notebook, but notebook is not enabled";
|
||||||
|
handleError(error, "Explorer/onNewNotebookClicked");
|
||||||
|
throw new Error(error);
|
||||||
|
}
|
||||||
|
if (useNotebook.getState().isPhoenixNotebooks) {
|
||||||
|
if (isGithubTree) {
|
||||||
|
await this.allocateContainer(PoolIdType.DefaultPoolId);
|
||||||
|
parent = parent || this.resourceTree.myNotebooksContentRoot;
|
||||||
|
this.createNewNoteBook(parent, isGithubTree);
|
||||||
|
} else {
|
||||||
|
useDialog.getState().showOkCancelModalDialog(
|
||||||
|
Notebook.newNotebookModalTitle,
|
||||||
|
undefined,
|
||||||
|
"Create",
|
||||||
|
async () => {
|
||||||
|
await this.allocateContainer(PoolIdType.DefaultPoolId);
|
||||||
|
parent = parent || this.resourceTree.myNotebooksContentRoot;
|
||||||
|
this.createNewNoteBook(parent, isGithubTree);
|
||||||
|
},
|
||||||
|
"Cancel",
|
||||||
|
undefined,
|
||||||
|
this.getNewNoteWarningText(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
parent = parent || this.resourceTree.myNotebooksContentRoot;
|
||||||
|
this.createNewNoteBook(parent, isGithubTree);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private getNewNoteWarningText(): JSX.Element {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<p>{Notebook.newNotebookModalContent1}</p>
|
||||||
|
<br />
|
||||||
|
<p>
|
||||||
|
{Notebook.newNotebookModalContent2}
|
||||||
|
<Link href={Notebook.cosmosNotebookHomePageUrl} target="_blank">
|
||||||
|
{Notebook.learnMore}
|
||||||
|
</Link>
|
||||||
|
</p>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
private createNewNoteBook(parent?: NotebookContentItem, isGithubTree?: boolean): void {
|
||||||
|
const clearInProgressMessage = logConsoleProgress(`Creating new notebook in ${parent.path}`);
|
||||||
|
const startKey: number = TelemetryProcessor.traceStart(Action.CreateNewNotebook, {
|
||||||
|
dataExplorerArea: Constants.Areas.Notebook,
|
||||||
|
});
|
||||||
|
|
||||||
|
this.notebookManager?.notebookContentClient
|
||||||
|
.createNewNotebookFile(parent, isGithubTree)
|
||||||
|
.then((newFile: NotebookContentItem) => {
|
||||||
|
logConsoleInfo(`Successfully created: ${newFile.name}`);
|
||||||
|
TelemetryProcessor.traceSuccess(
|
||||||
|
Action.CreateNewNotebook,
|
||||||
|
{
|
||||||
|
dataExplorerArea: Constants.Areas.Notebook,
|
||||||
|
},
|
||||||
|
startKey,
|
||||||
|
);
|
||||||
|
return this.openNotebook(newFile);
|
||||||
|
})
|
||||||
|
.then(() => this.resourceTree.triggerRender())
|
||||||
|
.catch((error) => {
|
||||||
|
const errorMessage = `Failed to create a new notebook: ${getErrorMessage(error)}`;
|
||||||
|
logConsoleError(errorMessage);
|
||||||
|
TelemetryProcessor.traceFailure(
|
||||||
|
Action.CreateNewNotebook,
|
||||||
|
{
|
||||||
|
dataExplorerArea: Constants.Areas.Notebook,
|
||||||
|
error: errorMessage,
|
||||||
|
errorStack: getErrorStack(error),
|
||||||
|
},
|
||||||
|
startKey,
|
||||||
|
);
|
||||||
|
})
|
||||||
|
.finally(clearInProgressMessage);
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: Delete this function when ResourceTreeAdapter is removed.
|
// TODO: Delete this function when ResourceTreeAdapter is removed.
|
||||||
public async refreshContentItem(item: NotebookContentItem): Promise<void> {
|
public async refreshContentItem(item: NotebookContentItem): Promise<void> {
|
||||||
if (!useNotebook.getState().isNotebookEnabled || !this.notebookManager?.notebookContentClient) {
|
if (!useNotebook.getState().isNotebookEnabled || !this.notebookManager?.notebookContentClient) {
|
||||||
@@ -936,6 +1122,10 @@ export default class Explorer {
|
|||||||
let title: string;
|
let title: string;
|
||||||
|
|
||||||
switch (kind) {
|
switch (kind) {
|
||||||
|
case ViewModels.TerminalKind.Default:
|
||||||
|
title = "Terminal";
|
||||||
|
break;
|
||||||
|
|
||||||
case ViewModels.TerminalKind.Mongo:
|
case ViewModels.TerminalKind.Mongo:
|
||||||
title = "Mongo Shell";
|
title = "Mongo Shell";
|
||||||
break;
|
break;
|
||||||
@@ -1089,6 +1279,36 @@ export default class Explorer {
|
|||||||
.openSidePanel("Input parameters", <ExecuteSprocParamsPane storedProcedure={storedProcedure} />);
|
.openSidePanel("Input parameters", <ExecuteSprocParamsPane storedProcedure={storedProcedure} />);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public openUploadFilePanel(parent?: NotebookContentItem): void {
|
||||||
|
if (useNotebook.getState().isPhoenixNotebooks) {
|
||||||
|
useDialog.getState().showOkCancelModalDialog(
|
||||||
|
Notebook.newNotebookUploadModalTitle,
|
||||||
|
undefined,
|
||||||
|
"Upload",
|
||||||
|
async () => {
|
||||||
|
await this.allocateContainer(PoolIdType.DefaultPoolId);
|
||||||
|
parent = parent || this.resourceTree.myNotebooksContentRoot;
|
||||||
|
this.uploadFilePanel(parent);
|
||||||
|
},
|
||||||
|
"Cancel",
|
||||||
|
undefined,
|
||||||
|
this.getNewNoteWarningText(),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
parent = parent || this.resourceTree.myNotebooksContentRoot;
|
||||||
|
this.uploadFilePanel(parent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private uploadFilePanel(parent?: NotebookContentItem): void {
|
||||||
|
useSidePanel
|
||||||
|
.getState()
|
||||||
|
.openSidePanel(
|
||||||
|
"Upload file to notebook server",
|
||||||
|
<UploadFilePane uploadFile={(name: string, content: string) => this.uploadFile(name, content, parent)} />,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
public getDownloadModalConent(fileName: string): JSX.Element {
|
public getDownloadModalConent(fileName: string): JSX.Element {
|
||||||
if (useNotebook.getState().isPhoenixNotebooks) {
|
if (useNotebook.getState().isPhoenixNotebooks) {
|
||||||
return (
|
return (
|
||||||
@@ -1157,10 +1377,10 @@ export default class Explorer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public async refreshSampleData(): Promise<void> {
|
public async refreshSampleData(): Promise<void> {
|
||||||
try {
|
|
||||||
if (!userContext.sampleDataConnectionInfo) {
|
if (!userContext.sampleDataConnectionInfo) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const collection: DataModels.Collection = await readSampleCollection();
|
const collection: DataModels.Collection = await readSampleCollection();
|
||||||
if (!collection) {
|
if (!collection) {
|
||||||
return;
|
return;
|
||||||
@@ -1173,9 +1393,5 @@ export default class Explorer {
|
|||||||
|
|
||||||
const sampleDataResourceTokenCollection = new ResourceTokenCollection(this, databaseId, collection, true);
|
const sampleDataResourceTokenCollection = new ResourceTokenCollection(this, databaseId, collection, true);
|
||||||
useDatabases.setState({ sampleDataResourceTokenCollection });
|
useDatabases.setState({ sampleDataResourceTokenCollection });
|
||||||
} catch (error) {
|
|
||||||
Logger.logError(getErrorMessage(error), "Explorer");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -162,7 +162,7 @@ export const addRootChildToGraph = (
|
|||||||
* @param value
|
* @param value
|
||||||
*/
|
*/
|
||||||
export const escapeDoubleQuotes = (value: string): string => {
|
export const escapeDoubleQuotes = (value: string): string => {
|
||||||
return value === undefined ? value : value.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
|
return value === undefined ? value : value.replace(/"/g, '\\"');
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -186,5 +186,5 @@ export const getQuotedPropValue = (ip: ViewModels.InputPropertyValue): string =>
|
|||||||
* @param value
|
* @param value
|
||||||
*/
|
*/
|
||||||
export const escapeSingleQuotes = (value: string): string => {
|
export const escapeSingleQuotes = (value: string): string => {
|
||||||
return value === undefined ? value : value.replace(/\\/g, "\\\\").replace(/'/g, "\\'");
|
return value === undefined ? value : value.replace(/'/g, "\\'");
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -349,7 +349,7 @@ export class NodePropertiesComponent extends React.Component<
|
|||||||
onActivated={this.setIsDeleteConfirm.bind(this, true)}
|
onActivated={this.setIsDeleteConfirm.bind(this, true)}
|
||||||
aria-label="Delete this vertex"
|
aria-label="Delete this vertex"
|
||||||
>
|
>
|
||||||
<img src={DeleteIcon} alt="Delete" role="button" />
|
<img src={DeleteIcon} alt="Delete" />
|
||||||
</AccessibleElement>
|
</AccessibleElement>
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
@@ -406,7 +406,7 @@ export class NodePropertiesComponent extends React.Component<
|
|||||||
aria-label="Edit properties"
|
aria-label="Edit properties"
|
||||||
onActivated={expandClickHandler}
|
onActivated={expandClickHandler}
|
||||||
>
|
>
|
||||||
<img src={EditIcon} alt="Edit" role="button" />
|
<img src={EditIcon} alt="Edit" />
|
||||||
</AccessibleElement>
|
</AccessibleElement>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
|||||||
@@ -184,18 +184,12 @@ export const NewVertexComponent: FunctionComponent<INewVertexComponentProps> = (
|
|||||||
className="rightPaneTrashIcon rightPaneBtns"
|
className="rightPaneTrashIcon rightPaneBtns"
|
||||||
tabIndex={0}
|
tabIndex={0}
|
||||||
role="button"
|
role="button"
|
||||||
aria-label={`Delete ${data.key}`}
|
|
||||||
onClick={(event: React.MouseEvent<HTMLDivElement>) => removeNewVertexProperty(event, index)}
|
onClick={(event: React.MouseEvent<HTMLDivElement>) => removeNewVertexProperty(event, index)}
|
||||||
onKeyPress={(event: React.KeyboardEvent<HTMLDivElement>) =>
|
onKeyPress={(event: React.KeyboardEvent<HTMLDivElement>) =>
|
||||||
removeNewVertexPropertyKeyPress(event, index)
|
removeNewVertexPropertyKeyPress(event, index)
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<img
|
<img className="refreshcol rightPaneTrashIconImg" src={DeleteIcon} alt="Remove property" />
|
||||||
aria-label="hidden"
|
|
||||||
className="refreshcol rightPaneTrashIconImg"
|
|
||||||
src={DeleteIcon}
|
|
||||||
alt="Remove property"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -5,7 +5,6 @@
|
|||||||
*/
|
*/
|
||||||
import { CommandBar as FluentCommandBar, ICommandBarItemProps } from "@fluentui/react";
|
import { CommandBar as FluentCommandBar, ICommandBarItemProps } from "@fluentui/react";
|
||||||
import { useNotebook } from "Explorer/Notebook/useNotebook";
|
import { useNotebook } from "Explorer/Notebook/useNotebook";
|
||||||
import { KeyboardActionGroup, useKeyboardActionGroup } from "KeyboardShortcuts";
|
|
||||||
import { userContext } from "UserContext";
|
import { userContext } from "UserContext";
|
||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
import create, { UseStore } from "zustand";
|
import create, { UseStore } from "zustand";
|
||||||
@@ -41,7 +40,6 @@ export const CommandBar: React.FC<Props> = ({ container }: Props) => {
|
|||||||
const buttons = useCommandBar((state) => state.contextButtons);
|
const buttons = useCommandBar((state) => state.contextButtons);
|
||||||
const isHidden = useCommandBar((state) => state.isHidden);
|
const isHidden = useCommandBar((state) => state.isHidden);
|
||||||
const backgroundColor = StyleConstants.BaseLight;
|
const backgroundColor = StyleConstants.BaseLight;
|
||||||
const setKeyboardHandlers = useKeyboardActionGroup(KeyboardActionGroup.COMMAND_BAR);
|
|
||||||
|
|
||||||
if (userContext.apiType === "Postgres" || userContext.apiType === "VCoreMongo") {
|
if (userContext.apiType === "Postgres" || userContext.apiType === "VCoreMongo") {
|
||||||
const buttons =
|
const buttons =
|
||||||
@@ -107,10 +105,6 @@ export const CommandBar: React.FC<Props> = ({ container }: Props) => {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const allButtons = staticButtons.concat(contextButtons).concat(controlButtons);
|
|
||||||
const keyboardHandlers = CommandBarUtil.createKeyboardHandlers(allButtons);
|
|
||||||
setKeyboardHandlers(keyboardHandlers);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="commandBarContainer" style={{ display: isHidden ? "none" : "initial" }}>
|
<div className="commandBarContainer" style={{ display: isHidden ? "none" : "initial" }}>
|
||||||
<FluentCommandBar
|
<FluentCommandBar
|
||||||
|
|||||||
@@ -2,8 +2,10 @@ import * as ko from "knockout";
|
|||||||
import { AuthType } from "../../../AuthType";
|
import { AuthType } from "../../../AuthType";
|
||||||
import { DatabaseAccount } from "../../../Contracts/DataModels";
|
import { DatabaseAccount } from "../../../Contracts/DataModels";
|
||||||
import { CollectionBase } from "../../../Contracts/ViewModels";
|
import { CollectionBase } from "../../../Contracts/ViewModels";
|
||||||
|
import { GitHubOAuthService } from "../../../GitHub/GitHubOAuthService";
|
||||||
import { updateUserContext } from "../../../UserContext";
|
import { updateUserContext } from "../../../UserContext";
|
||||||
import Explorer from "../../Explorer";
|
import Explorer from "../../Explorer";
|
||||||
|
import NotebookManager from "../../Notebook/NotebookManager";
|
||||||
import { useNotebook } from "../../Notebook/useNotebook";
|
import { useNotebook } from "../../Notebook/useNotebook";
|
||||||
import { useDatabases } from "../../useDatabases";
|
import { useDatabases } from "../../useDatabases";
|
||||||
import { useSelectedNode } from "../../useSelectedNode";
|
import { useSelectedNode } from "../../useSelectedNode";
|
||||||
@@ -70,6 +72,181 @@ describe("CommandBarComponentButtonFactory tests", () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe("Enable notebook button", () => {
|
||||||
|
const enableNotebookBtnLabel = "Enable Notebooks (Preview)";
|
||||||
|
const selectedNodeState = useSelectedNode.getState();
|
||||||
|
|
||||||
|
beforeAll(() => {
|
||||||
|
mockExplorer = {} as Explorer;
|
||||||
|
updateUserContext({
|
||||||
|
portalEnv: "prod",
|
||||||
|
databaseAccount: {
|
||||||
|
properties: {
|
||||||
|
capabilities: [{ name: "EnableTable" }],
|
||||||
|
},
|
||||||
|
} as DatabaseAccount,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
updateUserContext({
|
||||||
|
portalEnv: "prod",
|
||||||
|
});
|
||||||
|
useNotebook.getState().setIsNotebookEnabled(false);
|
||||||
|
useNotebook.getState().setIsNotebooksEnabledForAccount(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Notebooks is already enabled - button should be hidden", () => {
|
||||||
|
useNotebook.getState().setIsNotebookEnabled(true);
|
||||||
|
useNotebook.getState().setIsNotebooksEnabledForAccount(true);
|
||||||
|
|
||||||
|
const buttons = CommandBarComponentButtonFactory.createStaticCommandBarButtons(mockExplorer, selectedNodeState);
|
||||||
|
const enableNotebookBtn = buttons.find((button) => button.commandButtonLabel === enableNotebookBtnLabel);
|
||||||
|
expect(enableNotebookBtn).toBeUndefined();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Account is running on one of the national clouds - button should be hidden", () => {
|
||||||
|
updateUserContext({
|
||||||
|
portalEnv: "mooncake",
|
||||||
|
});
|
||||||
|
|
||||||
|
const buttons = CommandBarComponentButtonFactory.createStaticCommandBarButtons(mockExplorer, selectedNodeState);
|
||||||
|
const enableNotebookBtn = buttons.find((button) => button.commandButtonLabel === enableNotebookBtnLabel);
|
||||||
|
expect(enableNotebookBtn).toBeUndefined();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Notebooks is not enabled but is available - button should be shown and enabled", () => {
|
||||||
|
useNotebook.getState().setIsNotebooksEnabledForAccount(true);
|
||||||
|
|
||||||
|
const buttons = CommandBarComponentButtonFactory.createStaticCommandBarButtons(mockExplorer, selectedNodeState);
|
||||||
|
const enableNotebookBtn = buttons.find((button) => button.commandButtonLabel === enableNotebookBtnLabel);
|
||||||
|
|
||||||
|
//TODO: modify once notebooks are available
|
||||||
|
expect(enableNotebookBtn).toBeUndefined();
|
||||||
|
//expect(enableNotebookBtn).toBeDefined();
|
||||||
|
//expect(enableNotebookBtn.disabled).toBe(false);
|
||||||
|
//expect(enableNotebookBtn.tooltipText).toBe("");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Notebooks is not enabled and is unavailable - button should be shown and disabled", () => {
|
||||||
|
const buttons = CommandBarComponentButtonFactory.createStaticCommandBarButtons(mockExplorer, selectedNodeState);
|
||||||
|
const enableNotebookBtn = buttons.find((button) => button.commandButtonLabel === enableNotebookBtnLabel);
|
||||||
|
|
||||||
|
//TODO: modify once notebooks are available
|
||||||
|
expect(enableNotebookBtn).toBeUndefined();
|
||||||
|
//expect(enableNotebookBtn).toBeDefined();
|
||||||
|
//expect(enableNotebookBtn.disabled).toBe(true);
|
||||||
|
//expect(enableNotebookBtn.tooltipText).toBe(
|
||||||
|
// "Notebooks are not yet available in your account's region. View supported regions here: https://aka.ms/cosmos-enable-notebooks."
|
||||||
|
//);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("Open Mongo shell button", () => {
|
||||||
|
const openMongoShellBtnLabel = "Open Mongo shell";
|
||||||
|
const selectedNodeState = useSelectedNode.getState();
|
||||||
|
|
||||||
|
beforeAll(() => {
|
||||||
|
mockExplorer = {} as Explorer;
|
||||||
|
updateUserContext({
|
||||||
|
databaseAccount: {
|
||||||
|
properties: {
|
||||||
|
capabilities: [{ name: "EnableTable" }],
|
||||||
|
},
|
||||||
|
} as DatabaseAccount,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
afterAll(() => {
|
||||||
|
updateUserContext({
|
||||||
|
apiType: "SQL",
|
||||||
|
});
|
||||||
|
useNotebook.getState().setIsShellEnabled(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
updateUserContext({
|
||||||
|
apiType: "Mongo",
|
||||||
|
});
|
||||||
|
useNotebook.getState().setIsShellEnabled(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
useNotebook.getState().setIsNotebookEnabled(false);
|
||||||
|
useNotebook.getState().setIsNotebooksEnabledForAccount(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Mongo Api not available - button should be hidden", () => {
|
||||||
|
updateUserContext({
|
||||||
|
apiType: "SQL",
|
||||||
|
});
|
||||||
|
const buttons = CommandBarComponentButtonFactory.createStaticCommandBarButtons(mockExplorer, selectedNodeState);
|
||||||
|
const openMongoShellBtn = buttons.find((button) => button.commandButtonLabel === openMongoShellBtnLabel);
|
||||||
|
expect(openMongoShellBtn).toBeUndefined();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Running on a national cloud - button should be hidden", () => {
|
||||||
|
updateUserContext({
|
||||||
|
portalEnv: "mooncake",
|
||||||
|
});
|
||||||
|
|
||||||
|
const buttons = CommandBarComponentButtonFactory.createStaticCommandBarButtons(mockExplorer, selectedNodeState);
|
||||||
|
const openMongoShellBtn = buttons.find((button) => button.commandButtonLabel === openMongoShellBtnLabel);
|
||||||
|
expect(openMongoShellBtn).toBeUndefined();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Notebooks is not enabled and is unavailable - button should be hidden", () => {
|
||||||
|
const buttons = CommandBarComponentButtonFactory.createStaticCommandBarButtons(mockExplorer, selectedNodeState);
|
||||||
|
const openMongoShellBtn = buttons.find((button) => button.commandButtonLabel === openMongoShellBtnLabel);
|
||||||
|
expect(openMongoShellBtn).toBeUndefined();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Notebooks is not enabled and is available - button should be hidden", () => {
|
||||||
|
useNotebook.getState().setIsNotebooksEnabledForAccount(true);
|
||||||
|
|
||||||
|
const buttons = CommandBarComponentButtonFactory.createStaticCommandBarButtons(mockExplorer, selectedNodeState);
|
||||||
|
const openMongoShellBtn = buttons.find((button) => button.commandButtonLabel === openMongoShellBtnLabel);
|
||||||
|
expect(openMongoShellBtn).toBeUndefined();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Notebooks is enabled and is unavailable - button should be shown and enabled", () => {
|
||||||
|
useNotebook.getState().setIsNotebookEnabled(true);
|
||||||
|
|
||||||
|
const buttons = CommandBarComponentButtonFactory.createStaticCommandBarButtons(mockExplorer, selectedNodeState);
|
||||||
|
const openMongoShellBtn = buttons.find((button) => button.commandButtonLabel === openMongoShellBtnLabel);
|
||||||
|
expect(openMongoShellBtn).toBeDefined();
|
||||||
|
|
||||||
|
//TODO: modify once notebooks are available
|
||||||
|
expect(openMongoShellBtn.disabled).toBe(true);
|
||||||
|
//expect(openMongoShellBtn.disabled).toBe(false);
|
||||||
|
//expect(openMongoShellBtn.tooltipText).toBe("");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Notebooks is enabled and is available - button should be shown and enabled", () => {
|
||||||
|
useNotebook.getState().setIsNotebookEnabled(true);
|
||||||
|
useNotebook.getState().setIsNotebooksEnabledForAccount(true);
|
||||||
|
|
||||||
|
const buttons = CommandBarComponentButtonFactory.createStaticCommandBarButtons(mockExplorer, selectedNodeState);
|
||||||
|
const openMongoShellBtn = buttons.find((button) => button.commandButtonLabel === openMongoShellBtnLabel);
|
||||||
|
expect(openMongoShellBtn).toBeDefined();
|
||||||
|
|
||||||
|
//TODO: modify once notebooks are available
|
||||||
|
expect(openMongoShellBtn.disabled).toBe(true);
|
||||||
|
//expect(openMongoShellBtn.disabled).toBe(false);
|
||||||
|
//expect(openMongoShellBtn.tooltipText).toBe("");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Notebooks is enabled and is available, terminal is unavailable due to ipRules - button should be hidden", () => {
|
||||||
|
useNotebook.getState().setIsNotebookEnabled(true);
|
||||||
|
useNotebook.getState().setIsNotebooksEnabledForAccount(true);
|
||||||
|
useNotebook.getState().setIsShellEnabled(false);
|
||||||
|
|
||||||
|
const buttons = CommandBarComponentButtonFactory.createStaticCommandBarButtons(mockExplorer, selectedNodeState);
|
||||||
|
const openMongoShellBtn = buttons.find((button) => button.commandButtonLabel === openMongoShellBtnLabel);
|
||||||
|
expect(openMongoShellBtn).toBeUndefined();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe("Open Cassandra shell button", () => {
|
describe("Open Cassandra shell button", () => {
|
||||||
const openCassandraShellBtnLabel = "Open Cassandra shell";
|
const openCassandraShellBtnLabel = "Open Cassandra shell";
|
||||||
const selectedNodeState = useSelectedNode.getState();
|
const selectedNodeState = useSelectedNode.getState();
|
||||||
@@ -128,6 +305,42 @@ describe("CommandBarComponentButtonFactory tests", () => {
|
|||||||
const openCassandraShellBtn = buttons.find((button) => button.commandButtonLabel === openCassandraShellBtnLabel);
|
const openCassandraShellBtn = buttons.find((button) => button.commandButtonLabel === openCassandraShellBtnLabel);
|
||||||
expect(openCassandraShellBtn).toBeUndefined();
|
expect(openCassandraShellBtn).toBeUndefined();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("Notebooks is not enabled and is available - button should be shown and enabled", () => {
|
||||||
|
useNotebook.getState().setIsNotebooksEnabledForAccount(true);
|
||||||
|
|
||||||
|
const buttons = CommandBarComponentButtonFactory.createStaticCommandBarButtons(mockExplorer, selectedNodeState);
|
||||||
|
const openCassandraShellBtn = buttons.find((button) => button.commandButtonLabel === openCassandraShellBtnLabel);
|
||||||
|
expect(openCassandraShellBtn).toBeUndefined();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Notebooks is enabled and is unavailable - button should be shown and enabled", () => {
|
||||||
|
useNotebook.getState().setIsNotebookEnabled(true);
|
||||||
|
|
||||||
|
const buttons = CommandBarComponentButtonFactory.createStaticCommandBarButtons(mockExplorer, selectedNodeState);
|
||||||
|
const openCassandraShellBtn = buttons.find((button) => button.commandButtonLabel === openCassandraShellBtnLabel);
|
||||||
|
|
||||||
|
expect(openCassandraShellBtn).toBeDefined();
|
||||||
|
|
||||||
|
//TODO: modify once notebooks are available
|
||||||
|
expect(openCassandraShellBtn.disabled).toBe(true);
|
||||||
|
//expect(openCassandraShellBtn.disabled).toBe(false);
|
||||||
|
//expect(openCassandraShellBtn.tooltipText).toBe("");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Notebooks is enabled and is available - button should be shown and enabled", () => {
|
||||||
|
useNotebook.getState().setIsNotebookEnabled(true);
|
||||||
|
useNotebook.getState().setIsNotebooksEnabledForAccount(true);
|
||||||
|
|
||||||
|
const buttons = CommandBarComponentButtonFactory.createStaticCommandBarButtons(mockExplorer, selectedNodeState);
|
||||||
|
const openCassandraShellBtn = buttons.find((button) => button.commandButtonLabel === openCassandraShellBtnLabel);
|
||||||
|
expect(openCassandraShellBtn).toBeDefined();
|
||||||
|
|
||||||
|
//TODO: modify once notebooks are available
|
||||||
|
expect(openCassandraShellBtn.disabled).toBe(true);
|
||||||
|
//expect(openCassandraShellBtn.disabled).toBe(false);
|
||||||
|
//expect(openCassandraShellBtn.tooltipText).toBe("");
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("Open Postgres and vCore Mongo buttons", () => {
|
describe("Open Postgres and vCore Mongo buttons", () => {
|
||||||
@@ -155,6 +368,62 @@ describe("CommandBarComponentButtonFactory tests", () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe("GitHub buttons", () => {
|
||||||
|
const connectToGitHubBtnLabel = "Connect to GitHub";
|
||||||
|
const manageGitHubSettingsBtnLabel = "Manage GitHub settings";
|
||||||
|
const selectedNodeState = useSelectedNode.getState();
|
||||||
|
|
||||||
|
beforeAll(() => {
|
||||||
|
mockExplorer = {} as Explorer;
|
||||||
|
updateUserContext({
|
||||||
|
databaseAccount: {
|
||||||
|
properties: {
|
||||||
|
capabilities: [{ name: "EnableTable" }],
|
||||||
|
},
|
||||||
|
} as DatabaseAccount,
|
||||||
|
});
|
||||||
|
|
||||||
|
mockExplorer.notebookManager = new NotebookManager();
|
||||||
|
mockExplorer.notebookManager.gitHubOAuthService = new GitHubOAuthService(undefined);
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
jest.resetAllMocks();
|
||||||
|
useNotebook.getState().setIsNotebookEnabled(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Notebooks is enabled and GitHubOAuthService is not logged in - connect to github button should be visible", () => {
|
||||||
|
useNotebook.getState().setIsNotebookEnabled(true);
|
||||||
|
|
||||||
|
const buttons = CommandBarComponentButtonFactory.createStaticCommandBarButtons(mockExplorer, selectedNodeState);
|
||||||
|
const connectToGitHubBtn = buttons.find((button) => button.commandButtonLabel === connectToGitHubBtnLabel);
|
||||||
|
expect(connectToGitHubBtn).toBeDefined();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Notebooks is enabled and GitHubOAuthService is logged in - manage github settings button should be visible", () => {
|
||||||
|
useNotebook.getState().setIsNotebookEnabled(true);
|
||||||
|
mockExplorer.notebookManager.gitHubOAuthService.isLoggedIn = jest.fn().mockReturnValue(true);
|
||||||
|
|
||||||
|
const buttons = CommandBarComponentButtonFactory.createStaticCommandBarButtons(mockExplorer, selectedNodeState);
|
||||||
|
const manageGitHubSettingsBtn = buttons.find(
|
||||||
|
(button) => button.commandButtonLabel === manageGitHubSettingsBtnLabel,
|
||||||
|
);
|
||||||
|
expect(manageGitHubSettingsBtn).toBeDefined();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Notebooks is not enabled - connect to github and manage github settings buttons should be hidden", () => {
|
||||||
|
const buttons = CommandBarComponentButtonFactory.createStaticCommandBarButtons(mockExplorer, selectedNodeState);
|
||||||
|
|
||||||
|
const connectToGitHubBtn = buttons.find((button) => button.commandButtonLabel === connectToGitHubBtnLabel);
|
||||||
|
expect(connectToGitHubBtn).toBeUndefined();
|
||||||
|
|
||||||
|
const manageGitHubSettingsBtn = buttons.find(
|
||||||
|
(button) => button.commandButtonLabel === manageGitHubSettingsBtnLabel,
|
||||||
|
);
|
||||||
|
expect(manageGitHubSettingsBtn).toBeUndefined();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe("Resource token", () => {
|
describe("Resource token", () => {
|
||||||
const mockCollection = { id: ko.observable("test") } as CollectionBase;
|
const mockCollection = { id: ko.observable("test") } as CollectionBase;
|
||||||
useSelectedNode.getState().setSelectedNode(mockCollection);
|
useSelectedNode.getState().setSelectedNode(mockCollection);
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
import { KeyboardAction } from "KeyboardShortcuts";
|
|
||||||
import { ReactTabKind, useTabs } from "hooks/useTabs";
|
|
||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
import AddCollectionIcon from "../../../../images/AddCollection.svg";
|
import AddCollectionIcon from "../../../../images/AddCollection.svg";
|
||||||
import AddDatabaseIcon from "../../../../images/AddDatabase.svg";
|
import AddDatabaseIcon from "../../../../images/AddDatabase.svg";
|
||||||
@@ -8,10 +6,13 @@ import AddStoredProcedureIcon from "../../../../images/AddStoredProcedure.svg";
|
|||||||
import AddTriggerIcon from "../../../../images/AddTrigger.svg";
|
import AddTriggerIcon from "../../../../images/AddTrigger.svg";
|
||||||
import AddUdfIcon from "../../../../images/AddUdf.svg";
|
import AddUdfIcon from "../../../../images/AddUdf.svg";
|
||||||
import BrowseQueriesIcon from "../../../../images/BrowseQuery.svg";
|
import BrowseQueriesIcon from "../../../../images/BrowseQuery.svg";
|
||||||
|
import CosmosTerminalIcon from "../../../../images/Cosmos-Terminal.svg";
|
||||||
import FeedbackIcon from "../../../../images/Feedback-Command.svg";
|
import FeedbackIcon from "../../../../images/Feedback-Command.svg";
|
||||||
import HomeIcon from "../../../../images/Home_16.svg";
|
|
||||||
import HostedTerminalIcon from "../../../../images/Hosted-Terminal.svg";
|
import HostedTerminalIcon from "../../../../images/Hosted-Terminal.svg";
|
||||||
import OpenQueryFromDiskIcon from "../../../../images/OpenQueryFromDisk.svg";
|
import OpenQueryFromDiskIcon from "../../../../images/OpenQueryFromDisk.svg";
|
||||||
|
import GitHubIcon from "../../../../images/github.svg";
|
||||||
|
import NewNotebookIcon from "../../../../images/notebook/Notebook-new.svg";
|
||||||
|
import ResetWorkspaceIcon from "../../../../images/notebook/Notebook-reset-workspace.svg";
|
||||||
import OpenInTabIcon from "../../../../images/open-in-tab.svg";
|
import OpenInTabIcon from "../../../../images/open-in-tab.svg";
|
||||||
import SettingsIcon from "../../../../images/settings_15x15.svg";
|
import SettingsIcon from "../../../../images/settings_15x15.svg";
|
||||||
import SynapseIcon from "../../../../images/synapse-link.svg";
|
import SynapseIcon from "../../../../images/synapse-link.svg";
|
||||||
@@ -19,6 +20,7 @@ import { AuthType } from "../../../AuthType";
|
|||||||
import * as Constants from "../../../Common/Constants";
|
import * as Constants from "../../../Common/Constants";
|
||||||
import { Platform, configContext } from "../../../ConfigContext";
|
import { Platform, configContext } from "../../../ConfigContext";
|
||||||
import * as ViewModels from "../../../Contracts/ViewModels";
|
import * as ViewModels from "../../../Contracts/ViewModels";
|
||||||
|
import { JunoClient } from "../../../Juno/JunoClient";
|
||||||
import { userContext } from "../../../UserContext";
|
import { userContext } from "../../../UserContext";
|
||||||
import { getCollectionName, getDatabaseName } from "../../../Utils/APITypeUtils";
|
import { getCollectionName, getDatabaseName } from "../../../Utils/APITypeUtils";
|
||||||
import { isRunningOnNationalCloud } from "../../../Utils/CloudUtils";
|
import { isRunningOnNationalCloud } from "../../../Utils/CloudUtils";
|
||||||
@@ -29,6 +31,7 @@ import { useNotebook } from "../../Notebook/useNotebook";
|
|||||||
import { OpenFullScreen } from "../../OpenFullScreen";
|
import { OpenFullScreen } from "../../OpenFullScreen";
|
||||||
import { AddDatabasePanel } from "../../Panes/AddDatabasePanel/AddDatabasePanel";
|
import { AddDatabasePanel } from "../../Panes/AddDatabasePanel/AddDatabasePanel";
|
||||||
import { BrowseQueriesPane } from "../../Panes/BrowseQueriesPane/BrowseQueriesPane";
|
import { BrowseQueriesPane } from "../../Panes/BrowseQueriesPane/BrowseQueriesPane";
|
||||||
|
import { GitHubReposPanel } from "../../Panes/GitHubReposPanel/GitHubReposPanel";
|
||||||
import { LoadQueryPane } from "../../Panes/LoadQueryPane/LoadQueryPane";
|
import { LoadQueryPane } from "../../Panes/LoadQueryPane/LoadQueryPane";
|
||||||
import { SettingsPane } from "../../Panes/SettingsPane/SettingsPane";
|
import { SettingsPane } from "../../Panes/SettingsPane/SettingsPane";
|
||||||
import { useDatabases } from "../../useDatabases";
|
import { useDatabases } from "../../useDatabases";
|
||||||
@@ -54,11 +57,7 @@ export function createStaticCommandBarButtons(
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (configContext.platform !== Platform.Fabric) {
|
if (configContext.platform !== Platform.Fabric) {
|
||||||
const homeBtn = createHomeButton();
|
|
||||||
buttons.push(homeBtn);
|
|
||||||
|
|
||||||
const newCollectionBtn = createNewCollectionGroup(container);
|
const newCollectionBtn = createNewCollectionGroup(container);
|
||||||
newCollectionBtn.keyboardAction = KeyboardAction.NEW_COLLECTION; // Just for the root button, not the child version we create below.
|
|
||||||
buttons.push(newCollectionBtn);
|
buttons.push(newCollectionBtn);
|
||||||
if (userContext.apiType !== "Tables" && userContext.apiType !== "Cassandra") {
|
if (userContext.apiType !== "Tables" && userContext.apiType !== "Cassandra") {
|
||||||
const addSynapseLink = createOpenSynapseLinkDialogButton(container);
|
const addSynapseLink = createOpenSynapseLinkDialogButton(container);
|
||||||
@@ -76,6 +75,57 @@ export function createStaticCommandBarButtons(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (useNotebook.getState().isNotebookEnabled) {
|
||||||
|
addDivider();
|
||||||
|
const notebookButtons: CommandButtonComponentProps[] = [];
|
||||||
|
|
||||||
|
const newNotebookButton = createNewNotebookButton(container);
|
||||||
|
newNotebookButton.children = [createNewNotebookButton(container), createuploadNotebookButton(container)];
|
||||||
|
notebookButtons.push(newNotebookButton);
|
||||||
|
|
||||||
|
if (container.notebookManager?.gitHubOAuthService) {
|
||||||
|
notebookButtons.push(createManageGitHubAccountButton(container));
|
||||||
|
}
|
||||||
|
if (useNotebook.getState().isPhoenixFeatures && configContext.isTerminalEnabled) {
|
||||||
|
notebookButtons.push(createOpenTerminalButton(container));
|
||||||
|
}
|
||||||
|
if (useNotebook.getState().isPhoenixNotebooks && selectedNodeState.isConnectedToContainer()) {
|
||||||
|
notebookButtons.push(createNotebookWorkspaceResetButton(container));
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
(userContext.apiType === "Mongo" &&
|
||||||
|
useNotebook.getState().isShellEnabled &&
|
||||||
|
selectedNodeState.isDatabaseNodeOrNoneSelected()) ||
|
||||||
|
userContext.apiType === "Cassandra"
|
||||||
|
) {
|
||||||
|
notebookButtons.push(createDivider());
|
||||||
|
if (userContext.apiType === "Cassandra") {
|
||||||
|
notebookButtons.push(createOpenTerminalButtonByKind(container, ViewModels.TerminalKind.Cassandra));
|
||||||
|
} else {
|
||||||
|
notebookButtons.push(createOpenTerminalButtonByKind(container, ViewModels.TerminalKind.Mongo));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
notebookButtons.forEach((btn) => {
|
||||||
|
if (btn.commandButtonLabel.indexOf("Cassandra") !== -1) {
|
||||||
|
if (!useNotebook.getState().isPhoenixFeatures) {
|
||||||
|
applyNotebooksTemporarilyDownStyle(btn, Constants.Notebook.cassandraShellTemporarilyDownMsg);
|
||||||
|
}
|
||||||
|
} else if (btn.commandButtonLabel.indexOf("Mongo") !== -1) {
|
||||||
|
if (!useNotebook.getState().isPhoenixFeatures) {
|
||||||
|
applyNotebooksTemporarilyDownStyle(btn, Constants.Notebook.mongoShellTemporarilyDownMsg);
|
||||||
|
}
|
||||||
|
} else if (btn.commandButtonLabel.indexOf("Open Terminal") !== -1) {
|
||||||
|
if (!useNotebook.getState().isPhoenixFeatures) {
|
||||||
|
applyNotebooksTemporarilyDownStyle(btn, Constants.Notebook.temporarilyDownMsg);
|
||||||
|
}
|
||||||
|
} else if (!useNotebook.getState().isPhoenixNotebooks) {
|
||||||
|
applyNotebooksTemporarilyDownStyle(btn, Constants.Notebook.temporarilyDownMsg);
|
||||||
|
}
|
||||||
|
buttons.push(btn);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (!selectedNodeState.isDatabaseNodeOrNoneSelected()) {
|
if (!selectedNodeState.isDatabaseNodeOrNoneSelected()) {
|
||||||
const isQuerySupported = userContext.apiType === "SQL" || userContext.apiType === "Gremlin";
|
const isQuerySupported = userContext.apiType === "SQL" || userContext.apiType === "Gremlin";
|
||||||
|
|
||||||
@@ -96,7 +146,6 @@ export function createStaticCommandBarButtons(
|
|||||||
const newStoredProcedureBtn: CommandButtonComponentProps = {
|
const newStoredProcedureBtn: CommandButtonComponentProps = {
|
||||||
iconSrc: AddStoredProcedureIcon,
|
iconSrc: AddStoredProcedureIcon,
|
||||||
iconAlt: label,
|
iconAlt: label,
|
||||||
keyboardAction: KeyboardAction.NEW_SPROC,
|
|
||||||
onCommandClick: () => {
|
onCommandClick: () => {
|
||||||
const selectedCollection: ViewModels.Collection = selectedNodeState.findSelectedCollection();
|
const selectedCollection: ViewModels.Collection = selectedNodeState.findSelectedCollection();
|
||||||
selectedCollection && selectedCollection.onNewStoredProcedureClick(selectedCollection);
|
selectedCollection && selectedCollection.onNewStoredProcedureClick(selectedCollection);
|
||||||
@@ -186,12 +235,12 @@ export function createControlCommandBarButtons(container: Explorer): CommandButt
|
|||||||
buttons.push(fullScreenButton);
|
buttons.push(fullScreenButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (configContext.platform === Platform.Portal) {
|
if (configContext.platform !== Platform.Emulator) {
|
||||||
const label = "Feedback";
|
const label = "Feedback";
|
||||||
const feedbackButtonOptions: CommandButtonComponentProps = {
|
const feedbackButtonOptions: CommandButtonComponentProps = {
|
||||||
iconSrc: FeedbackIcon,
|
iconSrc: FeedbackIcon,
|
||||||
iconAlt: label,
|
iconAlt: label,
|
||||||
onCommandClick: () => container.openCESCVAFeedbackBlade(),
|
onCommandClick: () => container.provideFeedbackEmail(),
|
||||||
commandButtonLabel: undefined,
|
commandButtonLabel: undefined,
|
||||||
ariaLabel: label,
|
ariaLabel: label,
|
||||||
tooltipText: label,
|
tooltipText: label,
|
||||||
@@ -236,18 +285,6 @@ function createNewCollectionGroup(container: Explorer): CommandButtonComponentPr
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function createHomeButton(): CommandButtonComponentProps {
|
|
||||||
const label = "Home";
|
|
||||||
return {
|
|
||||||
iconSrc: HomeIcon,
|
|
||||||
iconAlt: label,
|
|
||||||
onCommandClick: () => useTabs.getState().openAndActivateReactTab(ReactTabKind.Home),
|
|
||||||
commandButtonLabel: label,
|
|
||||||
hasPopup: false,
|
|
||||||
ariaLabel: label,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function createOpenSynapseLinkDialogButton(container: Explorer): CommandButtonComponentProps {
|
function createOpenSynapseLinkDialogButton(container: Explorer): CommandButtonComponentProps {
|
||||||
if (configContext.platform === Platform.Emulator) {
|
if (configContext.platform === Platform.Emulator) {
|
||||||
return undefined;
|
return undefined;
|
||||||
@@ -280,7 +317,6 @@ function createNewDatabase(container: Explorer): CommandButtonComponentProps {
|
|||||||
return {
|
return {
|
||||||
iconSrc: AddDatabaseIcon,
|
iconSrc: AddDatabaseIcon,
|
||||||
iconAlt: label,
|
iconAlt: label,
|
||||||
keyboardAction: KeyboardAction.NEW_DATABASE,
|
|
||||||
onCommandClick: async () => {
|
onCommandClick: async () => {
|
||||||
const throughputCap = userContext.databaseAccount?.properties.capacity?.totalThroughputLimit;
|
const throughputCap = userContext.databaseAccount?.properties.capacity?.totalThroughputLimit;
|
||||||
if (throughputCap && throughputCap !== -1) {
|
if (throughputCap && throughputCap !== -1) {
|
||||||
@@ -301,7 +337,6 @@ function createNewSQLQueryButton(selectedNodeState: SelectedNodeState): CommandB
|
|||||||
id: "newQueryBtn",
|
id: "newQueryBtn",
|
||||||
iconSrc: AddSqlQueryIcon,
|
iconSrc: AddSqlQueryIcon,
|
||||||
iconAlt: label,
|
iconAlt: label,
|
||||||
keyboardAction: KeyboardAction.NEW_QUERY,
|
|
||||||
onCommandClick: () => {
|
onCommandClick: () => {
|
||||||
const selectedCollection: ViewModels.Collection = selectedNodeState.findSelectedCollection();
|
const selectedCollection: ViewModels.Collection = selectedNodeState.findSelectedCollection();
|
||||||
selectedCollection && selectedCollection.onNewQueryClick(selectedCollection);
|
selectedCollection && selectedCollection.onNewQueryClick(selectedCollection);
|
||||||
@@ -317,7 +352,6 @@ function createNewSQLQueryButton(selectedNodeState: SelectedNodeState): CommandB
|
|||||||
id: "newQueryBtn",
|
id: "newQueryBtn",
|
||||||
iconSrc: AddSqlQueryIcon,
|
iconSrc: AddSqlQueryIcon,
|
||||||
iconAlt: label,
|
iconAlt: label,
|
||||||
keyboardAction: KeyboardAction.NEW_QUERY,
|
|
||||||
onCommandClick: () => {
|
onCommandClick: () => {
|
||||||
const selectedCollection: ViewModels.Collection = selectedNodeState.findSelectedCollection();
|
const selectedCollection: ViewModels.Collection = selectedNodeState.findSelectedCollection();
|
||||||
selectedCollection && selectedCollection.onNewMongoQueryClick(selectedCollection);
|
selectedCollection && selectedCollection.onNewMongoQueryClick(selectedCollection);
|
||||||
@@ -343,7 +377,6 @@ export function createScriptCommandButtons(selectedNodeState: SelectedNodeState)
|
|||||||
const newStoredProcedureBtn: CommandButtonComponentProps = {
|
const newStoredProcedureBtn: CommandButtonComponentProps = {
|
||||||
iconSrc: AddStoredProcedureIcon,
|
iconSrc: AddStoredProcedureIcon,
|
||||||
iconAlt: label,
|
iconAlt: label,
|
||||||
keyboardAction: KeyboardAction.NEW_SPROC,
|
|
||||||
onCommandClick: () => {
|
onCommandClick: () => {
|
||||||
const selectedCollection: ViewModels.Collection = selectedNodeState.findSelectedCollection();
|
const selectedCollection: ViewModels.Collection = selectedNodeState.findSelectedCollection();
|
||||||
selectedCollection && selectedCollection.onNewStoredProcedureClick(selectedCollection);
|
selectedCollection && selectedCollection.onNewStoredProcedureClick(selectedCollection);
|
||||||
@@ -363,7 +396,6 @@ export function createScriptCommandButtons(selectedNodeState: SelectedNodeState)
|
|||||||
const newUserDefinedFunctionBtn: CommandButtonComponentProps = {
|
const newUserDefinedFunctionBtn: CommandButtonComponentProps = {
|
||||||
iconSrc: AddUdfIcon,
|
iconSrc: AddUdfIcon,
|
||||||
iconAlt: label,
|
iconAlt: label,
|
||||||
keyboardAction: KeyboardAction.NEW_UDF,
|
|
||||||
onCommandClick: () => {
|
onCommandClick: () => {
|
||||||
const selectedCollection: ViewModels.Collection = selectedNodeState.findSelectedCollection();
|
const selectedCollection: ViewModels.Collection = selectedNodeState.findSelectedCollection();
|
||||||
selectedCollection && selectedCollection.onNewUserDefinedFunctionClick(selectedCollection);
|
selectedCollection && selectedCollection.onNewUserDefinedFunctionClick(selectedCollection);
|
||||||
@@ -383,7 +415,6 @@ export function createScriptCommandButtons(selectedNodeState: SelectedNodeState)
|
|||||||
const newTriggerBtn: CommandButtonComponentProps = {
|
const newTriggerBtn: CommandButtonComponentProps = {
|
||||||
iconSrc: AddTriggerIcon,
|
iconSrc: AddTriggerIcon,
|
||||||
iconAlt: label,
|
iconAlt: label,
|
||||||
keyboardAction: KeyboardAction.NEW_TRIGGER,
|
|
||||||
onCommandClick: () => {
|
onCommandClick: () => {
|
||||||
const selectedCollection: ViewModels.Collection = selectedNodeState.findSelectedCollection();
|
const selectedCollection: ViewModels.Collection = selectedNodeState.findSelectedCollection();
|
||||||
selectedCollection && selectedCollection.onNewTriggerClick(selectedCollection);
|
selectedCollection && selectedCollection.onNewTriggerClick(selectedCollection);
|
||||||
@@ -401,12 +432,45 @@ export function createScriptCommandButtons(selectedNodeState: SelectedNodeState)
|
|||||||
return buttons;
|
return buttons;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function applyNotebooksTemporarilyDownStyle(buttonProps: CommandButtonComponentProps, tooltip: string): void {
|
||||||
|
if (!buttonProps.isDivider) {
|
||||||
|
buttonProps.disabled = true;
|
||||||
|
buttonProps.tooltipText = tooltip;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function createNewNotebookButton(container: Explorer): CommandButtonComponentProps {
|
||||||
|
const label = "New Notebook";
|
||||||
|
return {
|
||||||
|
id: "newNotebookBtn",
|
||||||
|
iconSrc: NewNotebookIcon,
|
||||||
|
iconAlt: label,
|
||||||
|
onCommandClick: () => container.onNewNotebookClicked(),
|
||||||
|
commandButtonLabel: label,
|
||||||
|
hasPopup: false,
|
||||||
|
disabled: useSelectedNode.getState().isQueryCopilotCollectionSelected(),
|
||||||
|
ariaLabel: label,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function createuploadNotebookButton(container: Explorer): CommandButtonComponentProps {
|
||||||
|
const label = "Upload to Notebook Server";
|
||||||
|
return {
|
||||||
|
iconSrc: NewNotebookIcon,
|
||||||
|
iconAlt: label,
|
||||||
|
onCommandClick: () => container.openUploadFilePanel(),
|
||||||
|
commandButtonLabel: label,
|
||||||
|
hasPopup: false,
|
||||||
|
disabled: useSelectedNode.getState().isQueryCopilotCollectionSelected(),
|
||||||
|
ariaLabel: label,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
function createOpenQueryButton(container: Explorer): CommandButtonComponentProps {
|
function createOpenQueryButton(container: Explorer): CommandButtonComponentProps {
|
||||||
const label = "Open Query";
|
const label = "Open Query";
|
||||||
return {
|
return {
|
||||||
iconSrc: BrowseQueriesIcon,
|
iconSrc: BrowseQueriesIcon,
|
||||||
iconAlt: label,
|
iconAlt: label,
|
||||||
keyboardAction: KeyboardAction.OPEN_QUERY,
|
|
||||||
onCommandClick: () =>
|
onCommandClick: () =>
|
||||||
useSidePanel.getState().openSidePanel("Open Saved Queries", <BrowseQueriesPane explorer={container} />),
|
useSidePanel.getState().openSidePanel("Open Saved Queries", <BrowseQueriesPane explorer={container} />),
|
||||||
commandButtonLabel: label,
|
commandButtonLabel: label,
|
||||||
@@ -421,7 +485,6 @@ function createOpenQueryFromDiskButton(): CommandButtonComponentProps {
|
|||||||
return {
|
return {
|
||||||
iconSrc: OpenQueryFromDiskIcon,
|
iconSrc: OpenQueryFromDiskIcon,
|
||||||
iconAlt: label,
|
iconAlt: label,
|
||||||
keyboardAction: KeyboardAction.OPEN_QUERY_FROM_DISK,
|
|
||||||
onCommandClick: () => useSidePanel.getState().openSidePanel("Load Query", <LoadQueryPane />),
|
onCommandClick: () => useSidePanel.getState().openSidePanel("Load Query", <LoadQueryPane />),
|
||||||
commandButtonLabel: label,
|
commandButtonLabel: label,
|
||||||
ariaLabel: label,
|
ariaLabel: label,
|
||||||
@@ -430,6 +493,19 @@ function createOpenQueryFromDiskButton(): CommandButtonComponentProps {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function createOpenTerminalButton(container: Explorer): CommandButtonComponentProps {
|
||||||
|
const label = "Open Terminal";
|
||||||
|
return {
|
||||||
|
iconSrc: CosmosTerminalIcon,
|
||||||
|
iconAlt: label,
|
||||||
|
onCommandClick: () => container.openNotebookTerminal(ViewModels.TerminalKind.Default),
|
||||||
|
commandButtonLabel: label,
|
||||||
|
hasPopup: false,
|
||||||
|
disabled: useSelectedNode.getState().isQueryCopilotCollectionSelected(),
|
||||||
|
ariaLabel: label,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
function createOpenTerminalButtonByKind(
|
function createOpenTerminalButtonByKind(
|
||||||
container: Explorer,
|
container: Explorer,
|
||||||
terminalKind: ViewModels.TerminalKind,
|
terminalKind: ViewModels.TerminalKind,
|
||||||
@@ -469,6 +545,45 @@ function createOpenTerminalButtonByKind(
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function createNotebookWorkspaceResetButton(container: Explorer): CommandButtonComponentProps {
|
||||||
|
const label = "Reset Workspace";
|
||||||
|
return {
|
||||||
|
iconSrc: ResetWorkspaceIcon,
|
||||||
|
iconAlt: label,
|
||||||
|
onCommandClick: () => container.resetNotebookWorkspace(),
|
||||||
|
commandButtonLabel: label,
|
||||||
|
hasPopup: false,
|
||||||
|
disabled: useSelectedNode.getState().isQueryCopilotCollectionSelected(),
|
||||||
|
ariaLabel: label,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function createManageGitHubAccountButton(container: Explorer): CommandButtonComponentProps {
|
||||||
|
const connectedToGitHub: boolean = container.notebookManager?.gitHubOAuthService.isLoggedIn();
|
||||||
|
const label = connectedToGitHub ? "Manage GitHub settings" : "Connect to GitHub";
|
||||||
|
const junoClient = new JunoClient();
|
||||||
|
return {
|
||||||
|
iconSrc: GitHubIcon,
|
||||||
|
iconAlt: label,
|
||||||
|
onCommandClick: () => {
|
||||||
|
useSidePanel
|
||||||
|
.getState()
|
||||||
|
.openSidePanel(
|
||||||
|
label,
|
||||||
|
<GitHubReposPanel
|
||||||
|
explorer={container}
|
||||||
|
gitHubClientProp={container.notebookManager.gitHubClient}
|
||||||
|
junoClientProp={junoClient}
|
||||||
|
/>,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
commandButtonLabel: label,
|
||||||
|
hasPopup: false,
|
||||||
|
disabled: useSelectedNode.getState().isQueryCopilotCollectionSelected(),
|
||||||
|
ariaLabel: label,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
function createStaticCommandBarButtonsForResourceToken(
|
function createStaticCommandBarButtonsForResourceToken(
|
||||||
container: Explorer,
|
container: Explorer,
|
||||||
selectedNodeState: SelectedNodeState,
|
selectedNodeState: SelectedNodeState,
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import {
|
|||||||
IDropdownStyles,
|
IDropdownStyles,
|
||||||
} from "@fluentui/react";
|
} from "@fluentui/react";
|
||||||
import { useQueryCopilot } from "hooks/useQueryCopilot";
|
import { useQueryCopilot } from "hooks/useQueryCopilot";
|
||||||
import { KeyboardHandlerMap } from "KeyboardShortcuts";
|
|
||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
import _ from "underscore";
|
import _ from "underscore";
|
||||||
import ChevronDownIcon from "../../../../images/Chevron_down.svg";
|
import ChevronDownIcon from "../../../../images/Chevron_down.svg";
|
||||||
@@ -38,7 +37,7 @@ export const convertButton = (btns: CommandButtonComponentProps[], backgroundCol
|
|||||||
if (isDisabled) {
|
if (isDisabled) {
|
||||||
return StyleConstants.GrayScale;
|
return StyleConstants.GrayScale;
|
||||||
}
|
}
|
||||||
return configContext.platform == Platform.Fabric ? StyleConstants.FabricToolbarIconColor : undefined;
|
return configContext.platform == Platform.Fabric ? StyleConstants.NoColor : undefined;
|
||||||
};
|
};
|
||||||
|
|
||||||
return btns
|
return btns
|
||||||
@@ -60,23 +59,21 @@ export const convertButton = (btns: CommandButtonComponentProps[], backgroundCol
|
|||||||
imageProps: btn.iconSrc ? { src: btn.iconSrc, alt: btn.iconAlt } : undefined,
|
imageProps: btn.iconSrc ? { src: btn.iconSrc, alt: btn.iconAlt } : undefined,
|
||||||
iconName: btn.iconName,
|
iconName: btn.iconName,
|
||||||
},
|
},
|
||||||
onClick: btn.onCommandClick
|
onClick: (ev?: React.MouseEvent<HTMLElement, MouseEvent> | React.KeyboardEvent<HTMLElement>) => {
|
||||||
? (ev?: React.MouseEvent<HTMLElement, MouseEvent> | React.KeyboardEvent<HTMLElement>) => {
|
|
||||||
btn.onCommandClick(ev);
|
btn.onCommandClick(ev);
|
||||||
let copilotEnabled = false;
|
let copilotEnabled = false;
|
||||||
if (useQueryCopilot.getState().copilotEnabled && useQueryCopilot.getState().copilotUserDBEnabled) {
|
if (useQueryCopilot.getState().copilotEnabled && useQueryCopilot.getState().copilotUserDBEnabled) {
|
||||||
copilotEnabled = useQueryCopilot.getState().copilotEnabledforExecution;
|
copilotEnabled = useQueryCopilot.getState().copilotEnabledforExecution;
|
||||||
}
|
}
|
||||||
TelemetryProcessor.trace(Action.ClickCommandBarButton, ActionModifiers.Mark, { label, copilotEnabled });
|
TelemetryProcessor.trace(Action.ClickCommandBarButton, ActionModifiers.Mark, { label, copilotEnabled });
|
||||||
}
|
},
|
||||||
: undefined,
|
|
||||||
key: `${btn.commandButtonLabel}${index}`,
|
key: `${btn.commandButtonLabel}${index}`,
|
||||||
text: label,
|
text: label,
|
||||||
|
"data-test": label,
|
||||||
title: btn.tooltipText,
|
title: btn.tooltipText,
|
||||||
name: label,
|
name: label,
|
||||||
disabled: btn.disabled,
|
disabled: btn.disabled,
|
||||||
ariaLabel: btn.ariaLabel,
|
ariaLabel: btn.ariaLabel,
|
||||||
"data-test": `CommandBar/Button:${label}`,
|
|
||||||
buttonStyles: {
|
buttonStyles: {
|
||||||
root: {
|
root: {
|
||||||
backgroundColor: backgroundColor,
|
backgroundColor: backgroundColor,
|
||||||
@@ -99,12 +96,7 @@ export const convertButton = (btns: CommandButtonComponentProps[], backgroundCol
|
|||||||
},
|
},
|
||||||
width: 16,
|
width: 16,
|
||||||
},
|
},
|
||||||
label: {
|
label: { fontSize: StyleConstants.mediumFontSize },
|
||||||
fontSize:
|
|
||||||
configContext.platform == Platform.Fabric
|
|
||||||
? StyleConstants.DefaultFontSize
|
|
||||||
: StyleConstants.mediumFontSize,
|
|
||||||
},
|
|
||||||
rootHovered: { backgroundColor: hoverColor },
|
rootHovered: { backgroundColor: hoverColor },
|
||||||
rootPressed: { backgroundColor: hoverColor },
|
rootPressed: { backgroundColor: hoverColor },
|
||||||
splitButtonMenuButtonExpanded: {
|
splitButtonMenuButtonExpanded: {
|
||||||
@@ -141,12 +133,7 @@ export const convertButton = (btns: CommandButtonComponentProps[], backgroundCol
|
|||||||
// TODO Figure out how to do it the proper way with subComponentStyles.
|
// TODO Figure out how to do it the proper way with subComponentStyles.
|
||||||
// TODO Remove all this crazy styling once we adopt Ui-Fabric Azure themes
|
// TODO Remove all this crazy styling once we adopt Ui-Fabric Azure themes
|
||||||
selectors: {
|
selectors: {
|
||||||
".ms-ContextualMenu-itemText": {
|
".ms-ContextualMenu-itemText": { fontSize: StyleConstants.mediumFontSize },
|
||||||
fontSize:
|
|
||||||
configContext.platform == Platform.Fabric
|
|
||||||
? StyleConstants.DefaultFontSize
|
|
||||||
: StyleConstants.mediumFontSize,
|
|
||||||
},
|
|
||||||
".ms-ContextualMenu-link:hover": { backgroundColor: hoverColor },
|
".ms-ContextualMenu-link:hover": { backgroundColor: hoverColor },
|
||||||
".ms-ContextualMenu-icon": { width: 16, height: 16 },
|
".ms-ContextualMenu-icon": { width: 16, height: 16 },
|
||||||
},
|
},
|
||||||
@@ -236,28 +223,3 @@ export const createConnectionStatus = (container: Explorer, poolId: PoolIdType,
|
|||||||
onRender: () => <ConnectionStatus container={container} poolId={poolId} />,
|
onRender: () => <ConnectionStatus container={container} poolId={poolId} />,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
export function createKeyboardHandlers(allButtons: CommandButtonComponentProps[]): KeyboardHandlerMap {
|
|
||||||
const handlers: KeyboardHandlerMap = {};
|
|
||||||
|
|
||||||
function createHandlers(buttons: CommandButtonComponentProps[]) {
|
|
||||||
buttons.forEach((button) => {
|
|
||||||
if (!button.disabled && button.keyboardAction) {
|
|
||||||
handlers[button.keyboardAction] = (e) => {
|
|
||||||
button.onCommandClick(e);
|
|
||||||
|
|
||||||
// If the handler is bound, it means the button is visible and enabled, so we should prevent the default action
|
|
||||||
return true;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
if (button.children && button.children.length > 0) {
|
|
||||||
createHandlers(button.children);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
createHandlers(allButtons);
|
|
||||||
|
|
||||||
return handlers;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -162,7 +162,6 @@ export class NotificationConsoleComponent extends React.Component<
|
|||||||
role="button"
|
role="button"
|
||||||
onKeyDown={(event: React.KeyboardEvent<HTMLSpanElement>) => this.onClearNotificationsKeyPress(event)}
|
onKeyDown={(event: React.KeyboardEvent<HTMLSpanElement>) => this.onClearNotificationsKeyPress(event)}
|
||||||
tabIndex={0}
|
tabIndex={0}
|
||||||
style={{ border: "1px solid black", borderRadius: "2px" }}
|
|
||||||
>
|
>
|
||||||
<img src={ClearIcon} alt="clear notifications image" />
|
<img src={ClearIcon} alt="clear notifications image" />
|
||||||
Clear Notifications
|
Clear Notifications
|
||||||
|
|||||||
@@ -146,12 +146,6 @@ exports[`NotificationConsoleComponent renders the console 1`] = `
|
|||||||
onClick={[Function]}
|
onClick={[Function]}
|
||||||
onKeyDown={[Function]}
|
onKeyDown={[Function]}
|
||||||
role="button"
|
role="button"
|
||||||
style={
|
|
||||||
Object {
|
|
||||||
"border": "1px solid black",
|
|
||||||
"borderRadius": "2px",
|
|
||||||
}
|
|
||||||
}
|
|
||||||
tabIndex={0}
|
tabIndex={0}
|
||||||
>
|
>
|
||||||
<img
|
<img
|
||||||
@@ -317,12 +311,6 @@ exports[`NotificationConsoleComponent renders the console 2`] = `
|
|||||||
onClick={[Function]}
|
onClick={[Function]}
|
||||||
onKeyDown={[Function]}
|
onKeyDown={[Function]}
|
||||||
role="button"
|
role="button"
|
||||||
style={
|
|
||||||
Object {
|
|
||||||
"border": "1px solid black",
|
|
||||||
"borderRadius": "2px",
|
|
||||||
}
|
|
||||||
}
|
|
||||||
tabIndex={0}
|
tabIndex={0}
|
||||||
>
|
>
|
||||||
<img
|
<img
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
// TODO convert this file to an action registry in order to have actions and their handlers be more tightly coupled.
|
// TODO convert this file to an action registry in order to have actions and their handlers be more tightly coupled.
|
||||||
import { useDatabases } from "Explorer/useDatabases";
|
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { ActionContracts } from "../../Contracts/ExplorerContracts";
|
import { ActionContracts } from "../../Contracts/ExplorerContracts";
|
||||||
import * as ViewModels from "../../Contracts/ViewModels";
|
import * as ViewModels from "../../Contracts/ViewModels";
|
||||||
@@ -41,26 +40,12 @@ function openCollectionTab(
|
|||||||
databases: ViewModels.Database[],
|
databases: ViewModels.Database[],
|
||||||
initialDatabaseIndex = 0,
|
initialDatabaseIndex = 0,
|
||||||
) {
|
) {
|
||||||
//if databases are not yet loaded, wait until loaded
|
|
||||||
if (!databases || databases.length === 0) {
|
|
||||||
const databaseActionHandler = (databases: ViewModels.Database[]) => {
|
|
||||||
databasesUnsubscription();
|
|
||||||
openCollectionTab(action, databases, 0);
|
|
||||||
return;
|
|
||||||
};
|
|
||||||
const databasesUnsubscription = useDatabases.subscribe(databaseActionHandler, (state) => state.databases);
|
|
||||||
} else {
|
|
||||||
for (let i = initialDatabaseIndex; i < databases.length; i++) {
|
for (let i = initialDatabaseIndex; i < databases.length; i++) {
|
||||||
const database: ViewModels.Database = databases[i];
|
const database: ViewModels.Database = databases[i];
|
||||||
if (!!action.databaseResourceId && database.id() !== action.databaseResourceId) {
|
if (!!action.databaseResourceId && database.id() !== action.databaseResourceId) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
//expand database first if not expanded to load the collections
|
|
||||||
if (!database.isDatabaseExpanded?.()) {
|
|
||||||
database.expandDatabase?.();
|
|
||||||
}
|
|
||||||
|
|
||||||
const collectionActionHandler = (collections: ViewModels.Collection[]) => {
|
const collectionActionHandler = (collections: ViewModels.Collection[]) => {
|
||||||
if (!action.collectionResourceId && collections.length === 0) {
|
if (!action.collectionResourceId && collections.length === 0) {
|
||||||
subscription.dispose();
|
subscription.dispose();
|
||||||
@@ -147,7 +132,6 @@ function openCollectionTab(
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function openPane(action: ActionContracts.OpenPane, explorer: Explorer) {
|
function openPane(action: ActionContracts.OpenPane, explorer: Explorer) {
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ import { getErrorMessage, getErrorStack } from "Common/ErrorHandlingUtils";
|
|||||||
import { configContext, Platform } from "ConfigContext";
|
import { configContext, Platform } from "ConfigContext";
|
||||||
import * as DataModels from "Contracts/DataModels";
|
import * as DataModels from "Contracts/DataModels";
|
||||||
import { SubscriptionType } from "Contracts/SubscriptionType";
|
import { SubscriptionType } from "Contracts/SubscriptionType";
|
||||||
import { AddVectorEmbeddingPolicyForm } from "Explorer/Panes/VectorSearchPanel/AddVectorEmbeddingPolicyForm";
|
|
||||||
import { useSidePanel } from "hooks/useSidePanel";
|
import { useSidePanel } from "hooks/useSidePanel";
|
||||||
import { useTeachingBubble } from "hooks/useTeachingBubble";
|
import { useTeachingBubble } from "hooks/useTeachingBubble";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
@@ -30,7 +29,7 @@ import { Action } from "Shared/Telemetry/TelemetryConstants";
|
|||||||
import * as TelemetryProcessor from "Shared/Telemetry/TelemetryProcessor";
|
import * as TelemetryProcessor from "Shared/Telemetry/TelemetryProcessor";
|
||||||
import { userContext } from "UserContext";
|
import { userContext } from "UserContext";
|
||||||
import { getCollectionName } from "Utils/APITypeUtils";
|
import { getCollectionName } from "Utils/APITypeUtils";
|
||||||
import { isCapabilityEnabled, isServerlessAccount, isVectorSearchEnabled } from "Utils/CapabilityUtils";
|
import { isCapabilityEnabled, isServerlessAccount } from "Utils/CapabilityUtils";
|
||||||
import { getUpsellMessage } from "Utils/PricingUtils";
|
import { getUpsellMessage } from "Utils/PricingUtils";
|
||||||
import { CollapsibleSectionComponent } from "../Controls/CollapsiblePanel/CollapsibleSectionComponent";
|
import { CollapsibleSectionComponent } from "../Controls/CollapsiblePanel/CollapsibleSectionComponent";
|
||||||
import { ThroughputInput } from "../Controls/ThroughputInput/ThroughputInput";
|
import { ThroughputInput } from "../Controls/ThroughputInput/ThroughputInput";
|
||||||
@@ -82,10 +81,6 @@ export const AllPropertiesIndexed: DataModels.IndexingPolicy = {
|
|||||||
excludedPaths: [],
|
excludedPaths: [],
|
||||||
};
|
};
|
||||||
|
|
||||||
export const DefaultVectorEmbeddingPolicy: DataModels.VectorEmbeddingPolicy = {
|
|
||||||
vectorEmbeddings: [],
|
|
||||||
};
|
|
||||||
|
|
||||||
export interface AddCollectionPanelState {
|
export interface AddCollectionPanelState {
|
||||||
createNewDatabase: boolean;
|
createNewDatabase: boolean;
|
||||||
newDatabaseId: string;
|
newDatabaseId: string;
|
||||||
@@ -106,9 +101,6 @@ export interface AddCollectionPanelState {
|
|||||||
isExecuting: boolean;
|
isExecuting: boolean;
|
||||||
isThroughputCapExceeded: boolean;
|
isThroughputCapExceeded: boolean;
|
||||||
teachingBubbleStep: number;
|
teachingBubbleStep: number;
|
||||||
vectorIndexingPolicy: DataModels.VectorIndex[];
|
|
||||||
vectorEmbeddingPolicy: DataModels.VectorEmbedding[];
|
|
||||||
vectorPolicyValidated: boolean;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class AddCollectionPanel extends React.Component<AddCollectionPanelProps, AddCollectionPanelState> {
|
export class AddCollectionPanel extends React.Component<AddCollectionPanelProps, AddCollectionPanelState> {
|
||||||
@@ -144,9 +136,6 @@ export class AddCollectionPanel extends React.Component<AddCollectionPanelProps,
|
|||||||
isExecuting: false,
|
isExecuting: false,
|
||||||
isThroughputCapExceeded: false,
|
isThroughputCapExceeded: false,
|
||||||
teachingBubbleStep: 0,
|
teachingBubbleStep: 0,
|
||||||
vectorEmbeddingPolicy: [],
|
|
||||||
vectorIndexingPolicy: [],
|
|
||||||
vectorPolicyValidated: true,
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -156,17 +145,11 @@ export class AddCollectionPanel extends React.Component<AddCollectionPanelProps,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidUpdate(_prevProps: AddCollectionPanelProps, prevState: AddCollectionPanelState): void {
|
|
||||||
if (this.state.errorMessage && this.state.errorMessage !== prevState.errorMessage) {
|
|
||||||
this.scrollToSection("panelContainer");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
render(): JSX.Element {
|
render(): JSX.Element {
|
||||||
const isFirstResourceCreated = useDatabases.getState().isFirstResourceCreated();
|
const isFirstResourceCreated = useDatabases.getState().isFirstResourceCreated();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<form className="panelFormWrapper" onSubmit={this.submit.bind(this)} id="panelContainer">
|
<form className="panelFormWrapper" onSubmit={this.submit.bind(this)}>
|
||||||
{this.state.errorMessage && (
|
{this.state.errorMessage && (
|
||||||
<PanelInfoErrorComponent
|
<PanelInfoErrorComponent
|
||||||
message={this.state.errorMessage}
|
message={this.state.errorMessage}
|
||||||
@@ -399,7 +382,6 @@ export class AddCollectionPanel extends React.Component<AddCollectionPanelProps,
|
|||||||
)}
|
)}
|
||||||
{!this.state.createNewDatabase && (
|
{!this.state.createNewDatabase && (
|
||||||
<Dropdown
|
<Dropdown
|
||||||
ariaLabel="Choose an existing database"
|
|
||||||
styles={{ title: { height: 27, lineHeight: 27 }, dropdownItem: { fontSize: 12 } }}
|
styles={{ title: { height: 27, lineHeight: 27 }, dropdownItem: { fontSize: 12 } }}
|
||||||
style={{ width: 300, fontSize: 12 }}
|
style={{ width: 300, fontSize: 12 }}
|
||||||
placeholder="Choose an existing database"
|
placeholder="Choose an existing database"
|
||||||
@@ -576,7 +558,9 @@ export class AddCollectionPanel extends React.Component<AddCollectionPanelProps,
|
|||||||
</TooltipHost>
|
</TooltipHost>
|
||||||
</Stack>
|
</Stack>
|
||||||
|
|
||||||
<Text variant="small">{this.getPartitionKeySubtext()}</Text>
|
<Text variant="small" aria-label="pkDescription">
|
||||||
|
{this.getPartitionKeySubtext()}
|
||||||
|
</Text>
|
||||||
|
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
@@ -816,7 +800,8 @@ export class AddCollectionPanel extends React.Component<AddCollectionPanelProps,
|
|||||||
iconName="Info"
|
iconName="Info"
|
||||||
className="panelInfoIcon"
|
className="panelInfoIcon"
|
||||||
tabIndex={0}
|
tabIndex={0}
|
||||||
ariaLabel="Enable analytical store capability to perform near real-time analytics on your operational data, without impacting the performance of transactional workloads."
|
ariaLabel="Enable analytical store capability to perform near real-time analytics on your operational data, without
|
||||||
|
impacting the performance of transactional workloads."
|
||||||
/>
|
/>
|
||||||
</TooltipHost>
|
</TooltipHost>
|
||||||
</Stack>
|
</Stack>
|
||||||
@@ -878,44 +863,17 @@ export class AddCollectionPanel extends React.Component<AddCollectionPanelProps,
|
|||||||
)}
|
)}
|
||||||
</Stack>
|
</Stack>
|
||||||
)}
|
)}
|
||||||
{this.shouldShowVectorSearchParameters() && (
|
|
||||||
<Stack>
|
|
||||||
<CollapsibleSectionComponent
|
|
||||||
title="Container Vector Policy"
|
|
||||||
isExpandedByDefault={false}
|
|
||||||
onExpand={() => {
|
|
||||||
this.scrollToSection("collapsibleVectorPolicySectionContent");
|
|
||||||
}}
|
|
||||||
tooltipContent={this.getContainerVectorPolicyTooltipContent()}
|
|
||||||
>
|
|
||||||
<Stack id="collapsibleVectorPolicySectionContent" styles={{ root: { position: "relative" } }}>
|
|
||||||
<Stack styles={{ root: { paddingLeft: 40 } }}>
|
|
||||||
<AddVectorEmbeddingPolicyForm
|
|
||||||
vectorEmbedding={this.state.vectorEmbeddingPolicy}
|
|
||||||
vectorIndex={this.state.vectorIndexingPolicy}
|
|
||||||
onVectorEmbeddingChange={(
|
|
||||||
vectorEmbeddingPolicy: DataModels.VectorEmbedding[],
|
|
||||||
vectorIndexingPolicy: DataModels.VectorIndex[],
|
|
||||||
vectorPolicyValidated: boolean,
|
|
||||||
) => {
|
|
||||||
this.setState({ vectorEmbeddingPolicy, vectorIndexingPolicy, vectorPolicyValidated });
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</Stack>
|
|
||||||
</Stack>
|
|
||||||
</CollapsibleSectionComponent>
|
|
||||||
</Stack>
|
|
||||||
)}
|
|
||||||
{userContext.apiType !== "Tables" && (
|
{userContext.apiType !== "Tables" && (
|
||||||
<CollapsibleSectionComponent
|
<CollapsibleSectionComponent
|
||||||
title="Advanced"
|
title="Advanced"
|
||||||
isExpandedByDefault={false}
|
isExpandedByDefault={false}
|
||||||
onExpand={() => {
|
onExpand={() => {
|
||||||
TelemetryProcessor.traceOpen(Action.ExpandAddCollectionPaneAdvancedSection);
|
TelemetryProcessor.traceOpen(Action.ExpandAddCollectionPaneAdvancedSection);
|
||||||
this.scrollToSection("collapsibleAdvancedSectionContent");
|
this.scrollToAdvancedSection();
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Stack className="panelGroupSpacing" id="collapsibleAdvancedSectionContent">
|
<Stack className="panelGroupSpacing" id="collapsibleSectionContent">
|
||||||
{isCapabilityEnabled("EnableMongo") && !isCapabilityEnabled("EnableMongo16MBDocumentSupport") && (
|
{isCapabilityEnabled("EnableMongo") && !isCapabilityEnabled("EnableMongo16MBDocumentSupport") && (
|
||||||
<Stack className="panelGroupSpacing">
|
<Stack className="panelGroupSpacing">
|
||||||
<Stack horizontal>
|
<Stack horizontal>
|
||||||
@@ -966,9 +924,10 @@ export class AddCollectionPanel extends React.Component<AddCollectionPanelProps,
|
|||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
<Text variant="small">
|
<Text variant="small">
|
||||||
<Icon iconName="InfoSolid" className="removeIcon" /> To ensure compatibility with older SDKs, the
|
<Icon iconName="InfoSolid" className="removeIcon" tabIndex={0} /> To ensure compatibility with
|
||||||
created container will use a legacy partitioning scheme that supports partition key values of size
|
older SDKs, the created container will use a legacy partitioning scheme that supports partition
|
||||||
only up to 101 bytes. If this is enabled, you will not be able to use hierarchical partition keys.{" "}
|
key values of size only up to 101 bytes. If this is enabled, you will not be able to use
|
||||||
|
hierarchical partition keys.{" "}
|
||||||
<Link href="https://aka.ms/cosmos-large-pk" target="_blank">
|
<Link href="https://aka.ms/cosmos-large-pk" target="_blank">
|
||||||
Learn more
|
Learn more
|
||||||
</Link>
|
</Link>
|
||||||
@@ -1111,18 +1070,6 @@ export class AddCollectionPanel extends React.Component<AddCollectionPanelProps,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private setVectorEmbeddingPolicy(vectorEmbeddingPolicy: DataModels.VectorEmbedding[]): void {
|
|
||||||
this.setState({
|
|
||||||
vectorEmbeddingPolicy,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private setVectorIndexingPolicy(vectorIndexingPolicy: DataModels.VectorIndex[]): void {
|
|
||||||
this.setState({
|
|
||||||
vectorIndexingPolicy,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private isSelectedDatabaseSharedThroughput(): boolean {
|
private isSelectedDatabaseSharedThroughput(): boolean {
|
||||||
if (!this.state.selectedDatabaseId) {
|
if (!this.state.selectedDatabaseId) {
|
||||||
return false;
|
return false;
|
||||||
@@ -1203,18 +1150,6 @@ export class AddCollectionPanel extends React.Component<AddCollectionPanelProps,
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private getContainerVectorPolicyTooltipContent(): JSX.Element {
|
|
||||||
return (
|
|
||||||
<Text variant="small">
|
|
||||||
Describe any properties in your data that contain vectors, so that they can be made available for similarity
|
|
||||||
queries.{" "}
|
|
||||||
<Link target="_blank" href="https://aka.ms/CosmosDBVectorSetup">
|
|
||||||
Learn more
|
|
||||||
</Link>
|
|
||||||
</Text>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
private shouldShowCollectionThroughputInput(): boolean {
|
private shouldShowCollectionThroughputInput(): boolean {
|
||||||
if (isServerlessAccount()) {
|
if (isServerlessAccount()) {
|
||||||
return false;
|
return false;
|
||||||
@@ -1274,10 +1209,6 @@ export class AddCollectionPanel extends React.Component<AddCollectionPanelProps,
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private shouldShowVectorSearchParameters() {
|
|
||||||
return isVectorSearchEnabled() && (isServerlessAccount() || this.shouldShowCollectionThroughputInput());
|
|
||||||
}
|
|
||||||
|
|
||||||
private parseUniqueKeys(): DataModels.UniqueKeyPolicy {
|
private parseUniqueKeys(): DataModels.UniqueKeyPolicy {
|
||||||
if (this.state.uniqueKeys?.length === 0) {
|
if (this.state.uniqueKeys?.length === 0) {
|
||||||
return undefined;
|
return undefined;
|
||||||
@@ -1334,11 +1265,6 @@ export class AddCollectionPanel extends React.Component<AddCollectionPanelProps,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.shouldShowVectorSearchParameters() && !this.state.vectorPolicyValidated) {
|
|
||||||
this.setState({ errorMessage: "Please fix errors in container vector policy" });
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1361,8 +1287,8 @@ export class AddCollectionPanel extends React.Component<AddCollectionPanelProps,
|
|||||||
return Constants.AnalyticalStorageTtl.Disabled;
|
return Constants.AnalyticalStorageTtl.Disabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
private scrollToSection(id: string): void {
|
private scrollToAdvancedSection(): void {
|
||||||
document.getElementById(id)?.scrollIntoView();
|
document.getElementById("collapsibleSectionContent")?.scrollIntoView();
|
||||||
}
|
}
|
||||||
|
|
||||||
private getSampleDBName(): string {
|
private getSampleDBName(): string {
|
||||||
@@ -1418,15 +1344,6 @@ export class AddCollectionPanel extends React.Component<AddCollectionPanelProps,
|
|||||||
? AllPropertiesIndexed
|
? AllPropertiesIndexed
|
||||||
: SharedDatabaseDefault;
|
: SharedDatabaseDefault;
|
||||||
|
|
||||||
let vectorEmbeddingPolicy: DataModels.VectorEmbeddingPolicy;
|
|
||||||
|
|
||||||
if (this.shouldShowVectorSearchParameters()) {
|
|
||||||
indexingPolicy.vectorIndexes = this.state.vectorIndexingPolicy;
|
|
||||||
vectorEmbeddingPolicy = {
|
|
||||||
vectorEmbeddings: this.state.vectorEmbeddingPolicy,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
const telemetryData = {
|
const telemetryData = {
|
||||||
database: {
|
database: {
|
||||||
id: databaseId,
|
id: databaseId,
|
||||||
@@ -1485,7 +1402,6 @@ export class AddCollectionPanel extends React.Component<AddCollectionPanelProps,
|
|||||||
partitionKey,
|
partitionKey,
|
||||||
uniqueKeyPolicy,
|
uniqueKeyPolicy,
|
||||||
createMongoWildcardIndex: this.state.createMongoWildCardIndex,
|
createMongoWildcardIndex: this.state.createMongoWildCardIndex,
|
||||||
vectorEmbeddingPolicy,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
this.setState({ isExecuting: true });
|
this.setState({ isExecuting: true });
|
||||||
|
|||||||
@@ -202,8 +202,8 @@ export const CassandraAddCollectionPane: FunctionComponent<CassandraAddCollectio
|
|||||||
required={true}
|
required={true}
|
||||||
autoComplete="off"
|
autoComplete="off"
|
||||||
styles={getTextFieldStyles()}
|
styles={getTextFieldStyles()}
|
||||||
pattern="[^/?#\\-]*[^/?#- \\]"
|
pattern="[^/?#\\]*[^/?# \\]"
|
||||||
title="May not end with space nor contain characters '\' '/' '#' '?' '-'"
|
title="May not end with space nor contain characters '\' '/' '#' '?'"
|
||||||
placeholder="Type a new keyspace id"
|
placeholder="Type a new keyspace id"
|
||||||
size={40}
|
size={40}
|
||||||
value={newKeyspaceId}
|
value={newKeyspaceId}
|
||||||
@@ -275,7 +275,7 @@ export const CassandraAddCollectionPane: FunctionComponent<CassandraAddCollectio
|
|||||||
<span className="mandatoryStar">* </span>
|
<span className="mandatoryStar">* </span>
|
||||||
<Text className="panelTextBold" variant="small">
|
<Text className="panelTextBold" variant="small">
|
||||||
Enter CQL command to create the table.{" "}
|
Enter CQL command to create the table.{" "}
|
||||||
<Link className="underlinedLink" href="https://aka.ms/cassandra-create-table" target="_blank">
|
<Link href="https://aka.ms/cassandra-create-table" target="_blank">
|
||||||
Learn More
|
Learn More
|
||||||
</Link>
|
</Link>
|
||||||
</Text>
|
</Text>
|
||||||
@@ -292,8 +292,8 @@ export const CassandraAddCollectionPane: FunctionComponent<CassandraAddCollectio
|
|||||||
required={true}
|
required={true}
|
||||||
ariaLabel="addCollection-table Id Create table"
|
ariaLabel="addCollection-table Id Create table"
|
||||||
autoComplete="off"
|
autoComplete="off"
|
||||||
pattern="[^/?#\\-]*[^/?#- \\]"
|
pattern="[^/?#\\]*[^/?# \\]"
|
||||||
title="May not end with space nor contain characters '\' '/' '#' '?' '-'"
|
title="May not end with space nor contain characters '\' '/' '#' '?'"
|
||||||
placeholder="Enter table Id"
|
placeholder="Enter table Id"
|
||||||
size={20}
|
size={20}
|
||||||
value={tableId}
|
value={tableId}
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import {
|
|||||||
Icon,
|
Icon,
|
||||||
IconButton,
|
IconButton,
|
||||||
Link,
|
Link,
|
||||||
MessageBar,
|
|
||||||
Stack,
|
Stack,
|
||||||
Text,
|
Text,
|
||||||
TooltipHost,
|
TooltipHost,
|
||||||
@@ -208,7 +207,6 @@ export const ChangePartitionKeyPane: React.FC<ChangePartitionKeyPaneProps> = ({
|
|||||||
</Stack>
|
</Stack>
|
||||||
{createNewContainer ? (
|
{createNewContainer ? (
|
||||||
<Stack>
|
<Stack>
|
||||||
<MessageBar>All configurations except for unique keys will be copied from the source container</MessageBar>
|
|
||||||
<Stack className="panelGroupSpacing">
|
<Stack className="panelGroupSpacing">
|
||||||
<Stack horizontal>
|
<Stack horizontal>
|
||||||
<span className="mandatoryStar">* </span>
|
<span className="mandatoryStar">* </span>
|
||||||
@@ -264,7 +262,7 @@ export const ChangePartitionKeyPane: React.FC<ChangePartitionKeyPaneProps> = ({
|
|||||||
</TooltipHost>
|
</TooltipHost>
|
||||||
</Stack>
|
</Stack>
|
||||||
|
|
||||||
<Text variant="small">
|
<Text variant="small" aria-label="pkDescription">
|
||||||
{getPartitionKeySubtext(userContext.features.partitionKeyDefault, userContext.apiType)}
|
{getPartitionKeySubtext(userContext.features.partitionKeyDefault, userContext.apiType)}
|
||||||
</Text>
|
</Text>
|
||||||
|
|
||||||
|
|||||||
@@ -379,7 +379,6 @@ exports[`Delete Collection Confirmation Pane submit() should call delete collect
|
|||||||
>
|
>
|
||||||
<CustomizedPrimaryButton
|
<CustomizedPrimaryButton
|
||||||
ariaLabel="OK"
|
ariaLabel="OK"
|
||||||
data-test="Panel/OkButton"
|
|
||||||
disabled={false}
|
disabled={false}
|
||||||
id="sidePanelOkButton"
|
id="sidePanelOkButton"
|
||||||
text="OK"
|
text="OK"
|
||||||
@@ -387,7 +386,6 @@ exports[`Delete Collection Confirmation Pane submit() should call delete collect
|
|||||||
>
|
>
|
||||||
<PrimaryButton
|
<PrimaryButton
|
||||||
ariaLabel="OK"
|
ariaLabel="OK"
|
||||||
data-test="Panel/OkButton"
|
|
||||||
disabled={false}
|
disabled={false}
|
||||||
id="sidePanelOkButton"
|
id="sidePanelOkButton"
|
||||||
text="OK"
|
text="OK"
|
||||||
@@ -668,7 +666,6 @@ exports[`Delete Collection Confirmation Pane submit() should call delete collect
|
|||||||
>
|
>
|
||||||
<CustomizedDefaultButton
|
<CustomizedDefaultButton
|
||||||
ariaLabel="OK"
|
ariaLabel="OK"
|
||||||
data-test="Panel/OkButton"
|
|
||||||
disabled={false}
|
disabled={false}
|
||||||
id="sidePanelOkButton"
|
id="sidePanelOkButton"
|
||||||
onRenderDescription={[Function]}
|
onRenderDescription={[Function]}
|
||||||
@@ -951,7 +948,6 @@ exports[`Delete Collection Confirmation Pane submit() should call delete collect
|
|||||||
>
|
>
|
||||||
<DefaultButton
|
<DefaultButton
|
||||||
ariaLabel="OK"
|
ariaLabel="OK"
|
||||||
data-test="Panel/OkButton"
|
|
||||||
disabled={false}
|
disabled={false}
|
||||||
id="sidePanelOkButton"
|
id="sidePanelOkButton"
|
||||||
onRenderDescription={[Function]}
|
onRenderDescription={[Function]}
|
||||||
@@ -1235,7 +1231,6 @@ exports[`Delete Collection Confirmation Pane submit() should call delete collect
|
|||||||
<BaseButton
|
<BaseButton
|
||||||
ariaLabel="OK"
|
ariaLabel="OK"
|
||||||
baseClassName="ms-Button"
|
baseClassName="ms-Button"
|
||||||
data-test="Panel/OkButton"
|
|
||||||
disabled={false}
|
disabled={false}
|
||||||
id="sidePanelOkButton"
|
id="sidePanelOkButton"
|
||||||
onRenderDescription={[Function]}
|
onRenderDescription={[Function]}
|
||||||
@@ -2110,7 +2105,6 @@ exports[`Delete Collection Confirmation Pane submit() should call delete collect
|
|||||||
aria-label="OK"
|
aria-label="OK"
|
||||||
className="ms-Button ms-Button--primary root-122"
|
className="ms-Button ms-Button--primary root-122"
|
||||||
data-is-focusable={true}
|
data-is-focusable={true}
|
||||||
data-test="Panel/OkButton"
|
|
||||||
id="sidePanelOkButton"
|
id="sidePanelOkButton"
|
||||||
onClick={[Function]}
|
onClick={[Function]}
|
||||||
onKeyDown={[Function]}
|
onKeyDown={[Function]}
|
||||||
@@ -2146,11 +2140,6 @@ exports[`Delete Collection Confirmation Pane submit() should call delete collect
|
|||||||
</div>
|
</div>
|
||||||
</PanelFooterComponent>
|
</PanelFooterComponent>
|
||||||
</form>
|
</form>
|
||||||
<span
|
|
||||||
className="screenReaderOnly"
|
|
||||||
id="screenReaderStatus"
|
|
||||||
role="status"
|
|
||||||
/>
|
|
||||||
</RightPaneForm>
|
</RightPaneForm>
|
||||||
</DeleteCollectionConfirmationPane>
|
</DeleteCollectionConfirmationPane>
|
||||||
`;
|
`;
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import { DefaultExperienceUtility } from "Shared/DefaultExperienceUtility";
|
|||||||
import { Action, ActionModifiers } from "Shared/Telemetry/TelemetryConstants";
|
import { Action, ActionModifiers } from "Shared/Telemetry/TelemetryConstants";
|
||||||
import * as TelemetryProcessor from "Shared/Telemetry/TelemetryProcessor";
|
import * as TelemetryProcessor from "Shared/Telemetry/TelemetryProcessor";
|
||||||
import { userContext } from "UserContext";
|
import { userContext } from "UserContext";
|
||||||
import { getDatabaseName } from "Utils/APITypeUtils";
|
|
||||||
import { logConsoleError } from "Utils/NotificationConsoleUtils";
|
import { logConsoleError } from "Utils/NotificationConsoleUtils";
|
||||||
import { useSidePanel } from "hooks/useSidePanel";
|
import { useSidePanel } from "hooks/useSidePanel";
|
||||||
import { useTabs } from "hooks/useTabs";
|
import { useTabs } from "hooks/useTabs";
|
||||||
@@ -38,11 +37,11 @@ export const DeleteDatabaseConfirmationPanel: FunctionComponent<DeleteDatabaseCo
|
|||||||
const submit = async (): Promise<void> => {
|
const submit = async (): Promise<void> => {
|
||||||
if (selectedDatabase?.id() && databaseInput !== selectedDatabase.id()) {
|
if (selectedDatabase?.id() && databaseInput !== selectedDatabase.id()) {
|
||||||
setFormError(
|
setFormError(
|
||||||
`Input ${getDatabaseName()} name "${databaseInput}" does not match the selected ${getDatabaseName()} "${selectedDatabase.id()}"`,
|
`Input database name "${databaseInput}" does not match the selected database "${selectedDatabase.id()}"`,
|
||||||
);
|
);
|
||||||
logConsoleError(`Error while deleting ${getDatabaseName()} ${selectedDatabase && selectedDatabase.id()}`);
|
logConsoleError(`Error while deleting collection ${selectedDatabase && selectedDatabase.id()}`);
|
||||||
logConsoleError(
|
logConsoleError(
|
||||||
`Input ${getDatabaseName()} name "${databaseInput}" does not match the selected ${getDatabaseName()} "${selectedDatabase.id()}"`,
|
`Input database name "${databaseInput}" does not match the selected database "${selectedDatabase.id()}"`,
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -124,18 +123,17 @@ export const DeleteDatabaseConfirmationPanel: FunctionComponent<DeleteDatabaseCo
|
|||||||
message:
|
message:
|
||||||
"Warning! The action you are about to take cannot be undone. Continuing will permanently delete this resource and all of its children resources.",
|
"Warning! The action you are about to take cannot be undone. Continuing will permanently delete this resource and all of its children resources.",
|
||||||
};
|
};
|
||||||
const confirmDatabase = `Confirm by typing the ${getDatabaseName()} id`;
|
const confirmDatabase = "Confirm by typing the database id";
|
||||||
const reasonInfo = `Help us improve Azure Cosmos DB! What is the reason why you are deleting this ${getDatabaseName()}?`;
|
const reasonInfo = "Help us improve Azure Cosmos DB! What is the reason why you are deleting this database?";
|
||||||
return (
|
return (
|
||||||
<RightPaneForm {...props}>
|
<RightPaneForm {...props}>
|
||||||
{!formError && <PanelInfoErrorComponent {...errorProps} />}
|
{!formError && <PanelInfoErrorComponent {...errorProps} />}
|
||||||
<div className="panelMainContent">
|
<div className="panelMainContent">
|
||||||
<div className="confirmDeleteInput">
|
<div className="confirmDeleteInput">
|
||||||
<span className="mandatoryStar">* </span>
|
<span className="mandatoryStar">* </span>
|
||||||
<Text variant="small">Confirm by typing the {getDatabaseName()} id</Text>
|
<Text variant="small">Confirm by typing the database id</Text>
|
||||||
<TextField
|
<TextField
|
||||||
id="confirmDatabaseId"
|
id="confirmDatabaseId"
|
||||||
data-test="Input:confirmDatabaseId"
|
|
||||||
autoFocus
|
autoFocus
|
||||||
styles={{ fieldGroup: { width: 300 } }}
|
styles={{ fieldGroup: { width: 300 } }}
|
||||||
onChange={(event, newInput?: string) => {
|
onChange={(event, newInput?: string) => {
|
||||||
@@ -151,7 +149,7 @@ export const DeleteDatabaseConfirmationPanel: FunctionComponent<DeleteDatabaseCo
|
|||||||
Help us improve Azure Cosmos DB!
|
Help us improve Azure Cosmos DB!
|
||||||
</Text>
|
</Text>
|
||||||
<Text variant="small" block>
|
<Text variant="small" block>
|
||||||
What is the reason why you are deleting this {getDatabaseName()}?
|
What is the reason why you are deleting this database?
|
||||||
</Text>
|
</Text>
|
||||||
<TextField
|
<TextField
|
||||||
id="deleteDatabaseFeedbackInput"
|
id="deleteDatabaseFeedbackInput"
|
||||||
|
|||||||
@@ -5312,7 +5312,6 @@ exports[`Excute Sproc Param Pane should render Default properly 1`] = `
|
|||||||
>
|
>
|
||||||
<CustomizedPrimaryButton
|
<CustomizedPrimaryButton
|
||||||
ariaLabel="Execute"
|
ariaLabel="Execute"
|
||||||
data-test="Panel/OkButton"
|
|
||||||
disabled={false}
|
disabled={false}
|
||||||
id="sidePanelOkButton"
|
id="sidePanelOkButton"
|
||||||
text="Execute"
|
text="Execute"
|
||||||
@@ -5320,7 +5319,6 @@ exports[`Excute Sproc Param Pane should render Default properly 1`] = `
|
|||||||
>
|
>
|
||||||
<PrimaryButton
|
<PrimaryButton
|
||||||
ariaLabel="Execute"
|
ariaLabel="Execute"
|
||||||
data-test="Panel/OkButton"
|
|
||||||
disabled={false}
|
disabled={false}
|
||||||
id="sidePanelOkButton"
|
id="sidePanelOkButton"
|
||||||
text="Execute"
|
text="Execute"
|
||||||
@@ -5601,7 +5599,6 @@ exports[`Excute Sproc Param Pane should render Default properly 1`] = `
|
|||||||
>
|
>
|
||||||
<CustomizedDefaultButton
|
<CustomizedDefaultButton
|
||||||
ariaLabel="Execute"
|
ariaLabel="Execute"
|
||||||
data-test="Panel/OkButton"
|
|
||||||
disabled={false}
|
disabled={false}
|
||||||
id="sidePanelOkButton"
|
id="sidePanelOkButton"
|
||||||
onRenderDescription={[Function]}
|
onRenderDescription={[Function]}
|
||||||
@@ -5884,7 +5881,6 @@ exports[`Excute Sproc Param Pane should render Default properly 1`] = `
|
|||||||
>
|
>
|
||||||
<DefaultButton
|
<DefaultButton
|
||||||
ariaLabel="Execute"
|
ariaLabel="Execute"
|
||||||
data-test="Panel/OkButton"
|
|
||||||
disabled={false}
|
disabled={false}
|
||||||
id="sidePanelOkButton"
|
id="sidePanelOkButton"
|
||||||
onRenderDescription={[Function]}
|
onRenderDescription={[Function]}
|
||||||
@@ -6168,7 +6164,6 @@ exports[`Excute Sproc Param Pane should render Default properly 1`] = `
|
|||||||
<BaseButton
|
<BaseButton
|
||||||
ariaLabel="Execute"
|
ariaLabel="Execute"
|
||||||
baseClassName="ms-Button"
|
baseClassName="ms-Button"
|
||||||
data-test="Panel/OkButton"
|
|
||||||
disabled={false}
|
disabled={false}
|
||||||
id="sidePanelOkButton"
|
id="sidePanelOkButton"
|
||||||
onRenderDescription={[Function]}
|
onRenderDescription={[Function]}
|
||||||
@@ -7043,7 +7038,6 @@ exports[`Excute Sproc Param Pane should render Default properly 1`] = `
|
|||||||
aria-label="Execute"
|
aria-label="Execute"
|
||||||
className="ms-Button ms-Button--primary root-148"
|
className="ms-Button ms-Button--primary root-148"
|
||||||
data-is-focusable={true}
|
data-is-focusable={true}
|
||||||
data-test="Panel/OkButton"
|
|
||||||
id="sidePanelOkButton"
|
id="sidePanelOkButton"
|
||||||
onClick={[Function]}
|
onClick={[Function]}
|
||||||
onKeyDown={[Function]}
|
onKeyDown={[Function]}
|
||||||
@@ -7079,11 +7073,6 @@ exports[`Excute Sproc Param Pane should render Default properly 1`] = `
|
|||||||
</div>
|
</div>
|
||||||
</PanelFooterComponent>
|
</PanelFooterComponent>
|
||||||
</form>
|
</form>
|
||||||
<span
|
|
||||||
className="screenReaderOnly"
|
|
||||||
id="screenReaderStatus"
|
|
||||||
role="status"
|
|
||||||
/>
|
|
||||||
</RightPaneForm>
|
</RightPaneForm>
|
||||||
</ExecuteSprocParamsPane>
|
</ExecuteSprocParamsPane>
|
||||||
`;
|
`;
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ exports[`GitHub Repos Panel should render Default properly 1`] = `
|
|||||||
Object {
|
Object {
|
||||||
"container": Explorer {
|
"container": Explorer {
|
||||||
"_isInitializingNotebooks": false,
|
"_isInitializingNotebooks": false,
|
||||||
|
"_resetNotebookWorkspace": [Function],
|
||||||
"isFixedCollectionWithSharedThroughputSupported": [Function],
|
"isFixedCollectionWithSharedThroughputSupported": [Function],
|
||||||
"isTabsContentExpanded": [Function],
|
"isTabsContentExpanded": [Function],
|
||||||
"onRefreshDatabasesKeyPress": [Function],
|
"onRefreshDatabasesKeyPress": [Function],
|
||||||
|
|||||||
@@ -48,13 +48,6 @@
|
|||||||
font-size: @mediumFontSize;
|
font-size: @mediumFontSize;
|
||||||
padding: 0 @LargeSpace 0 @SmallSpace;
|
padding: 0 @LargeSpace 0 @SmallSpace;
|
||||||
}
|
}
|
||||||
|
|
||||||
.panelSectionSpinner {
|
|
||||||
position: absolute;
|
|
||||||
top: 50%;
|
|
||||||
left: 50%;
|
|
||||||
transform: translate(-50%, -50%);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -53,13 +53,12 @@ export class PanelContainerComponent extends React.Component<PanelContainerProps
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Panel
|
<Panel
|
||||||
data-test={`Panel:${this.props.headerText}`}
|
|
||||||
headerText={this.props.headerText}
|
headerText={this.props.headerText}
|
||||||
isOpen={this.props.isOpen}
|
isOpen={this.props.isOpen}
|
||||||
onDismiss={this.onDissmiss}
|
onDismiss={this.onDissmiss}
|
||||||
isLightDismiss
|
isLightDismiss
|
||||||
type={PanelType.custom}
|
type={PanelType.custom}
|
||||||
closeButtonAriaLabel={`Close ${this.props.headerText}`}
|
closeButtonAriaLabel="Close"
|
||||||
customWidth={this.props.panelWidth ? this.props.panelWidth : "440px"}
|
customWidth={this.props.panelWidth ? this.props.panelWidth : "440px"}
|
||||||
headerClassName="panelHeader"
|
headerClassName="panelHeader"
|
||||||
onRenderNavigationContent={this.props.onRenderNavigationContent}
|
onRenderNavigationContent={this.props.onRenderNavigationContent}
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ export const PanelFooterComponent: React.FunctionComponent<PanelFooterProps> = (
|
|||||||
<PrimaryButton
|
<PrimaryButton
|
||||||
type="submit"
|
type="submit"
|
||||||
id="sidePanelOkButton"
|
id="sidePanelOkButton"
|
||||||
data-test="Panel/OkButton"
|
|
||||||
text={buttonLabel}
|
text={buttonLabel}
|
||||||
ariaLabel={buttonLabel}
|
ariaLabel={buttonLabel}
|
||||||
disabled={!!isButtonDisabled}
|
disabled={!!isButtonDisabled}
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ import React, { CSSProperties, FunctionComponent, ReactNode } from "react";
|
|||||||
import { PanelFooterComponent } from "../PanelFooterComponent";
|
import { PanelFooterComponent } from "../PanelFooterComponent";
|
||||||
import { PanelInfoErrorComponent } from "../PanelInfoErrorComponent";
|
import { PanelInfoErrorComponent } from "../PanelInfoErrorComponent";
|
||||||
import { PanelLoadingScreen } from "../PanelLoadingScreen";
|
import { PanelLoadingScreen } from "../PanelLoadingScreen";
|
||||||
import { labelToLoadingItemName } from "Explorer/Tables/Constants";
|
|
||||||
|
|
||||||
export interface RightPaneFormProps {
|
export interface RightPaneFormProps {
|
||||||
formError: string;
|
formError: string;
|
||||||
@@ -28,10 +27,6 @@ export const RightPaneForm: FunctionComponent<RightPaneFormProps> = ({
|
|||||||
const handleOnSubmit = (event: React.FormEvent<HTMLFormElement>) => {
|
const handleOnSubmit = (event: React.FormEvent<HTMLFormElement>) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
onSubmit();
|
onSubmit();
|
||||||
const screenReaderStatusElement = document.getElementById("screenReaderStatus");
|
|
||||||
if (screenReaderStatusElement) {
|
|
||||||
screenReaderStatusElement.innerHTML = labelToLoadingItemName[submitButtonText] || "Loading";
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -47,7 +42,6 @@ export const RightPaneForm: FunctionComponent<RightPaneFormProps> = ({
|
|||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</form>
|
</form>
|
||||||
<span role="status" className="screenReaderOnly" id="screenReaderStatus"></span>
|
|
||||||
{isExecuting && <PanelLoadingScreen />}
|
{isExecuting && <PanelLoadingScreen />}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ exports[`Right Pane Form should render Default properly 1`] = `
|
|||||||
>
|
>
|
||||||
<CustomizedPrimaryButton
|
<CustomizedPrimaryButton
|
||||||
ariaLabel="Load"
|
ariaLabel="Load"
|
||||||
data-test="Panel/OkButton"
|
|
||||||
disabled={false}
|
disabled={false}
|
||||||
id="sidePanelOkButton"
|
id="sidePanelOkButton"
|
||||||
text="Load"
|
text="Load"
|
||||||
@@ -29,7 +28,6 @@ exports[`Right Pane Form should render Default properly 1`] = `
|
|||||||
>
|
>
|
||||||
<PrimaryButton
|
<PrimaryButton
|
||||||
ariaLabel="Load"
|
ariaLabel="Load"
|
||||||
data-test="Panel/OkButton"
|
|
||||||
disabled={false}
|
disabled={false}
|
||||||
id="sidePanelOkButton"
|
id="sidePanelOkButton"
|
||||||
text="Load"
|
text="Load"
|
||||||
@@ -310,7 +308,6 @@ exports[`Right Pane Form should render Default properly 1`] = `
|
|||||||
>
|
>
|
||||||
<CustomizedDefaultButton
|
<CustomizedDefaultButton
|
||||||
ariaLabel="Load"
|
ariaLabel="Load"
|
||||||
data-test="Panel/OkButton"
|
|
||||||
disabled={false}
|
disabled={false}
|
||||||
id="sidePanelOkButton"
|
id="sidePanelOkButton"
|
||||||
onRenderDescription={[Function]}
|
onRenderDescription={[Function]}
|
||||||
@@ -593,7 +590,6 @@ exports[`Right Pane Form should render Default properly 1`] = `
|
|||||||
>
|
>
|
||||||
<DefaultButton
|
<DefaultButton
|
||||||
ariaLabel="Load"
|
ariaLabel="Load"
|
||||||
data-test="Panel/OkButton"
|
|
||||||
disabled={false}
|
disabled={false}
|
||||||
id="sidePanelOkButton"
|
id="sidePanelOkButton"
|
||||||
onRenderDescription={[Function]}
|
onRenderDescription={[Function]}
|
||||||
@@ -877,7 +873,6 @@ exports[`Right Pane Form should render Default properly 1`] = `
|
|||||||
<BaseButton
|
<BaseButton
|
||||||
ariaLabel="Load"
|
ariaLabel="Load"
|
||||||
baseClassName="ms-Button"
|
baseClassName="ms-Button"
|
||||||
data-test="Panel/OkButton"
|
|
||||||
disabled={false}
|
disabled={false}
|
||||||
id="sidePanelOkButton"
|
id="sidePanelOkButton"
|
||||||
onRenderDescription={[Function]}
|
onRenderDescription={[Function]}
|
||||||
@@ -1752,7 +1747,6 @@ exports[`Right Pane Form should render Default properly 1`] = `
|
|||||||
aria-label="Load"
|
aria-label="Load"
|
||||||
className="ms-Button ms-Button--primary root-109"
|
className="ms-Button ms-Button--primary root-109"
|
||||||
data-is-focusable={true}
|
data-is-focusable={true}
|
||||||
data-test="Panel/OkButton"
|
|
||||||
id="sidePanelOkButton"
|
id="sidePanelOkButton"
|
||||||
onClick={[Function]}
|
onClick={[Function]}
|
||||||
onKeyDown={[Function]}
|
onKeyDown={[Function]}
|
||||||
@@ -1788,10 +1782,5 @@ exports[`Right Pane Form should render Default properly 1`] = `
|
|||||||
</div>
|
</div>
|
||||||
</PanelFooterComponent>
|
</PanelFooterComponent>
|
||||||
</form>
|
</form>
|
||||||
<span
|
|
||||||
className="screenReaderOnly"
|
|
||||||
id="screenReaderStatus"
|
|
||||||
role="status"
|
|
||||||
/>
|
|
||||||
</RightPaneForm>
|
</RightPaneForm>
|
||||||
`;
|
`;
|
||||||
|
|||||||
@@ -9,15 +9,12 @@ import {
|
|||||||
Toggle,
|
Toggle,
|
||||||
} from "@fluentui/react";
|
} from "@fluentui/react";
|
||||||
import * as Constants from "Common/Constants";
|
import * as Constants from "Common/Constants";
|
||||||
import { SplitterDirection } from "Common/Splitter";
|
|
||||||
import { InfoTooltip } from "Common/Tooltip/InfoTooltip";
|
import { InfoTooltip } from "Common/Tooltip/InfoTooltip";
|
||||||
import { configContext } from "ConfigContext";
|
import { configContext } from "ConfigContext";
|
||||||
import { useDatabases } from "Explorer/useDatabases";
|
|
||||||
import {
|
import {
|
||||||
DefaultRUThreshold,
|
DefaultRUThreshold,
|
||||||
LocalStorageUtility,
|
LocalStorageUtility,
|
||||||
StorageKey,
|
StorageKey,
|
||||||
getDefaultQueryResultsView,
|
|
||||||
getRUThreshold,
|
getRUThreshold,
|
||||||
ruThresholdEnabled as isRUThresholdEnabled,
|
ruThresholdEnabled as isRUThresholdEnabled,
|
||||||
} from "Shared/StorageUtility";
|
} from "Shared/StorageUtility";
|
||||||
@@ -50,9 +47,6 @@ export const SettingsPane: FunctionComponent<{ explorer: Explorer }> = ({
|
|||||||
LocalStorageUtility.getEntryBoolean(StorageKey.QueryTimeoutEnabled),
|
LocalStorageUtility.getEntryBoolean(StorageKey.QueryTimeoutEnabled),
|
||||||
);
|
);
|
||||||
const [queryTimeout, setQueryTimeout] = useState<number>(LocalStorageUtility.getEntryNumber(StorageKey.QueryTimeout));
|
const [queryTimeout, setQueryTimeout] = useState<number>(LocalStorageUtility.getEntryNumber(StorageKey.QueryTimeout));
|
||||||
const [defaultQueryResultsView, setDefaultQueryResultsView] = useState<SplitterDirection>(
|
|
||||||
getDefaultQueryResultsView(),
|
|
||||||
);
|
|
||||||
const [automaticallyCancelQueryAfterTimeout, setAutomaticallyCancelQueryAfterTimeout] = useState<boolean>(
|
const [automaticallyCancelQueryAfterTimeout, setAutomaticallyCancelQueryAfterTimeout] = useState<boolean>(
|
||||||
LocalStorageUtility.getEntryBoolean(StorageKey.AutomaticallyCancelQueryAfterTimeout),
|
LocalStorageUtility.getEntryBoolean(StorageKey.AutomaticallyCancelQueryAfterTimeout),
|
||||||
);
|
);
|
||||||
@@ -108,10 +102,7 @@ export const SettingsPane: FunctionComponent<{ explorer: Explorer }> = ({
|
|||||||
const shouldShowCrossPartitionOption = userContext.apiType !== "Gremlin";
|
const shouldShowCrossPartitionOption = userContext.apiType !== "Gremlin";
|
||||||
const shouldShowParallelismOption = userContext.apiType !== "Gremlin";
|
const shouldShowParallelismOption = userContext.apiType !== "Gremlin";
|
||||||
const shouldShowPriorityLevelOption = PriorityBasedExecutionUtils.isFeatureEnabled();
|
const shouldShowPriorityLevelOption = PriorityBasedExecutionUtils.isFeatureEnabled();
|
||||||
const shouldShowCopilotSampleDBOption =
|
const shouldShowCopilotSampleDBOption = userContext.apiType === "SQL" && useQueryCopilot.getState().copilotEnabled;
|
||||||
userContext.apiType === "SQL" &&
|
|
||||||
useQueryCopilot.getState().copilotEnabled &&
|
|
||||||
useDatabases.getState().sampleDataResourceTokenCollection;
|
|
||||||
const handlerOnSubmit = async () => {
|
const handlerOnSubmit = async () => {
|
||||||
setIsExecuting(true);
|
setIsExecuting(true);
|
||||||
|
|
||||||
@@ -130,7 +121,6 @@ export const SettingsPane: FunctionComponent<{ explorer: Explorer }> = ({
|
|||||||
LocalStorageUtility.setEntryNumber(StorageKey.MaxDegreeOfParellism, maxDegreeOfParallelism);
|
LocalStorageUtility.setEntryNumber(StorageKey.MaxDegreeOfParellism, maxDegreeOfParallelism);
|
||||||
LocalStorageUtility.setEntryString(StorageKey.PriorityLevel, priorityLevel.toString());
|
LocalStorageUtility.setEntryString(StorageKey.PriorityLevel, priorityLevel.toString());
|
||||||
LocalStorageUtility.setEntryString(StorageKey.CopilotSampleDBEnabled, copilotSampleDBEnabled.toString());
|
LocalStorageUtility.setEntryString(StorageKey.CopilotSampleDBEnabled, copilotSampleDBEnabled.toString());
|
||||||
LocalStorageUtility.setEntryString(StorageKey.DefaultQueryResultsView, defaultQueryResultsView);
|
|
||||||
|
|
||||||
if (shouldShowGraphAutoVizOption) {
|
if (shouldShowGraphAutoVizOption) {
|
||||||
LocalStorageUtility.setEntryBoolean(
|
LocalStorageUtility.setEntryBoolean(
|
||||||
@@ -207,11 +197,6 @@ export const SettingsPane: FunctionComponent<{ explorer: Explorer }> = ({
|
|||||||
{ key: Constants.PriorityLevel.High, text: "High" },
|
{ key: Constants.PriorityLevel.High, text: "High" },
|
||||||
];
|
];
|
||||||
|
|
||||||
const defaultQueryResultsViewOptionList: IChoiceGroupOption[] = [
|
|
||||||
{ key: SplitterDirection.Vertical, text: "Vertical" },
|
|
||||||
{ key: SplitterDirection.Horizontal, text: "Horizontal" },
|
|
||||||
];
|
|
||||||
|
|
||||||
const handleOnPriorityLevelOptionChange = (
|
const handleOnPriorityLevelOptionChange = (
|
||||||
ev: React.FormEvent<HTMLInputElement>,
|
ev: React.FormEvent<HTMLInputElement>,
|
||||||
option: IChoiceGroupOption,
|
option: IChoiceGroupOption,
|
||||||
@@ -249,13 +234,6 @@ export const SettingsPane: FunctionComponent<{ explorer: Explorer }> = ({
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleOnDefaultQueryResultsViewChange = (
|
|
||||||
ev: React.MouseEvent<HTMLElement>,
|
|
||||||
option: IChoiceGroupOption,
|
|
||||||
): void => {
|
|
||||||
setDefaultQueryResultsView(option.key as SplitterDirection);
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleOnQueryRetryAttemptsSpinButtonChange = (ev: React.MouseEvent<HTMLElement>, newValue?: string): void => {
|
const handleOnQueryRetryAttemptsSpinButtonChange = (ev: React.MouseEvent<HTMLElement>, newValue?: string): void => {
|
||||||
const retryAttempts = Number(newValue);
|
const retryAttempts = Number(newValue);
|
||||||
if (!isNaN(retryAttempts)) {
|
if (!isNaN(retryAttempts)) {
|
||||||
@@ -460,25 +438,6 @@ export const SettingsPane: FunctionComponent<{ explorer: Explorer }> = ({
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="settingsSection">
|
|
||||||
<div className="settingsSectionPart">
|
|
||||||
<div>
|
|
||||||
<legend id="defaultQueryResultsView" className="settingsSectionLabel legendLabel">
|
|
||||||
Default Query Results View
|
|
||||||
</legend>
|
|
||||||
<InfoTooltip>Select the default view to use when displaying query results.</InfoTooltip>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<ChoiceGroup
|
|
||||||
ariaLabelledBy="defaultQueryResultsView"
|
|
||||||
selectedKey={defaultQueryResultsView}
|
|
||||||
options={defaultQueryResultsViewOptionList}
|
|
||||||
styles={choiceButtonStyles}
|
|
||||||
onChange={handleOnDefaultQueryResultsViewChange}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
<div className="settingsSection">
|
<div className="settingsSection">
|
||||||
@@ -671,7 +630,7 @@ export const SettingsPane: FunctionComponent<{ explorer: Explorer }> = ({
|
|||||||
Enable sample database
|
Enable sample database
|
||||||
<InfoTooltip>
|
<InfoTooltip>
|
||||||
This is a sample database and collection with synthetic product data you can use to explore using
|
This is a sample database and collection with synthetic product data you can use to explore using
|
||||||
NoSQL queries and Query Advisor. This will appear as another database in the Data Explorer UI, and is
|
NoSQL queries and Copilot. This will appear as another database in the Data Explorer UI, and is
|
||||||
created by, and maintained by Microsoft at no cost to you.
|
created by, and maintained by Microsoft at no cost to you.
|
||||||
</InfoTooltip>
|
</InfoTooltip>
|
||||||
</div>
|
</div>
|
||||||
@@ -681,7 +640,7 @@ export const SettingsPane: FunctionComponent<{ explorer: Explorer }> = ({
|
|||||||
label: { padding: 0 },
|
label: { padding: 0 },
|
||||||
}}
|
}}
|
||||||
className="padding"
|
className="padding"
|
||||||
ariaLabel="Enable sample db for Query Advisor"
|
ariaLabel="Enable sample db for Copilot"
|
||||||
checked={copilotSampleDBEnabled}
|
checked={copilotSampleDBEnabled}
|
||||||
onChange={handleSampleDatabaseChange}
|
onChange={handleSampleDatabaseChange}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -205,67 +205,6 @@ exports[`Settings Pane should render Default properly 1`] = `
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div
|
|
||||||
className="settingsSection"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
className="settingsSectionPart"
|
|
||||||
>
|
|
||||||
<div>
|
|
||||||
<legend
|
|
||||||
className="settingsSectionLabel legendLabel"
|
|
||||||
id="defaultQueryResultsView"
|
|
||||||
>
|
|
||||||
Default Query Results View
|
|
||||||
</legend>
|
|
||||||
<InfoTooltip>
|
|
||||||
Select the default view to use when displaying query results.
|
|
||||||
</InfoTooltip>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<StyledChoiceGroup
|
|
||||||
ariaLabelledBy="defaultQueryResultsView"
|
|
||||||
onChange={[Function]}
|
|
||||||
options={
|
|
||||||
Array [
|
|
||||||
Object {
|
|
||||||
"key": "vertical",
|
|
||||||
"text": "Vertical",
|
|
||||||
},
|
|
||||||
Object {
|
|
||||||
"key": "horizontal",
|
|
||||||
"text": "Horizontal",
|
|
||||||
},
|
|
||||||
]
|
|
||||||
}
|
|
||||||
selectedKey="vertical"
|
|
||||||
styles={
|
|
||||||
Object {
|
|
||||||
"flexContainer": Array [
|
|
||||||
Object {
|
|
||||||
"selectors": Object {
|
|
||||||
".ms-ChoiceField": Object {
|
|
||||||
"marginTop": 0,
|
|
||||||
},
|
|
||||||
".ms-ChoiceField-wrapper label": Object {
|
|
||||||
"fontSize": 12,
|
|
||||||
"paddingTop": 0,
|
|
||||||
},
|
|
||||||
".ms-ChoiceFieldGroup root-133": Object {
|
|
||||||
"clear": "both",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
"root": Object {
|
|
||||||
"clear": "both",
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div
|
<div
|
||||||
className="settingsSection"
|
className="settingsSection"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ exports[`StringInput Pane should render Create new directory properly 1`] = `
|
|||||||
explorer={
|
explorer={
|
||||||
Explorer {
|
Explorer {
|
||||||
"_isInitializingNotebooks": false,
|
"_isInitializingNotebooks": false,
|
||||||
|
"_resetNotebookWorkspace": [Function],
|
||||||
"isFixedCollectionWithSharedThroughputSupported": [Function],
|
"isFixedCollectionWithSharedThroughputSupported": [Function],
|
||||||
"isTabsContentExpanded": [Function],
|
"isTabsContentExpanded": [Function],
|
||||||
"onRefreshDatabasesKeyPress": [Function],
|
"onRefreshDatabasesKeyPress": [Function],
|
||||||
@@ -688,7 +689,6 @@ exports[`StringInput Pane should render Create new directory properly 1`] = `
|
|||||||
>
|
>
|
||||||
<CustomizedPrimaryButton
|
<CustomizedPrimaryButton
|
||||||
ariaLabel="Create"
|
ariaLabel="Create"
|
||||||
data-test="Panel/OkButton"
|
|
||||||
disabled={false}
|
disabled={false}
|
||||||
id="sidePanelOkButton"
|
id="sidePanelOkButton"
|
||||||
text="Create"
|
text="Create"
|
||||||
@@ -696,7 +696,6 @@ exports[`StringInput Pane should render Create new directory properly 1`] = `
|
|||||||
>
|
>
|
||||||
<PrimaryButton
|
<PrimaryButton
|
||||||
ariaLabel="Create"
|
ariaLabel="Create"
|
||||||
data-test="Panel/OkButton"
|
|
||||||
disabled={false}
|
disabled={false}
|
||||||
id="sidePanelOkButton"
|
id="sidePanelOkButton"
|
||||||
text="Create"
|
text="Create"
|
||||||
@@ -977,7 +976,6 @@ exports[`StringInput Pane should render Create new directory properly 1`] = `
|
|||||||
>
|
>
|
||||||
<CustomizedDefaultButton
|
<CustomizedDefaultButton
|
||||||
ariaLabel="Create"
|
ariaLabel="Create"
|
||||||
data-test="Panel/OkButton"
|
|
||||||
disabled={false}
|
disabled={false}
|
||||||
id="sidePanelOkButton"
|
id="sidePanelOkButton"
|
||||||
onRenderDescription={[Function]}
|
onRenderDescription={[Function]}
|
||||||
@@ -1260,7 +1258,6 @@ exports[`StringInput Pane should render Create new directory properly 1`] = `
|
|||||||
>
|
>
|
||||||
<DefaultButton
|
<DefaultButton
|
||||||
ariaLabel="Create"
|
ariaLabel="Create"
|
||||||
data-test="Panel/OkButton"
|
|
||||||
disabled={false}
|
disabled={false}
|
||||||
id="sidePanelOkButton"
|
id="sidePanelOkButton"
|
||||||
onRenderDescription={[Function]}
|
onRenderDescription={[Function]}
|
||||||
@@ -1544,7 +1541,6 @@ exports[`StringInput Pane should render Create new directory properly 1`] = `
|
|||||||
<BaseButton
|
<BaseButton
|
||||||
ariaLabel="Create"
|
ariaLabel="Create"
|
||||||
baseClassName="ms-Button"
|
baseClassName="ms-Button"
|
||||||
data-test="Panel/OkButton"
|
|
||||||
disabled={false}
|
disabled={false}
|
||||||
id="sidePanelOkButton"
|
id="sidePanelOkButton"
|
||||||
onRenderDescription={[Function]}
|
onRenderDescription={[Function]}
|
||||||
@@ -2419,7 +2415,6 @@ exports[`StringInput Pane should render Create new directory properly 1`] = `
|
|||||||
aria-label="Create"
|
aria-label="Create"
|
||||||
className="ms-Button ms-Button--primary root-122"
|
className="ms-Button ms-Button--primary root-122"
|
||||||
data-is-focusable={true}
|
data-is-focusable={true}
|
||||||
data-test="Panel/OkButton"
|
|
||||||
id="sidePanelOkButton"
|
id="sidePanelOkButton"
|
||||||
onClick={[Function]}
|
onClick={[Function]}
|
||||||
onKeyDown={[Function]}
|
onKeyDown={[Function]}
|
||||||
@@ -2455,11 +2450,6 @@ exports[`StringInput Pane should render Create new directory properly 1`] = `
|
|||||||
</div>
|
</div>
|
||||||
</PanelFooterComponent>
|
</PanelFooterComponent>
|
||||||
</form>
|
</form>
|
||||||
<span
|
|
||||||
className="screenReaderOnly"
|
|
||||||
id="screenReaderStatus"
|
|
||||||
role="status"
|
|
||||||
/>
|
|
||||||
</RightPaneForm>
|
</RightPaneForm>
|
||||||
</StringInputPane>
|
</StringInputPane>
|
||||||
`;
|
`;
|
||||||
|
|||||||
@@ -124,8 +124,8 @@ export const AddTableEntityPanel: FunctionComponent<AddTableEntityPanelProps> =
|
|||||||
|
|
||||||
setIsExecuting(true);
|
setIsExecuting(true);
|
||||||
const entity: Entities.ITableEntity = entityFromAttributes(entities);
|
const entity: Entities.ITableEntity = entityFromAttributes(entities);
|
||||||
try {
|
|
||||||
const newEntity: Entities.ITableEntity = await tableDataClient.createDocument(queryTablesTab.collection, entity);
|
const newEntity: Entities.ITableEntity = await tableDataClient.createDocument(queryTablesTab.collection, entity);
|
||||||
|
try {
|
||||||
await tableEntityListViewModel.addEntityToCache(newEntity);
|
await tableEntityListViewModel.addEntityToCache(newEntity);
|
||||||
if (!tryInsertNewHeaders(tableEntityListViewModel, newEntity)) {
|
if (!tryInsertNewHeaders(tableEntityListViewModel, newEntity)) {
|
||||||
tableEntityListViewModel.redrawTableThrottled();
|
tableEntityListViewModel.redrawTableThrottled();
|
||||||
@@ -261,7 +261,6 @@ export const AddTableEntityPanel: FunctionComponent<AddTableEntityPanelProps> =
|
|||||||
<TextField
|
<TextField
|
||||||
multiline
|
multiline
|
||||||
rows={5}
|
rows={5}
|
||||||
ariaLabel={entityAttributeProperty}
|
|
||||||
value={entityAttributeValue}
|
value={entityAttributeValue}
|
||||||
onChange={(event, newInput?: string) => {
|
onChange={(event, newInput?: string) => {
|
||||||
entityChange(newInput, selectedRow, "value");
|
entityChange(newInput, selectedRow, "value");
|
||||||
|
|||||||
@@ -1258,7 +1258,6 @@ exports[`Table query select Panel should render Default properly 1`] = `
|
|||||||
>
|
>
|
||||||
<CustomizedPrimaryButton
|
<CustomizedPrimaryButton
|
||||||
ariaLabel="OK"
|
ariaLabel="OK"
|
||||||
data-test="Panel/OkButton"
|
|
||||||
disabled={false}
|
disabled={false}
|
||||||
id="sidePanelOkButton"
|
id="sidePanelOkButton"
|
||||||
text="OK"
|
text="OK"
|
||||||
@@ -1266,7 +1265,6 @@ exports[`Table query select Panel should render Default properly 1`] = `
|
|||||||
>
|
>
|
||||||
<PrimaryButton
|
<PrimaryButton
|
||||||
ariaLabel="OK"
|
ariaLabel="OK"
|
||||||
data-test="Panel/OkButton"
|
|
||||||
disabled={false}
|
disabled={false}
|
||||||
id="sidePanelOkButton"
|
id="sidePanelOkButton"
|
||||||
text="OK"
|
text="OK"
|
||||||
@@ -1547,7 +1545,6 @@ exports[`Table query select Panel should render Default properly 1`] = `
|
|||||||
>
|
>
|
||||||
<CustomizedDefaultButton
|
<CustomizedDefaultButton
|
||||||
ariaLabel="OK"
|
ariaLabel="OK"
|
||||||
data-test="Panel/OkButton"
|
|
||||||
disabled={false}
|
disabled={false}
|
||||||
id="sidePanelOkButton"
|
id="sidePanelOkButton"
|
||||||
onRenderDescription={[Function]}
|
onRenderDescription={[Function]}
|
||||||
@@ -1830,7 +1827,6 @@ exports[`Table query select Panel should render Default properly 1`] = `
|
|||||||
>
|
>
|
||||||
<DefaultButton
|
<DefaultButton
|
||||||
ariaLabel="OK"
|
ariaLabel="OK"
|
||||||
data-test="Panel/OkButton"
|
|
||||||
disabled={false}
|
disabled={false}
|
||||||
id="sidePanelOkButton"
|
id="sidePanelOkButton"
|
||||||
onRenderDescription={[Function]}
|
onRenderDescription={[Function]}
|
||||||
@@ -2114,7 +2110,6 @@ exports[`Table query select Panel should render Default properly 1`] = `
|
|||||||
<BaseButton
|
<BaseButton
|
||||||
ariaLabel="OK"
|
ariaLabel="OK"
|
||||||
baseClassName="ms-Button"
|
baseClassName="ms-Button"
|
||||||
data-test="Panel/OkButton"
|
|
||||||
disabled={false}
|
disabled={false}
|
||||||
id="sidePanelOkButton"
|
id="sidePanelOkButton"
|
||||||
onRenderDescription={[Function]}
|
onRenderDescription={[Function]}
|
||||||
@@ -2989,7 +2984,6 @@ exports[`Table query select Panel should render Default properly 1`] = `
|
|||||||
aria-label="OK"
|
aria-label="OK"
|
||||||
className="ms-Button ms-Button--primary root-125"
|
className="ms-Button ms-Button--primary root-125"
|
||||||
data-is-focusable={true}
|
data-is-focusable={true}
|
||||||
data-test="Panel/OkButton"
|
|
||||||
id="sidePanelOkButton"
|
id="sidePanelOkButton"
|
||||||
onClick={[Function]}
|
onClick={[Function]}
|
||||||
onKeyDown={[Function]}
|
onKeyDown={[Function]}
|
||||||
@@ -3025,11 +3019,6 @@ exports[`Table query select Panel should render Default properly 1`] = `
|
|||||||
</div>
|
</div>
|
||||||
</PanelFooterComponent>
|
</PanelFooterComponent>
|
||||||
</form>
|
</form>
|
||||||
<span
|
|
||||||
className="screenReaderOnly"
|
|
||||||
id="screenReaderStatus"
|
|
||||||
role="status"
|
|
||||||
/>
|
|
||||||
</RightPaneForm>
|
</RightPaneForm>
|
||||||
</TableQuerySelectPanel>
|
</TableQuerySelectPanel>
|
||||||
`;
|
`;
|
||||||
|
|||||||
@@ -369,7 +369,6 @@ exports[`Excute Add Table Entity Pane should render Default properly 1`] = `
|
|||||||
>
|
>
|
||||||
<CustomizedPrimaryButton
|
<CustomizedPrimaryButton
|
||||||
ariaLabel="Add Entity"
|
ariaLabel="Add Entity"
|
||||||
data-test="Panel/OkButton"
|
|
||||||
disabled={false}
|
disabled={false}
|
||||||
id="sidePanelOkButton"
|
id="sidePanelOkButton"
|
||||||
text="Add Entity"
|
text="Add Entity"
|
||||||
@@ -377,7 +376,6 @@ exports[`Excute Add Table Entity Pane should render Default properly 1`] = `
|
|||||||
>
|
>
|
||||||
<PrimaryButton
|
<PrimaryButton
|
||||||
ariaLabel="Add Entity"
|
ariaLabel="Add Entity"
|
||||||
data-test="Panel/OkButton"
|
|
||||||
disabled={false}
|
disabled={false}
|
||||||
id="sidePanelOkButton"
|
id="sidePanelOkButton"
|
||||||
text="Add Entity"
|
text="Add Entity"
|
||||||
@@ -658,7 +656,6 @@ exports[`Excute Add Table Entity Pane should render Default properly 1`] = `
|
|||||||
>
|
>
|
||||||
<CustomizedDefaultButton
|
<CustomizedDefaultButton
|
||||||
ariaLabel="Add Entity"
|
ariaLabel="Add Entity"
|
||||||
data-test="Panel/OkButton"
|
|
||||||
disabled={false}
|
disabled={false}
|
||||||
id="sidePanelOkButton"
|
id="sidePanelOkButton"
|
||||||
onRenderDescription={[Function]}
|
onRenderDescription={[Function]}
|
||||||
@@ -941,7 +938,6 @@ exports[`Excute Add Table Entity Pane should render Default properly 1`] = `
|
|||||||
>
|
>
|
||||||
<DefaultButton
|
<DefaultButton
|
||||||
ariaLabel="Add Entity"
|
ariaLabel="Add Entity"
|
||||||
data-test="Panel/OkButton"
|
|
||||||
disabled={false}
|
disabled={false}
|
||||||
id="sidePanelOkButton"
|
id="sidePanelOkButton"
|
||||||
onRenderDescription={[Function]}
|
onRenderDescription={[Function]}
|
||||||
@@ -1225,7 +1221,6 @@ exports[`Excute Add Table Entity Pane should render Default properly 1`] = `
|
|||||||
<BaseButton
|
<BaseButton
|
||||||
ariaLabel="Add Entity"
|
ariaLabel="Add Entity"
|
||||||
baseClassName="ms-Button"
|
baseClassName="ms-Button"
|
||||||
data-test="Panel/OkButton"
|
|
||||||
disabled={false}
|
disabled={false}
|
||||||
id="sidePanelOkButton"
|
id="sidePanelOkButton"
|
||||||
onRenderDescription={[Function]}
|
onRenderDescription={[Function]}
|
||||||
@@ -2100,7 +2095,6 @@ exports[`Excute Add Table Entity Pane should render Default properly 1`] = `
|
|||||||
aria-label="Add Entity"
|
aria-label="Add Entity"
|
||||||
className="ms-Button ms-Button--primary root-113"
|
className="ms-Button ms-Button--primary root-113"
|
||||||
data-is-focusable={true}
|
data-is-focusable={true}
|
||||||
data-test="Panel/OkButton"
|
|
||||||
id="sidePanelOkButton"
|
id="sidePanelOkButton"
|
||||||
onClick={[Function]}
|
onClick={[Function]}
|
||||||
onKeyDown={[Function]}
|
onKeyDown={[Function]}
|
||||||
@@ -2136,11 +2130,6 @@ exports[`Excute Add Table Entity Pane should render Default properly 1`] = `
|
|||||||
</div>
|
</div>
|
||||||
</PanelFooterComponent>
|
</PanelFooterComponent>
|
||||||
</form>
|
</form>
|
||||||
<span
|
|
||||||
className="screenReaderOnly"
|
|
||||||
id="screenReaderStatus"
|
|
||||||
role="status"
|
|
||||||
/>
|
|
||||||
</RightPaneForm>
|
</RightPaneForm>
|
||||||
</AddTableEntityPanel>
|
</AddTableEntityPanel>
|
||||||
`;
|
`;
|
||||||
|
|||||||
@@ -375,7 +375,6 @@ exports[`Excute Edit Table Entity Pane should render Default properly 1`] = `
|
|||||||
>
|
>
|
||||||
<CustomizedPrimaryButton
|
<CustomizedPrimaryButton
|
||||||
ariaLabel="Update"
|
ariaLabel="Update"
|
||||||
data-test="Panel/OkButton"
|
|
||||||
disabled={false}
|
disabled={false}
|
||||||
id="sidePanelOkButton"
|
id="sidePanelOkButton"
|
||||||
text="Update"
|
text="Update"
|
||||||
@@ -383,7 +382,6 @@ exports[`Excute Edit Table Entity Pane should render Default properly 1`] = `
|
|||||||
>
|
>
|
||||||
<PrimaryButton
|
<PrimaryButton
|
||||||
ariaLabel="Update"
|
ariaLabel="Update"
|
||||||
data-test="Panel/OkButton"
|
|
||||||
disabled={false}
|
disabled={false}
|
||||||
id="sidePanelOkButton"
|
id="sidePanelOkButton"
|
||||||
text="Update"
|
text="Update"
|
||||||
@@ -664,7 +662,6 @@ exports[`Excute Edit Table Entity Pane should render Default properly 1`] = `
|
|||||||
>
|
>
|
||||||
<CustomizedDefaultButton
|
<CustomizedDefaultButton
|
||||||
ariaLabel="Update"
|
ariaLabel="Update"
|
||||||
data-test="Panel/OkButton"
|
|
||||||
disabled={false}
|
disabled={false}
|
||||||
id="sidePanelOkButton"
|
id="sidePanelOkButton"
|
||||||
onRenderDescription={[Function]}
|
onRenderDescription={[Function]}
|
||||||
@@ -947,7 +944,6 @@ exports[`Excute Edit Table Entity Pane should render Default properly 1`] = `
|
|||||||
>
|
>
|
||||||
<DefaultButton
|
<DefaultButton
|
||||||
ariaLabel="Update"
|
ariaLabel="Update"
|
||||||
data-test="Panel/OkButton"
|
|
||||||
disabled={false}
|
disabled={false}
|
||||||
id="sidePanelOkButton"
|
id="sidePanelOkButton"
|
||||||
onRenderDescription={[Function]}
|
onRenderDescription={[Function]}
|
||||||
@@ -1231,7 +1227,6 @@ exports[`Excute Edit Table Entity Pane should render Default properly 1`] = `
|
|||||||
<BaseButton
|
<BaseButton
|
||||||
ariaLabel="Update"
|
ariaLabel="Update"
|
||||||
baseClassName="ms-Button"
|
baseClassName="ms-Button"
|
||||||
data-test="Panel/OkButton"
|
|
||||||
disabled={false}
|
disabled={false}
|
||||||
id="sidePanelOkButton"
|
id="sidePanelOkButton"
|
||||||
onRenderDescription={[Function]}
|
onRenderDescription={[Function]}
|
||||||
@@ -2106,7 +2101,6 @@ exports[`Excute Edit Table Entity Pane should render Default properly 1`] = `
|
|||||||
aria-label="Update"
|
aria-label="Update"
|
||||||
className="ms-Button ms-Button--primary root-113"
|
className="ms-Button ms-Button--primary root-113"
|
||||||
data-is-focusable={true}
|
data-is-focusable={true}
|
||||||
data-test="Panel/OkButton"
|
|
||||||
id="sidePanelOkButton"
|
id="sidePanelOkButton"
|
||||||
onClick={[Function]}
|
onClick={[Function]}
|
||||||
onKeyDown={[Function]}
|
onKeyDown={[Function]}
|
||||||
@@ -2142,11 +2136,6 @@ exports[`Excute Edit Table Entity Pane should render Default properly 1`] = `
|
|||||||
</div>
|
</div>
|
||||||
</PanelFooterComponent>
|
</PanelFooterComponent>
|
||||||
</form>
|
</form>
|
||||||
<span
|
|
||||||
className="screenReaderOnly"
|
|
||||||
id="screenReaderStatus"
|
|
||||||
role="status"
|
|
||||||
/>
|
|
||||||
</RightPaneForm>
|
</RightPaneForm>
|
||||||
</EditTableEntityPanel>
|
</EditTableEntityPanel>
|
||||||
`;
|
`;
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user