mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-24 19:31:36 +00:00
Compare commits
4 Commits
Remove-Exp
...
users/srna
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9e8793d1b1 | ||
|
|
f41de718a0 | ||
|
|
5820afc25a | ||
|
|
6d94f18f9a |
@@ -3,13 +3,7 @@ PORTAL_RUNNER_PASSWORD=
|
|||||||
PORTAL_RUNNER_SUBSCRIPTION=
|
PORTAL_RUNNER_SUBSCRIPTION=
|
||||||
PORTAL_RUNNER_RESOURCE_GROUP=
|
PORTAL_RUNNER_RESOURCE_GROUP=
|
||||||
PORTAL_RUNNER_DATABASE_ACCOUNT=
|
PORTAL_RUNNER_DATABASE_ACCOUNT=
|
||||||
PORTAL_RUNNER_DATABASE_ACCOUNT_KEY=
|
|
||||||
PORTAL_RUNNER_MONGO_DATABASE_ACCOUNT=
|
|
||||||
PORTAL_RUNNER_MONGO_DATABASE_ACCOUNT_KEY=
|
|
||||||
PORTAL_RUNNER_CONNECTION_STRING=
|
PORTAL_RUNNER_CONNECTION_STRING=
|
||||||
NOTEBOOKS_TEST_RUNNER_TENANT_ID=
|
|
||||||
NOTEBOOKS_TEST_RUNNER_CLIENT_ID=
|
|
||||||
NOTEBOOKS_TEST_RUNNER_CLIENT_SECRET=
|
|
||||||
CASSANDRA_CONNECTION_STRING=
|
CASSANDRA_CONNECTION_STRING=
|
||||||
MONGO_CONNECTION_STRING=
|
MONGO_CONNECTION_STRING=
|
||||||
TABLES_CONNECTION_STRING=
|
TABLES_CONNECTION_STRING=
|
||||||
|
|||||||
@@ -11,9 +11,16 @@ src/Common/CosmosClient.test.ts
|
|||||||
src/Common/CosmosClient.ts
|
src/Common/CosmosClient.ts
|
||||||
src/Common/DataAccessUtilityBase.test.ts
|
src/Common/DataAccessUtilityBase.test.ts
|
||||||
src/Common/DataAccessUtilityBase.ts
|
src/Common/DataAccessUtilityBase.ts
|
||||||
|
src/Common/DeleteFeedback.ts
|
||||||
|
src/Common/DocumentClientUtilityBase.ts
|
||||||
src/Common/EditableUtility.ts
|
src/Common/EditableUtility.ts
|
||||||
|
src/Common/EnvironmentUtility.ts
|
||||||
src/Common/HashMap.test.ts
|
src/Common/HashMap.test.ts
|
||||||
src/Common/HashMap.ts
|
src/Common/HashMap.ts
|
||||||
|
src/Common/HeadersUtility.test.ts
|
||||||
|
src/Common/HeadersUtility.ts
|
||||||
|
src/Common/IteratorUtilities.test.ts
|
||||||
|
src/Common/IteratorUtilities.ts
|
||||||
src/Common/Logger.test.ts
|
src/Common/Logger.test.ts
|
||||||
src/Common/MessageHandler.test.ts
|
src/Common/MessageHandler.test.ts
|
||||||
src/Common/MessageHandler.ts
|
src/Common/MessageHandler.ts
|
||||||
@@ -24,6 +31,8 @@ src/Common/ObjectCache.test.ts
|
|||||||
src/Common/ObjectCache.ts
|
src/Common/ObjectCache.ts
|
||||||
src/Common/QueriesClient.ts
|
src/Common/QueriesClient.ts
|
||||||
src/Common/Splitter.ts
|
src/Common/Splitter.ts
|
||||||
|
src/Common/ThemeUtility.ts
|
||||||
|
src/Common/UrlUtility.ts
|
||||||
src/Config.ts
|
src/Config.ts
|
||||||
src/Contracts/ActionContracts.ts
|
src/Contracts/ActionContracts.ts
|
||||||
src/Contracts/DataModels.ts
|
src/Contracts/DataModels.ts
|
||||||
@@ -34,6 +43,7 @@ src/Contracts/ViewModels.ts
|
|||||||
src/Controls/Heatmap/Heatmap.test.ts
|
src/Controls/Heatmap/Heatmap.test.ts
|
||||||
src/Controls/Heatmap/Heatmap.ts
|
src/Controls/Heatmap/Heatmap.ts
|
||||||
src/Controls/Heatmap/HeatmapDatatypes.ts
|
src/Controls/Heatmap/HeatmapDatatypes.ts
|
||||||
|
src/Definitions/adal.d.ts
|
||||||
src/Definitions/datatables.d.ts
|
src/Definitions/datatables.d.ts
|
||||||
src/Definitions/gif.d.ts
|
src/Definitions/gif.d.ts
|
||||||
src/Definitions/globals.d.ts
|
src/Definitions/globals.d.ts
|
||||||
@@ -45,10 +55,13 @@ src/Definitions/jquery.d.ts
|
|||||||
src/Definitions/plotly.js-cartesian-dist.d-min.ts
|
src/Definitions/plotly.js-cartesian-dist.d-min.ts
|
||||||
src/Definitions/png.d.ts
|
src/Definitions/png.d.ts
|
||||||
src/Definitions/svg.d.ts
|
src/Definitions/svg.d.ts
|
||||||
|
src/Definitions/worker.d.ts
|
||||||
src/Explorer/ComponentRegisterer.test.ts
|
src/Explorer/ComponentRegisterer.test.ts
|
||||||
src/Explorer/ComponentRegisterer.ts
|
src/Explorer/ComponentRegisterer.ts
|
||||||
src/Explorer/ContextMenuButtonFactory.ts
|
src/Explorer/ContextMenuButtonFactory.ts
|
||||||
src/Explorer/Controls/CollapsiblePanel/CollapsiblePanelComponent.ts
|
src/Explorer/Controls/CollapsiblePanel/CollapsiblePanelComponent.ts
|
||||||
|
src/Explorer/Controls/CommandButton/CommandButton.test.ts
|
||||||
|
src/Explorer/Controls/CommandButton/CommandButton.ts
|
||||||
src/Explorer/Controls/DiffEditor/DiffEditorComponent.ts
|
src/Explorer/Controls/DiffEditor/DiffEditorComponent.ts
|
||||||
src/Explorer/Controls/DynamicList/DynamicList.test.ts
|
src/Explorer/Controls/DynamicList/DynamicList.test.ts
|
||||||
src/Explorer/Controls/DynamicList/DynamicListComponent.ts
|
src/Explorer/Controls/DynamicList/DynamicListComponent.ts
|
||||||
@@ -76,7 +89,7 @@ src/Explorer/DataSamples/ContainerSampleGenerator.test.ts
|
|||||||
src/Explorer/DataSamples/ContainerSampleGenerator.ts
|
src/Explorer/DataSamples/ContainerSampleGenerator.ts
|
||||||
src/Explorer/DataSamples/DataSamplesUtil.test.ts
|
src/Explorer/DataSamples/DataSamplesUtil.test.ts
|
||||||
src/Explorer/DataSamples/DataSamplesUtil.ts
|
src/Explorer/DataSamples/DataSamplesUtil.ts
|
||||||
src/Explorer/Explorer.tsx
|
src/Explorer/Explorer.ts
|
||||||
src/Explorer/Graph/GraphExplorerComponent/ArraysByKeyCache.test.ts
|
src/Explorer/Graph/GraphExplorerComponent/ArraysByKeyCache.test.ts
|
||||||
src/Explorer/Graph/GraphExplorerComponent/ArraysByKeyCache.ts
|
src/Explorer/Graph/GraphExplorerComponent/ArraysByKeyCache.ts
|
||||||
src/Explorer/Graph/GraphExplorerComponent/D3ForceGraph.test.ts
|
src/Explorer/Graph/GraphExplorerComponent/D3ForceGraph.test.ts
|
||||||
@@ -84,17 +97,22 @@ src/Explorer/Graph/GraphExplorerComponent/D3ForceGraph.ts
|
|||||||
src/Explorer/Graph/GraphExplorerComponent/EdgeInfoCache.ts
|
src/Explorer/Graph/GraphExplorerComponent/EdgeInfoCache.ts
|
||||||
src/Explorer/Graph/GraphExplorerComponent/GraphData.test.ts
|
src/Explorer/Graph/GraphExplorerComponent/GraphData.test.ts
|
||||||
src/Explorer/Graph/GraphExplorerComponent/GraphData.ts
|
src/Explorer/Graph/GraphExplorerComponent/GraphData.ts
|
||||||
|
src/Explorer/Graph/GraphExplorerComponent/GraphUtil.test.ts
|
||||||
|
src/Explorer/Graph/GraphExplorerComponent/GraphUtil.ts
|
||||||
src/Explorer/Graph/GraphExplorerComponent/GremlinClient.test.ts
|
src/Explorer/Graph/GraphExplorerComponent/GremlinClient.test.ts
|
||||||
src/Explorer/Graph/GraphExplorerComponent/GremlinClient.ts
|
src/Explorer/Graph/GraphExplorerComponent/GremlinClient.ts
|
||||||
src/Explorer/Graph/GraphExplorerComponent/GremlinSimpleClient.test.ts
|
src/Explorer/Graph/GraphExplorerComponent/GremlinSimpleClient.test.ts
|
||||||
src/Explorer/Graph/GraphExplorerComponent/GremlinSimpleClient.ts
|
src/Explorer/Graph/GraphExplorerComponent/GremlinSimpleClient.ts
|
||||||
src/Explorer/Graph/GraphStyleComponent/GraphStyle.test.ts
|
src/Explorer/Graph/GraphStyleComponent/GraphStyle.test.ts
|
||||||
src/Explorer/Graph/GraphStyleComponent/GraphStyleComponent.ts
|
src/Explorer/Graph/GraphStyleComponent/GraphStyleComponent.ts
|
||||||
|
src/Explorer/Graph/NewVertexComponent/NewVertex.test.ts
|
||||||
|
src/Explorer/Graph/NewVertexComponent/NewVertexComponent.ts
|
||||||
src/Explorer/Menus/CommandBar/CommandBarComponentButtonFactory.test.ts
|
src/Explorer/Menus/CommandBar/CommandBarComponentButtonFactory.test.ts
|
||||||
src/Explorer/Menus/CommandBar/CommandBarComponentButtonFactory.ts
|
src/Explorer/Menus/CommandBar/CommandBarComponentButtonFactory.ts
|
||||||
src/Explorer/Menus/ContextMenu.ts
|
src/Explorer/Menus/ContextMenu.ts
|
||||||
src/Explorer/MostRecentActivity/MostRecentActivity.ts
|
src/Explorer/MostRecentActivity/MostRecentActivity.ts
|
||||||
|
src/Explorer/Notebook/FileSystemUtil.ts
|
||||||
|
src/Explorer/Notebook/NTeractUtil.ts
|
||||||
src/Explorer/Notebook/NotebookClientV2.ts
|
src/Explorer/Notebook/NotebookClientV2.ts
|
||||||
src/Explorer/Notebook/NotebookComponent/NotebookContentProvider.ts
|
src/Explorer/Notebook/NotebookComponent/NotebookContentProvider.ts
|
||||||
src/Explorer/Notebook/NotebookComponent/__mocks__/rx-jupyter.ts
|
src/Explorer/Notebook/NotebookComponent/__mocks__/rx-jupyter.ts
|
||||||
@@ -119,21 +137,34 @@ src/Explorer/Panes/AddDatabasePane.ts
|
|||||||
src/Explorer/Panes/BrowseQueriesPane.ts
|
src/Explorer/Panes/BrowseQueriesPane.ts
|
||||||
src/Explorer/Panes/CassandraAddCollectionPane.ts
|
src/Explorer/Panes/CassandraAddCollectionPane.ts
|
||||||
src/Explorer/Panes/ContextualPaneBase.ts
|
src/Explorer/Panes/ContextualPaneBase.ts
|
||||||
|
src/Explorer/Panes/DeleteCollectionConfirmationPane.test.ts
|
||||||
|
src/Explorer/Panes/DeleteCollectionConfirmationPane.ts
|
||||||
src/Explorer/Panes/DeleteDatabaseConfirmationPane.test.ts
|
src/Explorer/Panes/DeleteDatabaseConfirmationPane.test.ts
|
||||||
src/Explorer/Panes/DeleteDatabaseConfirmationPane.ts
|
src/Explorer/Panes/DeleteDatabaseConfirmationPane.ts
|
||||||
|
src/Explorer/Panes/ExecuteSprocParamsPane.ts
|
||||||
src/Explorer/Panes/GraphStylingPane.ts
|
src/Explorer/Panes/GraphStylingPane.ts
|
||||||
# src/Explorer/Panes/NewVertexPane.ts
|
src/Explorer/Panes/LoadQueryPane.ts
|
||||||
|
src/Explorer/Panes/NewVertexPane.ts
|
||||||
src/Explorer/Panes/PaneComponents.ts
|
src/Explorer/Panes/PaneComponents.ts
|
||||||
src/Explorer/Panes/RenewAdHocAccessPane.ts
|
src/Explorer/Panes/RenewAdHocAccessPane.ts
|
||||||
|
src/Explorer/Panes/SaveQueryPane.ts
|
||||||
|
src/Explorer/Panes/SettingsPane.test.ts
|
||||||
|
src/Explorer/Panes/SettingsPane.ts
|
||||||
|
src/Explorer/Panes/SetupNotebooksPane.ts
|
||||||
src/Explorer/Panes/StringInputPane.ts
|
src/Explorer/Panes/StringInputPane.ts
|
||||||
src/Explorer/Panes/SwitchDirectoryPane.ts
|
src/Explorer/Panes/SwitchDirectoryPane.ts
|
||||||
|
src/Explorer/Panes/Tables/AddTableEntityPane.ts
|
||||||
src/Explorer/Panes/Tables/EditTableEntityPane.ts
|
src/Explorer/Panes/Tables/EditTableEntityPane.ts
|
||||||
src/Explorer/Panes/Tables/EntityPropertyViewModel.ts
|
src/Explorer/Panes/Tables/EntityPropertyViewModel.ts
|
||||||
|
src/Explorer/Panes/Tables/QuerySelectPane.ts
|
||||||
|
src/Explorer/Panes/Tables/TableColumnOptionsPane.ts
|
||||||
src/Explorer/Panes/Tables/TableEntityPane.ts
|
src/Explorer/Panes/Tables/TableEntityPane.ts
|
||||||
src/Explorer/Panes/Tables/Validators/EntityPropertyNameValidator.ts
|
src/Explorer/Panes/Tables/Validators/EntityPropertyNameValidator.ts
|
||||||
src/Explorer/Panes/Tables/Validators/EntityPropertyValidationCommon.ts
|
src/Explorer/Panes/Tables/Validators/EntityPropertyValidationCommon.ts
|
||||||
src/Explorer/Panes/Tables/Validators/EntityPropertyValueValidator.ts
|
src/Explorer/Panes/Tables/Validators/EntityPropertyValueValidator.ts
|
||||||
src/Explorer/SplashScreen/SplashScreen.test.ts
|
src/Explorer/Panes/UploadFilePane.ts
|
||||||
|
src/Explorer/Panes/UploadItemsPane.ts
|
||||||
|
src/Explorer/SplashScreen/SplashScreenComponentAdapter.test.ts
|
||||||
src/Explorer/Tables/Constants.ts
|
src/Explorer/Tables/Constants.ts
|
||||||
src/Explorer/Tables/DataTable/CacheBase.ts
|
src/Explorer/Tables/DataTable/CacheBase.ts
|
||||||
src/Explorer/Tables/DataTable/DataTableBindingManager.ts
|
src/Explorer/Tables/DataTable/DataTableBindingManager.ts
|
||||||
@@ -141,6 +172,7 @@ src/Explorer/Tables/DataTable/DataTableBuilder.ts
|
|||||||
src/Explorer/Tables/DataTable/DataTableContextMenu.ts
|
src/Explorer/Tables/DataTable/DataTableContextMenu.ts
|
||||||
src/Explorer/Tables/DataTable/DataTableOperationManager.ts
|
src/Explorer/Tables/DataTable/DataTableOperationManager.ts
|
||||||
src/Explorer/Tables/DataTable/DataTableOperations.ts
|
src/Explorer/Tables/DataTable/DataTableOperations.ts
|
||||||
|
src/Explorer/Tables/DataTable/DataTableUtilities.ts
|
||||||
src/Explorer/Tables/DataTable/DataTableViewModel.ts
|
src/Explorer/Tables/DataTable/DataTableViewModel.ts
|
||||||
src/Explorer/Tables/DataTable/TableCommands.ts
|
src/Explorer/Tables/DataTable/TableCommands.ts
|
||||||
src/Explorer/Tables/DataTable/TableEntityCache.ts
|
src/Explorer/Tables/DataTable/TableEntityCache.ts
|
||||||
@@ -149,6 +181,8 @@ src/Explorer/Tables/Entities.ts
|
|||||||
src/Explorer/Tables/QueryBuilder/ClauseGroup.ts
|
src/Explorer/Tables/QueryBuilder/ClauseGroup.ts
|
||||||
src/Explorer/Tables/QueryBuilder/ClauseGroupViewModel.ts
|
src/Explorer/Tables/QueryBuilder/ClauseGroupViewModel.ts
|
||||||
src/Explorer/Tables/QueryBuilder/CustomTimestampHelper.ts
|
src/Explorer/Tables/QueryBuilder/CustomTimestampHelper.ts
|
||||||
|
src/Explorer/Tables/QueryBuilder/DateTimeUtilities.test.ts
|
||||||
|
src/Explorer/Tables/QueryBuilder/DateTimeUtilities.ts
|
||||||
src/Explorer/Tables/QueryBuilder/QueryBuilderViewModel.ts
|
src/Explorer/Tables/QueryBuilder/QueryBuilderViewModel.ts
|
||||||
src/Explorer/Tables/QueryBuilder/QueryClauseViewModel.ts
|
src/Explorer/Tables/QueryBuilder/QueryClauseViewModel.ts
|
||||||
src/Explorer/Tables/QueryBuilder/QueryViewModel.ts
|
src/Explorer/Tables/QueryBuilder/QueryViewModel.ts
|
||||||
@@ -168,6 +202,9 @@ src/Explorer/Tabs/QueryTab.test.ts
|
|||||||
src/Explorer/Tabs/QueryTab.ts
|
src/Explorer/Tabs/QueryTab.ts
|
||||||
src/Explorer/Tabs/QueryTablesTab.ts
|
src/Explorer/Tabs/QueryTablesTab.ts
|
||||||
src/Explorer/Tabs/ScriptTabBase.ts
|
src/Explorer/Tabs/ScriptTabBase.ts
|
||||||
|
src/Explorer/Tabs/SettingsTab.test.ts
|
||||||
|
src/Explorer/Tabs/SettingsTab.ts
|
||||||
|
src/Explorer/Tabs/SparkMasterTab.ts
|
||||||
src/Explorer/Tabs/StoredProcedureTab.ts
|
src/Explorer/Tabs/StoredProcedureTab.ts
|
||||||
src/Explorer/Tabs/TabComponents.ts
|
src/Explorer/Tabs/TabComponents.ts
|
||||||
src/Explorer/Tabs/TabsBase.ts
|
src/Explorer/Tabs/TabsBase.ts
|
||||||
@@ -208,6 +245,9 @@ src/Platform/Hosted/Authorization.ts
|
|||||||
src/Platform/Hosted/DataAccessUtility.ts
|
src/Platform/Hosted/DataAccessUtility.ts
|
||||||
src/Platform/Hosted/ExplorerFactory.ts
|
src/Platform/Hosted/ExplorerFactory.ts
|
||||||
src/Platform/Hosted/Helpers/ConnectionStringParser.test.ts
|
src/Platform/Hosted/Helpers/ConnectionStringParser.test.ts
|
||||||
|
src/Platform/Hosted/Helpers/ConnectionStringParser.ts
|
||||||
|
src/Platform/Hosted/HostedUtils.test.ts
|
||||||
|
src/Platform/Hosted/HostedUtils.ts
|
||||||
src/Platform/Hosted/Main.ts
|
src/Platform/Hosted/Main.ts
|
||||||
src/Platform/Hosted/Maint.test.ts
|
src/Platform/Hosted/Maint.test.ts
|
||||||
src/Platform/Hosted/NotificationsClient.ts
|
src/Platform/Hosted/NotificationsClient.ts
|
||||||
@@ -231,6 +271,8 @@ src/Shared/ExplorerSettings.ts
|
|||||||
src/Shared/PriceEstimateCalculator.ts
|
src/Shared/PriceEstimateCalculator.ts
|
||||||
src/Shared/StorageUtility.test.ts
|
src/Shared/StorageUtility.test.ts
|
||||||
src/Shared/StorageUtility.ts
|
src/Shared/StorageUtility.ts
|
||||||
|
src/Shared/StringUtility.test.ts
|
||||||
|
src/Shared/StringUtility.ts
|
||||||
src/Shared/appInsights.ts
|
src/Shared/appInsights.ts
|
||||||
src/SparkClusterManager/ArcadiaResourceManager.ts
|
src/SparkClusterManager/ArcadiaResourceManager.ts
|
||||||
src/SparkClusterManager/SparkClusterManager.ts
|
src/SparkClusterManager/SparkClusterManager.ts
|
||||||
@@ -239,11 +281,28 @@ src/Terminal/NotebookAppContracts.d.ts
|
|||||||
src/Terminal/index.ts
|
src/Terminal/index.ts
|
||||||
src/TokenProviders/PortalTokenProvider.ts
|
src/TokenProviders/PortalTokenProvider.ts
|
||||||
src/TokenProviders/TokenProviderFactory.ts
|
src/TokenProviders/TokenProviderFactory.ts
|
||||||
|
src/Utils/AuthorizationUtils.test.ts
|
||||||
|
src/Utils/AuthorizationUtils.ts
|
||||||
|
src/Utils/AutoPilotUtils.test.ts
|
||||||
|
src/Utils/AutoPilotUtils.ts
|
||||||
|
src/Utils/DatabaseAccountUtils.test.ts
|
||||||
|
src/Utils/DatabaseAccountUtils.ts
|
||||||
|
src/Utils/JunoUtils.ts
|
||||||
|
src/Utils/MessageValidation.ts
|
||||||
|
src/Utils/NotebookConfigurationUtils.ts
|
||||||
|
src/Utils/OfferUtils.test.ts
|
||||||
|
src/Utils/OfferUtils.ts
|
||||||
src/Utils/PricingUtils.test.ts
|
src/Utils/PricingUtils.test.ts
|
||||||
src/Utils/QueryUtils.test.ts
|
src/Utils/QueryUtils.test.ts
|
||||||
|
src/Utils/QueryUtils.ts
|
||||||
|
src/Utils/StringUtils.test.ts
|
||||||
|
src/Utils/StringUtils.ts
|
||||||
src/applyExplorerBindings.ts
|
src/applyExplorerBindings.ts
|
||||||
src/global.d.ts
|
src/global.d.ts
|
||||||
|
src/quickstart.ts
|
||||||
src/setupTests.ts
|
src/setupTests.ts
|
||||||
|
src/workers/upload/definitions.ts
|
||||||
|
src/workers/upload/index.ts
|
||||||
src/Explorer/Controls/AccessibleElement/AccessibleElement.tsx
|
src/Explorer/Controls/AccessibleElement/AccessibleElement.tsx
|
||||||
src/Explorer/Controls/Accordion/AccordionComponent.tsx
|
src/Explorer/Controls/Accordion/AccordionComponent.tsx
|
||||||
src/Explorer/Controls/AccountSwitch/AccountSwitchComponent.test.tsx
|
src/Explorer/Controls/AccountSwitch/AccountSwitchComponent.test.tsx
|
||||||
@@ -289,8 +348,18 @@ src/Explorer/Graph/GraphExplorerComponent/QueryContainerComponent.tsx
|
|||||||
src/Explorer/Graph/GraphExplorerComponent/ReadOnlyNeighborsComponent.tsx
|
src/Explorer/Graph/GraphExplorerComponent/ReadOnlyNeighborsComponent.tsx
|
||||||
src/Explorer/Graph/GraphExplorerComponent/ReadOnlyNodePropertiesComponent.test.tsx
|
src/Explorer/Graph/GraphExplorerComponent/ReadOnlyNodePropertiesComponent.test.tsx
|
||||||
src/Explorer/Graph/GraphExplorerComponent/ReadOnlyNodePropertiesComponent.tsx
|
src/Explorer/Graph/GraphExplorerComponent/ReadOnlyNodePropertiesComponent.tsx
|
||||||
|
src/Explorer/Menus/CommandBar/CommandBarComponentAdapter.tsx
|
||||||
|
src/Explorer/Menus/CommandBar/CommandBarUtil.test.tsx
|
||||||
src/Explorer/Menus/CommandBar/CommandBarUtil.tsx
|
src/Explorer/Menus/CommandBar/CommandBarUtil.tsx
|
||||||
|
src/Explorer/Menus/CommandBar/MemoryTrackerComponent.tsx
|
||||||
|
src/Explorer/Menus/NavBar/ControlBarComponent.tsx
|
||||||
|
src/Explorer/Menus/NavBar/ControlBarComponentAdapter.tsx
|
||||||
|
src/Explorer/Menus/NavBar/MeControlComponent.test.tsx
|
||||||
|
src/Explorer/Menus/NavBar/MeControlComponent.tsx
|
||||||
|
src/Explorer/Menus/NavBar/MeControlComponentAdapter.tsx
|
||||||
src/Explorer/Menus/NotificationConsole/NotificationConsoleComponent.test.tsx
|
src/Explorer/Menus/NotificationConsole/NotificationConsoleComponent.test.tsx
|
||||||
|
src/Explorer/Menus/NotificationConsole/NotificationConsoleComponent.tsx
|
||||||
|
src/Explorer/Menus/NotificationConsole/NotificationConsoleComponentAdapter.tsx
|
||||||
src/Explorer/Notebook/NotebookComponent/NotebookComponent.tsx
|
src/Explorer/Notebook/NotebookComponent/NotebookComponent.tsx
|
||||||
src/Explorer/Notebook/NotebookComponent/NotebookComponentAdapter.tsx
|
src/Explorer/Notebook/NotebookComponent/NotebookComponentAdapter.tsx
|
||||||
src/Explorer/Notebook/NotebookComponent/NotebookComponentBootstrapper.tsx
|
src/Explorer/Notebook/NotebookComponent/NotebookComponentBootstrapper.tsx
|
||||||
@@ -317,7 +386,8 @@ src/Explorer/Notebook/temp/inputs/editor.tsx
|
|||||||
src/Explorer/Notebook/temp/markdown-cell.tsx
|
src/Explorer/Notebook/temp/markdown-cell.tsx
|
||||||
src/Explorer/Notebook/temp/source.tsx
|
src/Explorer/Notebook/temp/source.tsx
|
||||||
src/Explorer/Notebook/temp/syntax-highlighter/index.tsx
|
src/Explorer/Notebook/temp/syntax-highlighter/index.tsx
|
||||||
src/Explorer/SplashScreen/SplashScreen.tsx
|
src/Explorer/SplashScreen/SplashScreenComponent.tsx
|
||||||
|
src/Explorer/SplashScreen/SplashScreenComponentApdapter.tsx
|
||||||
src/Explorer/Tabs/GalleryTab.tsx
|
src/Explorer/Tabs/GalleryTab.tsx
|
||||||
src/Explorer/Tabs/NotebookViewerTab.tsx
|
src/Explorer/Tabs/NotebookViewerTab.tsx
|
||||||
src/Explorer/Tabs/TerminalTab.tsx
|
src/Explorer/Tabs/TerminalTab.tsx
|
||||||
@@ -326,5 +396,19 @@ src/Explorer/Tree/ResourceTreeAdapterForResourceToken.tsx
|
|||||||
src/GalleryViewer/Cards/GalleryCardComponent.tsx
|
src/GalleryViewer/Cards/GalleryCardComponent.tsx
|
||||||
src/GalleryViewer/GalleryViewer.tsx
|
src/GalleryViewer/GalleryViewer.tsx
|
||||||
src/GalleryViewer/GalleryViewerComponent.tsx
|
src/GalleryViewer/GalleryViewerComponent.tsx
|
||||||
|
cypress/integration/dataexplorer/CASSANDRA/addCollection.spec.ts
|
||||||
|
cypress/integration/dataexplorer/GRAPH/addCollection.spec.ts
|
||||||
|
cypress/integration/dataexplorer/ci-tests/addCollectionPane.spec.ts
|
||||||
|
cypress/integration/dataexplorer/ci-tests/createDatabase.spec.ts
|
||||||
|
cypress/integration/dataexplorer/ci-tests/deleteCollection.spec.ts
|
||||||
|
cypress/integration/dataexplorer/ci-tests/deleteDatabase.spec.ts
|
||||||
|
cypress/integration/dataexplorer/MONGO/addCollection.spec.ts
|
||||||
|
cypress/integration/dataexplorer/MONGO/addCollectionAutopilot.spec.ts
|
||||||
|
cypress/integration/dataexplorer/MONGO/addCollectionExistingDatabase.spec.ts
|
||||||
|
cypress/integration/dataexplorer/MONGO/provisionDatabaseThroughput.spec.ts
|
||||||
|
cypress/integration/dataexplorer/SQL/addCollection.spec.ts
|
||||||
|
cypress/integration/dataexplorer/TABLE/addCollection.spec.ts
|
||||||
|
cypress/integration/notebook/newNotebook.spec.ts
|
||||||
|
cypress/integration/notebook/resourceTree.spec.ts
|
||||||
__mocks__/monaco-editor.ts
|
__mocks__/monaco-editor.ts
|
||||||
src/Explorer/Tree/ResourceTreeAdapterForResourceToken.test.tsx
|
src/Explorer/Tree/ResourceTreeAdapterForResourceToken.test.tsx
|
||||||
33
.eslintrc.js
33
.eslintrc.js
@@ -1,39 +1,41 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
env: {
|
env: {
|
||||||
browser: true,
|
browser: true,
|
||||||
es6: true,
|
es6: true
|
||||||
},
|
},
|
||||||
plugins: ["@typescript-eslint", "no-null", "prefer-arrow", "react-hooks"],
|
plugins: ["@typescript-eslint", "no-null", "prefer-arrow"],
|
||||||
extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
|
extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
|
||||||
globals: {
|
globals: {
|
||||||
Atomics: "readonly",
|
Atomics: "readonly",
|
||||||
SharedArrayBuffer: "readonly",
|
SharedArrayBuffer: "readonly"
|
||||||
},
|
},
|
||||||
parser: "@typescript-eslint/parser",
|
parser: "@typescript-eslint/parser",
|
||||||
parserOptions: {
|
parserOptions: {
|
||||||
ecmaFeatures: {
|
ecmaFeatures: {
|
||||||
jsx: true,
|
jsx: true
|
||||||
},
|
},
|
||||||
ecmaVersion: 2018,
|
ecmaVersion: 2018,
|
||||||
sourceType: "module",
|
sourceType: "module"
|
||||||
},
|
},
|
||||||
overrides: [
|
overrides: [
|
||||||
{
|
{
|
||||||
files: ["**/*.tsx"],
|
files: ["**/*.tsx"],
|
||||||
|
env: {
|
||||||
|
jest: true
|
||||||
|
},
|
||||||
extends: ["plugin:react/recommended"],
|
extends: ["plugin:react/recommended"],
|
||||||
plugins: ["react"],
|
plugins: ["react"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
files: ["**/*.{test,spec}.{ts,tsx}"],
|
files: ["**/*.{test,spec}.{ts,tsx}"],
|
||||||
env: {
|
env: {
|
||||||
jest: true,
|
jest: true
|
||||||
},
|
},
|
||||||
extends: ["plugin:jest/recommended"],
|
extends: ["plugin:jest/recommended"],
|
||||||
plugins: ["jest"],
|
plugins: ["jest"]
|
||||||
},
|
}
|
||||||
],
|
],
|
||||||
rules: {
|
rules: {
|
||||||
"no-console": ["error", { allow: ["error", "warn", "dir"] }],
|
|
||||||
curly: "error",
|
curly: "error",
|
||||||
"@typescript-eslint/no-unused-vars": "error",
|
"@typescript-eslint/no-unused-vars": "error",
|
||||||
"@typescript-eslint/no-extraneous-class": "error",
|
"@typescript-eslint/no-extraneous-class": "error",
|
||||||
@@ -41,15 +43,12 @@ module.exports = {
|
|||||||
"@typescript-eslint/no-explicit-any": "error",
|
"@typescript-eslint/no-explicit-any": "error",
|
||||||
"prefer-arrow/prefer-arrow-functions": ["error", { allowStandaloneDeclarations: true }],
|
"prefer-arrow/prefer-arrow-functions": ["error", { allowStandaloneDeclarations: true }],
|
||||||
eqeqeq: "error",
|
eqeqeq: "error",
|
||||||
"react/display-name": "off",
|
|
||||||
"react-hooks/rules-of-hooks": "warn", // TODO: error
|
|
||||||
"react-hooks/exhaustive-deps": "warn", // TODO: error
|
|
||||||
"no-restricted-syntax": [
|
"no-restricted-syntax": [
|
||||||
"error",
|
"error",
|
||||||
{
|
{
|
||||||
selector: "CallExpression[callee.object.name='JSON'][callee.property.name='stringify'] Identifier[name=/$err/]",
|
selector: "CallExpression[callee.object.name='JSON'][callee.property.name='stringify'] Identifier[name=/$err/]",
|
||||||
message: "Do not use JSON.stringify(error). It will print '{}'",
|
message: "Do not use JSON.stringify(error). It will print '{}'"
|
||||||
},
|
}
|
||||||
],
|
]
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
1
.github/PULL_REQUEST_TEMPLATE.md
vendored
1
.github/PULL_REQUEST_TEMPLATE.md
vendored
@@ -1 +0,0 @@
|
|||||||
[Preview this branch](https://cosmos-explorer-preview.azurewebsites.net/pull/EDIT_THIS_NUMBER_IN_THE_PR_DESCRIPTION?feature.someFeatureFlagYouMightNeed=true)
|
|
||||||
9
.github/dependabot.yml
vendored
9
.github/dependabot.yml
vendored
@@ -1,9 +0,0 @@
|
|||||||
# Please see the documentation for all configuration options:
|
|
||||||
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
|
|
||||||
|
|
||||||
version: 2
|
|
||||||
updates:
|
|
||||||
- package-ecosystem: "npm"
|
|
||||||
directory: "/"
|
|
||||||
schedule:
|
|
||||||
interval: "daily"
|
|
||||||
159
.github/workflows/ci.yml
vendored
159
.github/workflows/ci.yml
vendored
@@ -9,29 +9,15 @@ on:
|
|||||||
branches:
|
branches:
|
||||||
- master
|
- master
|
||||||
jobs:
|
jobs:
|
||||||
codemetrics:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
name: "Log Code Metrics"
|
|
||||||
if: github.ref == 'refs/heads/master'
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- name: Use Node.js 14.x
|
|
||||||
uses: actions/setup-node@v1
|
|
||||||
with:
|
|
||||||
node-version: 14.x
|
|
||||||
- run: npm ci
|
|
||||||
- run: node utils/codeMetrics.js
|
|
||||||
env:
|
|
||||||
CODE_METRICS_APP_ID: ${{ secrets.CODE_METRICS_APP_ID }}
|
|
||||||
compile:
|
compile:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
name: "Compile TypeScript"
|
name: "Compile TypeScript"
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: Use Node.js 14.x
|
- name: Use Node.js 12.x
|
||||||
uses: actions/setup-node@v1
|
uses: actions/setup-node@v1
|
||||||
with:
|
with:
|
||||||
node-version: 14.x
|
node-version: 12.x
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
- run: npm run compile
|
- run: npm run compile
|
||||||
- run: npm run compile:strict
|
- run: npm run compile:strict
|
||||||
@@ -40,10 +26,10 @@ jobs:
|
|||||||
name: "Check Format"
|
name: "Check Format"
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: Use Node.js 14.x
|
- name: Use Node.js 12.x
|
||||||
uses: actions/setup-node@v1
|
uses: actions/setup-node@v1
|
||||||
with:
|
with:
|
||||||
node-version: 14.x
|
node-version: 12.x
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
- run: npm run format:check
|
- run: npm run format:check
|
||||||
lint:
|
lint:
|
||||||
@@ -51,10 +37,10 @@ jobs:
|
|||||||
name: "Lint"
|
name: "Lint"
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: Use Node.js 14.x
|
- name: Use Node.js 12.x
|
||||||
uses: actions/setup-node@v1
|
uses: actions/setup-node@v1
|
||||||
with:
|
with:
|
||||||
node-version: 14.x
|
node-version: 12.x
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
- run: npm run lint
|
- run: npm run lint
|
||||||
unittest:
|
unittest:
|
||||||
@@ -62,21 +48,22 @@ jobs:
|
|||||||
name: "Unit Tests"
|
name: "Unit Tests"
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: Use Node.js 14.x
|
- name: Use Node.js 12.x
|
||||||
uses: actions/setup-node@v1
|
uses: actions/setup-node@v1
|
||||||
with:
|
with:
|
||||||
node-version: 14.x
|
node-version: 12.x
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
- run: npm run test
|
- run: npm run test
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
needs: [lint, format, compile, unittest]
|
||||||
name: "Build"
|
name: "Build"
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: Use Node.js 14.x
|
- name: Use Node.js 12.x
|
||||||
uses: actions/setup-node@v1
|
uses: actions/setup-node@v1
|
||||||
with:
|
with:
|
||||||
node-version: 14.x
|
node-version: 12.x
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
- run: npm run build:contracts
|
- run: npm run build:contracts
|
||||||
- name: Restore Build Cache
|
- name: Restore Build Cache
|
||||||
@@ -91,82 +78,88 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
name: dist
|
name: dist
|
||||||
path: dist/
|
path: dist/
|
||||||
- name: Upload build to preview blob storage
|
|
||||||
run: az storage blob upload-batch -d '$web' -s 'dist' --account-name cosmosexplorerpreview --subscription cosmosdb-portalteam-generaldemo --destination-path "${{github.event.pull_request.head.sha}}" --account-key="${PREVIEW_STORAGE_KEY}"
|
|
||||||
env:
|
|
||||||
PREVIEW_STORAGE_KEY: ${{ secrets.PREVIEW_STORAGE_KEY }}
|
|
||||||
- name: Upload preview config to blob storage
|
|
||||||
run: az storage blob upload -c '$web' -f ./preview/config.json --account-name cosmosexplorerpreview --subscription cosmosdb-portalteam-generaldemo --name "${{github.event.pull_request.head.sha}}/config.json" --account-key="${PREVIEW_STORAGE_KEY}"
|
|
||||||
env:
|
|
||||||
PREVIEW_STORAGE_KEY: ${{ secrets.PREVIEW_STORAGE_KEY }}
|
|
||||||
endtoendemulator:
|
endtoendemulator:
|
||||||
name: "End To End Emulator Tests"
|
name: "End To End Tests | Emulator | SQL"
|
||||||
# Temporarily disabled. This test needs to be rewritten in playwright
|
needs: [lint, format, compile, unittest]
|
||||||
if: false
|
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: Use Node.js 14.x
|
- uses: southpolesteve/cosmos-emulator-github-action@v1
|
||||||
|
- name: Use Node.js 12.x
|
||||||
uses: actions/setup-node@v1
|
uses: actions/setup-node@v1
|
||||||
with:
|
with:
|
||||||
node-version: 14.x
|
node-version: 12.x
|
||||||
- uses: southpolesteve/cosmos-emulator-github-action@v1
|
- name: Restore Cypress Binary Cache
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ~/.cache/Cypress
|
||||||
|
key: ${{ runner.os }}-cypress-binary-cache
|
||||||
- name: End to End Tests
|
- name: End to End Tests
|
||||||
run: |
|
run: |
|
||||||
npm ci
|
npm ci
|
||||||
npm start &
|
npm start &
|
||||||
npm run wait-for-server
|
npm ci --prefix ./cypress
|
||||||
npx jest -c ./jest.config.e2e.js --detectOpenHandles test/sql/container.spec.ts
|
npm run test:ci --prefix ./cypress -- --spec ./integration/dataexplorer/ci-tests/createDatabase.spec.ts
|
||||||
shell: bash
|
shell: bash
|
||||||
env:
|
env:
|
||||||
DATA_EXPLORER_ENDPOINT: "https://localhost:1234/explorer.html?platform=Emulator"
|
EMULATOR_ENDPOINT: https://0.0.0.0:8081/
|
||||||
PLATFORM: "Emulator"
|
|
||||||
NODE_TLS_REJECT_UNAUTHORIZED: 0
|
NODE_TLS_REJECT_UNAUTHORIZED: 0
|
||||||
|
CYPRESS_CACHE_FOLDER: ~/.cache/Cypress
|
||||||
|
accessibility:
|
||||||
|
name: "Accessibility | Hosted"
|
||||||
|
needs: [lint, format, compile, unittest]
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Use Node.js 12.x
|
||||||
|
uses: actions/setup-node@v1
|
||||||
|
with:
|
||||||
|
node-version: 12.x
|
||||||
|
- name: Accessibility Check
|
||||||
|
run: |
|
||||||
|
# Ubuntu gets mad when webpack runs too many files watchers
|
||||||
|
cat /proc/sys/fs/inotify/max_user_watches
|
||||||
|
sudo sysctl fs.inotify.max_user_watches=524288
|
||||||
|
sudo sysctl -p
|
||||||
|
npm ci
|
||||||
|
npm start &
|
||||||
|
npx wait-on -i 5000 https-get://0.0.0.0:1234/
|
||||||
|
node utils/accesibilityCheck.js
|
||||||
|
shell: bash
|
||||||
|
env:
|
||||||
|
NODE_TLS_REJECT_UNAUTHORIZED: 0
|
||||||
|
endtoendpuppeteer:
|
||||||
|
name: "End to end puppeteer tests"
|
||||||
|
needs: [lint, format, compile, unittest]
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Use Node.js 12.x
|
||||||
|
uses: actions/setup-node@v1
|
||||||
|
with:
|
||||||
|
node-version: 12.x
|
||||||
|
- name: End to End Puppeteer Tests
|
||||||
|
run: |
|
||||||
|
npm ci
|
||||||
|
npm start &
|
||||||
|
npm run wait-for-server
|
||||||
|
npm run test:e2e
|
||||||
|
shell: bash
|
||||||
|
env:
|
||||||
|
NODE_TLS_REJECT_UNAUTHORIZED: 0
|
||||||
|
PORTAL_RUNNER_CONNECTION_STRING: ${{ secrets.CONNECTION_STRING_SQL }}
|
||||||
|
MONGO_CONNECTION_STRING: ${{ secrets.CONNECTION_STRING_MONGO }}
|
||||||
|
CASSANDRA_CONNECTION_STRING: ${{ secrets.CONNECTION_STRING_CASSANDRA }}
|
||||||
|
TABLES_CONNECTION_STRING: ${{ secrets.CONNECTION_STRING_TABLE }}
|
||||||
|
DATA_EXPLORER_ENDPOINT: "https://localhost:1234/hostedExplorer.html"
|
||||||
- uses: actions/upload-artifact@v2
|
- uses: actions/upload-artifact@v2
|
||||||
if: failure()
|
|
||||||
with:
|
with:
|
||||||
name: screenshots
|
name: screenshots
|
||||||
path: failed-*
|
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/sql/container.spec.ts
|
|
||||||
- ./test/mongo/container.spec.ts
|
|
||||||
- ./test/selfServe/selfServeExample.spec.ts
|
|
||||||
- ./test/notebooks/upload.spec.ts
|
|
||||||
- ./test/sql/resourceToken.spec.ts
|
|
||||||
- ./test/tables/container.spec.ts
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- name: Use Node.js 14.x
|
|
||||||
uses: actions/setup-node@v1
|
|
||||||
with:
|
|
||||||
node-version: 14.x
|
|
||||||
- run: npm ci
|
|
||||||
- run: 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@v2
|
|
||||||
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/')
|
||||||
needs: [build]
|
needs: [lint, format, compile, build, unittest, endtoendemulator, endtoendpuppeteer]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
env:
|
env:
|
||||||
NUGET_SOURCE: ${{ secrets.NUGET_SOURCE }}
|
NUGET_SOURCE: ${{ secrets.NUGET_SOURCE }}
|
||||||
@@ -182,7 +175,7 @@ jobs:
|
|||||||
- run: cp ./configs/prod.json config.json
|
- run: cp ./configs/prod.json config.json
|
||||||
- run: nuget sources add -Name "ADO" -Source "$NUGET_SOURCE" -UserName "GitHub" -Password "$AZURE_DEVOPS_PAT"
|
- run: nuget sources add -Name "ADO" -Source "$NUGET_SOURCE" -UserName "GitHub" -Password "$AZURE_DEVOPS_PAT"
|
||||||
- run: nuget pack -Version "2.0.0-github-${GITHUB_SHA}"
|
- run: nuget pack -Version "2.0.0-github-${GITHUB_SHA}"
|
||||||
- run: nuget push -SkipDuplicate -Source "$NUGET_SOURCE" -ApiKey Az *.nupkg
|
- run: nuget push -Source "$NUGET_SOURCE" -ApiKey Az *.nupkg
|
||||||
- uses: actions/upload-artifact@v2
|
- uses: actions/upload-artifact@v2
|
||||||
name: packages
|
name: packages
|
||||||
with:
|
with:
|
||||||
@@ -190,7 +183,7 @@ jobs:
|
|||||||
nugetmpac:
|
nugetmpac:
|
||||||
name: Publish Nuget MPAC
|
name: Publish Nuget MPAC
|
||||||
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/')
|
||||||
needs: [build]
|
needs: [lint, format, compile, build, unittest, endtoendemulator, endtoendpuppeteer]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
env:
|
env:
|
||||||
NUGET_SOURCE: ${{ secrets.NUGET_SOURCE }}
|
NUGET_SOURCE: ${{ secrets.NUGET_SOURCE }}
|
||||||
@@ -207,7 +200,7 @@ jobs:
|
|||||||
- run: sed -i 's/Azure.Cosmos.DB.Data.Explorer/Azure.Cosmos.DB.Data.Explorer.MPAC/g' DataExplorer.nuspec
|
- run: sed -i 's/Azure.Cosmos.DB.Data.Explorer/Azure.Cosmos.DB.Data.Explorer.MPAC/g' DataExplorer.nuspec
|
||||||
- run: nuget sources add -Name "ADO" -Source "$NUGET_SOURCE" -UserName "GitHub" -Password "$AZURE_DEVOPS_PAT"
|
- run: nuget sources add -Name "ADO" -Source "$NUGET_SOURCE" -UserName "GitHub" -Password "$AZURE_DEVOPS_PAT"
|
||||||
- run: nuget pack -Version "2.0.0-github-${GITHUB_SHA}"
|
- run: nuget pack -Version "2.0.0-github-${GITHUB_SHA}"
|
||||||
- run: nuget push -SkipDuplicate -Source "$NUGET_SOURCE" -ApiKey Az *.nupkg
|
- run: nuget push -Source "$NUGET_SOURCE" -ApiKey Az *.nupkg
|
||||||
- uses: actions/upload-artifact@v2
|
- uses: actions/upload-artifact@v2
|
||||||
name: packages
|
name: packages
|
||||||
with:
|
with:
|
||||||
|
|||||||
28
.github/workflows/cleanup.yml
vendored
28
.github/workflows/cleanup.yml
vendored
@@ -1,28 +0,0 @@
|
|||||||
# This is a basic workflow to help you get started with Actions
|
|
||||||
|
|
||||||
name: Cleanup End to End Account Resources
|
|
||||||
|
|
||||||
on:
|
|
||||||
# Allows you to run this workflow manually from the Actions tab
|
|
||||||
workflow_dispatch:
|
|
||||||
schedule:
|
|
||||||
# Once every hour
|
|
||||||
- cron: "0 * * * *"
|
|
||||||
|
|
||||||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
|
|
||||||
jobs:
|
|
||||||
# This workflow contains a single job called "build"
|
|
||||||
cleanupaccounts:
|
|
||||||
name: "Cleanup Test Database Accounts"
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
env:
|
|
||||||
NOTEBOOKS_TEST_RUNNER_CLIENT_ID: ${{ secrets.NOTEBOOKS_TEST_RUNNER_CLIENT_ID }}
|
|
||||||
NOTEBOOKS_TEST_RUNNER_CLIENT_SECRET: ${{ secrets.NOTEBOOKS_TEST_RUNNER_CLIENT_SECRET }}
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- name: Use Node.js 14.x
|
|
||||||
uses: actions/setup-node@v1
|
|
||||||
with:
|
|
||||||
node-version: 14.x
|
|
||||||
- run: npm ci
|
|
||||||
- run: node utils/cleanupDBs.js
|
|
||||||
25
.github/workflows/runners.yml
vendored
Normal file
25
.github/workflows/runners.yml
vendored
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
name: Runners
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
- cron: "0 * 1 * *"
|
||||||
|
jobs:
|
||||||
|
sqlcreatecollection:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
name: "SQL | Create Collection"
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: actions/setup-node@v1
|
||||||
|
- run: npm ci
|
||||||
|
- run: npm run test:e2e
|
||||||
|
env:
|
||||||
|
PORTAL_RUNNER_APP_INSIGHTS_KEY: ${{ secrets.PORTAL_RUNNER_APP_INSIGHTS_KEY }}
|
||||||
|
PORTAL_RUNNER_USERNAME: ${{ secrets.PORTAL_RUNNER_USERNAME }}
|
||||||
|
PORTAL_RUNNER_PASSWORD: ${{ secrets.PORTAL_RUNNER_PASSWORD }}
|
||||||
|
PORTAL_RUNNER_SUBSCRIPTION: 69e02f2d-f059-4409-9eac-97e8a276ae2c
|
||||||
|
PORTAL_RUNNER_RESOURCE_GROUP: runners
|
||||||
|
PORTAL_RUNNER_DATABASE_ACCOUNT: portal-sql-runner
|
||||||
|
- uses: actions/upload-artifact@v2
|
||||||
|
if: failure()
|
||||||
|
with:
|
||||||
|
name: screenshots
|
||||||
|
path: failure.png
|
||||||
7
.gitignore
vendored
7
.gitignore
vendored
@@ -9,11 +9,12 @@ pkg/DataExplorer/*
|
|||||||
test/out/*
|
test/out/*
|
||||||
workers/**/*.js
|
workers/**/*.js
|
||||||
*.trx
|
*.trx
|
||||||
|
cypress/videos
|
||||||
|
cypress/screenshots
|
||||||
|
cypress/fixtures
|
||||||
notebookapp/*
|
notebookapp/*
|
||||||
Contracts/*
|
Contracts/*
|
||||||
.DS_Store
|
.DS_Store
|
||||||
.cache/
|
.cache/
|
||||||
.env
|
.env
|
||||||
failure.png
|
failure.png
|
||||||
screenshots/*
|
|
||||||
GettingStarted-ignore*.ipynb
|
|
||||||
BIN
.vs/slnx.sqlite
BIN
.vs/slnx.sqlite
Binary file not shown.
43
.vscode/settings.json
vendored
43
.vscode/settings.json
vendored
@@ -1,26 +1,21 @@
|
|||||||
// Place your settings in this file to overwrite default and user settings.
|
// Place your settings in this file to overwrite default and user settings.
|
||||||
{
|
{
|
||||||
"files.exclude": {
|
"files.exclude": {
|
||||||
".vs": true,
|
".vs": true,
|
||||||
".vscode/**": true,
|
".vscode/**": true,
|
||||||
"*.trx": true,
|
"*.trx": true,
|
||||||
"**/.DS_Store": true,
|
"**/.DS_Store": true,
|
||||||
"**/.git": true,
|
"**/.git": true,
|
||||||
"**/.hg": true,
|
"**/.hg": true,
|
||||||
"**/.svn": true,
|
"**/.svn": true,
|
||||||
"built/**": true,
|
"built/**": true,
|
||||||
"coverage/**": true,
|
"coverage/**": true,
|
||||||
"libs/**": true,
|
"libs/**": true,
|
||||||
"node_modules/**": true,
|
"node_modules/**": true,
|
||||||
"package-lock.json": true,
|
"package-lock.json": true,
|
||||||
"quickstart/**": true,
|
"quickstart/**": true,
|
||||||
"test/out/**": true,
|
"test/out/**": true,
|
||||||
"workers/libs/**": true
|
"workers/libs/**": true
|
||||||
},
|
},
|
||||||
"typescript.tsdk": "node_modules/typescript/lib",
|
"typescript.tsdk": "node_modules/typescript/lib"
|
||||||
"editor.formatOnSave": true,
|
}
|
||||||
"editor.codeActionsOnSave": {
|
|
||||||
"source.fixAll.eslint": true,
|
|
||||||
"source.organizeImports": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,194 +0,0 @@
|
|||||||
# Coding Guidelines and Recommendations
|
|
||||||
|
|
||||||
Cosmos Explorer has been under constant development for over 5 years. As a result, there are many different patterns and practices in the codebase. This document serves as a guide to how we write code and helps avoid propagating practices which are no longer preferred. Each requirement in this document is labeled and color-coded to show the relative importance. In order from highest to lowest importance:
|
|
||||||
|
|
||||||
✅ DO this. If you feel you need an exception, engage with the project owners _prior_ to implementation.
|
|
||||||
|
|
||||||
⛔️ DO NOT do this. If you feel you need an exception, engage with the project owners _prior_ to implementation.
|
|
||||||
|
|
||||||
☑️ YOU SHOULD strongly consider this but it is not a requirement. If not following this advice, please comment code with why and proactively begin a discussion as part of the PR process.
|
|
||||||
|
|
||||||
⚠️ YOU SHOULD NOT strongly consider not doing this. If not following this advice, please comment code with why and proactively begin a discussion as part of the PR process.
|
|
||||||
|
|
||||||
💭 YOU MAY consider this advice if appropriate to your situation. Other team members may comment on this as part of PR review, but there is no need to be proactive.
|
|
||||||
|
|
||||||
## Development Environment
|
|
||||||
|
|
||||||
☑️ YOU SHOULD
|
|
||||||
|
|
||||||
- Use VSCode and install the following extensions. This setup will catch most linting/formatting/type errors as you develop:
|
|
||||||
- [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode)
|
|
||||||
- [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint)
|
|
||||||
|
|
||||||
💭 YOU MAY
|
|
||||||
|
|
||||||
- Use the [GitHub CLI](https://cli.github.com/). It has helpful workflows for submitting PRs as well as for checking out other team member's PRs.
|
|
||||||
- Use Windows, Linux (including WSL), or OSX. We have team members developing on all three environments.
|
|
||||||
|
|
||||||
✅ DO
|
|
||||||
|
|
||||||
- Maintain cross-platform compatibility when modifying any engineering or build systems
|
|
||||||
|
|
||||||
## Code Formatting
|
|
||||||
|
|
||||||
✅ DO
|
|
||||||
|
|
||||||
- Use [Prettier](https://prettier.io/) to format your code
|
|
||||||
- This will occur automatically if using the recommended editor setup
|
|
||||||
- `npm run format` will also format code
|
|
||||||
|
|
||||||
## Linting
|
|
||||||
|
|
||||||
✅ DO
|
|
||||||
|
|
||||||
- Use [ESLint](https://eslint.org/) to check for code errors.
|
|
||||||
- This will occur automatically if using the recommended editor setup
|
|
||||||
- `npm run lint` will also check for linting errors
|
|
||||||
|
|
||||||
💭 YOU MAY
|
|
||||||
|
|
||||||
- Consider adding new lint rules.
|
|
||||||
- If you find yourself performing "nits" as part of PR review, consider adding a lint rule that will automatically catch the error in the future
|
|
||||||
|
|
||||||
⚠️ YOU SHOULD NOT
|
|
||||||
|
|
||||||
- Disable lint rules
|
|
||||||
- Lint rules exist as guidance and to catch common mistakes
|
|
||||||
- You will find places we disable specific lint rules however it should be exceptional.
|
|
||||||
- If a rule does need to be disabled, prefer disabling a specific line instead of the entire file.
|
|
||||||
|
|
||||||
⛔️ DO NOT
|
|
||||||
|
|
||||||
- Add [TSLint](https://palantir.github.io/tslint/) rules
|
|
||||||
- TSLint has been deprecated and is on track to be removed
|
|
||||||
- Always prefer ESLint rules
|
|
||||||
|
|
||||||
## UI Components
|
|
||||||
|
|
||||||
☑️ YOU SHOULD
|
|
||||||
|
|
||||||
- Write new components using [React](https://reactjs.org/). We are actively migrating Cosmos Explorer off of [Knockout](https://knockoutjs.com/).
|
|
||||||
- Use [Fluent](https://developer.microsoft.com/en-us/fluentui#/) components.
|
|
||||||
- Fluent components are designed to be highly accessible and composable
|
|
||||||
- Using Fluent allows us to build upon the work of the Fluent team and leads to a lower total cost of ownership for UI code
|
|
||||||
|
|
||||||
### React
|
|
||||||
|
|
||||||
☑️ YOU SHOULD
|
|
||||||
|
|
||||||
- Use pure functional components when no state is required
|
|
||||||
|
|
||||||
💭 YOU MAY
|
|
||||||
|
|
||||||
- Use functional (hooks) or class components
|
|
||||||
- The project contains examples of both
|
|
||||||
- Neither is strongly preferred at this time
|
|
||||||
|
|
||||||
⛔️ DO NOT
|
|
||||||
|
|
||||||
- Use inheritance for sharing component behavior.
|
|
||||||
- React documentation covers this topic in detail https://reactjs.org/docs/composition-vs-inheritance.html
|
|
||||||
- Suffix your file or component name with "Component"
|
|
||||||
- Even though the code has examples of it, we are ending the practice.
|
|
||||||
|
|
||||||
## Libraries
|
|
||||||
|
|
||||||
⚠️ YOU SHOULD NOT
|
|
||||||
|
|
||||||
- Add new libraries to package.json.
|
|
||||||
- Adding libraries may bring in code that explodes the bundled size or attempts to run NodeJS code in the browser
|
|
||||||
- Consult with project owners for help with library selection if one is needed
|
|
||||||
|
|
||||||
⛔️ DO NOT
|
|
||||||
|
|
||||||
- Use underscore.js
|
|
||||||
- Much of this library is now native to JS and will be automatically transpiled
|
|
||||||
- Use jQuery
|
|
||||||
- Much of this library is not native to the DOM.
|
|
||||||
- We are planning to remove it
|
|
||||||
|
|
||||||
## Testing
|
|
||||||
|
|
||||||
⛔️ DO NOT
|
|
||||||
|
|
||||||
- Decrease test coverage
|
|
||||||
- Unit/Functional test coverage is checked as part of the CI process
|
|
||||||
|
|
||||||
### Unit Tests
|
|
||||||
|
|
||||||
✅ DO
|
|
||||||
|
|
||||||
- Write unit tests for non-UI and utility code.
|
|
||||||
- Write your tests using [Jest](https://jestjs.io/)
|
|
||||||
|
|
||||||
☑️ YOU SHOULD
|
|
||||||
|
|
||||||
- Abstract non-UI and utility code so it can run either the NodeJS or Browser environment
|
|
||||||
|
|
||||||
### Functional(Component) Tests
|
|
||||||
|
|
||||||
✅ DO
|
|
||||||
|
|
||||||
- Write tests for UI components
|
|
||||||
- Write your tests using [Jest](https://jestjs.io/)
|
|
||||||
- Use either Enzyme or React Testing Library to perform component tests.
|
|
||||||
|
|
||||||
### Mocking
|
|
||||||
|
|
||||||
✅ DO
|
|
||||||
|
|
||||||
- Use Jest's built-in mocking helpers
|
|
||||||
|
|
||||||
☑️ YOU SHOULD
|
|
||||||
|
|
||||||
- Write code that does not require mocking
|
|
||||||
- Build components that do not require mocking extremely large or difficult to mock objects (like Explorer.ts). Pass _only_ what you need.
|
|
||||||
|
|
||||||
⛔️ DO NOT
|
|
||||||
|
|
||||||
- Use sinon.js for mocking
|
|
||||||
- Sinon has been deprecated and planned for removal
|
|
||||||
|
|
||||||
### End to End Tests
|
|
||||||
|
|
||||||
✅ DO
|
|
||||||
|
|
||||||
- Use [Playwright](https://github.com/microsoft/playwright) and [Jest](https://jestjs.io/)
|
|
||||||
- Write or modify an existing E2E test that covers the primary use case of any major feature.
|
|
||||||
- Use caution. Do not try to cover every case. End to End tests can be slow and brittle.
|
|
||||||
|
|
||||||
☑️ YOU SHOULD
|
|
||||||
|
|
||||||
- Write tests that use accessible attributes to perform actions. Role, Title, Label, etc
|
|
||||||
- More information https://testing-library.com/docs/queries/about#priority
|
|
||||||
|
|
||||||
⚠️ YOU SHOULD NOT
|
|
||||||
|
|
||||||
- Add test specfic `data-*` attributes to dom elements
|
|
||||||
- This is a common current practice, but one we would like to avoid in the future
|
|
||||||
- End to end tests need to use semantic HTML and accesible attributes to be truely end to end
|
|
||||||
- No user or screen reader actually navigates an app using `data-*` attributes
|
|
||||||
- Add arbitrary time delays to wait for page to render or element to be ready.
|
|
||||||
- All the time delays add up and slow down testing.
|
|
||||||
- Prefer using the framework's "wait for..." functionality.
|
|
||||||
|
|
||||||
### Migrating Knockout to React
|
|
||||||
|
|
||||||
✅ DO
|
|
||||||
|
|
||||||
- Consult other team members before beginning migration work. There is a significant amount of flux in patterns we are using and it is important we do not propagate incorrect patterns.
|
|
||||||
- Start by converting HTML to JSX: https://magic.reactjs.net/htmltojsx.htm. Add functionality as a second step.
|
|
||||||
|
|
||||||
☑️ YOU SHOULD
|
|
||||||
|
|
||||||
- Write React components that require no dependency on Knockout or observables to trigger rendering.
|
|
||||||
|
|
||||||
## Browser Support
|
|
||||||
|
|
||||||
✅ DO
|
|
||||||
|
|
||||||
- Support all [browsers supported by the Azure Portal](https://docs.microsoft.com/en-us/azure/azure-portal/azure-portal-supported-browsers-devices)
|
|
||||||
- Support IE11
|
|
||||||
- In practice, this should not need to be considered as part of a normal development workflow
|
|
||||||
- Polyfills and transpilation are already provided by our engineering systems.
|
|
||||||
- This requirement will be removed on March 30th, 2021 when Azure drops IE11 support.
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
# Contribution guidelines to Data Explorer
|
# Contribution guidelines to Data Explorer
|
||||||
|
|
||||||
This project welcomes contributions and suggestions. Most contributions require you to agree to a
|
This project welcomes contributions and suggestions. Most contributions require you to agree to a
|
||||||
Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
|
Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
|
||||||
the rights to use your contribution. For details, visit https://cla.microsoft.com.
|
the rights to use your contribution. For details, visit https://cla.microsoft.com.
|
||||||
|
|
||||||
@@ -13,7 +13,6 @@ For more information see the [Code of Conduct FAQ](https://opensource.microsoft.
|
|||||||
contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
|
contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
|
||||||
|
|
||||||
## Microsoft Open Source Code of Conduct
|
## Microsoft Open Source Code of Conduct
|
||||||
|
|
||||||
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
|
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
|
||||||
|
|
||||||
Resources:
|
Resources:
|
||||||
@@ -21,3 +20,33 @@ Resources:
|
|||||||
- [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/)
|
- [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/)
|
||||||
- [Microsoft Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/)
|
- [Microsoft Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/)
|
||||||
- Contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with questions or concerns
|
- Contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with questions or concerns
|
||||||
|
|
||||||
|
## Browser support
|
||||||
|
Please make sure to support all modern browsers as well as Internet Explorer 11.
|
||||||
|
For IE support, polyfill is preferred over new usage of lodash or underscore. We already polyfill almost everything by importing babel-polyfill at the top of entry points.
|
||||||
|
|
||||||
|
|
||||||
|
## Coding guidelines, conventions and recommendations
|
||||||
|
### Typescript
|
||||||
|
* Follow this [typescript style guide](https://github.com/excelmicro/typescript) which is based on [airbnb's style guide](https://github.com/airbnb/javascript).
|
||||||
|
* Conventions speficic to this project:
|
||||||
|
- Use double-quotes for string
|
||||||
|
- Don't use `null`, use `undefined`
|
||||||
|
- Pascal case for private static readonly fields
|
||||||
|
- Camel case for classnames in markup
|
||||||
|
* Don't use class unless necessary
|
||||||
|
* Code related to notebooks should be dynamically imported so that it is loaded from a separate bundle only if the account is notebook-enabled. There are already top-level notebook components which are dynamically imported and their dependencies can be statically imported from these files.
|
||||||
|
* Prefer using [Fluent UI controls](https://developer.microsoft.com/en-us/fluentui#/controls/web) over creating your own, in order to maintain consistency and support a11y.
|
||||||
|
|
||||||
|
### React
|
||||||
|
* Prefer using React class components over function components and hooks unless you have a simple component and require no nested functions:
|
||||||
|
* Nested functions may be harder to test independently
|
||||||
|
* Switching from function component to class component later mayb be painful
|
||||||
|
|
||||||
|
## Testing
|
||||||
|
Any PR should not decrease testing coverage.
|
||||||
|
|
||||||
|
## Recommended Tools and VS Code extensions
|
||||||
|
* [Bookmarks](https://github.com/alefragnani/vscode-bookmarks)
|
||||||
|
* [Bracket pair colorizer](https://github.com/CoenraadS/Bracket-Pair-Colorizer-2)
|
||||||
|
* [GitHub Pull Requests and Issues](https://github.com/Microsoft/vscode-pull-request-github)
|
||||||
52
README.md
52
README.md
@@ -13,17 +13,29 @@ UI for Azure Cosmos DB. Powers the [Azure Portal](https://portal.azure.com/), ht
|
|||||||
|
|
||||||
### Watch mode
|
### Watch mode
|
||||||
|
|
||||||
Run `npm start` to start the development server and automatically rebuild on changes
|
Run `npm run watch` to start the development server and automatically rebuild on changes
|
||||||
|
|
||||||
### Hosted Development (https://cosmos.azure.com)
|
### Specifying Development Platform
|
||||||
|
|
||||||
- Visit: `https://localhost:1234/hostedExplorer.html`
|
Setting the environment variable `PLATFORM` during the build process will force the explorer to load the specified platform. By default in development it will run in `Hosted` mode. Valid options:
|
||||||
- The default webpack dev server configuration will proxy requests to the production portal backend: `https://main.documentdb.ext.azure.com`. This will allow you to use production connection strings on your local machine.
|
|
||||||
|
- Hosted
|
||||||
|
- Emulator
|
||||||
|
- Portal
|
||||||
|
|
||||||
|
`PLATFORM=Emulator npm run watch`
|
||||||
|
|
||||||
|
### Hosted Development
|
||||||
|
|
||||||
|
The default webpack dev server configuration will proxy requests to the production portal backend: `https://main.documentdb.ext.azure.com`. This will allow you to use production connection strings on your local machine.
|
||||||
|
|
||||||
|
To run pure hosted mode, in `webpack.config.js` change index HtmlWebpackPlugin to use hostedExplorer.html and change entry for index to use HostedExplorer.ts.
|
||||||
|
|
||||||
### Emulator Development
|
### Emulator Development
|
||||||
|
|
||||||
- Start the Cosmos Emulator
|
In a window environment, running `npm run build` will automatically copy the built files from `/dist` over to the default emulator install paths. In a non-windows environment you can specify an alternate endpoint using `EMULATOR_ENDPOINT` and webpack dev server will proxy requests for you.
|
||||||
- Visit: https://localhost:1234/index.html
|
|
||||||
|
`PLATFORM=Emulator EMULATOR_ENDPOINT=https://my-vm.azure.com:8081 npm run watch`
|
||||||
|
|
||||||
#### Setting up a Remote Emulator
|
#### Setting up a Remote Emulator
|
||||||
|
|
||||||
@@ -43,8 +55,16 @@ The Cosmos emulator currently only runs in Windows environments. You can still d
|
|||||||
|
|
||||||
### Portal Development
|
### Portal Development
|
||||||
|
|
||||||
- Visit: https://ms.portal.azure.com/?dataExplorerSource=https%3A%2F%2Flocalhost%3A1234%2Fexplorer.html
|
The Cosmos Portal that consumes this repo is not currently open source. If you have access to this project, `npm run build` will copy the built files over to the portal where they will be loaded by the portal development environment
|
||||||
- You may have to manually visit https://localhost:1234/explorer.html first and click through any SSL certificate warnings
|
|
||||||
|
You can however load a local running instance of data explorer in the production portal.
|
||||||
|
|
||||||
|
1. Turn off browser SSL validation for localhost: chrome://flags/#allow-insecure-localhost OR Install valid SSL certs for localhost (on IE, follow these [instructions](https://www.technipages.com/ie-bypass-problem-with-this-websites-security-certificate) to install the localhost certificate in the right place)
|
||||||
|
2. Allowlist `https://localhost:1234` domain for CORS in the Azure Cosmos DB portal
|
||||||
|
3. Start the project in portal mode: `PLATFORM=Portal npm run watch`
|
||||||
|
4. Load the portal using the following link: https://ms.portal.azure.com/?dataExplorerSource=https%3A%2F%2Flocalhost%3A1234%2Fexplorer.html
|
||||||
|
|
||||||
|
Live reload will occur, but data explorer will not properly integrate again with the parent iframe. You will have to manually reload the page.
|
||||||
|
|
||||||
### Testing
|
### Testing
|
||||||
|
|
||||||
@@ -56,7 +76,17 @@ Unit tests are located adjacent to the code under test and run with [Jest](https
|
|||||||
|
|
||||||
#### End to End CI Tests
|
#### End to End CI Tests
|
||||||
|
|
||||||
Jest and Puppeteer are used for end to end browser based tests and are contained in `test/`. To run these tests locally:
|
[Cypress](https://www.cypress.io/) is used for end to end tests and are contained in `cypress/`. Currently, it operates as sub project with its own typescript config and dependencies. It also only operates against the emulator. To run cypress tests:
|
||||||
|
|
||||||
|
1. Ensure the emulator is running
|
||||||
|
2. Start cosmos explorer in emulator mode: `PLATFORM=Emulator npm run watch`
|
||||||
|
3. Move into `cypress/` folder: `cd cypress`
|
||||||
|
4. Install dependencies: `npm install`
|
||||||
|
5. Run cypress headless(`npm run test`) or in interactive mode(`npm run test:debug`)
|
||||||
|
|
||||||
|
#### End to End Production Tests
|
||||||
|
|
||||||
|
Jest and Puppeteer are used for end to end production runners and are contained in `test/`. To run these tests locally:
|
||||||
|
|
||||||
1. Copy .env.example to .env
|
1. Copy .env.example to .env
|
||||||
2. Update the values in .env including your local data explorer endpoint (ask a teammate/codeowner for help with .env values)
|
2. Update the values in .env including your local data explorer endpoint (ask a teammate/codeowner for help with .env values)
|
||||||
@@ -68,10 +98,6 @@ Jest and Puppeteer are used for end to end browser based tests and are contained
|
|||||||
|
|
||||||
We generally adhere to the release strategy [documented by the Azure SDK Guidelines](https://azure.github.io/azure-sdk/policies_repobranching.html#release-branches). Most releases should happen from the master branch. If master contains commits that cannot be released, you may create a release from a `release/` or `hotfix/` branch. See linked documentation for more details.
|
We generally adhere to the release strategy [documented by the Azure SDK Guidelines](https://azure.github.io/azure-sdk/policies_repobranching.html#release-branches). Most releases should happen from the master branch. If master contains commits that cannot be released, you may create a release from a `release/` or `hotfix/` branch. See linked documentation for more details.
|
||||||
|
|
||||||
### Architecture
|
|
||||||
|
|
||||||
[](https://mermaid-js.github.io/mermaid-live-editor/#/edit/eyJjb2RlIjoiZ3JhcGggTFJcbiAgaG9zdGVkKGh0dHBzOi8vY29zbW9zLmF6dXJlLmNvbSlcbiAgcG9ydGFsKFBvcnRhbClcbiAgZW11bGF0b3IoRW11bGF0b3IpXG4gIGFhZFtBQURdXG4gIHJlc291cmNlVG9rZW5bUmVzb3VyY2UgVG9rZW5dXG4gIGNvbm5lY3Rpb25TdHJpbmdbQ29ubmVjdGlvbiBTdHJpbmddXG4gIHBvcnRhbFRva2VuW0VuY3J5cHRlZCBQb3J0YWwgVG9rZW5dXG4gIG1hc3RlcktleVtNYXN0ZXIgS2V5XVxuICBhcm1bQVJNIFJlc291cmNlIFByb3ZpZGVyXVxuICBkYXRhcGxhbmVbRGF0YSBQbGFuZV1cbiAgcHJveHlbUG9ydGFsIEFQSSBQcm94eV1cbiAgc3FsW1NRTF1cbiAgbW9uZ29bTW9uZ29dXG4gIHRhYmxlc1tUYWJsZXNdXG4gIGNhc3NhbmRyYVtDYXNzYW5kcmFdXG4gIGdyYWZbR3JhcGhdXG5cblxuICBlbXVsYXRvciAtLT4gbWFzdGVyS2V5IC0tLS0-IGRhdGFwbGFuZVxuICBwb3J0YWwgLS0-IGFhZFxuICBob3N0ZWQgLS0-IHBvcnRhbFRva2VuICYgcmVzb3VyY2VUb2tlbiAmIGNvbm5lY3Rpb25TdHJpbmcgJiBhYWRcbiAgYWFkIC0tLT4gYXJtXG4gIGFhZCAtLS0-IGRhdGFwbGFuZVxuICBhYWQgLS0tPiBwcm94eVxuICByZXNvdXJjZVRva2VuIC0tLT4gc3FsIC0tPiBkYXRhcGxhbmVcbiAgcG9ydGFsVG9rZW4gLS0tPiBwcm94eVxuICBwcm94eSAtLT4gZGF0YXBsYW5lXG4gIGNvbm5lY3Rpb25TdHJpbmcgLS0-IHNxbCAmIG1vbmdvICYgY2Fzc2FuZHJhICYgZ3JhZiAmIHRhYmxlc1xuICBzcWwgLS0-IGRhdGFwbGFuZVxuICB0YWJsZXMgLS0-IGRhdGFwbGFuZVxuICBtb25nbyAtLT4gcHJveHlcbiAgY2Fzc2FuZHJhIC0tPiBwcm94eVxuICBncmFmIC0tPiBwcm94eVxuXG5cdFx0IiwibWVybWFpZCI6eyJ0aGVtZSI6ImRlZmF1bHQifSwidXBkYXRlRWRpdG9yIjpmYWxzZX0)
|
|
||||||
|
|
||||||
# Contributing
|
# Contributing
|
||||||
|
|
||||||
Please read the [contribution guidelines](./CONTRIBUTING.md).
|
Please read the [contribution guidelines](./CONTRIBUTING.md).
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
presets: [["@babel/preset-env", { targets: { node: "current" } }], "@babel/preset-react", "@babel/preset-typescript"],
|
presets: [["@babel/preset-env", { targets: { node: "current" } }], "@babel/preset-react", "@babel/preset-typescript"]
|
||||||
plugins: [["@babel/plugin-proposal-decorators", { legacy: true }]],
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
# Why?
|
|
||||||
|
|
||||||
This adds a mock module for `canvas`. Nteract has a ignored require and undeclared dependency on this module. `cavnas` is a server side node module and is not used in browser side code for nteract.
|
|
||||||
|
|
||||||
Installing it locally (`npm install canvas`) will resolve the problem, but it is a native module so it is flaky depending on the system, node version, processor arch, etc. This module provides a simpler, more robust solution.
|
|
||||||
|
|
||||||
Remove this workaround if [this bug](https://github.com/nteract/any-vega/issues/2) ever gets resolved
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
module.exports = {}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "canvas",
|
|
||||||
"version": "1.0.0",
|
|
||||||
"description": "",
|
|
||||||
"main": "index.js",
|
|
||||||
"scripts": {
|
|
||||||
"test": "echo \"Error: no test specified\" && exit 1"
|
|
||||||
},
|
|
||||||
"author": "",
|
|
||||||
"license": "ISC"
|
|
||||||
}
|
|
||||||
4
cypress/.gitignore
vendored
Normal file
4
cypress/.gitignore
vendored
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
cypress.env.json
|
||||||
|
cypress/report
|
||||||
|
cypress/screenshots
|
||||||
|
cypress/videos
|
||||||
51
cypress/cleanup.js
Normal file
51
cypress/cleanup.js
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
// Cleans up old databases from previous test runs
|
||||||
|
const { CosmosClient } = require("@azure/cosmos");
|
||||||
|
|
||||||
|
// TODO: Add support for other API connection strings
|
||||||
|
const mongoRegex = RegExp("mongodb://.*:(.*)@(.*).mongo.cosmos.azure.com");
|
||||||
|
|
||||||
|
async function cleanup() {
|
||||||
|
const connectionString = process.env.CYPRESS_CONNECTION_STRING;
|
||||||
|
if (!connectionString) {
|
||||||
|
throw new Error("Connection string not provided");
|
||||||
|
}
|
||||||
|
|
||||||
|
let client;
|
||||||
|
switch (true) {
|
||||||
|
case connectionString.includes("mongodb://"): {
|
||||||
|
const [, key, accountName] = connectionString.match(mongoRegex);
|
||||||
|
client = new CosmosClient({
|
||||||
|
key,
|
||||||
|
endpoint: `https://${accountName}.documents.azure.com:443/`
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// TODO: Add support for other API connection strings
|
||||||
|
default:
|
||||||
|
client = new CosmosClient(connectionString);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
const response = await client.databases.readAll().fetchAll();
|
||||||
|
return Promise.all(
|
||||||
|
response.resources.map(async db => {
|
||||||
|
const dbTimestamp = new Date(db._ts * 1000);
|
||||||
|
const twentyMinutesAgo = new Date(Date.now() - 1000 * 60 * 20);
|
||||||
|
if (dbTimestamp < twentyMinutesAgo) {
|
||||||
|
await client.database(db.id).delete();
|
||||||
|
console.log(`DELETED: ${db.id} | Timestamp: ${dbTimestamp}`);
|
||||||
|
} else {
|
||||||
|
console.log(`SKIPPED: ${db.id} | Timestamp: ${dbTimestamp}`);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
cleanup()
|
||||||
|
.then(() => {
|
||||||
|
process.exit(0);
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
console.error(error);
|
||||||
|
process.exit(1);
|
||||||
|
});
|
||||||
15
cypress/cypress.json
Normal file
15
cypress/cypress.json
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"integrationFolder": "./integration",
|
||||||
|
"pluginsFile": false,
|
||||||
|
"fixturesFolder": false,
|
||||||
|
"supportFile": "./support/index.js",
|
||||||
|
"defaultCommandTimeout": 90000,
|
||||||
|
"chromeWebSecurity": false,
|
||||||
|
"reporter": "mochawesome",
|
||||||
|
"reporterOptions": {
|
||||||
|
"reportDir": "cypress/report",
|
||||||
|
"json": true,
|
||||||
|
"overwrite": false,
|
||||||
|
"html": false
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
// 1. Click on "New Container" on the command bar.
|
||||||
|
// 2. Pane with the title "Add Container" should appear on the right side of the screen
|
||||||
|
// 3. It includes an input box for the database Id.
|
||||||
|
// 4. It includes a checkbox called "Create now".
|
||||||
|
// 5. When the checkbox is marked, enter new database id.
|
||||||
|
// 3. Create a database WITH "Provision throughput" checked.
|
||||||
|
// 4. Enter minimum throughput value of 400.
|
||||||
|
// 5. Enter container id to the container id text box.
|
||||||
|
// 6. Enter partition key to the partition key text box.
|
||||||
|
// 7. Click "OK" to create a new container.
|
||||||
|
// 8. Verify the new container is created along with the database id and should appead in the Data Explorer list in the left side of the screen.
|
||||||
|
|
||||||
|
const connectionString = require("../../../utilities/connectionString");
|
||||||
|
|
||||||
|
let crypt = require("crypto");
|
||||||
|
|
||||||
|
context("Cassandra API Test - createDatabase", () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
connectionString.loginUsingConnectionString(connectionString.constants.cassandra);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Create a new table in Cassandra API", () => {
|
||||||
|
const keyspaceId = `KeyspaceId${crypt.randomBytes(8).toString("hex")}`;
|
||||||
|
const tableId = `TableId112`;
|
||||||
|
|
||||||
|
cy.get("iframe").then($element => {
|
||||||
|
const $body = $element.contents().find("body");
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('div[class="commandBarContainer"]')
|
||||||
|
.should("be.visible")
|
||||||
|
.find('button[data-test="New Table"]')
|
||||||
|
.should("be.visible")
|
||||||
|
.click();
|
||||||
|
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('div[class="contextual-pane-in"]')
|
||||||
|
.should("be.visible")
|
||||||
|
.find('span[id="containerTitle"]');
|
||||||
|
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('input[id="keyspace-id"]')
|
||||||
|
.should("be.visible")
|
||||||
|
.type(keyspaceId);
|
||||||
|
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('input[class="textfontclr"]')
|
||||||
|
.type(tableId);
|
||||||
|
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('input[data-test="databaseThroughputValue"]')
|
||||||
|
.should("have.value", "400");
|
||||||
|
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('data-test="addCollection-createCollection"')
|
||||||
|
.click();
|
||||||
|
|
||||||
|
cy.wait(10000);
|
||||||
|
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('div[data-test="resourceTreeId"]')
|
||||||
|
.should("exist")
|
||||||
|
.find('div[class="treeComponent dataResourceTree"]')
|
||||||
|
.should("contain", tableId);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
81
cypress/integration/dataexplorer/GRAPH/addCollection.spec.ts
Normal file
81
cypress/integration/dataexplorer/GRAPH/addCollection.spec.ts
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
// 1. Click on "New Graph" on the command bar.
|
||||||
|
// 2. Pane with the title "Add Container" should appear on the right side of the screen
|
||||||
|
// 3. It includes an input box for the database Id.
|
||||||
|
// 4. It includes a checkbox called "Create now".
|
||||||
|
// 5. When the checkbox is marked, enter new database id.
|
||||||
|
// 3. Create a database WITH "Provision throughput" checked.
|
||||||
|
// 4. Enter minimum throughput value of 400.
|
||||||
|
// 5. Enter container id to the container id text box.
|
||||||
|
// 6. Enter partition key to the partition key text box.
|
||||||
|
// 7. Click "OK" to create a new container.
|
||||||
|
// 8. Verify the new container is created along with the database id and should appead in the Data Explorer list in the left side of the screen.
|
||||||
|
|
||||||
|
const connectionString = require("../../../utilities/connectionString");
|
||||||
|
|
||||||
|
let crypt = require("crypto");
|
||||||
|
|
||||||
|
context("Graph API Test", () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
connectionString.loginUsingConnectionString(connectionString.constants.graph);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Create a new graph in Graph API", () => {
|
||||||
|
const dbId = `TestDatabase${crypt.randomBytes(8).toString("hex")}`;
|
||||||
|
const graphId = `TestGraph${crypt.randomBytes(8).toString("hex")}`;
|
||||||
|
const partitionKey = `SharedKey${crypt.randomBytes(8).toString("hex")}`;
|
||||||
|
|
||||||
|
cy.get("iframe").then($element => {
|
||||||
|
const $body = $element.contents().find("body");
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('div[class="commandBarContainer"]')
|
||||||
|
.should("be.visible")
|
||||||
|
.find('button[data-test="New Graph"]')
|
||||||
|
.should("be.visible")
|
||||||
|
.click();
|
||||||
|
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('div[class="contextual-pane-in"]')
|
||||||
|
.should("be.visible")
|
||||||
|
.find('span[id="containerTitle"]');
|
||||||
|
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('input[data-test="addCollection-createNewDatabase"]')
|
||||||
|
.check();
|
||||||
|
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('input[data-test="addCollection-newDatabaseId"]')
|
||||||
|
.should("be.visible")
|
||||||
|
.type(dbId);
|
||||||
|
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('input[data-test="addCollectionPane-databaseSharedThroughput"]')
|
||||||
|
.check();
|
||||||
|
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('input[data-test="databaseThroughputValue"]')
|
||||||
|
.should("have.value", "400");
|
||||||
|
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('input[data-test="addCollection-collectionId"]')
|
||||||
|
.type(graphId);
|
||||||
|
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('input[data-test="addCollection-partitionKeyValue"]')
|
||||||
|
.type(partitionKey);
|
||||||
|
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('input[data-test="addCollection-createCollection"]')
|
||||||
|
.click();
|
||||||
|
|
||||||
|
cy.wait(10000);
|
||||||
|
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('div[data-test="resourceTreeId"]')
|
||||||
|
.should("exist")
|
||||||
|
.find('div[class="treeComponent dataResourceTree"]')
|
||||||
|
.should("contain", dbId)
|
||||||
|
.click()
|
||||||
|
.should("contain", graphId);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
80
cypress/integration/dataexplorer/MONGO/addCollection.spec.ts
Normal file
80
cypress/integration/dataexplorer/MONGO/addCollection.spec.ts
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
// 1. Click on "New Container" on the command bar.
|
||||||
|
// 2. Pane with the title "Add Container" should appear on the right side of the screen
|
||||||
|
// 3. It includes an input box for the database Id.
|
||||||
|
// 4. It includes a checkbox called "Create now".
|
||||||
|
// 5. When the checkbox is marked, enter new database id.
|
||||||
|
// 3. Create a database WITH "Provision throughput" checked.
|
||||||
|
// 4. Enter minimum throughput value of 400.
|
||||||
|
// 5. Enter container id to the container id text box.
|
||||||
|
// 6. Enter partition key to the partition key text box.
|
||||||
|
// 7. Click "OK" to create a new container.
|
||||||
|
// // 8. Verify the new container is created along with the database id and should appead in the Data Explorer list in the left side of the screen.
|
||||||
|
|
||||||
|
const connectionString = require("../../../utilities/connectionString");
|
||||||
|
|
||||||
|
let crypt = require("crypto");
|
||||||
|
|
||||||
|
context("Mongo API Test - createDatabase", () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
connectionString.loginUsingConnectionString();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Create a new collection in Mongo API", () => {
|
||||||
|
const dbId = `TestDatabase${crypt.randomBytes(8).toString("hex")}`;
|
||||||
|
const collectionId = `TestCollection${crypt.randomBytes(8).toString("hex")}`;
|
||||||
|
const sharedKey = `SharedKey${crypt.randomBytes(8).toString("hex")}`;
|
||||||
|
|
||||||
|
cy.get("iframe").then($element => {
|
||||||
|
const $body = $element.contents().find("body");
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('div[class="commandBarContainer"]')
|
||||||
|
.should("be.visible")
|
||||||
|
.find('button[data-test="New Collection"]')
|
||||||
|
.should("be.visible")
|
||||||
|
.click();
|
||||||
|
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('div[class="contextual-pane-in"]')
|
||||||
|
.should("be.visible")
|
||||||
|
.find('span[id="containerTitle"]');
|
||||||
|
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('input[data-test="addCollection-createNewDatabase"]')
|
||||||
|
.check();
|
||||||
|
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('input[data-test="addCollection-newDatabaseId"]')
|
||||||
|
.type(dbId);
|
||||||
|
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('input[data-test="addCollectionPane-databaseSharedThroughput"]')
|
||||||
|
.check();
|
||||||
|
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('input[data-test="addCollection-collectionId"]')
|
||||||
|
.type(collectionId);
|
||||||
|
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('input[data-test="databaseThroughputValue"]')
|
||||||
|
.should("have.value", "400");
|
||||||
|
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('input[data-test="addCollection-partitionKeyValue"]')
|
||||||
|
.type(sharedKey);
|
||||||
|
|
||||||
|
cy.wrap($body)
|
||||||
|
.find("#submitBtnAddCollection")
|
||||||
|
.click();
|
||||||
|
|
||||||
|
cy.wait(10000);
|
||||||
|
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('div[data-test="resourceTreeId"]')
|
||||||
|
.should("exist")
|
||||||
|
.find('div[class="treeComponent dataResourceTree"]')
|
||||||
|
.should("contain", dbId)
|
||||||
|
.click()
|
||||||
|
.should("contain", collectionId);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,96 @@
|
|||||||
|
// 1. Click on "New Container" on the command bar.
|
||||||
|
// 2. Pane with the title "Add Container" should appear on the right side of the screen
|
||||||
|
// 3. It includes an input box for the database Id.
|
||||||
|
// 4. It includes a checkbox called "Create now".
|
||||||
|
// 5. When the checkbox is marked, enter new database id.
|
||||||
|
// 3. Create a database WITH "Provision throughput" checked.
|
||||||
|
// 4. Enter minimum throughput value of 400.
|
||||||
|
// 5. Enter container id to the container id text box.
|
||||||
|
// 6. Enter partition key to the partition key text box.
|
||||||
|
// 7. Click "OK" to create a new container.
|
||||||
|
// 8. Verify the new container is created along with the database id and should appead in the Data Explorer list in the left side of the screen.
|
||||||
|
|
||||||
|
const connectionString = require("../../../utilities/connectionString");
|
||||||
|
|
||||||
|
let crypt = require("crypto");
|
||||||
|
|
||||||
|
context("Mongo API Test", () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
connectionString.loginUsingConnectionString();
|
||||||
|
});
|
||||||
|
|
||||||
|
it.skip("Create a new collection in Mongo API - Autopilot", () => {
|
||||||
|
const dbId = `TestDatabase${crypt.randomBytes(8).toString("hex")}`;
|
||||||
|
const collectionId = `TestCollection${crypt.randomBytes(8).toString("hex")}`;
|
||||||
|
const sharedKey = `SharedKey${crypt.randomBytes(8).toString("hex")}`;
|
||||||
|
|
||||||
|
cy.get("iframe").then($element => {
|
||||||
|
const $body = $element.contents().find("body");
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('div[class="commandBarContainer"]')
|
||||||
|
.should("be.visible")
|
||||||
|
.find('button[data-test="New Collection"]')
|
||||||
|
.should("be.visible")
|
||||||
|
.click();
|
||||||
|
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('div[class="contextual-pane-in"]')
|
||||||
|
.should("be.visible")
|
||||||
|
.find('span[id="containerTitle"]');
|
||||||
|
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('input[data-test="addCollection-createNewDatabase"]')
|
||||||
|
.check();
|
||||||
|
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('input[data-test="addCollection-newDatabaseId"]')
|
||||||
|
.type(dbId);
|
||||||
|
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('input[data-test="addCollectionPane-databaseSharedThroughput"]')
|
||||||
|
.check();
|
||||||
|
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('div[class="throughputModeContainer"]')
|
||||||
|
.should("be.visible")
|
||||||
|
.and(input => {
|
||||||
|
expect(input.get(0).textContent, "first item").contains("Autopilot (preview)");
|
||||||
|
expect(input.get(1).textContent, "second item").contains("Manual");
|
||||||
|
});
|
||||||
|
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('input[id="newContainer-databaseThroughput-autoPilotRadio"]')
|
||||||
|
.check();
|
||||||
|
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('select[name="autoPilotTiers"]')
|
||||||
|
// .eq(1).should('contain', '4,000 RU/s');
|
||||||
|
// // .select('4,000 RU/s').should('have.value', '1');
|
||||||
|
|
||||||
|
.find('option[value="2"]')
|
||||||
|
.then($element => $element.get(1).setAttribute("selected", "selected"));
|
||||||
|
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('input[data-test="addCollection-collectionId"]')
|
||||||
|
.type(collectionId);
|
||||||
|
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('input[data-test="addCollection-partitionKeyValue"]')
|
||||||
|
.type(sharedKey);
|
||||||
|
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('input[data-test="addCollection-createCollection"]')
|
||||||
|
.click();
|
||||||
|
|
||||||
|
cy.wait(10000);
|
||||||
|
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('div[data-test="resourceTreeId"]')
|
||||||
|
.should("exist")
|
||||||
|
.find('div[class="treeComponent dataResourceTree"]')
|
||||||
|
.should("contain", dbId)
|
||||||
|
.click()
|
||||||
|
.should("contain", collectionId);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,67 @@
|
|||||||
|
const connectionString = require("../../../utilities/connectionString");
|
||||||
|
|
||||||
|
let crypt = require("crypto");
|
||||||
|
|
||||||
|
context("Mongo API Test", () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
connectionString.loginUsingConnectionString();
|
||||||
|
});
|
||||||
|
|
||||||
|
it.skip("Create a new collection in existing database in Mongo API", () => {
|
||||||
|
const collectionId = `TestCollection${crypt.randomBytes(8).toString("hex")}`;
|
||||||
|
const sharedKey = `SharedKey${crypt.randomBytes(8).toString("hex")}`;
|
||||||
|
|
||||||
|
cy.get("iframe").then($element => {
|
||||||
|
const $body = $element.contents().find("body");
|
||||||
|
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('span[class="nodeLabel"]')
|
||||||
|
.should("be.visible")
|
||||||
|
.then($span => {
|
||||||
|
const dbId1 = $span.text();
|
||||||
|
cy.log("DBBB", dbId1);
|
||||||
|
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('div[class="commandBarContainer"]')
|
||||||
|
.should("be.visible")
|
||||||
|
.find('button[data-test="New Collection"]')
|
||||||
|
.should("be.visible")
|
||||||
|
.click();
|
||||||
|
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('div[class="contextual-pane-in"]')
|
||||||
|
.should("be.visible")
|
||||||
|
.find('span[id="containerTitle"]');
|
||||||
|
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('input[data-test="addCollection-existingDatabase"]')
|
||||||
|
.check();
|
||||||
|
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('input[data-test="addCollection-existingDatabase"]')
|
||||||
|
.type(dbId1);
|
||||||
|
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('input[data-test="addCollection-collectionId"]')
|
||||||
|
.type(collectionId);
|
||||||
|
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('input[data-test="addCollection-partitionKeyValue"]')
|
||||||
|
.type(sharedKey);
|
||||||
|
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('input[data-test="addCollection-createCollection"]')
|
||||||
|
.click();
|
||||||
|
|
||||||
|
cy.wait(10000);
|
||||||
|
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('div[data-test="resourceTreeId"]')
|
||||||
|
.should("exist")
|
||||||
|
.find('div[class="treeComponent dataResourceTree"]')
|
||||||
|
.click()
|
||||||
|
.should("contain", collectionId);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,203 @@
|
|||||||
|
const connectionString = require("../../../utilities/connectionString");
|
||||||
|
|
||||||
|
let crypt = require("crypto");
|
||||||
|
|
||||||
|
context.skip("Mongo API Test", () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
connectionString.loginUsingConnectionString();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Create a new collection in Mongo API - Provision database throughput", () => {
|
||||||
|
const dbId = `TestDatabase${crypt.randomBytes(8).toString("hex")}`;
|
||||||
|
const collectionId = `TestCollection${crypt.randomBytes(8).toString("hex")}`;
|
||||||
|
const sharedKey = `SharedKey${crypt.randomBytes(8).toString("hex")}`;
|
||||||
|
|
||||||
|
cy.get("iframe").then($element => {
|
||||||
|
const $body = $element.contents().find("body");
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('div[class="commandBarContainer"]')
|
||||||
|
.should("be.visible")
|
||||||
|
.find('button[data-test="New Collection"]')
|
||||||
|
.should("be.visible")
|
||||||
|
.click();
|
||||||
|
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('div[class="contextual-pane-in"]')
|
||||||
|
.should("be.visible")
|
||||||
|
.find('span[id="containerTitle"]');
|
||||||
|
|
||||||
|
cy.wrap($body)
|
||||||
|
.find(".createNewDatabaseOrUseExisting")
|
||||||
|
.should("have.length", 2)
|
||||||
|
.and(input => {
|
||||||
|
expect(input.get(0).textContent, "first item").contains("Create new");
|
||||||
|
expect(input.get(1).textContent, "second item").contains("Use existing");
|
||||||
|
});
|
||||||
|
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('input[data-test="addCollection-createNewDatabase"]')
|
||||||
|
.check();
|
||||||
|
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('input[data-test="addCollectionPane-databaseSharedThroughput"]')
|
||||||
|
.check();
|
||||||
|
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('input[data-test="addCollection-newDatabaseId"]')
|
||||||
|
.type(dbId);
|
||||||
|
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('input[data-test="addCollectionPane-databaseSharedThroughput"]')
|
||||||
|
.check();
|
||||||
|
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('input[data-test="databaseThroughputValue"]')
|
||||||
|
.should("have.value", "400");
|
||||||
|
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('input[data-test="addCollection-collectionId"]')
|
||||||
|
.type(collectionId);
|
||||||
|
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('input[data-test="addCollection-partitionKeyValue"]')
|
||||||
|
.type(sharedKey);
|
||||||
|
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('input[data-test="addCollection-createCollection"]')
|
||||||
|
.click();
|
||||||
|
|
||||||
|
cy.wait(10000);
|
||||||
|
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('div[data-test="resourceTreeId"]')
|
||||||
|
.should("exist")
|
||||||
|
.find('div[class="treeComponent dataResourceTree"]')
|
||||||
|
.should("contain", dbId)
|
||||||
|
.click()
|
||||||
|
.should("contain", collectionId);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Create a new collection - without provision database throughput", () => {
|
||||||
|
const dbId = `TestDatabase${crypt.randomBytes(8).toString("hex")}`;
|
||||||
|
const collectionId = `TestCollection${crypt.randomBytes(8).toString("hex")}`;
|
||||||
|
const collectionIdTitle = `Add Collection`;
|
||||||
|
const sharedKey = `SharedKey${crypt.randomBytes(8).toString("hex")}`;
|
||||||
|
|
||||||
|
cy.get("iframe").then($element => {
|
||||||
|
const $body = $element.contents().find("body");
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('div[class="commandBarContainer"]')
|
||||||
|
.should("be.visible")
|
||||||
|
.find('button[data-test="New Collection"]')
|
||||||
|
.should("be.visible")
|
||||||
|
.click();
|
||||||
|
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('div[class="contextual-pane-in"]')
|
||||||
|
.should("be.visible")
|
||||||
|
.find('span[id="containerTitle"]');
|
||||||
|
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('input[data-test="addCollection-createNewDatabase"]')
|
||||||
|
.check();
|
||||||
|
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('input[data-test="addCollection-newDatabaseId"]')
|
||||||
|
.type(dbId);
|
||||||
|
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('input[data-test="addCollectionPane-databaseSharedThroughput"]')
|
||||||
|
.uncheck();
|
||||||
|
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('input[data-test="addCollection-collectionId"]')
|
||||||
|
.type(collectionId);
|
||||||
|
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('input[id="tab2"]')
|
||||||
|
.check({ force: true });
|
||||||
|
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('input[data-test="addCollection-partitionKeyValue"]')
|
||||||
|
.type(sharedKey);
|
||||||
|
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('input[data-test="databaseThroughputValue"]')
|
||||||
|
.should("have.value", "400");
|
||||||
|
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('input[data-test="addCollection-createCollection"]')
|
||||||
|
.click();
|
||||||
|
|
||||||
|
cy.wait(10000);
|
||||||
|
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('div[data-test="resourceTreeId"]')
|
||||||
|
.should("exist")
|
||||||
|
.find('div[class="treeComponent dataResourceTree"]')
|
||||||
|
.should("contain", dbId)
|
||||||
|
.click()
|
||||||
|
.should("contain", collectionId);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Create a new collection - without provision database throughput Fixed Storage Capacity", () => {
|
||||||
|
const dbId = `TestDatabase${crypt.randomBytes(8).toString("hex")}`;
|
||||||
|
const collectionId = `TestCollection${crypt.randomBytes(8).toString("hex")}`;
|
||||||
|
const sharedKey = `SharedKey${crypt.randomBytes(8).toString("hex")}`;
|
||||||
|
|
||||||
|
cy.get("iframe").then($element => {
|
||||||
|
const $body = $element.contents().find("body");
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('div[class="commandBarContainer"]')
|
||||||
|
.should("be.visible")
|
||||||
|
.find('button[data-test="New Collection"]')
|
||||||
|
.should("be.visible")
|
||||||
|
.click();
|
||||||
|
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('div[class="contextual-pane-in"]')
|
||||||
|
.should("be.visible")
|
||||||
|
.find('span[id="containerTitle"]');
|
||||||
|
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('input[data-test="addCollection-createNewDatabase"]')
|
||||||
|
.check();
|
||||||
|
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('input[data-test="addCollection-newDatabaseId"]')
|
||||||
|
.type(dbId);
|
||||||
|
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('input[data-test="addCollectionPane-databaseSharedThroughput"]')
|
||||||
|
.uncheck();
|
||||||
|
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('input[data-test="addCollection-collectionId"]')
|
||||||
|
.type(collectionId);
|
||||||
|
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('input[id="tab1"]')
|
||||||
|
.check({ force: true });
|
||||||
|
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('input[data-test="databaseThroughputValue"]')
|
||||||
|
.should("have.value", "400");
|
||||||
|
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('input[data-test="addCollection-createCollection"]')
|
||||||
|
.click();
|
||||||
|
|
||||||
|
cy.wait(10000);
|
||||||
|
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('div[data-test="resourceTreeId"]')
|
||||||
|
.should("exist")
|
||||||
|
.find('div[class="treeComponent dataResourceTree"]')
|
||||||
|
.should("contain", dbId)
|
||||||
|
.click()
|
||||||
|
.should("contain", collectionId);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
79
cypress/integration/dataexplorer/SQL/addCollection.spec.ts
Normal file
79
cypress/integration/dataexplorer/SQL/addCollection.spec.ts
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
// 1. Click on "New Container" on the command bar.
|
||||||
|
// 2. Pane with the title "Add Container" should appear on the right side of the screen
|
||||||
|
// 3. It includes an input box for the database Id.
|
||||||
|
// 4. It includes a checkbox called "Create now".
|
||||||
|
// 5. When the checkbox is marked, enter new database id.
|
||||||
|
// 3. Create a database WITH "Provision throughput" checked.
|
||||||
|
// 4. Enter minimum throughput value of 400.
|
||||||
|
// 5. Enter container id to the container id text box.
|
||||||
|
// 6. Enter partition key to the partition key text box.
|
||||||
|
// 7. Click "OK" to create a new container.
|
||||||
|
// 8. Verify the new container is created along with the database id and should appead in the Data Explorer list in the left side of the screen.
|
||||||
|
|
||||||
|
const connectionString = require("../../../utilities/connectionString");
|
||||||
|
|
||||||
|
let crypt = require("crypto");
|
||||||
|
|
||||||
|
context("SQL API Test", () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
connectionString.loginUsingConnectionString();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Create a new container in SQL API", () => {
|
||||||
|
const dbId = `TestDatabase${crypt.randomBytes(8).toString("hex")}`;
|
||||||
|
const collectionId = `TestCollection${crypt.randomBytes(8).toString("hex")}`;
|
||||||
|
const sharedKey = `SharedKey${crypt.randomBytes(8).toString("hex")}`;
|
||||||
|
connectionString.loginUsingConnectionString();
|
||||||
|
|
||||||
|
cy.get("iframe").then($element => {
|
||||||
|
const $body = $element.contents().find("body");
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('div[class="commandBarContainer"]')
|
||||||
|
.should("be.visible")
|
||||||
|
.find('button[data-test="New Container"]')
|
||||||
|
.should("be.visible")
|
||||||
|
.click();
|
||||||
|
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('div[class="contextual-pane-in"]')
|
||||||
|
.should("be.visible")
|
||||||
|
.find('span[id="containerTitle"]');
|
||||||
|
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('input[data-test="addCollection-createNewDatabase"]')
|
||||||
|
.check();
|
||||||
|
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('input[data-test="addCollectionPane-databaseSharedThroughput"]')
|
||||||
|
.check();
|
||||||
|
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('input[data-test="addCollection-newDatabaseId"]')
|
||||||
|
.type(dbId);
|
||||||
|
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('input[data-test="addCollection-collectionId"]')
|
||||||
|
.type(collectionId);
|
||||||
|
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('input[data-test="databaseThroughputValue"]')
|
||||||
|
.should("have.value", "400");
|
||||||
|
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('input[data-test="addCollection-partitionKeyValue"]')
|
||||||
|
.type(sharedKey);
|
||||||
|
|
||||||
|
cy.wrap($body)
|
||||||
|
.find("#submitBtnAddCollection")
|
||||||
|
.click();
|
||||||
|
|
||||||
|
cy.wait(10000);
|
||||||
|
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('div[data-test="resourceTreeId"]')
|
||||||
|
.should("exist")
|
||||||
|
.find('div[class="treeComponent dataResourceTree"]')
|
||||||
|
.should("contain", dbId);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
60
cypress/integration/dataexplorer/TABLE/addCollection.spec.ts
Normal file
60
cypress/integration/dataexplorer/TABLE/addCollection.spec.ts
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
// 1. Click on "New Container" on the command bar.
|
||||||
|
// 2. Pane with the title "Add Container" should appear on the right side of the screen
|
||||||
|
// 3. It includes an input box for the database Id.
|
||||||
|
// 4. It includes a checkbox called "Create now".
|
||||||
|
// 5. When the checkbox is marked, enter new database id.
|
||||||
|
// 3. Create a database WITH "Provision throughput" checked.
|
||||||
|
// 4. Enter minimum throughput value of 400.
|
||||||
|
// 5. Enter container id to the container id text box.
|
||||||
|
// 6. Enter partition key to the partition key text box.
|
||||||
|
// 7. Click "OK" to create a new container.
|
||||||
|
// 8. Verify the new container is created along with the database id and should appead in the Data Explorer list in the left side of the screen.
|
||||||
|
|
||||||
|
const connectionString = require("../../../utilities/connectionString");
|
||||||
|
|
||||||
|
let crypt = require("crypto");
|
||||||
|
|
||||||
|
context("Table API Test", () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
connectionString.loginUsingConnectionString(connectionString.constants.table);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Create a new table in Table API", () => {
|
||||||
|
const collectionId = `TestCollection${crypt.randomBytes(8).toString("hex")}`;
|
||||||
|
|
||||||
|
cy.get("iframe").then($element => {
|
||||||
|
const $body = $element.contents().find("body");
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('div[class="commandBarContainer"]')
|
||||||
|
.should("be.visible")
|
||||||
|
.find('button[data-test="New Table"]')
|
||||||
|
.should("be.visible")
|
||||||
|
.click();
|
||||||
|
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('div[class="contextual-pane-in"]')
|
||||||
|
.should("be.visible")
|
||||||
|
.find('span[id="containerTitle"]');
|
||||||
|
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('input[data-test="addCollection-collectionId"]')
|
||||||
|
.type(collectionId);
|
||||||
|
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('input[data-test="databaseThroughputValue"]')
|
||||||
|
.should("have.value", "400");
|
||||||
|
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('input[data-test="addCollection-createCollection"]')
|
||||||
|
.click();
|
||||||
|
|
||||||
|
cy.wait(10000);
|
||||||
|
|
||||||
|
cy.wrap($body)
|
||||||
|
.find('div[data-test="resourceTreeId"]')
|
||||||
|
.should("exist")
|
||||||
|
.find('div[class="treeComponent dataResourceTree"]')
|
||||||
|
.should("contain", collectionId);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
// 1. Click on "New Container" on the command bar.
|
||||||
|
// 2. Pane with the title "Add Container" should appear on the right side of the screen
|
||||||
|
// 3. It includes an input box for the database Id.
|
||||||
|
// 4. It includes a checkbox called "Create now".
|
||||||
|
// 5. When the checkbox is marked, enter new database id.
|
||||||
|
// 3. Create a database WITH "Provision throughput" checked.
|
||||||
|
// 4. Enter minimum throughput value of 400.
|
||||||
|
// 5. Enter container id to the container id text box.
|
||||||
|
// 6. Enter partition key to the partition key text box.
|
||||||
|
// 7. Click "OK" to create a new container.
|
||||||
|
// 8. Verify the new container is created along with the database id and should appead in the Data Explorer list in the left side of the screen.
|
||||||
|
|
||||||
|
let crypt = require("crypto");
|
||||||
|
|
||||||
|
context("Emulator - createDatabase", () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.visit("http://localhost:1234/explorer.html");
|
||||||
|
});
|
||||||
|
|
||||||
|
const dbId = `TestDatabase${crypt.randomBytes(8).toString("hex")}`;
|
||||||
|
const collectionId = `TestCollection${crypt.randomBytes(8).toString("hex")}`;
|
||||||
|
const collectionIdTitle = `Add Collection`;
|
||||||
|
const partitionKey = `PartitionKey${crypt.randomBytes(8).toString("hex")}`;
|
||||||
|
|
||||||
|
it("Create a new collection", () => {
|
||||||
|
cy.contains("New Container").click();
|
||||||
|
|
||||||
|
// cy.contains(collectionIdTitle);
|
||||||
|
|
||||||
|
cy.get(".createNewDatabaseOrUseExisting")
|
||||||
|
.should("have.length", 2)
|
||||||
|
.and(input => {
|
||||||
|
expect(input.get(0).textContent, "first item").contains("Create new");
|
||||||
|
expect(input.get(1).textContent, "second item").contains("Use existing");
|
||||||
|
});
|
||||||
|
|
||||||
|
cy.get('input[data-test="addCollection-createNewDatabase"]').check();
|
||||||
|
|
||||||
|
cy.get('input[data-test="addCollection-newDatabaseId"]').type(dbId);
|
||||||
|
|
||||||
|
cy.get('input[data-test="addCollection-collectionId"]').type(collectionId);
|
||||||
|
|
||||||
|
cy.get('input[data-test="databaseThroughputValue"]').should("have.value", "400");
|
||||||
|
|
||||||
|
cy.get('input[data-test="addCollection-partitionKeyValue"]').type(partitionKey);
|
||||||
|
|
||||||
|
cy.get('input[data-test="addCollection-createCollection"]').click();
|
||||||
|
|
||||||
|
cy.get('div[data-test="resourceTreeId"]').should("exist");
|
||||||
|
|
||||||
|
cy.get('div[data-test="resourceTree-collectionsTree"]').should("contain", dbId);
|
||||||
|
|
||||||
|
cy.get('div[data-test="databaseList"]').should("contain", collectionId);
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
// 1. Click on "New Database" on the command bar
|
||||||
|
// 2. a Pane with the title "Add Database" should appear on the right side of the screen
|
||||||
|
// i. It includes an input box for the database Id.
|
||||||
|
// ii. It includes a checkbox called "Provision throughput".
|
||||||
|
// iii. Whe the checkbox is marked, a new input with a throughput control let's you customize RU at the database level
|
||||||
|
// 3. Create a database WITHOUT "Provision throughput" checked.
|
||||||
|
// 4. It should appear in the Data Explorer list.
|
||||||
|
// 5. Repeat steps 1-3 but create a database WITH "Provision throughput" with the default RU value.
|
||||||
|
// 6. It should appear in the Data Explorer list.
|
||||||
|
// 7. If expanded, it should have the list item called "Scale", that once clicked, it should show the "Scale" tab.
|
||||||
|
// 8. Inside that tab, a throughput control will let you change the RU value within the permited range.
|
||||||
|
// 9. If you change the value, it should enable the "Save" button.
|
||||||
|
// 10. Click "Save" and verify that the process completes without error.
|
||||||
|
// 11. Close the tab and reopen it and verify that the input contains the last saved value.%
|
||||||
|
|
||||||
|
const crypto = require("crypto");
|
||||||
|
const client = require("../../../utilities/cosmosClient");
|
||||||
|
const randomString = crypto.randomBytes(2).toString("hex");
|
||||||
|
const databaseId = `TestDB-${randomString}`;
|
||||||
|
const collectionId = `TestColl-${randomString}`;
|
||||||
|
|
||||||
|
context("Emulator - Create database -> container -> item", () => {
|
||||||
|
beforeEach(async () => {
|
||||||
|
const { resources } = await client.databases.readAll().fetchAll();
|
||||||
|
for (const database of resources) {
|
||||||
|
await client.database(database.id).delete();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
it("creates a new database", () => {
|
||||||
|
cy.visit("https://0.0.0.0:1234/explorer.html?platform=Emulator");
|
||||||
|
cy.contains("New Container").click();
|
||||||
|
cy.get("[data-test=addCollection-newDatabaseId]").click();
|
||||||
|
cy.get("[data-test=addCollection-newDatabaseId]").type(databaseId);
|
||||||
|
cy.get("[data-test=addCollection-collectionId]").click();
|
||||||
|
cy.get("[data-test=addCollection-collectionId]").type(collectionId);
|
||||||
|
cy.get("[data-test=addCollection-partitionKeyValue]").click();
|
||||||
|
cy.get("[data-test=addCollection-partitionKeyValue]").type("/pk");
|
||||||
|
cy.get('input[name="createCollection"]').click();
|
||||||
|
cy.get(".dataResourceTree").should("contain", databaseId);
|
||||||
|
cy.get(".dataResourceTree")
|
||||||
|
.contains(databaseId)
|
||||||
|
.click();
|
||||||
|
cy.get(".dataResourceTree").should("contain", collectionId);
|
||||||
|
cy.get(".dataResourceTree")
|
||||||
|
.contains(collectionId)
|
||||||
|
.click();
|
||||||
|
cy.get(".dataResourceTree")
|
||||||
|
.contains("Items")
|
||||||
|
.click();
|
||||||
|
cy.get(".dataResourceTree")
|
||||||
|
.contains("Items")
|
||||||
|
.click();
|
||||||
|
cy.wait(1000); // React rendering inside KO causes some weird async rendering that makes this test flaky without waiting
|
||||||
|
cy.get(".commandBarContainer")
|
||||||
|
.contains("New Item")
|
||||||
|
.click();
|
||||||
|
cy.wait(1000); // React rendering inside KO causes some weird async rendering that makes this test flaky without waiting
|
||||||
|
cy.get(".commandBarContainer")
|
||||||
|
.contains("Save")
|
||||||
|
.click();
|
||||||
|
cy.wait(1000); // React rendering inside KO causes some weird async rendering that makes this test flaky without waiting
|
||||||
|
cy.get(".documentsGridHeaderContainer").should("contain", "replace_with_new_document_id");
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
// 1. Click last database in the resource tree
|
||||||
|
// 2. Click the last collection within the database
|
||||||
|
// 3. Select the context menu within the collection
|
||||||
|
// 4. Select "Delete Container" option in the dropdown
|
||||||
|
// 5. On Selection, Delete Container pane opens on the right side
|
||||||
|
// 6. Enter the same collection id that is to be deleted and click ok
|
||||||
|
// 7. Now, the resource tree refreshes, the deleted collection should not appear under the database
|
||||||
|
|
||||||
|
let crypt = require("crypto");
|
||||||
|
|
||||||
|
context("Emulator - deleteCollection", () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.visit("http://localhost:1234/explorer.html");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Delete a collection", () => {
|
||||||
|
cy.get(".databaseId")
|
||||||
|
.last()
|
||||||
|
.click();
|
||||||
|
|
||||||
|
cy.get(".collectionList")
|
||||||
|
.last()
|
||||||
|
.then($id => {
|
||||||
|
const collectionId = $id.text();
|
||||||
|
|
||||||
|
cy.get('span[data-test="collectionEllipsisMenu"]').should("exist");
|
||||||
|
|
||||||
|
cy.get('span[data-test="collectionEllipsisMenu"]')
|
||||||
|
.invoke("show")
|
||||||
|
.last()
|
||||||
|
.click();
|
||||||
|
|
||||||
|
cy.get('div[data-test="collectionContextMenu"]')
|
||||||
|
.contains("Delete Container")
|
||||||
|
.click({ force: true });
|
||||||
|
|
||||||
|
cy.get('input[data-test="confirmCollectionId"]').type(collectionId.trim());
|
||||||
|
|
||||||
|
cy.get('input[data-test="deleteCollection"]').click();
|
||||||
|
|
||||||
|
cy.get('div[data-test="databaseList"]').should("not.contain", collectionId);
|
||||||
|
|
||||||
|
cy.get('div[data-test="databaseMenu"]').should("not.contain", collectionId);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,83 @@
|
|||||||
|
// 1. Click last database in the resource tree
|
||||||
|
// 2. Select the context menu within the database
|
||||||
|
// 4. Select "Delete Database" option in the dropdown
|
||||||
|
// 5. On Selection, Delete Database pane opens on the right side
|
||||||
|
// 6. Enter the same database id that is to be deleted and click ok
|
||||||
|
// 7. Now, the resource tree refreshes, the deleted database should not appear in the resource tree
|
||||||
|
|
||||||
|
let crypt = require("crypto");
|
||||||
|
|
||||||
|
context("Emulator - deleteDatabase", () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
const dbId = `TestDatabase${crypt.randomBytes(8).toString("hex")}`;
|
||||||
|
const collectionId = `TestCollection${crypt.randomBytes(8).toString("hex")}`;
|
||||||
|
let db_rid = "";
|
||||||
|
const date = new Date().toUTCString();
|
||||||
|
let authToken = "";
|
||||||
|
cy.visit("http://localhost:1234/explorer.html");
|
||||||
|
|
||||||
|
// Creating auth token for collection creation
|
||||||
|
cy.request({
|
||||||
|
method: "GET",
|
||||||
|
url: "https://localhost:8081/_explorer/authorization/post/dbs/",
|
||||||
|
headers: {
|
||||||
|
"x-ms-date": date,
|
||||||
|
authorization: "-"
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.then(response => {
|
||||||
|
authToken = response.body.Token; // Getting auth token for collection creation
|
||||||
|
return new Cypress.Promise((resolve, reject) => {
|
||||||
|
return resolve();
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
cy.request({
|
||||||
|
method: "POST",
|
||||||
|
url: "https://localhost:8081/dbs",
|
||||||
|
headers: {
|
||||||
|
"x-ms-date": date,
|
||||||
|
authorization: authToken,
|
||||||
|
"x-ms-version": "2018-12-31"
|
||||||
|
},
|
||||||
|
body: {
|
||||||
|
id: dbId
|
||||||
|
}
|
||||||
|
}).then(response => {
|
||||||
|
cy.log("Response", response);
|
||||||
|
db_rid = response.body._rid;
|
||||||
|
return new Cypress.Promise((resolve, reject) => {
|
||||||
|
cy.log("Rid", db_rid);
|
||||||
|
return resolve();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Delete a database", () => {
|
||||||
|
cy.get('span[data-test="refreshTree"]').click();
|
||||||
|
|
||||||
|
cy.get(".databaseId")
|
||||||
|
.last()
|
||||||
|
.then($id => {
|
||||||
|
const dbId = $id.text();
|
||||||
|
|
||||||
|
cy.get('span[data-test="databaseEllipsisMenu"]').should("exist");
|
||||||
|
|
||||||
|
cy.get('span[data-test="databaseEllipsisMenu"]')
|
||||||
|
.invoke("show")
|
||||||
|
.last()
|
||||||
|
.click();
|
||||||
|
|
||||||
|
cy.get('div[data-test="databaseContextMenu"]')
|
||||||
|
.contains("Delete Database")
|
||||||
|
.click({ force: true });
|
||||||
|
|
||||||
|
cy.get('input[data-test="confirmDatabaseId"]').type(dbId.trim());
|
||||||
|
|
||||||
|
cy.get('input[data-test="deleteDatabase"]').click();
|
||||||
|
|
||||||
|
cy.get('div[data-test="databaseList"]').should("not.contain", dbId);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
35
cypress/integration/notebook/README.md
Normal file
35
cypress/integration/notebook/README.md
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
# Notebook end-to-end tests
|
||||||
|
This describes how to run the tests locally
|
||||||
|
|
||||||
|
## Stand up a local notebook container instance:
|
||||||
|
Instructions on how to build and run the container [here](https://microsoft.sharepoint.com/teams/DocDB/_layouts/OneNote.aspx?id=%2Fteams%2FDocDB%2FSiteAssets%2FDocDB%20Team%20Notebook&wd=target%28Tools%20_%20SDK%2FPortal%2FDevelopment.one%7CF800BE8E-1E31-48FE-90D7-EF698EF88112%2FHow%20to%20build%20notebook%20service%7C4BAA153B-422C-41E2-B997-F3FCE02CD743%2F%29)
|
||||||
|
|
||||||
|
## Run a local data explorer
|
||||||
|
Instructions are in [`DataExplorer/README.md`](https://msdata.visualstudio.com/CosmosDB/_git/cosmosdb-dataexplorer?path=%2FProduct%2FPortal%2FDataExplorer%2FREADME.md&_a=preview).
|
||||||
|
|
||||||
|
Make sure you can run Data Explorer locally from the web browser.
|
||||||
|
|
||||||
|
## Run cypress tests
|
||||||
|
1. Edit the URL for your DataExplorer in the `.spec.ts` file
|
||||||
|
2. Run the test:
|
||||||
|
```bash
|
||||||
|
cd DataExplorer/cypress
|
||||||
|
npm i
|
||||||
|
npm t -- --spec 'integration/notebook/newNotebook.spec.ts'
|
||||||
|
```
|
||||||
|
|
||||||
|
To run in Debug mode:
|
||||||
|
```
|
||||||
|
npm run test:debug
|
||||||
|
```
|
||||||
|
This opens Cypress UI
|
||||||
|
|
||||||
|
## Troubleshooting
|
||||||
|
* The tests are recorded in the `videos` folder.
|
||||||
|
* Cypress does not support hover: workarounds [here](https://docs.cypress.io/api/commands/hover.html#Workarounds).
|
||||||
|
|
||||||
|
|
||||||
|
## References
|
||||||
|
* [Cypress API](https://docs.cypress.io/api/api/table-of-contents.html)
|
||||||
|
* [Cypress cookbook](https://docs.cypress.io/faq/questions/using-cypress-faq.html#How-do-I-get-an-element%E2%80%99s-text-contents)
|
||||||
|
* [Cypress best practices](https://docs.cypress.io/guides/references/best-practices.html#Selecting-Elements)
|
||||||
93
cypress/integration/notebook/newNotebook.spec.ts
Normal file
93
cypress/integration/notebook/newNotebook.spec.ts
Normal file
@@ -0,0 +1,93 @@
|
|||||||
|
// THIS ADDS A NEW NOTEBOOK TO YOUR NOTEBOOKS
|
||||||
|
context("New Notebook smoke test", () => {
|
||||||
|
const timeout = 15000; // in ms
|
||||||
|
const explorerUrl =
|
||||||
|
"https://localhost:1234/explorer.html?feature.notebookserverurl=https%3A%2F%2Flocalhost%3A10001%2F12345%2Fnotebook&feature.notebookServerToken=token&feature.enablenotebooks=true";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wait for UI to be ready
|
||||||
|
*/
|
||||||
|
const waitForReady = () => {
|
||||||
|
cy.get(".splashScreenContainer", { timeout }).should("be.visible");
|
||||||
|
};
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.visit(explorerUrl);
|
||||||
|
waitForReady();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Create a new notebook and run some code", () => {
|
||||||
|
// Create new notebook
|
||||||
|
cy.contains("New Notebook").click();
|
||||||
|
|
||||||
|
// Check tab name
|
||||||
|
cy.get("li.tabList .tabNavText").should($span => {
|
||||||
|
const text = $span.text();
|
||||||
|
expect(text).to.match(/^Untitled.*\.ipynb$/);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Wait for python3 | idle status
|
||||||
|
cy.get('[data-test="notebookStatusBar"] [data-test="kernelStatus"]', { timeout }).should($p => {
|
||||||
|
const text = $p.text();
|
||||||
|
expect(text).to.match(/^python3.*idle$/);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Click on a cell
|
||||||
|
cy.get(".cell-container")
|
||||||
|
.as("cellContainer")
|
||||||
|
.click();
|
||||||
|
|
||||||
|
// Type in some code
|
||||||
|
cy.get("@cellContainer").type("2+4");
|
||||||
|
|
||||||
|
// Execute
|
||||||
|
cy.get('[data-test="Run"]')
|
||||||
|
.first()
|
||||||
|
.click();
|
||||||
|
|
||||||
|
// Verify results
|
||||||
|
cy.get("@cellContainer").within(() => {
|
||||||
|
cy.get("pre code span").should("contain", "6");
|
||||||
|
});
|
||||||
|
|
||||||
|
// Restart kernel
|
||||||
|
cy.get('[data-test="Run"] button')
|
||||||
|
.eq(-1)
|
||||||
|
.click();
|
||||||
|
cy.get("li")
|
||||||
|
.contains("Restart Kernel")
|
||||||
|
.click();
|
||||||
|
|
||||||
|
// Wait for python3 | restarting status
|
||||||
|
cy.get('[data-test="notebookStatusBar"] [data-test="kernelStatus"]', { timeout }).should($p => {
|
||||||
|
const text = $p.text();
|
||||||
|
expect(text).to.match(/^python3.*restarting$/);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Wait for python3 | idle status
|
||||||
|
cy.get('[data-test="notebookStatusBar"] [data-test="kernelStatus"]', { timeout }).should($p => {
|
||||||
|
const text = $p.text();
|
||||||
|
expect(text).to.match(/^python3.*idle$/);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Click on a cell
|
||||||
|
cy.get(".cell-container")
|
||||||
|
.as("cellContainer")
|
||||||
|
.find(".input")
|
||||||
|
.as("codeInput")
|
||||||
|
.click();
|
||||||
|
|
||||||
|
// Type in some code
|
||||||
|
cy.get("@codeInput").type("{backspace}{backspace}{backspace}4+5");
|
||||||
|
|
||||||
|
// Execute
|
||||||
|
cy.get('[data-test="Run"]')
|
||||||
|
.first()
|
||||||
|
.click();
|
||||||
|
|
||||||
|
// Verify results
|
||||||
|
cy.get("@cellContainer").within(() => {
|
||||||
|
cy.get("pre code span").should("contain", "9");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
172
cypress/integration/notebook/resourceTree.spec.ts
Normal file
172
cypress/integration/notebook/resourceTree.spec.ts
Normal file
@@ -0,0 +1,172 @@
|
|||||||
|
context("Resource tree notebook file manipulation", () => {
|
||||||
|
const timeout = 15000; // in ms
|
||||||
|
const explorerUrl =
|
||||||
|
"https://localhost:1234/explorer.html?feature.notebookserverurl=https%3A%2F%2Flocalhost%3A10001%2F12345%2Fnotebook&feature.notebookServerToken=token&feature.enablenotebooks=true";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wait for UI to be ready
|
||||||
|
*/
|
||||||
|
const waitForReady = () => {
|
||||||
|
cy.get(".splashScreenContainer", { timeout }).should("be.visible");
|
||||||
|
};
|
||||||
|
|
||||||
|
const clickContextMenuAndSelectOption = (nodeLabel, option) => {
|
||||||
|
cy.get(`.treeNodeHeader[data-test="${nodeLabel}"]`)
|
||||||
|
.find("button.treeMenuEllipsis")
|
||||||
|
.click();
|
||||||
|
cy.get('[data-test="treeComponentMenuItemContainer"]')
|
||||||
|
.contains(option)
|
||||||
|
.click();
|
||||||
|
};
|
||||||
|
|
||||||
|
const createFolder = folder => {
|
||||||
|
clickContextMenuAndSelectOption("My Notebooks/", "New Directory");
|
||||||
|
|
||||||
|
cy.get("#stringInputPane").within(() => {
|
||||||
|
cy.get('input[name="collectionIdConfirmation"]').type(folder);
|
||||||
|
cy.get("form").submit();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const deleteItem = nodeName => {
|
||||||
|
clickContextMenuAndSelectOption(`${nodeName}`, "Delete");
|
||||||
|
cy.get(".ms-Dialog-main")
|
||||||
|
.contains("Delete")
|
||||||
|
.click();
|
||||||
|
};
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.visit(explorerUrl);
|
||||||
|
waitForReady();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Create and remove a directory", () => {
|
||||||
|
const folder = "e2etest_folder1";
|
||||||
|
createFolder(folder);
|
||||||
|
cy.get(`.treeNodeHeader[data-test="${folder}/"]`).should("exist");
|
||||||
|
deleteItem(`${folder}/`);
|
||||||
|
cy.get(`.treeNodeHeader[data-test="${folder}/"]`).should("not.exist");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Create and rename a directory", () => {
|
||||||
|
const folder = "e2etest_folder2";
|
||||||
|
const renamedFolder = "e2etest_folder2_renamed";
|
||||||
|
createFolder(folder);
|
||||||
|
|
||||||
|
// Rename
|
||||||
|
clickContextMenuAndSelectOption(`${folder}/`, "Rename");
|
||||||
|
cy.get("#stringInputPane").within(() => {
|
||||||
|
cy.get('input[name="collectionIdConfirmation"]')
|
||||||
|
.clear()
|
||||||
|
.type(renamedFolder);
|
||||||
|
cy.get("form").submit();
|
||||||
|
});
|
||||||
|
cy.get(`.treeNodeHeader[data-test="${renamedFolder}/"]`).should("exist");
|
||||||
|
cy.get(`.treeNodeHeader[data-test="${folder}/"]`).should("not.exist");
|
||||||
|
|
||||||
|
deleteItem(`${renamedFolder}/`);
|
||||||
|
cy.get(`.treeNodeHeader[data-test="${renamedFolder}/"]`).should("not.exist");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Create a notebook inside a directory", () => {
|
||||||
|
const folder = "e2etest_folder3";
|
||||||
|
const newNotebookName = "Untitled.ipynb";
|
||||||
|
createFolder(folder);
|
||||||
|
clickContextMenuAndSelectOption(`${folder}/`, "New Notebook");
|
||||||
|
|
||||||
|
// Verify tab is open
|
||||||
|
cy.get(".tabList")
|
||||||
|
.contains(newNotebookName)
|
||||||
|
.should("exist");
|
||||||
|
|
||||||
|
// Close tab
|
||||||
|
cy.get(`.tabList[title="notebooks/${folder}/${newNotebookName}"]`)
|
||||||
|
.find(".cancelButton")
|
||||||
|
.click();
|
||||||
|
// When running from command line, closing the tab is too fast
|
||||||
|
cy.get("body").then($body => {
|
||||||
|
if ($body.find(".ms-Dialog-main").length) {
|
||||||
|
// For some reason, this does not work
|
||||||
|
// cy.get(".ms-Dialog-main").contains("Close").click();
|
||||||
|
cy.get(".ms-Dialog-main .ms-Button--primary").click();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Expand folder node
|
||||||
|
cy.get(`.treeNodeHeader[data-test="${folder}/"]`).click();
|
||||||
|
cy.get(`.nodeChildren[data-test="${folder}/"] .treeNodeHeader[data-test="${newNotebookName}"]`).should("exist");
|
||||||
|
|
||||||
|
// Delete notebook
|
||||||
|
cy.get(`.nodeChildren[data-test="${folder}/"] .treeNodeHeader[data-test="${newNotebookName}"]`)
|
||||||
|
.find("button.treeMenuEllipsis")
|
||||||
|
.click();
|
||||||
|
cy.get('[data-test="treeComponentMenuItemContainer"]')
|
||||||
|
.contains("Delete")
|
||||||
|
.click();
|
||||||
|
|
||||||
|
// Confirm
|
||||||
|
cy.get(".ms-Dialog-main")
|
||||||
|
.contains("Delete")
|
||||||
|
.click();
|
||||||
|
cy.get(`.nodeChildren[data-test="${folder}/"] .treeNodeHeader[data-test="${newNotebookName}"]`).should("not.exist");
|
||||||
|
|
||||||
|
deleteItem(`${folder}/`);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Create and rename a notebook inside a directory", () => {
|
||||||
|
const folder = "e2etest_folder4";
|
||||||
|
const newNotebookName = "Untitled.ipynb";
|
||||||
|
const renamedNotebookName = "mynotebook.ipynb";
|
||||||
|
createFolder(folder);
|
||||||
|
clickContextMenuAndSelectOption(`${folder}/`, "New Notebook");
|
||||||
|
|
||||||
|
// Close tab
|
||||||
|
cy.get(`.tabList[title="notebooks/${folder}/${newNotebookName}"]`)
|
||||||
|
.find(".cancelButton")
|
||||||
|
.click();
|
||||||
|
cy.get("body").then($body => {
|
||||||
|
if ($body.find(".ms-Dialog-main").length) {
|
||||||
|
// For some reason, this does not work
|
||||||
|
// cy.get(".ms-Dialog-main").contains("Close").click();
|
||||||
|
cy.get(".ms-Dialog-main .ms-Button--primary").click();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Expand folder node
|
||||||
|
cy.get(`.treeNodeHeader[data-test="${folder}/"]`).click();
|
||||||
|
cy.get(`.nodeChildren[data-test="${folder}/"] .treeNodeHeader[data-test="${newNotebookName}"]`).should("exist");
|
||||||
|
|
||||||
|
// Rename notebook
|
||||||
|
cy.get(`.nodeChildren[data-test="${folder}/"] .treeNodeHeader[data-test="${newNotebookName}"]`)
|
||||||
|
.find("button.treeMenuEllipsis")
|
||||||
|
.click();
|
||||||
|
cy.get('[data-test="treeComponentMenuItemContainer"]')
|
||||||
|
.contains("Rename")
|
||||||
|
.click();
|
||||||
|
|
||||||
|
cy.get("#stringInputPane").within(() => {
|
||||||
|
cy.get('input[name="collectionIdConfirmation"]')
|
||||||
|
.clear()
|
||||||
|
.type(renamedNotebookName);
|
||||||
|
cy.get("form").submit();
|
||||||
|
});
|
||||||
|
cy.get(`.nodeChildren[data-test="${folder}/"] .treeNodeHeader[data-test="${newNotebookName}"]`).should("not.exist");
|
||||||
|
cy.get(`.nodeChildren[data-test="${folder}/"] .treeNodeHeader[data-test="${renamedNotebookName}"]`).should("exist");
|
||||||
|
|
||||||
|
// Delete notebook
|
||||||
|
cy.get(`.nodeChildren[data-test="${folder}/"] .treeNodeHeader[data-test="${renamedNotebookName}"]`)
|
||||||
|
.find("button.treeMenuEllipsis")
|
||||||
|
.click();
|
||||||
|
cy.get('[data-test="treeComponentMenuItemContainer"]')
|
||||||
|
.contains("Delete")
|
||||||
|
.click();
|
||||||
|
|
||||||
|
// Confirm
|
||||||
|
cy.get(".ms-Dialog-main")
|
||||||
|
.contains("Delete")
|
||||||
|
.click();
|
||||||
|
// Give it time to settle
|
||||||
|
cy.wait(1000);
|
||||||
|
deleteItem(`${folder}/`);
|
||||||
|
});
|
||||||
|
});
|
||||||
3066
cypress/package-lock.json
generated
Normal file
3066
cypress/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
25
cypress/package.json
Normal file
25
cypress/package.json
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
{
|
||||||
|
"name": "cosmos-explorer-cypress",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "",
|
||||||
|
"main": "index.js",
|
||||||
|
"scripts": {
|
||||||
|
"test": "cypress run",
|
||||||
|
"wait-for-server": "wait-on -t 240000 -i 5000 -v https-get://0.0.0.0:1234/",
|
||||||
|
"test:sql": "cypress run --browser chrome --spec \"./integration/dataexplorer/SQL/*\"",
|
||||||
|
"test:ci": "wait-on -t 240000 -i 5000 -v https-get://0.0.0.0:1234/ https-get://0.0.0.0:8081/_explorer/index.html && cypress run --browser edge --headless",
|
||||||
|
"test:debug": "cypress open"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"cypress": "^4.8.0",
|
||||||
|
"mocha": "^7.0.1",
|
||||||
|
"mochawesome": "^4.1.0",
|
||||||
|
"mochawesome-merge": "^4.0.1",
|
||||||
|
"mochawesome-report-generator": "^4.1.0",
|
||||||
|
"typescript": "3.4.3",
|
||||||
|
"wait-on": "^4.0.2"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@microsoft/applicationinsights-web": "^2.5.2"
|
||||||
|
}
|
||||||
|
}
|
||||||
23
cypress/support/index.js
Normal file
23
cypress/support/index.js
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
let appInsightsLib = require("@microsoft/applicationinsights-web");
|
||||||
|
|
||||||
|
const appInsights = new appInsightsLib.ApplicationInsights({
|
||||||
|
config: {
|
||||||
|
instrumentationKey: "fe61c39f-7d32-4488-a191-b13621965315"
|
||||||
|
/* ...Other Configuration Options... */
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
appInsights.loadAppInsights();
|
||||||
|
|
||||||
|
Cypress.on("fail", (error, runnable) => {
|
||||||
|
// App Insights will record the fail tests for Create Collection
|
||||||
|
let message = JSON.stringify(runnable.title);
|
||||||
|
appInsights.trackTrace({
|
||||||
|
message: `${message}`,
|
||||||
|
properties: {
|
||||||
|
passed: false,
|
||||||
|
error: error
|
||||||
|
}
|
||||||
|
});
|
||||||
|
throw error; // throw error to have test still fail
|
||||||
|
});
|
||||||
11
cypress/tsconfig.json
Normal file
11
cypress/tsconfig.json
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"strict": true,
|
||||||
|
"noEmit": true,
|
||||||
|
"module": "commonjs",
|
||||||
|
"target": "es5",
|
||||||
|
"lib": ["es5", "dom", "es6"],
|
||||||
|
"types": ["cypress", "node"]
|
||||||
|
},
|
||||||
|
"include": ["**/*.ts", "**/*.spec.ts"]
|
||||||
|
}
|
||||||
41
cypress/utilities/connectionString.js
Normal file
41
cypress/utilities/connectionString.js
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
module.exports = {
|
||||||
|
loginUsingConnectionString: function() {
|
||||||
|
const prodUrl = Cypress.env("TEST_ENDPOINT") || "https://localhost:1234/hostedExplorer.html";
|
||||||
|
const timeout = 15000;
|
||||||
|
|
||||||
|
cy.visit(prodUrl);
|
||||||
|
cy.get('iframe[id="explorerMenu"]').should("be.visible");
|
||||||
|
|
||||||
|
cy.get("iframe").then($element => {
|
||||||
|
const $body = $element.contents().find("body");
|
||||||
|
|
||||||
|
cy.wrap($body)
|
||||||
|
.find("#connectExplorer")
|
||||||
|
.should("exist")
|
||||||
|
.find("div[class='connectExplorer']")
|
||||||
|
.should("exist")
|
||||||
|
.find("p[class='welcomeText']")
|
||||||
|
.should("exist");
|
||||||
|
|
||||||
|
cy.wrap($body.find("div > p.switchConnectTypeText"))
|
||||||
|
.should("exist")
|
||||||
|
.last()
|
||||||
|
.click({ force: true });
|
||||||
|
|
||||||
|
const secret = Cypress.env("CONNECTION_STRING");
|
||||||
|
|
||||||
|
cy.wrap($body)
|
||||||
|
.find("input[class='inputToken']")
|
||||||
|
.should("exist")
|
||||||
|
.type(secret, {
|
||||||
|
force: true
|
||||||
|
});
|
||||||
|
|
||||||
|
cy.wrap($body.find("input[value='Connect']"), { timeout })
|
||||||
|
.first()
|
||||||
|
.click({ force: true });
|
||||||
|
|
||||||
|
cy.wait(15000);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
6
cypress/utilities/cosmosClient.js
Normal file
6
cypress/utilities/cosmosClient.js
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
const { CosmosClient } = require("@azure/cosmos");
|
||||||
|
|
||||||
|
module.exports = new CosmosClient({
|
||||||
|
endpoint: "https://0.0.0.0:8081",
|
||||||
|
key: "C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw=="
|
||||||
|
});
|
||||||
1963
externals/adal.js
vendored
Normal file
1963
externals/adal.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
10
externals/iframeResizer.contentWindow.min.js
vendored
10
externals/iframeResizer.contentWindow.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -1,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.31449 2.01439L4.00103 5.31963L3.26105 4.57965L7.8407 0L12.4203 4.57965L11.6804 5.31963L8.36691 2.01439V12.8428H7.31449V2.01439ZM13.629 12.8428H14.6814V16H1V12.8428H2.05242V14.9476H13.629V12.8428Z" fill="#0078D4"/>
|
|
||||||
</svg>
|
|
||||||
|
Before Width: | Height: | Size: 329 B |
@@ -1,13 +0,0 @@
|
|||||||
const isCI = require("is-ci");
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
exitOnPageError: false,
|
|
||||||
launchOptions: {
|
|
||||||
headless: isCI,
|
|
||||||
slowMo: 10,
|
|
||||||
timeout: 60000,
|
|
||||||
},
|
|
||||||
contextOptions: {
|
|
||||||
ignoreHTTPSErrors: true,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
11
jest-puppeteer.config.js
Normal file
11
jest-puppeteer.config.js
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
const isCI = require("is-ci");
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
launch: {
|
||||||
|
headless: isCI,
|
||||||
|
slowMo: 55,
|
||||||
|
defaultViewport: null,
|
||||||
|
ignoreHTTPSErrors: true,
|
||||||
|
args: ["--disable-web-security"]
|
||||||
|
}
|
||||||
|
};
|
||||||
5
jest.config.e2e.js
Normal file
5
jest.config.e2e.js
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
module.exports = {
|
||||||
|
preset: "jest-puppeteer",
|
||||||
|
testMatch: ["<rootDir>/test/**/*.spec.[jt]s?(x)"],
|
||||||
|
setupFiles: ["dotenv/config"]
|
||||||
|
};
|
||||||
@@ -21,13 +21,17 @@ module.exports = {
|
|||||||
collectCoverage: true,
|
collectCoverage: true,
|
||||||
|
|
||||||
// An array of glob patterns indicating a set of files for which coverage information should be collected
|
// An array of glob patterns indicating a set of files for which coverage information should be collected
|
||||||
collectCoverageFrom: ["src/**/*.{js,jsx,ts,tsx}"],
|
// collectCoverageFrom: [
|
||||||
|
// "src/Common/Headers*"
|
||||||
|
// ],
|
||||||
|
|
||||||
// The directory where Jest should output its coverage files
|
// The directory where Jest should output its coverage files
|
||||||
coverageDirectory: "coverage",
|
coverageDirectory: "coverage",
|
||||||
|
|
||||||
// An array of regexp pattern strings used to skip coverage collection
|
// An array of regexp pattern strings used to skip coverage collection
|
||||||
coveragePathIgnorePatterns: ["/node_modules/"],
|
// coveragePathIgnorePatterns: [
|
||||||
|
// "/node_modules/"
|
||||||
|
// ],
|
||||||
|
|
||||||
// A list of reporter names that Jest uses when writing coverage reports
|
// A list of reporter names that Jest uses when writing coverage reports
|
||||||
coverageReporters: ["json", "text", "cobertura"],
|
coverageReporters: ["json", "text", "cobertura"],
|
||||||
@@ -35,11 +39,11 @@ module.exports = {
|
|||||||
// An object that configures minimum threshold enforcement for coverage results
|
// An object that configures minimum threshold enforcement for coverage results
|
||||||
coverageThreshold: {
|
coverageThreshold: {
|
||||||
global: {
|
global: {
|
||||||
branches: 25,
|
branches: 20,
|
||||||
functions: 25,
|
functions: 24,
|
||||||
lines: 30,
|
lines: 30,
|
||||||
statements: 30,
|
statements: 29.0
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// Make calling deprecated APIs throw helpful error messages
|
// Make calling deprecated APIs throw helpful error messages
|
||||||
@@ -67,12 +71,12 @@ module.exports = {
|
|||||||
|
|
||||||
// A map from regular expressions to module names that allow to stub out resources with a single module
|
// A map from regular expressions to module names that allow to stub out resources with a single module
|
||||||
moduleNameMapper: {
|
moduleNameMapper: {
|
||||||
"^.*[.](svg|png|gif|less|css)$": "<rootDir>/mockModule",
|
"^.*[.](svg|png|gif|less)$": "<rootDir>/mockModule",
|
||||||
"@nteract/stateful-components/(.*)$": "<rootDir>/mockModule",
|
"worker-loader": "<rootDir>/mockModule",
|
||||||
"office-ui-fabric-react/lib/(.*)$": "office-ui-fabric-react/lib-commonjs/$1", // https://github.com/OfficeDev/office-ui-fabric-react/wiki/Fabric-6-Release-Notes
|
"office-ui-fabric-react/lib/(.*)$": "office-ui-fabric-react/lib-commonjs/$1", // https://github.com/OfficeDev/office-ui-fabric-react/wiki/Fabric-6-Release-Notes
|
||||||
"^dnd-core$": "dnd-core/dist/cjs",
|
"^dnd-core$": "dnd-core/dist/cjs",
|
||||||
"^react-dnd$": "react-dnd/dist/cjs",
|
"^react-dnd$": "react-dnd/dist/cjs",
|
||||||
"^react-dnd-html5-backend$": "react-dnd-html5-backend/dist/cjs",
|
"^react-dnd-html5-backend$": "react-dnd-html5-backend/dist/cjs"
|
||||||
},
|
},
|
||||||
|
|
||||||
// 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
|
||||||
@@ -160,11 +164,11 @@ module.exports = {
|
|||||||
// A map from regular expressions to paths to transformers
|
// A map from regular expressions to paths to transformers
|
||||||
transform: {
|
transform: {
|
||||||
"^.+\\.html?$": "html-loader-jest",
|
"^.+\\.html?$": "html-loader-jest",
|
||||||
"^.+\\.[t|j]sx?$": "babel-jest",
|
"^.+\\.[t|j]sx?$": "babel-jest"
|
||||||
},
|
},
|
||||||
|
|
||||||
// An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
|
// An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
|
||||||
transformIgnorePatterns: ["/node_modules/", "/externals/"],
|
transformIgnorePatterns: ["/node_modules/", "/externals/"]
|
||||||
|
|
||||||
// An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them
|
// An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them
|
||||||
// unmockedModulePathPatterns: undefined,
|
// unmockedModulePathPatterns: undefined,
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
module.exports = {
|
|
||||||
preset: "jest-playwright-preset",
|
|
||||||
testMatch: ["<rootDir>/test/**/*.spec.[jt]s?(x)"],
|
|
||||||
setupFiles: ["dotenv/config"],
|
|
||||||
testEnvironment: "./test/playwrightEnv.js",
|
|
||||||
setupFilesAfterEnv: ["expect-playwright"],
|
|
||||||
};
|
|
||||||
@@ -3,8 +3,8 @@
|
|||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: wf_segoe-ui_normal;
|
font-family: wf_segoe-ui_normal;
|
||||||
src: url("../../fonts/segoe-ui/west-european/normal/latest.woff");
|
src: url('../../fonts/segoe-ui/west-european/normal/latest.woff');
|
||||||
}
|
}
|
||||||
|
|
||||||
@DataExplorerFont: wf_segoe-ui_normal, "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif;
|
@DataExplorerFont: wf_segoe-ui_normal, "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif;
|
||||||
@@ -20,26 +20,26 @@
|
|||||||
COLORS
|
COLORS
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
@AccentMediumHigh: #0058ad;
|
@AccentMediumHigh: #0058AD;
|
||||||
@AccentMedium: #004e87;
|
@AccentMedium: #004E87;
|
||||||
@AccentHigh: #1ebaed;
|
@AccentHigh: #1EBAED;
|
||||||
@AccentExtraHigh: #55b3ff;
|
@AccentExtraHigh: #55B3FF;
|
||||||
@AccentLow: #edf6ff;
|
@AccentLow: #EDF6FF;
|
||||||
@AccentMediumLow: #ddeefe;
|
@AccentMediumLow: #DDEEFE;
|
||||||
@AccentLight: #eef7ff;
|
@AccentLight: #EEF7FF;
|
||||||
@AccentExtra: #ddf0ff;
|
@AccentExtra: #DDF0FF;
|
||||||
|
|
||||||
@SelectionHigh: #b91f26;
|
@SelectionHigh: #B91F26;
|
||||||
@BaseLight: #ffffff;
|
@BaseLight: #FFFFFF;
|
||||||
@BaseDark: #000000;
|
@BaseDark: #000000;
|
||||||
@NotificationLow: #fff4ce;
|
@NotificationLow: #FFF4CE;
|
||||||
@NotificationHigh: #f9e9b0;
|
@NotificationHigh: #F9E9B0;
|
||||||
@Purple1: #8a2da5;
|
@Purple1: #8A2DA5;
|
||||||
@Dirty: #9b4f96;
|
@Dirty: #9b4f96;
|
||||||
|
|
||||||
@BaseLow: #f2f2f2;
|
@BaseLow: #F2F2F2;
|
||||||
@BaseMediumLow: #e6e6e6;
|
@BaseMediumLow: #E6E6E6;
|
||||||
@BaseMedium: #cccccc;
|
@BaseMedium: #CCCCCC;
|
||||||
@BaseMediumHigh: #767676;
|
@BaseMediumHigh: #767676;
|
||||||
@BaseHigh: #393939;
|
@BaseHigh: #393939;
|
||||||
|
|
||||||
@@ -53,17 +53,10 @@
|
|||||||
|
|
||||||
@ErrorColor: @SelectionHigh;
|
@ErrorColor: @SelectionHigh;
|
||||||
|
|
||||||
@SelectionColor: #3074b0;
|
@SelectionColor: #3074B0;
|
||||||
|
|
||||||
@FocusColor: #605e5c;
|
@FocusColor: #605e5c;
|
||||||
|
|
||||||
@GalleryBackgroundColor: #fdfdfd;
|
|
||||||
|
|
||||||
//Icons
|
|
||||||
@InfoIconColor: #0072c6;
|
|
||||||
@WarningIconColor: #db7500;
|
|
||||||
@ErrorIconColor: #b91f26;
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
METRICS
|
METRICS
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
@@ -87,7 +80,7 @@
|
|||||||
@ImgWidth: 14px;
|
@ImgWidth: 14px;
|
||||||
@ImgHeight: 14px;
|
@ImgHeight: 14px;
|
||||||
|
|
||||||
@toggleFontWeight: 700;
|
@toggleFontWeight:700;
|
||||||
|
|
||||||
//Resource Tree
|
//Resource Tree
|
||||||
@TreeLineHeight: 17px;
|
@TreeLineHeight: 17px;
|
||||||
@@ -151,16 +144,16 @@
|
|||||||
/**********************************************************************************/
|
/**********************************************************************************/
|
||||||
|
|
||||||
.flex-display(@display: flex) {
|
.flex-display(@display: flex) {
|
||||||
display: ~"-webkit-@{display}";
|
display: ~"-webkit-@{display}";
|
||||||
display: ~"-ms-@{display}box"; // IE10 uses -ms-flexbox
|
display: ~"-ms-@{display}box"; // IE10 uses -ms-flexbox
|
||||||
display: ~"-ms-@{display}"; // IE11
|
display: ~"-ms-@{display}"; // IE11
|
||||||
display: @display;
|
display: @display;
|
||||||
}
|
}
|
||||||
|
|
||||||
.flex-direction(@direction: column) {
|
.flex-direction(@direction: column) {
|
||||||
-webkit-flex-direction: @direction;
|
-webkit-flex-direction: @direction;
|
||||||
-ms-flex-direction: @direction;
|
-ms-flex-direction: @direction;
|
||||||
flex-direction: @direction;
|
flex-direction: @direction;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*************************************************************************************
|
/*************************************************************************************
|
||||||
@@ -168,31 +161,32 @@
|
|||||||
**************************************************************************************/
|
**************************************************************************************/
|
||||||
|
|
||||||
@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
|
@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
|
||||||
.selectedRadio,
|
.selectedRadio,
|
||||||
.selectedRadio:hover,
|
.selectedRadio:hover,
|
||||||
.selectedRadio:active,
|
.selectedRadio:active,
|
||||||
.selectedRadio.dirty,
|
.selectedRadio.dirty,
|
||||||
.tab [type="radio"]:checked ~ label,
|
.tab [type=radio]:checked ~ label,
|
||||||
.tab [type="radio"]:checked ~ label:hover {
|
.tab [type=radio]:checked ~ label:hover {
|
||||||
-ms-high-contrast-adjust: none;
|
-ms-high-contrast-adjust: none;
|
||||||
-webkit-text-fill-color: HighlightText;
|
-webkit-text-fill-color: HighlightText;
|
||||||
color: HighlightText;
|
color: HighlightText;
|
||||||
border-color: HighlightText;
|
border-color: HighlightText;
|
||||||
background-color: Highlight;
|
background-color: Highlight;
|
||||||
}
|
}
|
||||||
|
|
||||||
.queryMetricsSummaryTuple {
|
.queryMetricsSummaryTuple {
|
||||||
th,
|
|
||||||
td {
|
th, td {
|
||||||
&:nth-child(2) {
|
|
||||||
width: @IETableDataWidth;
|
&:nth-child(2) {
|
||||||
}
|
width: @IETableDataWidth;
|
||||||
|
}
|
||||||
&:nth-child(3) {
|
|
||||||
width: 50%;
|
&:nth-child(3) {
|
||||||
}
|
width: 50%;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/********************************************************************************************
|
/********************************************************************************************
|
||||||
@@ -200,15 +194,15 @@
|
|||||||
*********************************************************************************************/
|
*********************************************************************************************/
|
||||||
|
|
||||||
.hover() {
|
.hover() {
|
||||||
background-color: @AccentLight;
|
background-color: @AccentLight;
|
||||||
}
|
}
|
||||||
|
|
||||||
.active() {
|
.active() {
|
||||||
background-color: @AccentExtra;
|
background-color: @AccentExtra;
|
||||||
}
|
}
|
||||||
|
|
||||||
.focus() {
|
.focus() {
|
||||||
outline: 1px dashed @FocusColor;
|
outline: 1px dashed @FocusColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************************************
|
/************************************************************************************************
|
||||||
@@ -218,87 +212,63 @@
|
|||||||
@ToggleWidth: 180px;
|
@ToggleWidth: 180px;
|
||||||
|
|
||||||
.toggleSwitch() {
|
.toggleSwitch() {
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
margin-bottom: @SmallSpace;
|
margin-bottom: @SmallSpace;
|
||||||
padding: @SmallSpace;
|
padding: @SmallSpace;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
color: @BaseHigh;
|
color: @BaseHigh;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
font-size: @mediumFontSize;
|
font-size: @mediumFontSize;
|
||||||
font-family: @DataExplorerFont;
|
font-family: @DataExplorerFont;
|
||||||
}
|
}
|
||||||
|
|
||||||
.selectedToggle() {
|
.selectedToggle() {
|
||||||
border-bottom: 2px solid @BaseHigh;
|
border-bottom: 2px solid @BaseHigh;
|
||||||
}
|
}
|
||||||
|
|
||||||
.unselectedToggle() {
|
.unselectedToggle() {
|
||||||
color: @AccentMediumHigh;
|
color: @AccentMediumHigh;
|
||||||
}
|
}
|
||||||
|
|
||||||
/********************************************************************************************************
|
/********************************************************************************************************
|
||||||
Common Data Explorer Icons
|
Common Data Explorer Icons
|
||||||
*********************************************************************************************************/
|
*********************************************************************************************************/
|
||||||
.dataExplorerIcons() {
|
.dataExplorerIcons() {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
width: @ImgWidth;
|
width: @ImgWidth;
|
||||||
height: @ImgHeight;
|
height: @ImgHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*********************************************************************************************************
|
/*********************************************************************************************************
|
||||||
Info Tooltip
|
Info Tooltip
|
||||||
**********************************************************************************************************/
|
**********************************************************************************************************/
|
||||||
.infoTooltip() {
|
.infoTooltip() {
|
||||||
position: relative;
|
position: relative;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tooltipText(@textColor: @BaseLight, @backgroundColor: @BaseHigh) {
|
.tooltipText(@textColor: @BaseLight, @backgroundColor: @BaseHigh) {
|
||||||
visibility: hidden;
|
visibility: hidden;
|
||||||
background-color: @backgroundColor;
|
background-color: @backgroundColor;
|
||||||
color: @textColor;
|
color: @textColor;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
left: @MediumSpace;
|
left: @MediumSpace;
|
||||||
padding: @MediumSpace;
|
padding: @MediumSpace;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tooltipTextAfter(@color: @BaseDark) {
|
.tooltipTextAfter(@color: @BaseDark) {
|
||||||
content: "";
|
content: "";
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: 100%;
|
right: 100%;
|
||||||
border-style: solid;
|
border-style: solid;
|
||||||
border-color: transparent @color transparent transparent;
|
border-color: transparent @color transparent transparent;
|
||||||
left: 0px;
|
left: 0px;
|
||||||
width: 0;
|
width: 0;
|
||||||
height: 0;
|
height: 0;
|
||||||
border-color: @InfoPointerColor transparent;
|
border-color: @InfoPointerColor transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tooltipVisible() {
|
.tooltipVisible() {
|
||||||
visibility: visible;
|
visibility: visible;
|
||||||
}
|
|
||||||
|
|
||||||
.inputTooltip() {
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
|
|
||||||
.inputTooltipText(@textColor: @BaseLight, @backgroundColor: @BaseHigh) {
|
|
||||||
background-color: @backgroundColor;
|
|
||||||
color: @textColor;
|
|
||||||
position: absolute;
|
|
||||||
z-index: 1;
|
|
||||||
padding: @MediumSpace;
|
|
||||||
}
|
|
||||||
|
|
||||||
.inputTooltipTextAfter(@color: @BaseDark) {
|
|
||||||
content: "";
|
|
||||||
position: absolute;
|
|
||||||
right: 100%;
|
|
||||||
border-style: solid;
|
|
||||||
border-color: transparent @color transparent transparent;
|
|
||||||
left: 10px;
|
|
||||||
width: 0;
|
|
||||||
height: 0;
|
|
||||||
border-color: @InfoPointerColor transparent;
|
|
||||||
}
|
}
|
||||||
|
|||||||
3828
less/documentDB.less
3828
less/documentDB.less
File diff suppressed because it is too large
Load Diff
@@ -13,11 +13,6 @@
|
|||||||
@NavMediumSpace: 10px;
|
@NavMediumSpace: 10px;
|
||||||
@NavLargeSpace: 15px;
|
@NavLargeSpace: 15px;
|
||||||
|
|
||||||
.skip-link {
|
|
||||||
position: fixed;
|
|
||||||
top: -200px;
|
|
||||||
}
|
|
||||||
|
|
||||||
html {
|
html {
|
||||||
font-family: wf_segoe-ui_normal, "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif;
|
font-family: wf_segoe-ui_normal, "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif;
|
||||||
padding: 0px;
|
padding: 0px;
|
||||||
|
|||||||
@@ -1,12 +1,20 @@
|
|||||||
@import "./Common/Constants";
|
@import "./Common/Constants";
|
||||||
|
|
||||||
|
.main {
|
||||||
|
width: 100%;
|
||||||
|
float: left;
|
||||||
|
transition: all .0s ease-in-out;
|
||||||
|
-ms-transition: all 0s ease-in-out;
|
||||||
|
-webkit-transition: all 0s ease-in-out;
|
||||||
|
-moz-transition: all .0s ease-in-out;
|
||||||
|
height: 100%;
|
||||||
|
background-color: white;
|
||||||
|
border-left: 0px solid white;
|
||||||
|
}
|
||||||
|
|
||||||
.resourceTree {
|
.resourceTree {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
flex: 0 0 auto;
|
flex: 0 0 auto;
|
||||||
.main {
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.resourceTreeScroll {
|
.resourceTreeScroll {
|
||||||
|
|||||||
13266
package-lock.json
generated
13266
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
100
package.json
100
package.json
@@ -4,17 +4,12 @@
|
|||||||
"description": "Cosmos Explorer",
|
"description": "Cosmos Explorer",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@azure/arm-cosmosdb": "9.1.0",
|
"@azure/cosmos": "3.9.0",
|
||||||
"@azure/cosmos": "3.10.5",
|
"@azure/cosmos-language-service": "0.0.4",
|
||||||
"@azure/cosmos-language-service": "0.0.5",
|
"@jupyterlab/services": "6.0.0-rc.2",
|
||||||
"@azure/identity": "1.2.1",
|
"@jupyterlab/terminal": "3.0.0-rc.2",
|
||||||
"@azure/ms-rest-nodeauth": "3.0.7",
|
"@microsoft/applicationinsights-web": "2.5.9",
|
||||||
"@babel/plugin-proposal-class-properties": "7.12.1",
|
"@nteract/commutable": "7.3.2",
|
||||||
"@babel/plugin-proposal-decorators": "7.12.12",
|
|
||||||
"@jupyterlab/services": "6.0.2",
|
|
||||||
"@jupyterlab/terminal": "3.0.3",
|
|
||||||
"@microsoft/applicationinsights-web": "2.6.1",
|
|
||||||
"@nteract/commutable": "7.4.2",
|
|
||||||
"@nteract/connected-components": "6.8.2",
|
"@nteract/connected-components": "6.8.2",
|
||||||
"@nteract/core": "15.1.0",
|
"@nteract/core": "15.1.0",
|
||||||
"@nteract/data-explorer": "8.0.3",
|
"@nteract/data-explorer": "8.0.3",
|
||||||
@@ -25,7 +20,7 @@
|
|||||||
"@nteract/iron-icons": "1.0.0",
|
"@nteract/iron-icons": "1.0.0",
|
||||||
"@nteract/jupyter-widgets": "2.0.0",
|
"@nteract/jupyter-widgets": "2.0.0",
|
||||||
"@nteract/logos": "1.0.0",
|
"@nteract/logos": "1.0.0",
|
||||||
"@nteract/markdown": "4.6.0",
|
"@nteract/markdown": "4.4.0",
|
||||||
"@nteract/monaco-editor": "3.2.2",
|
"@nteract/monaco-editor": "3.2.2",
|
||||||
"@nteract/octicons": "2.0.0",
|
"@nteract/octicons": "2.0.0",
|
||||||
"@nteract/outputs": "3.0.9",
|
"@nteract/outputs": "3.0.9",
|
||||||
@@ -39,16 +34,16 @@
|
|||||||
"@nteract/transform-vega": "7.0.6",
|
"@nteract/transform-vega": "7.0.6",
|
||||||
"@octokit/rest": "17.9.2",
|
"@octokit/rest": "17.9.2",
|
||||||
"@phosphor/widgets": "1.9.3",
|
"@phosphor/widgets": "1.9.3",
|
||||||
"@testing-library/jest-dom": "5.11.9",
|
|
||||||
"@types/mkdirp": "1.0.1",
|
"@types/mkdirp": "1.0.1",
|
||||||
"@types/node-fetch": "2.5.7",
|
"@types/node-fetch": "2.5.7",
|
||||||
"@uifabric/react-cards": "0.109.110",
|
"@uifabric/react-cards": "0.109.110",
|
||||||
"@uifabric/styling": "7.13.7",
|
"@uifabric/styling": "7.13.7",
|
||||||
|
"abort-controller": "3.0.0",
|
||||||
"applicationinsights": "1.8.0",
|
"applicationinsights": "1.8.0",
|
||||||
|
"babel-polyfill": "6.26.0",
|
||||||
"bootstrap": "3.4.1",
|
"bootstrap": "3.4.1",
|
||||||
"canvas": "file:./canvas",
|
"canvas": "2.6.1",
|
||||||
"clean-webpack-plugin": "0.1.19",
|
"clean-webpack-plugin": "0.1.19",
|
||||||
"clipboard-copy": "4.0.1",
|
|
||||||
"copy-webpack-plugin": "6.0.2",
|
"copy-webpack-plugin": "6.0.2",
|
||||||
"crossroads": "0.12.2",
|
"crossroads": "0.12.2",
|
||||||
"css-element-queries": "1.1.1",
|
"css-element-queries": "1.1.1",
|
||||||
@@ -58,14 +53,12 @@
|
|||||||
"date-fns": "1.29.0",
|
"date-fns": "1.29.0",
|
||||||
"dayjs": "1.8.19",
|
"dayjs": "1.8.19",
|
||||||
"dotenv": "8.2.0",
|
"dotenv": "8.2.0",
|
||||||
|
"es6-object-assign": "1.1.0",
|
||||||
|
"es6-symbol": "3.1.3",
|
||||||
"eslint-plugin-jest": "23.13.2",
|
"eslint-plugin-jest": "23.13.2",
|
||||||
"eslint-plugin-react": "7.20.0",
|
"eslint-plugin-react": "7.20.0",
|
||||||
"hasher": "1.2.0",
|
"hasher": "1.2.0",
|
||||||
"html2canvas": "1.0.0-rc.5",
|
"html2canvas": "1.0.0-rc.5",
|
||||||
"i18next": "19.8.4",
|
|
||||||
"i18next-browser-languagedetector": "6.0.1",
|
|
||||||
"i18next-http-backend": "1.0.23",
|
|
||||||
"iframe-resizer-react": "1.1.0",
|
|
||||||
"immutable": "4.0.0-rc.12",
|
"immutable": "4.0.0-rc.12",
|
||||||
"is-ci": "2.0.0",
|
"is-ci": "2.0.0",
|
||||||
"jquery": "3.5.1",
|
"jquery": "3.5.1",
|
||||||
@@ -73,63 +66,68 @@
|
|||||||
"jquery-ui-dist": "1.12.1",
|
"jquery-ui-dist": "1.12.1",
|
||||||
"knockout": "3.5.1",
|
"knockout": "3.5.1",
|
||||||
"mkdirp": "1.0.4",
|
"mkdirp": "1.0.4",
|
||||||
"monaco-editor": "0.18.1",
|
"monaco-editor": "0.15.6",
|
||||||
"ms": "2.1.3",
|
"object.entries": "1.1.0",
|
||||||
"msal": "1.4.4",
|
"office-ui-fabric-react": "7.134.1",
|
||||||
"office-ui-fabric-react": "7.164.2",
|
|
||||||
"p-retry": "4.2.0",
|
"p-retry": "4.2.0",
|
||||||
"plotly.js-cartesian-dist-min": "1.52.3",
|
"plotly.js-cartesian-dist-min": "1.52.3",
|
||||||
"post-robot": "10.0.42",
|
"promise-polyfill": "8.1.0",
|
||||||
|
"promise.prototype.finally": "3.1.0",
|
||||||
"q": "1.5.1",
|
"q": "1.5.1",
|
||||||
"react": "16.13.1",
|
"react": "16.13.1",
|
||||||
"react-animate-height": "2.0.8",
|
"react-animate-height": "2.0.8",
|
||||||
"react-dnd": "9.4.0",
|
"react-dnd": "9.4.0",
|
||||||
"react-dnd-html5-backend": "9.4.0",
|
"react-dnd-html5-backend": "9.4.0",
|
||||||
"react-dom": "16.13.1",
|
"react-dom": "16.9.0",
|
||||||
"react-hotkeys": "2.0.0",
|
"react-hotkeys": "2.0.0",
|
||||||
"react-i18next": "11.8.5",
|
|
||||||
"react-notification-system": "0.2.17",
|
"react-notification-system": "0.2.17",
|
||||||
"react-redux": "7.1.3",
|
"react-redux": "7.1.3",
|
||||||
"redux": "4.0.4",
|
"redux": "4.0.4",
|
||||||
"reflect-metadata": "0.1.13",
|
|
||||||
"rx-jupyter": "5.5.12",
|
"rx-jupyter": "5.5.12",
|
||||||
"rxjs": "6.6.3",
|
"rxjs": "6.6.3",
|
||||||
"sanitize-html": "2.3.3",
|
|
||||||
"styled-components": "4.3.2",
|
"styled-components": "4.3.2",
|
||||||
"swr": "0.4.0",
|
"text-encoding": "0.7.0",
|
||||||
"terser-webpack-plugin": "3.1.0",
|
|
||||||
"underscore": "1.9.1",
|
"underscore": "1.9.1",
|
||||||
"utility-types": "3.10.0"
|
"url-polyfill": "1.1.7",
|
||||||
|
"utility-types": "3.10.0",
|
||||||
|
"webcrypto-liner": "1.1.4",
|
||||||
|
"webfontloader": "1.6.28",
|
||||||
|
"whatwg-fetch": "3.0.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "7.9.0",
|
"@babel/core": "7.9.0",
|
||||||
"@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",
|
||||||
"@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",
|
||||||
"@types/crossroads": "0.0.30",
|
"@types/crossroads": "0.0.30",
|
||||||
"@types/d3": "5.9.2",
|
"@types/d3": "5.9.2",
|
||||||
"@types/enzyme": "3.10.7",
|
"@types/enzyme": "3.10.7",
|
||||||
"@types/enzyme-adapter-react-16": "1.0.6",
|
"@types/enzyme-adapter-react-16": "1.0.6",
|
||||||
|
"@types/expect-puppeteer": "4.4.3",
|
||||||
"@types/hasher": "0.0.31",
|
"@types/hasher": "0.0.31",
|
||||||
"@types/jest": "26.0.20",
|
"@types/jest": "23.3.10",
|
||||||
|
"@types/jest-environment-puppeteer": "4.3.2",
|
||||||
"@types/memoize-one": "4.1.1",
|
"@types/memoize-one": "4.1.1",
|
||||||
"@types/node": "12.11.1",
|
"@types/node": "12.11.1",
|
||||||
"@types/post-robot": "10.0.1",
|
|
||||||
"@types/promise.prototype.finally": "2.0.3",
|
"@types/promise.prototype.finally": "2.0.3",
|
||||||
|
"@types/prop-types": "15.5.8",
|
||||||
|
"@types/puppeteer": "3.0.1",
|
||||||
"@types/q": "1.5.1",
|
"@types/q": "1.5.1",
|
||||||
"@types/react": "17.0.3",
|
"@types/react": "16.9.49",
|
||||||
"@types/react-dom": "17.0.3",
|
"@types/react-dom": "16.0.7",
|
||||||
"@types/react-notification-system": "0.2.39",
|
"@types/react-notification-system": "0.2.39",
|
||||||
"@types/react-redux": "7.1.7",
|
"@types/react-redux": "7.1.7",
|
||||||
"@types/sanitize-html": "1.27.2",
|
|
||||||
"@types/sinon": "2.3.3",
|
"@types/sinon": "2.3.3",
|
||||||
"@types/styled-components": "5.1.1",
|
"@types/styled-components": "5.1.1",
|
||||||
|
"@types/text-encoding": "0.0.33",
|
||||||
"@types/underscore": "1.7.36",
|
"@types/underscore": "1.7.36",
|
||||||
|
"@types/webfontloader": "1.6.29",
|
||||||
"@typescript-eslint/eslint-plugin": "4.0.1",
|
"@typescript-eslint/eslint-plugin": "4.0.1",
|
||||||
"@typescript-eslint/parser": "4.0.1",
|
"@typescript-eslint/parser": "4.0.1",
|
||||||
|
"adal-angular": "1.0.15",
|
||||||
|
"axe-puppeteer": "1.1.0",
|
||||||
"babel-jest": "24.9.0",
|
"babel-jest": "24.9.0",
|
||||||
"babel-loader": "8.1.0",
|
"babel-loader": "8.1.0",
|
||||||
"buffer": "5.1.0",
|
"buffer": "5.1.0",
|
||||||
@@ -143,19 +141,16 @@
|
|||||||
"eslint-cli": "1.1.1",
|
"eslint-cli": "1.1.1",
|
||||||
"eslint-plugin-no-null": "1.0.2",
|
"eslint-plugin-no-null": "1.0.2",
|
||||||
"eslint-plugin-prefer-arrow": "1.2.2",
|
"eslint-plugin-prefer-arrow": "1.2.2",
|
||||||
"eslint-plugin-react-hooks": "4.2.0",
|
|
||||||
"expect-playwright": "0.3.3",
|
|
||||||
"expose-loader": "0.7.5",
|
"expose-loader": "0.7.5",
|
||||||
"fast-glob": "3.2.5",
|
|
||||||
"file-loader": "2.0.0",
|
"file-loader": "2.0.0",
|
||||||
"fs-extra": "7.0.0",
|
"fs-extra": "7.0.0",
|
||||||
"html-inline-css-webpack-plugin": "1.11.0",
|
|
||||||
"html-loader": "0.5.5",
|
"html-loader": "0.5.5",
|
||||||
"html-loader-jest": "0.2.1",
|
"html-loader-jest": "0.2.1",
|
||||||
"html-webpack-plugin": "4.5.2",
|
"html-webpack-plugin": "3.2.0",
|
||||||
|
"inline-css": "2.2.5",
|
||||||
"jest": "25.5.4",
|
"jest": "25.5.4",
|
||||||
"jest-canvas-mock": "2.1.0",
|
"jest-canvas-mock": "2.1.0",
|
||||||
"jest-playwright-preset": "1.5.1",
|
"jest-puppeteer": "4.4.0",
|
||||||
"jest-trx-results-processor": "0.0.7",
|
"jest-trx-results-processor": "0.0.7",
|
||||||
"less": "3.8.1",
|
"less": "3.8.1",
|
||||||
"less-loader": "4.1.0",
|
"less-loader": "4.1.0",
|
||||||
@@ -163,23 +158,24 @@
|
|||||||
"mini-css-extract-plugin": "0.4.3",
|
"mini-css-extract-plugin": "0.4.3",
|
||||||
"monaco-editor-webpack-plugin": "1.7.0",
|
"monaco-editor-webpack-plugin": "1.7.0",
|
||||||
"node-fetch": "2.6.1",
|
"node-fetch": "2.6.1",
|
||||||
"playwright": "1.10.0",
|
"prettier": "1.19.1",
|
||||||
"prettier": "2.2.1",
|
"puppeteer": "4.0.0",
|
||||||
"raw-loader": "0.5.1",
|
"raw-loader": "0.5.1",
|
||||||
"react-dev-utils": "11.0.4",
|
|
||||||
"rimraf": "3.0.0",
|
"rimraf": "3.0.0",
|
||||||
"sinon": "3.2.1",
|
"sinon": "3.2.1",
|
||||||
"style-loader": "0.23.0",
|
"style-loader": "0.23.0",
|
||||||
|
"terser-webpack-plugin": "3.0.5",
|
||||||
"ts-loader": "6.2.2",
|
"ts-loader": "6.2.2",
|
||||||
"tslint": "5.11.0",
|
"tslint": "5.11.0",
|
||||||
"tslint-microsoft-contrib": "6.0.0",
|
"tslint-microsoft-contrib": "6.0.0",
|
||||||
"typescript": "4.2.4",
|
"typescript": "4.0.2",
|
||||||
"url-loader": "1.1.1",
|
"url-loader": "1.1.1",
|
||||||
"wait-on": "4.0.2",
|
"wait-on": "4.0.2",
|
||||||
"webpack": "4.43.0",
|
"webpack": "4.43.0",
|
||||||
"webpack-bundle-analyzer": "3.6.1",
|
"webpack-bundle-analyzer": "3.6.1",
|
||||||
"webpack-cli": "3.3.10",
|
"webpack-cli": "3.3.10",
|
||||||
"webpack-dev-server": "3.11.0"
|
"webpack-dev-server": "3.11.0",
|
||||||
|
"worker-loader": "2.0.0"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "node --max-old-space-size=10196 node_modules/webpack-dev-server/bin/webpack-dev-server.js",
|
"start": "node --max-old-space-size=10196 node_modules/webpack-dev-server/bin/webpack-dev-server.js",
|
||||||
@@ -198,12 +194,12 @@
|
|||||||
"compile": "tsc",
|
"compile": "tsc",
|
||||||
"compile:contracts": "tsc -p ./tsconfig.contracts.json",
|
"compile:contracts": "tsc -p ./tsconfig.contracts.json",
|
||||||
"compile:strict": "tsc -p ./tsconfig.strict.json",
|
"compile:strict": "tsc -p ./tsconfig.strict.json",
|
||||||
"format": "prettier --write \"{src,test}/**/*.{ts,tsx,html}\" \"*.{js,html}\"",
|
"format": "prettier --write \"{src,cypress,test}/**/*.{ts,tsx,html}\" \"*.{js,html}\"",
|
||||||
"format:check": "prettier --check \"{src,test}/**/*.{ts,tsx,html}\" \"*.{js,html}\"",
|
"format:check": "prettier --check \"{src,cypress,test}/**/*.{ts,tsx,html}\" \"*.{js,html}\"",
|
||||||
"lint": "tslint --project tsconfig.json && eslint \"**/*.{ts,tsx}\"",
|
"lint": "tslint --project tsconfig.json && eslint \"**/*.{ts,tsx}\"",
|
||||||
"build:contracts": "npm run compile:contracts",
|
"build:contracts": "npm run compile:contracts",
|
||||||
"strict:find": "node ./strict-null-checks/find.js",
|
"strictEligibleFiles": "node ./strict-migration-tools/index.js",
|
||||||
"strict:add": "node ./strict-null-checks/auto-add.js",
|
"autoAddStrictEligibleFiles": "node ./strict-migration-tools/autoAdd.js",
|
||||||
"compile:fullStrict": "tsc -p ./tsconfig.json --strictNullChecks",
|
"compile:fullStrict": "tsc -p ./tsconfig.json --strictNullChecks",
|
||||||
"generateARMClients": "ts-node --compiler-options '{\"module\":\"commonjs\"}' utils/armClientGenerator/generator.ts"
|
"generateARMClients": "ts-node --compiler-options '{\"module\":\"commonjs\"}' utils/armClientGenerator/generator.ts"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
[defaults]
|
|
||||||
group = stfaul
|
|
||||||
sku = P1v2
|
|
||||||
appserviceplan = stfaul_asp_Linux_centralus_0
|
|
||||||
location = centralus
|
|
||||||
web = cosmos-explorer-preview
|
|
||||||
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
# Cosmos Explorer Preview
|
|
||||||
|
|
||||||
Cosmos Explorer Preview makes it possible to try a working version of any commit on master or in a PR. No need to run the app locally or deploy to staging.
|
|
||||||
|
|
||||||
Initial support is for Hosted (Connection string only) or the Azure Portal. Examples:
|
|
||||||
|
|
||||||
Connection string URLs: https://cosmos-explorer-preview.azurewebsites.net/commit/COMMIT_SHA/hostedExplorer.html
|
|
||||||
Portal URLs: https://ms.portal.azure.com/?dataExplorerSource=https://cosmos-explorer-preview.azurewebsites.net/commit/COMMIT_SHA/explorer.html#home
|
|
||||||
|
|
||||||
In both cases replace `COMMIT_SHA` with the commit you want to view. It must have already completed its build on GitHub Actions.
|
|
||||||
|
|
||||||
### Architechture
|
|
||||||
|
|
||||||
- This folder contains a NodeJS app deployed to Azure App Service that powers preview URLs:
|
|
||||||
- Paths starting with `/commit/` are proxied to an Azure Storage account containing build artifacts
|
|
||||||
- Paths starting with `/proxy/` are proxied dynamically to Cosmos account endpoints. Required otherwise CORS would need to be configured for every account accessed.
|
|
||||||
- Paths starting with `/api/` are proxied to Portal APIs that do not support CORS.
|
|
||||||
- On GitHub Actions build completion:
|
|
||||||
- All files in dist are uploaded to an Azure Storage account namespaced by the SHA of the commit
|
|
||||||
- `/preview/config.json` is uploaded to the same folder with preview specific configuration
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"PROXY_PATH": "/proxy"
|
|
||||||
}
|
|
||||||
@@ -1,68 +0,0 @@
|
|||||||
const express = require("express");
|
|
||||||
const { createProxyMiddleware } = require("http-proxy-middleware");
|
|
||||||
const port = process.env.PORT || 3000;
|
|
||||||
const fetch = require("node-fetch");
|
|
||||||
|
|
||||||
const api = createProxyMiddleware("/api", {
|
|
||||||
target: "https://main.documentdb.ext.azure.com",
|
|
||||||
changeOrigin: true,
|
|
||||||
logLevel: "debug",
|
|
||||||
bypass: (req, res) => {
|
|
||||||
if (req.method === "OPTIONS") {
|
|
||||||
res.statusCode = 200;
|
|
||||||
res.send();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
const proxy = createProxyMiddleware("/proxy", {
|
|
||||||
target: "https://main.documentdb.ext.azure.com",
|
|
||||||
changeOrigin: true,
|
|
||||||
secure: false,
|
|
||||||
logLevel: "debug",
|
|
||||||
pathRewrite: { "^/proxy": "" },
|
|
||||||
router: (req) => {
|
|
||||||
let newTarget = req.headers["x-ms-proxy-target"];
|
|
||||||
return newTarget;
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
const commit = createProxyMiddleware("/commit", {
|
|
||||||
target: "https://cosmosexplorerpreview.blob.core.windows.net",
|
|
||||||
changeOrigin: true,
|
|
||||||
secure: false,
|
|
||||||
logLevel: "debug",
|
|
||||||
pathRewrite: { "^/commit": "$web/" },
|
|
||||||
});
|
|
||||||
|
|
||||||
const app = express();
|
|
||||||
|
|
||||||
app.use(api);
|
|
||||||
app.use(proxy);
|
|
||||||
app.use(commit);
|
|
||||||
app.get("/pull/:pr(\\d+)", (req, res) => {
|
|
||||||
const pr = req.params.pr;
|
|
||||||
const [, query] = req.originalUrl.split("?");
|
|
||||||
const search = new URLSearchParams(query);
|
|
||||||
|
|
||||||
fetch("https://api.github.com/repos/Azure/cosmos-explorer/pulls/" + pr)
|
|
||||||
.then((response) => response.json())
|
|
||||||
.then(({ head: { ref, sha } }) => {
|
|
||||||
const prUrl = new URL("https://github.com/Azure/cosmos-explorer/pull/" + pr);
|
|
||||||
prUrl.hash = ref;
|
|
||||||
search.set("feature.pr", prUrl.href);
|
|
||||||
|
|
||||||
const explorer = new URL("https://cosmos-explorer-preview.azurewebsites.net/commit/" + sha + "/explorer.html");
|
|
||||||
explorer.search = search.toString();
|
|
||||||
|
|
||||||
const portal = new URL("https://ms.portal.azure.com/");
|
|
||||||
portal.searchParams.set("dataExplorerSource", explorer.href);
|
|
||||||
|
|
||||||
return res.redirect(portal.href);
|
|
||||||
})
|
|
||||||
.catch(() => res.sendStatus(500));
|
|
||||||
});
|
|
||||||
|
|
||||||
app.listen(port, () => {
|
|
||||||
console.log(`Example app listening on port: ${port}`);
|
|
||||||
});
|
|
||||||
1146
preview/package-lock.json
generated
1146
preview/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -1,18 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "cosmos-explorer-preview",
|
|
||||||
"version": "1.0.0",
|
|
||||||
"description": "",
|
|
||||||
"main": "index.js",
|
|
||||||
"scripts": {
|
|
||||||
"deploy": "az webapp up -n cosmos-explorer-preview --subscription cosmosdb-portalteam-generaldemo -g stfaul",
|
|
||||||
"start": "node index.js",
|
|
||||||
"test": "echo \"Error: no test specified\" && exit 1"
|
|
||||||
},
|
|
||||||
"keywords": [],
|
|
||||||
"author": "Microsoft Corporation",
|
|
||||||
"dependencies": {
|
|
||||||
"express": "^4.17.1",
|
|
||||||
"http-proxy-middleware": "^1.1.0",
|
|
||||||
"node-fetch": "^2.6.1"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
"offerThroughput": 400,
|
"offerThroughput": 400,
|
||||||
"databaseLevelThroughput": false,
|
"databaseLevelThroughput": false,
|
||||||
"collectionId": "Persons",
|
"collectionId": "Persons",
|
||||||
"createNewDatabase": true,
|
"rupmEnabled": false,
|
||||||
"partitionKey": { "kind": "Hash", "paths": ["/name"] },
|
"partitionKey": { "kind": "Hash", "paths": ["/name"] },
|
||||||
"data": [
|
"data": [
|
||||||
"g.addV('person').property(id, '1').property('name', 'Eva').property('age', 44)",
|
"g.addV('person').property(id, '1').property('name', 'Eva').property('age', 44)",
|
||||||
@@ -13,4 +13,4 @@
|
|||||||
"g.V('1').addE('knows').to(g.V('2')).outV().addE('knows').to(g.V('3'))",
|
"g.V('1').addE('knows').to(g.V('2')).outV().addE('knows').to(g.V('3'))",
|
||||||
"g.V('3').addE('knows').to(g.V('4'))"
|
"g.V('3').addE('knows').to(g.V('4'))"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
export enum AuthType {
|
export enum AuthType {
|
||||||
AAD = "aad",
|
AAD = "aad",
|
||||||
EncryptedToken = "encryptedtoken",
|
EncryptedToken = "encryptedtoken",
|
||||||
MasterKey = "masterkey",
|
MasterKey = "masterkey",
|
||||||
ResourceToken = "resourcetoken",
|
ResourceToken = "resourcetoken"
|
||||||
ConnectionString = "connectionstring",
|
}
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,22 +1,21 @@
|
|||||||
import * as ko from "knockout";
|
import * as ko from "knockout";
|
||||||
import * as ReactBindingHandler from "./ReactBindingHandler";
|
import * as ReactBindingHandler from "./ReactBindingHandler";
|
||||||
import "../Explorer/Tables/DataTable/DataTableBindingManager";
|
|
||||||
|
export class BindingHandlersRegisterer {
|
||||||
export class BindingHandlersRegisterer {
|
public static registerBindingHandlers() {
|
||||||
public static registerBindingHandlers() {
|
ko.bindingHandlers.setTemplateReady = {
|
||||||
ko.bindingHandlers.setTemplateReady = {
|
init(
|
||||||
init(
|
element: any,
|
||||||
element: any,
|
wrappedValueAccessor: () => any,
|
||||||
wrappedValueAccessor: () => any,
|
allBindings?: ko.AllBindings,
|
||||||
allBindings?: ko.AllBindings,
|
viewModel?: any,
|
||||||
viewModel?: any,
|
bindingContext?: ko.BindingContext
|
||||||
bindingContext?: ko.BindingContext
|
) {
|
||||||
) {
|
const value = ko.unwrap(wrappedValueAccessor());
|
||||||
const value = ko.unwrap(wrappedValueAccessor());
|
bindingContext?.$data.isTemplateReady(value);
|
||||||
bindingContext?.$data.isTemplateReady(value);
|
}
|
||||||
},
|
} as ko.BindingHandler;
|
||||||
} as ko.BindingHandler;
|
|
||||||
|
ReactBindingHandler.Registerer.register();
|
||||||
ReactBindingHandler.Registerer.register();
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ export class Registerer {
|
|||||||
|
|
||||||
// Initial rendering at mount point
|
// Initial rendering at mount point
|
||||||
ReactDOM.render(adapter.renderComponent(), element);
|
ReactDOM.render(adapter.renderComponent(), element);
|
||||||
},
|
}
|
||||||
} as ko.BindingHandler;
|
} as ko.BindingHandler;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,68 +0,0 @@
|
|||||||
import { createImmutableOutput, JSONObject, OnDiskOutput } from "@nteract/commutable";
|
|
||||||
// import outputs individually to avoid increasing the bundle size
|
|
||||||
import { KernelOutputError } from "@nteract/outputs/lib/components/kernel-output-error";
|
|
||||||
import { Output } from "@nteract/outputs/lib/components/output";
|
|
||||||
import { StreamText } from "@nteract/outputs/lib/components/stream-text";
|
|
||||||
import { ContentRef } from "@nteract/types";
|
|
||||||
import "bootstrap/dist/css/bootstrap.css";
|
|
||||||
import postRobot from "post-robot";
|
|
||||||
import * as React from "react";
|
|
||||||
import * as ReactDOM from "react-dom";
|
|
||||||
import "../../externals/iframeResizer.contentWindow.min.js"; // Required for iFrameResizer to work
|
|
||||||
import "../Explorer/Notebook/NotebookRenderer/base.css";
|
|
||||||
import "../Explorer/Notebook/NotebookRenderer/default.css";
|
|
||||||
import { TransformMedia } from "./TransformMedia";
|
|
||||||
|
|
||||||
export interface CellOutputViewerProps {
|
|
||||||
id: string;
|
|
||||||
contentRef: ContentRef;
|
|
||||||
hidden: boolean;
|
|
||||||
expanded: boolean;
|
|
||||||
outputs: OnDiskOutput[];
|
|
||||||
onMetadataChange: (metadata: JSONObject, mediaType: string, index?: number) => void;
|
|
||||||
}
|
|
||||||
|
|
||||||
const onInit = async () => {
|
|
||||||
postRobot.on(
|
|
||||||
"props",
|
|
||||||
{
|
|
||||||
window: window.parent,
|
|
||||||
domain: window.location.origin,
|
|
||||||
},
|
|
||||||
(event) => {
|
|
||||||
// Typescript definition for event is wrong. So read props by casting to <any>
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
||||||
const props = (event as any).data as CellOutputViewerProps;
|
|
||||||
const outputs = (
|
|
||||||
<div
|
|
||||||
data-iframe-height
|
|
||||||
className={`nteract-cell-outputs ${props.hidden ? "hidden" : ""} ${props.expanded ? "expanded" : ""}`}
|
|
||||||
>
|
|
||||||
{props.outputs?.map((output, index) => (
|
|
||||||
<Output output={createImmutableOutput(output)} key={index}>
|
|
||||||
<TransformMedia
|
|
||||||
output_type={"display_data"}
|
|
||||||
id={props.id}
|
|
||||||
contentRef={props.contentRef}
|
|
||||||
onMetadataChange={(metadata, mediaType) => props.onMetadataChange(metadata, mediaType, index)}
|
|
||||||
/>
|
|
||||||
<TransformMedia
|
|
||||||
output_type={"execute_result"}
|
|
||||||
id={props.id}
|
|
||||||
contentRef={props.contentRef}
|
|
||||||
onMetadataChange={(metadata, mediaType) => props.onMetadataChange(metadata, mediaType, index)}
|
|
||||||
/>
|
|
||||||
<KernelOutputError />
|
|
||||||
<StreamText />
|
|
||||||
</Output>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
|
|
||||||
ReactDOM.render(outputs, document.getElementById("cellOutput"));
|
|
||||||
}
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
// Entry point
|
|
||||||
window.addEventListener("load", onInit);
|
|
||||||
@@ -1,138 +0,0 @@
|
|||||||
import { ImmutableDisplayData, ImmutableExecuteResult, JSONObject } from "@nteract/commutable";
|
|
||||||
// import outputs individually to avoid increasing the bundle size
|
|
||||||
import { HTML } from "@nteract/outputs/lib/components/media/html";
|
|
||||||
import { Image } from "@nteract/outputs/lib/components/media/image";
|
|
||||||
import { JavaScript } from "@nteract/outputs/lib/components/media/javascript";
|
|
||||||
import { Json } from "@nteract/outputs/lib/components/media/json";
|
|
||||||
import { LaTeX } from "@nteract/outputs/lib/components/media/latex";
|
|
||||||
import { Plain } from "@nteract/outputs/lib/components/media/plain";
|
|
||||||
import { SVG } from "@nteract/outputs/lib/components/media/svg";
|
|
||||||
import { ContentRef } from "@nteract/types";
|
|
||||||
import React, { Suspense } from "react";
|
|
||||||
|
|
||||||
const EmptyTransform = (): JSX.Element => <></>;
|
|
||||||
|
|
||||||
const displayOrder = [
|
|
||||||
"application/vnd.jupyter.widget-view+json",
|
|
||||||
"application/vnd.vega.v5+json",
|
|
||||||
"application/vnd.vega.v4+json",
|
|
||||||
"application/vnd.vega.v3+json",
|
|
||||||
"application/vnd.vega.v2+json",
|
|
||||||
"application/vnd.vegalite.v4+json",
|
|
||||||
"application/vnd.vegalite.v3+json",
|
|
||||||
"application/vnd.vegalite.v2+json",
|
|
||||||
"application/vnd.vegalite.v1+json",
|
|
||||||
"application/geo+json",
|
|
||||||
"application/vnd.plotly.v1+json",
|
|
||||||
"text/vnd.plotly.v1+html",
|
|
||||||
"application/x-nteract-model-debug+json",
|
|
||||||
"application/vnd.dataresource+json",
|
|
||||||
"application/vdom.v1+json",
|
|
||||||
"application/json",
|
|
||||||
"application/javascript",
|
|
||||||
"text/html",
|
|
||||||
"text/markdown",
|
|
||||||
"text/latex",
|
|
||||||
"image/svg+xml",
|
|
||||||
"image/gif",
|
|
||||||
"image/png",
|
|
||||||
"image/jpeg",
|
|
||||||
"text/plain",
|
|
||||||
];
|
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
||||||
const transformsById = new Map<string, React.ComponentType<any>>([
|
|
||||||
["text/vnd.plotly.v1+html", React.lazy(() => import("@nteract/transform-plotly"))],
|
|
||||||
["application/vnd.plotly.v1+json", React.lazy(() => import("@nteract/transform-plotly"))],
|
|
||||||
["application/geo+json", EmptyTransform], // TODO: The geojson transform will likely need some work because of the basemap URL(s)
|
|
||||||
["application/x-nteract-model-debug+json", React.lazy(() => import("@nteract/transform-model-debug"))],
|
|
||||||
["application/vnd.dataresource+json", React.lazy(() => import("@nteract/data-explorer"))],
|
|
||||||
["application/vnd.jupyter.widget-view+json", React.lazy(() => import("./transforms/WidgetDisplay"))],
|
|
||||||
["application/vnd.vegalite.v1+json", React.lazy(() => import("./transforms/VegaLite1"))],
|
|
||||||
["application/vnd.vegalite.v2+json", React.lazy(() => import("./transforms/VegaLite2"))],
|
|
||||||
["application/vnd.vegalite.v3+json", React.lazy(() => import("./transforms/VegaLite3"))],
|
|
||||||
["application/vnd.vegalite.v4+json", React.lazy(() => import("./transforms/VegaLite4"))],
|
|
||||||
["application/vnd.vega.v2+json", React.lazy(() => import("./transforms/Vega2"))],
|
|
||||||
["application/vnd.vega.v3+json", React.lazy(() => import("./transforms/Vega3"))],
|
|
||||||
["application/vnd.vega.v4+json", React.lazy(() => import("./transforms/Vega4"))],
|
|
||||||
["application/vnd.vega.v5+json", React.lazy(() => import("./transforms/Vega5"))],
|
|
||||||
["application/vdom.v1+json", React.lazy(() => import("@nteract/transform-vdom"))],
|
|
||||||
["application/json", Json],
|
|
||||||
["application/javascript", JavaScript],
|
|
||||||
["text/html", HTML],
|
|
||||||
["text/markdown", React.lazy(() => import("@nteract/outputs/lib/components/media/markdown"))], // Markdown increases the bundle size so lazy load it
|
|
||||||
["text/latex", LaTeX],
|
|
||||||
["image/svg+xml", SVG],
|
|
||||||
["image/gif", Image],
|
|
||||||
["image/png", Image],
|
|
||||||
["image/jpeg", Image],
|
|
||||||
["text/plain", Plain],
|
|
||||||
]);
|
|
||||||
|
|
||||||
interface TransformMediaProps {
|
|
||||||
output_type: string;
|
|
||||||
id: string;
|
|
||||||
contentRef: ContentRef;
|
|
||||||
output?: ImmutableDisplayData | ImmutableExecuteResult;
|
|
||||||
onMetadataChange: (metadata: JSONObject, mediaType: string) => void;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const TransformMedia = (props: TransformMediaProps): JSX.Element => {
|
|
||||||
const { Media, mediaType, data, metadata } = getMediaInfo(props);
|
|
||||||
|
|
||||||
// If we had no valid result, return an empty output
|
|
||||||
if (!mediaType || !data) {
|
|
||||||
return <></>;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Suspense fallback={<div>Loading...</div>}>
|
|
||||||
<Media
|
|
||||||
onMetadataChange={props.onMetadataChange}
|
|
||||||
data={data}
|
|
||||||
metadata={metadata}
|
|
||||||
contentRef={props.contentRef}
|
|
||||||
id={props.id}
|
|
||||||
/>
|
|
||||||
</Suspense>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
const getMediaInfo = (props: TransformMediaProps) => {
|
|
||||||
const { output, output_type } = props;
|
|
||||||
// This component should only be used with display data and execute result
|
|
||||||
if (!output || !(output_type === "display_data" || output_type === "execute_result")) {
|
|
||||||
console.warn("connected transform media managed to get a non media bundle output");
|
|
||||||
return {
|
|
||||||
Media: EmptyTransform,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
// Find the first mediaType in the output data that we support with a handler
|
|
||||||
const mediaType = displayOrder.find(
|
|
||||||
(key) =>
|
|
||||||
Object.prototype.hasOwnProperty.call(output.data, key) &&
|
|
||||||
(Object.prototype.hasOwnProperty.call(transformsById, key) || transformsById.get(key))
|
|
||||||
);
|
|
||||||
|
|
||||||
if (mediaType) {
|
|
||||||
const metadata = output.metadata.get(mediaType);
|
|
||||||
const data = output.data[mediaType];
|
|
||||||
|
|
||||||
const Media = transformsById.get(mediaType);
|
|
||||||
return {
|
|
||||||
Media,
|
|
||||||
mediaType,
|
|
||||||
data,
|
|
||||||
metadata,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
Media: EmptyTransform,
|
|
||||||
mediaType,
|
|
||||||
output,
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
export default TransformMedia;
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8" />
|
|
||||||
<meta name="viewport" content="height=device-height, width=device-width, initial-scale=1.0" />
|
|
||||||
<title>Cell Output Viewer</title>
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
<div class="cellOutput" id="cellOutput"></div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
export { Vega2 as default } from "@nteract/transform-vega";
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
export { Vega3 as default } from "@nteract/transform-vega";
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
export { Vega4 as default } from "@nteract/transform-vega";
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
export { Vega5 as default } from "@nteract/transform-vega";
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
export { VegaLite1 as default } from "@nteract/transform-vega";
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
export { VegaLite2 as default } from "@nteract/transform-vega";
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
export { VegaLite3 as default } from "@nteract/transform-vega";
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
export { VegaLite4 as default } from "@nteract/transform-vega";
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
export { WidgetDisplay as default } from "@nteract/jupyter-widgets";
|
|
||||||
@@ -40,7 +40,7 @@ export class ArrayHashMap<T> {
|
|||||||
public forEach(key: string, iteratorFct: (value: T) => void) {
|
public forEach(key: string, iteratorFct: (value: T) => void) {
|
||||||
const values = this.store.get(key);
|
const values = this.store.get(key);
|
||||||
if (values) {
|
if (values) {
|
||||||
values.forEach((value) => iteratorFct(value));
|
values.forEach(value => iteratorFct(value));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,390 +1,439 @@
|
|||||||
export class CodeOfConductEndpoints {
|
import { HashMap } from "./HashMap";
|
||||||
public static privacyStatement: string = "https://aka.ms/ms-privacy-policy";
|
|
||||||
public static codeOfConduct: string = "https://aka.ms/cosmos-code-of-conduct";
|
export class AuthorizationEndpoints {
|
||||||
public static termsOfUse: string = "https://aka.ms/ms-terms-of-use";
|
public static arm: string = "https://management.core.windows.net/";
|
||||||
}
|
public static common: string = "https://login.windows.net/";
|
||||||
|
}
|
||||||
export class EndpointsRegex {
|
|
||||||
public static readonly cassandra = [
|
export class CodeOfConductEndpoints {
|
||||||
"AccountEndpoint=(.*).cassandra.cosmosdb.azure.com",
|
public static privacyStatement: string = "https://aka.ms/ms-privacy-policy";
|
||||||
"HostName=(.*).cassandra.cosmos.azure.com",
|
public static codeOfConduct: string = "https://aka.ms/cosmos-code-of-conduct";
|
||||||
];
|
public static termsOfUse: string = "https://aka.ms/ms-terms-of-use";
|
||||||
public static readonly mongo = "mongodb://.*:(.*)@(.*).documents.azure.com";
|
}
|
||||||
public static readonly mongoCompute = "mongodb://.*:(.*)@(.*).mongo.cosmos.azure.com";
|
|
||||||
public static readonly sql = "AccountEndpoint=https://(.*).documents.azure.com";
|
export class EndpointsRegex {
|
||||||
public static readonly table = "TableEndpoint=https://(.*).table.cosmosdb.azure.com";
|
public static readonly cassandra = [
|
||||||
}
|
"AccountEndpoint=(.*).cassandra.cosmosdb.azure.com",
|
||||||
|
"HostName=(.*).cassandra.cosmos.azure.com"
|
||||||
export class ApiEndpoints {
|
];
|
||||||
public static runtimeProxy: string = "/api/RuntimeProxy";
|
public static readonly mongo = "mongodb://.*:(.*)@(.*).documents.azure.com";
|
||||||
public static guestRuntimeProxy: string = "/api/guest/RuntimeProxy";
|
public static readonly mongoCompute = "mongodb://.*:(.*)@(.*).mongo.cosmos.azure.com";
|
||||||
}
|
public static readonly sql = "AccountEndpoint=https://(.*).documents.azure.com";
|
||||||
|
public static readonly table = "TableEndpoint=https://(.*).table.cosmosdb.azure.com";
|
||||||
export class ServerIds {
|
}
|
||||||
public static localhost: string = "localhost";
|
|
||||||
public static blackforest: string = "blackforest";
|
export class ApiEndpoints {
|
||||||
public static fairfax: string = "fairfax";
|
public static runtimeProxy: string = "/api/RuntimeProxy";
|
||||||
public static mooncake: string = "mooncake";
|
public static guestRuntimeProxy: string = "/api/guest/RuntimeProxy";
|
||||||
public static productionPortal: string = "prod";
|
}
|
||||||
public static dev: string = "dev";
|
|
||||||
}
|
export class ServerIds {
|
||||||
|
public static localhost: string = "localhost";
|
||||||
export class ArmApiVersions {
|
public static blackforest: string = "blackforest";
|
||||||
public static readonly documentDB: string = "2015-11-06";
|
public static fairfax: string = "fairfax";
|
||||||
public static readonly arcadia: string = "2019-06-01-preview";
|
public static mooncake: string = "mooncake";
|
||||||
public static readonly arcadiaLivy: string = "2019-11-01-preview";
|
public static productionPortal: string = "prod";
|
||||||
public static readonly arm: string = "2015-11-01";
|
public static dev: string = "dev";
|
||||||
public static readonly armFeatures: string = "2014-08-01-preview";
|
}
|
||||||
public static readonly publicVersion = "2020-04-01";
|
|
||||||
}
|
export class ArmApiVersions {
|
||||||
|
public static readonly documentDB: string = "2015-11-06";
|
||||||
export class ArmResourceTypes {
|
public static readonly arcadia: string = "2019-06-01-preview";
|
||||||
public static readonly notebookWorkspaces = "Microsoft.DocumentDB/databaseAccounts/notebookWorkspaces";
|
public static readonly arcadiaLivy: string = "2019-11-01-preview";
|
||||||
public static readonly synapseWorkspaces = "Microsoft.Synapse/workspaces";
|
public static readonly arm: string = "2015-11-01";
|
||||||
}
|
public static readonly armFeatures: string = "2014-08-01-preview";
|
||||||
|
public static readonly publicVersion = "2020-04-01";
|
||||||
export class BackendDefaults {
|
}
|
||||||
public static partitionKeyKind: string = "Hash";
|
|
||||||
public static singlePartitionStorageInGb: string = "10";
|
export class ArmResourceTypes {
|
||||||
public static multiPartitionStorageInGb: string = "100";
|
public static readonly notebookWorkspaces = "Microsoft.DocumentDB/databaseAccounts/notebookWorkspaces";
|
||||||
public static maxChangeFeedRetentionDuration: number = 10;
|
public static readonly synapseWorkspaces = "Microsoft.Synapse/workspaces";
|
||||||
public static partitionKeyVersion = 2;
|
}
|
||||||
}
|
|
||||||
|
export class BackendDefaults {
|
||||||
export class ClientDefaults {
|
public static partitionKeyKind: string = "Hash";
|
||||||
public static requestTimeoutMs: number = 60000;
|
public static singlePartitionStorageInGb: string = "10";
|
||||||
public static portalCacheTimeoutMs: number = 10000;
|
public static multiPartitionStorageInGb: string = "100";
|
||||||
public static errorNotificationTimeoutMs: number = 5000;
|
public static maxChangeFeedRetentionDuration: number = 10;
|
||||||
public static copyHelperTimeoutMs: number = 2000;
|
public static partitionKeyVersion = 2;
|
||||||
public static waitForDOMElementMs: number = 500;
|
}
|
||||||
public static cacheBustingTimeoutMs: number =
|
|
||||||
10 /** minutes **/ * 60 /** to seconds **/ * 1000 /** to milliseconds **/;
|
export class ClientDefaults {
|
||||||
public static databaseThroughputIncreaseFactor: number = 100;
|
public static requestTimeoutMs: number = 60000;
|
||||||
public static readonly arcadiaTokenRefreshInterval: number =
|
public static portalCacheTimeoutMs: number = 10000;
|
||||||
20 /** minutes **/ * 60 /** to seconds **/ * 1000 /** to milliseconds **/;
|
public static errorNotificationTimeoutMs: number = 5000;
|
||||||
public static readonly arcadiaTokenRefreshIntervalPaddingMs: number = 2000;
|
public static copyHelperTimeoutMs: number = 2000;
|
||||||
}
|
public static waitForDOMElementMs: number = 500;
|
||||||
|
public static cacheBustingTimeoutMs: number =
|
||||||
export class AccountKind {
|
10 /** minutes **/ * 60 /** to seconds **/ * 1000 /** to milliseconds **/;
|
||||||
public static DocumentDB: string = "DocumentDB";
|
public static databaseThroughputIncreaseFactor: number = 100;
|
||||||
public static MongoDB: string = "MongoDB";
|
public static readonly arcadiaTokenRefreshInterval: number =
|
||||||
public static Parse: string = "Parse";
|
20 /** minutes **/ * 60 /** to seconds **/ * 1000 /** to milliseconds **/;
|
||||||
public static GlobalDocumentDB: string = "GlobalDocumentDB";
|
public static readonly arcadiaTokenRefreshIntervalPaddingMs: number = 2000;
|
||||||
public static Default: string = AccountKind.DocumentDB;
|
}
|
||||||
}
|
|
||||||
|
export class AccountKind {
|
||||||
export class CorrelationBackend {
|
public static DocumentDB: string = "DocumentDB";
|
||||||
public static Url: string = "https://aka.ms/cosmosdbanalytics";
|
public static MongoDB: string = "MongoDB";
|
||||||
}
|
public static Parse: string = "Parse";
|
||||||
|
public static GlobalDocumentDB: string = "GlobalDocumentDB";
|
||||||
export class DefaultAccountExperience {
|
public static Default: string = AccountKind.DocumentDB;
|
||||||
public static DocumentDB: string = "DocumentDB";
|
}
|
||||||
public static Graph: string = "Graph";
|
|
||||||
public static MongoDB: string = "MongoDB";
|
export class CorrelationBackend {
|
||||||
public static ApiForMongoDB: string = "Azure Cosmos DB for MongoDB API";
|
public static Url: string = "https://aka.ms/cosmosdbanalytics";
|
||||||
public static Table: string = "Table";
|
}
|
||||||
public static Cassandra: string = "Cassandra";
|
|
||||||
public static Default: string = DefaultAccountExperience.DocumentDB;
|
export class DefaultAccountExperience {
|
||||||
}
|
public static DocumentDB: string = "DocumentDB";
|
||||||
|
public static Graph: string = "Graph";
|
||||||
export class CapabilityNames {
|
public static MongoDB: string = "MongoDB";
|
||||||
public static EnableTable: string = "EnableTable";
|
public static ApiForMongoDB: string = "Azure Cosmos DB for MongoDB API";
|
||||||
public static EnableGremlin: string = "EnableGremlin";
|
public static Table: string = "Table";
|
||||||
public static EnableCassandra: string = "EnableCassandra";
|
public static Cassandra: string = "Cassandra";
|
||||||
public static EnableAutoScale: string = "EnableAutoScale";
|
public static Default: string = DefaultAccountExperience.DocumentDB;
|
||||||
public static readonly EnableNotebooks: string = "EnableNotebooks";
|
}
|
||||||
public static readonly EnableStorageAnalytics: string = "EnableStorageAnalytics";
|
|
||||||
public static readonly EnableMongo: string = "EnableMongo";
|
export class CapabilityNames {
|
||||||
public static readonly EnableServerless: string = "EnableServerless";
|
public static EnableTable: string = "EnableTable";
|
||||||
}
|
public static EnableGremlin: string = "EnableGremlin";
|
||||||
|
public static EnableCassandra: string = "EnableCassandra";
|
||||||
// flight names returned from the portal are always lowercase
|
public static EnableAutoScale: string = "EnableAutoScale";
|
||||||
export class Flights {
|
public static readonly EnableNotebooks: string = "EnableNotebooks";
|
||||||
public static readonly SettingsV2 = "settingsv2";
|
public static readonly EnableStorageAnalytics: string = "EnableStorageAnalytics";
|
||||||
public static readonly MongoIndexEditor = "mongoindexeditor";
|
public static readonly EnableMongo: string = "EnableMongo";
|
||||||
public static readonly MongoIndexing = "mongoindexing";
|
public static readonly EnableServerless: string = "EnableServerless";
|
||||||
public static readonly AutoscaleTest = "autoscaletest";
|
}
|
||||||
}
|
|
||||||
|
export class Features {
|
||||||
export class AfecFeatures {
|
public static readonly cosmosdb = "cosmosdb";
|
||||||
public static readonly Spark = "spark-public-preview";
|
public static readonly enableChangeFeedPolicy = "enablechangefeedpolicy";
|
||||||
public static readonly Notebooks = "sparknotebooks-public-preview";
|
public static readonly enableRupm = "enablerupm";
|
||||||
public static readonly StorageAnalytics = "storageanalytics-public-preview";
|
public static readonly executeSproc = "dataexplorerexecutesproc";
|
||||||
}
|
public static readonly hostedDataExplorer = "hosteddataexplorerenabled";
|
||||||
|
public static readonly enableTtl = "enablettl";
|
||||||
export class TagNames {
|
public static readonly enableNotebooks = "enablenotebooks";
|
||||||
public static defaultExperience: string = "defaultExperience";
|
public static readonly enableGalleryPublish = "enablegallerypublish";
|
||||||
}
|
public static readonly enableCodeOfConduct = "enablecodeofconduct";
|
||||||
|
public static readonly enableLinkInjection = "enablelinkinjection";
|
||||||
export class MongoDBAccounts {
|
public static readonly enableSpark = "enablespark";
|
||||||
public static protocol: string = "https";
|
public static readonly livyEndpoint = "livyendpoint";
|
||||||
public static defaultPort: string = "10255";
|
public static readonly notebookServerUrl = "notebookserverurl";
|
||||||
}
|
public static readonly notebookServerToken = "notebookservertoken";
|
||||||
|
public static readonly notebookBasePath = "notebookbasepath";
|
||||||
export enum MongoBackendEndpointType {
|
public static readonly canExceedMaximumValue = "canexceedmaximumvalue";
|
||||||
local,
|
public static readonly enableFixedCollectionWithSharedThroughput = "enablefixedcollectionwithsharedthroughput";
|
||||||
remote,
|
public static readonly ttl90Days = "ttl90days";
|
||||||
}
|
public static readonly enableRightPanelV2 = "enablerightpanelv2";
|
||||||
|
public static readonly enableSDKoperations = "enablesdkoperations";
|
||||||
// TODO: 435619 Add default endpoints per cloud and use regional only when available
|
}
|
||||||
export class CassandraBackend {
|
|
||||||
public static readonly createOrDeleteApi: string = "api/cassandra/createordelete";
|
// flight names returned from the portal are always lowercase
|
||||||
public static readonly guestCreateOrDeleteApi: string = "api/guest/cassandra/createordelete";
|
export class Flights {
|
||||||
public static readonly queryApi: string = "api/cassandra";
|
public static readonly SettingsV2 = "settingsv2";
|
||||||
public static readonly guestQueryApi: string = "api/guest/cassandra";
|
public static readonly MongoIndexEditor = "mongoindexeditor";
|
||||||
public static readonly keysApi: string = "api/cassandra/keys";
|
}
|
||||||
public static readonly guestKeysApi: string = "api/guest/cassandra/keys";
|
|
||||||
public static readonly schemaApi: string = "api/cassandra/schema";
|
export class AfecFeatures {
|
||||||
public static readonly guestSchemaApi: string = "api/guest/cassandra/schema";
|
public static readonly Spark = "spark-public-preview";
|
||||||
}
|
public static readonly Notebooks = "sparknotebooks-public-preview";
|
||||||
|
public static readonly StorageAnalytics = "storageanalytics-public-preview";
|
||||||
export class Queries {
|
}
|
||||||
public static CustomPageOption: string = "custom";
|
|
||||||
public static UnlimitedPageOption: string = "unlimited";
|
export class Spark {
|
||||||
public static itemsPerPage: number = 100;
|
public static readonly MaxWorkerCount = 10;
|
||||||
public static unlimitedItemsPerPage: number = 100; // TODO: Figure out appropriate value so it works for accounts with a large number of partitions
|
public static readonly SKUs: HashMap<string> = new HashMap({
|
||||||
|
"Cosmos.Spark.D1s": "D1s / 1 core / 4GB RAM",
|
||||||
public static QueryEditorMinHeightRatio: number = 0.1;
|
"Cosmos.Spark.D2s": "D2s / 2 cores / 8GB RAM",
|
||||||
public static QueryEditorMaxHeightRatio: number = 0.4;
|
"Cosmos.Spark.D4s": "D4s / 4 cores / 16GB RAM",
|
||||||
public static readonly DefaultMaxDegreeOfParallelism = 6;
|
"Cosmos.Spark.D8s": "D8s / 8 cores / 32GB RAM",
|
||||||
}
|
"Cosmos.Spark.D16s": "D16s / 16 cores / 64GB RAM",
|
||||||
|
"Cosmos.Spark.D32s": "D32s / 32 cores / 128GB RAM",
|
||||||
export class SavedQueries {
|
"Cosmos.Spark.D64s": "D64s / 64 cores / 256GB RAM"
|
||||||
public static readonly CollectionName: string = "___Query";
|
});
|
||||||
public static readonly DatabaseName: string = "___Cosmos";
|
}
|
||||||
public static readonly OfferThroughput: number = 400;
|
|
||||||
public static readonly PartitionKeyProperty: string = "id";
|
export class TagNames {
|
||||||
}
|
public static defaultExperience: string = "defaultExperience";
|
||||||
|
}
|
||||||
export class DocumentsGridMetrics {
|
|
||||||
public static DocumentsPerPage: number = 100;
|
export class MongoDBAccounts {
|
||||||
public static IndividualRowHeight: number = 34;
|
public static protocol: string = "https";
|
||||||
public static BufferHeight: number = 28;
|
public static defaultPort: string = "10255";
|
||||||
public static SplitterMinWidth: number = 200;
|
}
|
||||||
public static SplitterMaxWidth: number = 360;
|
|
||||||
|
export enum MongoBackendEndpointType {
|
||||||
public static DocumentEditorMinWidthRatio: number = 0.2;
|
local,
|
||||||
public static DocumentEditorMaxWidthRatio: number = 0.4;
|
remote
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ExplorerMetrics {
|
// TODO: 435619 Add default endpoints per cloud and use regional only when available
|
||||||
public static SplitterMinWidth: number = 240;
|
export class CassandraBackend {
|
||||||
public static SplitterMaxWidth: number = 400;
|
public static readonly createOrDeleteApi: string = "api/cassandra/createordelete";
|
||||||
public static CollapsedResourceTreeWidth: number = 36;
|
public static readonly guestCreateOrDeleteApi: string = "api/guest/cassandra/createordelete";
|
||||||
}
|
public static readonly queryApi: string = "api/cassandra";
|
||||||
|
public static readonly guestQueryApi: string = "api/guest/cassandra";
|
||||||
export class SplitterMetrics {
|
public static readonly keysApi: string = "api/cassandra/keys";
|
||||||
public static CollapsedPositionLeft: number = ExplorerMetrics.CollapsedResourceTreeWidth;
|
public static readonly guestKeysApi: string = "api/guest/cassandra/keys";
|
||||||
}
|
public static readonly schemaApi: string = "api/cassandra/schema";
|
||||||
|
public static readonly guestSchemaApi: string = "api/guest/cassandra/schema";
|
||||||
export class Areas {
|
}
|
||||||
public static ResourceTree: string = "Resource Tree";
|
|
||||||
public static ContextualPane: string = "Contextual Pane";
|
export class RUPMStates {
|
||||||
public static Tab: string = "Tab";
|
public static on: string = "on";
|
||||||
public static ShareDialog: string = "Share Access Dialog";
|
public static off: string = "off";
|
||||||
public static Notebook: string = "Notebook";
|
}
|
||||||
}
|
|
||||||
|
export class Queries {
|
||||||
export class HttpHeaders {
|
public static CustomPageOption: string = "custom";
|
||||||
public static activityId: string = "x-ms-activity-id";
|
public static UnlimitedPageOption: string = "unlimited";
|
||||||
public static apiType: string = "x-ms-cosmos-apitype";
|
public static itemsPerPage: number = 100;
|
||||||
public static authorization: string = "authorization";
|
public static unlimitedItemsPerPage: number = 100; // TODO: Figure out appropriate value so it works for accounts with a large number of partitions
|
||||||
public static collectionIndexTransformationProgress: string =
|
|
||||||
"x-ms-documentdb-collection-index-transformation-progress";
|
public static QueryEditorMinHeightRatio: number = 0.1;
|
||||||
public static continuation: string = "x-ms-continuation";
|
public static QueryEditorMaxHeightRatio: number = 0.4;
|
||||||
public static correlationRequestId: string = "x-ms-correlation-request-id";
|
public static readonly DefaultMaxDegreeOfParallelism = 6;
|
||||||
public static enableScriptLogging: string = "x-ms-documentdb-script-enable-logging";
|
}
|
||||||
public static guestAccessToken: string = "x-ms-encrypted-auth-token";
|
|
||||||
public static getReadOnlyKey: string = "x-ms-get-read-only-key";
|
export class SavedQueries {
|
||||||
public static connectionString: string = "x-ms-connection-string";
|
public static readonly CollectionName: string = "___Query";
|
||||||
public static msDate: string = "x-ms-date";
|
public static readonly DatabaseName: string = "___Cosmos";
|
||||||
public static location: string = "Location";
|
public static readonly OfferThroughput: number = 400;
|
||||||
public static contentType: string = "Content-Type";
|
public static readonly PartitionKeyProperty: string = "id";
|
||||||
public static offerReplacePending: string = "x-ms-offer-replace-pending";
|
}
|
||||||
public static user: string = "x-ms-user";
|
|
||||||
public static populatePartitionStatistics: string = "x-ms-documentdb-populatepartitionstatistics";
|
export class DocumentsGridMetrics {
|
||||||
public static queryMetrics: string = "x-ms-documentdb-query-metrics";
|
public static DocumentsPerPage: number = 100;
|
||||||
public static requestCharge: string = "x-ms-request-charge";
|
public static IndividualRowHeight: number = 34;
|
||||||
public static resourceQuota: string = "x-ms-resource-quota";
|
public static BufferHeight: number = 28;
|
||||||
public static resourceUsage: string = "x-ms-resource-usage";
|
public static SplitterMinWidth: number = 200;
|
||||||
public static retryAfterMs: string = "x-ms-retry-after-ms";
|
public static SplitterMaxWidth: number = 360;
|
||||||
public static scriptLogResults: string = "x-ms-documentdb-script-log-results";
|
|
||||||
public static populateCollectionThroughputInfo = "x-ms-documentdb-populatecollectionthroughputinfo";
|
public static DocumentEditorMinWidthRatio: number = 0.2;
|
||||||
public static supportSpatialLegacyCoordinates = "x-ms-documentdb-supportspatiallegacycoordinates";
|
public static DocumentEditorMaxWidthRatio: number = 0.4;
|
||||||
public static usePolygonsSmallerThanAHemisphere = "x-ms-documentdb-usepolygonssmallerthanahemisphere";
|
}
|
||||||
public static autoPilotThroughput = "autoscaleSettings";
|
|
||||||
public static autoPilotThroughputSDK = "x-ms-cosmos-offer-autopilot-settings";
|
export class ExplorerMetrics {
|
||||||
public static partitionKey: string = "x-ms-documentdb-partitionkey";
|
public static SplitterMinWidth: number = 240;
|
||||||
public static migrateOfferToManualThroughput: string = "x-ms-cosmos-migrate-offer-to-manual-throughput";
|
public static SplitterMaxWidth: number = 400;
|
||||||
public static migrateOfferToAutopilot: string = "x-ms-cosmos-migrate-offer-to-autopilot";
|
public static CollapsedResourceTreeWidth: number = 36;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ApiType {
|
export class SplitterMetrics {
|
||||||
// Mapped to hexadecimal values in the backend
|
public static CollapsedPositionLeft: number = ExplorerMetrics.CollapsedResourceTreeWidth;
|
||||||
public static readonly MongoDB: number = 1;
|
}
|
||||||
public static readonly Gremlin: number = 2;
|
|
||||||
public static readonly Cassandra: number = 4;
|
export class Areas {
|
||||||
public static readonly Table: number = 8;
|
public static ResourceTree: string = "Resource Tree";
|
||||||
public static readonly SQL: number = 16;
|
public static ContextualPane: string = "Contextual Pane";
|
||||||
}
|
public static Tab: string = "Tab";
|
||||||
|
public static ShareDialog: string = "Share Access Dialog";
|
||||||
export class HttpStatusCodes {
|
public static Notebook: string = "Notebook";
|
||||||
public static readonly OK: number = 200;
|
}
|
||||||
public static readonly Created: number = 201;
|
|
||||||
public static readonly Accepted: number = 202;
|
export class HttpHeaders {
|
||||||
public static readonly NoContent: number = 204;
|
public static activityId: string = "x-ms-activity-id";
|
||||||
public static readonly NotModified: number = 304;
|
public static apiType: string = "x-ms-cosmos-apitype";
|
||||||
public static readonly Unauthorized: number = 401;
|
public static authorization: string = "authorization";
|
||||||
public static readonly Forbidden: number = 403;
|
public static collectionIndexTransformationProgress: string =
|
||||||
public static readonly NotFound: number = 404;
|
"x-ms-documentdb-collection-index-transformation-progress";
|
||||||
public static readonly TooManyRequests: number = 429;
|
public static continuation: string = "x-ms-continuation";
|
||||||
public static readonly Conflict: number = 409;
|
public static correlationRequestId: string = "x-ms-correlation-request-id";
|
||||||
|
public static enableScriptLogging: string = "x-ms-documentdb-script-enable-logging";
|
||||||
public static readonly InternalServerError: number = 500;
|
public static guestAccessToken: string = "x-ms-encrypted-auth-token";
|
||||||
public static readonly BadGateway: number = 502;
|
public static getReadOnlyKey: string = "x-ms-get-read-only-key";
|
||||||
public static readonly ServiceUnavailable: number = 503;
|
public static connectionString: string = "x-ms-connection-string";
|
||||||
public static readonly GatewayTimeout: number = 504;
|
public static msDate: string = "x-ms-date";
|
||||||
|
public static location: string = "Location";
|
||||||
public static readonly RetryableStatusCodes: number[] = [
|
public static contentType: string = "Content-Type";
|
||||||
HttpStatusCodes.TooManyRequests,
|
public static offerReplacePending: string = "x-ms-offer-replace-pending";
|
||||||
HttpStatusCodes.InternalServerError, // TODO: Handle all 500s on Portal backend and remove from retries list
|
public static user: string = "x-ms-user";
|
||||||
HttpStatusCodes.BadGateway,
|
public static populatePartitionStatistics: string = "x-ms-documentdb-populatepartitionstatistics";
|
||||||
HttpStatusCodes.ServiceUnavailable,
|
public static queryMetrics: string = "x-ms-documentdb-query-metrics";
|
||||||
HttpStatusCodes.GatewayTimeout,
|
public static requestCharge: string = "x-ms-request-charge";
|
||||||
];
|
public static resourceQuota: string = "x-ms-resource-quota";
|
||||||
}
|
public static resourceUsage: string = "x-ms-resource-usage";
|
||||||
|
public static retryAfterMs: string = "x-ms-retry-after-ms";
|
||||||
export class Urls {
|
public static scriptLogResults: string = "x-ms-documentdb-script-log-results";
|
||||||
public static feedbackEmail = "https://aka.ms/cosmosdbfeedback?subject=Cosmos%20DB%20Data%20Explorer%20Feedback";
|
public static populateCollectionThroughputInfo = "x-ms-documentdb-populatecollectionthroughputinfo";
|
||||||
public static autoscaleMigration = "https://aka.ms/cosmos-autoscale-migration";
|
public static supportSpatialLegacyCoordinates = "x-ms-documentdb-supportspatiallegacycoordinates";
|
||||||
public static freeTierInformation = "https://aka.ms/cosmos-free-tier";
|
public static usePolygonsSmallerThanAHemisphere = "x-ms-documentdb-usepolygonssmallerthanahemisphere";
|
||||||
public static cosmosPricing = "https://aka.ms/azure-cosmos-db-pricing";
|
public static autoPilotThroughput = "autoscaleSettings";
|
||||||
}
|
public static autoPilotThroughputSDK = "x-ms-cosmos-offer-autopilot-settings";
|
||||||
|
public static partitionKey: string = "x-ms-documentdb-partitionkey";
|
||||||
export class HashRoutePrefixes {
|
public static migrateOfferToManualThroughput: string = "x-ms-cosmos-migrate-offer-to-manual-throughput";
|
||||||
public static databases: string = "/dbs/{db_id}";
|
public static migrateOfferToAutopilot: string = "x-ms-cosmos-migrate-offer-to-autopilot";
|
||||||
public static collections: string = "/dbs/{db_id}/colls/{coll_id}";
|
}
|
||||||
public static sprocHash: string = "/sprocs/";
|
|
||||||
public static sprocs: string = HashRoutePrefixes.collections + HashRoutePrefixes.sprocHash + "{sproc_id}";
|
export class ApiType {
|
||||||
public static docs: string = HashRoutePrefixes.collections + "/docs/{doc_id}/";
|
// Mapped to hexadecimal values in the backend
|
||||||
public static conflicts: string = HashRoutePrefixes.collections + "/conflicts";
|
public static readonly MongoDB: number = 1;
|
||||||
|
public static readonly Gremlin: number = 2;
|
||||||
public static databasesWithId(databaseId: string): string {
|
public static readonly Cassandra: number = 4;
|
||||||
return this.databases.replace("{db_id}", databaseId).replace("/", ""); // strip the first slash since hasher adds it
|
public static readonly Table: number = 8;
|
||||||
}
|
public static readonly SQL: number = 16;
|
||||||
|
}
|
||||||
public static collectionsWithIds(databaseId: string, collectionId: string): string {
|
|
||||||
const transformedDatabasePrefix: string = this.collections.replace("{db_id}", databaseId);
|
export class HttpStatusCodes {
|
||||||
|
public static readonly OK: number = 200;
|
||||||
return transformedDatabasePrefix.replace("{coll_id}", collectionId).replace("/", ""); // strip the first slash since hasher adds it
|
public static readonly Created: number = 201;
|
||||||
}
|
public static readonly Accepted: number = 202;
|
||||||
|
public static readonly NoContent: number = 204;
|
||||||
public static sprocWithIds(
|
public static readonly NotModified: number = 304;
|
||||||
databaseId: string,
|
public static readonly Unauthorized: number = 401;
|
||||||
collectionId: string,
|
public static readonly Forbidden: number = 403;
|
||||||
sprocId: string,
|
public static readonly NotFound: number = 404;
|
||||||
stripFirstSlash: boolean = true
|
public static readonly TooManyRequests: number = 429;
|
||||||
): string {
|
public static readonly Conflict: number = 409;
|
||||||
const transformedDatabasePrefix: string = this.sprocs.replace("{db_id}", databaseId);
|
|
||||||
|
public static readonly InternalServerError: number = 500;
|
||||||
const transformedSprocRoute: string = transformedDatabasePrefix
|
public static readonly BadGateway: number = 502;
|
||||||
.replace("{coll_id}", collectionId)
|
public static readonly ServiceUnavailable: number = 503;
|
||||||
.replace("{sproc_id}", sprocId);
|
public static readonly GatewayTimeout: number = 504;
|
||||||
if (!!stripFirstSlash) {
|
|
||||||
return transformedSprocRoute.replace("/", ""); // strip the first slash since hasher adds it
|
public static readonly RetryableStatusCodes: number[] = [
|
||||||
}
|
HttpStatusCodes.TooManyRequests,
|
||||||
|
HttpStatusCodes.InternalServerError, // TODO: Handle all 500s on Portal backend and remove from retries list
|
||||||
return transformedSprocRoute;
|
HttpStatusCodes.BadGateway,
|
||||||
}
|
HttpStatusCodes.ServiceUnavailable,
|
||||||
|
HttpStatusCodes.GatewayTimeout
|
||||||
public static conflictsWithIds(databaseId: string, collectionId: string) {
|
];
|
||||||
const transformedDatabasePrefix: string = this.conflicts.replace("{db_id}", databaseId);
|
}
|
||||||
|
|
||||||
return transformedDatabasePrefix.replace("{coll_id}", collectionId).replace("/", ""); // strip the first slash since hasher adds it;
|
export class Urls {
|
||||||
}
|
public static feedbackEmail = "https://aka.ms/cosmosdbfeedback?subject=Cosmos%20DB%20Data%20Explorer%20Feedback";
|
||||||
|
public static autoscaleMigration = "https://aka.ms/cosmos-autoscale-migration";
|
||||||
public static docsWithIds(databaseId: string, collectionId: string, docId: string) {
|
public static freeTierInformation = "https://aka.ms/cosmos-free-tier";
|
||||||
const transformedDatabasePrefix: string = this.docs.replace("{db_id}", databaseId);
|
public static cosmosPricing = "https://aka.ms/azure-cosmos-db-pricing";
|
||||||
|
}
|
||||||
return transformedDatabasePrefix.replace("{coll_id}", collectionId).replace("{doc_id}", docId).replace("/", ""); // strip the first slash since hasher adds it
|
|
||||||
}
|
export class HashRoutePrefixes {
|
||||||
}
|
public static databases: string = "/dbs/{db_id}";
|
||||||
|
public static collections: string = "/dbs/{db_id}/colls/{coll_id}";
|
||||||
export class ConfigurationOverridesValues {
|
public static sprocHash: string = "/sprocs/";
|
||||||
public static IsBsonSchemaV2: string = "true";
|
public static sprocs: string = HashRoutePrefixes.collections + HashRoutePrefixes.sprocHash + "{sproc_id}";
|
||||||
}
|
public static docs: string = HashRoutePrefixes.collections + "/docs/{doc_id}/";
|
||||||
|
public static conflicts: string = HashRoutePrefixes.collections + "/conflicts";
|
||||||
export class KeyCodes {
|
|
||||||
public static Space: number = 32;
|
public static databasesWithId(databaseId: string): string {
|
||||||
public static Enter: number = 13;
|
return this.databases.replace("{db_id}", databaseId).replace("/", ""); // strip the first slash since hasher adds it
|
||||||
public static Escape: number = 27;
|
}
|
||||||
public static UpArrow: number = 38;
|
|
||||||
public static DownArrow: number = 40;
|
public static collectionsWithIds(databaseId: string, collectionId: string): string {
|
||||||
public static LeftArrow: number = 37;
|
const transformedDatabasePrefix: string = this.collections.replace("{db_id}", databaseId);
|
||||||
public static RightArrow: number = 39;
|
|
||||||
public static Tab: number = 9;
|
return transformedDatabasePrefix.replace("{coll_id}", collectionId).replace("/", ""); // strip the first slash since hasher adds it
|
||||||
}
|
}
|
||||||
|
|
||||||
// Normalized per: https://www.w3.org/TR/uievents-key/#named-key-attribute-values
|
public static sprocWithIds(
|
||||||
export class NormalizedEventKey {
|
databaseId: string,
|
||||||
public static readonly Space = " ";
|
collectionId: string,
|
||||||
public static readonly Enter = "Enter";
|
sprocId: string,
|
||||||
public static readonly Escape = "Escape";
|
stripFirstSlash: boolean = true
|
||||||
public static readonly UpArrow = "ArrowUp";
|
): string {
|
||||||
public static readonly DownArrow = "ArrowDown";
|
const transformedDatabasePrefix: string = this.sprocs.replace("{db_id}", databaseId);
|
||||||
public static readonly LeftArrow = "ArrowLeft";
|
|
||||||
public static readonly RightArrow = "ArrowRight";
|
const transformedSprocRoute: string = transformedDatabasePrefix
|
||||||
}
|
.replace("{coll_id}", collectionId)
|
||||||
|
.replace("{sproc_id}", sprocId);
|
||||||
export class TryCosmosExperience {
|
if (!!stripFirstSlash) {
|
||||||
public static extendUrl: string = "https://trycosmosdb.azure.com/api/resource/extendportal?userId={0}";
|
return transformedSprocRoute.replace("/", ""); // strip the first slash since hasher adds it
|
||||||
public static deleteUrl: string = "https://trycosmosdb.azure.com/api/resource/deleteportal?userId={0}";
|
}
|
||||||
public static collectionsPerAccount: number = 3;
|
|
||||||
public static maxRU: number = 5000;
|
return transformedSprocRoute;
|
||||||
public static defaultRU: number = 3000;
|
}
|
||||||
}
|
|
||||||
|
public static conflictsWithIds(databaseId: string, collectionId: string) {
|
||||||
export class OfferVersions {
|
const transformedDatabasePrefix: string = this.conflicts.replace("{db_id}", databaseId);
|
||||||
public static V1: string = "V1";
|
|
||||||
public static V2: string = "V2";
|
return transformedDatabasePrefix.replace("{coll_id}", collectionId).replace("/", ""); // strip the first slash since hasher adds it;
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum ConflictOperationType {
|
public static docsWithIds(databaseId: string, collectionId: string, docId: string) {
|
||||||
Replace = "replace",
|
const transformedDatabasePrefix: string = this.docs.replace("{db_id}", databaseId);
|
||||||
Create = "create",
|
|
||||||
Delete = "delete",
|
return transformedDatabasePrefix
|
||||||
}
|
.replace("{coll_id}", collectionId)
|
||||||
|
.replace("{doc_id}", docId)
|
||||||
export const EmulatorMasterKey =
|
.replace("/", ""); // strip the first slash since hasher adds it
|
||||||
//[SuppressMessage("Microsoft.Security", "CS002:SecretInNextLine", Justification="Well known public masterKey for emulator")]
|
}
|
||||||
"C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==";
|
}
|
||||||
|
|
||||||
// A variable @MyVariable defined in Constants.less is accessible as StyleConstants.MyVariable
|
export class ConfigurationOverridesValues {
|
||||||
export const StyleConstants = require("less-vars-loader!../../less/Common/Constants.less");
|
public static IsBsonSchemaV2: string = "true";
|
||||||
|
}
|
||||||
export class Notebook {
|
|
||||||
public static readonly defaultBasePath = "./notebooks";
|
export class KeyCodes {
|
||||||
public static readonly heartbeatDelayMs = 5000;
|
public static Space: number = 32;
|
||||||
public static readonly kernelRestartInitialDelayMs = 1000;
|
public static Enter: number = 13;
|
||||||
public static readonly kernelRestartMaxDelayMs = 20000;
|
public static Escape: number = 27;
|
||||||
public static readonly autoSaveIntervalMs = 120000;
|
public static UpArrow: number = 38;
|
||||||
}
|
public static DownArrow: number = 40;
|
||||||
|
public static LeftArrow: number = 37;
|
||||||
export class SparkLibrary {
|
public static RightArrow: number = 39;
|
||||||
public static readonly nameMinLength = 3;
|
public static Tab: number = 9;
|
||||||
public static readonly nameMaxLength = 63;
|
}
|
||||||
}
|
|
||||||
|
// Normalized per: https://www.w3.org/TR/uievents-key/#named-key-attribute-values
|
||||||
export class AnalyticalStorageTtl {
|
export class NormalizedEventKey {
|
||||||
public static readonly Days90: number = 7776000;
|
public static readonly Space = " ";
|
||||||
public static readonly Infinite: number = -1;
|
public static readonly Enter = "Enter";
|
||||||
public static readonly Disabled: number = 0;
|
public static readonly Escape = "Escape";
|
||||||
}
|
public static readonly UpArrow = "ArrowUp";
|
||||||
|
public static readonly DownArrow = "ArrowDown";
|
||||||
export class TerminalQueryParams {
|
public static readonly LeftArrow = "ArrowLeft";
|
||||||
public static readonly Terminal = "terminal";
|
public static readonly RightArrow = "ArrowRight";
|
||||||
public static readonly Server = "server";
|
}
|
||||||
public static readonly Token = "token";
|
|
||||||
public static readonly SubscriptionId = "subscriptionId";
|
export class TryCosmosExperience {
|
||||||
public static readonly TerminalEndpoint = "terminalEndpoint";
|
public static extendUrl: string = "https://trycosmosdb.azure.com/api/resource/extendportal?userId={0}";
|
||||||
}
|
public static deleteUrl: string = "https://trycosmosdb.azure.com/api/resource/deleteportal?userId={0}";
|
||||||
|
public static collectionsPerAccount: number = 3;
|
||||||
|
public static maxRU: number = 5000;
|
||||||
|
public static defaultRU: number = 3000;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class OfferVersions {
|
||||||
|
public static V1: string = "V1";
|
||||||
|
public static V2: string = "V2";
|
||||||
|
}
|
||||||
|
|
||||||
|
export enum ConflictOperationType {
|
||||||
|
Replace = "replace",
|
||||||
|
Create = "create",
|
||||||
|
Delete = "delete"
|
||||||
|
}
|
||||||
|
|
||||||
|
export const EmulatorMasterKey =
|
||||||
|
//[SuppressMessage("Microsoft.Security", "CS002:SecretInNextLine", Justification="Well known public masterKey for emulator")]
|
||||||
|
"C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==";
|
||||||
|
|
||||||
|
// A variable @MyVariable defined in Constants.less is accessible as StyleConstants.MyVariable
|
||||||
|
export const StyleConstants = require("less-vars-loader!../../less/Common/Constants.less");
|
||||||
|
|
||||||
|
export class Notebook {
|
||||||
|
public static readonly defaultBasePath = "./notebooks";
|
||||||
|
public static readonly heartbeatDelayMs = 5000;
|
||||||
|
public static readonly kernelRestartInitialDelayMs = 1000;
|
||||||
|
public static readonly kernelRestartMaxDelayMs = 20000;
|
||||||
|
public static readonly autoSaveIntervalMs = 120000;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class SparkLibrary {
|
||||||
|
public static readonly nameMinLength = 3;
|
||||||
|
public static readonly nameMaxLength = 63;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class AnalyticalStorageTtl {
|
||||||
|
public static readonly Days90: number = 7776000;
|
||||||
|
public static readonly Infinite: number = -1;
|
||||||
|
public static readonly Disabled: number = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class TerminalQueryParams {
|
||||||
|
public static readonly Terminal = "terminal";
|
||||||
|
public static readonly Server = "server";
|
||||||
|
public static readonly Token = "token";
|
||||||
|
public static readonly SubscriptionId = "subscriptionId";
|
||||||
|
public static readonly TerminalEndpoint = "terminalEndpoint";
|
||||||
|
}
|
||||||
|
|||||||
@@ -10,17 +10,17 @@ describe("tokenProvider", () => {
|
|||||||
resourceId: "",
|
resourceId: "",
|
||||||
resourceType: "dbs" as ResourceType,
|
resourceType: "dbs" as ResourceType,
|
||||||
headers: {},
|
headers: {},
|
||||||
getAuthorizationTokenUsingMasterKey: () => "",
|
getAuthorizationTokenUsingMasterKey: () => ""
|
||||||
};
|
};
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
updateConfigContext({
|
updateConfigContext({
|
||||||
BACKEND_ENDPOINT: "https://main.documentdb.ext.azure.com",
|
BACKEND_ENDPOINT: "https://main.documentdb.ext.azure.com"
|
||||||
});
|
});
|
||||||
window.fetch = jest.fn().mockImplementation(() => {
|
window.fetch = jest.fn().mockImplementation(() => {
|
||||||
return {
|
return {
|
||||||
json: () => "{}",
|
json: () => "{}",
|
||||||
headers: new Map(),
|
headers: new Map()
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -36,7 +36,7 @@ describe("tokenProvider", () => {
|
|||||||
|
|
||||||
it("does not call the auth service if a master key is set", async () => {
|
it("does not call the auth service if a master key is set", async () => {
|
||||||
updateUserContext({
|
updateUserContext({
|
||||||
masterKey: "foo",
|
masterKey: "foo"
|
||||||
});
|
});
|
||||||
await tokenProvider(options);
|
await tokenProvider(options);
|
||||||
expect((window.fetch as any).mock.calls.length).toBe(0);
|
expect((window.fetch as any).mock.calls.length).toBe(0);
|
||||||
@@ -50,7 +50,7 @@ describe("getTokenFromAuthService", () => {
|
|||||||
window.fetch = jest.fn().mockImplementation(() => {
|
window.fetch = jest.fn().mockImplementation(() => {
|
||||||
return {
|
return {
|
||||||
json: () => "{}",
|
json: () => "{}",
|
||||||
headers: new Map(),
|
headers: new Map()
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -61,7 +61,7 @@ describe("getTokenFromAuthService", () => {
|
|||||||
|
|
||||||
it("builds the correct URL in production", () => {
|
it("builds the correct URL in production", () => {
|
||||||
updateConfigContext({
|
updateConfigContext({
|
||||||
BACKEND_ENDPOINT: "https://main.documentdb.ext.azure.com",
|
BACKEND_ENDPOINT: "https://main.documentdb.ext.azure.com"
|
||||||
});
|
});
|
||||||
getTokenFromAuthService("GET", "dbs", "foo");
|
getTokenFromAuthService("GET", "dbs", "foo");
|
||||||
expect(window.fetch).toHaveBeenCalledWith(
|
expect(window.fetch).toHaveBeenCalledWith(
|
||||||
@@ -72,7 +72,7 @@ describe("getTokenFromAuthService", () => {
|
|||||||
|
|
||||||
it("builds the correct URL in dev", () => {
|
it("builds the correct URL in dev", () => {
|
||||||
updateConfigContext({
|
updateConfigContext({
|
||||||
BACKEND_ENDPOINT: "https://localhost:1234",
|
BACKEND_ENDPOINT: "https://localhost:1234"
|
||||||
});
|
});
|
||||||
getTokenFromAuthService("GET", "dbs", "foo");
|
getTokenFromAuthService("GET", "dbs", "foo");
|
||||||
expect(window.fetch).toHaveBeenCalledWith(
|
expect(window.fetch).toHaveBeenCalledWith(
|
||||||
@@ -96,15 +96,15 @@ describe("endpoint", () => {
|
|||||||
documentEndpoint: "bar",
|
documentEndpoint: "bar",
|
||||||
gremlinEndpoint: "foo",
|
gremlinEndpoint: "foo",
|
||||||
tableEndpoint: "foo",
|
tableEndpoint: "foo",
|
||||||
cassandraEndpoint: "foo",
|
cassandraEndpoint: "foo"
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
expect(endpoint()).toEqual("bar");
|
expect(endpoint()).toEqual("bar");
|
||||||
});
|
});
|
||||||
it("uses _endpoint if set", () => {
|
it("uses _endpoint if set", () => {
|
||||||
updateUserContext({
|
updateUserContext({
|
||||||
endpoint: "baz",
|
endpoint: "baz"
|
||||||
});
|
});
|
||||||
expect(endpoint()).toEqual("baz");
|
expect(endpoint()).toEqual("baz");
|
||||||
});
|
});
|
||||||
@@ -121,7 +121,7 @@ describe("requestPlugin", () => {
|
|||||||
updateConfigContext({
|
updateConfigContext({
|
||||||
platform: Platform.Hosted,
|
platform: Platform.Hosted,
|
||||||
BACKEND_ENDPOINT: "https://localhost:1234",
|
BACKEND_ENDPOINT: "https://localhost:1234",
|
||||||
PROXY_PATH: "/proxy",
|
PROXY_PATH: "/proxy"
|
||||||
});
|
});
|
||||||
const headers = {};
|
const headers = {};
|
||||||
const endpoint = "https://docs.azure.com";
|
const endpoint = "https://docs.azure.com";
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import * as Cosmos from "@azure/cosmos";
|
import * as Cosmos from "@azure/cosmos";
|
||||||
import { RequestInfo, setAuthorizationTokenHeaderUsingMasterKey } from "@azure/cosmos";
|
import { RequestInfo, setAuthorizationTokenHeaderUsingMasterKey } from "@azure/cosmos";
|
||||||
import { configContext, Platform } from "../ConfigContext";
|
import { configContext, Platform } from "../ConfigContext";
|
||||||
import { userContext } from "../UserContext";
|
import { getErrorMessage } from "./ErrorHandlingUtils";
|
||||||
import { logConsoleError } from "../Utils/NotificationConsoleUtils";
|
import { logConsoleError } from "../Utils/NotificationConsoleUtils";
|
||||||
import { EmulatorMasterKey, HttpHeaders } from "./Constants";
|
import { EmulatorMasterKey, HttpHeaders } from "./Constants";
|
||||||
import { getErrorMessage } from "./ErrorHandlingUtils";
|
import { userContext } from "../UserContext";
|
||||||
|
|
||||||
const _global = typeof self === "undefined" ? window : self;
|
const _global = typeof self === "undefined" ? window : self;
|
||||||
|
|
||||||
@@ -32,7 +32,7 @@ export const tokenProvider = async (requestInfo: RequestInfo) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const requestPlugin: Cosmos.Plugin<any> = async (requestContext, next) => {
|
export const requestPlugin: Cosmos.Plugin<any> = async (requestContext, next) => {
|
||||||
requestContext.endpoint = new URL(configContext.PROXY_PATH, window.location.href).href;
|
requestContext.endpoint = configContext.PROXY_PATH;
|
||||||
requestContext.headers["x-ms-proxy-target"] = endpoint();
|
requestContext.headers["x-ms-proxy-target"] = endpoint();
|
||||||
return next(requestContext);
|
return next(requestContext);
|
||||||
};
|
};
|
||||||
@@ -58,13 +58,13 @@ export async function getTokenFromAuthService(verb: string, resourceType: string
|
|||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
"content-type": "application/json",
|
"content-type": "application/json",
|
||||||
"x-ms-encrypted-auth-token": userContext.accessToken,
|
"x-ms-encrypted-auth-token": userContext.accessToken
|
||||||
},
|
},
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
verb,
|
verb,
|
||||||
resourceType,
|
resourceType,
|
||||||
resourceId,
|
resourceId
|
||||||
}),
|
})
|
||||||
});
|
});
|
||||||
//TODO I am not sure why we have to parse the JSON again here. fetch should do it for us when we call .json()
|
//TODO I am not sure why we have to parse the JSON again here. fetch should do it for us when we call .json()
|
||||||
const result = JSON.parse(await response.json());
|
const result = JSON.parse(await response.json());
|
||||||
@@ -75,23 +75,19 @@ export async function getTokenFromAuthService(verb: string, resourceType: string
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let _client: Cosmos.CosmosClient;
|
|
||||||
|
|
||||||
export function client(): Cosmos.CosmosClient {
|
export function client(): Cosmos.CosmosClient {
|
||||||
if (_client) return _client;
|
|
||||||
const options: Cosmos.CosmosClientOptions = {
|
const options: Cosmos.CosmosClientOptions = {
|
||||||
endpoint: endpoint() || "https://cosmos.azure.com", // CosmosClient gets upset if we pass a bad URL. This should never actually get called
|
endpoint: endpoint() || " ", // CosmosClient gets upset if we pass a falsy value here
|
||||||
key: userContext.masterKey,
|
key: userContext.masterKey,
|
||||||
tokenProvider,
|
tokenProvider,
|
||||||
connectionPolicy: {
|
connectionPolicy: {
|
||||||
enableEndpointDiscovery: false,
|
enableEndpointDiscovery: false
|
||||||
},
|
},
|
||||||
userAgentSuffix: "Azure Portal",
|
userAgentSuffix: "Azure Portal"
|
||||||
};
|
};
|
||||||
|
|
||||||
if (configContext.PROXY_PATH !== undefined) {
|
if (configContext.PROXY_PATH !== undefined) {
|
||||||
(options as any).plugins = [{ on: "request", plugin: requestPlugin }];
|
(options as any).plugins = [{ on: "request", plugin: requestPlugin }];
|
||||||
}
|
}
|
||||||
_client = new Cosmos.CosmosClient(options);
|
return new Cosmos.CosmosClient(options);
|
||||||
return _client;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
import { getCommonQueryOptions } from "./queryDocuments";
|
import { getCommonQueryOptions } from "./DataAccessUtilityBase";
|
||||||
import { LocalStorageUtility, StorageKey } from "../../Shared/StorageUtility";
|
import { LocalStorageUtility, StorageKey } from "../Shared/StorageUtility";
|
||||||
|
|
||||||
describe("getCommonQueryOptions", () => {
|
describe("getCommonQueryOptions", () => {
|
||||||
it("builds the correct default options objects", () => {
|
it("builds the correct default options objects", () => {
|
||||||
expect(getCommonQueryOptions({})).toMatchSnapshot();
|
expect(getCommonQueryOptions({})).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
it("reads from localStorage", () => {
|
it("reads from localStorage", () => {
|
||||||
LocalStorageUtility.setEntryNumber(StorageKey.ActualItemPerPage, 37);
|
LocalStorageUtility.setEntryNumber(StorageKey.ActualItemPerPage, 37);
|
||||||
LocalStorageUtility.setEntryNumber(StorageKey.MaxDegreeOfParellism, 17);
|
LocalStorageUtility.setEntryNumber(StorageKey.MaxDegreeOfParellism, 17);
|
||||||
expect(getCommonQueryOptions({})).toMatchSnapshot();
|
expect(getCommonQueryOptions({})).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
182
src/Common/DataAccessUtilityBase.ts
Normal file
182
src/Common/DataAccessUtilityBase.ts
Normal file
@@ -0,0 +1,182 @@
|
|||||||
|
import {
|
||||||
|
ConflictDefinition,
|
||||||
|
FeedOptions,
|
||||||
|
ItemDefinition,
|
||||||
|
OfferDefinition,
|
||||||
|
QueryIterator,
|
||||||
|
Resource
|
||||||
|
} from "@azure/cosmos";
|
||||||
|
import { RequestOptions } from "@azure/cosmos/dist-esm";
|
||||||
|
import Q from "q";
|
||||||
|
import { configContext, Platform } from "../ConfigContext";
|
||||||
|
import * as DataModels from "../Contracts/DataModels";
|
||||||
|
import { MessageTypes } from "../Contracts/ExplorerContracts";
|
||||||
|
import * as ViewModels from "../Contracts/ViewModels";
|
||||||
|
import ConflictId from "../Explorer/Tree/ConflictId";
|
||||||
|
import DocumentId from "../Explorer/Tree/DocumentId";
|
||||||
|
import StoredProcedure from "../Explorer/Tree/StoredProcedure";
|
||||||
|
import { LocalStorageUtility, StorageKey } from "../Shared/StorageUtility";
|
||||||
|
import { OfferUtils } from "../Utils/OfferUtils";
|
||||||
|
import * as Constants from "./Constants";
|
||||||
|
import { client } from "./CosmosClient";
|
||||||
|
import * as HeadersUtility from "./HeadersUtility";
|
||||||
|
import { sendCachedDataMessage } from "./MessageHandler";
|
||||||
|
|
||||||
|
export function getCommonQueryOptions(options: FeedOptions): any {
|
||||||
|
const storedItemPerPageSetting: number = LocalStorageUtility.getEntryNumber(StorageKey.ActualItemPerPage);
|
||||||
|
options = options || {};
|
||||||
|
options.populateQueryMetrics = true;
|
||||||
|
options.enableScanInQuery = options.enableScanInQuery || true;
|
||||||
|
if (!options.partitionKey) {
|
||||||
|
options.forceQueryPlan = true;
|
||||||
|
}
|
||||||
|
options.maxItemCount =
|
||||||
|
options.maxItemCount ||
|
||||||
|
(storedItemPerPageSetting !== undefined && storedItemPerPageSetting) ||
|
||||||
|
Constants.Queries.itemsPerPage;
|
||||||
|
options.maxDegreeOfParallelism = LocalStorageUtility.getEntryNumber(StorageKey.MaxDegreeOfParellism);
|
||||||
|
|
||||||
|
return options;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function queryDocuments(
|
||||||
|
databaseId: string,
|
||||||
|
containerId: string,
|
||||||
|
query: string,
|
||||||
|
options: any
|
||||||
|
): Q.Promise<QueryIterator<ItemDefinition & Resource>> {
|
||||||
|
options = getCommonQueryOptions(options);
|
||||||
|
const documentsIterator = client()
|
||||||
|
.database(databaseId)
|
||||||
|
.container(containerId)
|
||||||
|
.items.query(query, options);
|
||||||
|
return Q(documentsIterator);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getPartitionKeyHeaderForConflict(conflictId: ConflictId): Object {
|
||||||
|
const partitionKeyDefinition: DataModels.PartitionKey = conflictId.partitionKey;
|
||||||
|
const partitionKeyValue: any = conflictId.partitionKeyValue;
|
||||||
|
|
||||||
|
return getPartitionKeyHeader(partitionKeyDefinition, partitionKeyValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getPartitionKeyHeader(partitionKeyDefinition: DataModels.PartitionKey, partitionKeyValue: any): Object {
|
||||||
|
if (!partitionKeyDefinition) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (partitionKeyValue === undefined) {
|
||||||
|
return [{}];
|
||||||
|
}
|
||||||
|
|
||||||
|
return [partitionKeyValue];
|
||||||
|
}
|
||||||
|
|
||||||
|
export function updateDocument(
|
||||||
|
collection: ViewModels.CollectionBase,
|
||||||
|
documentId: DocumentId,
|
||||||
|
newDocument: any
|
||||||
|
): Q.Promise<any> {
|
||||||
|
const partitionKey = documentId.partitionKeyValue;
|
||||||
|
|
||||||
|
return Q(
|
||||||
|
client()
|
||||||
|
.database(collection.databaseId)
|
||||||
|
.container(collection.id())
|
||||||
|
.item(documentId.id(), partitionKey)
|
||||||
|
.replace(newDocument)
|
||||||
|
.then(response => response.resource)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function executeStoredProcedure(
|
||||||
|
collection: ViewModels.Collection,
|
||||||
|
storedProcedure: StoredProcedure,
|
||||||
|
partitionKeyValue: any,
|
||||||
|
params: any[]
|
||||||
|
): Q.Promise<any> {
|
||||||
|
// TODO remove this deferred. Kept it because of timeout code at bottom of function
|
||||||
|
const deferred = Q.defer<any>();
|
||||||
|
|
||||||
|
client()
|
||||||
|
.database(collection.databaseId)
|
||||||
|
.container(collection.id())
|
||||||
|
.scripts.storedProcedure(storedProcedure.id())
|
||||||
|
.execute(partitionKeyValue, params, { enableScriptLogging: true })
|
||||||
|
.then(response =>
|
||||||
|
deferred.resolve({
|
||||||
|
result: response.resource,
|
||||||
|
scriptLogs: response.headers[Constants.HttpHeaders.scriptLogResults]
|
||||||
|
})
|
||||||
|
)
|
||||||
|
.catch(error => deferred.reject(error));
|
||||||
|
|
||||||
|
return deferred.promise.timeout(
|
||||||
|
Constants.ClientDefaults.requestTimeoutMs,
|
||||||
|
`Request timed out while executing stored procedure ${storedProcedure.id()}`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function createDocument(collection: ViewModels.CollectionBase, newDocument: any): Q.Promise<any> {
|
||||||
|
return Q(
|
||||||
|
client()
|
||||||
|
.database(collection.databaseId)
|
||||||
|
.container(collection.id())
|
||||||
|
.items.create(newDocument)
|
||||||
|
.then(response => response.resource)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function readDocument(collection: ViewModels.CollectionBase, documentId: DocumentId): Q.Promise<any> {
|
||||||
|
const partitionKey = documentId.partitionKeyValue;
|
||||||
|
|
||||||
|
return Q(
|
||||||
|
client()
|
||||||
|
.database(collection.databaseId)
|
||||||
|
.container(collection.id())
|
||||||
|
.item(documentId.id(), partitionKey)
|
||||||
|
.read()
|
||||||
|
.then(response => response.resource)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function deleteDocument(collection: ViewModels.CollectionBase, documentId: DocumentId): Q.Promise<any> {
|
||||||
|
const partitionKey = documentId.partitionKeyValue;
|
||||||
|
|
||||||
|
return Q(
|
||||||
|
client()
|
||||||
|
.database(collection.databaseId)
|
||||||
|
.container(collection.id())
|
||||||
|
.item(documentId.id(), partitionKey)
|
||||||
|
.delete()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function deleteConflict(
|
||||||
|
collection: ViewModels.CollectionBase,
|
||||||
|
conflictId: ConflictId,
|
||||||
|
options: any = {}
|
||||||
|
): Q.Promise<any> {
|
||||||
|
options.partitionKey = options.partitionKey || getPartitionKeyHeaderForConflict(conflictId);
|
||||||
|
|
||||||
|
return Q(
|
||||||
|
client()
|
||||||
|
.database(collection.databaseId)
|
||||||
|
.container(collection.id())
|
||||||
|
.conflict(conflictId.id())
|
||||||
|
.delete(options)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function queryConflicts(
|
||||||
|
databaseId: string,
|
||||||
|
containerId: string,
|
||||||
|
query: string,
|
||||||
|
options: any
|
||||||
|
): Q.Promise<QueryIterator<ConflictDefinition & Resource>> {
|
||||||
|
const documentsIterator = client()
|
||||||
|
.database(databaseId)
|
||||||
|
.container(containerId)
|
||||||
|
.conflicts.query(query, options);
|
||||||
|
return Q(documentsIterator);
|
||||||
|
}
|
||||||
217
src/Common/DocumentClientUtilityBase.ts
Normal file
217
src/Common/DocumentClientUtilityBase.ts
Normal file
@@ -0,0 +1,217 @@
|
|||||||
|
import { ConflictDefinition, ItemDefinition, QueryIterator, Resource } from "@azure/cosmos";
|
||||||
|
import Q from "q";
|
||||||
|
import * as ViewModels from "../Contracts/ViewModels";
|
||||||
|
import ConflictId from "../Explorer/Tree/ConflictId";
|
||||||
|
import DocumentId from "../Explorer/Tree/DocumentId";
|
||||||
|
import StoredProcedure from "../Explorer/Tree/StoredProcedure";
|
||||||
|
import { logConsoleInfo, logConsoleProgress } from "../Utils/NotificationConsoleUtils";
|
||||||
|
import * as Constants from "./Constants";
|
||||||
|
import * as DataAccessUtilityBase from "./DataAccessUtilityBase";
|
||||||
|
import { MinimalQueryIterator, nextPage } from "./IteratorUtilities";
|
||||||
|
import { handleError } from "./ErrorHandlingUtils";
|
||||||
|
|
||||||
|
// TODO: Log all promise resolutions and errors with verbosity levels
|
||||||
|
export function queryDocuments(
|
||||||
|
databaseId: string,
|
||||||
|
containerId: string,
|
||||||
|
query: string,
|
||||||
|
options: any
|
||||||
|
): Q.Promise<QueryIterator<ItemDefinition & Resource>> {
|
||||||
|
return DataAccessUtilityBase.queryDocuments(databaseId, containerId, query, options);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function queryConflicts(
|
||||||
|
databaseId: string,
|
||||||
|
containerId: string,
|
||||||
|
query: string,
|
||||||
|
options: any
|
||||||
|
): Q.Promise<QueryIterator<ConflictDefinition & Resource>> {
|
||||||
|
return DataAccessUtilityBase.queryConflicts(databaseId, containerId, query, options);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getEntityName() {
|
||||||
|
const defaultExperience =
|
||||||
|
window.dataExplorer && window.dataExplorer.defaultExperience && window.dataExplorer.defaultExperience();
|
||||||
|
if (defaultExperience === Constants.DefaultAccountExperience.MongoDB) {
|
||||||
|
return "document";
|
||||||
|
}
|
||||||
|
return "item";
|
||||||
|
}
|
||||||
|
|
||||||
|
export function executeStoredProcedure(
|
||||||
|
collection: ViewModels.Collection,
|
||||||
|
storedProcedure: StoredProcedure,
|
||||||
|
partitionKeyValue: any,
|
||||||
|
params: any[]
|
||||||
|
): Q.Promise<any> {
|
||||||
|
var deferred = Q.defer<any>();
|
||||||
|
|
||||||
|
const clearMessage = logConsoleProgress(`Executing stored procedure ${storedProcedure.id()}`);
|
||||||
|
DataAccessUtilityBase.executeStoredProcedure(collection, storedProcedure, partitionKeyValue, params)
|
||||||
|
.then(
|
||||||
|
(response: any) => {
|
||||||
|
deferred.resolve(response);
|
||||||
|
logConsoleInfo(
|
||||||
|
`Finished executing stored procedure ${storedProcedure.id()} for container ${storedProcedure.collection.id()}`
|
||||||
|
);
|
||||||
|
},
|
||||||
|
(error: any) => {
|
||||||
|
handleError(
|
||||||
|
error,
|
||||||
|
"ExecuteStoredProcedure",
|
||||||
|
`Failed to execute stored procedure ${storedProcedure.id()} for container ${storedProcedure.collection.id()}`
|
||||||
|
);
|
||||||
|
deferred.reject(error);
|
||||||
|
}
|
||||||
|
)
|
||||||
|
.finally(() => {
|
||||||
|
clearMessage();
|
||||||
|
});
|
||||||
|
|
||||||
|
return deferred.promise;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function queryDocumentsPage(
|
||||||
|
resourceName: string,
|
||||||
|
documentsIterator: MinimalQueryIterator,
|
||||||
|
firstItemIndex: number,
|
||||||
|
options: any
|
||||||
|
): Q.Promise<ViewModels.QueryResults> {
|
||||||
|
var deferred = Q.defer<ViewModels.QueryResults>();
|
||||||
|
const entityName = getEntityName();
|
||||||
|
const clearMessage = logConsoleProgress(`Querying ${entityName} for container ${resourceName}`);
|
||||||
|
Q(nextPage(documentsIterator, firstItemIndex))
|
||||||
|
.then(
|
||||||
|
(result: ViewModels.QueryResults) => {
|
||||||
|
const itemCount = (result.documents && result.documents.length) || 0;
|
||||||
|
logConsoleInfo(`Successfully fetched ${itemCount} ${entityName} for container ${resourceName}`);
|
||||||
|
deferred.resolve(result);
|
||||||
|
},
|
||||||
|
(error: any) => {
|
||||||
|
handleError(error, "QueryDocumentsPage", `Failed to query ${entityName} for container ${resourceName}`);
|
||||||
|
deferred.reject(error);
|
||||||
|
}
|
||||||
|
)
|
||||||
|
.finally(() => {
|
||||||
|
clearMessage();
|
||||||
|
});
|
||||||
|
|
||||||
|
return deferred.promise;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function readDocument(collection: ViewModels.CollectionBase, documentId: DocumentId): Q.Promise<any> {
|
||||||
|
var deferred = Q.defer<any>();
|
||||||
|
const entityName = getEntityName();
|
||||||
|
const clearMessage = logConsoleProgress(`Reading ${entityName} ${documentId.id()}`);
|
||||||
|
DataAccessUtilityBase.readDocument(collection, documentId)
|
||||||
|
.then(
|
||||||
|
(document: any) => {
|
||||||
|
deferred.resolve(document);
|
||||||
|
},
|
||||||
|
(error: any) => {
|
||||||
|
handleError(error, "ReadDocument", `Failed to read ${entityName} ${documentId.id()}`);
|
||||||
|
deferred.reject(error);
|
||||||
|
}
|
||||||
|
)
|
||||||
|
.finally(() => {
|
||||||
|
clearMessage();
|
||||||
|
});
|
||||||
|
|
||||||
|
return deferred.promise;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function updateDocument(
|
||||||
|
collection: ViewModels.CollectionBase,
|
||||||
|
documentId: DocumentId,
|
||||||
|
newDocument: any
|
||||||
|
): Q.Promise<any> {
|
||||||
|
var deferred = Q.defer<any>();
|
||||||
|
const entityName = getEntityName();
|
||||||
|
const clearMessage = logConsoleProgress(`Updating ${entityName} ${documentId.id()}`);
|
||||||
|
DataAccessUtilityBase.updateDocument(collection, documentId, newDocument)
|
||||||
|
.then(
|
||||||
|
(updatedDocument: any) => {
|
||||||
|
logConsoleInfo(`Successfully updated ${entityName} ${documentId.id()}`);
|
||||||
|
deferred.resolve(updatedDocument);
|
||||||
|
},
|
||||||
|
(error: any) => {
|
||||||
|
handleError(error, "UpdateDocument", `Failed to update ${entityName} ${documentId.id()}`);
|
||||||
|
deferred.reject(error);
|
||||||
|
}
|
||||||
|
)
|
||||||
|
.finally(() => {
|
||||||
|
clearMessage();
|
||||||
|
});
|
||||||
|
|
||||||
|
return deferred.promise;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function createDocument(collection: ViewModels.CollectionBase, newDocument: any): Q.Promise<any> {
|
||||||
|
var deferred = Q.defer<any>();
|
||||||
|
const entityName = getEntityName();
|
||||||
|
const clearMessage = logConsoleProgress(`Creating new ${entityName} for container ${collection.id()}`);
|
||||||
|
DataAccessUtilityBase.createDocument(collection, newDocument)
|
||||||
|
.then(
|
||||||
|
(savedDocument: any) => {
|
||||||
|
logConsoleInfo(`Successfully created new ${entityName} for container ${collection.id()}`);
|
||||||
|
deferred.resolve(savedDocument);
|
||||||
|
},
|
||||||
|
(error: any) => {
|
||||||
|
handleError(error, "CreateDocument", `Error while creating new ${entityName} for container ${collection.id()}`);
|
||||||
|
deferred.reject(error);
|
||||||
|
}
|
||||||
|
)
|
||||||
|
.finally(() => {
|
||||||
|
clearMessage();
|
||||||
|
});
|
||||||
|
|
||||||
|
return deferred.promise;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function deleteDocument(collection: ViewModels.CollectionBase, documentId: DocumentId): Q.Promise<any> {
|
||||||
|
var deferred = Q.defer<any>();
|
||||||
|
const entityName = getEntityName();
|
||||||
|
const clearMessage = logConsoleProgress(`Deleting ${entityName} ${documentId.id()}`);
|
||||||
|
DataAccessUtilityBase.deleteDocument(collection, documentId)
|
||||||
|
.then(
|
||||||
|
(response: any) => {
|
||||||
|
logConsoleInfo(`Successfully deleted ${entityName} ${documentId.id()}`);
|
||||||
|
deferred.resolve(response);
|
||||||
|
},
|
||||||
|
(error: any) => {
|
||||||
|
handleError(error, "DeleteDocument", `Error while deleting ${entityName} ${documentId.id()}`);
|
||||||
|
deferred.reject(error);
|
||||||
|
}
|
||||||
|
)
|
||||||
|
.finally(() => {
|
||||||
|
clearMessage();
|
||||||
|
});
|
||||||
|
|
||||||
|
return deferred.promise;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function deleteConflict(
|
||||||
|
collection: ViewModels.CollectionBase,
|
||||||
|
conflictId: ConflictId,
|
||||||
|
options?: any
|
||||||
|
): Q.Promise<any> {
|
||||||
|
var deferred = Q.defer<any>();
|
||||||
|
|
||||||
|
const clearMessage = logConsoleProgress(`Deleting conflict ${conflictId.id()}`);
|
||||||
|
DataAccessUtilityBase.deleteConflict(collection, conflictId, options)
|
||||||
|
.then(
|
||||||
|
(response: any) => {
|
||||||
|
logConsoleInfo(`Successfully deleted conflict ${conflictId.id()}`);
|
||||||
|
deferred.resolve(response);
|
||||||
|
},
|
||||||
|
(error: any) => {
|
||||||
|
handleError(error, "DeleteConflict", `Error while deleting conflict ${conflictId.id()}`);
|
||||||
|
deferred.reject(error);
|
||||||
|
}
|
||||||
|
)
|
||||||
|
.finally(() => {
|
||||||
|
clearMessage();
|
||||||
|
});
|
||||||
|
|
||||||
|
return deferred.promise;
|
||||||
|
}
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
import { DefaultAccountExperienceType } from "../DefaultAccountExperienceType";
|
|
||||||
import { userContext } from "../UserContext";
|
|
||||||
|
|
||||||
export const getEntityName = (): string => {
|
|
||||||
if (userContext.defaultExperience === DefaultAccountExperienceType.MongoDB) {
|
|
||||||
return "document";
|
|
||||||
}
|
|
||||||
|
|
||||||
return "item";
|
|
||||||
};
|
|
||||||
@@ -1,94 +1,94 @@
|
|||||||
import * as ko from "knockout";
|
import * as ko from "knockout";
|
||||||
import * as ViewModels from "../Contracts/ViewModels";
|
import * as ViewModels from "../Contracts/ViewModels";
|
||||||
|
|
||||||
export default class EditableUtility {
|
export default class EditableUtility {
|
||||||
public static observable<T>(initialValue?: T): ViewModels.Editable<T> {
|
public static observable<T>(initialValue?: T): ViewModels.Editable<T> {
|
||||||
var observable: ViewModels.Editable<T> = <ViewModels.Editable<T>>ko.observable<T>(initialValue);
|
var observable: ViewModels.Editable<T> = <ViewModels.Editable<T>>ko.observable<T>(initialValue);
|
||||||
|
|
||||||
observable.edits = ko.observableArray<T>([initialValue]);
|
observable.edits = ko.observableArray<T>([initialValue]);
|
||||||
observable.validations = ko.observableArray<(value: T) => boolean>([]);
|
observable.validations = ko.observableArray<(value: T) => boolean>([]);
|
||||||
|
|
||||||
observable.setBaseline = (baseline: T) => {
|
observable.setBaseline = (baseline: T) => {
|
||||||
observable(baseline);
|
observable(baseline);
|
||||||
observable.edits([baseline]);
|
observable.edits([baseline]);
|
||||||
};
|
};
|
||||||
|
|
||||||
observable.getEditableCurrentValue = ko.computed<T>(() => {
|
observable.getEditableCurrentValue = ko.computed<T>(() => {
|
||||||
const edits = (observable.edits && observable.edits()) || [];
|
const edits = (observable.edits && observable.edits()) || [];
|
||||||
if (edits.length === 0) {
|
if (edits.length === 0) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
return edits[edits.length - 1];
|
return edits[edits.length - 1];
|
||||||
});
|
});
|
||||||
|
|
||||||
observable.getEditableOriginalValue = ko.computed<T>(() => {
|
observable.getEditableOriginalValue = ko.computed<T>(() => {
|
||||||
const edits = (observable.edits && observable.edits()) || [];
|
const edits = (observable.edits && observable.edits()) || [];
|
||||||
if (edits.length === 0) {
|
if (edits.length === 0) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
return edits[0];
|
return edits[0];
|
||||||
});
|
});
|
||||||
|
|
||||||
observable.editableIsDirty = ko.computed<boolean>(() => {
|
observable.editableIsDirty = ko.computed<boolean>(() => {
|
||||||
const edits = (observable.edits && observable.edits()) || [];
|
const edits = (observable.edits && observable.edits()) || [];
|
||||||
if (edits.length <= 1) {
|
if (edits.length <= 1) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
let current: any = observable.getEditableCurrentValue();
|
let current: any = observable.getEditableCurrentValue();
|
||||||
let original: any = observable.getEditableOriginalValue();
|
let original: any = observable.getEditableOriginalValue();
|
||||||
|
|
||||||
switch (typeof current) {
|
switch (typeof current) {
|
||||||
case "string":
|
case "string":
|
||||||
case "undefined":
|
case "undefined":
|
||||||
case "number":
|
case "number":
|
||||||
case "boolean":
|
case "boolean":
|
||||||
current = current && current.toString();
|
current = current && current.toString();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
current = JSON.stringify(current);
|
current = JSON.stringify(current);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (typeof original) {
|
switch (typeof original) {
|
||||||
case "string":
|
case "string":
|
||||||
case "undefined":
|
case "undefined":
|
||||||
case "number":
|
case "number":
|
||||||
case "boolean":
|
case "boolean":
|
||||||
original = original && original.toString();
|
original = original && original.toString();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
original = JSON.stringify(original);
|
original = JSON.stringify(original);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (current !== original) {
|
if (current !== original) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
observable.subscribe((edit) => {
|
observable.subscribe(edit => {
|
||||||
var edits = observable.edits && observable.edits();
|
var edits = observable.edits && observable.edits();
|
||||||
if (!edits) {
|
if (!edits) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
edits.push(edit);
|
edits.push(edit);
|
||||||
observable.edits(edits);
|
observable.edits(edits);
|
||||||
});
|
});
|
||||||
|
|
||||||
observable.editableIsValid = ko.observable<boolean>(true);
|
observable.editableIsValid = ko.observable<boolean>(true);
|
||||||
observable.subscribe((value) => {
|
observable.subscribe(value => {
|
||||||
const validations: ((value: T) => boolean)[] = (observable.validations && observable.validations()) || [];
|
const validations: ((value: T) => boolean)[] = (observable.validations && observable.validations()) || [];
|
||||||
const isValid = validations.every((validate) => validate(value));
|
const isValid = validations.every(validate => validate(value));
|
||||||
observable.editableIsValid(isValid);
|
observable.editableIsValid(isValid);
|
||||||
});
|
});
|
||||||
|
|
||||||
return observable;
|
return observable;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,61 +0,0 @@
|
|||||||
import { DatePicker, TextField } from "office-ui-fabric-react";
|
|
||||||
import React, { FunctionComponent } from "react";
|
|
||||||
|
|
||||||
export interface TableEntityProps {
|
|
||||||
entityValueLabel?: string;
|
|
||||||
entityValuePlaceholder: string;
|
|
||||||
entityValue: string | Date;
|
|
||||||
isEntityTypeDate: boolean;
|
|
||||||
entityTimeValue: string;
|
|
||||||
entityValueType: string;
|
|
||||||
onEntityValueChange: (event: React.FormEvent<HTMLElement>, newInput?: string) => void;
|
|
||||||
onSelectDate: (date: Date | null | undefined) => void;
|
|
||||||
onEntityTimeValueChange: (event: React.FormEvent<HTMLElement>, newInput?: string) => void;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const EntityValue: FunctionComponent<TableEntityProps> = ({
|
|
||||||
entityValueLabel,
|
|
||||||
entityValuePlaceholder,
|
|
||||||
entityValue,
|
|
||||||
isEntityTypeDate,
|
|
||||||
entityTimeValue,
|
|
||||||
entityValueType,
|
|
||||||
onEntityValueChange,
|
|
||||||
onSelectDate,
|
|
||||||
onEntityTimeValueChange,
|
|
||||||
}: TableEntityProps): JSX.Element => {
|
|
||||||
if (isEntityTypeDate) {
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<DatePicker
|
|
||||||
className="addEntityDatePicker"
|
|
||||||
placeholder={entityValuePlaceholder}
|
|
||||||
value={entityValue && new Date(entityValue)}
|
|
||||||
ariaLabel={entityValuePlaceholder}
|
|
||||||
onSelectDate={onSelectDate}
|
|
||||||
/>
|
|
||||||
<TextField
|
|
||||||
label={entityValueLabel && entityValueLabel}
|
|
||||||
id="entityTimeId"
|
|
||||||
autoFocus
|
|
||||||
type="time"
|
|
||||||
value={entityTimeValue}
|
|
||||||
onChange={onEntityTimeValueChange}
|
|
||||||
/>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<TextField
|
|
||||||
label={entityValueLabel && entityValueLabel}
|
|
||||||
className="addEntityTextField"
|
|
||||||
id="entityValueId"
|
|
||||||
autoFocus
|
|
||||||
type={entityValueType}
|
|
||||||
placeholder={entityValuePlaceholder}
|
|
||||||
value={typeof entityValue === "string" && entityValue}
|
|
||||||
onChange={onEntityValueChange}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
export function normalizeArmEndpoint(uri: string): string {
|
export default class EnvironmentUtility {
|
||||||
if (uri && uri.slice(-1) !== "/") {
|
public static normalizeArmEndpointUri(uri: string): string {
|
||||||
return `${uri}/`;
|
if (uri && uri.slice(-1) !== "/") {
|
||||||
}
|
return `${uri}/`;
|
||||||
return uri;
|
}
|
||||||
}
|
return uri;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
import { MessageTypes } from "../Contracts/ExplorerContracts";
|
|
||||||
import { SubscriptionType } from "../Contracts/SubscriptionType";
|
|
||||||
import { userContext } from "../UserContext";
|
|
||||||
import { ARMError } from "../Utils/arm/request";
|
import { ARMError } from "../Utils/arm/request";
|
||||||
import { logConsoleError } from "../Utils/NotificationConsoleUtils";
|
|
||||||
import { HttpStatusCodes } from "./Constants";
|
import { HttpStatusCodes } from "./Constants";
|
||||||
|
import { MessageTypes } from "../Contracts/ExplorerContracts";
|
||||||
|
import { SubscriptionType } from "../Contracts/ViewModels";
|
||||||
|
import { logConsoleError } from "../Utils/NotificationConsoleUtils";
|
||||||
import { logError } from "./Logger";
|
import { logError } from "./Logger";
|
||||||
import { sendMessage } from "./MessageHandler";
|
import { sendMessage } from "./MessageHandler";
|
||||||
|
|
||||||
@@ -22,7 +21,7 @@ export const handleError = (error: string | ARMError | Error, area: string, cons
|
|||||||
sendNotificationForError(errorMessage, errorCode);
|
sendNotificationForError(errorMessage, errorCode);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getErrorMessage = (error: string | Error = ""): string => {
|
export const getErrorMessage = (error: string | Error): string => {
|
||||||
const errorMessage = typeof error === "string" ? error : error.message;
|
const errorMessage = typeof error === "string" ? error : error.message;
|
||||||
return replaceKnownError(errorMessage);
|
return replaceKnownError(errorMessage);
|
||||||
};
|
};
|
||||||
@@ -38,18 +37,18 @@ const sendNotificationForError = (errorMessage: string, errorCode: number | stri
|
|||||||
}
|
}
|
||||||
sendMessage({
|
sendMessage({
|
||||||
type: MessageTypes.ForbiddenError,
|
type: MessageTypes.ForbiddenError,
|
||||||
reason: errorMessage,
|
reason: errorMessage
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const replaceKnownError = (errorMessage: string): string => {
|
const replaceKnownError = (errorMessage: string): string => {
|
||||||
if (
|
if (
|
||||||
userContext.subscriptionType === SubscriptionType.Internal &&
|
window.dataExplorer?.subscriptionType() === SubscriptionType.Internal &&
|
||||||
errorMessage?.indexOf("SharedOffer is Disabled for your account") >= 0
|
errorMessage.indexOf("SharedOffer is Disabled for your account") >= 0
|
||||||
) {
|
) {
|
||||||
return "Database throughput is not supported for internal subscriptions.";
|
return "Database throughput is not supported for internal subscriptions.";
|
||||||
} else if (errorMessage?.indexOf("Partition key paths must contain only valid") >= 0) {
|
} else if (errorMessage.indexOf("Partition key paths must contain only valid") >= 0) {
|
||||||
return "Partition key paths must contain only valid characters and not contain a trailing slash or wildcard character.";
|
return "Partition key paths must contain only valid characters and not contain a trailing slash or wildcard character.";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,25 +1,25 @@
|
|||||||
import * as HeadersUtility from "./HeadersUtility";
|
import * as HeadersUtility from "./HeadersUtility";
|
||||||
import { ExplorerSettings } from "../Shared/ExplorerSettings";
|
import { ExplorerSettings } from "../Shared/ExplorerSettings";
|
||||||
import { LocalStorageUtility, StorageKey } from "../Shared/StorageUtility";
|
import { LocalStorageUtility, StorageKey } from "../Shared/StorageUtility";
|
||||||
|
|
||||||
describe("Headers Utility", () => {
|
describe("Headers Utility", () => {
|
||||||
describe("shouldEnableCrossPartitionKeyForResourceWithPartitionKey()", () => {
|
describe("shouldEnableCrossPartitionKeyForResourceWithPartitionKey()", () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
ExplorerSettings.createDefaultSettings();
|
ExplorerSettings.createDefaultSettings();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should return true by default", () => {
|
it("should return true by default", () => {
|
||||||
expect(HeadersUtility.shouldEnableCrossPartitionKey()).toBe(true);
|
expect(HeadersUtility.shouldEnableCrossPartitionKey()).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should return false if the enable cross partition key feed option is false", () => {
|
it("should return false if the enable cross partition key feed option is false", () => {
|
||||||
LocalStorageUtility.setEntryString(StorageKey.IsCrossPartitionQueryEnabled, "false");
|
LocalStorageUtility.setEntryString(StorageKey.IsCrossPartitionQueryEnabled, "false");
|
||||||
expect(HeadersUtility.shouldEnableCrossPartitionKey()).toBe(false);
|
expect(HeadersUtility.shouldEnableCrossPartitionKey()).toBe(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should return true if the enable cross partition key feed option is true", () => {
|
it("should return true if the enable cross partition key feed option is true", () => {
|
||||||
LocalStorageUtility.setEntryString(StorageKey.IsCrossPartitionQueryEnabled, "true");
|
LocalStorageUtility.setEntryString(StorageKey.IsCrossPartitionQueryEnabled, "true");
|
||||||
expect(HeadersUtility.shouldEnableCrossPartitionKey()).toBe(true);
|
expect(HeadersUtility.shouldEnableCrossPartitionKey()).toBe(true);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,5 +1,28 @@
|
|||||||
import { LocalStorageUtility, StorageKey } from "../Shared/StorageUtility";
|
import * as Constants from "./Constants";
|
||||||
|
|
||||||
export function shouldEnableCrossPartitionKey(): boolean {
|
import { LocalStorageUtility, StorageKey } from "../Shared/StorageUtility";
|
||||||
return LocalStorageUtility.getEntryString(StorageKey.IsCrossPartitionQueryEnabled) === "true";
|
|
||||||
}
|
// x-ms-resource-quota: databases = 100; collections = 5000; users = 500000; permissions = 2000000;
|
||||||
|
export function getQuota(responseHeaders: any): any {
|
||||||
|
return responseHeaders && responseHeaders[Constants.HttpHeaders.resourceQuota]
|
||||||
|
? parseStringIntoObject(responseHeaders[Constants.HttpHeaders.resourceQuota])
|
||||||
|
: null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function shouldEnableCrossPartitionKey(): boolean {
|
||||||
|
return LocalStorageUtility.getEntryString(StorageKey.IsCrossPartitionQueryEnabled) === "true";
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseStringIntoObject(resourceString: string) {
|
||||||
|
var entityObject: any = {};
|
||||||
|
|
||||||
|
if (resourceString) {
|
||||||
|
var entitiesArray: string[] = resourceString.split(";");
|
||||||
|
for (var i: any = 0; i < entitiesArray.length; i++) {
|
||||||
|
var entity: string[] = entitiesArray[i].split("=");
|
||||||
|
entityObject[entity[0]] = entity[1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return entityObject;
|
||||||
|
}
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ describe("nextPage", () => {
|
|||||||
queryMetrics: {},
|
queryMetrics: {},
|
||||||
requestCharge: 1,
|
requestCharge: 1,
|
||||||
headers: {},
|
headers: {},
|
||||||
activityId: "foo",
|
activityId: "foo"
|
||||||
}),
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
expect(await nextPage(fakeIterator, 10)).toMatchSnapshot();
|
expect(await nextPage(fakeIterator, 10)).toMatchSnapshot();
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
import { QueryResults } from "../Contracts/ViewModels";
|
import { QueryResults } from "../Contracts/ViewModels";
|
||||||
|
|
||||||
interface QueryResponse {
|
interface QueryResponse {
|
||||||
// [Todo] remove any
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
||||||
resources: any[];
|
resources: any[];
|
||||||
hasMoreResults: boolean;
|
hasMoreResults: boolean;
|
||||||
activityId: string;
|
activityId: string;
|
||||||
@@ -16,9 +14,8 @@ export interface MinimalQueryIterator {
|
|||||||
// Pick<QueryIterator<any>, "fetchNext">;
|
// Pick<QueryIterator<any>, "fetchNext">;
|
||||||
|
|
||||||
export function nextPage(documentsIterator: MinimalQueryIterator, firstItemIndex: number): Promise<QueryResults> {
|
export function nextPage(documentsIterator: MinimalQueryIterator, firstItemIndex: number): Promise<QueryResults> {
|
||||||
return documentsIterator.fetchNext().then((response) => {
|
return documentsIterator.fetchNext().then(response => {
|
||||||
const documents = response.resources;
|
const documents = response.resources;
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
||||||
const headers = (response as any).headers || {}; // TODO this is a private key. Remove any
|
const headers = (response as any).headers || {}; // TODO this is a private key. Remove any
|
||||||
const itemCount = (documents && documents.length) || 0;
|
const itemCount = (documents && documents.length) || 0;
|
||||||
return {
|
return {
|
||||||
@@ -29,7 +26,7 @@ export function nextPage(documentsIterator: MinimalQueryIterator, firstItemIndex
|
|||||||
lastItemIndex: Number(firstItemIndex) + Number(itemCount),
|
lastItemIndex: Number(firstItemIndex) + Number(itemCount),
|
||||||
headers,
|
headers,
|
||||||
activityId: response.activityId,
|
activityId: response.activityId,
|
||||||
requestCharge: response.requestCharge,
|
requestCharge: response.requestCharge
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,26 +1,26 @@
|
|||||||
jest.mock("./MessageHandler");
|
jest.mock("./MessageHandler");
|
||||||
import { LogEntryLevel } from "../Contracts/Diagnostics";
|
import { LogEntryLevel } from "../Contracts/Diagnostics";
|
||||||
import * as Logger from "./Logger";
|
import * as Logger from "./Logger";
|
||||||
import { MessageTypes } from "../Contracts/ExplorerContracts";
|
import { MessageTypes } from "../Contracts/ExplorerContracts";
|
||||||
import { sendMessage } from "./MessageHandler";
|
import { sendMessage } from "./MessageHandler";
|
||||||
|
|
||||||
describe("Logger", () => {
|
describe("Logger", () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
jest.resetAllMocks();
|
jest.resetAllMocks();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should log info messages", () => {
|
it("should log info messages", () => {
|
||||||
Logger.logInfo("Test info", "DocDB");
|
Logger.logInfo("Test info", "DocDB");
|
||||||
expect(sendMessage).toBeCalled();
|
expect(sendMessage).toBeCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should log error messages", () => {
|
it("should log error messages", () => {
|
||||||
Logger.logError("Test error", "DocDB");
|
Logger.logError("Test error", "DocDB");
|
||||||
expect(sendMessage).toBeCalled();
|
expect(sendMessage).toBeCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should log warnings", () => {
|
it("should log warnings", () => {
|
||||||
Logger.logWarning("Test warning", "DocDB");
|
Logger.logWarning("Test warning", "DocDB");
|
||||||
expect(sendMessage).toBeCalled();
|
expect(sendMessage).toBeCalled();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { SeverityLevel } from "@microsoft/applicationinsights-web";
|
|
||||||
import { Diagnostics, MessageTypes } from "../Contracts/ExplorerContracts";
|
|
||||||
import { trackTrace } from "../Shared/appInsights";
|
|
||||||
import { sendMessage } from "./MessageHandler";
|
import { sendMessage } from "./MessageHandler";
|
||||||
|
import { Diagnostics, MessageTypes } from "../Contracts/ExplorerContracts";
|
||||||
|
import { appInsights } from "../Shared/appInsights";
|
||||||
|
import { SeverityLevel } from "@microsoft/applicationinsights-web";
|
||||||
|
|
||||||
// TODO: Move to a separate Diagnostics folder
|
// TODO: Move to a separate Diagnostics folder
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
@@ -29,7 +29,7 @@ export function logError(errorMessage: string, area: string, code?: number | str
|
|||||||
function _logEntry(entry: Diagnostics.LogEntry): void {
|
function _logEntry(entry: Diagnostics.LogEntry): void {
|
||||||
sendMessage({
|
sendMessage({
|
||||||
type: MessageTypes.LogInfo,
|
type: MessageTypes.LogInfo,
|
||||||
data: JSON.stringify(entry),
|
data: JSON.stringify(entry)
|
||||||
});
|
});
|
||||||
|
|
||||||
const severityLevel = ((level: Diagnostics.LogEntryLevel): SeverityLevel => {
|
const severityLevel = ((level: Diagnostics.LogEntryLevel): SeverityLevel => {
|
||||||
@@ -46,7 +46,7 @@ function _logEntry(entry: Diagnostics.LogEntry): void {
|
|||||||
return SeverityLevel.Information;
|
return SeverityLevel.Information;
|
||||||
}
|
}
|
||||||
})(entry.level);
|
})(entry.level);
|
||||||
trackTrace({ message: entry.message, severityLevel }, { area: entry.area });
|
appInsights.trackTrace({ message: entry.message, severityLevel }, { area: entry.area });
|
||||||
}
|
}
|
||||||
|
|
||||||
function _generateLogEntry(
|
function _generateLogEntry(
|
||||||
@@ -60,6 +60,6 @@ function _generateLogEntry(
|
|||||||
level,
|
level,
|
||||||
message,
|
message,
|
||||||
area,
|
area,
|
||||||
code,
|
code
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,28 +1,28 @@
|
|||||||
import Q from "q";
|
import Q from "q";
|
||||||
import * as MessageHandler from "./MessageHandler";
|
import * as MessageHandler from "./MessageHandler";
|
||||||
|
|
||||||
describe("Message Handler", () => {
|
describe("Message Handler", () => {
|
||||||
it("should handle cached message", async () => {
|
it("should handle cached message", async () => {
|
||||||
let mockPromise = {
|
let mockPromise = {
|
||||||
id: "123",
|
id: "123",
|
||||||
startTime: new Date(),
|
startTime: new Date(),
|
||||||
deferred: Q.defer<any>(),
|
deferred: Q.defer<any>()
|
||||||
};
|
};
|
||||||
let mockMessage = { message: { id: "123", data: "{}" } };
|
let mockMessage = { message: { id: "123", data: "{}" } };
|
||||||
MessageHandler.RequestMap[mockPromise.id] = mockPromise;
|
MessageHandler.RequestMap[mockPromise.id] = mockPromise;
|
||||||
MessageHandler.handleCachedDataMessage(mockMessage);
|
MessageHandler.handleCachedDataMessage(mockMessage);
|
||||||
expect(mockPromise.deferred.promise.isFulfilled()).toBe(true);
|
expect(mockPromise.deferred.promise.isFulfilled()).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should delete fulfilled promises on running the garbage collector", async () => {
|
it("should delete fulfilled promises on running the garbage collector", async () => {
|
||||||
let message = {
|
let message = {
|
||||||
id: "123",
|
id: "123",
|
||||||
startTime: new Date(),
|
startTime: new Date(),
|
||||||
deferred: Q.defer<any>(),
|
deferred: Q.defer<any>()
|
||||||
};
|
};
|
||||||
|
|
||||||
MessageHandler.handleCachedDataMessage(message);
|
MessageHandler.handleCachedDataMessage(message);
|
||||||
MessageHandler.runGarbageCollector();
|
MessageHandler.runGarbageCollector();
|
||||||
expect(MessageHandler.RequestMap["123"]).toBeUndefined();
|
expect(MessageHandler.RequestMap["123"]).toBeUndefined();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
|
import { MessageTypes } from "../Contracts/ExplorerContracts";
|
||||||
import Q from "q";
|
import Q from "q";
|
||||||
import * as _ from "underscore";
|
import * as _ from "underscore";
|
||||||
import { MessageTypes } from "../Contracts/ExplorerContracts";
|
|
||||||
import { getDataExplorerWindow } from "../Utils/WindowUtils";
|
|
||||||
import * as Constants from "./Constants";
|
import * as Constants from "./Constants";
|
||||||
|
import { getDataExplorerWindow } from "../Utils/WindowUtils";
|
||||||
|
|
||||||
export interface CachedDataPromise<T> {
|
export interface CachedDataPromise<T> {
|
||||||
deferred: Q.Deferred<T>;
|
deferred: Q.Deferred<T>;
|
||||||
@@ -35,7 +35,7 @@ export function sendCachedDataMessage<TResponseDataModel>(
|
|||||||
let cachedDataPromise: CachedDataPromise<TResponseDataModel> = {
|
let cachedDataPromise: CachedDataPromise<TResponseDataModel> = {
|
||||||
deferred: Q.defer<TResponseDataModel>(),
|
deferred: Q.defer<TResponseDataModel>(),
|
||||||
startTime: new Date(),
|
startTime: new Date(),
|
||||||
id: _.uniqueId(),
|
id: _.uniqueId()
|
||||||
};
|
};
|
||||||
RequestMap[cachedDataPromise.id] = cachedDataPromise;
|
RequestMap[cachedDataPromise.id] = cachedDataPromise;
|
||||||
sendMessage({ type: messageType, params: params, id: cachedDataPromise.id });
|
sendMessage({ type: messageType, params: params, id: cachedDataPromise.id });
|
||||||
@@ -48,18 +48,17 @@ export function sendCachedDataMessage<TResponseDataModel>(
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function sendMessage(data: any): void {
|
export function sendMessage(data: any): void {
|
||||||
_sendMessage({
|
if (canSendMessage()) {
|
||||||
signature: "pcIframe",
|
// We try to find data explorer window first, then fallback to current window
|
||||||
data: data,
|
const portalChildWindow = getDataExplorerWindow(window) || window;
|
||||||
});
|
portalChildWindow.parent.postMessage(
|
||||||
}
|
{
|
||||||
|
signature: "pcIframe",
|
||||||
export function sendReadyMessage(): void {
|
data: data
|
||||||
_sendMessage({
|
},
|
||||||
signature: "pcIframe",
|
portalChildWindow.document.referrer
|
||||||
kind: "ready",
|
);
|
||||||
data: "ready",
|
}
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function canSendMessage(): boolean {
|
export function canSendMessage(): boolean {
|
||||||
@@ -75,17 +74,3 @@ export function runGarbageCollector() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const _sendMessage = (message: any): void => {
|
|
||||||
if (canSendMessage()) {
|
|
||||||
// Portal window can receive messages from only child windows
|
|
||||||
const portalChildWindow = getDataExplorerWindow(window) || window;
|
|
||||||
if (portalChildWindow === window) {
|
|
||||||
// Current window is a child of portal, send message to portal window
|
|
||||||
portalChildWindow.parent.postMessage(message, portalChildWindow.document.referrer || "*");
|
|
||||||
} else {
|
|
||||||
// Current window is not a child of portal, send message to the child window instead (which is data explorer)
|
|
||||||
portalChildWindow.postMessage(message, portalChildWindow.location.origin || "*");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ const fetchMock = () => {
|
|||||||
ok: true,
|
ok: true,
|
||||||
text: () => "{}",
|
text: () => "{}",
|
||||||
json: () => "{}",
|
json: () => "{}",
|
||||||
headers: new Map(),
|
headers: new Map()
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -27,8 +27,8 @@ const collection = {
|
|||||||
partitionKey: {
|
partitionKey: {
|
||||||
paths: ["/pk"],
|
paths: ["/pk"],
|
||||||
kind: "Hash",
|
kind: "Hash",
|
||||||
version: 1,
|
version: 1
|
||||||
},
|
}
|
||||||
} as Collection;
|
} as Collection;
|
||||||
|
|
||||||
const documentId = ({
|
const documentId = ({
|
||||||
@@ -38,8 +38,8 @@ const documentId = ({
|
|||||||
partitionKey: {
|
partitionKey: {
|
||||||
paths: ["/pk"],
|
paths: ["/pk"],
|
||||||
kind: "Hash",
|
kind: "Hash",
|
||||||
version: 1,
|
version: 1
|
||||||
},
|
}
|
||||||
} as unknown) as DocumentId;
|
} as unknown) as DocumentId;
|
||||||
|
|
||||||
const databaseAccount = {
|
const databaseAccount = {
|
||||||
@@ -52,8 +52,8 @@ const databaseAccount = {
|
|||||||
documentEndpoint: "bar",
|
documentEndpoint: "bar",
|
||||||
gremlinEndpoint: "foo",
|
gremlinEndpoint: "foo",
|
||||||
tableEndpoint: "foo",
|
tableEndpoint: "foo",
|
||||||
cassandraEndpoint: "foo",
|
cassandraEndpoint: "foo"
|
||||||
},
|
}
|
||||||
} as DatabaseAccount;
|
} as DatabaseAccount;
|
||||||
|
|
||||||
describe("MongoProxyClient", () => {
|
describe("MongoProxyClient", () => {
|
||||||
@@ -61,10 +61,10 @@ describe("MongoProxyClient", () => {
|
|||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
resetConfigContext();
|
resetConfigContext();
|
||||||
updateUserContext({
|
updateUserContext({
|
||||||
databaseAccount,
|
databaseAccount
|
||||||
});
|
});
|
||||||
updateConfigContext({
|
updateConfigContext({
|
||||||
BACKEND_ENDPOINT: "https://main.documentdb.ext.azure.com",
|
BACKEND_ENDPOINT: "https://main.documentdb.ext.azure.com"
|
||||||
});
|
});
|
||||||
window.fetch = jest.fn().mockImplementation(fetchMock);
|
window.fetch = jest.fn().mockImplementation(fetchMock);
|
||||||
});
|
});
|
||||||
@@ -93,10 +93,10 @@ describe("MongoProxyClient", () => {
|
|||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
resetConfigContext();
|
resetConfigContext();
|
||||||
updateUserContext({
|
updateUserContext({
|
||||||
databaseAccount,
|
databaseAccount
|
||||||
});
|
});
|
||||||
updateConfigContext({
|
updateConfigContext({
|
||||||
BACKEND_ENDPOINT: "https://main.documentdb.ext.azure.com",
|
BACKEND_ENDPOINT: "https://main.documentdb.ext.azure.com"
|
||||||
});
|
});
|
||||||
window.fetch = jest.fn().mockImplementation(fetchMock);
|
window.fetch = jest.fn().mockImplementation(fetchMock);
|
||||||
});
|
});
|
||||||
@@ -125,10 +125,10 @@ describe("MongoProxyClient", () => {
|
|||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
resetConfigContext();
|
resetConfigContext();
|
||||||
updateUserContext({
|
updateUserContext({
|
||||||
databaseAccount,
|
databaseAccount
|
||||||
});
|
});
|
||||||
updateConfigContext({
|
updateConfigContext({
|
||||||
BACKEND_ENDPOINT: "https://main.documentdb.ext.azure.com",
|
BACKEND_ENDPOINT: "https://main.documentdb.ext.azure.com"
|
||||||
});
|
});
|
||||||
window.fetch = jest.fn().mockImplementation(fetchMock);
|
window.fetch = jest.fn().mockImplementation(fetchMock);
|
||||||
});
|
});
|
||||||
@@ -157,10 +157,10 @@ describe("MongoProxyClient", () => {
|
|||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
resetConfigContext();
|
resetConfigContext();
|
||||||
updateUserContext({
|
updateUserContext({
|
||||||
databaseAccount,
|
databaseAccount
|
||||||
});
|
});
|
||||||
updateConfigContext({
|
updateConfigContext({
|
||||||
BACKEND_ENDPOINT: "https://main.documentdb.ext.azure.com",
|
BACKEND_ENDPOINT: "https://main.documentdb.ext.azure.com"
|
||||||
});
|
});
|
||||||
window.fetch = jest.fn().mockImplementation(fetchMock);
|
window.fetch = jest.fn().mockImplementation(fetchMock);
|
||||||
});
|
});
|
||||||
@@ -189,10 +189,10 @@ describe("MongoProxyClient", () => {
|
|||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
resetConfigContext();
|
resetConfigContext();
|
||||||
updateUserContext({
|
updateUserContext({
|
||||||
databaseAccount,
|
databaseAccount
|
||||||
});
|
});
|
||||||
updateConfigContext({
|
updateConfigContext({
|
||||||
BACKEND_ENDPOINT: "https://main.documentdb.ext.azure.com",
|
BACKEND_ENDPOINT: "https://main.documentdb.ext.azure.com"
|
||||||
});
|
});
|
||||||
window.fetch = jest.fn().mockImplementation(fetchMock);
|
window.fetch = jest.fn().mockImplementation(fetchMock);
|
||||||
});
|
});
|
||||||
@@ -220,11 +220,12 @@ describe("MongoProxyClient", () => {
|
|||||||
describe("getEndpoint", () => {
|
describe("getEndpoint", () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
resetConfigContext();
|
resetConfigContext();
|
||||||
|
delete window.authType;
|
||||||
updateUserContext({
|
updateUserContext({
|
||||||
databaseAccount,
|
databaseAccount
|
||||||
});
|
});
|
||||||
updateConfigContext({
|
updateConfigContext({
|
||||||
BACKEND_ENDPOINT: "https://main.documentdb.ext.azure.com",
|
BACKEND_ENDPOINT: "https://main.documentdb.ext.azure.com"
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -240,9 +241,7 @@ describe("MongoProxyClient", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("returns a guest endpoint", () => {
|
it("returns a guest endpoint", () => {
|
||||||
updateUserContext({
|
window.authType = AuthType.EncryptedToken;
|
||||||
authType: AuthType.EncryptedToken,
|
|
||||||
});
|
|
||||||
const endpoint = getEndpoint();
|
const endpoint = getEndpoint();
|
||||||
expect(endpoint).toEqual("https://main.documentdb.ext.azure.com/api/guest/mongo/explorer");
|
expect(endpoint).toEqual("https://main.documentdb.ext.azure.com/api/guest/mongo/explorer");
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -5,21 +5,22 @@ import { configContext } from "../ConfigContext";
|
|||||||
import * as DataModels from "../Contracts/DataModels";
|
import * as DataModels from "../Contracts/DataModels";
|
||||||
import { MessageTypes } from "../Contracts/ExplorerContracts";
|
import { MessageTypes } from "../Contracts/ExplorerContracts";
|
||||||
import { Collection } from "../Contracts/ViewModels";
|
import { Collection } from "../Contracts/ViewModels";
|
||||||
|
import { ConsoleDataType } from "../Explorer/Menus/NotificationConsole/NotificationConsoleComponent";
|
||||||
import DocumentId from "../Explorer/Tree/DocumentId";
|
import DocumentId from "../Explorer/Tree/DocumentId";
|
||||||
import { userContext } from "../UserContext";
|
import * as NotificationConsoleUtils from "../Utils/NotificationConsoleUtils";
|
||||||
import { logConsoleError } from "../Utils/NotificationConsoleUtils";
|
|
||||||
import { ApiType, HttpHeaders, HttpStatusCodes } from "./Constants";
|
import { ApiType, HttpHeaders, HttpStatusCodes } from "./Constants";
|
||||||
|
import { userContext } from "../UserContext";
|
||||||
import { MinimalQueryIterator } from "./IteratorUtilities";
|
import { MinimalQueryIterator } from "./IteratorUtilities";
|
||||||
import { sendMessage } from "./MessageHandler";
|
import { sendMessage } from "./MessageHandler";
|
||||||
|
|
||||||
const defaultHeaders = {
|
const defaultHeaders = {
|
||||||
[HttpHeaders.apiType]: ApiType.MongoDB.toString(),
|
[HttpHeaders.apiType]: ApiType.MongoDB.toString(),
|
||||||
[CosmosSDKConstants.HttpHeaders.MaxEntityCount]: "100",
|
[CosmosSDKConstants.HttpHeaders.MaxEntityCount]: "100",
|
||||||
[CosmosSDKConstants.HttpHeaders.Version]: "2017-11-15",
|
[CosmosSDKConstants.HttpHeaders.Version]: "2017-11-15"
|
||||||
};
|
};
|
||||||
|
|
||||||
function authHeaders() {
|
function authHeaders() {
|
||||||
if (userContext.authType === AuthType.EncryptedToken) {
|
if (window.authType === AuthType.EncryptedToken) {
|
||||||
return { [HttpHeaders.guestAccessToken]: userContext.accessToken };
|
return { [HttpHeaders.guestAccessToken]: userContext.accessToken };
|
||||||
} else {
|
} else {
|
||||||
return { [HttpHeaders.authorization]: userContext.authorizationToken };
|
return { [HttpHeaders.authorization]: userContext.authorizationToken };
|
||||||
@@ -30,7 +31,7 @@ export function queryIterator(databaseId: string, collection: Collection, query:
|
|||||||
let continuationToken: string;
|
let continuationToken: string;
|
||||||
return {
|
return {
|
||||||
fetchNext: () => {
|
fetchNext: () => {
|
||||||
return queryDocuments(databaseId, collection, false, query).then((response) => {
|
return queryDocuments(databaseId, collection, false, query).then(response => {
|
||||||
continuationToken = response.continuationToken;
|
continuationToken = response.continuationToken;
|
||||||
const headers: { [key: string]: string | number } = {};
|
const headers: { [key: string]: string | number } = {};
|
||||||
response.headers.forEach((value, key) => {
|
response.headers.forEach((value, key) => {
|
||||||
@@ -41,10 +42,10 @@ export function queryIterator(databaseId: string, collection: Collection, query:
|
|||||||
headers,
|
headers,
|
||||||
requestCharge: Number(headers[CosmosSDKConstants.HttpHeaders.RequestCharge]),
|
requestCharge: Number(headers[CosmosSDKConstants.HttpHeaders.RequestCharge]),
|
||||||
activityId: String(headers[CosmosSDKConstants.HttpHeaders.ActivityId]),
|
activityId: String(headers[CosmosSDKConstants.HttpHeaders.ActivityId]),
|
||||||
hasMoreResults: !!continuationToken,
|
hasMoreResults: !!continuationToken
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,9 +74,7 @@ export function queryDocuments(
|
|||||||
rg: userContext.resourceGroup,
|
rg: userContext.resourceGroup,
|
||||||
dba: databaseAccount.name,
|
dba: databaseAccount.name,
|
||||||
pk:
|
pk:
|
||||||
collection && collection.partitionKey && !collection.partitionKey.systemKey
|
collection && collection.partitionKey && !collection.partitionKey.systemKey ? collection.partitionKeyProperty : ""
|
||||||
? collection.partitionKeyProperty
|
|
||||||
: "",
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const endpoint = getEndpoint() || "";
|
const endpoint = getEndpoint() || "";
|
||||||
@@ -88,7 +87,7 @@ export function queryDocuments(
|
|||||||
[CosmosSDKConstants.HttpHeaders.EnableScanInQuery]: "true",
|
[CosmosSDKConstants.HttpHeaders.EnableScanInQuery]: "true",
|
||||||
[CosmosSDKConstants.HttpHeaders.EnableCrossPartitionQuery]: "true",
|
[CosmosSDKConstants.HttpHeaders.EnableCrossPartitionQuery]: "true",
|
||||||
[CosmosSDKConstants.HttpHeaders.ParallelizeCrossPartitionQuery]: "true",
|
[CosmosSDKConstants.HttpHeaders.ParallelizeCrossPartitionQuery]: "true",
|
||||||
[HttpHeaders.contentType]: "application/query+json",
|
[HttpHeaders.contentType]: "application/query+json"
|
||||||
};
|
};
|
||||||
|
|
||||||
if (continuationToken) {
|
if (continuationToken) {
|
||||||
@@ -101,14 +100,14 @@ export function queryDocuments(
|
|||||||
.fetch(`${endpoint}${path}?${queryString.stringify(params)}`, {
|
.fetch(`${endpoint}${path}?${queryString.stringify(params)}`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: JSON.stringify({ query }),
|
body: JSON.stringify({ query }),
|
||||||
headers,
|
headers
|
||||||
})
|
})
|
||||||
.then(async (response) => {
|
.then(async response => {
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
return {
|
return {
|
||||||
continuationToken: response.headers.get(CosmosSDKConstants.HttpHeaders.Continuation),
|
continuationToken: response.headers.get(CosmosSDKConstants.HttpHeaders.Continuation),
|
||||||
documents: (await response.json()).Documents as DataModels.DocumentId[],
|
documents: (await response.json()).Documents as DataModels.DocumentId[],
|
||||||
headers: response.headers,
|
headers: response.headers
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
errorHandling(response, "querying documents", params);
|
errorHandling(response, "querying documents", params);
|
||||||
@@ -136,9 +135,7 @@ export function readDocument(
|
|||||||
rg: userContext.resourceGroup,
|
rg: userContext.resourceGroup,
|
||||||
dba: databaseAccount.name,
|
dba: databaseAccount.name,
|
||||||
pk:
|
pk:
|
||||||
documentId && documentId.partitionKey && !documentId.partitionKey.systemKey
|
documentId && documentId.partitionKey && !documentId.partitionKey.systemKey ? documentId.partitionKeyProperty : ""
|
||||||
? documentId.partitionKeyProperty
|
|
||||||
: "",
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const endpoint = getEndpoint();
|
const endpoint = getEndpoint();
|
||||||
@@ -150,10 +147,10 @@ export function readDocument(
|
|||||||
...authHeaders(),
|
...authHeaders(),
|
||||||
[CosmosSDKConstants.HttpHeaders.PartitionKey]: encodeURIComponent(
|
[CosmosSDKConstants.HttpHeaders.PartitionKey]: encodeURIComponent(
|
||||||
JSON.stringify(documentId.partitionKeyHeader())
|
JSON.stringify(documentId.partitionKeyHeader())
|
||||||
),
|
)
|
||||||
},
|
}
|
||||||
})
|
})
|
||||||
.then((response) => {
|
.then(response => {
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
return response.json();
|
return response.json();
|
||||||
}
|
}
|
||||||
@@ -178,7 +175,7 @@ export function createDocument(
|
|||||||
sid: userContext.subscriptionId,
|
sid: userContext.subscriptionId,
|
||||||
rg: userContext.resourceGroup,
|
rg: userContext.resourceGroup,
|
||||||
dba: databaseAccount.name,
|
dba: databaseAccount.name,
|
||||||
pk: collection && collection.partitionKey && !collection.partitionKey.systemKey ? partitionKeyProperty : "",
|
pk: collection && collection.partitionKey && !collection.partitionKey.systemKey ? partitionKeyProperty : ""
|
||||||
};
|
};
|
||||||
|
|
||||||
const endpoint = getEndpoint();
|
const endpoint = getEndpoint();
|
||||||
@@ -189,10 +186,10 @@ export function createDocument(
|
|||||||
body: JSON.stringify(documentContent),
|
body: JSON.stringify(documentContent),
|
||||||
headers: {
|
headers: {
|
||||||
...defaultHeaders,
|
...defaultHeaders,
|
||||||
...authHeaders(),
|
...authHeaders()
|
||||||
},
|
}
|
||||||
})
|
})
|
||||||
.then((response) => {
|
.then(response => {
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
return response.json();
|
return response.json();
|
||||||
}
|
}
|
||||||
@@ -221,9 +218,7 @@ export function updateDocument(
|
|||||||
rg: userContext.resourceGroup,
|
rg: userContext.resourceGroup,
|
||||||
dba: databaseAccount.name,
|
dba: databaseAccount.name,
|
||||||
pk:
|
pk:
|
||||||
documentId && documentId.partitionKey && !documentId.partitionKey.systemKey
|
documentId && documentId.partitionKey && !documentId.partitionKey.systemKey ? documentId.partitionKeyProperty : ""
|
||||||
? documentId.partitionKeyProperty
|
|
||||||
: "",
|
|
||||||
};
|
};
|
||||||
const endpoint = getEndpoint();
|
const endpoint = getEndpoint();
|
||||||
|
|
||||||
@@ -235,10 +230,10 @@ export function updateDocument(
|
|||||||
...defaultHeaders,
|
...defaultHeaders,
|
||||||
...authHeaders(),
|
...authHeaders(),
|
||||||
[HttpHeaders.contentType]: "application/json",
|
[HttpHeaders.contentType]: "application/json",
|
||||||
[CosmosSDKConstants.HttpHeaders.PartitionKey]: JSON.stringify(documentId.partitionKeyHeader()),
|
[CosmosSDKConstants.HttpHeaders.PartitionKey]: JSON.stringify(documentId.partitionKeyHeader())
|
||||||
},
|
}
|
||||||
})
|
})
|
||||||
.then((response) => {
|
.then(response => {
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
return response.json();
|
return response.json();
|
||||||
}
|
}
|
||||||
@@ -262,9 +257,7 @@ export function deleteDocument(databaseId: string, collection: Collection, docum
|
|||||||
rg: userContext.resourceGroup,
|
rg: userContext.resourceGroup,
|
||||||
dba: databaseAccount.name,
|
dba: databaseAccount.name,
|
||||||
pk:
|
pk:
|
||||||
documentId && documentId.partitionKey && !documentId.partitionKey.systemKey
|
documentId && documentId.partitionKey && !documentId.partitionKey.systemKey ? documentId.partitionKeyProperty : ""
|
||||||
? documentId.partitionKeyProperty
|
|
||||||
: "",
|
|
||||||
};
|
};
|
||||||
const endpoint = getEndpoint();
|
const endpoint = getEndpoint();
|
||||||
|
|
||||||
@@ -275,10 +268,10 @@ export function deleteDocument(databaseId: string, collection: Collection, docum
|
|||||||
...defaultHeaders,
|
...defaultHeaders,
|
||||||
...authHeaders(),
|
...authHeaders(),
|
||||||
[HttpHeaders.contentType]: "application/json",
|
[HttpHeaders.contentType]: "application/json",
|
||||||
[CosmosSDKConstants.HttpHeaders.PartitionKey]: JSON.stringify(documentId.partitionKeyHeader()),
|
[CosmosSDKConstants.HttpHeaders.PartitionKey]: JSON.stringify(documentId.partitionKeyHeader())
|
||||||
},
|
}
|
||||||
})
|
})
|
||||||
.then((response) => {
|
.then(response => {
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
@@ -306,7 +299,7 @@ export function createMongoCollectionWithProxy(
|
|||||||
rg: userContext.resourceGroup,
|
rg: userContext.resourceGroup,
|
||||||
dba: databaseAccount.name,
|
dba: databaseAccount.name,
|
||||||
isAutoPilot: !!params.autoPilotMaxThroughput,
|
isAutoPilot: !!params.autoPilotMaxThroughput,
|
||||||
autoPilotThroughput: params.autoPilotMaxThroughput?.toString(),
|
autoPilotThroughput: params.autoPilotMaxThroughput?.toString()
|
||||||
};
|
};
|
||||||
|
|
||||||
const endpoint = getEndpoint();
|
const endpoint = getEndpoint();
|
||||||
@@ -321,11 +314,11 @@ export function createMongoCollectionWithProxy(
|
|||||||
headers: {
|
headers: {
|
||||||
...defaultHeaders,
|
...defaultHeaders,
|
||||||
...authHeaders(),
|
...authHeaders(),
|
||||||
[HttpHeaders.contentType]: "application/json",
|
[HttpHeaders.contentType]: "application/json"
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
.then((response) => {
|
.then(response => {
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
return response.json();
|
return response.json();
|
||||||
}
|
}
|
||||||
@@ -336,7 +329,7 @@ export function createMongoCollectionWithProxy(
|
|||||||
export function getEndpoint(): string {
|
export function getEndpoint(): string {
|
||||||
let url = (configContext.MONGO_BACKEND_ENDPOINT || configContext.BACKEND_ENDPOINT) + "/api/mongo/explorer";
|
let url = (configContext.MONGO_BACKEND_ENDPOINT || configContext.BACKEND_ENDPOINT) + "/api/mongo/explorer";
|
||||||
|
|
||||||
if (userContext.authType === AuthType.EncryptedToken) {
|
if (window.authType === AuthType.EncryptedToken) {
|
||||||
url = url.replace("api/mongo", "api/guest/mongo");
|
url = url.replace("api/mongo", "api/guest/mongo");
|
||||||
}
|
}
|
||||||
return url;
|
return url;
|
||||||
@@ -347,7 +340,10 @@ export function getEndpoint(): string {
|
|||||||
async function errorHandling(response: Response, action: string, params: unknown): Promise<void> {
|
async function errorHandling(response: Response, action: string, params: unknown): Promise<void> {
|
||||||
const errorMessage = await response.text();
|
const errorMessage = await response.text();
|
||||||
// Log the error where the user can see it
|
// Log the error where the user can see it
|
||||||
logConsoleError(`Error ${action}: ${errorMessage}, Payload: ${JSON.stringify(params)}`);
|
NotificationConsoleUtils.logConsoleMessage(
|
||||||
|
ConsoleDataType.Error,
|
||||||
|
`Error ${action}: ${errorMessage}, Payload: ${JSON.stringify(params)}`
|
||||||
|
);
|
||||||
if (response.status === HttpStatusCodes.Forbidden) {
|
if (response.status === HttpStatusCodes.Forbidden) {
|
||||||
sendMessage({ type: MessageTypes.ForbiddenError, reason: errorMessage });
|
sendMessage({ type: MessageTypes.ForbiddenError, reason: errorMessage });
|
||||||
return;
|
return;
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user