mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-23 19:01:28 +00:00
Compare commits
1 Commits
tsStrict/f
...
users/srna
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
09cb9c80bd |
@@ -191,4 +191,5 @@ src/Explorer/Notebook/NotebookRenderer/decorators/kbd-shortcuts/index.tsx
|
|||||||
src/Explorer/Notebook/temp/inputs/connected-editors/codemirror.tsx
|
src/Explorer/Notebook/temp/inputs/connected-editors/codemirror.tsx
|
||||||
src/Explorer/Tree/ResourceTreeAdapter.tsx
|
src/Explorer/Tree/ResourceTreeAdapter.tsx
|
||||||
__mocks__/monaco-editor.ts
|
__mocks__/monaco-editor.ts
|
||||||
|
src/Explorer/Tree/ResourceTreeAdapterForResourceToken.test.tsx
|
||||||
src/Explorer/Tree/ResourceTree.tsx
|
src/Explorer/Tree/ResourceTree.tsx
|
||||||
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
.dataResourceTree {
|
.dataResourceTree {
|
||||||
margin-left: @MediumSpace;
|
margin-left: @MediumSpace;
|
||||||
overflow: auto;
|
|
||||||
|
|
||||||
.databaseHeader {
|
.databaseHeader {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
|
|||||||
271
less/tree.less
271
less/tree.less
@@ -1,270 +1,273 @@
|
|||||||
@import "./Common/Constants";
|
@import "./Common/Constants";
|
||||||
|
|
||||||
|
|
||||||
.resourceTree {
|
.resourceTree {
|
||||||
height: 100%;
|
|
||||||
flex: 0 0 auto;
|
|
||||||
.main {
|
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
width: 20%;
|
||||||
|
flex: 0 0 auto;
|
||||||
|
.main {
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.resourceTreeScroll {
|
.resourceTreeScroll {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
padding-right: 10px;
|
padding-right: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.userSelectNone {
|
.userSelectNone {
|
||||||
-webkit-user-select: none;
|
-webkit-user-select: none;
|
||||||
-moz-user-select: none;
|
-moz-user-select: none;
|
||||||
-ms-user-select: none;
|
-ms-user-select: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.treeHovermargin {
|
.treeHovermargin {
|
||||||
margin-left: 16px;
|
margin-left: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.highlight {
|
.highlight {
|
||||||
padding: @SmallSpace 2px;
|
padding: @SmallSpace 2px;
|
||||||
outline: 0;
|
outline: 0;
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
.hover();
|
.hover();
|
||||||
}
|
}
|
||||||
|
|
||||||
&:active {
|
&:active {
|
||||||
.active();
|
.active();
|
||||||
}
|
}
|
||||||
|
|
||||||
&:focus {
|
&:focus {
|
||||||
.focus();
|
.focus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.contextmenushowing {
|
.contextmenushowing {
|
||||||
background-color: #eee;
|
background-color: #EEE;
|
||||||
}
|
}
|
||||||
|
|
||||||
.collectionstree {
|
.collectionstree {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
margin-top: @DefaultSpace;
|
margin-top: @DefaultSpace;
|
||||||
|
|
||||||
.databaseList {
|
|
||||||
list-style-type: none;
|
|
||||||
padding-left: 0px;
|
|
||||||
|
|
||||||
.collectionList {
|
.databaseList {
|
||||||
padding-left: (2 * @MediumSpace);
|
list-style-type: none;
|
||||||
|
padding-left: 0px;
|
||||||
|
|
||||||
|
.collectionList {
|
||||||
|
padding-left:(2 * @MediumSpace);
|
||||||
|
}
|
||||||
|
|
||||||
|
.collectionChildList {
|
||||||
|
padding-left: @LargeSpace;
|
||||||
|
}
|
||||||
|
|
||||||
|
.databaseDocuments {
|
||||||
|
padding-left: (5 * @MediumSpace);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.collectionChildList {
|
|
||||||
padding-left: @LargeSpace;
|
|
||||||
}
|
|
||||||
|
|
||||||
.databaseDocuments {
|
|
||||||
padding-left: (5 * @MediumSpace);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.pointerCursor {
|
.pointerCursor {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
.menuEllipsis {
|
.menuEllipsis {
|
||||||
padding-right: 6px;
|
padding-right: 6px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
position: relative;
|
position: relative;
|
||||||
top: -5px;
|
top: -5px;
|
||||||
left: 0px;
|
left: 0px;
|
||||||
float: right;
|
float: right;
|
||||||
display: none;
|
display: none;
|
||||||
padding-left: 6px !important;
|
padding-left: 6px!important;
|
||||||
line-height: @TreeLineHeight;
|
line-height: @TreeLineHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
.databaseMenu {
|
.databaseMenu {
|
||||||
.flex-display();
|
.flex-display();
|
||||||
}
|
}
|
||||||
|
|
||||||
.databaseMenu:hover .menuEllipsis,
|
.databaseMenu:hover .menuEllipsis,
|
||||||
.databaseMenu:focus .menuEllipsis {
|
.databaseMenu:focus .menuEllipsis {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
.databaseCollChildTextOverflow {
|
.databaseCollChildTextOverflow {
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.collectionMenu {
|
.collectionMenu {
|
||||||
.flex-display();
|
.flex-display();
|
||||||
}
|
}
|
||||||
|
|
||||||
.collectionMenu:hover .menuEllipsis,
|
.collectionMenu:hover .menuEllipsis,
|
||||||
.collectionMenu:focus .menuEllipsis {
|
.collectionMenu:focus .menuEllipsis {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
.documentsMenu:hover .menuEllipsis,
|
.documentsMenu:hover .menuEllipsis,
|
||||||
.documentsMenu:focus .menuEllipsis {
|
.documentsMenu:focus .menuEllipsis {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
.treeChildMenu {
|
.treeChildMenu {
|
||||||
display: flex;
|
display: flex;
|
||||||
}
|
}
|
||||||
|
|
||||||
.storedProcedureMenu:hover .menuEllipsis,
|
.storedProcedureMenu:hover .menuEllipsis,
|
||||||
.storedProcedureMenu:focus .menuEllipsis {
|
.storedProcedureMenu:focus .menuEllipsis {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
.childMenu {
|
.childMenu {
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
padding-left: (6 * @MediumSpace);
|
padding-left: (6 * @MediumSpace);
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.storedChildMenu:hover .menuEllipsis,
|
.storedChildMenu:hover .menuEllipsis,
|
||||||
.storedChildMenu:focus .menuEllipsis {
|
.storedChildMenu:focus .menuEllipsis {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
.contextmenu6 {
|
.contextmenu6 {
|
||||||
top: -29px;
|
top: -29px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.userDefinedMenu:hover .contextmenu6 {
|
.userDefinedMenu:hover .contextmenu6 {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
.userDefinedchildMenu:hover .menuEllipsis,
|
.userDefinedchildMenu:hover .menuEllipsis,
|
||||||
.userDefinedchildMenu:focus .menuEllipsis {
|
.userDefinedchildMenu:focus .menuEllipsis {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
.triggersMenu:hover .menuEllipsis,
|
.triggersMenu:hover .menuEllipsis,
|
||||||
.triggersMenu:focus .menuEllipsis {
|
.triggersMenu:focus .menuEllipsis {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
.triggersChildMenu:hover .menuEllipsis,
|
.triggersChildMenu:hover .menuEllipsis,
|
||||||
.triggersChildMenu:focus .menuEllipsis {
|
.triggersChildMenu:focus .menuEllipsis {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
.databaseId {
|
.databaseId {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.storedUdfTriggerMenu {
|
.storedUdfTriggerMenu {
|
||||||
padding-left: 0px;
|
padding-left: 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.collectionstree img {
|
.collectionstree img {
|
||||||
width: 16px;
|
width: 16px;
|
||||||
height: 16px;
|
height: 16px;
|
||||||
vertical-align: text-top;
|
vertical-align: text-top;
|
||||||
}
|
}
|
||||||
|
|
||||||
img.collectionsTreeCollapseExpand {
|
img.collectionsTreeCollapseExpand {
|
||||||
width: 10px;
|
width: 10px;
|
||||||
height: 10px;
|
height: 10px;
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
margin-bottom: 5px;
|
margin-bottom: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.collapsed::before {
|
.collapsed::before {
|
||||||
content: "\23F5";
|
content: "\23F5";
|
||||||
margin-left: 0px;
|
margin-left: 0px;
|
||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.expanded::before {
|
.expanded::before {
|
||||||
content: "\23F7";
|
content: '\23F7';
|
||||||
margin-left: 0px;
|
margin-left: 0px;
|
||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.collectionMenuChildren {
|
.collectionMenuChildren {
|
||||||
padding-left: 42px;
|
padding-left: 42px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.main-nav {
|
.main-nav {
|
||||||
width: 100vh;
|
width: 100vh;
|
||||||
height: 40px;
|
height: 40px;
|
||||||
background: white;
|
background: white;
|
||||||
transform-origin: left top;
|
transform-origin: left top;
|
||||||
-webkit-transform-origin: left top;
|
-webkit-transform-origin: left top;
|
||||||
-ms-transform-origin: left top;
|
-ms-transform-origin: left top;
|
||||||
transform: rotate(-90deg) translateX(-100%);
|
transform: rotate(-90deg) translateX(-100%);
|
||||||
-webkit-transform: rotate(-90deg) translateX(-100%);
|
-webkit-transform: rotate(-90deg) translateX(-100%);
|
||||||
-ms-transform: rotate(-90deg) translateX(-100%);
|
-ms-transform: rotate(-90deg) translateX(-100%);
|
||||||
border-bottom: 1px solid #ccc;
|
border-bottom: 1px solid #CCC;
|
||||||
}
|
}
|
||||||
|
|
||||||
.main-nav-img {
|
.main-nav-img {
|
||||||
width: 16px;
|
width: 16px;
|
||||||
height: 16px;
|
height: 16px;
|
||||||
margin: -32px 0 0 0;
|
margin: -32px 0 0 0;
|
||||||
transform: rotate(-90deg) translateX(-100%);
|
transform: rotate(-90deg) translateX(-100%);
|
||||||
-webkit-transform: rotate(-90deg) translateX(-100%);
|
-webkit-transform: rotate(-90deg) translateX(-100%);
|
||||||
-ms-transform: rotate(-90deg) translateX(-100%);
|
-ms-transform: rotate(-90deg) translateX(-100%);
|
||||||
}
|
}
|
||||||
|
|
||||||
.main-nav-img.main-nav-sub-img {
|
.main-nav-img.main-nav-sub-img {
|
||||||
width: 16px;
|
width: 16px;
|
||||||
height: 16px;
|
height: 16px;
|
||||||
margin: 0px 0px 0 0;
|
margin: 0px 0px 0 0;
|
||||||
transform: rotate(180deg) translateX(0%);
|
transform: rotate(180deg) translateX(0%);
|
||||||
-webkit-transform: rotate(180deg) translateX(0%);
|
-webkit-transform: rotate(180deg) translateX(0%);
|
||||||
-ms-transform: rotate(180deg) translateX(0%);
|
-ms-transform: rotate(180deg) translateX(0%);
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: -8px;
|
right: -8px;
|
||||||
top: 16px;
|
top: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
ul.nav {
|
ul.nav {
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
margin-top: 0px;
|
margin-top: 0px;
|
||||||
margin-left: 0px;
|
margin-left: 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mini ul.nav li {
|
.mini ul.nav li {
|
||||||
float: right;
|
float: right;
|
||||||
line-height: 25px;
|
line-height: 25px;
|
||||||
height: auto;
|
height: auto;
|
||||||
margin-top: 3px;
|
margin-top: 3px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.spancolchildstyle {
|
.spancolchildstyle {
|
||||||
padding: 4px;
|
padding: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.contextmenubutton {
|
.contextmenubutton {
|
||||||
float: right;
|
float: right;
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.highlight:hover > .contextmenubutton {
|
.highlight:hover>.contextmenubutton {
|
||||||
display: unset;
|
display: unset;
|
||||||
}
|
}
|
||||||
|
|
||||||
.highlight:hover > .contextmenubutton::after {
|
.highlight:hover>.contextmenubutton::after {
|
||||||
content: "\2026";
|
content: "\2026";
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.showEllipsis {
|
.showEllipsis {
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
24
package-lock.json
generated
24
package-lock.json
generated
@@ -20623,9 +20623,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"playwright": {
|
"playwright": {
|
||||||
"version": "1.13.0",
|
"version": "1.10.0",
|
||||||
"resolved": "https://registry.npmjs.org/playwright/-/playwright-1.13.0.tgz",
|
"resolved": "https://registry.npmjs.org/playwright/-/playwright-1.10.0.tgz",
|
||||||
"integrity": "sha512-GA5OyEeKx1v/pRcANmYncCT67Y7Y4N5zLRU5E690dn/Id10sooR5hQZmCDYsjXlutZb/1q0R3sITALnvhEjCjg==",
|
"integrity": "sha512-b7SGBcCPq4W3pb4ImEDmNXtO0ZkJbZMuWiShsaNJd+rGfY/6fqwgllsAojmxGSgFmijYw7WxCoPiAIEDIH16Kw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"commander": "^6.1.0",
|
"commander": "^6.1.0",
|
||||||
@@ -20640,8 +20640,7 @@
|
|||||||
"proxy-from-env": "^1.1.0",
|
"proxy-from-env": "^1.1.0",
|
||||||
"rimraf": "^3.0.2",
|
"rimraf": "^3.0.2",
|
||||||
"stack-utils": "^2.0.3",
|
"stack-utils": "^2.0.3",
|
||||||
"ws": "^7.4.6",
|
"ws": "^7.3.1"
|
||||||
"yazl": "^2.5.1"
|
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"commander": {
|
"commander": {
|
||||||
@@ -20673,12 +20672,6 @@
|
|||||||
"requires": {
|
"requires": {
|
||||||
"escape-string-regexp": "^2.0.0"
|
"escape-string-regexp": "^2.0.0"
|
||||||
}
|
}
|
||||||
},
|
|
||||||
"ws": {
|
|
||||||
"version": "7.5.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/ws/-/ws-7.5.3.tgz",
|
|
||||||
"integrity": "sha512-kQ/dHIzuLrS6Je9+uv81ueZomEwH0qVYstcAQ4/Z93K8zeko9gtAbttJWzoC5ukqXY1PpoouV3+VSOqEAFt5wg==",
|
|
||||||
"dev": true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -26169,15 +26162,6 @@
|
|||||||
"fd-slicer": "~1.1.0"
|
"fd-slicer": "~1.1.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"yazl": {
|
|
||||||
"version": "2.5.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/yazl/-/yazl-2.5.1.tgz",
|
|
||||||
"integrity": "sha512-phENi2PLiHnHb6QBVot+dJnaAZ0xosj7p3fWl+znIjBDlnMI2PsZCJZ306BPTFOaHf5qdDEI8x5qFrSOBN5vrw==",
|
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
|
||||||
"buffer-crc32": "~0.2.3"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"yocto-queue": {
|
"yocto-queue": {
|
||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz",
|
||||||
|
|||||||
@@ -164,7 +164,7 @@
|
|||||||
"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.13.0",
|
"playwright": "1.10.0",
|
||||||
"prettier": "2.2.1",
|
"prettier": "2.2.1",
|
||||||
"raw-loader": "0.5.1",
|
"raw-loader": "0.5.1",
|
||||||
"react-dev-utils": "11.0.4",
|
"react-dev-utils": "11.0.4",
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ import arrowLeftImg from "../../images/imgarrowlefticon.svg";
|
|||||||
import refreshImg from "../../images/refresh-cosmos.svg";
|
import refreshImg from "../../images/refresh-cosmos.svg";
|
||||||
import { AuthType } from "../AuthType";
|
import { AuthType } from "../AuthType";
|
||||||
import Explorer from "../Explorer/Explorer";
|
import Explorer from "../Explorer/Explorer";
|
||||||
import { ResourceTokenTree } from "../Explorer/Tree/ResourceTokenTree";
|
|
||||||
import { ResourceTree } from "../Explorer/Tree/ResourceTree";
|
import { ResourceTree } from "../Explorer/Tree/ResourceTree";
|
||||||
import { userContext } from "../UserContext";
|
import { userContext } from "../UserContext";
|
||||||
|
|
||||||
@@ -53,7 +52,7 @@ export const ResourceTreeContainer: FunctionComponent<ResourceTreeContainerProps
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{userContext.authType === AuthType.ResourceToken ? (
|
{userContext.authType === AuthType.ResourceToken ? (
|
||||||
<ResourceTokenTree />
|
<div style={{ overflowY: "auto" }} data-bind="react:resourceTreeForResourceToken" />
|
||||||
) : userContext.features.enableKOResourceTree ? (
|
) : userContext.features.enableKOResourceTree ? (
|
||||||
<div style={{ overflowY: "auto" }} data-bind="react:resourceTree" />
|
<div style={{ overflowY: "auto" }} data-bind="react:resourceTree" />
|
||||||
) : (
|
) : (
|
||||||
|
|||||||
@@ -1,10 +1,7 @@
|
|||||||
jest.mock("../../Utils/arm/request");
|
jest.mock("../../Utils/arm/request");
|
||||||
jest.mock("../CosmosClient");
|
jest.mock("../CosmosClient");
|
||||||
import ko from "knockout";
|
|
||||||
import { AuthType } from "../../AuthType";
|
import { AuthType } from "../../AuthType";
|
||||||
import { CreateCollectionParams, DatabaseAccount } from "../../Contracts/DataModels";
|
import { CreateCollectionParams, DatabaseAccount } from "../../Contracts/DataModels";
|
||||||
import { Database } from "../../Contracts/ViewModels";
|
|
||||||
import { useDatabases } from "../../Explorer/useDatabases";
|
|
||||||
import { updateUserContext } from "../../UserContext";
|
import { updateUserContext } from "../../UserContext";
|
||||||
import { armRequest } from "../../Utils/arm/request";
|
import { armRequest } from "../../Utils/arm/request";
|
||||||
import { client } from "../CosmosClient";
|
import { client } from "../CosmosClient";
|
||||||
@@ -26,15 +23,6 @@ describe("createCollection", () => {
|
|||||||
} as DatabaseAccount,
|
} as DatabaseAccount,
|
||||||
apiType: "SQL",
|
apiType: "SQL",
|
||||||
});
|
});
|
||||||
useDatabases.setState({
|
|
||||||
databases: [
|
|
||||||
{
|
|
||||||
id: ko.observable("testDatabase"),
|
|
||||||
loadCollections: () => undefined,
|
|
||||||
collections: ko.observableArray([]),
|
|
||||||
} as Database,
|
|
||||||
],
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should call ARM if logged in with AAD", async () => {
|
it("should call ARM if logged in with AAD", async () => {
|
||||||
|
|||||||
@@ -4,16 +4,20 @@ import { ContainerRequest } from "@azure/cosmos/dist-esm/client/Container/Contai
|
|||||||
import { DatabaseRequest } from "@azure/cosmos/dist-esm/client/Database/DatabaseRequest";
|
import { DatabaseRequest } from "@azure/cosmos/dist-esm/client/Database/DatabaseRequest";
|
||||||
import { AuthType } from "../../AuthType";
|
import { AuthType } from "../../AuthType";
|
||||||
import * as DataModels from "../../Contracts/DataModels";
|
import * as DataModels from "../../Contracts/DataModels";
|
||||||
import { useDatabases } from "../../Explorer/useDatabases";
|
|
||||||
import { Action, ActionModifiers } from "../../Shared/Telemetry/TelemetryConstants";
|
import { Action, ActionModifiers } from "../../Shared/Telemetry/TelemetryConstants";
|
||||||
import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
||||||
import { userContext } from "../../UserContext";
|
import { userContext } from "../../UserContext";
|
||||||
import { getCollectionName } from "../../Utils/APITypeUtils";
|
import {
|
||||||
import { createUpdateCassandraTable } from "../../Utils/arm/generatedClients/cosmos/cassandraResources";
|
createUpdateCassandraTable,
|
||||||
import { createUpdateGremlinGraph } from "../../Utils/arm/generatedClients/cosmos/gremlinResources";
|
getCassandraTable,
|
||||||
import { createUpdateMongoDBCollection } from "../../Utils/arm/generatedClients/cosmos/mongoDBResources";
|
} from "../../Utils/arm/generatedClients/cosmos/cassandraResources";
|
||||||
import { createUpdateSqlContainer } from "../../Utils/arm/generatedClients/cosmos/sqlResources";
|
import { createUpdateGremlinGraph, getGremlinGraph } from "../../Utils/arm/generatedClients/cosmos/gremlinResources";
|
||||||
import { createUpdateTable } from "../../Utils/arm/generatedClients/cosmos/tableResources";
|
import {
|
||||||
|
createUpdateMongoDBCollection,
|
||||||
|
getMongoDBCollection,
|
||||||
|
} from "../../Utils/arm/generatedClients/cosmos/mongoDBResources";
|
||||||
|
import { createUpdateSqlContainer, getSqlContainer } from "../../Utils/arm/generatedClients/cosmos/sqlResources";
|
||||||
|
import { createUpdateTable, getTable } from "../../Utils/arm/generatedClients/cosmos/tableResources";
|
||||||
import * as ARMTypes from "../../Utils/arm/generatedClients/cosmos/types";
|
import * as ARMTypes from "../../Utils/arm/generatedClients/cosmos/types";
|
||||||
import { logConsoleInfo, logConsoleProgress } from "../../Utils/NotificationConsoleUtils";
|
import { logConsoleInfo, logConsoleProgress } from "../../Utils/NotificationConsoleUtils";
|
||||||
import { client } from "../CosmosClient";
|
import { client } from "../CosmosClient";
|
||||||
@@ -55,16 +59,6 @@ export const createCollection = async (params: DataModels.CreateCollectionParams
|
|||||||
};
|
};
|
||||||
|
|
||||||
const createCollectionWithARM = async (params: DataModels.CreateCollectionParams): Promise<DataModels.Collection> => {
|
const createCollectionWithARM = async (params: DataModels.CreateCollectionParams): Promise<DataModels.Collection> => {
|
||||||
if (!params.createNewDatabase) {
|
|
||||||
const isValid = await useDatabases.getState().validateCollectionId(params.databaseId, params.collectionId);
|
|
||||||
if (!isValid) {
|
|
||||||
const collectionName = getCollectionName().toLocaleLowerCase();
|
|
||||||
throw new Error(
|
|
||||||
`Create ${collectionName} failed: ${collectionName} with id ${params.collectionId} already exists`
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const { apiType } = userContext;
|
const { apiType } = userContext;
|
||||||
switch (apiType) {
|
switch (apiType) {
|
||||||
case "SQL":
|
case "SQL":
|
||||||
@@ -83,6 +77,23 @@ const createCollectionWithARM = async (params: DataModels.CreateCollectionParams
|
|||||||
};
|
};
|
||||||
|
|
||||||
const createSqlContainer = async (params: DataModels.CreateCollectionParams): Promise<DataModels.Collection> => {
|
const createSqlContainer = async (params: DataModels.CreateCollectionParams): Promise<DataModels.Collection> => {
|
||||||
|
try {
|
||||||
|
const getResponse = await getSqlContainer(
|
||||||
|
userContext.subscriptionId,
|
||||||
|
userContext.resourceGroup,
|
||||||
|
userContext.databaseAccount.name,
|
||||||
|
params.databaseId,
|
||||||
|
params.collectionId
|
||||||
|
);
|
||||||
|
if (getResponse?.properties?.resource) {
|
||||||
|
throw new Error(`Create container failed: container with id ${params.collectionId} already exists`);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
if (error.code !== "NotFound") {
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const options: ARMTypes.CreateUpdateOptions = constructRpOptions(params);
|
const options: ARMTypes.CreateUpdateOptions = constructRpOptions(params);
|
||||||
const resource: ARMTypes.SqlContainerResource = {
|
const resource: ARMTypes.SqlContainerResource = {
|
||||||
id: params.collectionId,
|
id: params.collectionId,
|
||||||
@@ -120,6 +131,23 @@ const createSqlContainer = async (params: DataModels.CreateCollectionParams): Pr
|
|||||||
|
|
||||||
const createMongoCollection = async (params: DataModels.CreateCollectionParams): Promise<DataModels.Collection> => {
|
const createMongoCollection = async (params: DataModels.CreateCollectionParams): Promise<DataModels.Collection> => {
|
||||||
const mongoWildcardIndexOnAllFields: ARMTypes.MongoIndex[] = [{ key: { keys: ["$**"] } }, { key: { keys: ["_id"] } }];
|
const mongoWildcardIndexOnAllFields: ARMTypes.MongoIndex[] = [{ key: { keys: ["$**"] } }, { key: { keys: ["_id"] } }];
|
||||||
|
try {
|
||||||
|
const getResponse = await getMongoDBCollection(
|
||||||
|
userContext.subscriptionId,
|
||||||
|
userContext.resourceGroup,
|
||||||
|
userContext.databaseAccount.name,
|
||||||
|
params.databaseId,
|
||||||
|
params.collectionId
|
||||||
|
);
|
||||||
|
if (getResponse?.properties?.resource) {
|
||||||
|
throw new Error(`Create collection failed: collection with id ${params.collectionId} already exists`);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
if (error.code !== "NotFound") {
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const options: ARMTypes.CreateUpdateOptions = constructRpOptions(params);
|
const options: ARMTypes.CreateUpdateOptions = constructRpOptions(params);
|
||||||
const resource: ARMTypes.MongoDBCollectionResource = {
|
const resource: ARMTypes.MongoDBCollectionResource = {
|
||||||
id: params.collectionId,
|
id: params.collectionId,
|
||||||
@@ -161,6 +189,23 @@ const createMongoCollection = async (params: DataModels.CreateCollectionParams):
|
|||||||
};
|
};
|
||||||
|
|
||||||
const createCassandraTable = async (params: DataModels.CreateCollectionParams): Promise<DataModels.Collection> => {
|
const createCassandraTable = async (params: DataModels.CreateCollectionParams): Promise<DataModels.Collection> => {
|
||||||
|
try {
|
||||||
|
const getResponse = await getCassandraTable(
|
||||||
|
userContext.subscriptionId,
|
||||||
|
userContext.resourceGroup,
|
||||||
|
userContext.databaseAccount.name,
|
||||||
|
params.databaseId,
|
||||||
|
params.collectionId
|
||||||
|
);
|
||||||
|
if (getResponse?.properties?.resource) {
|
||||||
|
throw new Error(`Create table failed: table with id ${params.collectionId} already exists`);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
if (error.code !== "NotFound") {
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const options: ARMTypes.CreateUpdateOptions = constructRpOptions(params);
|
const options: ARMTypes.CreateUpdateOptions = constructRpOptions(params);
|
||||||
const resource: ARMTypes.CassandraTableResource = {
|
const resource: ARMTypes.CassandraTableResource = {
|
||||||
id: params.collectionId,
|
id: params.collectionId,
|
||||||
@@ -188,6 +233,23 @@ const createCassandraTable = async (params: DataModels.CreateCollectionParams):
|
|||||||
};
|
};
|
||||||
|
|
||||||
const createGraph = async (params: DataModels.CreateCollectionParams): Promise<DataModels.Collection> => {
|
const createGraph = async (params: DataModels.CreateCollectionParams): Promise<DataModels.Collection> => {
|
||||||
|
try {
|
||||||
|
const getResponse = await getGremlinGraph(
|
||||||
|
userContext.subscriptionId,
|
||||||
|
userContext.resourceGroup,
|
||||||
|
userContext.databaseAccount.name,
|
||||||
|
params.databaseId,
|
||||||
|
params.collectionId
|
||||||
|
);
|
||||||
|
if (getResponse?.properties?.resource) {
|
||||||
|
throw new Error(`Create graph failed: graph with id ${params.collectionId} already exists`);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
if (error.code !== "NotFound") {
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const options: ARMTypes.CreateUpdateOptions = constructRpOptions(params);
|
const options: ARMTypes.CreateUpdateOptions = constructRpOptions(params);
|
||||||
const resource: ARMTypes.GremlinGraphResource = {
|
const resource: ARMTypes.GremlinGraphResource = {
|
||||||
id: params.collectionId,
|
id: params.collectionId,
|
||||||
@@ -222,6 +284,22 @@ const createGraph = async (params: DataModels.CreateCollectionParams): Promise<D
|
|||||||
};
|
};
|
||||||
|
|
||||||
const createTable = async (params: DataModels.CreateCollectionParams): Promise<DataModels.Collection> => {
|
const createTable = async (params: DataModels.CreateCollectionParams): Promise<DataModels.Collection> => {
|
||||||
|
try {
|
||||||
|
const getResponse = await getTable(
|
||||||
|
userContext.subscriptionId,
|
||||||
|
userContext.resourceGroup,
|
||||||
|
userContext.databaseAccount.name,
|
||||||
|
params.collectionId
|
||||||
|
);
|
||||||
|
if (getResponse?.properties?.resource) {
|
||||||
|
throw new Error(`Create table failed: table with id ${params.collectionId} already exists`);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
if (error.code !== "NotFound") {
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const options: ARMTypes.CreateUpdateOptions = constructRpOptions(params);
|
const options: ARMTypes.CreateUpdateOptions = constructRpOptions(params);
|
||||||
const resource: ARMTypes.TableResource = {
|
const resource: ARMTypes.TableResource = {
|
||||||
id: params.collectionId,
|
id: params.collectionId,
|
||||||
|
|||||||
@@ -2,13 +2,20 @@ import { DatabaseResponse } from "@azure/cosmos";
|
|||||||
import { DatabaseRequest } from "@azure/cosmos/dist-esm/client/Database/DatabaseRequest";
|
import { DatabaseRequest } from "@azure/cosmos/dist-esm/client/Database/DatabaseRequest";
|
||||||
import { AuthType } from "../../AuthType";
|
import { AuthType } from "../../AuthType";
|
||||||
import * as DataModels from "../../Contracts/DataModels";
|
import * as DataModels from "../../Contracts/DataModels";
|
||||||
import { useDatabases } from "../../Explorer/useDatabases";
|
|
||||||
import { userContext } from "../../UserContext";
|
import { userContext } from "../../UserContext";
|
||||||
import { getDatabaseName } from "../../Utils/APITypeUtils";
|
import {
|
||||||
import { createUpdateCassandraKeyspace } from "../../Utils/arm/generatedClients/cosmos/cassandraResources";
|
createUpdateCassandraKeyspace,
|
||||||
import { createUpdateGremlinDatabase } from "../../Utils/arm/generatedClients/cosmos/gremlinResources";
|
getCassandraKeyspace,
|
||||||
import { createUpdateMongoDBDatabase } from "../../Utils/arm/generatedClients/cosmos/mongoDBResources";
|
} from "../../Utils/arm/generatedClients/cosmos/cassandraResources";
|
||||||
import { createUpdateSqlDatabase } from "../../Utils/arm/generatedClients/cosmos/sqlResources";
|
import {
|
||||||
|
createUpdateGremlinDatabase,
|
||||||
|
getGremlinDatabase,
|
||||||
|
} from "../../Utils/arm/generatedClients/cosmos/gremlinResources";
|
||||||
|
import {
|
||||||
|
createUpdateMongoDBDatabase,
|
||||||
|
getMongoDBDatabase,
|
||||||
|
} from "../../Utils/arm/generatedClients/cosmos/mongoDBResources";
|
||||||
|
import { createUpdateSqlDatabase, getSqlDatabase } from "../../Utils/arm/generatedClients/cosmos/sqlResources";
|
||||||
import {
|
import {
|
||||||
CassandraKeyspaceCreateUpdateParameters,
|
CassandraKeyspaceCreateUpdateParameters,
|
||||||
CreateUpdateOptions,
|
CreateUpdateOptions,
|
||||||
@@ -41,11 +48,6 @@ export async function createDatabase(params: DataModels.CreateDatabaseParams): P
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function createDatabaseWithARM(params: DataModels.CreateDatabaseParams): Promise<DataModels.Database> {
|
async function createDatabaseWithARM(params: DataModels.CreateDatabaseParams): Promise<DataModels.Database> {
|
||||||
if (!useDatabases.getState().validateDatabaseId(params.databaseId)) {
|
|
||||||
const databaseName = getDatabaseName().toLocaleLowerCase();
|
|
||||||
throw new Error(`Create ${databaseName} failed: ${databaseName} with id ${params.databaseId} already exists`);
|
|
||||||
}
|
|
||||||
|
|
||||||
const { apiType } = userContext;
|
const { apiType } = userContext;
|
||||||
|
|
||||||
switch (apiType) {
|
switch (apiType) {
|
||||||
@@ -63,6 +65,22 @@ async function createDatabaseWithARM(params: DataModels.CreateDatabaseParams): P
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function createSqlDatabase(params: DataModels.CreateDatabaseParams): Promise<DataModels.Database> {
|
async function createSqlDatabase(params: DataModels.CreateDatabaseParams): Promise<DataModels.Database> {
|
||||||
|
try {
|
||||||
|
const getResponse = await getSqlDatabase(
|
||||||
|
userContext.subscriptionId,
|
||||||
|
userContext.resourceGroup,
|
||||||
|
userContext.databaseAccount.name,
|
||||||
|
params.databaseId
|
||||||
|
);
|
||||||
|
if (getResponse?.properties?.resource) {
|
||||||
|
throw new Error(`Create database failed: database with id ${params.databaseId} already exists`);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
if (error.code !== "NotFound") {
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const options: CreateUpdateOptions = constructRpOptions(params);
|
const options: CreateUpdateOptions = constructRpOptions(params);
|
||||||
const rpPayload: SqlDatabaseCreateUpdateParameters = {
|
const rpPayload: SqlDatabaseCreateUpdateParameters = {
|
||||||
properties: {
|
properties: {
|
||||||
@@ -83,6 +101,22 @@ async function createSqlDatabase(params: DataModels.CreateDatabaseParams): Promi
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function createMongoDatabase(params: DataModels.CreateDatabaseParams): Promise<DataModels.Database> {
|
async function createMongoDatabase(params: DataModels.CreateDatabaseParams): Promise<DataModels.Database> {
|
||||||
|
try {
|
||||||
|
const getResponse = await getMongoDBDatabase(
|
||||||
|
userContext.subscriptionId,
|
||||||
|
userContext.resourceGroup,
|
||||||
|
userContext.databaseAccount.name,
|
||||||
|
params.databaseId
|
||||||
|
);
|
||||||
|
if (getResponse?.properties?.resource) {
|
||||||
|
throw new Error(`Create database failed: database with id ${params.databaseId} already exists`);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
if (error.code !== "NotFound") {
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const options: CreateUpdateOptions = constructRpOptions(params);
|
const options: CreateUpdateOptions = constructRpOptions(params);
|
||||||
const rpPayload: MongoDBDatabaseCreateUpdateParameters = {
|
const rpPayload: MongoDBDatabaseCreateUpdateParameters = {
|
||||||
properties: {
|
properties: {
|
||||||
@@ -103,6 +137,22 @@ async function createMongoDatabase(params: DataModels.CreateDatabaseParams): Pro
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function createCassandraKeyspace(params: DataModels.CreateDatabaseParams): Promise<DataModels.Database> {
|
async function createCassandraKeyspace(params: DataModels.CreateDatabaseParams): Promise<DataModels.Database> {
|
||||||
|
try {
|
||||||
|
const getResponse = await getCassandraKeyspace(
|
||||||
|
userContext.subscriptionId,
|
||||||
|
userContext.resourceGroup,
|
||||||
|
userContext.databaseAccount.name,
|
||||||
|
params.databaseId
|
||||||
|
);
|
||||||
|
if (getResponse?.properties?.resource) {
|
||||||
|
throw new Error(`Create database failed: database with id ${params.databaseId} already exists`);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
if (error.code !== "NotFound") {
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const options: CreateUpdateOptions = constructRpOptions(params);
|
const options: CreateUpdateOptions = constructRpOptions(params);
|
||||||
const rpPayload: CassandraKeyspaceCreateUpdateParameters = {
|
const rpPayload: CassandraKeyspaceCreateUpdateParameters = {
|
||||||
properties: {
|
properties: {
|
||||||
@@ -123,6 +173,22 @@ async function createCassandraKeyspace(params: DataModels.CreateDatabaseParams):
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function createGremlineDatabase(params: DataModels.CreateDatabaseParams): Promise<DataModels.Database> {
|
async function createGremlineDatabase(params: DataModels.CreateDatabaseParams): Promise<DataModels.Database> {
|
||||||
|
try {
|
||||||
|
const getResponse = await getGremlinDatabase(
|
||||||
|
userContext.subscriptionId,
|
||||||
|
userContext.resourceGroup,
|
||||||
|
userContext.databaseAccount.name,
|
||||||
|
params.databaseId
|
||||||
|
);
|
||||||
|
if (getResponse?.properties?.resource) {
|
||||||
|
throw new Error(`Create database failed: database with id ${params.databaseId} already exists`);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
if (error.code !== "NotFound") {
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const options: CreateUpdateOptions = constructRpOptions(params);
|
const options: CreateUpdateOptions = constructRpOptions(params);
|
||||||
const rpPayload: GremlinDatabaseCreateUpdateParameters = {
|
const rpPayload: GremlinDatabaseCreateUpdateParameters = {
|
||||||
properties: {
|
properties: {
|
||||||
|
|||||||
@@ -44,6 +44,10 @@ exports[`SettingsComponent renders 1`] = `
|
|||||||
"copyNotebook": [Function],
|
"copyNotebook": [Function],
|
||||||
"parameters": [Function],
|
"parameters": [Function],
|
||||||
},
|
},
|
||||||
|
"resourceTreeForResourceToken": ResourceTreeAdapterForResourceToken {
|
||||||
|
"container": [Circular],
|
||||||
|
"parameters": [Function],
|
||||||
|
},
|
||||||
},
|
},
|
||||||
"databaseId": "test",
|
"databaseId": "test",
|
||||||
"defaultTtl": [Function],
|
"defaultTtl": [Function],
|
||||||
@@ -111,6 +115,10 @@ exports[`SettingsComponent renders 1`] = `
|
|||||||
"copyNotebook": [Function],
|
"copyNotebook": [Function],
|
||||||
"parameters": [Function],
|
"parameters": [Function],
|
||||||
},
|
},
|
||||||
|
"resourceTreeForResourceToken": ResourceTreeAdapterForResourceToken {
|
||||||
|
"container": [Circular],
|
||||||
|
"parameters": [Function],
|
||||||
|
},
|
||||||
},
|
},
|
||||||
"databaseId": "test",
|
"databaseId": "test",
|
||||||
"defaultTtl": [Function],
|
"defaultTtl": [Function],
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import {
|
import {
|
||||||
Dropdown,
|
DocumentCard,
|
||||||
IDropdownOption,
|
DocumentCardDetails,
|
||||||
|
Dropdown, IDropdownOption,
|
||||||
IStackTokens,
|
IStackTokens,
|
||||||
Label,
|
Label,
|
||||||
Link,
|
Link,
|
||||||
@@ -12,19 +13,19 @@ import {
|
|||||||
Stack,
|
Stack,
|
||||||
Text,
|
Text,
|
||||||
TextField,
|
TextField,
|
||||||
Toggle,
|
Toggle
|
||||||
} from "@fluentui/react";
|
} from "@fluentui/react";
|
||||||
import { TFunction } from "i18next";
|
import { TFunction } from "i18next";
|
||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
import {
|
import {
|
||||||
ChoiceItem,
|
ChoiceItem,
|
||||||
Description,
|
Description,
|
||||||
DescriptionType,
|
DescriptionType, Info,
|
||||||
Info,
|
|
||||||
InputType,
|
InputType,
|
||||||
InputTypeValue,
|
InputTypeValue,
|
||||||
NumberUiType,
|
NumberUiType,
|
||||||
SmartUiInput,
|
SmartUiInput,
|
||||||
|
Style
|
||||||
} from "../../../SelfServe/SelfServeTypes";
|
} from "../../../SelfServe/SelfServeTypes";
|
||||||
import { ToolTipLabelComponent } from "../Settings/SettingsSubComponents/ToolTipLabelComponent";
|
import { ToolTipLabelComponent } from "../Settings/SettingsSubComponents/ToolTipLabelComponent";
|
||||||
import * as InputUtils from "./InputUtils";
|
import * as InputUtils from "./InputUtils";
|
||||||
@@ -87,6 +88,7 @@ interface Node {
|
|||||||
info?: Info;
|
info?: Info;
|
||||||
input?: AnyDisplay;
|
input?: AnyDisplay;
|
||||||
children?: Node[];
|
children?: Node[];
|
||||||
|
style?: Style
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SmartUiDescriptor {
|
export interface SmartUiDescriptor {
|
||||||
@@ -194,6 +196,14 @@ export class SmartUiComponent extends React.Component<SmartUiComponentProps, Sma
|
|||||||
|
|
||||||
if (description.type === DescriptionType.Text) {
|
if (description.type === DescriptionType.Text) {
|
||||||
return descriptionElement;
|
return descriptionElement;
|
||||||
|
} else if (description.type === DescriptionType.Card) {
|
||||||
|
return (
|
||||||
|
<DocumentCard styles={{ root: { display: "inline-block", padding: 10 } }}>
|
||||||
|
<DocumentCardDetails>
|
||||||
|
{descriptionElement}
|
||||||
|
</DocumentCardDetails>
|
||||||
|
</DocumentCard>
|
||||||
|
)
|
||||||
}
|
}
|
||||||
const messageBarType =
|
const messageBarType =
|
||||||
description.type === DescriptionType.InfoMessageBar ? MessageBarType.info : MessageBarType.warning;
|
description.type === DescriptionType.InfoMessageBar ? MessageBarType.info : MessageBarType.warning;
|
||||||
@@ -396,18 +406,29 @@ export class SmartUiComponent extends React.Component<SmartUiComponentProps, Sma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private renderNode(node: Node): JSX.Element {
|
private renderNode(node: Node, isSectionFloatRight: boolean): JSX.Element {
|
||||||
const containerStackTokens: IStackTokens = { childrenGap: 10 };
|
const containerStackTokens: IStackTokens = { childrenGap: 10 };
|
||||||
|
const isNodeFloatRight = node.style?.isFloatRight === true;
|
||||||
|
console.log(isSectionFloatRight, isNodeFloatRight, node.id)
|
||||||
return (
|
return (
|
||||||
<Stack tokens={containerStackTokens} className="widgetRendererContainer">
|
<Stack tokens={containerStackTokens} className="widgetRendererContainer">
|
||||||
<Stack.Item>{node.input && this.renderElement(node.input, node.info as Info)}</Stack.Item>
|
{isSectionFloatRight === isNodeFloatRight ?
|
||||||
{node.children && node.children.map((child) => <div key={child.id}>{this.renderNode(child)}</div>)}
|
<>
|
||||||
|
<Stack.Item>{node.input && this.renderElement(node.input, node.info as Info)}</Stack.Item>
|
||||||
|
</>
|
||||||
|
: <></>
|
||||||
|
}
|
||||||
|
{node.children && node.children.map((child) => <div key={child.id}>{this.renderNode(child, isSectionFloatRight)}</div>)}
|
||||||
</Stack>
|
</Stack>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
render(): JSX.Element {
|
render(): JSX.Element {
|
||||||
return this.renderNode(this.props.descriptor.root);
|
return (
|
||||||
|
<Stack horizontal tokens={{ childrenGap: 50 }}>
|
||||||
|
{this.renderNode(this.props.descriptor.root, false)}
|
||||||
|
{this.renderNode(this.props.descriptor.root, true)}
|
||||||
|
</Stack>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,6 +59,7 @@ import TerminalTab from "./Tabs/TerminalTab";
|
|||||||
import Database from "./Tree/Database";
|
import Database from "./Tree/Database";
|
||||||
import ResourceTokenCollection from "./Tree/ResourceTokenCollection";
|
import ResourceTokenCollection from "./Tree/ResourceTokenCollection";
|
||||||
import { ResourceTreeAdapter } from "./Tree/ResourceTreeAdapter";
|
import { ResourceTreeAdapter } from "./Tree/ResourceTreeAdapter";
|
||||||
|
import { ResourceTreeAdapterForResourceToken } from "./Tree/ResourceTreeAdapterForResourceToken";
|
||||||
import StoredProcedure from "./Tree/StoredProcedure";
|
import StoredProcedure from "./Tree/StoredProcedure";
|
||||||
import { useDatabases } from "./useDatabases";
|
import { useDatabases } from "./useDatabases";
|
||||||
import { useSelectedNode } from "./useSelectedNode";
|
import { useSelectedNode } from "./useSelectedNode";
|
||||||
@@ -73,6 +74,9 @@ export default class Explorer {
|
|||||||
// Resource Tree
|
// Resource Tree
|
||||||
private resourceTree: ResourceTreeAdapter;
|
private resourceTree: ResourceTreeAdapter;
|
||||||
|
|
||||||
|
// Resource Token
|
||||||
|
public resourceTreeForResourceToken: ResourceTreeAdapterForResourceToken;
|
||||||
|
|
||||||
// Tabs
|
// Tabs
|
||||||
public isTabsContentExpanded: ko.Observable<boolean>;
|
public isTabsContentExpanded: ko.Observable<boolean>;
|
||||||
|
|
||||||
@@ -182,6 +186,7 @@ export default class Explorer {
|
|||||||
);
|
);
|
||||||
|
|
||||||
this.resourceTree = new ResourceTreeAdapter(this);
|
this.resourceTree = new ResourceTreeAdapter(this);
|
||||||
|
this.resourceTreeForResourceToken = new ResourceTreeAdapterForResourceToken(this);
|
||||||
|
|
||||||
// Override notebook server parameters from URL parameters
|
// Override notebook server parameters from URL parameters
|
||||||
if (userContext.features.notebookServerUrl && userContext.features.notebookServerToken) {
|
if (userContext.features.notebookServerUrl && userContext.features.notebookServerToken) {
|
||||||
|
|||||||
@@ -54,11 +54,11 @@ export const SET_HOVERED_CELL = "SET_HOVERED_CELL";
|
|||||||
export interface SetHoveredCellAction {
|
export interface SetHoveredCellAction {
|
||||||
type: "SET_HOVERED_CELL";
|
type: "SET_HOVERED_CELL";
|
||||||
payload: {
|
payload: {
|
||||||
cellId?: CellId;
|
cellId: CellId;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export const setHoveredCell = (payload: { cellId?: CellId }): SetHoveredCellAction => {
|
export const setHoveredCell = (payload: { cellId: CellId }): SetHoveredCellAction => {
|
||||||
return {
|
return {
|
||||||
type: SET_HOVERED_CELL,
|
type: SET_HOVERED_CELL,
|
||||||
payload,
|
payload,
|
||||||
|
|||||||
@@ -29,7 +29,6 @@ import { SnapshotRequest } from "./NotebookComponent/types";
|
|||||||
import { NotebookContainerClient } from "./NotebookContainerClient";
|
import { NotebookContainerClient } from "./NotebookContainerClient";
|
||||||
import { NotebookContentClient } from "./NotebookContentClient";
|
import { NotebookContentClient } from "./NotebookContentClient";
|
||||||
import { SchemaAnalyzerNotebook } from "./SchemaAnalyzer/SchemaAnalyzerUtils";
|
import { SchemaAnalyzerNotebook } from "./SchemaAnalyzer/SchemaAnalyzerUtils";
|
||||||
import { useNotebook } from "./useNotebook";
|
|
||||||
|
|
||||||
type NotebookPaneContent = string | ImmutableNotebook;
|
type NotebookPaneContent = string | ImmutableNotebook;
|
||||||
|
|
||||||
@@ -111,7 +110,6 @@ export default class NotebookManager {
|
|||||||
this.junoClient.subscribeToPinnedRepos((pinnedRepos) => {
|
this.junoClient.subscribeToPinnedRepos((pinnedRepos) => {
|
||||||
this.params.resourceTree.initializeGitHubRepos(pinnedRepos);
|
this.params.resourceTree.initializeGitHubRepos(pinnedRepos);
|
||||||
this.params.resourceTree.triggerRender();
|
this.params.resourceTree.triggerRender();
|
||||||
useNotebook.getState().initializeGitHubRepos(pinnedRepos);
|
|
||||||
});
|
});
|
||||||
this.refreshPinnedRepos();
|
this.refreshPinnedRepos();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,12 +6,10 @@ import { getErrorMessage } from "../../Common/ErrorHandlingUtils";
|
|||||||
import * as Logger from "../../Common/Logger";
|
import * as Logger from "../../Common/Logger";
|
||||||
import { configContext } from "../../ConfigContext";
|
import { configContext } from "../../ConfigContext";
|
||||||
import * as DataModels from "../../Contracts/DataModels";
|
import * as DataModels from "../../Contracts/DataModels";
|
||||||
import { IPinnedRepo } from "../../Juno/JunoClient";
|
|
||||||
import { Action, ActionModifiers } from "../../Shared/Telemetry/TelemetryConstants";
|
import { Action, ActionModifiers } from "../../Shared/Telemetry/TelemetryConstants";
|
||||||
import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
||||||
import { userContext } from "../../UserContext";
|
import { userContext } from "../../UserContext";
|
||||||
import { getAuthorizationHeader } from "../../Utils/AuthorizationUtils";
|
import { getAuthorizationHeader } from "../../Utils/AuthorizationUtils";
|
||||||
import * as GitHubUtils from "../../Utils/GitHubUtils";
|
|
||||||
import { NotebookContentItem, NotebookContentItemType } from "./NotebookContentItem";
|
import { NotebookContentItem, NotebookContentItemType } from "./NotebookContentItem";
|
||||||
import NotebookManager from "./NotebookManager";
|
import NotebookManager from "./NotebookManager";
|
||||||
|
|
||||||
@@ -41,7 +39,6 @@ interface NotebookState {
|
|||||||
updateNotebookItem: (item: NotebookContentItem) => void;
|
updateNotebookItem: (item: NotebookContentItem) => void;
|
||||||
deleteNotebookItem: (item: NotebookContentItem) => void;
|
deleteNotebookItem: (item: NotebookContentItem) => void;
|
||||||
initializeNotebooksTree: (notebookManager: NotebookManager) => Promise<void>;
|
initializeNotebooksTree: (notebookManager: NotebookManager) => Promise<void>;
|
||||||
initializeGitHubRepos: (pinnedRepos: IPinnedRepo[]) => void;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const useNotebook: UseStore<NotebookState> = create((set, get) => ({
|
export const useNotebook: UseStore<NotebookState> = create((set, get) => ({
|
||||||
@@ -156,31 +153,35 @@ export const useNotebook: UseStore<NotebookState> = create((set, get) => ({
|
|||||||
set({ myNotebooksContentRoot: root });
|
set({ myNotebooksContentRoot: root });
|
||||||
},
|
},
|
||||||
initializeNotebooksTree: async (notebookManager: NotebookManager): Promise<void> => {
|
initializeNotebooksTree: async (notebookManager: NotebookManager): Promise<void> => {
|
||||||
const myNotebooksContentRoot = {
|
set({
|
||||||
name: "My Notebooks",
|
myNotebooksContentRoot: {
|
||||||
path: get().notebookBasePath,
|
name: "My Notebooks",
|
||||||
type: NotebookContentItemType.Directory,
|
path: get().notebookBasePath,
|
||||||
};
|
type: NotebookContentItemType.Directory,
|
||||||
const galleryContentRoot = {
|
},
|
||||||
name: "Gallery",
|
galleryContentRoot: {
|
||||||
path: "Gallery",
|
name: "Gallery",
|
||||||
type: NotebookContentItemType.File,
|
path: "Gallery",
|
||||||
};
|
type: NotebookContentItemType.File,
|
||||||
const gitHubNotebooksContentRoot = notebookManager?.gitHubOAuthService?.isLoggedIn()
|
},
|
||||||
? {
|
});
|
||||||
|
|
||||||
|
if (notebookManager?.gitHubOAuthService?.isLoggedIn()) {
|
||||||
|
set({
|
||||||
|
gitHubNotebooksContentRoot: {
|
||||||
name: "GitHub repos",
|
name: "GitHub repos",
|
||||||
path: "PsuedoDir",
|
path: "PsuedoDir",
|
||||||
type: NotebookContentItemType.Directory,
|
type: NotebookContentItemType.Directory,
|
||||||
}
|
},
|
||||||
: undefined;
|
});
|
||||||
set({
|
}
|
||||||
myNotebooksContentRoot,
|
|
||||||
galleryContentRoot,
|
|
||||||
gitHubNotebooksContentRoot,
|
|
||||||
});
|
|
||||||
|
|
||||||
if (get().notebookServerInfo?.notebookServerEndpoint) {
|
if (get().notebookServerInfo?.notebookServerEndpoint) {
|
||||||
const updatedRoot = await notebookManager?.notebookContentClient?.updateItemChildren(myNotebooksContentRoot);
|
const updatedRoot = await notebookManager?.notebookContentClient?.updateItemChildren({
|
||||||
|
name: "My Notebooks",
|
||||||
|
path: get().notebookBasePath,
|
||||||
|
type: NotebookContentItemType.Directory,
|
||||||
|
});
|
||||||
set({ myNotebooksContentRoot: updatedRoot });
|
set({ myNotebooksContentRoot: updatedRoot });
|
||||||
|
|
||||||
if (updatedRoot?.children) {
|
if (updatedRoot?.children) {
|
||||||
@@ -205,31 +206,4 @@ export const useNotebook: UseStore<NotebookState> = create((set, get) => ({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
initializeGitHubRepos: (pinnedRepos: IPinnedRepo[]): void => {
|
|
||||||
const gitHubNotebooksContentRoot = cloneDeep(get().gitHubNotebooksContentRoot);
|
|
||||||
if (gitHubNotebooksContentRoot) {
|
|
||||||
gitHubNotebooksContentRoot.children = [];
|
|
||||||
pinnedRepos?.forEach((pinnedRepo) => {
|
|
||||||
const repoFullName = GitHubUtils.toRepoFullName(pinnedRepo.owner, pinnedRepo.name);
|
|
||||||
const repoTreeItem: NotebookContentItem = {
|
|
||||||
name: repoFullName,
|
|
||||||
path: "PsuedoDir",
|
|
||||||
type: NotebookContentItemType.Directory,
|
|
||||||
children: [],
|
|
||||||
};
|
|
||||||
|
|
||||||
pinnedRepo.branches.forEach((branch) => {
|
|
||||||
repoTreeItem.children.push({
|
|
||||||
name: branch.name,
|
|
||||||
path: GitHubUtils.toContentUri(pinnedRepo.owner, pinnedRepo.name, branch.name, ""),
|
|
||||||
type: NotebookContentItemType.Directory,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
gitHubNotebooksContentRoot.children.push(repoTreeItem);
|
|
||||||
});
|
|
||||||
|
|
||||||
set({ gitHubNotebooksContentRoot });
|
|
||||||
}
|
|
||||||
},
|
|
||||||
}));
|
}));
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ export interface InputParameterProps {
|
|||||||
onDeleteParamKeyPress?: () => void;
|
onDeleteParamKeyPress?: () => void;
|
||||||
onAddNewParamKeyPress?: () => void;
|
onAddNewParamKeyPress?: () => void;
|
||||||
onParamValueChange: (event: React.FormEvent<HTMLElement>, newInput?: string) => void;
|
onParamValueChange: (event: React.FormEvent<HTMLElement>, newInput?: string) => void;
|
||||||
onParamKeyChange: (event: React.FormEvent<HTMLElement>, selectedParam?: IDropdownOption) => void;
|
onParamKeyChange: (event: React.FormEvent<HTMLElement>, selectedParam: IDropdownOption) => void;
|
||||||
paramValue: string;
|
paramValue: string;
|
||||||
selectedKey: string | number;
|
selectedKey: string | number;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,6 +33,10 @@ exports[`GitHub Repos Panel should render Default properly 1`] = `
|
|||||||
"copyNotebook": [Function],
|
"copyNotebook": [Function],
|
||||||
"parameters": [Function],
|
"parameters": [Function],
|
||||||
},
|
},
|
||||||
|
"resourceTreeForResourceToken": ResourceTreeAdapterForResourceToken {
|
||||||
|
"container": [Circular],
|
||||||
|
"parameters": [Function],
|
||||||
|
},
|
||||||
},
|
},
|
||||||
"getRepo": [Function],
|
"getRepo": [Function],
|
||||||
"pinRepo": [Function],
|
"pinRepo": [Function],
|
||||||
|
|||||||
@@ -150,6 +150,9 @@
|
|||||||
.backImageIcon {
|
.backImageIcon {
|
||||||
margin-top: 8px;
|
margin-top: 8px;
|
||||||
}
|
}
|
||||||
|
.entityValueTextField {
|
||||||
|
margin: 24px;
|
||||||
|
}
|
||||||
.addEntityDatePicker {
|
.addEntityDatePicker {
|
||||||
max-width: 145px;
|
max-width: 145px;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,10 @@ exports[`StringInput Pane should render Create new directory properly 1`] = `
|
|||||||
"copyNotebook": [Function],
|
"copyNotebook": [Function],
|
||||||
"parameters": [Function],
|
"parameters": [Function],
|
||||||
},
|
},
|
||||||
|
"resourceTreeForResourceToken": ResourceTreeAdapterForResourceToken {
|
||||||
|
"container": [Circular],
|
||||||
|
"parameters": [Function],
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
inProgressMessage="Creating directory "
|
inProgressMessage="Creating directory "
|
||||||
|
|||||||
@@ -218,7 +218,7 @@ export const AddTableEntityPanel: FunctionComponent<AddTableEntityPanelProps> =
|
|||||||
|
|
||||||
if (isEntityValuePanelOpen) {
|
if (isEntityValuePanelOpen) {
|
||||||
return (
|
return (
|
||||||
<Stack style={{ padding: "20px 34px" }}>
|
<Stack style={{ margin: "20px 0", padding: "0 34px" }}>
|
||||||
<Stack horizontal {...columnProps}>
|
<Stack horizontal {...columnProps}>
|
||||||
<Image {...backImageProps} src={RevertBackIcon} alt="back" onClick={() => setIsEntityValuePanelFalse()} />
|
<Image {...backImageProps} src={RevertBackIcon} alt="back" onClick={() => setIsEntityValuePanelFalse()} />
|
||||||
<Label>{entityAttributeProperty}</Label>
|
<Label>{entityAttributeProperty}</Label>
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import { IDropdownOption, Image, Label, Stack, Text, TextField } from "@fluentui/react";
|
import { IDropdownOption, Image, IPanelProps, IRenderFunction, Label, Stack, Text, TextField } from "@fluentui/react";
|
||||||
import { useBoolean } from "@fluentui/react-hooks";
|
import { useBoolean } from "@fluentui/react-hooks";
|
||||||
import React, { FunctionComponent, useEffect, useState } from "react";
|
import React, { FunctionComponent, useEffect, useState } from "react";
|
||||||
import * as _ from "underscore";
|
import * as _ from "underscore";
|
||||||
import AddPropertyIcon from "../../../../images/Add-property.svg";
|
import AddPropertyIcon from "../../../../images/Add-property.svg";
|
||||||
import RevertBackIcon from "../../../../images/RevertBack.svg";
|
import RevertBackIcon from "../../../../images/RevertBack.svg";
|
||||||
import { getErrorMessage, handleError } from "../../../Common/ErrorHandlingUtils";
|
|
||||||
import { TableEntity } from "../../../Common/TableEntity";
|
import { TableEntity } from "../../../Common/TableEntity";
|
||||||
|
import { useSidePanel } from "../../../hooks/useSidePanel";
|
||||||
import { userContext } from "../../../UserContext";
|
import { userContext } from "../../../UserContext";
|
||||||
import * as TableConstants from "../../Tables/Constants";
|
import * as TableConstants from "../../Tables/Constants";
|
||||||
import * as DataTableUtilities from "../../Tables/DataTable/DataTableUtilities";
|
import * as DataTableUtilities from "../../Tables/DataTable/DataTableUtilities";
|
||||||
@@ -14,7 +14,7 @@ import * as Entities from "../../Tables/Entities";
|
|||||||
import { CassandraAPIDataClient, TableDataClient } from "../../Tables/TableDataClient";
|
import { CassandraAPIDataClient, TableDataClient } from "../../Tables/TableDataClient";
|
||||||
import * as TableEntityProcessor from "../../Tables/TableEntityProcessor";
|
import * as TableEntityProcessor from "../../Tables/TableEntityProcessor";
|
||||||
import QueryTablesTab from "../../Tabs/QueryTablesTab";
|
import QueryTablesTab from "../../Tabs/QueryTablesTab";
|
||||||
import { RightPaneForm, RightPaneFormProps } from "../RightPaneForm/RightPaneForm";
|
import { PanelContainerComponent } from "../PanelContainerComponent";
|
||||||
import {
|
import {
|
||||||
attributeNameLabel,
|
attributeNameLabel,
|
||||||
attributeValueLabel,
|
attributeValueLabel,
|
||||||
@@ -29,6 +29,7 @@ import {
|
|||||||
getEntityValuePlaceholder,
|
getEntityValuePlaceholder,
|
||||||
getFormattedTime,
|
getFormattedTime,
|
||||||
imageProps,
|
imageProps,
|
||||||
|
isValidEntities,
|
||||||
options,
|
options,
|
||||||
} from "./Validators/EntityTableHelper";
|
} from "./Validators/EntityTableHelper";
|
||||||
|
|
||||||
@@ -58,13 +59,12 @@ export const EditTableEntityPanel: FunctionComponent<EditTableEntityPanelProps>
|
|||||||
tableEntityListViewModel,
|
tableEntityListViewModel,
|
||||||
cassandraApiClient,
|
cassandraApiClient,
|
||||||
}: EditTableEntityPanelProps): JSX.Element => {
|
}: EditTableEntityPanelProps): JSX.Element => {
|
||||||
|
const closeSidePanel = useSidePanel((state) => state.closeSidePanel);
|
||||||
const [entities, setEntities] = useState<EntityRowType[]>([]);
|
const [entities, setEntities] = useState<EntityRowType[]>([]);
|
||||||
const [selectedRow, setSelectedRow] = useState<number>(0);
|
const [selectedRow, setSelectedRow] = useState<number>(0);
|
||||||
const [entityAttributeValue, setEntityAttributeValue] = useState<string>("");
|
const [entityAttributeValue, setEntityAttributeValue] = useState<string>("");
|
||||||
const [originalDocument, setOriginalDocument] = useState<Entities.ITableEntity>({});
|
const [originalDocument, setOriginalDocument] = useState<Entities.ITableEntity>({});
|
||||||
const [entityAttributeProperty, setEntityAttributeProperty] = useState<string>("");
|
const [entityAttributeProperty, setEntityAttributeProperty] = useState<string>("");
|
||||||
const [formError, setFormError] = useState<string>("");
|
|
||||||
const [isExecuting, setIsExecuting] = useState<boolean>(false);
|
|
||||||
|
|
||||||
const [
|
const [
|
||||||
isEntityValuePanelOpen,
|
isEntityValuePanelOpen,
|
||||||
@@ -190,44 +190,26 @@ export const EditTableEntityPanel: FunctionComponent<EditTableEntityPanelProps>
|
|||||||
return displayValue;
|
return displayValue;
|
||||||
};
|
};
|
||||||
|
|
||||||
const onSubmit = async (): Promise<void> => {
|
const submit = async (event: React.FormEvent<HTMLInputElement>): Promise<void> => {
|
||||||
for (let i = 0; i < entities.length; i++) {
|
if (!isValidEntities(entities)) {
|
||||||
const { property, type } = entities[i];
|
return undefined;
|
||||||
if (property === "" || property === undefined) {
|
|
||||||
setFormError(`Property name cannot be empty. Please enter a property name`);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!type) {
|
|
||||||
setFormError(`Property type cannot be empty. Please select a type from the dropdown for property ${property}`);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
event.preventDefault();
|
||||||
setIsExecuting(true);
|
|
||||||
const entity: Entities.ITableEntity = entityFromAttributes(entities);
|
const entity: Entities.ITableEntity = entityFromAttributes(entities);
|
||||||
const newTableDataClient = userContext.apiType === "Cassandra" ? cassandraApiClient : tableDataClient;
|
const newTableDataClient = userContext.apiType === "Cassandra" ? cassandraApiClient : tableDataClient;
|
||||||
const originalDocumentData = userContext.apiType === "Cassandra" ? originalDocument[0] : originalDocument;
|
const originalDocumentData = userContext.apiType === "Cassandra" ? originalDocument[0] : originalDocument;
|
||||||
|
const newEntity: Entities.ITableEntity = await newTableDataClient.updateDocument(
|
||||||
try {
|
queryTablesTab.collection,
|
||||||
const newEntity: Entities.ITableEntity = await newTableDataClient.updateDocument(
|
originalDocumentData,
|
||||||
queryTablesTab.collection,
|
entity
|
||||||
originalDocumentData,
|
);
|
||||||
entity
|
await tableEntityListViewModel.updateCachedEntity(newEntity);
|
||||||
);
|
if (!tryInsertNewHeaders(tableEntityListViewModel, newEntity)) {
|
||||||
await tableEntityListViewModel.updateCachedEntity(newEntity);
|
tableEntityListViewModel.redrawTableThrottled();
|
||||||
if (!tryInsertNewHeaders(tableEntityListViewModel, newEntity)) {
|
|
||||||
tableEntityListViewModel.redrawTableThrottled();
|
|
||||||
}
|
|
||||||
tableEntityListViewModel.selected.removeAll();
|
|
||||||
tableEntityListViewModel.selected.push(newEntity);
|
|
||||||
} catch (error) {
|
|
||||||
const errorMessage = getErrorMessage(error);
|
|
||||||
handleError(errorMessage, "EditTableRow");
|
|
||||||
throw error;
|
|
||||||
} finally {
|
|
||||||
setIsExecuting(false);
|
|
||||||
}
|
}
|
||||||
|
tableEntityListViewModel.selected.removeAll();
|
||||||
|
tableEntityListViewModel.selected.push(newEntity);
|
||||||
|
closeSidePanel();
|
||||||
};
|
};
|
||||||
|
|
||||||
const tryInsertNewHeaders = (viewModel: TableEntityListViewModel, newEntity: Entities.ITableEntity): boolean => {
|
const tryInsertNewHeaders = (viewModel: TableEntityListViewModel, newEntity: Entities.ITableEntity): boolean => {
|
||||||
@@ -317,81 +299,109 @@ export const EditTableEntityPanel: FunctionComponent<EditTableEntityPanelProps>
|
|||||||
setIsEntityValuePanelTrue();
|
setIsEntityValuePanelTrue();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const renderPanelContent = (): JSX.Element => {
|
||||||
|
return (
|
||||||
|
<form className="panelFormWrapper">
|
||||||
|
<div className="panelFormWrapper">
|
||||||
|
<div className="panelMainContent">
|
||||||
|
{entities.map((entity, index) => {
|
||||||
|
return (
|
||||||
|
<TableEntity
|
||||||
|
key={"" + entity.id + index}
|
||||||
|
isDeleteOptionVisible={entity.isDeleteOptionVisible}
|
||||||
|
entityTypeLabel={index === 0 && dataTypeLabel}
|
||||||
|
entityPropertyLabel={index === 0 && attributeNameLabel}
|
||||||
|
entityValueLabel={index === 0 && attributeValueLabel}
|
||||||
|
options={userContext.apiType === "Cassandra" ? cassandraOptions : options}
|
||||||
|
isPropertyTypeDisable={entity.isPropertyTypeDisable}
|
||||||
|
entityProperty={entity.property}
|
||||||
|
selectedKey={entity.type}
|
||||||
|
entityPropertyPlaceHolder={detailedHelp}
|
||||||
|
entityValuePlaceholder={entity.entityValuePlaceholder}
|
||||||
|
entityValue={entity.value?.toString()}
|
||||||
|
isEntityTypeDate={entity.isEntityTypeDate}
|
||||||
|
entityTimeValue={entity.entityTimeValue}
|
||||||
|
isEntityValueDisable={entity.isEntityValueDisable}
|
||||||
|
onEditEntity={() => editEntity(index)}
|
||||||
|
onSelectDate={(date: Date) => {
|
||||||
|
entityChange(date, index, "value");
|
||||||
|
}}
|
||||||
|
onDeleteEntity={() => deleteEntityAtIndex(index)}
|
||||||
|
onEntityPropertyChange={(event, newInput?: string) => {
|
||||||
|
entityChange(newInput, index, "property");
|
||||||
|
}}
|
||||||
|
onEntityTypeChange={(event: React.FormEvent<HTMLDivElement>, selectedParam: IDropdownOption) => {
|
||||||
|
entityTypeChange(event, selectedParam, index);
|
||||||
|
}}
|
||||||
|
onEntityValueChange={(event, newInput?: string) => {
|
||||||
|
entityChange(newInput, index, "value");
|
||||||
|
}}
|
||||||
|
onEntityTimeValueChange={(event, newInput?: string) => {
|
||||||
|
entityChange(newInput, index, "time");
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
{userContext.apiType !== "Cassandra" && (
|
||||||
|
<Stack horizontal onClick={addNewEntity} className="addButtonEntiy">
|
||||||
|
<Image {...imageProps} src={AddPropertyIcon} alt="Add Entity" />
|
||||||
|
<Text className="addNewParamStyle">{getAddButtonLabel(userContext.apiType)}</Text>
|
||||||
|
</Stack>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
{renderPanelFooter()}
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const renderPanelFooter = (): JSX.Element => {
|
||||||
|
return (
|
||||||
|
<div className="paneFooter">
|
||||||
|
<div className="leftpanel-okbut">
|
||||||
|
<input type="submit" onClick={submit} className="genericPaneSubmitBtn" value="Update Entity" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const onRenderNavigationContent: IRenderFunction<IPanelProps> = () => (
|
||||||
|
<Stack horizontal {...columnProps}>
|
||||||
|
<Image {...backImageProps} src={RevertBackIcon} alt="back" onClick={() => setIsEntityValuePanelFalse()} />
|
||||||
|
<Label>{entityAttributeProperty}</Label>
|
||||||
|
</Stack>
|
||||||
|
);
|
||||||
if (isEntityValuePanelOpen) {
|
if (isEntityValuePanelOpen) {
|
||||||
return (
|
return (
|
||||||
<Stack style={{ padding: "20px 34px" }}>
|
<PanelContainerComponent
|
||||||
<Stack horizontal {...columnProps}>
|
headerText=""
|
||||||
<Image {...backImageProps} src={RevertBackIcon} alt="back" onClick={() => setIsEntityValuePanelFalse()} />
|
onRenderNavigationContent={onRenderNavigationContent}
|
||||||
<Label>{entityAttributeProperty}</Label>
|
panelWidth="700px"
|
||||||
</Stack>
|
isOpen={true}
|
||||||
<TextField
|
panelContent={
|
||||||
multiline
|
<TextField
|
||||||
rows={5}
|
multiline
|
||||||
value={entityAttributeValue}
|
rows={5}
|
||||||
onChange={(event, newInput?: string) => {
|
className="entityValueTextField"
|
||||||
setEntityAttributeValue(newInput);
|
value={entityAttributeValue}
|
||||||
entityChange(newInput, selectedRow, "value");
|
onChange={(event, newInput?: string) => {
|
||||||
}}
|
setEntityAttributeValue(newInput);
|
||||||
/>
|
entityChange(newInput, selectedRow, "value");
|
||||||
</Stack>
|
}}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
isConsoleExpanded={false}
|
||||||
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const props: RightPaneFormProps = {
|
|
||||||
formError,
|
|
||||||
isExecuting,
|
|
||||||
submitButtonText: "Update",
|
|
||||||
onSubmit,
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<RightPaneForm {...props}>
|
<PanelContainerComponent
|
||||||
<div className="panelMainContent">
|
headerText="Edit Table Entity"
|
||||||
{entities.map((entity, index) => {
|
panelWidth="700px"
|
||||||
return (
|
isOpen={true}
|
||||||
<TableEntity
|
panelContent={renderPanelContent()}
|
||||||
key={"" + entity.id + index}
|
isConsoleExpanded={false}
|
||||||
isDeleteOptionVisible={entity.isDeleteOptionVisible}
|
/>
|
||||||
entityTypeLabel={index === 0 && dataTypeLabel}
|
|
||||||
entityPropertyLabel={index === 0 && attributeNameLabel}
|
|
||||||
entityValueLabel={index === 0 && attributeValueLabel}
|
|
||||||
options={userContext.apiType === "Cassandra" ? cassandraOptions : options}
|
|
||||||
isPropertyTypeDisable={entity.isPropertyTypeDisable}
|
|
||||||
entityProperty={entity.property}
|
|
||||||
selectedKey={entity.type}
|
|
||||||
entityPropertyPlaceHolder={detailedHelp}
|
|
||||||
entityValuePlaceholder={entity.entityValuePlaceholder}
|
|
||||||
entityValue={entity.value?.toString()}
|
|
||||||
isEntityTypeDate={entity.isEntityTypeDate}
|
|
||||||
entityTimeValue={entity.entityTimeValue}
|
|
||||||
isEntityValueDisable={entity.isEntityValueDisable}
|
|
||||||
onEditEntity={() => editEntity(index)}
|
|
||||||
onSelectDate={(date: Date) => {
|
|
||||||
entityChange(date, index, "value");
|
|
||||||
}}
|
|
||||||
onDeleteEntity={() => deleteEntityAtIndex(index)}
|
|
||||||
onEntityPropertyChange={(event, newInput?: string) => {
|
|
||||||
entityChange(newInput, index, "property");
|
|
||||||
}}
|
|
||||||
onEntityTypeChange={(event: React.FormEvent<HTMLDivElement>, selectedParam: IDropdownOption) => {
|
|
||||||
entityTypeChange(event, selectedParam, index);
|
|
||||||
}}
|
|
||||||
onEntityValueChange={(event, newInput?: string) => {
|
|
||||||
entityChange(newInput, index, "value");
|
|
||||||
}}
|
|
||||||
onEntityTimeValueChange={(event, newInput?: string) => {
|
|
||||||
entityChange(newInput, index, "time");
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
{userContext.apiType !== "Cassandra" && (
|
|
||||||
<Stack horizontal onClick={addNewEntity} className="addButtonEntiy">
|
|
||||||
<Image {...imageProps} src={AddPropertyIcon} alt="Add Entity" />
|
|
||||||
<Text className="addNewParamStyle">{getAddButtonLabel(userContext.apiType)}</Text>
|
|
||||||
</Stack>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
</RightPaneForm>
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ export const int64Placeholder = "Enter a signed 64-bit integer, in the range (-2
|
|||||||
|
|
||||||
export const columnProps: Partial<IStackProps> = {
|
export const columnProps: Partial<IStackProps> = {
|
||||||
tokens: { childrenGap: 10 },
|
tokens: { childrenGap: 10 },
|
||||||
styles: { root: { marginBottom: 8 } },
|
styles: { root: { width: 680, marginBottom: 8 } },
|
||||||
};
|
};
|
||||||
|
|
||||||
// helper functions
|
// helper functions
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -158,8 +158,7 @@ export default class QueryTablesTab extends TabsBase {
|
|||||||
queryTablesTab={this}
|
queryTablesTab={this}
|
||||||
tableEntityListViewModel={this.tableEntityListViewModel()}
|
tableEntityListViewModel={this.tableEntityListViewModel()}
|
||||||
cassandraApiClient={new CassandraAPIDataClient()}
|
cassandraApiClient={new CassandraAPIDataClient()}
|
||||||
/>,
|
/>
|
||||||
"700px"
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,35 @@
|
|||||||
|
import { shallow } from "enzyme";
|
||||||
|
import React from "react";
|
||||||
|
import * as DataModels from "../../Contracts/DataModels";
|
||||||
|
import * as ViewModels from "../../Contracts/ViewModels";
|
||||||
|
import { TreeComponent, TreeComponentProps, TreeNode } from "../Controls/TreeComponent/TreeComponent";
|
||||||
|
import Explorer from "../Explorer";
|
||||||
|
import { useDatabases } from "../useDatabases";
|
||||||
|
import ResourceTokenCollection from "./ResourceTokenCollection";
|
||||||
|
import { ResourceTreeAdapterForResourceToken } from "./ResourceTreeAdapterForResourceToken";
|
||||||
|
|
||||||
|
describe("Resource tree for resource token", () => {
|
||||||
|
const mockContainer = {} as Explorer;
|
||||||
|
const resourceTree = new ResourceTreeAdapterForResourceToken(mockContainer);
|
||||||
|
const mockCollection = {
|
||||||
|
_rid: "fakeRid",
|
||||||
|
_self: "fakeSelf",
|
||||||
|
id: "fakeId",
|
||||||
|
} as DataModels.Collection;
|
||||||
|
const mockResourceTokenCollection: ViewModels.CollectionBase = new ResourceTokenCollection(
|
||||||
|
mockContainer,
|
||||||
|
"fakeDatabaseId",
|
||||||
|
mockCollection
|
||||||
|
);
|
||||||
|
useDatabases.setState({ resourceTokenCollection: mockResourceTokenCollection });
|
||||||
|
|
||||||
|
it("should render", () => {
|
||||||
|
const rootNode: TreeNode = resourceTree.buildCollectionNode();
|
||||||
|
const props: TreeComponentProps = {
|
||||||
|
rootNode,
|
||||||
|
className: "dataResourceTree",
|
||||||
|
};
|
||||||
|
const wrapper = shallow(<TreeComponent {...props} />);
|
||||||
|
expect(wrapper).toMatchSnapshot();
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -1,18 +1,45 @@
|
|||||||
import React from "react";
|
import * as ko from "knockout";
|
||||||
|
import * as React from "react";
|
||||||
import CollectionIcon from "../../../images/tree-collection.svg";
|
import CollectionIcon from "../../../images/tree-collection.svg";
|
||||||
|
import { ReactAdapter } from "../../Bindings/ReactBindingHandler";
|
||||||
import * as ViewModels from "../../Contracts/ViewModels";
|
import * as ViewModels from "../../Contracts/ViewModels";
|
||||||
import { useTabs } from "../../hooks/useTabs";
|
import { useTabs } from "../../hooks/useTabs";
|
||||||
import { userContext } from "../../UserContext";
|
import { userContext } from "../../UserContext";
|
||||||
import { TreeComponent, TreeNode } from "../Controls/TreeComponent/TreeComponent";
|
import { TreeComponent, TreeNode } from "../Controls/TreeComponent/TreeComponent";
|
||||||
|
import Explorer from "../Explorer";
|
||||||
import { useCommandBar } from "../Menus/CommandBar/CommandBarComponentAdapter";
|
import { useCommandBar } from "../Menus/CommandBar/CommandBarComponentAdapter";
|
||||||
import { mostRecentActivity } from "../MostRecentActivity/MostRecentActivity";
|
import { mostRecentActivity } from "../MostRecentActivity/MostRecentActivity";
|
||||||
|
import { NotebookContentItem } from "../Notebook/NotebookContentItem";
|
||||||
import { useDatabases } from "../useDatabases";
|
import { useDatabases } from "../useDatabases";
|
||||||
import { useSelectedNode } from "../useSelectedNode";
|
import { useSelectedNode } from "../useSelectedNode";
|
||||||
|
|
||||||
export const ResourceTokenTree: React.FC = (): JSX.Element => {
|
export class ResourceTreeAdapterForResourceToken implements ReactAdapter {
|
||||||
const collection = useDatabases((state) => state.resourceTokenCollection);
|
public parameters: ko.Observable<number>;
|
||||||
|
public myNotebooksContentRoot: NotebookContentItem;
|
||||||
|
|
||||||
const buildCollectionNode = (): TreeNode => {
|
public constructor(private container: Explorer) {
|
||||||
|
this.parameters = ko.observable(Date.now());
|
||||||
|
|
||||||
|
useDatabases.subscribe(
|
||||||
|
() => this.triggerRender(),
|
||||||
|
(state) => state.resourceTokenCollection
|
||||||
|
);
|
||||||
|
useSelectedNode.subscribe(() => this.triggerRender());
|
||||||
|
useTabs.subscribe(
|
||||||
|
() => this.triggerRender(),
|
||||||
|
(state) => state.activeTab
|
||||||
|
);
|
||||||
|
|
||||||
|
this.triggerRender();
|
||||||
|
}
|
||||||
|
|
||||||
|
public renderComponent(): JSX.Element {
|
||||||
|
const dataRootNode = this.buildCollectionNode();
|
||||||
|
return <TreeComponent className="dataResourceTree" rootNode={dataRootNode} />;
|
||||||
|
}
|
||||||
|
|
||||||
|
public buildCollectionNode(): TreeNode {
|
||||||
|
const collection: ViewModels.CollectionBase = useDatabases.getState().resourceTokenCollection;
|
||||||
if (!collection) {
|
if (!collection) {
|
||||||
return {
|
return {
|
||||||
label: undefined,
|
label: undefined,
|
||||||
@@ -59,7 +86,9 @@ export const ResourceTokenTree: React.FC = (): JSX.Element => {
|
|||||||
isExpanded: true,
|
isExpanded: true,
|
||||||
children: [collectionNode],
|
children: [collectionNode],
|
||||||
};
|
};
|
||||||
};
|
}
|
||||||
|
|
||||||
return <TreeComponent className="dataResourceTree" rootNode={buildCollectionNode()} />;
|
public triggerRender() {
|
||||||
};
|
window.requestAnimationFrame(() => this.parameters(Date.now()));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
|
exports[`Resource tree for resource token should render 1`] = `
|
||||||
|
<div
|
||||||
|
className="treeComponent dataResourceTree"
|
||||||
|
role="tree"
|
||||||
|
>
|
||||||
|
<TreeNodeComponent
|
||||||
|
generation={0}
|
||||||
|
node={
|
||||||
|
Object {
|
||||||
|
"children": Array [
|
||||||
|
Object {
|
||||||
|
"children": Array [
|
||||||
|
Object {
|
||||||
|
"isSelected": [Function],
|
||||||
|
"label": "Items",
|
||||||
|
"onClick": [Function],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
"className": "collectionHeader",
|
||||||
|
"iconSrc": "",
|
||||||
|
"isExpanded": true,
|
||||||
|
"isSelected": [Function],
|
||||||
|
"label": "fakeId",
|
||||||
|
"onClick": [Function],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
"isExpanded": true,
|
||||||
|
"label": undefined,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
paddingLeft={0}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
@@ -2,7 +2,6 @@ import _ from "underscore";
|
|||||||
import create, { UseStore } from "zustand";
|
import create, { UseStore } from "zustand";
|
||||||
import * as Constants from "../Common/Constants";
|
import * as Constants from "../Common/Constants";
|
||||||
import * as ViewModels from "../Contracts/ViewModels";
|
import * as ViewModels from "../Contracts/ViewModels";
|
||||||
import { userContext } from "../UserContext";
|
|
||||||
import { useSelectedNode } from "./useSelectedNode";
|
import { useSelectedNode } from "./useSelectedNode";
|
||||||
|
|
||||||
interface DatabasesState {
|
interface DatabasesState {
|
||||||
@@ -20,8 +19,6 @@ interface DatabasesState {
|
|||||||
loadDatabaseOffers: () => Promise<void>;
|
loadDatabaseOffers: () => Promise<void>;
|
||||||
isFirstResourceCreated: () => boolean;
|
isFirstResourceCreated: () => boolean;
|
||||||
findSelectedDatabase: () => ViewModels.Database;
|
findSelectedDatabase: () => ViewModels.Database;
|
||||||
validateDatabaseId: (id: string) => boolean;
|
|
||||||
validateCollectionId: (databaseId: string, collectionId: string) => Promise<boolean>;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const useDatabases: UseStore<DatabasesState> = create((set, get) => ({
|
export const useDatabases: UseStore<DatabasesState> = create((set, get) => ({
|
||||||
@@ -132,17 +129,4 @@ export const useDatabases: UseStore<DatabasesState> = create((set, get) => ({
|
|||||||
|
|
||||||
return selectedNode.collection?.database;
|
return selectedNode.collection?.database;
|
||||||
},
|
},
|
||||||
validateDatabaseId: (id: string): boolean => {
|
|
||||||
return !get().databases.some((database) => database.id() === id);
|
|
||||||
},
|
|
||||||
validateCollectionId: async (databaseId: string, collectionId: string): Promise<boolean> => {
|
|
||||||
const database = get().databases.find((db) => db.id() === databaseId);
|
|
||||||
// For a new tables account, database is undefined when creating the first table
|
|
||||||
if (!database && userContext.apiType === "Tables") {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
await database.loadCollections();
|
|
||||||
return !database.collections().some((collection) => collection.id() === collectionId);
|
|
||||||
},
|
|
||||||
}));
|
}));
|
||||||
|
|||||||
23
src/Index.ts
Normal file
23
src/Index.ts
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
import "../less/index.less";
|
||||||
|
import "./Libs/jquery";
|
||||||
|
|
||||||
|
import * as ko from "knockout";
|
||||||
|
|
||||||
|
class Index {
|
||||||
|
public navigationSelection: ko.Observable<string>;
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
this.navigationSelection = ko.observable("quickstart");
|
||||||
|
}
|
||||||
|
|
||||||
|
public quickstart_click() {
|
||||||
|
this.navigationSelection("quickstart");
|
||||||
|
}
|
||||||
|
|
||||||
|
public explorer_click() {
|
||||||
|
this.navigationSelection("explorer");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var index = new Index();
|
||||||
|
ko.applyBindings(index);
|
||||||
@@ -1,66 +0,0 @@
|
|||||||
import React, { useState } from "react";
|
|
||||||
import ReactDOM from "react-dom";
|
|
||||||
import Arrow from "../images/Arrow.svg";
|
|
||||||
import CosmosDB_20170829 from "../images/CosmosDB_20170829.svg";
|
|
||||||
import Explorer from "../images/Explorer.svg";
|
|
||||||
import Feedback from "../images/Feedback.svg";
|
|
||||||
import Quickstart from "../images/Quickstart.svg";
|
|
||||||
import "../less/index.less";
|
|
||||||
|
|
||||||
const Index = (): JSX.Element => {
|
|
||||||
const [navigationSelection, setNavigationSelection] = useState("quickstart");
|
|
||||||
|
|
||||||
const quickstart_click = () => {
|
|
||||||
setNavigationSelection("quickstart");
|
|
||||||
};
|
|
||||||
|
|
||||||
const explorer_click = () => {
|
|
||||||
setNavigationSelection("explorer");
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
|
||||||
<React.Fragment>
|
|
||||||
<header className="header HeaderBg">
|
|
||||||
<div className="items">
|
|
||||||
<img className="DocDBicon" src={CosmosDB_20170829} alt="Azure Cosmos DB" />
|
|
||||||
<a className="createdocdbacnt" href="https://aka.ms/documentdbcreate" rel="noreferrer" target="_blank">
|
|
||||||
Create an Azure Cosmos DB account <img className="rightarrowimg" src={Arrow} alt="" />
|
|
||||||
</a>
|
|
||||||
<span className="title">Azure Cosmos DB Emulator</span>
|
|
||||||
</div>
|
|
||||||
</header>
|
|
||||||
<nav className="fixedleftpane">
|
|
||||||
<div
|
|
||||||
id="Quickstart"
|
|
||||||
onClick={quickstart_click}
|
|
||||||
className={navigationSelection === "quickstart" ? "topSelected" : ""}
|
|
||||||
>
|
|
||||||
<img id="imgiconwidth1" src={Quickstart} alt="Open Quick Start" />
|
|
||||||
<span className="menuQuickStart">Quickstart</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="Explorer" onClick={explorer_click} className={navigationSelection === "explorer" ? "topSelected" : ""}>
|
|
||||||
<img id="imgiconwidth1" src={Explorer} alt="Open Data Explorer" />
|
|
||||||
<span className="menuExplorer">Explorer</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div>
|
|
||||||
<a className="feedbackstyle" href="https://aka.ms/cosmosdbfeedback?subject=Cosmos%20DB%20Emulator%20Feedback">
|
|
||||||
<img id="imgiconwidth1" src={Feedback} alt="Report Issue" />
|
|
||||||
<span className="menuExplorer">Report Issue</span>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</nav>
|
|
||||||
|
|
||||||
{navigationSelection === "quickstart" && (
|
|
||||||
<iframe name="quickstart" className="iframe" src="quickstart.html"></iframe>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{navigationSelection === "explorer" && (
|
|
||||||
<iframe name="explorer" className="iframe" src="explorer.html?platform=Emulator"></iframe>
|
|
||||||
)}
|
|
||||||
</React.Fragment>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
ReactDOM.render(<Index />, document.getElementById("root"));
|
|
||||||
@@ -40,7 +40,7 @@
|
|||||||
"CosmosD4Details": "General Purpose Cosmos Compute with 4 vCPUs, 16 GB Memory",
|
"CosmosD4Details": "General Purpose Cosmos Compute with 4 vCPUs, 16 GB Memory",
|
||||||
"CosmosD8Details": "General Purpose Cosmos Compute with 8 vCPUs, 32 GB Memory",
|
"CosmosD8Details": "General Purpose Cosmos Compute with 8 vCPUs, 32 GB Memory",
|
||||||
"CosmosD16Details": "General Purpose Cosmos Compute with 16 vCPUs, 64 GB Memory",
|
"CosmosD16Details": "General Purpose Cosmos Compute with 16 vCPUs, 64 GB Memory",
|
||||||
"ApproximateCost": "Approximate Cost Per Hour",
|
"Cost": "Cost",
|
||||||
"CostText": "Hourly cost of the dedicated gateway resource depends on the SKU selection, number of instances per region, and number of regions.",
|
"CostText": "Hourly cost of the dedicated gateway resource depends on the SKU selection, number of instances per region, and number of regions.",
|
||||||
"ConnectionString": "Connection String",
|
"ConnectionString": "Connection String",
|
||||||
"ConnectionStringText": "To use the dedicated gateway, use the connection string shown in ",
|
"ConnectionStringText": "To use the dedicated gateway, use the connection string shown in ",
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* @module SelfServe/Decorators
|
* @module SelfServe/Decorators
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { ChoiceItem, Description, Info, NumberUiType, OnChangeCallback, RefreshParams } from "./SelfServeTypes";
|
import { ChoiceItem, Description, Info, NumberUiType, OnChangeCallback, RefreshParams, Style } from "./SelfServeTypes";
|
||||||
import { addPropertyToMap, buildSmartUiDescriptor, DecoratorProperties } from "./SelfServeUtils";
|
import { addPropertyToMap, buildSmartUiDescriptor, DecoratorProperties } from "./SelfServeUtils";
|
||||||
|
|
||||||
type ValueOf<T> = T[keyof T];
|
type ValueOf<T> = T[keyof T];
|
||||||
@@ -162,6 +162,14 @@ export const PropertyInfo = (info: (() => Promise<Info>) | Info): PropertyDecora
|
|||||||
return addToMap({ name: "info", value: info });
|
return addToMap({ name: "info", value: info });
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates that the UI element corresponding to the property should have an Info bubble. The Info
|
||||||
|
* bubble is the icon that looks like an "i" which users click on to get more information about the UI element.
|
||||||
|
*/
|
||||||
|
export const Styles = (style: (() => Promise<Style>) | Style): PropertyDecorator => {
|
||||||
|
return addToMap({ name: "style", value: style });
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicates that this property should correspond to a UI element with the given parameters.
|
* Indicates that this property should correspond to a UI element with the given parameters.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { IsDisplayable, OnChange, PropertyInfo, RefreshOptions, Values } from "../Decorators";
|
import { IsDisplayable, OnChange, PropertyInfo, RefreshOptions, Styles, Values } from "../Decorators";
|
||||||
import { selfServeTraceStart, selfServeTraceSuccess } from "../SelfServeTelemetryProcessor";
|
import { selfServeTraceStart, selfServeTraceSuccess } from "../SelfServeTelemetryProcessor";
|
||||||
import {
|
import {
|
||||||
ChoiceItem,
|
ChoiceItem,
|
||||||
@@ -10,7 +10,7 @@ import {
|
|||||||
OnSaveResult,
|
OnSaveResult,
|
||||||
RefreshResult,
|
RefreshResult,
|
||||||
SelfServeBaseClass,
|
SelfServeBaseClass,
|
||||||
SmartUiInput,
|
SmartUiInput
|
||||||
} from "../SelfServeTypes";
|
} from "../SelfServeTypes";
|
||||||
import {
|
import {
|
||||||
getMaxCollectionThroughput,
|
getMaxCollectionThroughput,
|
||||||
@@ -19,7 +19,7 @@ import {
|
|||||||
getMinDatabaseThroughput,
|
getMinDatabaseThroughput,
|
||||||
initialize,
|
initialize,
|
||||||
onRefreshSelfServeExample,
|
onRefreshSelfServeExample,
|
||||||
update,
|
update
|
||||||
} from "./SelfServeExample.rp";
|
} from "./SelfServeExample.rp";
|
||||||
import { AccountProps, Regions } from "./SelfServeExample.types";
|
import { AccountProps, Regions } from "./SelfServeExample.types";
|
||||||
|
|
||||||
@@ -203,6 +203,20 @@ export default class SelfServeExample extends SelfServeBaseClass {
|
|||||||
})
|
})
|
||||||
enableLogging: boolean;
|
enableLogging: boolean;
|
||||||
|
|
||||||
|
@Styles({ isFloatRight: true })
|
||||||
|
@Values({
|
||||||
|
labelTKey: "DescriptionLabel",
|
||||||
|
description: {
|
||||||
|
textTKey: "DescriptionText",
|
||||||
|
type: DescriptionType.Card,
|
||||||
|
link: {
|
||||||
|
href: "https://aka.ms/cosmos-create-account-portal",
|
||||||
|
textTKey: "DecriptionLinkText",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
rightDescription: string;
|
||||||
|
|
||||||
@Values({
|
@Values({
|
||||||
labelTKey: "Account Name",
|
labelTKey: "Account Name",
|
||||||
placeholderTKey: "AccountNamePlaceHolder",
|
placeholderTKey: "AccountNamePlaceHolder",
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import {
|
|||||||
Spinner,
|
Spinner,
|
||||||
SpinnerSize,
|
SpinnerSize,
|
||||||
Stack,
|
Stack,
|
||||||
Text,
|
Text
|
||||||
} from "@fluentui/react";
|
} from "@fluentui/react";
|
||||||
import { TFunction } from "i18next";
|
import { TFunction } from "i18next";
|
||||||
import promiseRetry, { AbortError } from "p-retry";
|
import promiseRetry, { AbortError } from "p-retry";
|
||||||
@@ -32,7 +32,7 @@ import {
|
|||||||
SelfServeComponentTelemetryType,
|
SelfServeComponentTelemetryType,
|
||||||
SelfServeDescriptor,
|
SelfServeDescriptor,
|
||||||
SmartUiInput,
|
SmartUiInput,
|
||||||
StringInput,
|
StringInput
|
||||||
} from "./SelfServeTypes";
|
} from "./SelfServeTypes";
|
||||||
|
|
||||||
interface SelfServeNotification {
|
interface SelfServeNotification {
|
||||||
@@ -186,6 +186,7 @@ export class SelfServeComponent extends React.Component<SelfServeComponentProps,
|
|||||||
baselineValues: Map<string, SmartUiInput>
|
baselineValues: Map<string, SmartUiInput>
|
||||||
): Promise<void> => {
|
): Promise<void> => {
|
||||||
currentNode.info = await this.getResolvedValue(currentNode.info);
|
currentNode.info = await this.getResolvedValue(currentNode.info);
|
||||||
|
currentNode.style = await this.getResolvedValue(currentNode.style);
|
||||||
|
|
||||||
if (currentNode.input) {
|
if (currentNode.input) {
|
||||||
currentNode.input = await this.getResolvedInput(currentNode.input, currentValues, baselineValues);
|
currentNode.input = await this.getResolvedInput(currentNode.input, currentValues, baselineValues);
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ export interface Node {
|
|||||||
info?: (() => Promise<Info>) | Info;
|
info?: (() => Promise<Info>) | Info;
|
||||||
input?: AnyDisplay;
|
input?: AnyDisplay;
|
||||||
children?: Node[];
|
children?: Node[];
|
||||||
|
style?: (() => Promise<Style>) | Style;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**@internal */
|
/**@internal */
|
||||||
@@ -82,6 +83,13 @@ export type AnyDisplay = NumberInput | BooleanInput | StringInput | ChoiceInput
|
|||||||
/**@internal */
|
/**@internal */
|
||||||
export type InputTypeValue = "number" | "string" | "boolean" | "object";
|
export type InputTypeValue = "number" | "string" | "boolean" | "object";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Describes the styling of the UI element.
|
||||||
|
*/
|
||||||
|
export interface Style {
|
||||||
|
isFloatRight: boolean
|
||||||
|
}
|
||||||
|
|
||||||
export type initializeCallback =
|
export type initializeCallback =
|
||||||
/**
|
/**
|
||||||
* @returns Promise of Map of propertyName => {@linkcode SmartUiInput} which will become the current state of the UI.
|
* @returns Promise of Map of propertyName => {@linkcode SmartUiInput} which will become the current state of the UI.
|
||||||
@@ -228,6 +236,7 @@ export enum DescriptionType {
|
|||||||
* Show the description as a Warning Message bar.
|
* Show the description as a Warning Message bar.
|
||||||
*/
|
*/
|
||||||
WarningMessageBar,
|
WarningMessageBar,
|
||||||
|
Card
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import {
|
|||||||
SelfServeDescriptor,
|
SelfServeDescriptor,
|
||||||
SmartUiInput,
|
SmartUiInput,
|
||||||
StringInput,
|
StringInput,
|
||||||
|
Style
|
||||||
} from "./SelfServeTypes";
|
} from "./SelfServeTypes";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -92,6 +93,7 @@ export interface DecoratorProperties {
|
|||||||
description?: (() => Promise<Description>) | Description;
|
description?: (() => Promise<Description>) | Description;
|
||||||
isDynamicDescription?: boolean;
|
isDynamicDescription?: boolean;
|
||||||
refreshParams?: RefreshParams;
|
refreshParams?: RefreshParams;
|
||||||
|
style?: (() => Promise<Style>) | Style;
|
||||||
onChange?: (
|
onChange?: (
|
||||||
newValue: InputType,
|
newValue: InputType,
|
||||||
currentState: Map<string, SmartUiInput>,
|
currentState: Map<string, SmartUiInput>,
|
||||||
@@ -197,6 +199,7 @@ const addToDescriptor = (
|
|||||||
info: value.info,
|
info: value.info,
|
||||||
input: getInput(value),
|
input: getInput(value),
|
||||||
children: [],
|
children: [],
|
||||||
|
style: value.style
|
||||||
} as Node;
|
} as Node;
|
||||||
context.delete(key);
|
context.delete(key);
|
||||||
root.children.push(element);
|
root.children.push(element);
|
||||||
|
|||||||
@@ -4,12 +4,7 @@ import { armRequestWithoutPolling } from "../../Utils/arm/request";
|
|||||||
import { selfServeTraceFailure, selfServeTraceStart, selfServeTraceSuccess } from "../SelfServeTelemetryProcessor";
|
import { selfServeTraceFailure, selfServeTraceStart, selfServeTraceSuccess } from "../SelfServeTelemetryProcessor";
|
||||||
import { RefreshResult } from "../SelfServeTypes";
|
import { RefreshResult } from "../SelfServeTypes";
|
||||||
import SqlX from "./SqlX";
|
import SqlX from "./SqlX";
|
||||||
import {
|
import { SqlxServiceResource, UpdateDedicatedGatewayRequestParameters } from "./SqlxTypes";
|
||||||
FetchPricesResponse,
|
|
||||||
RegionsResponse,
|
|
||||||
SqlxServiceResource,
|
|
||||||
UpdateDedicatedGatewayRequestParameters,
|
|
||||||
} from "./SqlxTypes";
|
|
||||||
|
|
||||||
const apiVersion = "2021-04-01-preview";
|
const apiVersion = "2021-04-01-preview";
|
||||||
|
|
||||||
@@ -133,67 +128,3 @@ export const refreshDedicatedGatewayProvisioning = async (): Promise<RefreshResu
|
|||||||
return { isUpdateInProgress: false, updateInProgressMessageTKey: undefined };
|
return { isUpdateInProgress: false, updateInProgressMessageTKey: undefined };
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const getGeneralPath = (subscriptionId: string, resourceGroup: string, name: string): string => {
|
|
||||||
return `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroup}/providers/Microsoft.DocumentDB/databaseAccounts/${name}`;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getReadRegions = async (): Promise<Array<string>> => {
|
|
||||||
try {
|
|
||||||
const readRegions = new Array<string>();
|
|
||||||
|
|
||||||
const response = await armRequestWithoutPolling<RegionsResponse>({
|
|
||||||
host: configContext.ARM_ENDPOINT,
|
|
||||||
path: getGeneralPath(userContext.subscriptionId, userContext.resourceGroup, userContext.databaseAccount.name),
|
|
||||||
method: "GET",
|
|
||||||
apiVersion: "2021-04-01-preview",
|
|
||||||
});
|
|
||||||
|
|
||||||
if (response.result.location !== undefined) {
|
|
||||||
readRegions.push(response.result.location.replace(" ", "").toLowerCase());
|
|
||||||
} else {
|
|
||||||
for (const location of response.result.locations) {
|
|
||||||
readRegions.push(location.locationName.replace(" ", "").toLowerCase());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return readRegions;
|
|
||||||
} catch (err) {
|
|
||||||
return new Array<string>();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const getFetchPricesPathForRegion = (subscriptionId: string): string => {
|
|
||||||
return `/subscriptions/${subscriptionId}/providers/Microsoft.CostManagement/fetchPrices`;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getPriceMap = async (regions: Array<string>): Promise<Map<string, Map<string, number>>> => {
|
|
||||||
try {
|
|
||||||
const priceMap = new Map<string, Map<string, number>>();
|
|
||||||
|
|
||||||
for (const region of regions) {
|
|
||||||
const regionPriceMap = new Map<string, number>();
|
|
||||||
|
|
||||||
const response = await armRequestWithoutPolling<FetchPricesResponse>({
|
|
||||||
host: configContext.ARM_ENDPOINT,
|
|
||||||
path: getFetchPricesPathForRegion(userContext.subscriptionId),
|
|
||||||
method: "POST",
|
|
||||||
apiVersion: "2020-01-01-preview",
|
|
||||||
queryParams: {
|
|
||||||
filter:
|
|
||||||
"armRegionName eq '" +
|
|
||||||
region +
|
|
||||||
"' and serviceFamily eq 'Databases' and productName eq 'Azure Cosmos DB Dedicated Gateway - General Purpose'",
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
for (const item of response.result.Items) {
|
|
||||||
regionPriceMap.set(item.skuName, item.retailPrice);
|
|
||||||
}
|
|
||||||
priceMap.set(region, regionPriceMap);
|
|
||||||
}
|
|
||||||
|
|
||||||
return priceMap;
|
|
||||||
} catch (err) {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|||||||
@@ -1,30 +1,27 @@
|
|||||||
import { IsDisplayable, OnChange, PropertyInfo, RefreshOptions, Values } from "../Decorators";
|
import { IsDisplayable, OnChange, PropertyInfo, RefreshOptions, Styles, Values } from "../Decorators";
|
||||||
import { selfServeTrace } from "../SelfServeTelemetryProcessor";
|
import { selfServeTrace } from "../SelfServeTelemetryProcessor";
|
||||||
import {
|
import {
|
||||||
ChoiceItem,
|
ChoiceItem,
|
||||||
Description,
|
Description,
|
||||||
DescriptionType,
|
DescriptionType, Info,
|
||||||
Info,
|
|
||||||
InputType,
|
InputType,
|
||||||
NumberUiType,
|
NumberUiType,
|
||||||
OnSaveResult,
|
OnSaveResult,
|
||||||
RefreshResult,
|
RefreshResult,
|
||||||
SelfServeBaseClass,
|
SelfServeBaseClass,
|
||||||
SmartUiInput,
|
SmartUiInput
|
||||||
} from "../SelfServeTypes";
|
} from "../SelfServeTypes";
|
||||||
import { BladeType, generateBladeLink } from "../SelfServeUtils";
|
import { BladeType, generateBladeLink } from "../SelfServeUtils";
|
||||||
import {
|
import {
|
||||||
deleteDedicatedGatewayResource,
|
deleteDedicatedGatewayResource,
|
||||||
getCurrentProvisioningState,
|
getCurrentProvisioningState,
|
||||||
getPriceMap,
|
|
||||||
getReadRegions,
|
|
||||||
refreshDedicatedGatewayProvisioning,
|
refreshDedicatedGatewayProvisioning,
|
||||||
updateDedicatedGatewayResource,
|
updateDedicatedGatewayResource
|
||||||
} from "./SqlX.rp";
|
} from "./SqlX.rp";
|
||||||
|
|
||||||
const costPerHourDefaultValue: Description = {
|
const costPerHourValue: Description = {
|
||||||
textTKey: "CostText",
|
textTKey: "CostText",
|
||||||
type: DescriptionType.Text,
|
type: DescriptionType.Card,
|
||||||
link: {
|
link: {
|
||||||
href: "https://aka.ms/cosmos-db-dedicated-gateway-pricing",
|
href: "https://aka.ms/cosmos-db-dedicated-gateway-pricing",
|
||||||
textTKey: "DedicatedGatewayPricing",
|
textTKey: "DedicatedGatewayPricing",
|
||||||
@@ -55,10 +52,7 @@ const CosmosD16s = "Cosmos.D16s";
|
|||||||
|
|
||||||
const onSKUChange = (newValue: InputType, currentValues: Map<string, SmartUiInput>): Map<string, SmartUiInput> => {
|
const onSKUChange = (newValue: InputType, currentValues: Map<string, SmartUiInput>): Map<string, SmartUiInput> => {
|
||||||
currentValues.set("sku", { value: newValue });
|
currentValues.set("sku", { value: newValue });
|
||||||
currentValues.set("costPerHour", {
|
currentValues.set("costPerHour", { value: costPerHourValue });
|
||||||
value: calculateCost(newValue as string, currentValues.get("instances").value as number),
|
|
||||||
});
|
|
||||||
|
|
||||||
return currentValues;
|
return currentValues;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -84,11 +78,6 @@ const onNumberOfInstancesChange = (
|
|||||||
} else {
|
} else {
|
||||||
currentValues.set("warningBanner", undefined);
|
currentValues.set("warningBanner", undefined);
|
||||||
}
|
}
|
||||||
|
|
||||||
currentValues.set("costPerHour", {
|
|
||||||
value: calculateCost(currentValues.get("sku").value as string, newValue as number),
|
|
||||||
});
|
|
||||||
|
|
||||||
return currentValues;
|
return currentValues;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -121,11 +110,6 @@ const onEnableDedicatedGatewayChange = (
|
|||||||
} as Description,
|
} as Description,
|
||||||
hidden: false,
|
hidden: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
currentValues.set("costPerHour", {
|
|
||||||
value: calculateCost(baselineValues.get("sku").value as string, baselineValues.get("instances").value as number),
|
|
||||||
hidden: false,
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
currentValues.set("warningBanner", {
|
currentValues.set("warningBanner", {
|
||||||
value: {
|
value: {
|
||||||
@@ -137,8 +121,6 @@ const onEnableDedicatedGatewayChange = (
|
|||||||
} as Description,
|
} as Description,
|
||||||
hidden: false,
|
hidden: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
currentValues.set("costPerHour", { value: costPerHourDefaultValue, hidden: true });
|
|
||||||
}
|
}
|
||||||
const sku = currentValues.get("sku");
|
const sku = currentValues.get("sku");
|
||||||
const instances = currentValues.get("instances");
|
const instances = currentValues.get("instances");
|
||||||
@@ -154,6 +136,7 @@ const onEnableDedicatedGatewayChange = (
|
|||||||
disabled: dedicatedGatewayOriginallyEnabled,
|
disabled: dedicatedGatewayOriginallyEnabled,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
currentValues.set("costPerHour", { value: costPerHourValue, hidden: hideAttributes });
|
||||||
currentValues.set("connectionString", {
|
currentValues.set("connectionString", {
|
||||||
value: connectionStringValue,
|
value: connectionStringValue,
|
||||||
hidden: !newValue || !dedicatedGatewayOriginallyEnabled,
|
hidden: !newValue || !dedicatedGatewayOriginallyEnabled,
|
||||||
@@ -193,40 +176,6 @@ const NumberOfInstancesDropdownInfo: Info = {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const ApproximateCostDropDownInfo: Info = {
|
|
||||||
messageTKey: "CostText",
|
|
||||||
link: {
|
|
||||||
href: "https://aka.ms/cosmos-db-dedicated-gateway-pricing",
|
|
||||||
textTKey: "DedicatedGatewayPricing",
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
let priceMap: Map<string, Map<string, number>>;
|
|
||||||
let regions: Array<string>;
|
|
||||||
|
|
||||||
const calculateCost = (skuName: string, instanceCount: number): Description => {
|
|
||||||
try {
|
|
||||||
let costPerHour = 0;
|
|
||||||
for (const region of regions) {
|
|
||||||
const incrementalCost = priceMap.get(region).get(skuName.replace("Cosmos.", ""));
|
|
||||||
if (incrementalCost === undefined) {
|
|
||||||
throw new Error("Value not found in map.");
|
|
||||||
}
|
|
||||||
costPerHour += incrementalCost;
|
|
||||||
}
|
|
||||||
|
|
||||||
costPerHour *= instanceCount;
|
|
||||||
costPerHour = Math.round(costPerHour * 100) / 100;
|
|
||||||
|
|
||||||
return {
|
|
||||||
textTKey: `${costPerHour} USD`,
|
|
||||||
type: DescriptionType.Text,
|
|
||||||
};
|
|
||||||
} catch (err) {
|
|
||||||
return costPerHourDefaultValue;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
@IsDisplayable()
|
@IsDisplayable()
|
||||||
@RefreshOptions({ retryIntervalInMs: 20000 })
|
@RefreshOptions({ retryIntervalInMs: 20000 })
|
||||||
export default class SqlX extends SelfServeBaseClass {
|
export default class SqlX extends SelfServeBaseClass {
|
||||||
@@ -324,15 +273,12 @@ export default class SqlX extends SelfServeBaseClass {
|
|||||||
hidden: true,
|
hidden: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
regions = await getReadRegions();
|
|
||||||
priceMap = await getPriceMap(regions);
|
|
||||||
|
|
||||||
const response = await getCurrentProvisioningState();
|
const response = await getCurrentProvisioningState();
|
||||||
if (response.status && response.status !== "Deleting") {
|
if (response.status && response.status !== "Deleting") {
|
||||||
defaults.set("enableDedicatedGateway", { value: true });
|
defaults.set("enableDedicatedGateway", { value: true });
|
||||||
defaults.set("sku", { value: response.sku, disabled: true });
|
defaults.set("sku", { value: response.sku, disabled: true });
|
||||||
defaults.set("instances", { value: response.instances, disabled: false });
|
defaults.set("instances", { value: response.instances, disabled: false });
|
||||||
defaults.set("costPerHour", { value: calculateCost(response.sku, response.instances) });
|
defaults.set("costPerHour", { value: costPerHourValue });
|
||||||
defaults.set("connectionString", {
|
defaults.set("connectionString", {
|
||||||
value: connectionStringValue,
|
value: connectionStringValue,
|
||||||
hidden: false,
|
hidden: false,
|
||||||
@@ -391,9 +337,9 @@ export default class SqlX extends SelfServeBaseClass {
|
|||||||
})
|
})
|
||||||
instances: number;
|
instances: number;
|
||||||
|
|
||||||
@PropertyInfo(ApproximateCostDropDownInfo)
|
@Styles({ isFloatRight: true })
|
||||||
@Values({
|
@Values({
|
||||||
labelTKey: "ApproximateCost",
|
labelTKey: "Cost",
|
||||||
isDynamicDescription: true,
|
isDynamicDescription: true,
|
||||||
})
|
})
|
||||||
costPerHour: string;
|
costPerHour: string;
|
||||||
|
|||||||
@@ -29,23 +29,3 @@ export type UpdateDedicatedGatewayRequestProperties = {
|
|||||||
instanceCount: number;
|
instanceCount: number;
|
||||||
serviceType: string;
|
serviceType: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type FetchPricesResponse = {
|
|
||||||
Items: Array<PriceItem>;
|
|
||||||
NextPageLink: string | undefined;
|
|
||||||
Count: number;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type PriceItem = {
|
|
||||||
retailPrice: number;
|
|
||||||
skuName: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type RegionsResponse = {
|
|
||||||
locations: Array<RegionItem>;
|
|
||||||
location: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type RegionItem = {
|
|
||||||
locationName: string;
|
|
||||||
};
|
|
||||||
|
|||||||
@@ -8,7 +8,54 @@
|
|||||||
|
|
||||||
<link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon" />
|
<link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon" />
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div id="root"></div>
|
<header class="header HeaderBg">
|
||||||
|
<div class="items">
|
||||||
|
<img class="DocDBicon" src="/CosmosDB_20170829.svg" alt="Azure Cosmos DB" />
|
||||||
|
<a class="createdocdbacnt" href="https://aka.ms/documentdbcreate" target="_blank">
|
||||||
|
Create an Azure Cosmos DB account <img class="rightarrowimg" src="/Arrow.svg" alt="" />
|
||||||
|
</a>
|
||||||
|
<span class="title">Azure Cosmos DB Emulator</span>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<nav class="fixedleftpane">
|
||||||
|
<div
|
||||||
|
id="Quickstart"
|
||||||
|
data-bind="click: quickstart_click, css:{ topSelected: navigationSelection() === 'quickstart' }"
|
||||||
|
>
|
||||||
|
<img id="imgiconwidth1" src="/Quickstart.svg" alt="Open Quick Start" />
|
||||||
|
<span class="menuQuickStart">Quickstart</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="Explorer" data-bind="click: explorer_click, css:{ topSelected: navigationSelection() === 'explorer' }">
|
||||||
|
<img id="imgiconwidth1" src="/Explorer.svg" alt="Open Data Explorer" />
|
||||||
|
<span class="menuExplorer">Explorer</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<a class="feedbackstyle" href="https://aka.ms/cosmosdbfeedback?subject=Cosmos%20DB%20Emulator%20Feedback">
|
||||||
|
<img id="imgiconwidth1" src="/Feedback.svg" alt="Report Issue" />
|
||||||
|
<span class="menuExplorer">Report Issue</span>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<iframe
|
||||||
|
name="quickstart"
|
||||||
|
class="iframe"
|
||||||
|
src="quickstart.html"
|
||||||
|
data-bind="visible: navigationSelection() === 'quickstart'"
|
||||||
|
>
|
||||||
|
</iframe>
|
||||||
|
|
||||||
|
<iframe
|
||||||
|
name="explorer"
|
||||||
|
class="iframe"
|
||||||
|
src="explorer.html?platform=Emulator"
|
||||||
|
data-bind="visible: navigationSelection() === 'explorer'"
|
||||||
|
>
|
||||||
|
</iframe>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -1,17 +1,17 @@
|
|||||||
import { jest } from "@jest/globals";
|
import { jest } from "@jest/globals";
|
||||||
import "expect-playwright";
|
import "expect-playwright";
|
||||||
import { generateUniqueName } from "../utils/shared";
|
import { generateUniqueName } from "../utils/shared";
|
||||||
import { waitForExplorer } from "../utils/waitForExplorer";
|
|
||||||
jest.setTimeout(120000);
|
jest.setTimeout(120000);
|
||||||
|
|
||||||
test("Cassandra keyspace and table CRUD", async () => {
|
test("Cassandra keyspace and table CRUD", async () => {
|
||||||
const keyspaceId = generateUniqueName("keyspace");
|
const keyspaceId = generateUniqueName("keyspace");
|
||||||
const tableId = generateUniqueName("table");
|
const tableId = generateUniqueName("table");
|
||||||
page.setDefaultTimeout(50000);
|
|
||||||
|
|
||||||
await page.goto("https://localhost:1234/testExplorer.html?accountName=portal-cassandra-runner");
|
await page.goto("https://localhost:1234/testExplorer.html?accountName=portal-cassandra-runner");
|
||||||
await page.waitForSelector("iframe");
|
await page.waitForSelector("iframe");
|
||||||
const explorer = await waitForExplorer();
|
const explorer = page.frame({
|
||||||
|
name: "explorer",
|
||||||
|
});
|
||||||
|
|
||||||
await explorer.click('[data-test="New Table"]');
|
await explorer.click('[data-test="New Table"]');
|
||||||
await explorer.click('[aria-label="Keyspace id"]');
|
await explorer.click('[aria-label="Keyspace id"]');
|
||||||
@@ -19,7 +19,7 @@ test("Cassandra keyspace and table CRUD", async () => {
|
|||||||
await explorer.click('[aria-label="addCollection-tableId"]');
|
await explorer.click('[aria-label="addCollection-tableId"]');
|
||||||
await explorer.fill('[aria-label="addCollection-tableId"]', tableId);
|
await explorer.fill('[aria-label="addCollection-tableId"]', tableId);
|
||||||
await explorer.click("#sidePanelOkButton");
|
await explorer.click("#sidePanelOkButton");
|
||||||
await explorer.click(`.nodeItem >> text=${keyspaceId}`);
|
await explorer.click(`.nodeItem >> text=${keyspaceId}`, { timeout: 50000 });
|
||||||
await explorer.click(`[data-test="${tableId}"] [aria-label="More"]`);
|
await explorer.click(`[data-test="${tableId}"] [aria-label="More"]`);
|
||||||
await explorer.click('button[role="menuitem"]:has-text("Delete Table")');
|
await explorer.click('button[role="menuitem"]:has-text("Delete Table")');
|
||||||
await explorer.fill('text=* Confirm by typing the table id >> input[type="text"]', tableId);
|
await explorer.fill('text=* Confirm by typing the table id >> input[type="text"]', tableId);
|
||||||
|
|||||||
@@ -1,16 +1,17 @@
|
|||||||
import { jest } from "@jest/globals";
|
import { jest } from "@jest/globals";
|
||||||
import "expect-playwright";
|
import "expect-playwright";
|
||||||
import { generateDatabaseNameWithTimestamp, generateUniqueName } from "../utils/shared";
|
import { generateDatabaseNameWithTimestamp, generateUniqueName } from "../utils/shared";
|
||||||
import { waitForExplorer } from "../utils/waitForExplorer";
|
|
||||||
jest.setTimeout(240000);
|
jest.setTimeout(240000);
|
||||||
|
|
||||||
test("Graph CRUD", async () => {
|
test("Graph CRUD", async () => {
|
||||||
const databaseId = generateDatabaseNameWithTimestamp();
|
const databaseId = generateDatabaseNameWithTimestamp();
|
||||||
const containerId = generateUniqueName("container");
|
const containerId = generateUniqueName("container");
|
||||||
page.setDefaultTimeout(50000);
|
|
||||||
|
|
||||||
await page.goto("https://localhost:1234/testExplorer.html?accountName=portal-gremlin-runner");
|
await page.goto("https://localhost:1234/testExplorer.html?accountName=portal-gremlin-runner");
|
||||||
const explorer = await waitForExplorer();
|
await page.waitForSelector("iframe");
|
||||||
|
const explorer = page.frame({
|
||||||
|
name: "explorer",
|
||||||
|
});
|
||||||
|
|
||||||
// Create new database and graph
|
// Create new database and graph
|
||||||
await explorer.click('[data-test="New Graph"]');
|
await explorer.click('[data-test="New Graph"]');
|
||||||
@@ -18,7 +19,7 @@ test("Graph CRUD", async () => {
|
|||||||
await explorer.fill('[aria-label="Graph id"]', containerId);
|
await explorer.fill('[aria-label="Graph id"]', containerId);
|
||||||
await explorer.fill('[aria-label="Partition key"]', "/pk");
|
await explorer.fill('[aria-label="Partition key"]', "/pk");
|
||||||
await explorer.click("#sidePanelOkButton");
|
await explorer.click("#sidePanelOkButton");
|
||||||
await explorer.click(`.nodeItem >> text=${databaseId}`);
|
await explorer.click(`.nodeItem >> text=${databaseId}`, { timeout: 50000 });
|
||||||
await explorer.click(`.nodeItem >> text=${containerId}`);
|
await explorer.click(`.nodeItem >> text=${containerId}`);
|
||||||
// Delete database and graph
|
// Delete database and graph
|
||||||
await explorer.click(`[data-test="${containerId}"] [aria-label="More"]`);
|
await explorer.click(`[data-test="${containerId}"] [aria-label="More"]`);
|
||||||
|
|||||||
@@ -1,16 +1,17 @@
|
|||||||
import { jest } from "@jest/globals";
|
import { jest } from "@jest/globals";
|
||||||
import "expect-playwright";
|
import "expect-playwright";
|
||||||
import { generateDatabaseNameWithTimestamp, generateUniqueName } from "../utils/shared";
|
import { generateDatabaseNameWithTimestamp, generateUniqueName } from "../utils/shared";
|
||||||
import { waitForExplorer } from "../utils/waitForExplorer";
|
|
||||||
jest.setTimeout(240000);
|
jest.setTimeout(240000);
|
||||||
|
|
||||||
test("Mongo CRUD", async () => {
|
test("Mongo CRUD", async () => {
|
||||||
const databaseId = generateDatabaseNameWithTimestamp();
|
const databaseId = generateDatabaseNameWithTimestamp();
|
||||||
const containerId = generateUniqueName("container");
|
const containerId = generateUniqueName("container");
|
||||||
page.setDefaultTimeout(50000);
|
|
||||||
|
|
||||||
await page.goto("https://localhost:1234/testExplorer.html?accountName=portal-mongo-runner");
|
await page.goto("https://localhost:1234/testExplorer.html?accountName=portal-mongo-runner");
|
||||||
const explorer = await waitForExplorer();
|
await page.waitForSelector("iframe");
|
||||||
|
const explorer = page.frame({
|
||||||
|
name: "explorer",
|
||||||
|
});
|
||||||
|
|
||||||
// Create new database and collection
|
// Create new database and collection
|
||||||
await explorer.click('[data-test="New Collection"]');
|
await explorer.click('[data-test="New Collection"]');
|
||||||
@@ -18,7 +19,7 @@ test("Mongo CRUD", async () => {
|
|||||||
await explorer.fill('[aria-label="Collection id"]', containerId);
|
await explorer.fill('[aria-label="Collection id"]', containerId);
|
||||||
await explorer.fill('[aria-label="Shard key"]', "/pk");
|
await explorer.fill('[aria-label="Shard key"]', "/pk");
|
||||||
await explorer.click("#sidePanelOkButton");
|
await explorer.click("#sidePanelOkButton");
|
||||||
await explorer.click(`.nodeItem >> text=${databaseId}`);
|
await explorer.click(`.nodeItem >> text=${databaseId}`, { timeout: 50000 });
|
||||||
await explorer.click(`.nodeItem >> text=${containerId}`);
|
await explorer.click(`.nodeItem >> text=${containerId}`);
|
||||||
// Create indexing policy
|
// Create indexing policy
|
||||||
await explorer.click(".nodeItem >> text=Settings");
|
await explorer.click(".nodeItem >> text=Settings");
|
||||||
|
|||||||
@@ -1,16 +1,17 @@
|
|||||||
import { jest } from "@jest/globals";
|
import { jest } from "@jest/globals";
|
||||||
import "expect-playwright";
|
import "expect-playwright";
|
||||||
import { generateDatabaseNameWithTimestamp, generateUniqueName } from "../utils/shared";
|
import { generateDatabaseNameWithTimestamp, generateUniqueName } from "../utils/shared";
|
||||||
import { waitForExplorer } from "../utils/waitForExplorer";
|
|
||||||
jest.setTimeout(240000);
|
jest.setTimeout(240000);
|
||||||
|
|
||||||
test("Mongo CRUD", async () => {
|
test("Mongo CRUD", async () => {
|
||||||
const databaseId = generateDatabaseNameWithTimestamp();
|
const databaseId = generateDatabaseNameWithTimestamp();
|
||||||
const containerId = generateUniqueName("container");
|
const containerId = generateUniqueName("container");
|
||||||
page.setDefaultTimeout(50000);
|
|
||||||
|
|
||||||
await page.goto("https://localhost:1234/testExplorer.html?accountName=portal-mongo32-runner");
|
await page.goto("https://localhost:1234/testExplorer.html?accountName=portal-mongo32-runner");
|
||||||
const explorer = await waitForExplorer();
|
await page.waitForSelector("iframe");
|
||||||
|
const explorer = page.frame({
|
||||||
|
name: "explorer",
|
||||||
|
});
|
||||||
|
|
||||||
// Create new database and collection
|
// Create new database and collection
|
||||||
await explorer.click('[data-test="New Collection"]');
|
await explorer.click('[data-test="New Collection"]');
|
||||||
@@ -18,7 +19,7 @@ test("Mongo CRUD", async () => {
|
|||||||
await explorer.fill('[aria-label="Collection id"]', containerId);
|
await explorer.fill('[aria-label="Collection id"]', containerId);
|
||||||
await explorer.fill('[aria-label="Shard key"]', "pk");
|
await explorer.fill('[aria-label="Shard key"]', "pk");
|
||||||
await explorer.click("#sidePanelOkButton");
|
await explorer.click("#sidePanelOkButton");
|
||||||
explorer.click(`.nodeItem >> text=${databaseId}`);
|
explorer.click(`.nodeItem >> text=${databaseId}`, { timeout: 50000 });
|
||||||
explorer.click(`.nodeItem >> text=${containerId}`);
|
explorer.click(`.nodeItem >> text=${containerId}`);
|
||||||
// Delete database and collection
|
// Delete database and collection
|
||||||
explorer.click(`[data-test="${containerId}"] [aria-label="More"]`);
|
explorer.click(`[data-test="${containerId}"] [aria-label="More"]`);
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ import { jest } from "@jest/globals";
|
|||||||
import "expect-playwright";
|
import "expect-playwright";
|
||||||
import fs from "fs";
|
import fs from "fs";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
import { waitForExplorer } from "../utils/waitForExplorer";
|
|
||||||
jest.setTimeout(240000);
|
jest.setTimeout(240000);
|
||||||
|
|
||||||
const filename = "GettingStarted.ipynb";
|
const filename = "GettingStarted.ipynb";
|
||||||
@@ -12,7 +11,10 @@ fs.copyFileSync(path.join(__dirname, filename), path.join(__dirname, fileToUploa
|
|||||||
|
|
||||||
test("Notebooks", async () => {
|
test("Notebooks", async () => {
|
||||||
await page.goto("https://localhost:1234/testExplorer.html?accountName=portal-sql-runner");
|
await page.goto("https://localhost:1234/testExplorer.html?accountName=portal-sql-runner");
|
||||||
const explorer = await waitForExplorer();
|
await page.waitForSelector("iframe");
|
||||||
|
const explorer = page.frame({
|
||||||
|
name: "explorer",
|
||||||
|
});
|
||||||
// Upload and Delete Notebook
|
// Upload and Delete Notebook
|
||||||
await explorer.click('[data-test="My Notebooks"] [aria-label="More"]');
|
await explorer.click('[data-test="My Notebooks"] [aria-label="More"]');
|
||||||
await explorer.click('button[role="menuitem"]:has-text("Upload File")');
|
await explorer.click('button[role="menuitem"]:has-text("Upload File")');
|
||||||
|
|||||||
@@ -1,22 +1,24 @@
|
|||||||
import { jest } from "@jest/globals";
|
import { jest } from "@jest/globals";
|
||||||
import "expect-playwright";
|
import "expect-playwright";
|
||||||
import { generateUniqueName } from "../utils/shared";
|
import { generateUniqueName } from "../utils/shared";
|
||||||
import { waitForExplorer } from "../utils/waitForExplorer";
|
|
||||||
jest.setTimeout(120000);
|
jest.setTimeout(120000);
|
||||||
|
|
||||||
test("SQL CRUD", async () => {
|
test("SQL CRUD", async () => {
|
||||||
const databaseId = generateUniqueName("db");
|
const databaseId = generateUniqueName("db");
|
||||||
const containerId = generateUniqueName("container");
|
const containerId = generateUniqueName("container");
|
||||||
page.setDefaultTimeout(50000);
|
|
||||||
|
|
||||||
await page.goto("https://localhost:1234/testExplorer.html?accountName=portal-sql-runner");
|
await page.goto("https://localhost:1234/testExplorer.html?accountName=portal-sql-runner");
|
||||||
const explorer = await waitForExplorer();
|
await page.waitForSelector("iframe");
|
||||||
|
const explorer = page.frame({
|
||||||
|
name: "explorer",
|
||||||
|
});
|
||||||
|
|
||||||
await explorer.click('[data-test="New Container"]');
|
await explorer.click('[data-test="New Container"]');
|
||||||
await explorer.fill('[aria-label="New database id"]', databaseId);
|
await explorer.fill('[aria-label="New database id"]', databaseId);
|
||||||
await explorer.fill('[aria-label="Container id"]', containerId);
|
await explorer.fill('[aria-label="Container id"]', containerId);
|
||||||
await explorer.fill('[aria-label="Partition key"]', "/pk");
|
await explorer.fill('[aria-label="Partition key"]', "/pk");
|
||||||
await explorer.click("#sidePanelOkButton");
|
await explorer.click("#sidePanelOkButton");
|
||||||
await explorer.click(`.nodeItem >> text=${databaseId}`);
|
await explorer.click(`.nodeItem >> text=${databaseId}`, { timeout: 50000 });
|
||||||
await explorer.click(`[data-test="${containerId}"] [aria-label="More"]`);
|
await explorer.click(`[data-test="${containerId}"] [aria-label="More"]`);
|
||||||
await explorer.click('button[role="menuitem"]:has-text("Delete Container")');
|
await explorer.click('button[role="menuitem"]:has-text("Delete Container")');
|
||||||
await explorer.fill('text=* Confirm by typing the container id >> input[type="text"]', containerId);
|
await explorer.fill('text=* Confirm by typing the container id >> input[type="text"]', containerId);
|
||||||
|
|||||||
@@ -1,22 +1,22 @@
|
|||||||
import { jest } from "@jest/globals";
|
import { jest } from "@jest/globals";
|
||||||
import "expect-playwright";
|
import "expect-playwright";
|
||||||
import { generateUniqueName } from "../utils/shared";
|
import { generateUniqueName } from "../utils/shared";
|
||||||
import { waitForExplorer } from "../utils/waitForExplorer";
|
|
||||||
|
|
||||||
jest.setTimeout(120000);
|
jest.setTimeout(120000);
|
||||||
|
|
||||||
test("Tables CRUD", async () => {
|
test("Tables CRUD", async () => {
|
||||||
const tableId = generateUniqueName("table");
|
const tableId = generateUniqueName("table");
|
||||||
page.setDefaultTimeout(50000);
|
|
||||||
|
|
||||||
await page.goto("https://localhost:1234/testExplorer.html?accountName=portal-tables-runner");
|
await page.goto("https://localhost:1234/testExplorer.html?accountName=portal-tables-runner");
|
||||||
const explorer = await waitForExplorer();
|
await page.waitForSelector("iframe");
|
||||||
|
const explorer = page.frame({
|
||||||
|
name: "explorer",
|
||||||
|
});
|
||||||
|
|
||||||
await page.waitForSelector('text="Querying databases"', { state: "detached" });
|
|
||||||
await explorer.click('[data-test="New Table"]');
|
await explorer.click('[data-test="New Table"]');
|
||||||
await explorer.fill('[aria-label="Table id"]', tableId);
|
await explorer.fill('[aria-label="Table id"]', tableId);
|
||||||
await explorer.click("#sidePanelOkButton");
|
await explorer.click("#sidePanelOkButton");
|
||||||
await explorer.click(`[data-test="TablesDB"]`);
|
await explorer.click(`[data-test="TablesDB"]`, { timeout: 50000 });
|
||||||
await explorer.click(`[data-test="${tableId}"] [aria-label="More"]`);
|
await explorer.click(`[data-test="${tableId}"] [aria-label="More"]`);
|
||||||
await explorer.click('button[role="menuitem"]:has-text("Delete Table")');
|
await explorer.click('button[role="menuitem"]:has-text("Delete Table")');
|
||||||
await explorer.fill('text=* Confirm by typing the table id >> input[type="text"]', tableId);
|
await explorer.fill('text=* Confirm by typing the table id >> input[type="text"]', tableId);
|
||||||
|
|||||||
@@ -1,9 +0,0 @@
|
|||||||
import { Frame } from "playwright";
|
|
||||||
|
|
||||||
export const waitForExplorer = async (): Promise<Frame> => {
|
|
||||||
await page.waitForSelector("iframe");
|
|
||||||
await page.waitForTimeout(5000);
|
|
||||||
return page.frame({
|
|
||||||
name: "explorer",
|
|
||||||
});
|
|
||||||
};
|
|
||||||
@@ -8,7 +8,6 @@
|
|||||||
"noUnusedParameters": true
|
"noUnusedParameters": true
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"./src/Explorer/Panes/ExecuteSprocParamsPane/InputParameter.tsx",
|
|
||||||
"./src/AuthType.ts",
|
"./src/AuthType.ts",
|
||||||
"./src/Bindings/ReactBindingHandler.ts",
|
"./src/Bindings/ReactBindingHandler.ts",
|
||||||
"./src/Common/ArrayHashMap.ts",
|
"./src/Common/ArrayHashMap.ts",
|
||||||
@@ -61,7 +60,6 @@
|
|||||||
"./src/Explorer/Notebook/NotebookRenderer/StatusBar.tsx",
|
"./src/Explorer/Notebook/NotebookRenderer/StatusBar.tsx",
|
||||||
"./src/Explorer/Notebook/NotebookRenderer/decorators/CellCreator.tsx",
|
"./src/Explorer/Notebook/NotebookRenderer/decorators/CellCreator.tsx",
|
||||||
"./src/Explorer/Notebook/NotebookRenderer/decorators/CellLabeler.tsx",
|
"./src/Explorer/Notebook/NotebookRenderer/decorators/CellLabeler.tsx",
|
||||||
"./src/Explorer/Notebook/NotebookRenderer/decorators/HoverableCell.tsx",
|
|
||||||
"./src/Explorer/Notebook/NotebookUtil.ts",
|
"./src/Explorer/Notebook/NotebookUtil.ts",
|
||||||
"./src/Explorer/Notebook/SchemaAnalyzer/SchemaAnalyzerSplashScreen.tsx",
|
"./src/Explorer/Notebook/SchemaAnalyzer/SchemaAnalyzerSplashScreen.tsx",
|
||||||
"./src/Explorer/Notebook/SchemaAnalyzer/SchemaAnalyzerUtils.ts",
|
"./src/Explorer/Notebook/SchemaAnalyzer/SchemaAnalyzerUtils.ts",
|
||||||
@@ -85,6 +83,7 @@
|
|||||||
"./src/Explorer/Tree/AccessibleVerticalList.ts",
|
"./src/Explorer/Tree/AccessibleVerticalList.ts",
|
||||||
"./src/GitHub/GitHubConnector.ts",
|
"./src/GitHub/GitHubConnector.ts",
|
||||||
"./src/HostedExplorerChildFrame.ts",
|
"./src/HostedExplorerChildFrame.ts",
|
||||||
|
"./src/Index.ts",
|
||||||
"./src/Platform/Hosted/Authorization.ts",
|
"./src/Platform/Hosted/Authorization.ts",
|
||||||
"./src/Platform/Hosted/Components/MeControl.test.tsx",
|
"./src/Platform/Hosted/Components/MeControl.test.tsx",
|
||||||
"./src/Platform/Hosted/Components/MeControl.tsx",
|
"./src/Platform/Hosted/Components/MeControl.tsx",
|
||||||
@@ -168,4 +167,4 @@
|
|||||||
"src/Terminal/**/*",
|
"src/Terminal/**/*",
|
||||||
"src/Utils/arm/**/*"
|
"src/Utils/arm/**/*"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -198,7 +198,7 @@ module.exports = function (_env = {}, argv = {}) {
|
|||||||
mode: mode,
|
mode: mode,
|
||||||
entry: {
|
entry: {
|
||||||
main: "./src/Main.tsx",
|
main: "./src/Main.tsx",
|
||||||
index: "./src/Index.tsx",
|
index: "./src/Index.ts",
|
||||||
quickstart: "./src/quickstart.ts",
|
quickstart: "./src/quickstart.ts",
|
||||||
hostedExplorer: "./src/HostedExplorer.tsx",
|
hostedExplorer: "./src/HostedExplorer.tsx",
|
||||||
testExplorer: "./test/testExplorer/TestExplorer.ts",
|
testExplorer: "./test/testExplorer/TestExplorer.ts",
|
||||||
|
|||||||
Reference in New Issue
Block a user