mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-23 19:01:28 +00:00
Compare commits
2 Commits
users/srna
...
memory-swr
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
23599741d7 | ||
|
|
d494278488 |
@@ -4,4 +4,3 @@ PORTAL_RUNNER_PASSWORD=
|
|||||||
PORTAL_RUNNER_SUBSCRIPTION=
|
PORTAL_RUNNER_SUBSCRIPTION=
|
||||||
PORTAL_RUNNER_RESOURCE_GROUP=
|
PORTAL_RUNNER_RESOURCE_GROUP=
|
||||||
PORTAL_RUNNER_DATABASE_ACCOUNT=
|
PORTAL_RUNNER_DATABASE_ACCOUNT=
|
||||||
PORTAL_RUNNER_CONNECTION_STRING=
|
|
||||||
20
.github/workflows/ci.yml
vendored
20
.github/workflows/ci.yml
vendored
@@ -196,26 +196,6 @@ jobs:
|
|||||||
shell: bash
|
shell: bash
|
||||||
env:
|
env:
|
||||||
NODE_TLS_REJECT_UNAUTHORIZED: 0
|
NODE_TLS_REJECT_UNAUTHORIZED: 0
|
||||||
endtoendpuppeteer:
|
|
||||||
name: "End to end puppeteer tests"
|
|
||||||
needs: [lint, format, compile, unittest]
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- name: Use Node.js 12.x
|
|
||||||
uses: actions/setup-node@v1
|
|
||||||
with:
|
|
||||||
node-version: 12.x
|
|
||||||
- name: End to End Puppeteer Tests
|
|
||||||
run: |
|
|
||||||
npm ci
|
|
||||||
npm start &
|
|
||||||
npm run wait-for-server
|
|
||||||
npm run test:e2e
|
|
||||||
shell: bash
|
|
||||||
env:
|
|
||||||
NODE_TLS_REJECT_UNAUTHORIZED: 0
|
|
||||||
PORTAL_RUNNER_CONNECTION_STRING: ${{ secrets.CONNECTION_STRING_SQL }}
|
|
||||||
nuget:
|
nuget:
|
||||||
name: Publish Nuget
|
name: Publish Nuget
|
||||||
if: github.ref == 'refs/heads/master' || contains(github.ref, 'hotfix/') || contains(github.ref, 'release/')
|
if: github.ref == 'refs/heads/master' || contains(github.ref, 'hotfix/') || contains(github.ref, 'release/')
|
||||||
|
|||||||
@@ -3,8 +3,7 @@ const isCI = require("is-ci");
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
launch: {
|
launch: {
|
||||||
headless: isCI,
|
headless: isCI,
|
||||||
slowMo: 50,
|
slowMo: isCI ? null : 20,
|
||||||
defaultViewport: null,
|
defaultViewport: null
|
||||||
ignoreHTTPSErrors: true
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -54,7 +54,7 @@
|
|||||||
|
|
||||||
@SelectionColor: #3074B0;
|
@SelectionColor: #3074B0;
|
||||||
|
|
||||||
@FocusColor: #605e5c;
|
@FocusColor: #00bcf2;
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
METRICS
|
METRICS
|
||||||
|
|||||||
@@ -1522,10 +1522,6 @@ p {
|
|||||||
.tooltipVisible();
|
.tooltipVisible();
|
||||||
}
|
}
|
||||||
|
|
||||||
.infoTooltip a {
|
|
||||||
color: @AccentHigh;
|
|
||||||
}
|
|
||||||
|
|
||||||
.nowrap {
|
.nowrap {
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
@@ -1650,7 +1646,7 @@ p {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.contextual-pane .collid {
|
.contextual-pane .collid {
|
||||||
border: 1px solid #605e5c;
|
border: 1px solid #bbbbbb;
|
||||||
font-size: 10px;
|
font-size: 10px;
|
||||||
padding: 5px 10px;
|
padding: 5px 10px;
|
||||||
color: #000;
|
color: #000;
|
||||||
@@ -2427,6 +2423,22 @@ a:link {
|
|||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
::-webkit-input-placeholder {
|
||||||
|
color: #969696;
|
||||||
|
}
|
||||||
|
|
||||||
|
::-moz-placeholder {
|
||||||
|
color: #969696;
|
||||||
|
}
|
||||||
|
|
||||||
|
:-ms-input-placeholder {
|
||||||
|
color: #969696;
|
||||||
|
}
|
||||||
|
|
||||||
|
:-moz-placeholder {
|
||||||
|
color: #969696;
|
||||||
|
}
|
||||||
|
|
||||||
::-ms-expand {
|
::-ms-expand {
|
||||||
color: #969696;
|
color: #969696;
|
||||||
}
|
}
|
||||||
@@ -2976,10 +2988,6 @@ settings-pane {
|
|||||||
.enableAnalyticalStorageRadio:nth-child(n+2) {
|
.enableAnalyticalStorageRadio:nth-child(n+2) {
|
||||||
margin-left: @LargeSpace;
|
margin-left: @LargeSpace;
|
||||||
}
|
}
|
||||||
|
|
||||||
.enableAnalyticalStorageRadioLabel {
|
|
||||||
padding: 0px
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.addCollectionLabel {
|
.addCollectionLabel {
|
||||||
@@ -3013,8 +3021,4 @@ settings-pane {
|
|||||||
|
|
||||||
.warningErrorContent a {
|
.warningErrorContent a {
|
||||||
color: @AccentMediumHigh
|
color: @AccentMediumHigh
|
||||||
}
|
}
|
||||||
|
|
||||||
.infoBoxContent a {
|
|
||||||
color: @AccentMediumHigh
|
|
||||||
}
|
|
||||||
246
package-lock.json
generated
246
package-lock.json
generated
@@ -3490,9 +3490,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@fluentui/date-time-utilities": {
|
"@fluentui/date-time-utilities": {
|
||||||
"version": "7.8.0",
|
"version": "7.7.0",
|
||||||
"resolved": "https://registry.npmjs.org/@fluentui/date-time-utilities/-/date-time-utilities-7.8.0.tgz",
|
"resolved": "https://registry.npmjs.org/@fluentui/date-time-utilities/-/date-time-utilities-7.7.0.tgz",
|
||||||
"integrity": "sha512-qzlTp3t+PghebJsLK9JwZr91qBRZ/fOml8TQCIjdtsEn4mH6/ciCwir7Fj8iOEkwwTC0iKsEr1jfsITtJKWSmA==",
|
"integrity": "sha512-rgtGX5x1AeYUfilfkgP6ag+ZKx41BJcUs16k6iSxXxd/mt00DAPOGY8ODGikKFpjGKcUwjKfYBssyKkVHDucfA==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@uifabric/set-version": "^7.0.22",
|
"@uifabric/set-version": "^7.0.22",
|
||||||
"tslib": "^1.10.0"
|
"tslib": "^1.10.0"
|
||||||
@@ -3517,9 +3517,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@fluentui/react-focus": {
|
"@fluentui/react-focus": {
|
||||||
"version": "7.16.0",
|
"version": "7.15.0",
|
||||||
"resolved": "https://registry.npmjs.org/@fluentui/react-focus/-/react-focus-7.16.0.tgz",
|
"resolved": "https://registry.npmjs.org/@fluentui/react-focus/-/react-focus-7.15.0.tgz",
|
||||||
"integrity": "sha512-TwB4Av7ID70ejisDIGkCZGKOxlquSazr6W+9Jv1JQAvsBLuj5XOspFJH4/Igjniw1LeO9QmAvFZeh/XRShiObw==",
|
"integrity": "sha512-xbxB0cbyEoUfQZ19pAqBeWCYJ/4IOu1FG4bhVjDimqSD7qKwJbLlJSDNwmHr05SWprdhmqJe23KOwsHMgyvnrw==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@fluentui/keyboard-key": "^0.2.11",
|
"@fluentui/keyboard-key": "^0.2.11",
|
||||||
"@uifabric/merge-styles": "^7.18.0",
|
"@uifabric/merge-styles": "^7.18.0",
|
||||||
@@ -3685,12 +3685,6 @@
|
|||||||
"integrity": "sha512-1dVNHT76Uu5N3eJNTYcvxee+jzX4Z9lfciqRRHCU27ihbUcYi+iSc2iml5Ke1LXe1SyJCLA0+14Jh4tXJgOppA==",
|
"integrity": "sha512-1dVNHT76Uu5N3eJNTYcvxee+jzX4Z9lfciqRRHCU27ihbUcYi+iSc2iml5Ke1LXe1SyJCLA0+14Jh4tXJgOppA==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"@hapi/formula": {
|
|
||||||
"version": "2.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/@hapi/formula/-/formula-2.0.0.tgz",
|
|
||||||
"integrity": "sha512-V87P8fv7PI0LH7LiVi8Lkf3x+KCO7pQozXRssAHNXXL9L1K+uyu4XypLXwxqVDKgyQai6qj3/KteNlrqDx4W5A==",
|
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"@hapi/hoek": {
|
"@hapi/hoek": {
|
||||||
"version": "8.5.1",
|
"version": "8.5.1",
|
||||||
"resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-8.5.1.tgz",
|
"resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-8.5.1.tgz",
|
||||||
@@ -3709,12 +3703,6 @@
|
|||||||
"@hapi/topo": "3.x.x"
|
"@hapi/topo": "3.x.x"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@hapi/pinpoint": {
|
|
||||||
"version": "2.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/@hapi/pinpoint/-/pinpoint-2.0.0.tgz",
|
|
||||||
"integrity": "sha512-vzXR5MY7n4XeIvLpfl3HtE3coZYO4raKXW766R6DZw/6aLqR26iuZ109K7a0NtF2Db0jxqh7xz2AxkUwpUFybw==",
|
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"@hapi/topo": {
|
"@hapi/topo": {
|
||||||
"version": "3.1.6",
|
"version": "3.1.6",
|
||||||
"resolved": "https://registry.npmjs.org/@hapi/topo/-/topo-3.1.6.tgz",
|
"resolved": "https://registry.npmjs.org/@hapi/topo/-/topo-3.1.6.tgz",
|
||||||
@@ -7628,16 +7616,6 @@
|
|||||||
"@types/enzyme": "*"
|
"@types/enzyme": "*"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@types/expect-puppeteer": {
|
|
||||||
"version": "4.4.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/@types/expect-puppeteer/-/expect-puppeteer-4.4.3.tgz",
|
|
||||||
"integrity": "sha512-jWZOO9d8ST2vutV5yxZ1OYxxtYD0lOufIgOUlDjyTNBGo8um67shJs2NQDLVDG06wWrabpPPOUQlI8GSvsdKVQ==",
|
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
|
||||||
"@types/jest": "*",
|
|
||||||
"@types/puppeteer": "*"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"@types/geojson": {
|
"@types/geojson": {
|
||||||
"version": "7946.0.7",
|
"version": "7946.0.7",
|
||||||
"resolved": "https://registry.npmjs.org/@types/geojson/-/geojson-7946.0.7.tgz",
|
"resolved": "https://registry.npmjs.org/@types/geojson/-/geojson-7946.0.7.tgz",
|
||||||
@@ -7713,33 +7691,6 @@
|
|||||||
"integrity": "sha512-DC8xTuW/6TYgvEg3HEXS7cu9OijFqprVDXXiOcdOKZCU/5PJNLZU37VVvmZHdtMiGOa8wAA/We+JzbdxFzQTRQ==",
|
"integrity": "sha512-DC8xTuW/6TYgvEg3HEXS7cu9OijFqprVDXXiOcdOKZCU/5PJNLZU37VVvmZHdtMiGOa8wAA/We+JzbdxFzQTRQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"@types/jest-environment-puppeteer": {
|
|
||||||
"version": "4.3.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/@types/jest-environment-puppeteer/-/jest-environment-puppeteer-4.3.2.tgz",
|
|
||||||
"integrity": "sha512-QVR49cGaQMOrWRN7CXlvtPMuVAxa3Z+W3APxhWoSQLG/lvz1y03ECPvS7Y9eK+hgfndK+39400rO6IifDJV9YA==",
|
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
|
||||||
"@jest/environment": "^24",
|
|
||||||
"@jest/fake-timers": "^24",
|
|
||||||
"@jest/types": "^24",
|
|
||||||
"@types/puppeteer": "*",
|
|
||||||
"jest-mock": "^24"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"@jest/environment": {
|
|
||||||
"version": "24.9.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/@jest/environment/-/environment-24.9.0.tgz",
|
|
||||||
"integrity": "sha512-5A1QluTPhvdIPFYnO3sZC3smkNeXPVELz7ikPbhUj0bQjB07EoE9qtLrem14ZUYWdVayYbsjVwIiL4WBIMV4aQ==",
|
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
|
||||||
"@jest/fake-timers": "^24.9.0",
|
|
||||||
"@jest/transform": "^24.9.0",
|
|
||||||
"@jest/types": "^24.9.0",
|
|
||||||
"jest-mock": "^24.9.0"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"@types/json-schema": {
|
"@types/json-schema": {
|
||||||
"version": "7.0.4",
|
"version": "7.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.4.tgz",
|
||||||
@@ -7815,15 +7766,6 @@
|
|||||||
"integrity": "sha512-3AQoUxQcQtLHsK25wtTWIoIpgYjH3vSDroZOUr7PpCHw/jLY1RB9z9E8dBT/OSmwStVgkRNvdh+ZHNiomRieaw==",
|
"integrity": "sha512-3AQoUxQcQtLHsK25wtTWIoIpgYjH3vSDroZOUr7PpCHw/jLY1RB9z9E8dBT/OSmwStVgkRNvdh+ZHNiomRieaw==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"@types/puppeteer": {
|
|
||||||
"version": "3.0.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/@types/puppeteer/-/puppeteer-3.0.1.tgz",
|
|
||||||
"integrity": "sha512-t03eNKCvWJXhQ8wkc5C6GYuSqMEdKLOX0GLMGtks25YZr38wKZlKTwGM/BoAPVtdysX7Bb9tdwrDS1+NrW3RRA==",
|
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
|
||||||
"@types/node": "*"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"@types/pvutils": {
|
"@types/pvutils": {
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/@types/pvutils/-/pvutils-0.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/@types/pvutils/-/pvutils-0.0.1.tgz",
|
||||||
@@ -8447,6 +8389,46 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"@uifabric/react-hooks": {
|
||||||
|
"version": "7.11.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@uifabric/react-hooks/-/react-hooks-7.11.0.tgz",
|
||||||
|
"integrity": "sha512-iU7c+JR+rY5kBTPmrF8F6iJBQw309MX/MvOx6ElhmNceBaa8BqDuqR9+TVfkH+Bxp37bmZnCaQF5w4+QWHZ81g==",
|
||||||
|
"requires": {
|
||||||
|
"@uifabric/set-version": "^7.0.22",
|
||||||
|
"@uifabric/utilities": "^7.31.0",
|
||||||
|
"tslib": "^1.10.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@uifabric/merge-styles": {
|
||||||
|
"version": "7.18.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@uifabric/merge-styles/-/merge-styles-7.18.0.tgz",
|
||||||
|
"integrity": "sha512-805WIbN7lAJATXKxZjjRbIgN7raRMwWYWeDkJJ52PCPuCesOvbpdr0GkH8rC6GQ7EB0MB7YM2i6Fiye7SFewbw==",
|
||||||
|
"requires": {
|
||||||
|
"@uifabric/set-version": "^7.0.22",
|
||||||
|
"tslib": "^1.10.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"@uifabric/set-version": {
|
||||||
|
"version": "7.0.22",
|
||||||
|
"resolved": "https://registry.npmjs.org/@uifabric/set-version/-/set-version-7.0.22.tgz",
|
||||||
|
"integrity": "sha512-IG35UNJNxqI7NC2eYuobGTD+v4W0VHQcC3bYd5Na9EgoC9jVgguS8n6EXUtP/lC1vJEYEyPEZdVwhPxKw4F4Sw==",
|
||||||
|
"requires": {
|
||||||
|
"tslib": "^1.10.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"@uifabric/utilities": {
|
||||||
|
"version": "7.31.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@uifabric/utilities/-/utilities-7.31.0.tgz",
|
||||||
|
"integrity": "sha512-m4Yeyn4gyW7xS8LvOnCesokPModYS2YuE9GQmO++MDZ/vC5RRNlvlyktUZDuxCZ84cNCiXyTQ8nImBaPGnxHVQ==",
|
||||||
|
"requires": {
|
||||||
|
"@uifabric/merge-styles": "^7.18.0",
|
||||||
|
"@uifabric/set-version": "^7.0.22",
|
||||||
|
"prop-types": "^15.7.2",
|
||||||
|
"tslib": "^1.10.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"@uifabric/set-version": {
|
"@uifabric/set-version": {
|
||||||
"version": "7.0.15",
|
"version": "7.0.15",
|
||||||
"resolved": "https://registry.npmjs.org/@uifabric/set-version/-/set-version-7.0.15.tgz",
|
"resolved": "https://registry.npmjs.org/@uifabric/set-version/-/set-version-7.0.15.tgz",
|
||||||
@@ -8947,9 +8929,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"acorn-jsx": {
|
"acorn-jsx": {
|
||||||
"version": "5.3.1",
|
"version": "5.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.1.tgz",
|
"resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.2.0.tgz",
|
||||||
"integrity": "sha512-K0Ptm/47OKfQRpNQ2J/oIN/3QYiK6FwW+eJbILhsdxh2WTLdl+30o8aGdTbm5JbffpFFAg/g+zi1E+jvJha5ng==",
|
"integrity": "sha512-HiUX/+K2YpkpJ+SzBffkM/AQ2YE03S0U1kjTLVpoJdhZMOWy8qvXVN9JdLqv2QsaQ6MPYQIuNmwD8zOiYUofLQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"acorn-walk": {
|
"acorn-walk": {
|
||||||
@@ -9334,13 +9316,6 @@
|
|||||||
"integrity": "sha512-yG89F0j9B4B0MKIcFyWWxnpZPLaNTjCj4tkE3fjbAoo0qmpGw0PYYqSbX/4ebnd9Icn8ZgK4K1fvDyEtW1JYtQ==",
|
"integrity": "sha512-yG89F0j9B4B0MKIcFyWWxnpZPLaNTjCj4tkE3fjbAoo0qmpGw0PYYqSbX/4ebnd9Icn8ZgK4K1fvDyEtW1JYtQ==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"pvutils": "^1.0.17"
|
"pvutils": "^1.0.17"
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"pvutils": {
|
|
||||||
"version": "1.0.17",
|
|
||||||
"resolved": "https://registry.npmjs.org/pvutils/-/pvutils-1.0.17.tgz",
|
|
||||||
"integrity": "sha512-wLHYUQxWaXVQvKnwIDWFVKDJku9XDCvyhhxoq8dc5MFdIlRenyPI9eSfEtcvgHgD7FlvCyGAlWgOzRnZD99GZQ=="
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"assert": {
|
"assert": {
|
||||||
@@ -15066,6 +15041,12 @@
|
|||||||
"pinkie-promise": "^2.0.0"
|
"pinkie-promise": "^2.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"fsevents": {
|
||||||
|
"version": "2.1.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.1.3.tgz",
|
||||||
|
"integrity": "sha512-Auw9a4AxqWpa9GUfj370BMPzzyncfBABW8Mab7BGWBYDj4Isgq+cDKtx0i6u9jcX9pQDnswsaaOTgTmA5pEjuQ==",
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
"get-caller-file": {
|
"get-caller-file": {
|
||||||
"version": "1.0.3",
|
"version": "1.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.3.tgz",
|
||||||
@@ -15114,6 +15095,7 @@
|
|||||||
"@types/graceful-fs": "^4.1.2",
|
"@types/graceful-fs": "^4.1.2",
|
||||||
"anymatch": "^3.0.3",
|
"anymatch": "^3.0.3",
|
||||||
"fb-watchman": "^2.0.0",
|
"fb-watchman": "^2.0.0",
|
||||||
|
"fsevents": "^2.1.2",
|
||||||
"graceful-fs": "^4.2.4",
|
"graceful-fs": "^4.2.4",
|
||||||
"jest-serializer": "^25.5.0",
|
"jest-serializer": "^25.5.0",
|
||||||
"jest-util": "^25.5.0",
|
"jest-util": "^25.5.0",
|
||||||
@@ -17675,19 +17657,6 @@
|
|||||||
"requires": {
|
"requires": {
|
||||||
"has-flag": "^4.0.0"
|
"has-flag": "^4.0.0"
|
||||||
}
|
}
|
||||||
},
|
|
||||||
"wait-on": {
|
|
||||||
"version": "3.3.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/wait-on/-/wait-on-3.3.0.tgz",
|
|
||||||
"integrity": "sha512-97dEuUapx4+Y12aknWZn7D25kkjMk16PbWoYzpSdA8bYpVfS6hpl2a2pOWZ3c+Tyt3/i4/pglyZctG3J4V1hWQ==",
|
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
|
||||||
"@hapi/joi": "^15.0.3",
|
|
||||||
"core-js": "^2.6.5",
|
|
||||||
"minimist": "^1.2.0",
|
|
||||||
"request": "^2.88.0",
|
|
||||||
"rx": "^4.1.0"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -22316,16 +22285,6 @@
|
|||||||
"tslib": "^1.10.0"
|
"tslib": "^1.10.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@uifabric/react-hooks": {
|
|
||||||
"version": "7.12.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/@uifabric/react-hooks/-/react-hooks-7.12.0.tgz",
|
|
||||||
"integrity": "sha512-vPrg7NVtjjZlDS33tDUiyJSov8PNHBBX8w+EN9eatxP0g6dDkvGv8uWd+9Xpxrliuzi7ad7vlmUMOQffYJntMg==",
|
|
||||||
"requires": {
|
|
||||||
"@uifabric/set-version": "^7.0.22",
|
|
||||||
"@uifabric/utilities": "^7.31.0",
|
|
||||||
"tslib": "^1.10.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"@uifabric/set-version": {
|
"@uifabric/set-version": {
|
||||||
"version": "7.0.22",
|
"version": "7.0.22",
|
||||||
"resolved": "https://registry.npmjs.org/@uifabric/set-version/-/set-version-7.0.22.tgz",
|
"resolved": "https://registry.npmjs.org/@uifabric/set-version/-/set-version-7.0.22.tgz",
|
||||||
@@ -23441,6 +23400,11 @@
|
|||||||
"tslib": "^1.10.0"
|
"tslib": "^1.10.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"pvutils": {
|
||||||
|
"version": "1.0.17",
|
||||||
|
"resolved": "https://registry.npmjs.org/pvutils/-/pvutils-1.0.17.tgz",
|
||||||
|
"integrity": "sha512-wLHYUQxWaXVQvKnwIDWFVKDJku9XDCvyhhxoq8dc5MFdIlRenyPI9eSfEtcvgHgD7FlvCyGAlWgOzRnZD99GZQ=="
|
||||||
|
},
|
||||||
"q": {
|
"q": {
|
||||||
"version": "1.5.1",
|
"version": "1.5.1",
|
||||||
"resolved": "https://registry.npmjs.org/q/-/q-1.5.1.tgz",
|
"resolved": "https://registry.npmjs.org/q/-/q-1.5.1.tgz",
|
||||||
@@ -23552,9 +23516,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"react": {
|
"react": {
|
||||||
"version": "16.9.0",
|
"version": "16.13.1",
|
||||||
"resolved": "https://registry.npmjs.org/react/-/react-16.9.0.tgz",
|
"resolved": "https://registry.npmjs.org/react/-/react-16.13.1.tgz",
|
||||||
"integrity": "sha512-+7LQnFBwkiw+BobzOF6N//BdoNw0ouwmSJTEm9cglOOmsg/TMiFHZLe2sEoN5M7LgJTj9oHH0gxklfnQe66S1w==",
|
"integrity": "sha512-YMZQQq32xHLX0bz5Mnibv1/LHb3Sqzngu7xstSM+vrkE5Kzr9xE0yMByK5kMoTK30YVJE61WfbxIFFvfeDKT1w==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"loose-envify": "^1.1.0",
|
"loose-envify": "^1.1.0",
|
||||||
"object-assign": "^4.1.1",
|
"object-assign": "^4.1.1",
|
||||||
@@ -25791,6 +25755,23 @@
|
|||||||
"resolved": "https://registry.npmjs.org/svgpath/-/svgpath-2.2.3.tgz",
|
"resolved": "https://registry.npmjs.org/svgpath/-/svgpath-2.2.3.tgz",
|
||||||
"integrity": "sha512-xA0glXYpJ9SYT4JeMp3c0psbqdZsG1c0ywGvdJUPY2FKEgwJV7NgkeYuuQiOxMp+XsK9nCqjm3KDw0LkM1YLXw=="
|
"integrity": "sha512-xA0glXYpJ9SYT4JeMp3c0psbqdZsG1c0ywGvdJUPY2FKEgwJV7NgkeYuuQiOxMp+XsK9nCqjm3KDw0LkM1YLXw=="
|
||||||
},
|
},
|
||||||
|
"swr": {
|
||||||
|
"version": "0.3.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/swr/-/swr-0.3.2.tgz",
|
||||||
|
"integrity": "sha512-Bs5Bihq1hQ66O5bdKaL47iZ2nlAaBsd8tTLRLkw9stZeuBEfH7zSuQI95S2TpchL0ybsMq3isWwuso2uPvCfHA==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"fast-deep-equal": "2.0.1"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"fast-deep-equal": {
|
||||||
|
"version": "2.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz",
|
||||||
|
"integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=",
|
||||||
|
"dev": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"symbol-observable": {
|
"symbol-observable": {
|
||||||
"version": "1.2.0",
|
"version": "1.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/symbol-observable/-/symbol-observable-1.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/symbol-observable/-/symbol-observable-1.2.0.tgz",
|
||||||
@@ -26937,65 +26918,16 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"wait-on": {
|
"wait-on": {
|
||||||
"version": "4.0.2",
|
"version": "3.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/wait-on/-/wait-on-4.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/wait-on/-/wait-on-3.3.0.tgz",
|
||||||
"integrity": "sha512-Qpmgm3Hw/sXm7xK68FBsYy5r+Uid94/QymwnEjn9GTpfiWTUVYm0bccivVwY/BXGYO2r+5Cd8S/DzrRZqHK/9w==",
|
"integrity": "sha512-97dEuUapx4+Y12aknWZn7D25kkjMk16PbWoYzpSdA8bYpVfS6hpl2a2pOWZ3c+Tyt3/i4/pglyZctG3J4V1hWQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@hapi/joi": "^17.1.1",
|
"@hapi/joi": "^15.0.3",
|
||||||
"lodash": "^4.17.15",
|
"core-js": "^2.6.5",
|
||||||
"minimist": "^1.2.5",
|
"minimist": "^1.2.0",
|
||||||
"request": "^2.88.2",
|
"request": "^2.88.0",
|
||||||
"request-promise-native": "^1.0.8",
|
"rx": "^4.1.0"
|
||||||
"rxjs": "^6.5.5"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"@hapi/address": {
|
|
||||||
"version": "4.1.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/@hapi/address/-/address-4.1.0.tgz",
|
|
||||||
"integrity": "sha512-SkszZf13HVgGmChdHo/PxchnSaCJ6cetVqLzyciudzZRT0jcOouIF/Q93mgjw8cce+D+4F4C1Z/WrfFN+O3VHQ==",
|
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
|
||||||
"@hapi/hoek": "^9.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"@hapi/hoek": {
|
|
||||||
"version": "9.0.4",
|
|
||||||
"resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-9.0.4.tgz",
|
|
||||||
"integrity": "sha512-EwaJS7RjoXUZ2cXXKZZxZqieGtc7RbvQhUy8FwDoMQtxWVi14tFjeFCYPZAM1mBCpOpiBpyaZbb9NeHc7eGKgw==",
|
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"@hapi/joi": {
|
|
||||||
"version": "17.1.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/@hapi/joi/-/joi-17.1.1.tgz",
|
|
||||||
"integrity": "sha512-p4DKeZAoeZW4g3u7ZeRo+vCDuSDgSvtsB/NpfjXEHTUjSeINAi/RrVOWiVQ1isaoLzMvFEhe8n5065mQq1AdQg==",
|
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
|
||||||
"@hapi/address": "^4.0.1",
|
|
||||||
"@hapi/formula": "^2.0.0",
|
|
||||||
"@hapi/hoek": "^9.0.0",
|
|
||||||
"@hapi/pinpoint": "^2.0.0",
|
|
||||||
"@hapi/topo": "^5.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"@hapi/topo": {
|
|
||||||
"version": "5.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/@hapi/topo/-/topo-5.0.0.tgz",
|
|
||||||
"integrity": "sha512-tFJlT47db0kMqVm3H4nQYgn6Pwg10GTZHb1pwmSiv1K4ks6drQOtfEF5ZnPjkvC+y4/bUPHK+bc87QvLcL+WMw==",
|
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
|
||||||
"@hapi/hoek": "^9.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"rxjs": {
|
|
||||||
"version": "6.6.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.2.tgz",
|
|
||||||
"integrity": "sha512-BHdBMVoWC2sL26w//BCu3YzKT4s2jip/WhwsGEDmeKYBhKDZeYezVUnHatYB7L85v5xs0BAQmg6BEYJEKxBabg==",
|
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
|
||||||
"tslib": "^1.9.0"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"wait-port": {
|
"wait-port": {
|
||||||
|
|||||||
@@ -72,7 +72,7 @@
|
|||||||
"promise-polyfill": "8.1.0",
|
"promise-polyfill": "8.1.0",
|
||||||
"promise.prototype.finally": "3.1.0",
|
"promise.prototype.finally": "3.1.0",
|
||||||
"q": "1.5.1",
|
"q": "1.5.1",
|
||||||
"react": "16.9.0",
|
"react": "16.13.1",
|
||||||
"react-animate-height": "2.0.8",
|
"react-animate-height": "2.0.8",
|
||||||
"react-dnd": "9.4.0",
|
"react-dnd": "9.4.0",
|
||||||
"react-dnd-html5-backend": "9.4.0",
|
"react-dnd-html5-backend": "9.4.0",
|
||||||
@@ -102,15 +102,12 @@
|
|||||||
"@types/d3": "4.13.2",
|
"@types/d3": "4.13.2",
|
||||||
"@types/enzyme": "3.10.3",
|
"@types/enzyme": "3.10.3",
|
||||||
"@types/enzyme-adapter-react-16": "1.0.5",
|
"@types/enzyme-adapter-react-16": "1.0.5",
|
||||||
"@types/expect-puppeteer": "4.4.3",
|
|
||||||
"@types/hasher": "0.0.31",
|
"@types/hasher": "0.0.31",
|
||||||
"@types/jest": "23.3.10",
|
"@types/jest": "23.3.10",
|
||||||
"@types/jest-environment-puppeteer": "4.3.2",
|
|
||||||
"@types/memoize-one": "4.1.1",
|
"@types/memoize-one": "4.1.1",
|
||||||
"@types/node": "12.11.1",
|
"@types/node": "12.11.1",
|
||||||
"@types/promise.prototype.finally": "2.0.3",
|
"@types/promise.prototype.finally": "2.0.3",
|
||||||
"@types/prop-types": "15.5.8",
|
"@types/prop-types": "15.5.8",
|
||||||
"@types/puppeteer": "3.0.1",
|
|
||||||
"@types/q": "1.5.1",
|
"@types/q": "1.5.1",
|
||||||
"@types/react": "16.8.25",
|
"@types/react": "16.8.25",
|
||||||
"@types/react-dom": "16.0.7",
|
"@types/react-dom": "16.0.7",
|
||||||
@@ -163,13 +160,13 @@
|
|||||||
"rimraf": "3.0.0",
|
"rimraf": "3.0.0",
|
||||||
"sinon": "3.2.1",
|
"sinon": "3.2.1",
|
||||||
"style-loader": "0.23.0",
|
"style-loader": "0.23.0",
|
||||||
|
"swr": "0.3.2",
|
||||||
"terser-webpack-plugin": "3.0.5",
|
"terser-webpack-plugin": "3.0.5",
|
||||||
"ts-loader": "6.2.2",
|
"ts-loader": "6.2.2",
|
||||||
"tslint": "5.11.0",
|
"tslint": "5.11.0",
|
||||||
"tslint-microsoft-contrib": "6.0.0",
|
"tslint-microsoft-contrib": "6.0.0",
|
||||||
"typescript": "4.0.2",
|
"typescript": "4.0.2",
|
||||||
"url-loader": "1.1.1",
|
"url-loader": "1.1.1",
|
||||||
"wait-on": "4.0.2",
|
|
||||||
"webpack": "4.43.0",
|
"webpack": "4.43.0",
|
||||||
"webpack-bundle-analyzer": "3.6.1",
|
"webpack-bundle-analyzer": "3.6.1",
|
||||||
"webpack-cli": "3.3.10",
|
"webpack-cli": "3.3.10",
|
||||||
@@ -188,7 +185,6 @@
|
|||||||
"test": "rimraf coverage && jest",
|
"test": "rimraf coverage && jest",
|
||||||
"test:e2e": "jest -c ./jest.config.e2e.js --detectOpenHandles",
|
"test:e2e": "jest -c ./jest.config.e2e.js --detectOpenHandles",
|
||||||
"watch": "npm run start",
|
"watch": "npm run start",
|
||||||
"wait-for-server": "wait-on -t 240000 -i 5000 -v https-get://0.0.0.0:1234/",
|
|
||||||
"build:ase": "gulp build:ase",
|
"build:ase": "gulp build:ase",
|
||||||
"compile": "tsc",
|
"compile": "tsc",
|
||||||
"compile:contracts": "tsc -p ./tsconfig.contracts.json",
|
"compile:contracts": "tsc -p ./tsconfig.contracts.json",
|
||||||
|
|||||||
@@ -1,26 +1,28 @@
|
|||||||
|
import * as _ from "underscore";
|
||||||
|
import * as Constants from "./Constants";
|
||||||
|
import * as DataModels from "../Contracts/DataModels";
|
||||||
|
import * as HeadersUtility from "./HeadersUtility";
|
||||||
|
import * as ViewModels from "../Contracts/ViewModels";
|
||||||
|
import Q from "q";
|
||||||
import {
|
import {
|
||||||
ConflictDefinition,
|
ConflictDefinition,
|
||||||
FeedOptions,
|
FeedOptions,
|
||||||
ItemDefinition,
|
ItemDefinition,
|
||||||
OfferDefinition,
|
|
||||||
QueryIterator,
|
QueryIterator,
|
||||||
Resource
|
Resource,
|
||||||
|
TriggerDefinition,
|
||||||
|
OfferDefinition
|
||||||
} from "@azure/cosmos";
|
} from "@azure/cosmos";
|
||||||
import { RequestOptions } from "@azure/cosmos/dist-esm";
|
|
||||||
import Q from "q";
|
|
||||||
import { configContext, Platform } from "../ConfigContext";
|
|
||||||
import * as DataModels from "../Contracts/DataModels";
|
|
||||||
import { MessageTypes } from "../Contracts/ExplorerContracts";
|
|
||||||
import * as ViewModels from "../Contracts/ViewModels";
|
|
||||||
import ConflictId from "../Explorer/Tree/ConflictId";
|
|
||||||
import DocumentId from "../Explorer/Tree/DocumentId";
|
|
||||||
import StoredProcedure from "../Explorer/Tree/StoredProcedure";
|
|
||||||
import { LocalStorageUtility, StorageKey } from "../Shared/StorageUtility";
|
|
||||||
import { OfferUtils } from "../Utils/OfferUtils";
|
|
||||||
import * as Constants from "./Constants";
|
|
||||||
import { client } from "./CosmosClient";
|
import { client } from "./CosmosClient";
|
||||||
import * as HeadersUtility from "./HeadersUtility";
|
import { LocalStorageUtility, StorageKey } from "../Shared/StorageUtility";
|
||||||
import { sendCachedDataMessage } from "./MessageHandler";
|
import { sendCachedDataMessage } from "./MessageHandler";
|
||||||
|
import { MessageTypes } from "../Contracts/ExplorerContracts";
|
||||||
|
import { OfferUtils } from "../Utils/OfferUtils";
|
||||||
|
import { RequestOptions } from "@azure/cosmos/dist-esm";
|
||||||
|
import StoredProcedure from "../Explorer/Tree/StoredProcedure";
|
||||||
|
import { Platform, configContext } from "../ConfigContext";
|
||||||
|
import DocumentId from "../Explorer/Tree/DocumentId";
|
||||||
|
import ConflictId from "../Explorer/Tree/ConflictId";
|
||||||
|
|
||||||
export function getCommonQueryOptions(options: FeedOptions): any {
|
export function getCommonQueryOptions(options: FeedOptions): any {
|
||||||
const storedItemPerPageSetting: number = LocalStorageUtility.getEntryNumber(StorageKey.ActualItemPerPage);
|
const storedItemPerPageSetting: number = LocalStorageUtility.getEntryNumber(StorageKey.ActualItemPerPage);
|
||||||
@@ -53,55 +55,85 @@ export function queryDocuments(
|
|||||||
return Q(documentsIterator);
|
return Q(documentsIterator);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getPartitionKeyHeaderForConflict(conflictId: ConflictId): Object {
|
export function readStoredProcedures(
|
||||||
const partitionKeyDefinition: DataModels.PartitionKey = conflictId.partitionKey;
|
collection: ViewModels.Collection,
|
||||||
const partitionKeyValue: any = conflictId.partitionKeyValue;
|
options?: any
|
||||||
|
): Q.Promise<DataModels.StoredProcedure[]> {
|
||||||
return getPartitionKeyHeader(partitionKeyDefinition, partitionKeyValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
export function getPartitionKeyHeader(partitionKeyDefinition: DataModels.PartitionKey, partitionKeyValue: any): Object {
|
|
||||||
if (!partitionKeyDefinition) {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (partitionKeyValue === undefined) {
|
|
||||||
return [{}];
|
|
||||||
}
|
|
||||||
|
|
||||||
return [partitionKeyValue];
|
|
||||||
}
|
|
||||||
|
|
||||||
export function updateOffer(
|
|
||||||
offer: DataModels.Offer,
|
|
||||||
newOffer: DataModels.Offer,
|
|
||||||
options?: RequestOptions
|
|
||||||
): Q.Promise<DataModels.Offer> {
|
|
||||||
return Q(
|
|
||||||
client()
|
|
||||||
.offer(offer.id)
|
|
||||||
// TODO Remove casting when SDK types are fixed (https://github.com/Azure/azure-sdk-for-js/issues/10660)
|
|
||||||
.replace((newOffer as unknown) as OfferDefinition, options)
|
|
||||||
.then(response => {
|
|
||||||
return Promise.all([refreshCachedOffers(), refreshCachedResources()]).then(() => response.resource);
|
|
||||||
})
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export function updateDocument(
|
|
||||||
collection: ViewModels.CollectionBase,
|
|
||||||
documentId: DocumentId,
|
|
||||||
newDocument: any
|
|
||||||
): Q.Promise<any> {
|
|
||||||
const partitionKey = documentId.partitionKeyValue;
|
|
||||||
|
|
||||||
return Q(
|
return Q(
|
||||||
client()
|
client()
|
||||||
.database(collection.databaseId)
|
.database(collection.databaseId)
|
||||||
.container(collection.id())
|
.container(collection.id())
|
||||||
.item(documentId.id(), partitionKey)
|
.scripts.storedProcedures.readAll(options)
|
||||||
.replace(newDocument)
|
.fetchAll()
|
||||||
.then(response => response.resource)
|
.then(response => response.resources as DataModels.StoredProcedure[])
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function readStoredProcedure(
|
||||||
|
collection: ViewModels.Collection,
|
||||||
|
requestedResource: DataModels.Resource,
|
||||||
|
options?: any
|
||||||
|
): Q.Promise<DataModels.StoredProcedure> {
|
||||||
|
return Q(
|
||||||
|
client()
|
||||||
|
.database(collection.databaseId)
|
||||||
|
.container(collection.id())
|
||||||
|
.scripts.storedProcedure(requestedResource.id)
|
||||||
|
.read(options)
|
||||||
|
.then(response => response.resource as DataModels.StoredProcedure)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
export function readUserDefinedFunctions(
|
||||||
|
collection: ViewModels.Collection,
|
||||||
|
options: any
|
||||||
|
): Q.Promise<DataModels.UserDefinedFunction[]> {
|
||||||
|
return Q(
|
||||||
|
client()
|
||||||
|
.database(collection.databaseId)
|
||||||
|
.container(collection.id())
|
||||||
|
.scripts.userDefinedFunctions.readAll(options)
|
||||||
|
.fetchAll()
|
||||||
|
.then(response => response.resources as DataModels.UserDefinedFunction[])
|
||||||
|
);
|
||||||
|
}
|
||||||
|
export function readUserDefinedFunction(
|
||||||
|
collection: ViewModels.Collection,
|
||||||
|
requestedResource: DataModels.Resource,
|
||||||
|
options?: any
|
||||||
|
): Q.Promise<DataModels.UserDefinedFunction> {
|
||||||
|
return Q(
|
||||||
|
client()
|
||||||
|
.database(collection.databaseId)
|
||||||
|
.container(collection.id())
|
||||||
|
.scripts.userDefinedFunction(requestedResource.id)
|
||||||
|
.read(options)
|
||||||
|
.then(response => response.resource as DataModels.UserDefinedFunction)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function readTriggers(collection: ViewModels.Collection, options: any): Q.Promise<DataModels.Trigger[]> {
|
||||||
|
return Q(
|
||||||
|
client()
|
||||||
|
.database(collection.databaseId)
|
||||||
|
.container(collection.id())
|
||||||
|
.scripts.triggers.readAll(options)
|
||||||
|
.fetchAll()
|
||||||
|
.then(response => response.resources as DataModels.Trigger[])
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function readTrigger(
|
||||||
|
collection: ViewModels.Collection,
|
||||||
|
requestedResource: DataModels.Resource,
|
||||||
|
options?: any
|
||||||
|
): Q.Promise<DataModels.Trigger> {
|
||||||
|
return Q(
|
||||||
|
client()
|
||||||
|
.database(collection.databaseId)
|
||||||
|
.container(collection.id())
|
||||||
|
.scripts.trigger(requestedResource.id)
|
||||||
|
.read(options)
|
||||||
|
.then(response => response.resource as DataModels.Trigger)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -133,16 +165,6 @@ export function executeStoredProcedure(
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function createDocument(collection: ViewModels.CollectionBase, newDocument: any): Q.Promise<any> {
|
|
||||||
return Q(
|
|
||||||
client()
|
|
||||||
.database(collection.databaseId)
|
|
||||||
.container(collection.id())
|
|
||||||
.items.create(newDocument)
|
|
||||||
.then(response => response.resource)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export function readDocument(collection: ViewModels.CollectionBase, documentId: DocumentId): Q.Promise<any> {
|
export function readDocument(collection: ViewModels.CollectionBase, documentId: DocumentId): Q.Promise<any> {
|
||||||
const partitionKey = documentId.partitionKeyValue;
|
const partitionKey = documentId.partitionKeyValue;
|
||||||
|
|
||||||
@@ -156,6 +178,155 @@ export function readDocument(collection: ViewModels.CollectionBase, documentId:
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getPartitionKeyHeaderForConflict(conflictId: ConflictId): Object {
|
||||||
|
const partitionKeyDefinition: DataModels.PartitionKey = conflictId.partitionKey;
|
||||||
|
const partitionKeyValue: any = conflictId.partitionKeyValue;
|
||||||
|
|
||||||
|
return getPartitionKeyHeader(partitionKeyDefinition, partitionKeyValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getPartitionKeyHeader(partitionKeyDefinition: DataModels.PartitionKey, partitionKeyValue: any): Object {
|
||||||
|
if (!partitionKeyDefinition) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (partitionKeyValue === undefined) {
|
||||||
|
return [{}];
|
||||||
|
}
|
||||||
|
|
||||||
|
return [partitionKeyValue];
|
||||||
|
}
|
||||||
|
|
||||||
|
export function updateDocument(
|
||||||
|
collection: ViewModels.CollectionBase,
|
||||||
|
documentId: DocumentId,
|
||||||
|
newDocument: any
|
||||||
|
): Q.Promise<any> {
|
||||||
|
const partitionKey = documentId.partitionKeyValue;
|
||||||
|
|
||||||
|
return Q(
|
||||||
|
client()
|
||||||
|
.database(collection.databaseId)
|
||||||
|
.container(collection.id())
|
||||||
|
.item(documentId.id(), partitionKey)
|
||||||
|
.replace(newDocument)
|
||||||
|
.then(response => response.resource)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function updateOffer(
|
||||||
|
offer: DataModels.Offer,
|
||||||
|
newOffer: DataModels.Offer,
|
||||||
|
options?: RequestOptions
|
||||||
|
): Q.Promise<DataModels.Offer> {
|
||||||
|
return Q(
|
||||||
|
client()
|
||||||
|
.offer(offer.id)
|
||||||
|
// TODO Remove casting when SDK types are fixed (https://github.com/Azure/azure-sdk-for-js/issues/10660)
|
||||||
|
.replace((newOffer as unknown) as OfferDefinition, options)
|
||||||
|
.then(response => {
|
||||||
|
return Promise.all([refreshCachedOffers(), refreshCachedResources()]).then(() => response.resource);
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function updateStoredProcedure(
|
||||||
|
collection: ViewModels.Collection,
|
||||||
|
storedProcedure: DataModels.StoredProcedure,
|
||||||
|
options: any
|
||||||
|
): Q.Promise<DataModels.StoredProcedure> {
|
||||||
|
return Q(
|
||||||
|
client()
|
||||||
|
.database(collection.databaseId)
|
||||||
|
.container(collection.id())
|
||||||
|
.scripts.storedProcedure(storedProcedure.id)
|
||||||
|
.replace(storedProcedure, options)
|
||||||
|
.then(response => response.resource as DataModels.StoredProcedure)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function updateUserDefinedFunction(
|
||||||
|
collection: ViewModels.Collection,
|
||||||
|
userDefinedFunction: DataModels.UserDefinedFunction,
|
||||||
|
options?: any
|
||||||
|
): Q.Promise<DataModels.UserDefinedFunction> {
|
||||||
|
return Q(
|
||||||
|
client()
|
||||||
|
.database(collection.databaseId)
|
||||||
|
.container(collection.id())
|
||||||
|
.scripts.userDefinedFunction(userDefinedFunction.id)
|
||||||
|
.replace(userDefinedFunction, options)
|
||||||
|
.then(response => response.resource as DataModels.StoredProcedure)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function updateTrigger(
|
||||||
|
collection: ViewModels.Collection,
|
||||||
|
trigger: DataModels.Trigger,
|
||||||
|
options?: any
|
||||||
|
): Q.Promise<DataModels.Trigger> {
|
||||||
|
return Q(
|
||||||
|
client()
|
||||||
|
.database(collection.databaseId)
|
||||||
|
.container(collection.id())
|
||||||
|
.scripts.trigger(trigger.id)
|
||||||
|
.replace(trigger as TriggerDefinition, options)
|
||||||
|
.then(response => response.resource as DataModels.Trigger)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function createDocument(collection: ViewModels.CollectionBase, newDocument: any): Q.Promise<any> {
|
||||||
|
return Q(
|
||||||
|
client()
|
||||||
|
.database(collection.databaseId)
|
||||||
|
.container(collection.id())
|
||||||
|
.items.create(newDocument)
|
||||||
|
.then(response => response.resource as DataModels.StoredProcedure)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function createStoredProcedure(
|
||||||
|
collection: ViewModels.Collection,
|
||||||
|
newStoredProcedure: DataModels.StoredProcedure,
|
||||||
|
options?: any
|
||||||
|
): Q.Promise<DataModels.StoredProcedure> {
|
||||||
|
return Q(
|
||||||
|
client()
|
||||||
|
.database(collection.databaseId)
|
||||||
|
.container(collection.id())
|
||||||
|
.scripts.storedProcedures.create(newStoredProcedure, options)
|
||||||
|
.then(response => response.resource as DataModels.StoredProcedure)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function createUserDefinedFunction(
|
||||||
|
collection: ViewModels.Collection,
|
||||||
|
newUserDefinedFunction: DataModels.UserDefinedFunction,
|
||||||
|
options: any
|
||||||
|
): Q.Promise<DataModels.UserDefinedFunction> {
|
||||||
|
return Q(
|
||||||
|
client()
|
||||||
|
.database(collection.databaseId)
|
||||||
|
.container(collection.id())
|
||||||
|
.scripts.userDefinedFunctions.create(newUserDefinedFunction, options)
|
||||||
|
.then(response => response.resource as DataModels.UserDefinedFunction)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function createTrigger(
|
||||||
|
collection: ViewModels.Collection,
|
||||||
|
newTrigger: DataModels.Trigger,
|
||||||
|
options?: any
|
||||||
|
): Q.Promise<DataModels.Trigger> {
|
||||||
|
return Q(
|
||||||
|
client()
|
||||||
|
.database(collection.databaseId)
|
||||||
|
.container(collection.id())
|
||||||
|
.scripts.triggers.create(newTrigger as TriggerDefinition, options)
|
||||||
|
.then(response => response.resource as DataModels.Trigger)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
export function deleteDocument(collection: ViewModels.CollectionBase, documentId: DocumentId): Q.Promise<any> {
|
export function deleteDocument(collection: ViewModels.CollectionBase, documentId: DocumentId): Q.Promise<any> {
|
||||||
const partitionKey = documentId.partitionKeyValue;
|
const partitionKey = documentId.partitionKeyValue;
|
||||||
|
|
||||||
@@ -184,6 +355,48 @@ export function deleteConflict(
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function deleteStoredProcedure(
|
||||||
|
collection: ViewModels.Collection,
|
||||||
|
storedProcedure: DataModels.StoredProcedure,
|
||||||
|
options: any
|
||||||
|
): Q.Promise<any> {
|
||||||
|
return Q(
|
||||||
|
client()
|
||||||
|
.database(collection.databaseId)
|
||||||
|
.container(collection.id())
|
||||||
|
.scripts.storedProcedure(storedProcedure.id)
|
||||||
|
.delete()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function deleteUserDefinedFunction(
|
||||||
|
collection: ViewModels.Collection,
|
||||||
|
userDefinedFunction: DataModels.UserDefinedFunction,
|
||||||
|
options: any
|
||||||
|
): Q.Promise<any> {
|
||||||
|
return Q(
|
||||||
|
client()
|
||||||
|
.database(collection.databaseId)
|
||||||
|
.container(collection.id())
|
||||||
|
.scripts.userDefinedFunction(userDefinedFunction.id)
|
||||||
|
.delete()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function deleteTrigger(
|
||||||
|
collection: ViewModels.Collection,
|
||||||
|
trigger: DataModels.Trigger,
|
||||||
|
options: any
|
||||||
|
): Q.Promise<any> {
|
||||||
|
return Q(
|
||||||
|
client()
|
||||||
|
.database(collection.databaseId)
|
||||||
|
.container(collection.id())
|
||||||
|
.scripts.trigger(trigger.id)
|
||||||
|
.delete()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
export function readCollectionQuotaInfo(
|
export function readCollectionQuotaInfo(
|
||||||
collection: ViewModels.Collection,
|
collection: ViewModels.Collection,
|
||||||
options: any
|
options: any
|
||||||
|
|||||||
@@ -1,17 +1,18 @@
|
|||||||
import { ConflictDefinition, ItemDefinition, QueryIterator, Resource } from "@azure/cosmos";
|
import * as Constants from "./Constants";
|
||||||
import { RequestOptions } from "@azure/cosmos/dist-esm";
|
|
||||||
import Q from "q";
|
|
||||||
import * as DataModels from "../Contracts/DataModels";
|
import * as DataModels from "../Contracts/DataModels";
|
||||||
import * as ViewModels from "../Contracts/ViewModels";
|
import * as ViewModels from "../Contracts/ViewModels";
|
||||||
|
import Q from "q";
|
||||||
|
import { ConflictDefinition, ItemDefinition, QueryIterator, Resource } from "@azure/cosmos";
|
||||||
|
import { ConsoleDataType } from "../Explorer/Menus/NotificationConsole/NotificationConsoleComponent";
|
||||||
|
import * as DataAccessUtilityBase from "./DataAccessUtilityBase";
|
||||||
|
import * as Logger from "./Logger";
|
||||||
|
import { MinimalQueryIterator, nextPage } from "./IteratorUtilities";
|
||||||
|
import * as NotificationConsoleUtils from "../Utils/NotificationConsoleUtils";
|
||||||
|
import { RequestOptions } from "@azure/cosmos/dist-esm";
|
||||||
|
import StoredProcedure from "../Explorer/Tree/StoredProcedure";
|
||||||
import ConflictId from "../Explorer/Tree/ConflictId";
|
import ConflictId from "../Explorer/Tree/ConflictId";
|
||||||
import DocumentId from "../Explorer/Tree/DocumentId";
|
import DocumentId from "../Explorer/Tree/DocumentId";
|
||||||
import StoredProcedure from "../Explorer/Tree/StoredProcedure";
|
|
||||||
import { logConsoleError, logConsoleInfo, logConsoleProgress } from "../Utils/NotificationConsoleUtils";
|
|
||||||
import * as Constants from "./Constants";
|
|
||||||
import { sendNotificationForError } from "./dataAccess/sendNotificationForError";
|
import { sendNotificationForError } from "./dataAccess/sendNotificationForError";
|
||||||
import * as DataAccessUtilityBase from "./DataAccessUtilityBase";
|
|
||||||
import { MinimalQueryIterator, nextPage } from "./IteratorUtilities";
|
|
||||||
import * as Logger from "./Logger";
|
|
||||||
|
|
||||||
// TODO: Log all promise resolutions and errors with verbosity levels
|
// TODO: Log all promise resolutions and errors with verbosity levels
|
||||||
export function queryDocuments(
|
export function queryDocuments(
|
||||||
@@ -41,6 +42,121 @@ export function getEntityName() {
|
|||||||
return "item";
|
return "item";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function readStoredProcedures(
|
||||||
|
collection: ViewModels.Collection,
|
||||||
|
options: any = {}
|
||||||
|
): Q.Promise<DataModels.StoredProcedure[]> {
|
||||||
|
var deferred = Q.defer<DataModels.StoredProcedure[]>();
|
||||||
|
const id = NotificationConsoleUtils.logConsoleMessage(
|
||||||
|
ConsoleDataType.InProgress,
|
||||||
|
`Querying stored procedures for container ${collection.id()}`
|
||||||
|
);
|
||||||
|
DataAccessUtilityBase.readStoredProcedures(collection, options)
|
||||||
|
.then(
|
||||||
|
(storedProcedures: DataModels.StoredProcedure[]) => {
|
||||||
|
deferred.resolve(storedProcedures);
|
||||||
|
},
|
||||||
|
(error: any) => {
|
||||||
|
NotificationConsoleUtils.logConsoleMessage(
|
||||||
|
ConsoleDataType.Error,
|
||||||
|
`Failed to query stored procedures for container ${collection.id()}: ${JSON.stringify(error)}`
|
||||||
|
);
|
||||||
|
Logger.logError(JSON.stringify(error), "ReadStoredProcedures", error.code);
|
||||||
|
sendNotificationForError(error);
|
||||||
|
deferred.reject(error);
|
||||||
|
}
|
||||||
|
)
|
||||||
|
.finally(() => {
|
||||||
|
NotificationConsoleUtils.clearInProgressMessageWithId(id);
|
||||||
|
});
|
||||||
|
|
||||||
|
return deferred.promise;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function readStoredProcedure(
|
||||||
|
collection: ViewModels.Collection,
|
||||||
|
requestedResource: DataModels.Resource,
|
||||||
|
options?: any
|
||||||
|
): Q.Promise<DataModels.StoredProcedure> {
|
||||||
|
return DataAccessUtilityBase.readStoredProcedure(collection, requestedResource, options);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function readUserDefinedFunctions(
|
||||||
|
collection: ViewModels.Collection,
|
||||||
|
options: any = {}
|
||||||
|
): Q.Promise<DataModels.UserDefinedFunction[]> {
|
||||||
|
var deferred = Q.defer<DataModels.UserDefinedFunction[]>();
|
||||||
|
const id = NotificationConsoleUtils.logConsoleMessage(
|
||||||
|
ConsoleDataType.InProgress,
|
||||||
|
`Querying user defined functions for collection ${collection.id()}`
|
||||||
|
);
|
||||||
|
DataAccessUtilityBase.readUserDefinedFunctions(collection, options)
|
||||||
|
.then(
|
||||||
|
(userDefinedFunctions: DataModels.UserDefinedFunction[]) => {
|
||||||
|
deferred.resolve(userDefinedFunctions);
|
||||||
|
},
|
||||||
|
(error: any) => {
|
||||||
|
NotificationConsoleUtils.logConsoleMessage(
|
||||||
|
ConsoleDataType.Error,
|
||||||
|
`Failed to query user defined functions for container ${collection.id()}: ${JSON.stringify(error)}`
|
||||||
|
);
|
||||||
|
Logger.logError(JSON.stringify(error), "ReadUDFs", error.code);
|
||||||
|
sendNotificationForError(error);
|
||||||
|
deferred.reject(error);
|
||||||
|
}
|
||||||
|
)
|
||||||
|
.finally(() => {
|
||||||
|
NotificationConsoleUtils.clearInProgressMessageWithId(id);
|
||||||
|
});
|
||||||
|
|
||||||
|
return deferred.promise;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function readUserDefinedFunction(
|
||||||
|
collection: ViewModels.Collection,
|
||||||
|
requestedResource: DataModels.Resource,
|
||||||
|
options: any
|
||||||
|
): Q.Promise<DataModels.UserDefinedFunction> {
|
||||||
|
return DataAccessUtilityBase.readUserDefinedFunction(collection, requestedResource, options);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function readTriggers(collection: ViewModels.Collection, options: any): Q.Promise<DataModels.Trigger[]> {
|
||||||
|
var deferred = Q.defer<DataModels.Trigger[]>();
|
||||||
|
|
||||||
|
const id = NotificationConsoleUtils.logConsoleMessage(
|
||||||
|
ConsoleDataType.InProgress,
|
||||||
|
`Querying triggers for container ${collection.id()}`
|
||||||
|
);
|
||||||
|
DataAccessUtilityBase.readTriggers(collection, options)
|
||||||
|
.then(
|
||||||
|
(triggers: DataModels.Trigger[]) => {
|
||||||
|
deferred.resolve(triggers);
|
||||||
|
},
|
||||||
|
(error: any) => {
|
||||||
|
NotificationConsoleUtils.logConsoleMessage(
|
||||||
|
ConsoleDataType.Error,
|
||||||
|
`Failed to query triggers for container ${collection.id()}: ${JSON.stringify(error)}`
|
||||||
|
);
|
||||||
|
Logger.logError(JSON.stringify(error), "ReadTriggers", error.code);
|
||||||
|
sendNotificationForError(error);
|
||||||
|
deferred.reject(error);
|
||||||
|
}
|
||||||
|
)
|
||||||
|
.finally(() => {
|
||||||
|
NotificationConsoleUtils.clearInProgressMessageWithId(id);
|
||||||
|
});
|
||||||
|
|
||||||
|
return deferred.promise;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function readTrigger(
|
||||||
|
collection: ViewModels.Collection,
|
||||||
|
requestedResource: DataModels.Resource,
|
||||||
|
options?: any
|
||||||
|
): Q.Promise<DataModels.Trigger> {
|
||||||
|
return DataAccessUtilityBase.readTrigger(collection, requestedResource, options);
|
||||||
|
}
|
||||||
|
|
||||||
export function executeStoredProcedure(
|
export function executeStoredProcedure(
|
||||||
collection: ViewModels.Collection,
|
collection: ViewModels.Collection,
|
||||||
storedProcedure: StoredProcedure,
|
storedProcedure: StoredProcedure,
|
||||||
@@ -49,17 +165,22 @@ export function executeStoredProcedure(
|
|||||||
): Q.Promise<any> {
|
): Q.Promise<any> {
|
||||||
var deferred = Q.defer<any>();
|
var deferred = Q.defer<any>();
|
||||||
|
|
||||||
const clearMessage = logConsoleProgress(`Executing stored procedure ${storedProcedure.id()}`);
|
const id = NotificationConsoleUtils.logConsoleMessage(
|
||||||
|
ConsoleDataType.InProgress,
|
||||||
|
`Executing stored procedure ${storedProcedure.id()}`
|
||||||
|
);
|
||||||
DataAccessUtilityBase.executeStoredProcedure(collection, storedProcedure, partitionKeyValue, params)
|
DataAccessUtilityBase.executeStoredProcedure(collection, storedProcedure, partitionKeyValue, params)
|
||||||
.then(
|
.then(
|
||||||
(response: any) => {
|
(response: any) => {
|
||||||
deferred.resolve(response);
|
deferred.resolve(response);
|
||||||
logConsoleInfo(
|
NotificationConsoleUtils.logConsoleMessage(
|
||||||
|
ConsoleDataType.Info,
|
||||||
`Finished executing stored procedure ${storedProcedure.id()} for container ${storedProcedure.collection.id()}`
|
`Finished executing stored procedure ${storedProcedure.id()} for container ${storedProcedure.collection.id()}`
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
(error: any) => {
|
(error: any) => {
|
||||||
logConsoleError(
|
NotificationConsoleUtils.logConsoleMessage(
|
||||||
|
ConsoleDataType.Error,
|
||||||
`Failed to execute stored procedure ${storedProcedure.id()} for container ${storedProcedure.collection.id()}: ${JSON.stringify(
|
`Failed to execute stored procedure ${storedProcedure.id()} for container ${storedProcedure.collection.id()}: ${JSON.stringify(
|
||||||
error
|
error
|
||||||
)}`
|
)}`
|
||||||
@@ -70,7 +191,7 @@ export function executeStoredProcedure(
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
clearMessage();
|
NotificationConsoleUtils.clearInProgressMessageWithId(id);
|
||||||
});
|
});
|
||||||
|
|
||||||
return deferred.promise;
|
return deferred.promise;
|
||||||
@@ -84,23 +205,32 @@ export function queryDocumentsPage(
|
|||||||
): Q.Promise<ViewModels.QueryResults> {
|
): Q.Promise<ViewModels.QueryResults> {
|
||||||
var deferred = Q.defer<ViewModels.QueryResults>();
|
var deferred = Q.defer<ViewModels.QueryResults>();
|
||||||
const entityName = getEntityName();
|
const entityName = getEntityName();
|
||||||
const clearMessage = logConsoleProgress(`Querying ${entityName} for container ${resourceName}`);
|
const id = NotificationConsoleUtils.logConsoleMessage(
|
||||||
|
ConsoleDataType.InProgress,
|
||||||
|
`Querying ${entityName} for container ${resourceName}`
|
||||||
|
);
|
||||||
Q(nextPage(documentsIterator, firstItemIndex))
|
Q(nextPage(documentsIterator, firstItemIndex))
|
||||||
.then(
|
.then(
|
||||||
(result: ViewModels.QueryResults) => {
|
(result: ViewModels.QueryResults) => {
|
||||||
const itemCount = (result.documents && result.documents.length) || 0;
|
const itemCount = (result.documents && result.documents.length) || 0;
|
||||||
logConsoleInfo(`Successfully fetched ${itemCount} ${entityName} for container ${resourceName}`);
|
NotificationConsoleUtils.logConsoleMessage(
|
||||||
|
ConsoleDataType.Info,
|
||||||
|
`Successfully fetched ${itemCount} ${entityName} for container ${resourceName}`
|
||||||
|
);
|
||||||
deferred.resolve(result);
|
deferred.resolve(result);
|
||||||
},
|
},
|
||||||
(error: any) => {
|
(error: any) => {
|
||||||
logConsoleError(`Failed to query ${entityName} for container ${resourceName}: ${JSON.stringify(error)}`);
|
NotificationConsoleUtils.logConsoleMessage(
|
||||||
|
ConsoleDataType.Error,
|
||||||
|
`Failed to query ${entityName} for container ${resourceName}: ${JSON.stringify(error)}`
|
||||||
|
);
|
||||||
Logger.logError(JSON.stringify(error), "QueryDocumentsPage", error.code);
|
Logger.logError(JSON.stringify(error), "QueryDocumentsPage", error.code);
|
||||||
sendNotificationForError(error);
|
sendNotificationForError(error);
|
||||||
deferred.reject(error);
|
deferred.reject(error);
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
clearMessage();
|
NotificationConsoleUtils.clearInProgressMessageWithId(id);
|
||||||
});
|
});
|
||||||
|
|
||||||
return deferred.promise;
|
return deferred.promise;
|
||||||
@@ -109,21 +239,27 @@ export function queryDocumentsPage(
|
|||||||
export function readDocument(collection: ViewModels.CollectionBase, documentId: DocumentId): Q.Promise<any> {
|
export function readDocument(collection: ViewModels.CollectionBase, documentId: DocumentId): Q.Promise<any> {
|
||||||
var deferred = Q.defer<any>();
|
var deferred = Q.defer<any>();
|
||||||
const entityName = getEntityName();
|
const entityName = getEntityName();
|
||||||
const clearMessage = logConsoleProgress(`Reading ${entityName} ${documentId.id()}`);
|
const id = NotificationConsoleUtils.logConsoleMessage(
|
||||||
|
ConsoleDataType.InProgress,
|
||||||
|
`Reading ${entityName} ${documentId.id()}`
|
||||||
|
);
|
||||||
DataAccessUtilityBase.readDocument(collection, documentId)
|
DataAccessUtilityBase.readDocument(collection, documentId)
|
||||||
.then(
|
.then(
|
||||||
(document: any) => {
|
(document: any) => {
|
||||||
deferred.resolve(document);
|
deferred.resolve(document);
|
||||||
},
|
},
|
||||||
(error: any) => {
|
(error: any) => {
|
||||||
logConsoleError(`Failed to read ${entityName} ${documentId.id()}: ${JSON.stringify(error)}`);
|
NotificationConsoleUtils.logConsoleMessage(
|
||||||
|
ConsoleDataType.Error,
|
||||||
|
`Failed to read ${entityName} ${documentId.id()}: ${JSON.stringify(error)}`
|
||||||
|
);
|
||||||
Logger.logError(JSON.stringify(error), "ReadDocument", error.code);
|
Logger.logError(JSON.stringify(error), "ReadDocument", error.code);
|
||||||
sendNotificationForError(error);
|
sendNotificationForError(error);
|
||||||
deferred.reject(error);
|
deferred.reject(error);
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
clearMessage();
|
NotificationConsoleUtils.clearInProgressMessageWithId(id);
|
||||||
});
|
});
|
||||||
|
|
||||||
return deferred.promise;
|
return deferred.promise;
|
||||||
@@ -136,22 +272,31 @@ export function updateDocument(
|
|||||||
): Q.Promise<any> {
|
): Q.Promise<any> {
|
||||||
var deferred = Q.defer<any>();
|
var deferred = Q.defer<any>();
|
||||||
const entityName = getEntityName();
|
const entityName = getEntityName();
|
||||||
const clearMessage = logConsoleProgress(`Updating ${entityName} ${documentId.id()}`);
|
const id = NotificationConsoleUtils.logConsoleMessage(
|
||||||
|
ConsoleDataType.InProgress,
|
||||||
|
`Updating ${entityName} ${documentId.id()}`
|
||||||
|
);
|
||||||
DataAccessUtilityBase.updateDocument(collection, documentId, newDocument)
|
DataAccessUtilityBase.updateDocument(collection, documentId, newDocument)
|
||||||
.then(
|
.then(
|
||||||
(updatedDocument: any) => {
|
(updatedDocument: any) => {
|
||||||
logConsoleInfo(`Successfully updated ${entityName} ${documentId.id()}`);
|
NotificationConsoleUtils.logConsoleMessage(
|
||||||
|
ConsoleDataType.Info,
|
||||||
|
`Successfully updated ${entityName} ${documentId.id()}`
|
||||||
|
);
|
||||||
deferred.resolve(updatedDocument);
|
deferred.resolve(updatedDocument);
|
||||||
},
|
},
|
||||||
(error: any) => {
|
(error: any) => {
|
||||||
logConsoleError(`Failed to update ${entityName} ${documentId.id()}: ${JSON.stringify(error)}`);
|
NotificationConsoleUtils.logConsoleMessage(
|
||||||
|
ConsoleDataType.Error,
|
||||||
|
`Failed to update ${entityName} ${documentId.id()}: ${JSON.stringify(error)}`
|
||||||
|
);
|
||||||
Logger.logError(JSON.stringify(error), "UpdateDocument", error.code);
|
Logger.logError(JSON.stringify(error), "UpdateDocument", error.code);
|
||||||
sendNotificationForError(error);
|
sendNotificationForError(error);
|
||||||
deferred.reject(error);
|
deferred.reject(error);
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
clearMessage();
|
NotificationConsoleUtils.clearInProgressMessageWithId(id);
|
||||||
});
|
});
|
||||||
|
|
||||||
return deferred.promise;
|
return deferred.promise;
|
||||||
@@ -163,15 +308,24 @@ export function updateOffer(
|
|||||||
options: RequestOptions
|
options: RequestOptions
|
||||||
): Q.Promise<DataModels.Offer> {
|
): Q.Promise<DataModels.Offer> {
|
||||||
var deferred = Q.defer<any>();
|
var deferred = Q.defer<any>();
|
||||||
const clearMessage = logConsoleProgress(`Updating offer for resource ${offer.resource}`);
|
const id = NotificationConsoleUtils.logConsoleMessage(
|
||||||
|
ConsoleDataType.InProgress,
|
||||||
|
`Updating offer for resource ${offer.resource}`
|
||||||
|
);
|
||||||
DataAccessUtilityBase.updateOffer(offer, newOffer, options)
|
DataAccessUtilityBase.updateOffer(offer, newOffer, options)
|
||||||
.then(
|
.then(
|
||||||
(replacedOffer: DataModels.Offer) => {
|
(replacedOffer: DataModels.Offer) => {
|
||||||
logConsoleInfo(`Successfully updated offer for resource ${offer.resource}`);
|
NotificationConsoleUtils.logConsoleMessage(
|
||||||
|
ConsoleDataType.Info,
|
||||||
|
`Successfully updated offer for resource ${offer.resource}`
|
||||||
|
);
|
||||||
deferred.resolve(replacedOffer);
|
deferred.resolve(replacedOffer);
|
||||||
},
|
},
|
||||||
(error: any) => {
|
(error: any) => {
|
||||||
logConsoleError(`Error updating offer for resource ${offer.resource}: ${JSON.stringify(error)}`);
|
NotificationConsoleUtils.logConsoleMessage(
|
||||||
|
ConsoleDataType.Error,
|
||||||
|
`Error updating offer for resource ${offer.resource}: ${JSON.stringify(error)}`
|
||||||
|
);
|
||||||
Logger.logError(
|
Logger.logError(
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
oldOffer: offer,
|
oldOffer: offer,
|
||||||
@@ -186,7 +340,108 @@ export function updateOffer(
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
clearMessage();
|
NotificationConsoleUtils.clearInProgressMessageWithId(id);
|
||||||
|
});
|
||||||
|
|
||||||
|
return deferred.promise;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function updateStoredProcedure(
|
||||||
|
collection: ViewModels.Collection,
|
||||||
|
storedProcedure: DataModels.StoredProcedure,
|
||||||
|
options?: any
|
||||||
|
): Q.Promise<DataModels.StoredProcedure> {
|
||||||
|
var deferred = Q.defer<any>();
|
||||||
|
const id = NotificationConsoleUtils.logConsoleMessage(
|
||||||
|
ConsoleDataType.InProgress,
|
||||||
|
`Updating stored procedure ${storedProcedure.id}`
|
||||||
|
);
|
||||||
|
DataAccessUtilityBase.updateStoredProcedure(collection, storedProcedure, options)
|
||||||
|
.then(
|
||||||
|
(updatedStoredProcedure: DataModels.StoredProcedure) => {
|
||||||
|
NotificationConsoleUtils.logConsoleMessage(
|
||||||
|
ConsoleDataType.Info,
|
||||||
|
`Successfully updated stored procedure ${storedProcedure.id}`
|
||||||
|
);
|
||||||
|
deferred.resolve(updatedStoredProcedure);
|
||||||
|
},
|
||||||
|
(error: any) => {
|
||||||
|
NotificationConsoleUtils.logConsoleMessage(
|
||||||
|
ConsoleDataType.Error,
|
||||||
|
`Error while updating stored procedure ${storedProcedure.id}:\n ${JSON.stringify(error)}`
|
||||||
|
);
|
||||||
|
Logger.logError(JSON.stringify(error), "UpdateStoredProcedure", error.code);
|
||||||
|
sendNotificationForError(error);
|
||||||
|
deferred.reject(error);
|
||||||
|
}
|
||||||
|
)
|
||||||
|
.finally(() => {
|
||||||
|
NotificationConsoleUtils.clearInProgressMessageWithId(id);
|
||||||
|
});
|
||||||
|
|
||||||
|
return deferred.promise;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function updateUserDefinedFunction(
|
||||||
|
collection: ViewModels.Collection,
|
||||||
|
userDefinedFunction: DataModels.UserDefinedFunction,
|
||||||
|
options: any = {}
|
||||||
|
): Q.Promise<DataModels.UserDefinedFunction> {
|
||||||
|
var deferred = Q.defer<any>();
|
||||||
|
const id = NotificationConsoleUtils.logConsoleMessage(
|
||||||
|
ConsoleDataType.InProgress,
|
||||||
|
`Updating user defined function ${userDefinedFunction.id}`
|
||||||
|
);
|
||||||
|
DataAccessUtilityBase.updateUserDefinedFunction(collection, userDefinedFunction, options)
|
||||||
|
.then(
|
||||||
|
(updatedUserDefinedFunction: DataModels.UserDefinedFunction) => {
|
||||||
|
NotificationConsoleUtils.logConsoleMessage(
|
||||||
|
ConsoleDataType.Info,
|
||||||
|
`Successfully updated user defined function ${userDefinedFunction.id}`
|
||||||
|
);
|
||||||
|
deferred.resolve(updatedUserDefinedFunction);
|
||||||
|
},
|
||||||
|
(error: any) => {
|
||||||
|
NotificationConsoleUtils.logConsoleMessage(
|
||||||
|
ConsoleDataType.Error,
|
||||||
|
`Error while updating user defined function ${userDefinedFunction.id}:\n ${JSON.stringify(error)}`
|
||||||
|
);
|
||||||
|
Logger.logError(JSON.stringify(error), "UpdateUDF", error.code);
|
||||||
|
sendNotificationForError(error);
|
||||||
|
deferred.reject(error);
|
||||||
|
}
|
||||||
|
)
|
||||||
|
.finally(() => {
|
||||||
|
NotificationConsoleUtils.clearInProgressMessageWithId(id);
|
||||||
|
});
|
||||||
|
|
||||||
|
return deferred.promise;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function updateTrigger(
|
||||||
|
collection: ViewModels.Collection,
|
||||||
|
trigger: DataModels.Trigger
|
||||||
|
): Q.Promise<DataModels.Trigger> {
|
||||||
|
var deferred = Q.defer<any>();
|
||||||
|
const id = NotificationConsoleUtils.logConsoleMessage(ConsoleDataType.InProgress, `Updating trigger ${trigger.id}`);
|
||||||
|
DataAccessUtilityBase.updateTrigger(collection, trigger)
|
||||||
|
.then(
|
||||||
|
(updatedTrigger: DataModels.Trigger) => {
|
||||||
|
NotificationConsoleUtils.logConsoleMessage(ConsoleDataType.Info, `Updated trigger ${trigger.id}`);
|
||||||
|
deferred.resolve(updatedTrigger);
|
||||||
|
},
|
||||||
|
(error: any) => {
|
||||||
|
NotificationConsoleUtils.logConsoleMessage(
|
||||||
|
ConsoleDataType.Error,
|
||||||
|
`Error while updating trigger ${trigger.id}:\n ${JSON.stringify(error)}`
|
||||||
|
);
|
||||||
|
Logger.logError(JSON.stringify(error), "UpdateTrigger", error.code);
|
||||||
|
sendNotificationForError(error);
|
||||||
|
deferred.reject(error);
|
||||||
|
}
|
||||||
|
)
|
||||||
|
.finally(() => {
|
||||||
|
NotificationConsoleUtils.clearInProgressMessageWithId(id);
|
||||||
});
|
});
|
||||||
|
|
||||||
return deferred.promise;
|
return deferred.promise;
|
||||||
@@ -195,15 +450,22 @@ export function updateOffer(
|
|||||||
export function createDocument(collection: ViewModels.CollectionBase, newDocument: any): Q.Promise<any> {
|
export function createDocument(collection: ViewModels.CollectionBase, newDocument: any): Q.Promise<any> {
|
||||||
var deferred = Q.defer<any>();
|
var deferred = Q.defer<any>();
|
||||||
const entityName = getEntityName();
|
const entityName = getEntityName();
|
||||||
const clearMessage = logConsoleProgress(`Creating new ${entityName} for container ${collection.id()}`);
|
const id = NotificationConsoleUtils.logConsoleMessage(
|
||||||
|
ConsoleDataType.InProgress,
|
||||||
|
`Creating new ${entityName} for container ${collection.id()}`
|
||||||
|
);
|
||||||
DataAccessUtilityBase.createDocument(collection, newDocument)
|
DataAccessUtilityBase.createDocument(collection, newDocument)
|
||||||
.then(
|
.then(
|
||||||
(savedDocument: any) => {
|
(savedDocument: any) => {
|
||||||
logConsoleInfo(`Successfully created new ${entityName} for container ${collection.id()}`);
|
NotificationConsoleUtils.logConsoleMessage(
|
||||||
|
ConsoleDataType.Info,
|
||||||
|
`Successfully created new ${entityName} for container ${collection.id()}`
|
||||||
|
);
|
||||||
deferred.resolve(savedDocument);
|
deferred.resolve(savedDocument);
|
||||||
},
|
},
|
||||||
(error: any) => {
|
(error: any) => {
|
||||||
logConsoleError(
|
NotificationConsoleUtils.logConsoleMessage(
|
||||||
|
ConsoleDataType.Error,
|
||||||
`Error while creating new ${entityName} for container ${collection.id()}:\n ${JSON.stringify(error)}`
|
`Error while creating new ${entityName} for container ${collection.id()}:\n ${JSON.stringify(error)}`
|
||||||
);
|
);
|
||||||
Logger.logError(JSON.stringify(error), "CreateDocument", error.code);
|
Logger.logError(JSON.stringify(error), "CreateDocument", error.code);
|
||||||
@@ -212,7 +474,115 @@ export function createDocument(collection: ViewModels.CollectionBase, newDocumen
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
clearMessage();
|
NotificationConsoleUtils.clearInProgressMessageWithId(id);
|
||||||
|
});
|
||||||
|
|
||||||
|
return deferred.promise;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function createStoredProcedure(
|
||||||
|
collection: ViewModels.Collection,
|
||||||
|
newStoredProcedure: DataModels.StoredProcedure,
|
||||||
|
options?: any
|
||||||
|
): Q.Promise<DataModels.StoredProcedure> {
|
||||||
|
var deferred = Q.defer<any>();
|
||||||
|
const id = NotificationConsoleUtils.logConsoleMessage(
|
||||||
|
ConsoleDataType.InProgress,
|
||||||
|
`Creating stored procedure for container ${collection.id()}`
|
||||||
|
);
|
||||||
|
DataAccessUtilityBase.createStoredProcedure(collection, newStoredProcedure, options)
|
||||||
|
.then(
|
||||||
|
(createdStoredProcedure: DataModels.StoredProcedure) => {
|
||||||
|
NotificationConsoleUtils.logConsoleMessage(
|
||||||
|
ConsoleDataType.Info,
|
||||||
|
`Successfully created stored procedure for container ${collection.id()}`
|
||||||
|
);
|
||||||
|
deferred.resolve(createdStoredProcedure);
|
||||||
|
},
|
||||||
|
error => {
|
||||||
|
NotificationConsoleUtils.logConsoleMessage(
|
||||||
|
ConsoleDataType.Error,
|
||||||
|
`Error while creating stored procedure for container ${collection.id()}:\n ${JSON.stringify(error)}`
|
||||||
|
);
|
||||||
|
Logger.logError(JSON.stringify(error), "CreateStoredProcedure", error.code);
|
||||||
|
sendNotificationForError(error);
|
||||||
|
deferred.reject(error);
|
||||||
|
}
|
||||||
|
)
|
||||||
|
.finally(() => {
|
||||||
|
NotificationConsoleUtils.clearInProgressMessageWithId(id);
|
||||||
|
});
|
||||||
|
|
||||||
|
return deferred.promise;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function createUserDefinedFunction(
|
||||||
|
collection: ViewModels.Collection,
|
||||||
|
newUserDefinedFunction: DataModels.UserDefinedFunction,
|
||||||
|
options?: any
|
||||||
|
): Q.Promise<DataModels.UserDefinedFunction> {
|
||||||
|
var deferred = Q.defer<any>();
|
||||||
|
const id = NotificationConsoleUtils.logConsoleMessage(
|
||||||
|
ConsoleDataType.InProgress,
|
||||||
|
`Creating user defined function for container ${collection.id()}`
|
||||||
|
);
|
||||||
|
DataAccessUtilityBase.createUserDefinedFunction(collection, newUserDefinedFunction, options)
|
||||||
|
.then(
|
||||||
|
(createdUserDefinedFunction: DataModels.UserDefinedFunction) => {
|
||||||
|
NotificationConsoleUtils.logConsoleMessage(
|
||||||
|
ConsoleDataType.Info,
|
||||||
|
`Successfully created user defined function for container ${collection.id()}`
|
||||||
|
);
|
||||||
|
deferred.resolve(createdUserDefinedFunction);
|
||||||
|
},
|
||||||
|
error => {
|
||||||
|
NotificationConsoleUtils.logConsoleMessage(
|
||||||
|
ConsoleDataType.Error,
|
||||||
|
`Error while creating user defined function for container ${collection.id()}:\n ${JSON.stringify(error)}`
|
||||||
|
);
|
||||||
|
Logger.logError(JSON.stringify(error), "CreateUDF", error.code);
|
||||||
|
sendNotificationForError(error);
|
||||||
|
deferred.reject(error);
|
||||||
|
}
|
||||||
|
)
|
||||||
|
.finally(() => {
|
||||||
|
NotificationConsoleUtils.clearInProgressMessageWithId(id);
|
||||||
|
});
|
||||||
|
|
||||||
|
return deferred.promise;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function createTrigger(
|
||||||
|
collection: ViewModels.Collection,
|
||||||
|
newTrigger: DataModels.Trigger,
|
||||||
|
options: any = {}
|
||||||
|
): Q.Promise<DataModels.Trigger> {
|
||||||
|
var deferred = Q.defer<any>();
|
||||||
|
const id = NotificationConsoleUtils.logConsoleMessage(
|
||||||
|
ConsoleDataType.InProgress,
|
||||||
|
`Creating trigger for container ${collection.id()}`
|
||||||
|
);
|
||||||
|
DataAccessUtilityBase.createTrigger(collection, newTrigger, options)
|
||||||
|
.then(
|
||||||
|
(createdTrigger: DataModels.Trigger) => {
|
||||||
|
NotificationConsoleUtils.logConsoleMessage(
|
||||||
|
ConsoleDataType.Info,
|
||||||
|
`Successfully created trigger for container ${collection.id()}`
|
||||||
|
);
|
||||||
|
deferred.resolve(createdTrigger);
|
||||||
|
},
|
||||||
|
(error: any) => {
|
||||||
|
NotificationConsoleUtils.logConsoleMessage(
|
||||||
|
ConsoleDataType.Error,
|
||||||
|
`Error while creating trigger for container ${collection.id()}:\n ${JSON.stringify(error)}`
|
||||||
|
);
|
||||||
|
Logger.logError(JSON.stringify(error), "CreateTrigger", error.code);
|
||||||
|
sendNotificationForError(error);
|
||||||
|
deferred.reject(error);
|
||||||
|
}
|
||||||
|
)
|
||||||
|
.finally(() => {
|
||||||
|
NotificationConsoleUtils.clearInProgressMessageWithId(id);
|
||||||
});
|
});
|
||||||
|
|
||||||
return deferred.promise;
|
return deferred.promise;
|
||||||
@@ -221,22 +591,31 @@ export function createDocument(collection: ViewModels.CollectionBase, newDocumen
|
|||||||
export function deleteDocument(collection: ViewModels.CollectionBase, documentId: DocumentId): Q.Promise<any> {
|
export function deleteDocument(collection: ViewModels.CollectionBase, documentId: DocumentId): Q.Promise<any> {
|
||||||
var deferred = Q.defer<any>();
|
var deferred = Q.defer<any>();
|
||||||
const entityName = getEntityName();
|
const entityName = getEntityName();
|
||||||
const clearMessage = logConsoleProgress(`Deleting ${entityName} ${documentId.id()}`);
|
const id = NotificationConsoleUtils.logConsoleMessage(
|
||||||
|
ConsoleDataType.InProgress,
|
||||||
|
`Deleting ${entityName} ${documentId.id()}`
|
||||||
|
);
|
||||||
DataAccessUtilityBase.deleteDocument(collection, documentId)
|
DataAccessUtilityBase.deleteDocument(collection, documentId)
|
||||||
.then(
|
.then(
|
||||||
(response: any) => {
|
(response: any) => {
|
||||||
logConsoleInfo(`Successfully deleted ${entityName} ${documentId.id()}`);
|
NotificationConsoleUtils.logConsoleMessage(
|
||||||
|
ConsoleDataType.Info,
|
||||||
|
`Successfully deleted ${entityName} ${documentId.id()}`
|
||||||
|
);
|
||||||
deferred.resolve(response);
|
deferred.resolve(response);
|
||||||
},
|
},
|
||||||
(error: any) => {
|
(error: any) => {
|
||||||
logConsoleError(`Error while deleting ${entityName} ${documentId.id()}:\n ${JSON.stringify(error)}`);
|
NotificationConsoleUtils.logConsoleMessage(
|
||||||
|
ConsoleDataType.Error,
|
||||||
|
`Error while deleting ${entityName} ${documentId.id()}:\n ${JSON.stringify(error)}`
|
||||||
|
);
|
||||||
Logger.logError(JSON.stringify(error), "DeleteDocument", error.code);
|
Logger.logError(JSON.stringify(error), "DeleteDocument", error.code);
|
||||||
sendNotificationForError(error);
|
sendNotificationForError(error);
|
||||||
deferred.reject(error);
|
deferred.reject(error);
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
clearMessage();
|
NotificationConsoleUtils.clearInProgressMessageWithId(id);
|
||||||
});
|
});
|
||||||
|
|
||||||
return deferred.promise;
|
return deferred.promise;
|
||||||
@@ -249,22 +628,134 @@ export function deleteConflict(
|
|||||||
): Q.Promise<any> {
|
): Q.Promise<any> {
|
||||||
var deferred = Q.defer<any>();
|
var deferred = Q.defer<any>();
|
||||||
|
|
||||||
const clearMessage = logConsoleProgress(`Deleting conflict ${conflictId.id()}`);
|
const id = NotificationConsoleUtils.logConsoleMessage(
|
||||||
|
ConsoleDataType.InProgress,
|
||||||
|
`Deleting conflict ${conflictId.id()}`
|
||||||
|
);
|
||||||
DataAccessUtilityBase.deleteConflict(collection, conflictId, options)
|
DataAccessUtilityBase.deleteConflict(collection, conflictId, options)
|
||||||
.then(
|
.then(
|
||||||
(response: any) => {
|
(response: any) => {
|
||||||
logConsoleInfo(`Successfully deleted conflict ${conflictId.id()}`);
|
NotificationConsoleUtils.logConsoleMessage(
|
||||||
|
ConsoleDataType.Info,
|
||||||
|
`Successfully deleted conflict ${conflictId.id()}`
|
||||||
|
);
|
||||||
deferred.resolve(response);
|
deferred.resolve(response);
|
||||||
},
|
},
|
||||||
(error: any) => {
|
(error: any) => {
|
||||||
logConsoleError(`Error while deleting conflict ${conflictId.id()}:\n ${JSON.stringify(error)}`);
|
NotificationConsoleUtils.logConsoleMessage(
|
||||||
|
ConsoleDataType.Error,
|
||||||
|
`Error while deleting conflict ${conflictId.id()}:\n ${JSON.stringify(error)}`
|
||||||
|
);
|
||||||
Logger.logError(JSON.stringify(error), "DeleteConflict", error.code);
|
Logger.logError(JSON.stringify(error), "DeleteConflict", error.code);
|
||||||
sendNotificationForError(error);
|
sendNotificationForError(error);
|
||||||
deferred.reject(error);
|
deferred.reject(error);
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
clearMessage();
|
NotificationConsoleUtils.clearInProgressMessageWithId(id);
|
||||||
|
});
|
||||||
|
|
||||||
|
return deferred.promise;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function deleteStoredProcedure(
|
||||||
|
collection: ViewModels.Collection,
|
||||||
|
storedProcedure: DataModels.StoredProcedure,
|
||||||
|
options: any = {}
|
||||||
|
): Q.Promise<DataModels.StoredProcedure> {
|
||||||
|
var deferred = Q.defer<any>();
|
||||||
|
|
||||||
|
const id = NotificationConsoleUtils.logConsoleMessage(
|
||||||
|
ConsoleDataType.InProgress,
|
||||||
|
`Deleting stored procedure ${storedProcedure.id}`
|
||||||
|
);
|
||||||
|
DataAccessUtilityBase.deleteStoredProcedure(collection, storedProcedure, options)
|
||||||
|
.then(
|
||||||
|
(response: any) => {
|
||||||
|
NotificationConsoleUtils.logConsoleMessage(
|
||||||
|
ConsoleDataType.Info,
|
||||||
|
`Successfully deleted stored procedure ${storedProcedure.id}`
|
||||||
|
);
|
||||||
|
deferred.resolve(response);
|
||||||
|
},
|
||||||
|
(error: any) => {
|
||||||
|
NotificationConsoleUtils.logConsoleMessage(
|
||||||
|
ConsoleDataType.Error,
|
||||||
|
`Error while deleting stored procedure ${storedProcedure.id}:\n ${JSON.stringify(error)}`
|
||||||
|
);
|
||||||
|
Logger.logError(JSON.stringify(error), "DeleteStoredProcedure", error.code);
|
||||||
|
sendNotificationForError(error);
|
||||||
|
deferred.reject(error);
|
||||||
|
}
|
||||||
|
)
|
||||||
|
.finally(() => {
|
||||||
|
NotificationConsoleUtils.clearInProgressMessageWithId(id);
|
||||||
|
});
|
||||||
|
|
||||||
|
return deferred.promise;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function deleteUserDefinedFunction(
|
||||||
|
collection: ViewModels.Collection,
|
||||||
|
userDefinedFunction: DataModels.UserDefinedFunction,
|
||||||
|
options: any = {}
|
||||||
|
): Q.Promise<DataModels.UserDefinedFunction> {
|
||||||
|
var deferred = Q.defer<any>();
|
||||||
|
const id = NotificationConsoleUtils.logConsoleMessage(
|
||||||
|
ConsoleDataType.InProgress,
|
||||||
|
`Deleting user defined function ${userDefinedFunction.id}`
|
||||||
|
);
|
||||||
|
DataAccessUtilityBase.deleteUserDefinedFunction(collection, userDefinedFunction, options)
|
||||||
|
.then(
|
||||||
|
(response: any) => {
|
||||||
|
NotificationConsoleUtils.logConsoleMessage(
|
||||||
|
ConsoleDataType.Info,
|
||||||
|
`Successfully deleted user defined function ${userDefinedFunction.id}`
|
||||||
|
);
|
||||||
|
deferred.resolve(response);
|
||||||
|
},
|
||||||
|
(error: any) => {
|
||||||
|
NotificationConsoleUtils.logConsoleMessage(
|
||||||
|
ConsoleDataType.Error,
|
||||||
|
`Error while deleting user defined function ${userDefinedFunction.id}:\n ${JSON.stringify(error)}`
|
||||||
|
);
|
||||||
|
Logger.logError(JSON.stringify(error), "DeleteUDF", error.code);
|
||||||
|
sendNotificationForError(error);
|
||||||
|
deferred.reject(error);
|
||||||
|
}
|
||||||
|
)
|
||||||
|
.finally(() => {
|
||||||
|
NotificationConsoleUtils.clearInProgressMessageWithId(id);
|
||||||
|
});
|
||||||
|
|
||||||
|
return deferred.promise;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function deleteTrigger(
|
||||||
|
collection: ViewModels.Collection,
|
||||||
|
trigger: DataModels.Trigger,
|
||||||
|
options: any = {}
|
||||||
|
): Q.Promise<DataModels.Trigger> {
|
||||||
|
var deferred = Q.defer<any>();
|
||||||
|
const id = NotificationConsoleUtils.logConsoleMessage(ConsoleDataType.InProgress, `Deleting trigger ${trigger.id}`);
|
||||||
|
DataAccessUtilityBase.deleteTrigger(collection, trigger, options)
|
||||||
|
.then(
|
||||||
|
(response: any) => {
|
||||||
|
NotificationConsoleUtils.logConsoleMessage(ConsoleDataType.Info, `Successfully deleted trigger ${trigger.id}`);
|
||||||
|
deferred.resolve(response);
|
||||||
|
},
|
||||||
|
(error: any) => {
|
||||||
|
NotificationConsoleUtils.logConsoleMessage(
|
||||||
|
ConsoleDataType.Error,
|
||||||
|
`Error while deleting trigger ${trigger.id}:\n ${JSON.stringify(error)}`
|
||||||
|
);
|
||||||
|
Logger.logError(JSON.stringify(error), "DeleteTrigger", error.code);
|
||||||
|
sendNotificationForError(error);
|
||||||
|
deferred.reject(error);
|
||||||
|
}
|
||||||
|
)
|
||||||
|
.finally(() => {
|
||||||
|
NotificationConsoleUtils.clearInProgressMessageWithId(id);
|
||||||
});
|
});
|
||||||
|
|
||||||
return deferred.promise;
|
return deferred.promise;
|
||||||
@@ -284,21 +775,27 @@ export function readCollectionQuotaInfo(
|
|||||||
): Q.Promise<DataModels.CollectionQuotaInfo> {
|
): Q.Promise<DataModels.CollectionQuotaInfo> {
|
||||||
var deferred = Q.defer<DataModels.CollectionQuotaInfo>();
|
var deferred = Q.defer<DataModels.CollectionQuotaInfo>();
|
||||||
|
|
||||||
const clearMessage = logConsoleProgress(`Querying quota info for container ${collection.id}`);
|
const id = NotificationConsoleUtils.logConsoleMessage(
|
||||||
|
ConsoleDataType.InProgress,
|
||||||
|
`Querying quota info for container ${collection.id}`
|
||||||
|
);
|
||||||
DataAccessUtilityBase.readCollectionQuotaInfo(collection, options)
|
DataAccessUtilityBase.readCollectionQuotaInfo(collection, options)
|
||||||
.then(
|
.then(
|
||||||
(quota: DataModels.CollectionQuotaInfo) => {
|
(quota: DataModels.CollectionQuotaInfo) => {
|
||||||
deferred.resolve(quota);
|
deferred.resolve(quota);
|
||||||
},
|
},
|
||||||
(error: any) => {
|
(error: any) => {
|
||||||
logConsoleError(`Error while querying quota info for container ${collection.id}:\n ${JSON.stringify(error)}`);
|
NotificationConsoleUtils.logConsoleMessage(
|
||||||
|
ConsoleDataType.Error,
|
||||||
|
`Error while querying quota info for container ${collection.id}:\n ${JSON.stringify(error)}`
|
||||||
|
);
|
||||||
Logger.logError(JSON.stringify(error), "ReadCollectionQuotaInfo", error.code);
|
Logger.logError(JSON.stringify(error), "ReadCollectionQuotaInfo", error.code);
|
||||||
sendNotificationForError(error);
|
sendNotificationForError(error);
|
||||||
deferred.reject(error);
|
deferred.reject(error);
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
clearMessage();
|
NotificationConsoleUtils.clearInProgressMessageWithId(id);
|
||||||
});
|
});
|
||||||
|
|
||||||
return deferred.promise;
|
return deferred.promise;
|
||||||
@@ -307,21 +804,24 @@ export function readCollectionQuotaInfo(
|
|||||||
export function readOffers(options: any = {}): Q.Promise<DataModels.Offer[]> {
|
export function readOffers(options: any = {}): Q.Promise<DataModels.Offer[]> {
|
||||||
var deferred = Q.defer<DataModels.Offer[]>();
|
var deferred = Q.defer<DataModels.Offer[]>();
|
||||||
|
|
||||||
const clearMessage = logConsoleProgress("Querying offers");
|
const id = NotificationConsoleUtils.logConsoleMessage(ConsoleDataType.InProgress, "Querying offers");
|
||||||
DataAccessUtilityBase.readOffers(options)
|
DataAccessUtilityBase.readOffers(options)
|
||||||
.then(
|
.then(
|
||||||
(offers: DataModels.Offer[]) => {
|
(offers: DataModels.Offer[]) => {
|
||||||
deferred.resolve(offers);
|
deferred.resolve(offers);
|
||||||
},
|
},
|
||||||
(error: any) => {
|
(error: any) => {
|
||||||
logConsoleError(`Error while querying offers:\n ${JSON.stringify(error)}`);
|
NotificationConsoleUtils.logConsoleMessage(
|
||||||
|
ConsoleDataType.Error,
|
||||||
|
`Error while querying offers:\n ${JSON.stringify(error)}`
|
||||||
|
);
|
||||||
Logger.logError(JSON.stringify(error), "ReadOffers", error.code);
|
Logger.logError(JSON.stringify(error), "ReadOffers", error.code);
|
||||||
sendNotificationForError(error);
|
sendNotificationForError(error);
|
||||||
deferred.reject(error);
|
deferred.reject(error);
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
clearMessage();
|
NotificationConsoleUtils.clearInProgressMessageWithId(id);
|
||||||
});
|
});
|
||||||
|
|
||||||
return deferred.promise;
|
return deferred.promise;
|
||||||
@@ -333,21 +833,24 @@ export function readOffer(
|
|||||||
): Q.Promise<DataModels.OfferWithHeaders> {
|
): Q.Promise<DataModels.OfferWithHeaders> {
|
||||||
var deferred = Q.defer<DataModels.OfferWithHeaders>();
|
var deferred = Q.defer<DataModels.OfferWithHeaders>();
|
||||||
|
|
||||||
const clearMessage = logConsoleProgress("Querying offer");
|
const id = NotificationConsoleUtils.logConsoleMessage(ConsoleDataType.InProgress, "Querying offer");
|
||||||
DataAccessUtilityBase.readOffer(requestedResource, options)
|
DataAccessUtilityBase.readOffer(requestedResource, options)
|
||||||
.then(
|
.then(
|
||||||
(offer: DataModels.OfferWithHeaders) => {
|
(offer: DataModels.OfferWithHeaders) => {
|
||||||
deferred.resolve(offer);
|
deferred.resolve(offer);
|
||||||
},
|
},
|
||||||
(error: any) => {
|
(error: any) => {
|
||||||
logConsoleError(`Error while querying offer:\n ${JSON.stringify(error)}`);
|
NotificationConsoleUtils.logConsoleMessage(
|
||||||
|
ConsoleDataType.Error,
|
||||||
|
`Error while querying offer:\n ${JSON.stringify(error)}`
|
||||||
|
);
|
||||||
Logger.logError(JSON.stringify(error), "ReadOffer", error.code);
|
Logger.logError(JSON.stringify(error), "ReadOffer", error.code);
|
||||||
sendNotificationForError(error);
|
sendNotificationForError(error);
|
||||||
deferred.reject(error);
|
deferred.reject(error);
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
clearMessage();
|
NotificationConsoleUtils.clearInProgressMessageWithId(id);
|
||||||
});
|
});
|
||||||
|
|
||||||
return deferred.promise;
|
return deferred.promise;
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import Q from "q";
|
import Q from "q";
|
||||||
import * as MessageHandler from "./MessageHandler";
|
import * as MessageHandler from "./MessageHandler";
|
||||||
|
import { MessageTypes } from "../Contracts/ExplorerContracts";
|
||||||
|
|
||||||
describe("Message Handler", () => {
|
describe("Message Handler", () => {
|
||||||
it("should handle cached message", async () => {
|
it("should handle cached message", async () => {
|
||||||
@@ -25,34 +26,4 @@ describe("Message Handler", () => {
|
|||||||
MessageHandler.runGarbageCollector();
|
MessageHandler.runGarbageCollector();
|
||||||
expect(MessageHandler.RequestMap["123"]).toBeUndefined();
|
expect(MessageHandler.RequestMap["123"]).toBeUndefined();
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("getDataExplorerWindow", () => {
|
|
||||||
it("should return current window if current window has dataExplorerPlatform property", () => {
|
|
||||||
const currentWindow: Window = { dataExplorerPlatform: 0 } as any;
|
|
||||||
|
|
||||||
expect(MessageHandler.getDataExplorerWindow(currentWindow)).toEqual(currentWindow);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should return current window's parent if current window's parent has dataExplorerPlatform property", () => {
|
|
||||||
const parentWindow: Window = { dataExplorerPlatform: 0 } as any;
|
|
||||||
const currentWindow: Window = { parent: parentWindow } as any;
|
|
||||||
|
|
||||||
expect(MessageHandler.getDataExplorerWindow(currentWindow)).toEqual(parentWindow);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should return undefined if none of the windows in the hierarchy have dataExplorerPlatform property and window's parent is reference to itself", () => {
|
|
||||||
const parentWindow: Window = {} as any;
|
|
||||||
(parentWindow as any).parent = parentWindow; // If a window does not have a parent, its parent property is a reference to itself.
|
|
||||||
const currentWindow: Window = { parent: parentWindow } as any;
|
|
||||||
|
|
||||||
expect(MessageHandler.getDataExplorerWindow(currentWindow)).toBeUndefined();
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should return undefined if none of the windows in the hierarchy have dataExplorerPlatform property and window's parent is not defined", () => {
|
|
||||||
const parentWindow: Window = {} as any;
|
|
||||||
const currentWindow: Window = { parent: parentWindow } as any;
|
|
||||||
|
|
||||||
expect(MessageHandler.getDataExplorerWindow(currentWindow)).toBeUndefined();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -48,38 +48,16 @@ export function sendCachedDataMessage<TResponseDataModel>(
|
|||||||
|
|
||||||
export function sendMessage(data: any): void {
|
export function sendMessage(data: any): void {
|
||||||
if (canSendMessage()) {
|
if (canSendMessage()) {
|
||||||
const dataExplorerWindow = getDataExplorerWindow(window);
|
window.parent.postMessage(
|
||||||
if (dataExplorerWindow) {
|
{
|
||||||
dataExplorerWindow.parent.postMessage(
|
signature: "pcIframe",
|
||||||
{
|
data: data
|
||||||
signature: "pcIframe",
|
},
|
||||||
data: data
|
window.document.referrer
|
||||||
},
|
);
|
||||||
dataExplorerWindow.document.referrer
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only exported for unit tests
|
|
||||||
export const getDataExplorerWindow = (currentWindow: Window): Window | undefined => {
|
|
||||||
// Start with the current window and traverse up the parent hierarchy to find a window
|
|
||||||
// with `dataExplorerPlatform` property
|
|
||||||
let dataExplorerWindow: Window | undefined = currentWindow;
|
|
||||||
// TODO: Need to `any` here since the window imports Explorer which can't be in strict mode yet
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
||||||
while (dataExplorerWindow && (dataExplorerWindow as any).dataExplorerPlatform == undefined) {
|
|
||||||
// If a window does not have a parent, its parent property is a reference to itself.
|
|
||||||
if (dataExplorerWindow.parent == dataExplorerWindow) {
|
|
||||||
dataExplorerWindow = undefined;
|
|
||||||
} else {
|
|
||||||
dataExplorerWindow = dataExplorerWindow.parent;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return dataExplorerWindow;
|
|
||||||
};
|
|
||||||
|
|
||||||
export function canSendMessage(): boolean {
|
export function canSendMessage(): boolean {
|
||||||
return window.parent !== window;
|
return window.parent !== window;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,23 +6,26 @@ 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 { DefaultAccountExperienceType } from "../../DefaultAccountExperienceType";
|
import { DefaultAccountExperienceType } from "../../DefaultAccountExperienceType";
|
||||||
import { RequestOptions } from "@azure/cosmos/dist-esm";
|
import { RequestOptions } from "@azure/cosmos/dist-esm";
|
||||||
import * as ARMTypes from "../../Utils/arm/generatedClients/2020-04-01/types";
|
import * as ARMTypes from "../../Utils/arm/generatedClients/2020-04-01-cosmos-db/types";
|
||||||
import { client } from "../CosmosClient";
|
import { client } from "../CosmosClient";
|
||||||
import { createMongoCollectionWithProxy } from "../MongoProxyClient";
|
import { createMongoCollectionWithProxy } from "../MongoProxyClient";
|
||||||
import { createUpdateSqlContainer, getSqlContainer } from "../../Utils/arm/generatedClients/2020-04-01/sqlResources";
|
import {
|
||||||
|
createUpdateSqlContainer,
|
||||||
|
getSqlContainer
|
||||||
|
} from "../../Utils/arm/generatedClients/2020-04-01-cosmos-db/sqlResources";
|
||||||
import {
|
import {
|
||||||
createUpdateCassandraTable,
|
createUpdateCassandraTable,
|
||||||
getCassandraTable
|
getCassandraTable
|
||||||
} from "../../Utils/arm/generatedClients/2020-04-01/cassandraResources";
|
} from "../../Utils/arm/generatedClients/2020-04-01-cosmos-db/cassandraResources";
|
||||||
import {
|
import {
|
||||||
createUpdateMongoDBCollection,
|
createUpdateMongoDBCollection,
|
||||||
getMongoDBCollection
|
getMongoDBCollection
|
||||||
} from "../../Utils/arm/generatedClients/2020-04-01/mongoDBResources";
|
} from "../../Utils/arm/generatedClients/2020-04-01-cosmos-db/mongoDBResources";
|
||||||
import {
|
import {
|
||||||
createUpdateGremlinGraph,
|
createUpdateGremlinGraph,
|
||||||
getGremlinGraph
|
getGremlinGraph
|
||||||
} from "../../Utils/arm/generatedClients/2020-04-01/gremlinResources";
|
} from "../../Utils/arm/generatedClients/2020-04-01-cosmos-db/gremlinResources";
|
||||||
import { createUpdateTable, getTable } from "../../Utils/arm/generatedClients/2020-04-01/tableResources";
|
import { createUpdateTable, getTable } from "../../Utils/arm/generatedClients/2020-04-01-cosmos-db/tableResources";
|
||||||
import { logConsoleProgress, logConsoleError, logConsoleInfo } from "../../Utils/NotificationConsoleUtils";
|
import { logConsoleProgress, logConsoleError, logConsoleInfo } from "../../Utils/NotificationConsoleUtils";
|
||||||
import { logError } from "../Logger";
|
import { logError } from "../Logger";
|
||||||
import { refreshCachedResources } from "../DataAccessUtilityBase";
|
import { refreshCachedResources } from "../DataAccessUtilityBase";
|
||||||
|
|||||||
@@ -9,21 +9,24 @@ import {
|
|||||||
MongoDBDatabaseCreateUpdateParameters,
|
MongoDBDatabaseCreateUpdateParameters,
|
||||||
SqlDatabaseCreateUpdateParameters,
|
SqlDatabaseCreateUpdateParameters,
|
||||||
CreateUpdateOptions
|
CreateUpdateOptions
|
||||||
} from "../../Utils/arm/generatedClients/2020-04-01/types";
|
} from "../../Utils/arm/generatedClients/2020-04-01-cosmos-db/types";
|
||||||
import { client } from "../CosmosClient";
|
import { client } from "../CosmosClient";
|
||||||
import { createUpdateSqlDatabase, getSqlDatabase } from "../../Utils/arm/generatedClients/2020-04-01/sqlResources";
|
import {
|
||||||
|
createUpdateSqlDatabase,
|
||||||
|
getSqlDatabase
|
||||||
|
} from "../../Utils/arm/generatedClients/2020-04-01-cosmos-db/sqlResources";
|
||||||
import {
|
import {
|
||||||
createUpdateCassandraKeyspace,
|
createUpdateCassandraKeyspace,
|
||||||
getCassandraKeyspace
|
getCassandraKeyspace
|
||||||
} from "../../Utils/arm/generatedClients/2020-04-01/cassandraResources";
|
} from "../../Utils/arm/generatedClients/2020-04-01-cosmos-db/cassandraResources";
|
||||||
import {
|
import {
|
||||||
createUpdateMongoDBDatabase,
|
createUpdateMongoDBDatabase,
|
||||||
getMongoDBDatabase
|
getMongoDBDatabase
|
||||||
} from "../../Utils/arm/generatedClients/2020-04-01/mongoDBResources";
|
} from "../../Utils/arm/generatedClients/2020-04-01-cosmos-db/mongoDBResources";
|
||||||
import {
|
import {
|
||||||
createUpdateGremlinDatabase,
|
createUpdateGremlinDatabase,
|
||||||
getGremlinDatabase
|
getGremlinDatabase
|
||||||
} from "../../Utils/arm/generatedClients/2020-04-01/gremlinResources";
|
} from "../../Utils/arm/generatedClients/2020-04-01-cosmos-db/gremlinResources";
|
||||||
import { logConsoleProgress, logConsoleError, logConsoleInfo } from "../../Utils/NotificationConsoleUtils";
|
import { logConsoleProgress, logConsoleError, logConsoleInfo } from "../../Utils/NotificationConsoleUtils";
|
||||||
import { logError } from "../Logger";
|
import { logError } from "../Logger";
|
||||||
import { refreshCachedOffers, refreshCachedResources } from "../DataAccessUtilityBase";
|
import { refreshCachedOffers, refreshCachedResources } from "../DataAccessUtilityBase";
|
||||||
|
|||||||
@@ -1,28 +0,0 @@
|
|||||||
import { Resource, StoredProcedureDefinition } from "@azure/cosmos";
|
|
||||||
import { logConsoleError, logConsoleProgress } from "../../Utils/NotificationConsoleUtils";
|
|
||||||
import { client } from "../CosmosClient";
|
|
||||||
import { logError } from "../Logger";
|
|
||||||
import { sendNotificationForError } from "./sendNotificationForError";
|
|
||||||
|
|
||||||
export async function createStoredProcedure(
|
|
||||||
databaseId: string,
|
|
||||||
collectionId: string,
|
|
||||||
storedProcedure: StoredProcedureDefinition
|
|
||||||
): Promise<StoredProcedureDefinition & Resource> {
|
|
||||||
let createdStoredProcedure: StoredProcedureDefinition & Resource;
|
|
||||||
const clearMessage = logConsoleProgress(`Creating stored procedure ${storedProcedure.id}`);
|
|
||||||
try {
|
|
||||||
const response = await client()
|
|
||||||
.database(databaseId)
|
|
||||||
.container(collectionId)
|
|
||||||
.scripts.storedProcedures.create(storedProcedure);
|
|
||||||
createdStoredProcedure = response.resource;
|
|
||||||
} catch (error) {
|
|
||||||
logConsoleError(`Error while creating stored procedure ${storedProcedure.id}:\n ${JSON.stringify(error)}`);
|
|
||||||
logError(JSON.stringify(error), "CreateStoredProcedure", error.code);
|
|
||||||
sendNotificationForError(error);
|
|
||||||
}
|
|
||||||
|
|
||||||
clearMessage();
|
|
||||||
return createdStoredProcedure;
|
|
||||||
}
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
import { Resource, TriggerDefinition } from "@azure/cosmos";
|
|
||||||
import { logConsoleError, logConsoleProgress } from "../../Utils/NotificationConsoleUtils";
|
|
||||||
import { client } from "../CosmosClient";
|
|
||||||
import { logError } from "../Logger";
|
|
||||||
import { sendNotificationForError } from "./sendNotificationForError";
|
|
||||||
|
|
||||||
export async function createTrigger(
|
|
||||||
databaseId: string,
|
|
||||||
collectionId: string,
|
|
||||||
trigger: TriggerDefinition
|
|
||||||
): Promise<TriggerDefinition & Resource> {
|
|
||||||
let createdTrigger: TriggerDefinition & Resource;
|
|
||||||
const clearMessage = logConsoleProgress(`Creating trigger ${trigger.id}`);
|
|
||||||
try {
|
|
||||||
const response = await client()
|
|
||||||
.database(databaseId)
|
|
||||||
.container(collectionId)
|
|
||||||
.scripts.triggers.create(trigger);
|
|
||||||
createdTrigger = response.resource;
|
|
||||||
} catch (error) {
|
|
||||||
logConsoleError(`Error while creating trigger ${trigger.id}:\n ${JSON.stringify(error)}`);
|
|
||||||
logError(JSON.stringify(error), "CreateTrigger", error.code);
|
|
||||||
sendNotificationForError(error);
|
|
||||||
}
|
|
||||||
|
|
||||||
clearMessage();
|
|
||||||
return createdTrigger;
|
|
||||||
}
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
import { Resource, UserDefinedFunctionDefinition } from "@azure/cosmos";
|
|
||||||
import { logConsoleError, logConsoleProgress } from "../../Utils/NotificationConsoleUtils";
|
|
||||||
import { client } from "../CosmosClient";
|
|
||||||
import { logError } from "../Logger";
|
|
||||||
import { sendNotificationForError } from "./sendNotificationForError";
|
|
||||||
|
|
||||||
export async function createUserDefinedFunction(
|
|
||||||
databaseId: string,
|
|
||||||
collectionId: string,
|
|
||||||
userDefinedFunction: UserDefinedFunctionDefinition
|
|
||||||
): Promise<UserDefinedFunctionDefinition & Resource> {
|
|
||||||
let createdUserDefinedFunction: UserDefinedFunctionDefinition & Resource;
|
|
||||||
const clearMessage = logConsoleProgress(`Creating user defined function ${userDefinedFunction.id}`);
|
|
||||||
try {
|
|
||||||
const response = await client()
|
|
||||||
.database(databaseId)
|
|
||||||
.container(collectionId)
|
|
||||||
.scripts.userDefinedFunctions.create(userDefinedFunction);
|
|
||||||
createdUserDefinedFunction = response.resource;
|
|
||||||
} catch (error) {
|
|
||||||
logConsoleError(`Error while creating user defined function ${userDefinedFunction.id}:\n ${JSON.stringify(error)}`);
|
|
||||||
logError(JSON.stringify(error), "CreateUserupdateUserDefinedFunction", error.code);
|
|
||||||
sendNotificationForError(error);
|
|
||||||
}
|
|
||||||
|
|
||||||
clearMessage();
|
|
||||||
return createdUserDefinedFunction;
|
|
||||||
}
|
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
import { AuthType } from "../../AuthType";
|
import { AuthType } from "../../AuthType";
|
||||||
import { DefaultAccountExperienceType } from "../../DefaultAccountExperienceType";
|
import { DefaultAccountExperienceType } from "../../DefaultAccountExperienceType";
|
||||||
import { deleteSqlContainer } from "../../Utils/arm/generatedClients/2020-04-01/sqlResources";
|
import { deleteSqlContainer } from "../../Utils/arm/generatedClients/2020-04-01-cosmos-db/sqlResources";
|
||||||
import { deleteCassandraTable } from "../../Utils/arm/generatedClients/2020-04-01/cassandraResources";
|
import { deleteCassandraTable } from "../../Utils/arm/generatedClients/2020-04-01-cosmos-db/cassandraResources";
|
||||||
import { deleteMongoDBCollection } from "../../Utils/arm/generatedClients/2020-04-01/mongoDBResources";
|
import { deleteMongoDBCollection } from "../../Utils/arm/generatedClients/2020-04-01-cosmos-db/mongoDBResources";
|
||||||
import { deleteGremlinGraph } from "../../Utils/arm/generatedClients/2020-04-01/gremlinResources";
|
import { deleteGremlinGraph } from "../../Utils/arm/generatedClients/2020-04-01-cosmos-db/gremlinResources";
|
||||||
import { deleteTable } from "../../Utils/arm/generatedClients/2020-04-01/tableResources";
|
import { deleteTable } from "../../Utils/arm/generatedClients/2020-04-01-cosmos-db/tableResources";
|
||||||
import { logConsoleError, logConsoleInfo, logConsoleProgress } from "../../Utils/NotificationConsoleUtils";
|
import { logConsoleError, logConsoleInfo, logConsoleProgress } from "../../Utils/NotificationConsoleUtils";
|
||||||
import { logError } from "../Logger";
|
import { logError } from "../Logger";
|
||||||
import { sendNotificationForError } from "./sendNotificationForError";
|
import { sendNotificationForError } from "./sendNotificationForError";
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import { AuthType } from "../../AuthType";
|
import { AuthType } from "../../AuthType";
|
||||||
import { DefaultAccountExperienceType } from "../../DefaultAccountExperienceType";
|
import { DefaultAccountExperienceType } from "../../DefaultAccountExperienceType";
|
||||||
import { deleteSqlDatabase } from "../../Utils/arm/generatedClients/2020-04-01/sqlResources";
|
import { deleteSqlDatabase } from "../../Utils/arm/generatedClients/2020-04-01-cosmos-db/sqlResources";
|
||||||
import { deleteCassandraKeyspace } from "../../Utils/arm/generatedClients/2020-04-01/cassandraResources";
|
import { deleteCassandraKeyspace } from "../../Utils/arm/generatedClients/2020-04-01-cosmos-db/cassandraResources";
|
||||||
import { deleteMongoDBDatabase } from "../../Utils/arm/generatedClients/2020-04-01/mongoDBResources";
|
import { deleteMongoDBDatabase } from "../../Utils/arm/generatedClients/2020-04-01-cosmos-db/mongoDBResources";
|
||||||
import { deleteGremlinDatabase } from "../../Utils/arm/generatedClients/2020-04-01/gremlinResources";
|
import { deleteGremlinDatabase } from "../../Utils/arm/generatedClients/2020-04-01-cosmos-db/gremlinResources";
|
||||||
import { logConsoleError, logConsoleInfo, logConsoleProgress } from "../../Utils/NotificationConsoleUtils";
|
import { logConsoleError, logConsoleInfo, logConsoleProgress } from "../../Utils/NotificationConsoleUtils";
|
||||||
import { userContext } from "../../UserContext";
|
import { userContext } from "../../UserContext";
|
||||||
import { client } from "../CosmosClient";
|
import { client } from "../CosmosClient";
|
||||||
|
|||||||
@@ -1,26 +0,0 @@
|
|||||||
import { logConsoleError, logConsoleProgress } from "../../Utils/NotificationConsoleUtils";
|
|
||||||
import { client } from "../CosmosClient";
|
|
||||||
import { logError } from "../Logger";
|
|
||||||
import { sendNotificationForError } from "./sendNotificationForError";
|
|
||||||
|
|
||||||
export async function deleteStoredProcedure(
|
|
||||||
databaseId: string,
|
|
||||||
collectionId: string,
|
|
||||||
storedProcedureId: string
|
|
||||||
): Promise<void> {
|
|
||||||
const clearMessage = logConsoleProgress(`Deleting stored procedure ${storedProcedureId}`);
|
|
||||||
try {
|
|
||||||
await client()
|
|
||||||
.database(databaseId)
|
|
||||||
.container(collectionId)
|
|
||||||
.scripts.storedProcedure(storedProcedureId)
|
|
||||||
.delete();
|
|
||||||
} catch (error) {
|
|
||||||
logConsoleError(`Error while deleting stored procedure ${storedProcedureId}:\n ${JSON.stringify(error)}`);
|
|
||||||
logError(JSON.stringify(error), "DeleteStoredProcedure", error.code);
|
|
||||||
sendNotificationForError(error);
|
|
||||||
}
|
|
||||||
|
|
||||||
clearMessage();
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
import { logConsoleError, logConsoleProgress } from "../../Utils/NotificationConsoleUtils";
|
|
||||||
import { client } from "../CosmosClient";
|
|
||||||
import { logError } from "../Logger";
|
|
||||||
import { sendNotificationForError } from "./sendNotificationForError";
|
|
||||||
|
|
||||||
export async function deleteTrigger(databaseId: string, collectionId: string, triggerId: string): Promise<void> {
|
|
||||||
const clearMessage = logConsoleProgress(`Deleting trigger ${triggerId}`);
|
|
||||||
try {
|
|
||||||
await client()
|
|
||||||
.database(databaseId)
|
|
||||||
.container(collectionId)
|
|
||||||
.scripts.trigger(triggerId)
|
|
||||||
.delete();
|
|
||||||
} catch (error) {
|
|
||||||
logConsoleError(`Error while deleting trigger ${triggerId}:\n ${JSON.stringify(error)}`);
|
|
||||||
logError(JSON.stringify(error), "DeleteTrigger", error.code);
|
|
||||||
sendNotificationForError(error);
|
|
||||||
}
|
|
||||||
|
|
||||||
clearMessage();
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
import { logConsoleError, logConsoleProgress } from "../../Utils/NotificationConsoleUtils";
|
|
||||||
import { client } from "../CosmosClient";
|
|
||||||
import { logError } from "../Logger";
|
|
||||||
import { sendNotificationForError } from "./sendNotificationForError";
|
|
||||||
|
|
||||||
export async function deleteUserDefinedFunction(databaseId: string, collectionId: string, id: string): Promise<void> {
|
|
||||||
const clearMessage = logConsoleProgress(`Deleting user defined function ${id}`);
|
|
||||||
try {
|
|
||||||
await client()
|
|
||||||
.database(databaseId)
|
|
||||||
.container(collectionId)
|
|
||||||
.scripts.userDefinedFunction(id)
|
|
||||||
.delete();
|
|
||||||
} catch (error) {
|
|
||||||
logConsoleError(`Error while deleting user defined function ${id}:\n ${JSON.stringify(error)}`);
|
|
||||||
logError(JSON.stringify(error), "DeleteUserDefinedFunction", error.code);
|
|
||||||
sendNotificationForError(error);
|
|
||||||
}
|
|
||||||
|
|
||||||
clearMessage();
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
@@ -2,11 +2,11 @@ import * as DataModels from "../../Contracts/DataModels";
|
|||||||
import { AuthType } from "../../AuthType";
|
import { AuthType } from "../../AuthType";
|
||||||
import { DefaultAccountExperienceType } from "../../DefaultAccountExperienceType";
|
import { DefaultAccountExperienceType } from "../../DefaultAccountExperienceType";
|
||||||
import { client } from "../CosmosClient";
|
import { client } from "../CosmosClient";
|
||||||
import { listSqlContainers } from "../../Utils/arm/generatedClients/2020-04-01/sqlResources";
|
import { listSqlContainers } from "../../Utils/arm/generatedClients/2020-04-01-cosmos-db/sqlResources";
|
||||||
import { listCassandraTables } from "../../Utils/arm/generatedClients/2020-04-01/cassandraResources";
|
import { listCassandraTables } from "../../Utils/arm/generatedClients/2020-04-01-cosmos-db/cassandraResources";
|
||||||
import { listMongoDBCollections } from "../../Utils/arm/generatedClients/2020-04-01/mongoDBResources";
|
import { listMongoDBCollections } from "../../Utils/arm/generatedClients/2020-04-01-cosmos-db/mongoDBResources";
|
||||||
import { listGremlinGraphs } from "../../Utils/arm/generatedClients/2020-04-01/gremlinResources";
|
import { listGremlinGraphs } from "../../Utils/arm/generatedClients/2020-04-01-cosmos-db/gremlinResources";
|
||||||
import { listTables } from "../../Utils/arm/generatedClients/2020-04-01/tableResources";
|
import { listTables } from "../../Utils/arm/generatedClients/2020-04-01-cosmos-db/tableResources";
|
||||||
import { logConsoleProgress, logConsoleError } from "../../Utils/NotificationConsoleUtils";
|
import { logConsoleProgress, logConsoleError } from "../../Utils/NotificationConsoleUtils";
|
||||||
import { logError } from "../Logger";
|
import { logError } from "../Logger";
|
||||||
import { sendNotificationForError } from "./sendNotificationForError";
|
import { sendNotificationForError } from "./sendNotificationForError";
|
||||||
|
|||||||
@@ -2,10 +2,10 @@ import * as DataModels from "../../Contracts/DataModels";
|
|||||||
import { AuthType } from "../../AuthType";
|
import { AuthType } from "../../AuthType";
|
||||||
import { DefaultAccountExperienceType } from "../../DefaultAccountExperienceType";
|
import { DefaultAccountExperienceType } from "../../DefaultAccountExperienceType";
|
||||||
import { client } from "../CosmosClient";
|
import { client } from "../CosmosClient";
|
||||||
import { listSqlDatabases } from "../../Utils/arm/generatedClients/2020-04-01/sqlResources";
|
import { listSqlDatabases } from "../../Utils/arm/generatedClients/2020-04-01-cosmos-db/sqlResources";
|
||||||
import { listCassandraKeyspaces } from "../../Utils/arm/generatedClients/2020-04-01/cassandraResources";
|
import { listCassandraKeyspaces } from "../../Utils/arm/generatedClients/2020-04-01-cosmos-db/cassandraResources";
|
||||||
import { listMongoDBDatabases } from "../../Utils/arm/generatedClients/2020-04-01/mongoDBResources";
|
import { listMongoDBDatabases } from "../../Utils/arm/generatedClients/2020-04-01-cosmos-db/mongoDBResources";
|
||||||
import { listGremlinDatabases } from "../../Utils/arm/generatedClients/2020-04-01/gremlinResources";
|
import { listGremlinDatabases } from "../../Utils/arm/generatedClients/2020-04-01-cosmos-db/gremlinResources";
|
||||||
import { logConsoleProgress, logConsoleError } from "../../Utils/NotificationConsoleUtils";
|
import { logConsoleProgress, logConsoleError } from "../../Utils/NotificationConsoleUtils";
|
||||||
import { logError } from "../Logger";
|
import { logError } from "../Logger";
|
||||||
import { sendNotificationForError } from "./sendNotificationForError";
|
import { sendNotificationForError } from "./sendNotificationForError";
|
||||||
|
|||||||
@@ -1,27 +0,0 @@
|
|||||||
import { Resource, StoredProcedureDefinition } from "@azure/cosmos";
|
|
||||||
import { logConsoleError, logConsoleProgress } from "../../Utils/NotificationConsoleUtils";
|
|
||||||
import { client } from "../CosmosClient";
|
|
||||||
import { logError } from "../Logger";
|
|
||||||
import { sendNotificationForError } from "./sendNotificationForError";
|
|
||||||
|
|
||||||
export async function readStoredProcedures(
|
|
||||||
databaseId: string,
|
|
||||||
collectionId: string
|
|
||||||
): Promise<(StoredProcedureDefinition & Resource)[]> {
|
|
||||||
let sprocs: (StoredProcedureDefinition & Resource)[];
|
|
||||||
const clearMessage = logConsoleProgress(`Querying stored procedures for container ${collectionId}`);
|
|
||||||
try {
|
|
||||||
const response = await client()
|
|
||||||
.database(databaseId)
|
|
||||||
.container(collectionId)
|
|
||||||
.scripts.storedProcedures.readAll()
|
|
||||||
.fetchAll();
|
|
||||||
sprocs = response.resources;
|
|
||||||
} catch (error) {
|
|
||||||
logConsoleError(`Failed to query stored procedures for container ${collectionId}: ${JSON.stringify(error)}`);
|
|
||||||
logError(JSON.stringify(error), "ReadStoredProcedures", error.code);
|
|
||||||
sendNotificationForError(error);
|
|
||||||
}
|
|
||||||
clearMessage();
|
|
||||||
return sprocs;
|
|
||||||
}
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
import { Resource, TriggerDefinition } from "@azure/cosmos";
|
|
||||||
import { logConsoleError, logConsoleProgress } from "../../Utils/NotificationConsoleUtils";
|
|
||||||
import { client } from "../CosmosClient";
|
|
||||||
import { logError } from "../Logger";
|
|
||||||
import { sendNotificationForError } from "./sendNotificationForError";
|
|
||||||
|
|
||||||
export async function readTriggers(
|
|
||||||
databaseId: string,
|
|
||||||
collectionId: string
|
|
||||||
): Promise<(TriggerDefinition & Resource)[]> {
|
|
||||||
let triggers: (TriggerDefinition & Resource)[];
|
|
||||||
const clearMessage = logConsoleProgress(`Querying triggers for container ${collectionId}`);
|
|
||||||
try {
|
|
||||||
const response = await client()
|
|
||||||
.database(databaseId)
|
|
||||||
.container(collectionId)
|
|
||||||
.scripts.triggers.readAll()
|
|
||||||
.fetchAll();
|
|
||||||
triggers = response.resources;
|
|
||||||
} catch (error) {
|
|
||||||
logConsoleError(`Failed to query triggers for container ${collectionId}: ${JSON.stringify(error)}`);
|
|
||||||
logError(JSON.stringify(error), "ReadTriggers", error.code);
|
|
||||||
sendNotificationForError(error);
|
|
||||||
}
|
|
||||||
clearMessage();
|
|
||||||
return triggers;
|
|
||||||
}
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
import { Resource, UserDefinedFunctionDefinition } from "@azure/cosmos";
|
|
||||||
import { logConsoleError, logConsoleProgress } from "../../Utils/NotificationConsoleUtils";
|
|
||||||
import { client } from "../CosmosClient";
|
|
||||||
import { logError } from "../Logger";
|
|
||||||
import { sendNotificationForError } from "./sendNotificationForError";
|
|
||||||
|
|
||||||
export async function readUserDefinedFunctions(
|
|
||||||
databaseId: string,
|
|
||||||
collectionId: string
|
|
||||||
): Promise<(UserDefinedFunctionDefinition & Resource)[]> {
|
|
||||||
let udfs: (UserDefinedFunctionDefinition & Resource)[];
|
|
||||||
const clearMessage = logConsoleProgress(`Querying user defined functions for container ${collectionId}`);
|
|
||||||
try {
|
|
||||||
const response = await client()
|
|
||||||
.database(databaseId)
|
|
||||||
.container(collectionId)
|
|
||||||
.scripts.userDefinedFunctions.readAll()
|
|
||||||
.fetchAll();
|
|
||||||
udfs = response.resources;
|
|
||||||
} catch (error) {
|
|
||||||
logConsoleError(`Failed to query user defined functions for container ${collectionId}: ${JSON.stringify(error)}`);
|
|
||||||
logError(JSON.stringify(error), "ReadUserDefinedFunctions", error.code);
|
|
||||||
sendNotificationForError(error);
|
|
||||||
}
|
|
||||||
clearMessage();
|
|
||||||
return udfs;
|
|
||||||
}
|
|
||||||
@@ -6,23 +6,26 @@ import {
|
|||||||
ExtendedResourceProperties,
|
ExtendedResourceProperties,
|
||||||
SqlContainerCreateUpdateParameters,
|
SqlContainerCreateUpdateParameters,
|
||||||
SqlContainerResource
|
SqlContainerResource
|
||||||
} from "../../Utils/arm/generatedClients/2020-04-01/types";
|
} from "../../Utils/arm/generatedClients/2020-04-01-cosmos-db/types";
|
||||||
import { RequestOptions } from "@azure/cosmos/dist-esm";
|
import { RequestOptions } from "@azure/cosmos/dist-esm";
|
||||||
import { client } from "../CosmosClient";
|
import { client } from "../CosmosClient";
|
||||||
import { createUpdateSqlContainer, getSqlContainer } from "../../Utils/arm/generatedClients/2020-04-01/sqlResources";
|
import {
|
||||||
|
createUpdateSqlContainer,
|
||||||
|
getSqlContainer
|
||||||
|
} from "../../Utils/arm/generatedClients/2020-04-01-cosmos-db/sqlResources";
|
||||||
import {
|
import {
|
||||||
createUpdateCassandraTable,
|
createUpdateCassandraTable,
|
||||||
getCassandraTable
|
getCassandraTable
|
||||||
} from "../../Utils/arm/generatedClients/2020-04-01/cassandraResources";
|
} from "../../Utils/arm/generatedClients/2020-04-01-cosmos-db/cassandraResources";
|
||||||
import {
|
import {
|
||||||
createUpdateMongoDBCollection,
|
createUpdateMongoDBCollection,
|
||||||
getMongoDBCollection
|
getMongoDBCollection
|
||||||
} from "../../Utils/arm/generatedClients/2020-04-01/mongoDBResources";
|
} from "../../Utils/arm/generatedClients/2020-04-01-cosmos-db/mongoDBResources";
|
||||||
import {
|
import {
|
||||||
createUpdateGremlinGraph,
|
createUpdateGremlinGraph,
|
||||||
getGremlinGraph
|
getGremlinGraph
|
||||||
} from "../../Utils/arm/generatedClients/2020-04-01/gremlinResources";
|
} from "../../Utils/arm/generatedClients/2020-04-01-cosmos-db/gremlinResources";
|
||||||
import { createUpdateTable, getTable } from "../../Utils/arm/generatedClients/2020-04-01/tableResources";
|
import { createUpdateTable, getTable } from "../../Utils/arm/generatedClients/2020-04-01-cosmos-db/tableResources";
|
||||||
import { logConsoleError, logConsoleInfo, logConsoleProgress } from "../../Utils/NotificationConsoleUtils";
|
import { logConsoleError, logConsoleInfo, logConsoleProgress } from "../../Utils/NotificationConsoleUtils";
|
||||||
import { logError } from "../Logger";
|
import { logError } from "../Logger";
|
||||||
import { refreshCachedResources } from "../DataAccessUtilityBase";
|
import { refreshCachedResources } from "../DataAccessUtilityBase";
|
||||||
|
|||||||
@@ -1,29 +0,0 @@
|
|||||||
import { Resource, StoredProcedureDefinition } from "@azure/cosmos";
|
|
||||||
import { logConsoleError, logConsoleProgress } from "../../Utils/NotificationConsoleUtils";
|
|
||||||
import { client } from "../CosmosClient";
|
|
||||||
import { logError } from "../Logger";
|
|
||||||
import { sendNotificationForError } from "./sendNotificationForError";
|
|
||||||
|
|
||||||
export async function updateStoredProcedure(
|
|
||||||
databaseId: string,
|
|
||||||
collectionId: string,
|
|
||||||
storedProcedure: StoredProcedureDefinition
|
|
||||||
): Promise<StoredProcedureDefinition & Resource> {
|
|
||||||
let updatedStoredProcedure: StoredProcedureDefinition & Resource;
|
|
||||||
const clearMessage = logConsoleProgress(`Updating stored procedure ${storedProcedure.id}`);
|
|
||||||
try {
|
|
||||||
const response = await client()
|
|
||||||
.database(databaseId)
|
|
||||||
.container(collectionId)
|
|
||||||
.scripts.storedProcedure(storedProcedure.id)
|
|
||||||
.replace(storedProcedure);
|
|
||||||
updatedStoredProcedure = response.resource;
|
|
||||||
} catch (error) {
|
|
||||||
logConsoleError(`Error while updating stored procedure ${storedProcedure.id}:\n ${JSON.stringify(error)}`);
|
|
||||||
logError(JSON.stringify(error), "UpdateStoredProcedure", error.code);
|
|
||||||
sendNotificationForError(error);
|
|
||||||
}
|
|
||||||
|
|
||||||
clearMessage();
|
|
||||||
return updatedStoredProcedure;
|
|
||||||
}
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
import { TriggerDefinition } from "@azure/cosmos";
|
|
||||||
import { logConsoleError, logConsoleProgress } from "../../Utils/NotificationConsoleUtils";
|
|
||||||
import { client } from "../CosmosClient";
|
|
||||||
import { logError } from "../Logger";
|
|
||||||
import { sendNotificationForError } from "./sendNotificationForError";
|
|
||||||
|
|
||||||
export async function updateTrigger(
|
|
||||||
databaseId: string,
|
|
||||||
collectionId: string,
|
|
||||||
trigger: TriggerDefinition
|
|
||||||
): Promise<TriggerDefinition> {
|
|
||||||
let updatedTrigger: TriggerDefinition;
|
|
||||||
const clearMessage = logConsoleProgress(`Updating trigger ${trigger.id}`);
|
|
||||||
try {
|
|
||||||
const response = await client()
|
|
||||||
.database(databaseId)
|
|
||||||
.container(collectionId)
|
|
||||||
.scripts.trigger(trigger.id)
|
|
||||||
.replace(trigger);
|
|
||||||
updatedTrigger = response.resource;
|
|
||||||
} catch (error) {
|
|
||||||
logConsoleError(`Error while updating trigger ${trigger.id}:\n ${JSON.stringify(error)}`);
|
|
||||||
logError(JSON.stringify(error), "UpdateTrigger", error.code);
|
|
||||||
sendNotificationForError(error);
|
|
||||||
}
|
|
||||||
|
|
||||||
clearMessage();
|
|
||||||
return updatedTrigger;
|
|
||||||
}
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
import { Resource, UserDefinedFunctionDefinition } from "@azure/cosmos";
|
|
||||||
import { logConsoleError, logConsoleProgress } from "../../Utils/NotificationConsoleUtils";
|
|
||||||
import { client } from "../CosmosClient";
|
|
||||||
import { logError } from "../Logger";
|
|
||||||
import { sendNotificationForError } from "./sendNotificationForError";
|
|
||||||
|
|
||||||
export async function updateUserDefinedFunction(
|
|
||||||
databaseId: string,
|
|
||||||
collectionId: string,
|
|
||||||
userDefinedFunction: UserDefinedFunctionDefinition
|
|
||||||
): Promise<UserDefinedFunctionDefinition & Resource> {
|
|
||||||
let updatedUserDefinedFunction: UserDefinedFunctionDefinition & Resource;
|
|
||||||
const clearMessage = logConsoleProgress(`Updating user defined function ${userDefinedFunction.id}`);
|
|
||||||
try {
|
|
||||||
const response = await client()
|
|
||||||
.database(databaseId)
|
|
||||||
.container(collectionId)
|
|
||||||
.scripts.userDefinedFunction(userDefinedFunction.id)
|
|
||||||
.replace(userDefinedFunction);
|
|
||||||
updatedUserDefinedFunction = response.resource;
|
|
||||||
} catch (error) {
|
|
||||||
logConsoleError(`Error while updating user defined function ${userDefinedFunction.id}:\n ${JSON.stringify(error)}`);
|
|
||||||
logError(JSON.stringify(error), "UpdateUserupdateUserDefinedFunction", error.code);
|
|
||||||
sendNotificationForError(error);
|
|
||||||
}
|
|
||||||
|
|
||||||
clearMessage();
|
|
||||||
return updatedUserDefinedFunction;
|
|
||||||
}
|
|
||||||
@@ -6,7 +6,7 @@ export enum Platform {
|
|||||||
|
|
||||||
interface ConfigContext {
|
interface ConfigContext {
|
||||||
platform: Platform;
|
platform: Platform;
|
||||||
allowedParentFrameOrigins: string[];
|
allowedParentFrameOrigins: RegExp;
|
||||||
gitSha?: string;
|
gitSha?: string;
|
||||||
proxyPath?: string;
|
proxyPath?: string;
|
||||||
AAD_ENDPOINT: string;
|
AAD_ENDPOINT: string;
|
||||||
@@ -30,12 +30,7 @@ interface ConfigContext {
|
|||||||
// Default configuration
|
// Default configuration
|
||||||
let configContext: Readonly<ConfigContext> = {
|
let configContext: Readonly<ConfigContext> = {
|
||||||
platform: Platform.Portal,
|
platform: Platform.Portal,
|
||||||
allowedParentFrameOrigins: [
|
allowedParentFrameOrigins: /^https:\/\/portal\.azure\.com$|^https:\/\/portal\.azure\.us$|^https:\/\/portal\.azure\.cn$|^https:\/\/portal\.microsoftazure\.de$|^https:\/\/.+\.portal\.azure\.com$|^https:\/\/.+\.portal\.azure\.us$|^https:\/\/.+\.portal\.azure\.cn$|^https:\/\/.+\.portal\.microsoftazure\.de$|^https:\/\/main\.documentdb\.ext\.azure\.com$|^https:\/\/main\.documentdb\.ext\.microsoftazure\.de$|^https:\/\/main\.documentdb\.ext\.azure\.cn$|^https:\/\/main\.documentdb\.ext\.azure\.us$/,
|
||||||
`^https:\\/\\/cosmos.azure.(com|cn|us)$`,
|
|
||||||
`^https:\\/\\/[\\.\\w]+.portal.azure.(com|cn|us)$`,
|
|
||||||
`^https:\\/\\/[\\.\\w]+.ext.azure.(com|cn|us)$`,
|
|
||||||
`^https:\\/\\/[\\.\\w]+microsoftazure.de$`
|
|
||||||
],
|
|
||||||
// Webpack injects this at build time
|
// Webpack injects this at build time
|
||||||
gitSha: process.env.GIT_SHA,
|
gitSha: process.env.GIT_SHA,
|
||||||
hostedExplorerURL: "https://cosmos.azure.com/",
|
hostedExplorerURL: "https://cosmos.azure.com/",
|
||||||
@@ -78,13 +73,8 @@ export async function initializeConfiguration(): Promise<ConfigContext> {
|
|||||||
const response = await fetch("./config.json");
|
const response = await fetch("./config.json");
|
||||||
if (response.status === 200) {
|
if (response.status === 200) {
|
||||||
try {
|
try {
|
||||||
const { allowedParentFrameOrigins, ...externalConfig } = await response.json();
|
const externalConfig = await response.json();
|
||||||
Object.assign(configContext, externalConfig);
|
Object.assign(configContext, externalConfig);
|
||||||
if (allowedParentFrameOrigins && allowedParentFrameOrigins.length > 0) {
|
|
||||||
updateConfigContext({
|
|
||||||
allowedParentFrameOrigins: [...configContext.allowedParentFrameOrigins, ...allowedParentFrameOrigins]
|
|
||||||
});
|
|
||||||
}
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Unable to parse json in config file");
|
console.error("Unable to parse json in config file");
|
||||||
console.error(error);
|
console.error(error);
|
||||||
|
|||||||
@@ -88,6 +88,10 @@ export interface Resource {
|
|||||||
id: string;
|
id: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface ResourceRequest {
|
||||||
|
id: string;
|
||||||
|
}
|
||||||
|
|
||||||
export interface Collection extends Resource {
|
export interface Collection extends Resource {
|
||||||
defaultTtl?: number;
|
defaultTtl?: number;
|
||||||
indexingPolicy?: IndexingPolicy;
|
indexingPolicy?: IndexingPolicy;
|
||||||
@@ -100,12 +104,39 @@ export interface Collection extends Resource {
|
|||||||
geospatialConfig?: GeospatialConfig;
|
geospatialConfig?: GeospatialConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface CreateCollectionWithRpResponse extends Resource {
|
||||||
|
properties: Collection;
|
||||||
|
name: string;
|
||||||
|
type: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CollectionRequest extends ResourceRequest {
|
||||||
|
defaultTtl?: number;
|
||||||
|
indexingPolicy?: IndexingPolicy;
|
||||||
|
partitionKey?: PartitionKey;
|
||||||
|
uniqueKeyPolicy?: UniqueKeyPolicy;
|
||||||
|
conflictResolutionPolicy?: ConflictResolutionPolicy;
|
||||||
|
}
|
||||||
|
|
||||||
export interface Database extends Resource {
|
export interface Database extends Resource {
|
||||||
collections?: Collection[];
|
collections?: Collection[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface DocumentId extends Resource {}
|
export interface DocumentId extends Resource {}
|
||||||
|
|
||||||
|
export interface Script extends Resource {
|
||||||
|
body: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface StoredProcedure extends Script {}
|
||||||
|
|
||||||
|
export interface UserDefinedFunction extends Script {}
|
||||||
|
|
||||||
|
export interface Trigger extends Script {
|
||||||
|
triggerType: string;
|
||||||
|
triggerOperation: string;
|
||||||
|
}
|
||||||
|
|
||||||
export interface ConflictId extends Resource {
|
export interface ConflictId extends Resource {
|
||||||
resourceId?: string;
|
resourceId?: string;
|
||||||
resourceType?: string;
|
resourceType?: string;
|
||||||
@@ -228,6 +259,28 @@ export interface ErrorDataModel {
|
|||||||
code?: string;
|
code?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Defines a property bag for telemetry e.g. see ITelemetryError.
|
||||||
|
*/
|
||||||
|
export interface ITelemetryProperties {
|
||||||
|
[propertyName: string]: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Defines a property bag for telemetry e.g. see ITelemetryError.
|
||||||
|
*/
|
||||||
|
export interface ITelemetryEvent {
|
||||||
|
name: string;
|
||||||
|
properties?: ITelemetryProperties;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Defines an error to be logged as telemetry data.
|
||||||
|
*/
|
||||||
|
export interface ITelemetryError extends ITelemetryEvent {
|
||||||
|
error: any;
|
||||||
|
}
|
||||||
|
|
||||||
export interface CreateDatabaseAndCollectionRequest {
|
export interface CreateDatabaseAndCollectionRequest {
|
||||||
databaseId: string;
|
databaseId: string;
|
||||||
collectionId: string;
|
collectionId: string;
|
||||||
@@ -254,6 +307,11 @@ export enum AutopilotTier {
|
|||||||
Tier4 = 4
|
Tier4 = 4
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface RpOptions {
|
||||||
|
// tier is sent as string, autoscale as object (AutoPilotCreationSettings)
|
||||||
|
[key: string]: string | AutoPilotCreationSettings;
|
||||||
|
}
|
||||||
|
|
||||||
export interface Query {
|
export interface Query {
|
||||||
id: string;
|
id: string;
|
||||||
resourceId: string;
|
resourceId: string;
|
||||||
@@ -289,6 +347,12 @@ export interface CreateCollectionParams {
|
|||||||
uniqueKeyPolicy?: UniqueKeyPolicy;
|
uniqueKeyPolicy?: UniqueKeyPolicy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface SharedThroughputRange {
|
||||||
|
minimumRU: number;
|
||||||
|
maximumRU: number;
|
||||||
|
defaultRU: number;
|
||||||
|
}
|
||||||
|
|
||||||
export interface Notification {
|
export interface Notification {
|
||||||
id: string;
|
id: string;
|
||||||
kind: string;
|
kind: string;
|
||||||
@@ -431,6 +495,25 @@ export interface NotebookConfigurationEndpointInfo {
|
|||||||
token: string;
|
token: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface SparkCluster {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
type: string;
|
||||||
|
properties: {
|
||||||
|
kind: string;
|
||||||
|
driverSize: string;
|
||||||
|
workerSize: string;
|
||||||
|
workerInstanceCount: number;
|
||||||
|
creationTime: string;
|
||||||
|
status: string;
|
||||||
|
libraries?: SparkClusterLibrary[];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface SparkClusterFeedResponse {
|
||||||
|
value: SparkCluster[];
|
||||||
|
}
|
||||||
|
|
||||||
export interface SparkClusterConnectionInfo {
|
export interface SparkClusterConnectionInfo {
|
||||||
userName: string;
|
userName: string;
|
||||||
password: string;
|
password: string;
|
||||||
@@ -472,10 +555,79 @@ export interface MongoParameters extends RpParameters {
|
|||||||
analyticalStorageTtl?: number;
|
analyticalStorageTtl?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface GraphParameters extends RpParameters {
|
||||||
|
pk: string;
|
||||||
|
coll: string;
|
||||||
|
cd: Boolean;
|
||||||
|
indexingPolicy?: IndexingPolicy;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CreationRequest {
|
||||||
|
properties: {
|
||||||
|
resource: {
|
||||||
|
id: string;
|
||||||
|
};
|
||||||
|
options: RpOptions;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface SqlCollectionParameters extends RpParameters {
|
||||||
|
uniqueKeyPolicy?: UniqueKeyPolicy;
|
||||||
|
pk: string;
|
||||||
|
coll: string;
|
||||||
|
cd: Boolean;
|
||||||
|
analyticalStorageTtl?: number;
|
||||||
|
indexingPolicy?: IndexingPolicy;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface MongoCreationRequest extends CreationRequest {
|
||||||
|
properties: {
|
||||||
|
resource: {
|
||||||
|
id: string;
|
||||||
|
analyticalStorageTtl?: number;
|
||||||
|
shardKey?: {};
|
||||||
|
};
|
||||||
|
options: RpOptions;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface GraphCreationRequest extends CreationRequest {
|
||||||
|
properties: {
|
||||||
|
resource: {
|
||||||
|
id: string;
|
||||||
|
partitionKey: {};
|
||||||
|
indexingPolicy?: IndexingPolicy;
|
||||||
|
};
|
||||||
|
options: RpOptions;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CreateDatabaseWithRpResponse {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
type: string;
|
||||||
|
properties: {
|
||||||
|
id: string;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
export interface SparkClusterLibrary {
|
export interface SparkClusterLibrary {
|
||||||
name: string;
|
name: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface SqlCollectionCreationRequest extends CreationRequest {
|
||||||
|
properties: {
|
||||||
|
resource: {
|
||||||
|
uniqueKeyPolicy?: UniqueKeyPolicy;
|
||||||
|
id: string;
|
||||||
|
partitionKey: {};
|
||||||
|
analyticalStorageTtl?: number;
|
||||||
|
indexingPolicy?: IndexingPolicy;
|
||||||
|
};
|
||||||
|
options: RpOptions;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
export interface Library extends SparkClusterLibrary {
|
export interface Library extends SparkClusterLibrary {
|
||||||
properties: {
|
properties: {
|
||||||
kind: "Jar";
|
kind: "Jar";
|
||||||
@@ -557,11 +709,6 @@ export interface SparkPool extends ArmResource {
|
|||||||
properties: SparkPoolProperties;
|
properties: SparkPoolProperties;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface MemoryUsageInfo {
|
|
||||||
freeKB: number;
|
|
||||||
totalKB: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface resourceTokenConnectionStringProperties {
|
export interface resourceTokenConnectionStringProperties {
|
||||||
accountEndpoint: string;
|
accountEndpoint: string;
|
||||||
collectionId: string;
|
collectionId: string;
|
||||||
|
|||||||
@@ -1,22 +1,16 @@
|
|||||||
import {
|
import * as DataModels from "./DataModels";
|
||||||
QueryMetrics,
|
|
||||||
Resource,
|
|
||||||
StoredProcedureDefinition,
|
|
||||||
TriggerDefinition,
|
|
||||||
UserDefinedFunctionDefinition
|
|
||||||
} from "@azure/cosmos";
|
|
||||||
import Q from "q";
|
import Q from "q";
|
||||||
import { CommandButtonComponentProps } from "../Explorer/Controls/CommandButton/CommandButtonComponent";
|
|
||||||
import Explorer from "../Explorer/Explorer";
|
|
||||||
import { ConsoleData } from "../Explorer/Menus/NotificationConsole/NotificationConsoleComponent";
|
|
||||||
import { CassandraTableKey, CassandraTableKeys } from "../Explorer/Tables/TableDataClient";
|
import { CassandraTableKey, CassandraTableKeys } from "../Explorer/Tables/TableDataClient";
|
||||||
import ConflictId from "../Explorer/Tree/ConflictId";
|
import { CommandButtonComponentProps } from "../Explorer/Controls/CommandButton/CommandButtonComponent";
|
||||||
import DocumentId from "../Explorer/Tree/DocumentId";
|
import { ConsoleData } from "../Explorer/Menus/NotificationConsole/NotificationConsoleComponent";
|
||||||
|
import { QueryMetrics } from "@azure/cosmos";
|
||||||
|
import { UploadDetails } from "../workers/upload/definitions";
|
||||||
|
import Explorer from "../Explorer/Explorer";
|
||||||
|
import UserDefinedFunction from "../Explorer/Tree/UserDefinedFunction";
|
||||||
import StoredProcedure from "../Explorer/Tree/StoredProcedure";
|
import StoredProcedure from "../Explorer/Tree/StoredProcedure";
|
||||||
import Trigger from "../Explorer/Tree/Trigger";
|
import Trigger from "../Explorer/Tree/Trigger";
|
||||||
import UserDefinedFunction from "../Explorer/Tree/UserDefinedFunction";
|
import DocumentId from "../Explorer/Tree/DocumentId";
|
||||||
import { UploadDetails } from "../workers/upload/definitions";
|
import ConflictId from "../Explorer/Tree/ConflictId";
|
||||||
import * as DataModels from "./DataModels";
|
|
||||||
|
|
||||||
export interface TokenProvider {
|
export interface TokenProvider {
|
||||||
getAuthHeader(): Promise<Headers>;
|
getAuthHeader(): Promise<Headers>;
|
||||||
@@ -159,13 +153,13 @@ export interface Collection extends CollectionBase {
|
|||||||
collapseUserDefinedFunctions(): void;
|
collapseUserDefinedFunctions(): void;
|
||||||
collapseTriggers(): void;
|
collapseTriggers(): void;
|
||||||
|
|
||||||
loadUserDefinedFunctions(): Promise<any>;
|
loadUserDefinedFunctions(): Q.Promise<any>;
|
||||||
loadStoredProcedures(): Promise<any>;
|
loadStoredProcedures(): Q.Promise<any>;
|
||||||
loadTriggers(): Promise<any>;
|
loadTriggers(): Q.Promise<any>;
|
||||||
|
|
||||||
createStoredProcedureNode(data: StoredProcedureDefinition & Resource): StoredProcedure;
|
createStoredProcedureNode(data: DataModels.StoredProcedure): StoredProcedure;
|
||||||
createUserDefinedFunctionNode(data: UserDefinedFunctionDefinition & Resource): UserDefinedFunction;
|
createUserDefinedFunctionNode(data: DataModels.UserDefinedFunction): UserDefinedFunction;
|
||||||
createTriggerNode(data: TriggerDefinition & Resource): Trigger;
|
createTriggerNode(data: DataModels.Trigger): Trigger;
|
||||||
findStoredProcedureWithId(sprocRid: string): StoredProcedure;
|
findStoredProcedureWithId(sprocRid: string): StoredProcedure;
|
||||||
findTriggerWithId(triggerRid: string): Trigger;
|
findTriggerWithId(triggerRid: string): Trigger;
|
||||||
findUserDefinedFunctionWithId(udfRid: string): UserDefinedFunction;
|
findUserDefinedFunctionWithId(udfRid: string): UserDefinedFunction;
|
||||||
|
|||||||
@@ -86,7 +86,6 @@ export class DynamicListViewModel extends WaitsForTemplateViewModel {
|
|||||||
public onRemoveItemKeyPress = (data: any, event: KeyboardEvent, source: any): boolean => {
|
public onRemoveItemKeyPress = (data: any, event: KeyboardEvent, source: any): boolean => {
|
||||||
if (event.keyCode === KeyCodes.Enter || event.keyCode === KeyCodes.Space) {
|
if (event.keyCode === KeyCodes.Enter || event.keyCode === KeyCodes.Space) {
|
||||||
this.removeItem(data, event);
|
this.removeItem(data, event);
|
||||||
(document.querySelector(".dynamicListItem:last-of-type input") as HTMLElement).focus();
|
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -95,7 +94,7 @@ export class DynamicListViewModel extends WaitsForTemplateViewModel {
|
|||||||
|
|
||||||
public addItem(): void {
|
public addItem(): void {
|
||||||
this.listItems.push({ value: ko.observable("") });
|
this.listItems.push({ value: ko.observable("") });
|
||||||
(document.querySelector(".dynamicListItem:last-of-type input") as HTMLElement).focus();
|
document.getElementById("uniqueKeyItems").focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
public onAddItemKeyPress = (source: any, event: KeyboardEvent): boolean => {
|
public onAddItemKeyPress = (source: any, event: KeyboardEvent): boolean => {
|
||||||
|
|||||||
@@ -66,9 +66,7 @@ export class GitHubReposComponent extends React.Component<GitHubReposComponentPr
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className={"firstdivbg headerline"} role="heading" aria-level={2}>
|
<div className={"firstdivbg headerline"}>{header}</div>
|
||||||
{header}
|
|
||||||
</div>
|
|
||||||
<div className={"paneMainContent"}>{content}</div>
|
<div className={"paneMainContent"}>{content}</div>
|
||||||
{!this.props.showAuthorizeAccess && (
|
{!this.props.showAuthorizeAccess && (
|
||||||
<>
|
<>
|
||||||
|
|||||||
@@ -84,7 +84,7 @@
|
|||||||
step: step,
|
step: step,
|
||||||
'class':'migration collid select-font-size',
|
'class':'migration collid select-font-size',
|
||||||
min: minAutoPilotThroughput,
|
min: minAutoPilotThroughput,
|
||||||
'aria-label': 'Max request units per second',
|
'aria-label': ariaLabel,
|
||||||
type: isAutoscaleThroughputInputFieldRequired() ? 'number' : 'hidden',
|
type: isAutoscaleThroughputInputFieldRequired() ? 'number' : 'hidden',
|
||||||
css: {
|
css: {
|
||||||
dirty: maxAutoPilotThroughputSet.editableIsDirty
|
dirty: maxAutoPilotThroughputSet.editableIsDirty
|
||||||
|
|||||||
@@ -282,7 +282,7 @@ export class TreeNodeComponent extends React.Component<TreeNodeComponentProps, T
|
|||||||
<img
|
<img
|
||||||
className="expandCollapseIcon"
|
className="expandCollapseIcon"
|
||||||
src={this.state.isExpanded ? TriangleDownIcon : TriangleRightIcon}
|
src={this.state.isExpanded ? TriangleDownIcon : TriangleRightIcon}
|
||||||
alt={this.state.isExpanded ? `${node.label} branch is expanded` : `${node.label} branch is collapsed`}
|
alt={this.state.isExpanded ? "Branch is expanded" : "Branch is collapsed"}
|
||||||
onKeyPress={(event: React.KeyboardEvent<HTMLDivElement>) => this.onCollapseExpandIconKeyPress(event, node)}
|
onKeyPress={(event: React.KeyboardEvent<HTMLDivElement>) => this.onCollapseExpandIconKeyPress(event, node)}
|
||||||
tabIndex={0}
|
tabIndex={0}
|
||||||
role="button"
|
role="button"
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ exports[`TreeNodeComponent does not render children by default 1`] = `
|
|||||||
tabIndex={-1}
|
tabIndex={-1}
|
||||||
>
|
>
|
||||||
<img
|
<img
|
||||||
alt="label branch is collapsed"
|
alt="Branch is collapsed"
|
||||||
className="expandCollapseIcon"
|
className="expandCollapseIcon"
|
||||||
onKeyPress={[Function]}
|
onKeyPress={[Function]}
|
||||||
role="button"
|
role="button"
|
||||||
@@ -140,7 +140,7 @@ exports[`TreeNodeComponent renders a simple node (sorted children, expanded) 1`]
|
|||||||
tabIndex={-1}
|
tabIndex={-1}
|
||||||
>
|
>
|
||||||
<img
|
<img
|
||||||
alt="label branch is expanded"
|
alt="Branch is expanded"
|
||||||
className="expandCollapseIcon"
|
className="expandCollapseIcon"
|
||||||
onKeyPress={[Function]}
|
onKeyPress={[Function]}
|
||||||
role="button"
|
role="button"
|
||||||
@@ -278,7 +278,7 @@ exports[`TreeNodeComponent renders sorted children, expanded, leaves and parents
|
|||||||
tabIndex={-1}
|
tabIndex={-1}
|
||||||
>
|
>
|
||||||
<img
|
<img
|
||||||
alt="label branch is expanded"
|
alt="Branch is expanded"
|
||||||
className="expandCollapseIcon"
|
className="expandCollapseIcon"
|
||||||
onKeyPress={[Function]}
|
onKeyPress={[Function]}
|
||||||
role="button"
|
role="button"
|
||||||
@@ -436,7 +436,7 @@ exports[`TreeNodeComponent renders unsorted children by default 1`] = `
|
|||||||
tabIndex={-1}
|
tabIndex={-1}
|
||||||
>
|
>
|
||||||
<img
|
<img
|
||||||
alt="label branch is expanded"
|
alt="Branch is expanded"
|
||||||
className="expandCollapseIcon"
|
className="expandCollapseIcon"
|
||||||
onKeyPress={[Function]}
|
onKeyPress={[Function]}
|
||||||
role="button"
|
role="button"
|
||||||
|
|||||||
@@ -87,7 +87,6 @@ import { ContextualPaneBase } from "./Panes/ContextualPaneBase";
|
|||||||
import TabsBase from "./Tabs/TabsBase";
|
import TabsBase from "./Tabs/TabsBase";
|
||||||
import { CommandButtonComponentProps } from "./Controls/CommandButton/CommandButtonComponent";
|
import { CommandButtonComponentProps } from "./Controls/CommandButton/CommandButtonComponent";
|
||||||
import { updateUserContext, userContext } from "../UserContext";
|
import { updateUserContext, userContext } from "../UserContext";
|
||||||
import { stringToBlob } from "../Utils/BlobUtils";
|
|
||||||
|
|
||||||
BindingHandlersRegisterer.registerBindingHandlers();
|
BindingHandlersRegisterer.registerBindingHandlers();
|
||||||
// Hold a reference to ComponentRegisterer to prevent transpiler to ignore import
|
// Hold a reference to ComponentRegisterer to prevent transpiler to ignore import
|
||||||
@@ -244,7 +243,6 @@ export default class Explorer {
|
|||||||
public arcadiaWorkspaces: ko.ObservableArray<ArcadiaWorkspaceItem>;
|
public arcadiaWorkspaces: ko.ObservableArray<ArcadiaWorkspaceItem>;
|
||||||
public hasStorageAnalyticsAfecFeature: ko.Observable<boolean>;
|
public hasStorageAnalyticsAfecFeature: ko.Observable<boolean>;
|
||||||
public isSynapseLinkUpdating: ko.Observable<boolean>;
|
public isSynapseLinkUpdating: ko.Observable<boolean>;
|
||||||
public memoryUsageInfo: ko.Observable<DataModels.MemoryUsageInfo>;
|
|
||||||
public notebookManager?: any; // This is dynamically loaded
|
public notebookManager?: any; // This is dynamically loaded
|
||||||
|
|
||||||
private _panes: ContextualPaneBase[] = [];
|
private _panes: ContextualPaneBase[] = [];
|
||||||
@@ -375,7 +373,6 @@ export default class Explorer {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.memoryUsageInfo = ko.observable<DataModels.MemoryUsageInfo>();
|
|
||||||
this.notificationsClient = options.notificationsClient;
|
this.notificationsClient = options.notificationsClient;
|
||||||
this.isEmulator = options.isEmulator;
|
this.isEmulator = options.isEmulator;
|
||||||
|
|
||||||
@@ -1894,9 +1891,6 @@ export default class Explorer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public findSelectedDatabase(): ViewModels.Database {
|
public findSelectedDatabase(): ViewModels.Database {
|
||||||
if (!this.selectedNode()) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
if (this.selectedNode().nodeKind === "Database") {
|
if (this.selectedNode().nodeKind === "Database") {
|
||||||
return _.find(this.databases(), (database: ViewModels.Database) => database.rid === this.selectedNode().rid);
|
return _.find(this.databases(), (database: ViewModels.Database) => database.rid === this.selectedNode().rid);
|
||||||
}
|
}
|
||||||
@@ -2622,11 +2616,9 @@ export default class Explorer {
|
|||||||
throw new Error(error);
|
throw new Error(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
const clearMessage = NotificationConsoleUtils.logConsoleProgress(`Downloading ${notebookFile.path}`);
|
|
||||||
|
|
||||||
return this.notebookManager?.notebookContentClient.readFileContent(notebookFile.path).then(
|
return this.notebookManager?.notebookContentClient.readFileContent(notebookFile.path).then(
|
||||||
(content: string) => {
|
(content: string) => {
|
||||||
const blob = stringToBlob(content, "text/plain");
|
const blob = new Blob([content], { type: "octet/stream" });
|
||||||
if (navigator.msSaveBlob) {
|
if (navigator.msSaveBlob) {
|
||||||
// for IE and Edge
|
// for IE and Edge
|
||||||
navigator.msSaveBlob(blob, notebookFile.name);
|
navigator.msSaveBlob(blob, notebookFile.name);
|
||||||
@@ -2643,16 +2635,12 @@ export default class Explorer {
|
|||||||
downloadLink.click();
|
downloadLink.click();
|
||||||
downloadLink.remove();
|
downloadLink.remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
clearMessage();
|
|
||||||
},
|
},
|
||||||
(error: any) => {
|
(error: any) => {
|
||||||
NotificationConsoleUtils.logConsoleMessage(
|
NotificationConsoleUtils.logConsoleMessage(
|
||||||
ConsoleDataType.Error,
|
ConsoleDataType.Error,
|
||||||
`Could not download notebook ${JSON.stringify(error)}`
|
`Could not download notebook ${JSON.stringify(error)}`
|
||||||
);
|
);
|
||||||
|
|
||||||
clearMessage();
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -82,9 +82,7 @@ export class CommandBarComponentAdapter implements ReactAdapter {
|
|||||||
uiFabricControlButtons.forEach((btn: ICommandBarItemProps) => (btn.iconOnly = true));
|
uiFabricControlButtons.forEach((btn: ICommandBarItemProps) => (btn.iconOnly = true));
|
||||||
|
|
||||||
if (this.isNotebookTabActive()) {
|
if (this.isNotebookTabActive()) {
|
||||||
uiFabricControlButtons.unshift(
|
uiFabricControlButtons.unshift(CommandBarUtil.createMemoryTracker("memoryTracker"));
|
||||||
CommandBarUtil.createMemoryTracker("memoryTracker", this.container.memoryUsageInfo)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -1,16 +1,14 @@
|
|||||||
import _ from "underscore";
|
import { ICommandBarItemProps } from "office-ui-fabric-react/lib/CommandBar";
|
||||||
import * as React from "react";
|
import { Dropdown, IDropdownOption, IDropdownStyles } from "office-ui-fabric-react/lib/Dropdown";
|
||||||
import { Observable } from "knockout";
|
|
||||||
import { IconType } from "office-ui-fabric-react/lib/Icon";
|
import { IconType } from "office-ui-fabric-react/lib/Icon";
|
||||||
import { IComponentAsProps } from "office-ui-fabric-react/lib/Utilities";
|
import { IComponentAsProps } from "office-ui-fabric-react/lib/Utilities";
|
||||||
import { StyleConstants } from "../../../Common/Constants";
|
import * as React from "react";
|
||||||
import { ICommandBarItemProps } from "office-ui-fabric-react/lib/CommandBar";
|
import _ from "underscore";
|
||||||
import { Dropdown, IDropdownStyles, IDropdownOption } from "office-ui-fabric-react/lib/Dropdown";
|
|
||||||
import { CommandButtonComponentProps } from "../../Controls/CommandButton/CommandButtonComponent";
|
|
||||||
import ChevronDownIcon from "../../../../images/Chevron_down.svg";
|
import ChevronDownIcon from "../../../../images/Chevron_down.svg";
|
||||||
|
import { StyleConstants } from "../../../Common/Constants";
|
||||||
import { ArcadiaMenuPicker } from "../../Controls/Arcadia/ArcadiaMenuPicker";
|
import { ArcadiaMenuPicker } from "../../Controls/Arcadia/ArcadiaMenuPicker";
|
||||||
|
import { CommandButtonComponentProps } from "../../Controls/CommandButton/CommandButtonComponent";
|
||||||
import { MemoryTrackerComponent } from "./MemoryTrackerComponent";
|
import { MemoryTrackerComponent } from "./MemoryTrackerComponent";
|
||||||
import { MemoryUsageInfo } from "../../../Contracts/DataModels";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utilities for CommandBar
|
* Utilities for CommandBar
|
||||||
@@ -178,10 +176,10 @@ export class CommandBarUtil {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public static createMemoryTracker(key: string, memoryUsageInfo: Observable<MemoryUsageInfo>): ICommandBarItemProps {
|
public static createMemoryTracker(key: string): ICommandBarItemProps {
|
||||||
return {
|
return {
|
||||||
key,
|
key,
|
||||||
onRender: () => <MemoryTrackerComponent memoryUsageInfo={memoryUsageInfo} />
|
onRender: () => <MemoryTrackerComponent />
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,50 +1,71 @@
|
|||||||
import * as React from "react";
|
import React, { FunctionComponent } from "react";
|
||||||
import { Observable, Subscription } from "knockout";
|
import useSWR from "swr";
|
||||||
import { MemoryUsageInfo } from "../../../Contracts/DataModels";
|
|
||||||
import { ProgressIndicator } from "office-ui-fabric-react/lib/ProgressIndicator";
|
import { ProgressIndicator } from "office-ui-fabric-react/lib/ProgressIndicator";
|
||||||
import { Spinner, SpinnerSize } from "office-ui-fabric-react/lib/Spinner";
|
import { Spinner, SpinnerSize } from "office-ui-fabric-react/lib/Spinner";
|
||||||
import { Stack } from "office-ui-fabric-react/lib/Stack";
|
import { Stack } from "office-ui-fabric-react/lib/Stack";
|
||||||
|
import { listConnectionInfo } from "../../../Utils/arm/generatedClients/2020-04-01-notebook/notebookWorkspaces";
|
||||||
|
import { NotebookWorkspaceConnectionInfoResult } from "../../../Utils/arm/generatedClients/2020-04-01-notebook/types";
|
||||||
|
import { userContext } from "../../../UserContext";
|
||||||
|
|
||||||
interface MemoryTrackerProps {
|
export interface MemoryUsageInfo {
|
||||||
memoryUsageInfo: Observable<MemoryUsageInfo>;
|
total: number;
|
||||||
|
free: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class MemoryTrackerComponent extends React.Component<MemoryTrackerProps> {
|
const kbInGB = 1048576;
|
||||||
private memoryUsageInfoSubscription: Subscription;
|
|
||||||
|
|
||||||
public componentDidMount(): void {
|
const fetchMemoryInfo = async (_key: unknown, connectionInfo: NotebookWorkspaceConnectionInfoResult) => {
|
||||||
this.memoryUsageInfoSubscription = this.props.memoryUsageInfo.subscribe(() => {
|
const response = await fetch(`${connectionInfo.notebookServerEndpoint}/api/metrics/memory`, {
|
||||||
this.forceUpdate();
|
method: "GET",
|
||||||
});
|
headers: {
|
||||||
}
|
Authorization: `Token ${connectionInfo.authToken}`,
|
||||||
|
"content-type": "application/json"
|
||||||
public componentWillUnmount(): void {
|
|
||||||
this.memoryUsageInfoSubscription && this.memoryUsageInfoSubscription.dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
public render(): JSX.Element {
|
|
||||||
const memoryUsageInfo: MemoryUsageInfo = this.props.memoryUsageInfo();
|
|
||||||
if (!memoryUsageInfo) {
|
|
||||||
return (
|
|
||||||
<Stack className="memoryTrackerContainer" horizontal>
|
|
||||||
<span>Memory</span>
|
|
||||||
<Spinner size={SpinnerSize.medium} />
|
|
||||||
</Stack>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error(await response.text());
|
||||||
|
}
|
||||||
|
const memoryUsageInfo = (await response.json()) as MemoryUsageInfo;
|
||||||
|
return {
|
||||||
|
totalKB: memoryUsageInfo.total,
|
||||||
|
freeKB: memoryUsageInfo.free
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
const totalGB = memoryUsageInfo.totalKB / 1048576;
|
export const MemoryTrackerComponent: FunctionComponent = () => {
|
||||||
const usedGB = totalGB - memoryUsageInfo.freeKB / 1048576;
|
const { data: connectionInfo } = useSWR(
|
||||||
|
[
|
||||||
|
"notebooksConnectionInfo",
|
||||||
|
userContext.subscriptionId,
|
||||||
|
userContext.resourceGroup,
|
||||||
|
userContext.databaseAccount.name,
|
||||||
|
"default"
|
||||||
|
],
|
||||||
|
(_key, subscriptionId, resourceGroup, accountName, workspace) =>
|
||||||
|
listConnectionInfo(subscriptionId, resourceGroup, accountName, workspace)
|
||||||
|
);
|
||||||
|
const { data } = useSWR(connectionInfo ? ["memoryUsage", connectionInfo] : null, fetchMemoryInfo, {
|
||||||
|
refreshInterval: 2000
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!data) {
|
||||||
return (
|
return (
|
||||||
<Stack className="memoryTrackerContainer" horizontal>
|
<Stack className="memoryTrackerContainer" horizontal>
|
||||||
<span>Memory</span>
|
<span>Memory</span>
|
||||||
<ProgressIndicator
|
<Spinner size={SpinnerSize.medium} />
|
||||||
className={usedGB / totalGB > 0.8 ? "lowMemory" : ""}
|
|
||||||
description={usedGB.toFixed(1) + " of " + totalGB.toFixed(1) + " GB"}
|
|
||||||
percentComplete={usedGB / totalGB}
|
|
||||||
/>
|
|
||||||
</Stack>
|
</Stack>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
const totalGB = data.totalKB / kbInGB;
|
||||||
|
const usedGB = totalGB - data.freeKB / kbInGB;
|
||||||
|
return (
|
||||||
|
<Stack className="memoryTrackerContainer" horizontal>
|
||||||
|
<span>Memory</span>
|
||||||
|
<ProgressIndicator
|
||||||
|
className={usedGB / totalGB > 0.8 ? "lowMemory" : ""}
|
||||||
|
description={usedGB.toFixed(1) + " of " + totalGB.toFixed(1) + " GB"}
|
||||||
|
percentComplete={usedGB / totalGB}
|
||||||
|
/>
|
||||||
|
</Stack>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|||||||
@@ -130,14 +130,11 @@ export class NotificationConsoleComponent extends React.Component<
|
|||||||
<span className="headerStatusEllipsis">{this.state.headerStatus}</span>
|
<span className="headerStatusEllipsis">{this.state.headerStatus}</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div className="expandCollapseButton" role="button" tabIndex={0}>
|
||||||
className="expandCollapseButton"
|
<img
|
||||||
role="button"
|
src={this.state.isExpanded ? ChevronDownIcon : ChevronUpIcon}
|
||||||
tabIndex={0}
|
alt={this.state.isExpanded ? "collapse console" : "expand console"}
|
||||||
aria-label={this.state.isExpanded ? "collapse console" : "expand console"}
|
/>
|
||||||
aria-expanded={this.state.isExpanded}
|
|
||||||
>
|
|
||||||
<img src={this.state.isExpanded ? ChevronDownIcon : ChevronUpIcon} alt="" />
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<AnimateHeight
|
<AnimateHeight
|
||||||
|
|||||||
@@ -68,14 +68,12 @@ exports[`NotificationConsoleComponent renders the console (expanded) 1`] = `
|
|||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
aria-expanded={true}
|
|
||||||
aria-label="collapse console"
|
|
||||||
className="expandCollapseButton"
|
className="expandCollapseButton"
|
||||||
role="button"
|
role="button"
|
||||||
tabIndex={0}
|
tabIndex={0}
|
||||||
>
|
>
|
||||||
<img
|
<img
|
||||||
alt=""
|
alt="collapse console"
|
||||||
src=""
|
src=""
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -2,89 +2,13 @@
|
|||||||
* Notebook container related stuff
|
* Notebook container related stuff
|
||||||
*/
|
*/
|
||||||
import * as DataModels from "../../Contracts/DataModels";
|
import * as DataModels from "../../Contracts/DataModels";
|
||||||
import * as Constants from "../../Common/Constants";
|
|
||||||
import { ConsoleDataType } from "../Menus/NotificationConsole/NotificationConsoleComponent";
|
|
||||||
import * as NotificationConsoleUtils from "../../Utils/NotificationConsoleUtils";
|
|
||||||
import * as Logger from "../../Common/Logger";
|
import * as Logger from "../../Common/Logger";
|
||||||
|
|
||||||
export class NotebookContainerClient {
|
export class NotebookContainerClient {
|
||||||
private reconnectingNotificationId: string;
|
private reconnectingNotificationId: string;
|
||||||
private isResettingWorkspace: boolean;
|
private isResettingWorkspace: boolean;
|
||||||
|
|
||||||
constructor(
|
constructor(private notebookServerInfo: ko.Observable<DataModels.NotebookWorkspaceConnectionInfo>) {}
|
||||||
private notebookServerInfo: ko.Observable<DataModels.NotebookWorkspaceConnectionInfo>,
|
|
||||||
private onConnectionLost: () => void,
|
|
||||||
private onMemoryUsageInfoUpdate: (update: DataModels.MemoryUsageInfo) => void
|
|
||||||
) {
|
|
||||||
if (notebookServerInfo() && notebookServerInfo().notebookServerEndpoint) {
|
|
||||||
this.scheduleHeartbeat(Constants.Notebook.heartbeatDelayMs);
|
|
||||||
} else {
|
|
||||||
const subscription = notebookServerInfo.subscribe((newServerInfo: DataModels.NotebookWorkspaceConnectionInfo) => {
|
|
||||||
if (newServerInfo && newServerInfo.notebookServerEndpoint) {
|
|
||||||
this.scheduleHeartbeat(Constants.Notebook.heartbeatDelayMs);
|
|
||||||
}
|
|
||||||
subscription.dispose();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Heartbeat: each ping schedules another ping
|
|
||||||
*/
|
|
||||||
private scheduleHeartbeat(delayMs: number): void {
|
|
||||||
setTimeout(() => {
|
|
||||||
this.getMemoryUsage()
|
|
||||||
.then(memoryUsageInfo => this.onMemoryUsageInfoUpdate(memoryUsageInfo))
|
|
||||||
.finally(() => this.scheduleHeartbeat(Constants.Notebook.heartbeatDelayMs));
|
|
||||||
}, delayMs);
|
|
||||||
}
|
|
||||||
|
|
||||||
private async getMemoryUsage(): Promise<DataModels.MemoryUsageInfo> {
|
|
||||||
if (!this.notebookServerInfo() || !this.notebookServerInfo().notebookServerEndpoint) {
|
|
||||||
const error = "No server endpoint detected";
|
|
||||||
Logger.logError(error, "NotebookContainerClient/getMemoryUsage");
|
|
||||||
return Promise.reject(error);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.isResettingWorkspace) {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
const { notebookServerEndpoint, authToken } = this.getNotebookServerConfig();
|
|
||||||
try {
|
|
||||||
const response = await fetch(`${notebookServerEndpoint}/api/metrics/memory`, {
|
|
||||||
method: "GET",
|
|
||||||
headers: {
|
|
||||||
Authorization: authToken,
|
|
||||||
"content-type": "application/json"
|
|
||||||
}
|
|
||||||
});
|
|
||||||
if (response.ok) {
|
|
||||||
if (this.reconnectingNotificationId) {
|
|
||||||
NotificationConsoleUtils.clearInProgressMessageWithId(this.reconnectingNotificationId);
|
|
||||||
this.reconnectingNotificationId = "";
|
|
||||||
}
|
|
||||||
const memoryUsageInfo = await response.json();
|
|
||||||
if (memoryUsageInfo) {
|
|
||||||
return {
|
|
||||||
totalKB: memoryUsageInfo.total,
|
|
||||||
freeKB: memoryUsageInfo.free
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return undefined;
|
|
||||||
} catch (error) {
|
|
||||||
Logger.logError(error, "NotebookContainerClient/getMemoryUsage");
|
|
||||||
if (!this.reconnectingNotificationId) {
|
|
||||||
this.reconnectingNotificationId = NotificationConsoleUtils.logConsoleMessage(
|
|
||||||
ConsoleDataType.InProgress,
|
|
||||||
"Connection lost with Notebook server. Attempting to reconnect..."
|
|
||||||
);
|
|
||||||
}
|
|
||||||
this.onConnectionLost();
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public async resetWorkspace(): Promise<void> {
|
public async resetWorkspace(): Promise<void> {
|
||||||
this.isResettingWorkspace = true;
|
this.isResettingWorkspace = true;
|
||||||
|
|||||||
@@ -194,24 +194,17 @@ export class NotebookContentClient {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public async readFileContent(filePath: string): Promise<string> {
|
public readFileContent(filePath: string): Promise<string> {
|
||||||
const xhr = await this.contentProvider.get(this.getServerConfig(), filePath, { content: 1 }).toPromise();
|
return this.contentProvider
|
||||||
const content = (xhr.response as any).content;
|
.get(this.getServerConfig(), filePath, { type: "notebook", format: "text", content: 1 })
|
||||||
if (!content) {
|
.toPromise()
|
||||||
throw new Error("No content read");
|
.then(xhr => {
|
||||||
}
|
const content = (xhr.response as any).content;
|
||||||
|
if (!content) {
|
||||||
const format = (xhr.response as any).format;
|
throw new Error("No content read");
|
||||||
switch (format) {
|
}
|
||||||
case "text":
|
|
||||||
return content;
|
|
||||||
case "base64":
|
|
||||||
return atob(content);
|
|
||||||
case "json":
|
|
||||||
return stringifyNotebook(content);
|
return stringifyNotebook(content);
|
||||||
default:
|
});
|
||||||
throw new Error(`Unsupported content format ${format}`);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private deleteNotebookFile(path: string): Promise<string> {
|
private deleteNotebookFile(path: string): Promise<string> {
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ import { NotebookContentProvider } from "./NotebookComponent/NotebookContentProv
|
|||||||
import { GitHubContentProvider } from "../../GitHub/GitHubContentProvider";
|
import { GitHubContentProvider } from "../../GitHub/GitHubContentProvider";
|
||||||
import { contents } from "rx-jupyter";
|
import { contents } from "rx-jupyter";
|
||||||
import { NotebookContainerClient } from "./NotebookContainerClient";
|
import { NotebookContainerClient } from "./NotebookContainerClient";
|
||||||
import { MemoryUsageInfo } from "../../Contracts/DataModels";
|
|
||||||
import { NotebookContentClient } from "./NotebookContentClient";
|
import { NotebookContentClient } from "./NotebookContentClient";
|
||||||
import { DialogProps } from "../Controls/DialogReactComponent/DialogComponent";
|
import { DialogProps } from "../Controls/DialogReactComponent/DialogComponent";
|
||||||
import { ResourceTreeAdapter } from "../Tree/ResourceTreeAdapter";
|
import { ResourceTreeAdapter } from "../Tree/ResourceTreeAdapter";
|
||||||
@@ -76,11 +75,7 @@ export default class NotebookManager {
|
|||||||
contents.JupyterContentProvider
|
contents.JupyterContentProvider
|
||||||
);
|
);
|
||||||
|
|
||||||
this.notebookClient = new NotebookContainerClient(
|
this.notebookClient = new NotebookContainerClient(this.params.container.notebookServerInfo);
|
||||||
this.params.container.notebookServerInfo,
|
|
||||||
() => this.params.container.initNotebooks(this.params.container.databaseAccount()),
|
|
||||||
(update: MemoryUsageInfo) => this.params.container.memoryUsageInfo(update)
|
|
||||||
);
|
|
||||||
|
|
||||||
this.notebookContentClient = new NotebookContentClient(
|
this.notebookContentClient = new NotebookContentClient(
|
||||||
this.params.container.notebookServerInfo,
|
this.params.container.notebookServerInfo,
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
<script type="text/html" id="add-collection-inputs">
|
<script type="text/html" id="add-collection-inputs">
|
||||||
<!-- Add collection header - Start -->
|
<!-- Add collection header - Start -->
|
||||||
<div class="firstdivbg headerline">
|
<div class="firstdivbg headerline">
|
||||||
<span id="containerTitle" role="heading" aria-level="2" data-bind="text: title" ></span>
|
<span id="containerTitle" data-bind="text: title"></span>
|
||||||
<div class="closeImg" id="closeBtnAddCollection" role="button" aria-label="Add collection close pane"
|
<div class="closeImg" id="closeBtnAddCollection" role="button" aria-label="Add collection close pane"
|
||||||
data-bind="click: cancel, event: { keypress: onCloseKeyPress }" tabindex="0">
|
data-bind="click: cancel, event: { keypress: onCloseKeyPress }" tabindex="0">
|
||||||
<img src="../../../images/close-black.svg" title="Close" alt="Close" />
|
<img src="../../../images/close-black.svg" title="Close" alt="Close" />
|
||||||
@@ -115,10 +115,10 @@
|
|||||||
|
|
||||||
<!-- Database provisioned throughput - Start -->
|
<!-- Database provisioned throughput - Start -->
|
||||||
<!-- ko if: canConfigureThroughput -->
|
<!-- ko if: canConfigureThroughput -->
|
||||||
<div class="databaseProvision" aria-label="Provision database throughput"
|
<div class="databaseProvision" aria-label="New database provision support"
|
||||||
data-bind="visible: databaseCreateNew">
|
data-bind="visible: databaseCreateNew">
|
||||||
<input tabindex="0" type="checkbox" data-test="addCollectionPane-databaseSharedThroughput"
|
<input tabindex="0" type="checkbox" data-test="addCollectionPane-databaseSharedThroughput"
|
||||||
id="addCollection-databaseSharedThroughput" title="Provision database throughput"
|
id="addCollection-databaseSharedThroughput" title="Provision shared throughput"
|
||||||
data-bind="checked: databaseCreateNewShared" />
|
data-bind="checked: databaseCreateNewShared" />
|
||||||
<span class="databaseProvisionText" for="databaseSharedThroughput">Provision database throughput</span>
|
<span class="databaseProvisionText" for="databaseSharedThroughput">Provision database throughput</span>
|
||||||
<span class="infoTooltip" role="tooltip" tabindex="0">
|
<span class="infoTooltip" role="tooltip" tabindex="0">
|
||||||
@@ -537,11 +537,9 @@
|
|||||||
attr: {
|
attr: {
|
||||||
'aria-checked': isAnalyticalStorageOn() ? 'true' : 'false'
|
'aria-checked': isAnalyticalStorageOn() ? 'true' : 'false'
|
||||||
}" />
|
}" />
|
||||||
<label for="enableAnalyticalStorageRadioOn" class="enableAnalyticalStorageRadioLabel">
|
<span for="enableAnalyticalStorageRadioOn" data-bind="disable: showEnableSynapseLink">
|
||||||
<span data-bind="disable: showEnableSynapseLink">
|
On
|
||||||
On
|
</span>
|
||||||
</span>
|
|
||||||
</label>
|
|
||||||
|
|
||||||
<input class="enableAnalyticalStorageRadio" id="enableAnalyticalStorageRadioOff"
|
<input class="enableAnalyticalStorageRadio" id="enableAnalyticalStorageRadioOff"
|
||||||
name="analyticalStore" type="radio" role="radio" tabindex="0" data-bind="
|
name="analyticalStore" type="radio" role="radio" tabindex="0" data-bind="
|
||||||
@@ -551,11 +549,9 @@
|
|||||||
attr: {
|
attr: {
|
||||||
'aria-checked': isAnalyticalStorageOn() ? 'false' : 'true'
|
'aria-checked': isAnalyticalStorageOn() ? 'false' : 'true'
|
||||||
}" />
|
}" />
|
||||||
<label for="enableAnalyticalStorageRadioOff" class="enableAnalyticalStorageRadioLabel">
|
<span for="enableAnalyticalStorageRadioOff" data-bind="disable: showEnableSynapseLink">
|
||||||
<span data-bind="disable: showEnableSynapseLink">
|
Off
|
||||||
Off
|
</span>
|
||||||
</span>
|
|
||||||
</label>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="paragraph italic" data-bind="visible: ttl90DaysEnabled() && isAnalyticalStorageOn()">
|
<div class="paragraph italic" data-bind="visible: ttl90DaysEnabled() && isAnalyticalStorageOn()">
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
<script type="text/html" id="add-database-inputs">
|
<script type="text/html" id="add-database-inputs">
|
||||||
<!-- Add database header - Start -->
|
<!-- Add database header - Start -->
|
||||||
<div class="firstdivbg headerline">
|
<div class="firstdivbg headerline">
|
||||||
<span id="databaseTitle" role="heading" aria-level="2" data-bind="text: title"></span>
|
<span id="databaseTitle" data-bind="text: title"></span>
|
||||||
<div class="closeImg" role="button" aria-label="Close pane"
|
<div class="closeImg" role="button" aria-label="Close pane"
|
||||||
data-bind="click: cancel, event: { keypress: onCloseKeyPress }" tabindex="0">
|
data-bind="click: cancel, event: { keypress: onCloseKeyPress }" tabindex="0">
|
||||||
<img src="../../../images/close-black.svg" title="Close" alt="Close" />
|
<img src="../../../images/close-black.svg" title="Close" alt="Close" />
|
||||||
@@ -73,8 +73,8 @@
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<input id="database-id" type="text" aria-required="true" autocomplete="off" pattern="[^/?#\\]*[^/?# \\]"
|
<input id="database-id" type="text" aria-required="true" autocomplete="off" pattern="[^/?#\\]*[^/?# \\]"
|
||||||
title="May not end with space nor contain characters '\' '/' '#' '?'"
|
title="May not end with space nor contain characters '\' '/' '#' '?'" placeholder="Type a new database id"
|
||||||
size="40" class="collid" data-bind="textInput: databaseId, hasFocus: firstFieldHasFocus, attr: { placeholder: databaseIdPlaceHolder }"
|
size="40" class="collid" data-bind="textInput: databaseId, hasFocus: firstFieldHasFocus"
|
||||||
aria-label="Database id" autofocus>
|
aria-label="Database id" autofocus>
|
||||||
|
|
||||||
<!-- Database provisioned throughput - Start -->
|
<!-- Database provisioned throughput - Start -->
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ import { PlatformType } from "../../PlatformType";
|
|||||||
export default class AddDatabasePane extends ContextualPaneBase {
|
export default class AddDatabasePane extends ContextualPaneBase {
|
||||||
public defaultExperience: ko.Computed<string>;
|
public defaultExperience: ko.Computed<string>;
|
||||||
public databaseIdLabel: ko.Computed<string>;
|
public databaseIdLabel: ko.Computed<string>;
|
||||||
public databaseIdPlaceHolder: ko.Computed<string>;
|
|
||||||
public databaseId: ko.Observable<string>;
|
public databaseId: ko.Observable<string>;
|
||||||
public databaseIdTooltipText: ko.Computed<string>;
|
public databaseIdTooltipText: ko.Computed<string>;
|
||||||
public databaseLevelThroughputTooltipText: ko.Computed<string>;
|
public databaseLevelThroughputTooltipText: ko.Computed<string>;
|
||||||
@@ -71,11 +70,6 @@ export default class AddDatabasePane extends ContextualPaneBase {
|
|||||||
this.databaseIdLabel = ko.computed<string>(() =>
|
this.databaseIdLabel = ko.computed<string>(() =>
|
||||||
this.container.isPreferredApiCassandra() ? "Keyspace id" : "Database id"
|
this.container.isPreferredApiCassandra() ? "Keyspace id" : "Database id"
|
||||||
);
|
);
|
||||||
|
|
||||||
this.databaseIdPlaceHolder = ko.computed<string>(() =>
|
|
||||||
this.container.isPreferredApiCassandra() ? "Type a new keyspace id" : "Type a new database id"
|
|
||||||
);
|
|
||||||
|
|
||||||
this.databaseIdTooltipText = ko.computed<string>(() => {
|
this.databaseIdTooltipText = ko.computed<string>(() => {
|
||||||
const isCassandraAccount: boolean = this.container.isPreferredApiCassandra();
|
const isCassandraAccount: boolean = this.container.isPreferredApiCassandra();
|
||||||
return `A ${isCassandraAccount ? "keyspace" : "database"} is a logical container of one or more ${
|
return `A ${isCassandraAccount ? "keyspace" : "database"} is a logical container of one or more ${
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<div class="paneContentContainer">
|
<div class="paneContentContainer">
|
||||||
<!-- Save Query header - Start -->
|
<!-- Save Query header - Start -->
|
||||||
<div class="firstdivbg headerline">
|
<div class="firstdivbg headerline">
|
||||||
<span role="heading" aria-level="2" data-bind="text: title"></span>
|
<span data-bind="text: title"></span>
|
||||||
<div
|
<div
|
||||||
class="closeImg"
|
class="closeImg"
|
||||||
role="button"
|
role="button"
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
>
|
>
|
||||||
<!-- Add Cassandra collection header - Start -->
|
<!-- Add Cassandra collection header - Start -->
|
||||||
<div class="firstdivbg headerline">
|
<div class="firstdivbg headerline">
|
||||||
<span role="heading" aria-level="2" data-bind="text: title"></span>
|
<span data-bind="text: title"></span>
|
||||||
<div
|
<div
|
||||||
class="closeImg"
|
class="closeImg"
|
||||||
role="button"
|
role="button"
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import Explorer from "../Explorer";
|
|||||||
|
|
||||||
// TODO: Use specific actions for logging telemetry data
|
// TODO: Use specific actions for logging telemetry data
|
||||||
export abstract class ContextualPaneBase extends WaitsForTemplateViewModel {
|
export abstract class ContextualPaneBase extends WaitsForTemplateViewModel {
|
||||||
private initalFocusedElement: HTMLElement | undefined;
|
|
||||||
public id: string;
|
public id: string;
|
||||||
public container: Explorer;
|
public container: Explorer;
|
||||||
public firstFieldHasFocus: ko.Observable<boolean>;
|
public firstFieldHasFocus: ko.Observable<boolean>;
|
||||||
@@ -50,11 +49,9 @@ export abstract class ContextualPaneBase extends WaitsForTemplateViewModel {
|
|||||||
this.visible(false);
|
this.visible(false);
|
||||||
this.isExecuting(false);
|
this.isExecuting(false);
|
||||||
this.resetData();
|
this.resetData();
|
||||||
this.resetFocus();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public open() {
|
public open() {
|
||||||
this.initalFocusedElement = document.activeElement as HTMLElement;
|
|
||||||
this.visible(true);
|
this.visible(true);
|
||||||
this.firstFieldHasFocus(true);
|
this.firstFieldHasFocus(true);
|
||||||
this.resizePane();
|
this.resizePane();
|
||||||
@@ -126,11 +123,4 @@ export abstract class ContextualPaneBase extends WaitsForTemplateViewModel {
|
|||||||
|
|
||||||
$(paneElement).height(newPaneElementHeight);
|
$(paneElement).height(newPaneElementHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
private resetFocus(): void {
|
|
||||||
if (this.initalFocusedElement) {
|
|
||||||
this.initalFocusedElement.focus();
|
|
||||||
this.initalFocusedElement = undefined;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
>
|
>
|
||||||
<!-- Delete Collection Confirmation header - Start -->
|
<!-- Delete Collection Confirmation header - Start -->
|
||||||
<div class="firstdivbg headerline">
|
<div class="firstdivbg headerline">
|
||||||
<span role="heading" aria-level="2" data-bind="text: title"></span>
|
<span data-bind="text: title"></span>
|
||||||
<div
|
<div
|
||||||
class="closeImg"
|
class="closeImg"
|
||||||
role="button"
|
role="button"
|
||||||
@@ -67,7 +67,8 @@
|
|||||||
name="collectionIdConfirmation"
|
name="collectionIdConfirmation"
|
||||||
required
|
required
|
||||||
class="collid"
|
class="collid"
|
||||||
data-bind="value: collectionIdConfirmation, hasFocus: firstFieldHasFocus, attr: { 'aria-label': collectionIdConfirmationText }"
|
data-bind="value: collectionIdConfirmation, hasFocus: firstFieldHasFocus"
|
||||||
|
aria-label="Confirm by typing the collection id"
|
||||||
/>
|
/>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
>
|
>
|
||||||
<!-- Delete Database Confirmation header - Start -->
|
<!-- Delete Database Confirmation header - Start -->
|
||||||
<div class="firstdivbg headerline">
|
<div class="firstdivbg headerline">
|
||||||
<span role="heading" aria-level="2" data-bind="text: title"></span>
|
<span data-bind="text: title"></span>
|
||||||
<div
|
<div
|
||||||
class="closeImg"
|
class="closeImg"
|
||||||
role="button"
|
role="button"
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ import DeleteFeedback from "../../Common/DeleteFeedback";
|
|||||||
import * as NotificationConsoleUtils from "../../Utils/NotificationConsoleUtils";
|
import * as NotificationConsoleUtils from "../../Utils/NotificationConsoleUtils";
|
||||||
import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
||||||
import { deleteDatabase } from "../../Common/dataAccess/deleteDatabase";
|
import { deleteDatabase } from "../../Common/dataAccess/deleteDatabase";
|
||||||
import { ARMError } from "../../Utils/arm/request";
|
|
||||||
|
|
||||||
export default class DeleteDatabaseConfirmationPane extends ContextualPaneBase {
|
export default class DeleteDatabaseConfirmationPane extends ContextualPaneBase {
|
||||||
public databaseIdConfirmationText: ko.Observable<string>;
|
public databaseIdConfirmationText: ko.Observable<string>;
|
||||||
@@ -106,12 +105,11 @@ export default class DeleteDatabaseConfirmationPane extends ContextualPaneBase {
|
|||||||
this.databaseDeleteFeedback("");
|
this.databaseDeleteFeedback("");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
(reason: unknown) => {
|
(reason: any) => {
|
||||||
this.isExecuting(false);
|
this.isExecuting(false);
|
||||||
|
const message = ErrorParserUtility.parse(reason);
|
||||||
const message = reason instanceof ARMError ? reason.message : ErrorParserUtility.parse(reason)[0].message;
|
this.formErrors(message[0].message);
|
||||||
this.formErrors(message);
|
this.formErrorsDetails(message[0].message);
|
||||||
this.formErrorsDetails(message);
|
|
||||||
TelemetryProcessor.traceFailure(
|
TelemetryProcessor.traceFailure(
|
||||||
Action.DeleteDatabase,
|
Action.DeleteDatabase,
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
<form class="paneContentContainer" data-bind="submit: execute">
|
<form class="paneContentContainer" data-bind="submit: execute">
|
||||||
<!-- Input params header - Start -->
|
<!-- Input params header - Start -->
|
||||||
<div class="firstdivbg headerline">
|
<div class="firstdivbg headerline">
|
||||||
<span role="heading" aria-level="2" data-bind="text: title"></span>
|
<span data-bind="text: title"></span>
|
||||||
<div
|
<div
|
||||||
class="closeImg"
|
class="closeImg"
|
||||||
role="button"
|
role="button"
|
||||||
|
|||||||
@@ -70,9 +70,7 @@ export class GenericRightPaneComponent extends React.Component<GenericRightPaneP
|
|||||||
private renderPanelHeader = (): JSX.Element => {
|
private renderPanelHeader = (): JSX.Element => {
|
||||||
return (
|
return (
|
||||||
<div className="firstdivbg headerline">
|
<div className="firstdivbg headerline">
|
||||||
<span id="databaseTitle" role="heading" aria-level={2}>
|
<span id="databaseTitle">{this.props.title}</span>
|
||||||
{this.props.title}
|
|
||||||
</span>
|
|
||||||
<IconButton
|
<IconButton
|
||||||
ariaLabel="Close pane"
|
ariaLabel="Close pane"
|
||||||
title="Close pane"
|
title="Close pane"
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<form class="paneContentContainer" data-bind="submit: submit">
|
<form class="paneContentContainer" data-bind="submit: submit">
|
||||||
<!-- New Vertex header - Start -->
|
<!-- New Vertex header - Start -->
|
||||||
<div class="firstdivbg headerline">
|
<div class="firstdivbg headerline">
|
||||||
<span role="heading" aria-level="2">New Vertex</span>
|
<span>New Vertex</span>
|
||||||
<div
|
<div
|
||||||
class="closeImg"
|
class="closeImg"
|
||||||
role="button"
|
role="button"
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<form class="paneContentContainer" data-bind="submit: submit">
|
<form class="paneContentContainer" data-bind="submit: submit">
|
||||||
<!-- Graph Styling header - Start -->
|
<!-- Graph Styling header - Start -->
|
||||||
<div class="firstdivbg headerline">
|
<div class="firstdivbg headerline">
|
||||||
<span role="heading" aria-level="2">Graph Styling</span>
|
<span>Graph Styling</span>
|
||||||
<div
|
<div
|
||||||
class="closeImg"
|
class="closeImg"
|
||||||
role="button"
|
role="button"
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<form class="paneContentContainer" data-bind="submit: submit">
|
<form class="paneContentContainer" data-bind="submit: submit">
|
||||||
<!-- Load Query header - Start -->
|
<!-- Load Query header - Start -->
|
||||||
<div class="firstdivbg headerline">
|
<div class="firstdivbg headerline">
|
||||||
<span role="heading" aria-level="2" data-bind="text: title"></span>
|
<span data-bind="text: title"></span>
|
||||||
<div
|
<div
|
||||||
class="closeImg"
|
class="closeImg"
|
||||||
role="button"
|
role="button"
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
<form class="paneContentContainer" data-bind="submit: submit">
|
<form class="paneContentContainer" data-bind="submit: submit">
|
||||||
<!-- Renew ad-hoc access header - Start -->
|
<!-- Renew ad-hoc access header - Start -->
|
||||||
<div class="firstdivbg headerline">
|
<div class="firstdivbg headerline">
|
||||||
<span role="heading" aria-level="2" data-bind="text: title"></span>
|
<span data-bind="text: title"></span>
|
||||||
<div
|
<div
|
||||||
class="closeImg"
|
class="closeImg"
|
||||||
role="button"
|
role="button"
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<form class="paneContentContainer" data-bind="submit: submit">
|
<form class="paneContentContainer" data-bind="submit: submit">
|
||||||
<!-- Save Query header - Start -->
|
<!-- Save Query header - Start -->
|
||||||
<div class="firstdivbg headerline">
|
<div class="firstdivbg headerline">
|
||||||
<span role="heading" aria-level="2" data-bind="text: title"></span>
|
<span data-bind="text: title"></span>
|
||||||
<div class="closeImg" role="button" aria-label="Close pane" tabindex="0" data-bind="click: cancel">
|
<div class="closeImg" role="button" aria-label="Close pane" tabindex="0" data-bind="click: cancel">
|
||||||
<img src="../../../images/close-black.svg" title="Close" alt="Close" />
|
<img src="../../../images/close-black.svg" title="Close" alt="Close" />
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
<form class="paneContentContainer" data-bind="submit: submit">
|
<form class="paneContentContainer" data-bind="submit: submit">
|
||||||
<!-- Settings Confirmation header - Start -->
|
<!-- Settings Confirmation header - Start -->
|
||||||
<div class="firstdivbg headerline">
|
<div class="firstdivbg headerline">
|
||||||
<span role="heading" aria-level="2" data-bind="text: title"></span>
|
<span data-bind="text: title"></span>
|
||||||
<div
|
<div
|
||||||
class="closeImg"
|
class="closeImg"
|
||||||
role="button"
|
role="button"
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<div class="paneContentContainer">
|
<div class="paneContentContainer">
|
||||||
<!-- Setup notebooks header - Start -->
|
<!-- Setup notebooks header - Start -->
|
||||||
<div class="firstdivbg headerline">
|
<div class="firstdivbg headerline">
|
||||||
<span role="heading" aria-level="2" data-bind="text: title"></span>
|
<span data-bind="text: title"></span>
|
||||||
<div
|
<div
|
||||||
class="closeImg"
|
class="closeImg"
|
||||||
role="button"
|
role="button"
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<form class="paneContentContainer" data-bind="submit: submit">
|
<form class="paneContentContainer" data-bind="submit: submit">
|
||||||
<!-- String Input header - Start -->
|
<!-- String Input header - Start -->
|
||||||
<div class="firstdivbg headerline">
|
<div class="firstdivbg headerline">
|
||||||
<span role="heading" aria-level="2" data-bind="text: title"></span>
|
<span data-bind="text: title"></span>
|
||||||
<div class="closeImg" role="button" aria-label="Close pane" tabindex="0" data-bind="click: cancel"></div>
|
<div class="closeImg" role="button" aria-label="Close pane" tabindex="0" data-bind="click: cancel"></div>
|
||||||
</div>
|
</div>
|
||||||
<!-- String Input header - End -->
|
<!-- String Input header - End -->
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<div class="contextual-pane-in">
|
<div class="contextual-pane-in">
|
||||||
<!-- Switch Directory header - Start -->
|
<!-- Switch Directory header - Start -->
|
||||||
<div class="firstdivbg headerline">
|
<div class="firstdivbg headerline">
|
||||||
<span role="heading" aria-level="2" data-bind="text: title"></span>
|
<span data-bind="text: title"></span>
|
||||||
<div class="closeImg" role="button" aria-label="Close pane" tabindex="0" data-bind="click: close">
|
<div class="closeImg" role="button" aria-label="Close pane" tabindex="0" data-bind="click: close">
|
||||||
<img src="../../../images/close-black.svg" title="Close" alt="Close" />
|
<img src="../../../images/close-black.svg" title="Close" alt="Close" />
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ export default class AddTableEntityPane extends TableEntityPane {
|
|||||||
this.updateIsActionEnabled();
|
this.updateIsActionEnabled();
|
||||||
super.open();
|
super.open();
|
||||||
}
|
}
|
||||||
const focusElement = document.getElementById("closeAddEntityPane");
|
const focusElement = document.getElementById("addTableEntityValue");
|
||||||
focusElement && focusElement.focus();
|
focusElement && focusElement.focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,6 @@
|
|||||||
<div class="firstdivbg headerline">
|
<div class="firstdivbg headerline">
|
||||||
<span role="heading" aria-level="2" data-bind="text: title"></span>
|
<span role="heading" aria-level="2" data-bind="text: title"></span>
|
||||||
<div
|
<div
|
||||||
id="closeAddEntityPane"
|
|
||||||
class="closeImg"
|
class="closeImg"
|
||||||
role="button"
|
role="button"
|
||||||
aria-label="Close pane"
|
aria-label="Close pane"
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
>
|
>
|
||||||
<!-- Edit table entity header - Start -->
|
<!-- Edit table entity header - Start -->
|
||||||
<div class="firstdivbg headerline">
|
<div class="firstdivbg headerline">
|
||||||
<span role="heading" aria-level="2" data-bind="text: title"></span>
|
<span data-bind="text: title"></span>
|
||||||
<div
|
<div
|
||||||
class="closeImg"
|
class="closeImg"
|
||||||
role="button"
|
role="button"
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<form class="paneContentContainer" data-bind="submit: submit">
|
<form class="paneContentContainer" data-bind="submit: submit">
|
||||||
<!-- Upload File header - Start -->
|
<!-- Upload File header - Start -->
|
||||||
<div class="firstdivbg headerline">
|
<div class="firstdivbg headerline">
|
||||||
<span role="heading" aria-level="2" data-bind="text: title"></span>
|
<span data-bind="text: title"></span>
|
||||||
<div class="closeImg" role="button" aria-label="Close pane" tabindex="0" data-bind="click: cancel">
|
<div class="closeImg" role="button" aria-label="Close pane" tabindex="0" data-bind="click: cancel">
|
||||||
<img src="../../../images/close-black.svg" title="Close" alt="Close" />
|
<img src="../../../images/close-black.svg" title="Close" alt="Close" />
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
<form class="paneContentContainer" data-bind="submit: submit">
|
<form class="paneContentContainer" data-bind="submit: submit">
|
||||||
<!-- Upload items header - Start -->
|
<!-- Upload items header - Start -->
|
||||||
<div class="firstdivbg headerline">
|
<div class="firstdivbg headerline">
|
||||||
<span role="heading" aria-level="2" data-bind="text: title"></span>
|
<span data-bind="text: title"></span>
|
||||||
<div
|
<div
|
||||||
class="closeImg"
|
class="closeImg"
|
||||||
role="button"
|
role="button"
|
||||||
|
|||||||
@@ -100,7 +100,7 @@
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div class="loadMore">
|
<div class="loadMore">
|
||||||
<a role="button" data-bind="click: loadNextPage, event: { keypress: onLoadMoreKeyInput }" tabindex="0"
|
<a role="link" data-bind="click: loadNextPage, event: { keypress: onLoadMoreKeyInput }" tabindex="0"
|
||||||
>Load more</a
|
>Load more</a
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -200,7 +200,7 @@
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div class="loadMore">
|
<div class="loadMore">
|
||||||
<a role="button" data-bind="click: loadNextPage, event: { keypress: onLoadMoreKeyInput }" tabindex="0"
|
<a role="link" data-bind="click: loadNextPage, event: { keypress: onLoadMoreKeyInput }" tabindex="0"
|
||||||
>Load more</a
|
>Load more</a
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -390,7 +390,7 @@
|
|||||||
</table>
|
</table>
|
||||||
|
|
||||||
<div class="loadMore">
|
<div class="loadMore">
|
||||||
<a role="button" data-bind="click: loadNextPage, event: { keypress: onLoadMoreKeyInput }" tabindex="0"
|
<a role="link" data-bind="click: loadNextPage, event: { keypress: onLoadMoreKeyInput }" tabindex="0"
|
||||||
>Load more</a
|
>Load more</a
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -111,18 +111,17 @@
|
|||||||
data-bind="visible: isMetricsToggled() && allResultsMetadata().length > 0 && errors().length === 0"
|
data-bind="visible: isMetricsToggled() && allResultsMetadata().length > 0 && errors().length === 0"
|
||||||
>
|
>
|
||||||
<table class="queryMetricsSummary">
|
<table class="queryMetricsSummary">
|
||||||
<caption>
|
|
||||||
Query Statistics
|
|
||||||
</caption>
|
|
||||||
<thead class="queryMetricsSummaryHead">
|
<thead class="queryMetricsSummaryHead">
|
||||||
<tr class="queryMetricsSummaryHeader queryMetricsSummaryTuple">
|
<tr class="queryMetricsSummaryHeader queryMetricsSummaryTuple">
|
||||||
<th title="METRIC" scope="col">METRIC</th>
|
<th title="METRIC">METRIC</th>
|
||||||
<th title="VALUE" scope="col">VALUE</th>
|
<th></th>
|
||||||
|
<th title="VALUE">VALUE</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody class="queryMetricsSummaryBody" data-bind="with: aggregatedQueryMetrics">
|
<tbody class="queryMetricsSummaryBody" data-bind="with: aggregatedQueryMetrics">
|
||||||
<tr class="queryMetricsSummaryTuple">
|
<tr class="queryMetricsSummaryTuple">
|
||||||
<td title="Request Charge">Request Charge</td>
|
<td title="Request Charge">Request Charge</td>
|
||||||
|
<td></td>
|
||||||
<td>
|
<td>
|
||||||
<span
|
<span
|
||||||
data-bind="text: $parent.requestChargeDisplayText, attr: { title: $parent.requestChargeDisplayText }"
|
data-bind="text: $parent.requestChargeDisplayText, attr: { title: $parent.requestChargeDisplayText }"
|
||||||
@@ -131,6 +130,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr class="queryMetricsSummaryTuple">
|
<tr class="queryMetricsSummaryTuple">
|
||||||
<td title="Showing Results">Showing Results</td>
|
<td title="Showing Results">Showing Results</td>
|
||||||
|
<td></td>
|
||||||
<td>
|
<td>
|
||||||
<span
|
<span
|
||||||
data-bind="text: $parent.showingDocumentsDisplayText, attr: { title: $parent.showingDocumentsDisplayText }"
|
data-bind="text: $parent.showingDocumentsDisplayText, attr: { title: $parent.showingDocumentsDisplayText }"
|
||||||
@@ -138,8 +138,8 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="queryMetricsSummaryTuple" data-bind="visible: $parent.isQueryMetricsEnabled">
|
<tr class="queryMetricsSummaryTuple" data-bind="visible: $parent.isQueryMetricsEnabled">
|
||||||
|
<td><span title="Retrieved document count">Retrieved document count</span></td>
|
||||||
<td>
|
<td>
|
||||||
<span title="Retrieved document count">Retrieved document count</span>
|
|
||||||
<span class="queryMetricInfoTooltip" role="tooltip" tabindex="0">
|
<span class="queryMetricInfoTooltip" role="tooltip" tabindex="0">
|
||||||
<img class="infoImg" src="/info-bubble.svg" alt="More information" />
|
<img class="infoImg" src="/info-bubble.svg" alt="More information" />
|
||||||
<span class="queryMetricTooltipText">Total number of retrieved documents</span>
|
<span class="queryMetricTooltipText">Total number of retrieved documents</span>
|
||||||
@@ -148,8 +148,8 @@
|
|||||||
<td><span data-bind="text: retrievedDocumentCount, attr: { title: retrievedDocumentCount }"></span></td>
|
<td><span data-bind="text: retrievedDocumentCount, attr: { title: retrievedDocumentCount }"></span></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="queryMetricsSummaryTuple" data-bind="visible: $parent.isQueryMetricsEnabled">
|
<tr class="queryMetricsSummaryTuple" data-bind="visible: $parent.isQueryMetricsEnabled">
|
||||||
|
<td><span title="Retrieved document size">Retrieved document size</span></td>
|
||||||
<td>
|
<td>
|
||||||
<span title="Retrieved document size">Retrieved document size</span>
|
|
||||||
<span class="queryMetricInfoTooltip" role="tooltip" tabindex="0">
|
<span class="queryMetricInfoTooltip" role="tooltip" tabindex="0">
|
||||||
<img class="infoImg" src="/info-bubble.svg" alt="More information" />
|
<img class="infoImg" src="/info-bubble.svg" alt="More information" />
|
||||||
<span class="queryMetricTooltipText">Total size of retrieved documents in bytes</span>
|
<span class="queryMetricTooltipText">Total size of retrieved documents in bytes</span>
|
||||||
@@ -161,8 +161,8 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="queryMetricsSummaryTuple" data-bind="visible: $parent.isQueryMetricsEnabled">
|
<tr class="queryMetricsSummaryTuple" data-bind="visible: $parent.isQueryMetricsEnabled">
|
||||||
|
<td><span title="Output document count">Output document count</span></td>
|
||||||
<td>
|
<td>
|
||||||
<span title="Output document count">Output document count</span>
|
|
||||||
<span class="queryMetricInfoTooltip" role="tooltip" tabindex="0">
|
<span class="queryMetricInfoTooltip" role="tooltip" tabindex="0">
|
||||||
<img class="infoImg" src="/info-bubble.svg" alt="More information" />
|
<img class="infoImg" src="/info-bubble.svg" alt="More information" />
|
||||||
<span class="queryMetricTooltipText">Number of output documents</span>
|
<span class="queryMetricTooltipText">Number of output documents</span>
|
||||||
@@ -171,8 +171,8 @@
|
|||||||
<td><span data-bind="text: outputDocumentCount, attr: { title: outputDocumentCount }"></span></td>
|
<td><span data-bind="text: outputDocumentCount, attr: { title: outputDocumentCount }"></span></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="queryMetricsSummaryTuple" data-bind="visible: $parent.isQueryMetricsEnabled">
|
<tr class="queryMetricsSummaryTuple" data-bind="visible: $parent.isQueryMetricsEnabled">
|
||||||
|
<td><span title="Output document size">Output document size</span></td>
|
||||||
<td>
|
<td>
|
||||||
<span title="Output document size">Output document size</span>
|
|
||||||
<span class="queryMetricInfoTooltip" role="tooltip" tabindex="0">
|
<span class="queryMetricInfoTooltip" role="tooltip" tabindex="0">
|
||||||
<img class="infoImg" src="/info-bubble.svg" alt="More information" />
|
<img class="infoImg" src="/info-bubble.svg" alt="More information" />
|
||||||
<span class="queryMetricTooltipText">Total size of output documents in bytes</span>
|
<span class="queryMetricTooltipText">Total size of output documents in bytes</span>
|
||||||
@@ -184,8 +184,8 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="queryMetricsSummaryTuple" data-bind="visible: $parent.isQueryMetricsEnabled">
|
<tr class="queryMetricsSummaryTuple" data-bind="visible: $parent.isQueryMetricsEnabled">
|
||||||
|
<td><span title="Index hit document count">Index hit document count</span></td>
|
||||||
<td>
|
<td>
|
||||||
<span title="Index hit document count">Index hit document count</span>
|
|
||||||
<span class="queryMetricInfoTooltip" role="tooltip" tabindex="0">
|
<span class="queryMetricInfoTooltip" role="tooltip" tabindex="0">
|
||||||
<img class="infoImg" src="/info-bubble.svg" alt="More information" />
|
<img class="infoImg" src="/info-bubble.svg" alt="More information" />
|
||||||
<span class="queryMetricTooltipText">Total number of documents matched by the filter</span>
|
<span class="queryMetricTooltipText">Total number of documents matched by the filter</span>
|
||||||
@@ -194,8 +194,8 @@
|
|||||||
<td><span data-bind="text: indexHitDocumentCount, attr: { title: indexHitDocumentCount }"></span></td>
|
<td><span data-bind="text: indexHitDocumentCount, attr: { title: indexHitDocumentCount }"></span></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="queryMetricsSummaryTuple" data-bind="visible: $parent.isQueryMetricsEnabled">
|
<tr class="queryMetricsSummaryTuple" data-bind="visible: $parent.isQueryMetricsEnabled">
|
||||||
|
<td><span title="Index lookup time">Index lookup time</span></td>
|
||||||
<td>
|
<td>
|
||||||
<span title="Index lookup time">Index lookup time</span>
|
|
||||||
<span class="queryMetricInfoTooltip" role="tooltip" tabindex="0">
|
<span class="queryMetricInfoTooltip" role="tooltip" tabindex="0">
|
||||||
<img class="infoImg" src="/info-bubble.svg" alt="More information" />
|
<img class="infoImg" src="/info-bubble.svg" alt="More information" />
|
||||||
<span class="queryMetricTooltipText">Time spent in physical index layer</span>
|
<span class="queryMetricTooltipText">Time spent in physical index layer</span>
|
||||||
@@ -206,8 +206,8 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="queryMetricsSummaryTuple" data-bind="visible: $parent.isQueryMetricsEnabled">
|
<tr class="queryMetricsSummaryTuple" data-bind="visible: $parent.isQueryMetricsEnabled">
|
||||||
|
<td><span title="Document load time">Document load time</span></td>
|
||||||
<td>
|
<td>
|
||||||
<span title="Document load time">Document load time</span>
|
|
||||||
<span class="queryMetricInfoTooltip" role="tooltip" tabindex="0">
|
<span class="queryMetricInfoTooltip" role="tooltip" tabindex="0">
|
||||||
<img class="infoImg" src="/info-bubble.svg" alt="More information" />
|
<img class="infoImg" src="/info-bubble.svg" alt="More information" />
|
||||||
<span class="queryMetricTooltipText">Time spent in loading documents</span>
|
<span class="queryMetricTooltipText">Time spent in loading documents</span>
|
||||||
@@ -218,8 +218,8 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="queryMetricsSummaryTuple" data-bind="visible: $parent.isQueryMetricsEnabled">
|
<tr class="queryMetricsSummaryTuple" data-bind="visible: $parent.isQueryMetricsEnabled">
|
||||||
|
<td><span title="Query engine execution time">Query engine execution time</span></td>
|
||||||
<td>
|
<td>
|
||||||
<span title="Query engine execution time">Query engine execution time</span>
|
|
||||||
<span class="queryMetricInfoTooltip" role="tooltip" tabindex="0">
|
<span class="queryMetricInfoTooltip" role="tooltip" tabindex="0">
|
||||||
<img class="infoImg" src="/info-bubble.svg" alt="More information" />
|
<img class="infoImg" src="/info-bubble.svg" alt="More information" />
|
||||||
<span class="queryMetricTooltipText queryEngineExeTimeInfo"
|
<span class="queryMetricTooltipText queryEngineExeTimeInfo"
|
||||||
@@ -236,8 +236,8 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="queryMetricsSummaryTuple" data-bind="visible: $parent.isQueryMetricsEnabled">
|
<tr class="queryMetricsSummaryTuple" data-bind="visible: $parent.isQueryMetricsEnabled">
|
||||||
|
<td><span title="System function execution time">System function execution time</span></td>
|
||||||
<td>
|
<td>
|
||||||
<span title="System function execution time">System function execution time</span>
|
|
||||||
<span class="queryMetricInfoTooltip" role="tooltip" tabindex="0">
|
<span class="queryMetricInfoTooltip" role="tooltip" tabindex="0">
|
||||||
<img class="infoImg" src="/info-bubble.svg" alt="More information" />
|
<img class="infoImg" src="/info-bubble.svg" alt="More information" />
|
||||||
<span class="queryMetricTooltipText">Total time spent executing system (built-in) functions</span>
|
<span class="queryMetricTooltipText">Total time spent executing system (built-in) functions</span>
|
||||||
@@ -251,8 +251,8 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="queryMetricsSummaryTuple" data-bind="visible: $parent.isQueryMetricsEnabled">
|
<tr class="queryMetricsSummaryTuple" data-bind="visible: $parent.isQueryMetricsEnabled">
|
||||||
|
<td><span title="User defined function execution time">User defined function execution time</span></td>
|
||||||
<td>
|
<td>
|
||||||
<span title="User defined function execution time">User defined function execution time</span>
|
|
||||||
<span class="queryMetricInfoTooltip" role="tooltip" tabindex="0">
|
<span class="queryMetricInfoTooltip" role="tooltip" tabindex="0">
|
||||||
<img class="infoImg" src="/info-bubble.svg" alt="More information" />
|
<img class="infoImg" src="/info-bubble.svg" alt="More information" />
|
||||||
<span class="queryMetricTooltipText">Total time spent executing user-defined functions</span>
|
<span class="queryMetricTooltipText">Total time spent executing user-defined functions</span>
|
||||||
@@ -266,8 +266,8 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="queryMetricsSummaryTuple" data-bind="visible: $parent.isQueryMetricsEnabled">
|
<tr class="queryMetricsSummaryTuple" data-bind="visible: $parent.isQueryMetricsEnabled">
|
||||||
|
<td><span title="Document write time">Document write time</span></td>
|
||||||
<td>
|
<td>
|
||||||
<span title="Document write time">Document write time</span>
|
|
||||||
<span class="queryMetricInfoTooltip" role="tooltip" tabindex="0">
|
<span class="queryMetricInfoTooltip" role="tooltip" tabindex="0">
|
||||||
<img class="infoImg" src="/info-bubble.svg" alt="More information" />
|
<img class="infoImg" src="/info-bubble.svg" alt="More information" />
|
||||||
<span class="queryMetricTooltipText">Time spent to write query result set to response buffer</span>
|
<span class="queryMetricTooltipText">Time spent to write query result set to response buffer</span>
|
||||||
@@ -279,6 +279,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr class="queryMetricsSummaryTuple" data-bind="visible: $parent.roundTrips() != null">
|
<tr class="queryMetricsSummaryTuple" data-bind="visible: $parent.roundTrips() != null">
|
||||||
<td title="Round Trips">Round Trips</td>
|
<td title="Round Trips">Round Trips</td>
|
||||||
|
<td></td>
|
||||||
<td><span data-bind="text: $parent.roundTrips, attr: { title: $parent.roundTrips }"></span></td>
|
<td><span data-bind="text: $parent.roundTrips, attr: { title: $parent.roundTrips }"></span></td>
|
||||||
</tr>
|
</tr>
|
||||||
<!-- TODO: Report activity id for mongo queries -->
|
<!-- TODO: Report activity id for mongo queries -->
|
||||||
|
|||||||
@@ -93,7 +93,7 @@
|
|||||||
margin-left: @MediumSpace;
|
margin-left: @MediumSpace;
|
||||||
.flex-display();
|
.flex-display();
|
||||||
.flex-direction();
|
.flex-direction();
|
||||||
|
|
||||||
|
|
||||||
.togglesWithMetadata {
|
.togglesWithMetadata {
|
||||||
margin-top: @MediumSpace;
|
margin-top: @MediumSpace;
|
||||||
@@ -102,23 +102,23 @@
|
|||||||
height: @ToggleHeight;
|
height: @ToggleHeight;
|
||||||
width: @ToggleWidth;
|
width: @ToggleWidth;
|
||||||
margin-left: @MediumSpace;
|
margin-left: @MediumSpace;
|
||||||
|
|
||||||
&:focus {
|
&:focus {
|
||||||
.focus();
|
.focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
.tab {
|
.tab {
|
||||||
margin-right: @MediumSpace;
|
margin-right: @MediumSpace;
|
||||||
}
|
}
|
||||||
|
|
||||||
.toggleSwitch {
|
.toggleSwitch {
|
||||||
.toggleSwitch();
|
.toggleSwitch();
|
||||||
}
|
}
|
||||||
|
|
||||||
.selectedToggle {
|
.selectedToggle {
|
||||||
.selectedToggle();
|
.selectedToggle();
|
||||||
}
|
}
|
||||||
|
|
||||||
.unselectedToggle {
|
.unselectedToggle {
|
||||||
.unselectedToggle();
|
.unselectedToggle();
|
||||||
}
|
}
|
||||||
@@ -136,7 +136,7 @@
|
|||||||
.queryResultNextEnable {
|
.queryResultNextEnable {
|
||||||
color: @AccentMediumHigh;
|
color: @AccentMediumHigh;
|
||||||
font-size: @mediumFontSize;
|
font-size: @mediumFontSize;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
|
||||||
img {
|
img {
|
||||||
height: @ImgHeight;
|
height: @ImgHeight;
|
||||||
@@ -153,7 +153,7 @@
|
|||||||
img {
|
img {
|
||||||
height: @ImgHeight;
|
height: @ImgHeight;
|
||||||
width: @ImgWidth;
|
width: @ImgWidth;
|
||||||
margin-left: @SmallSpace;
|
margin-left: @SmallSpace;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -181,7 +181,7 @@
|
|||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
padding: @SmallSpace;
|
padding: @SmallSpace;
|
||||||
}
|
}
|
||||||
|
|
||||||
.queryMetricsSummaryContainer {
|
.queryMetricsSummaryContainer {
|
||||||
.flex-display();
|
.flex-display();
|
||||||
.flex-direction();
|
.flex-direction();
|
||||||
@@ -195,14 +195,10 @@
|
|||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
|
|
||||||
caption {
|
|
||||||
width: 100px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.queryMetricsSummaryHead {
|
.queryMetricsSummaryHead {
|
||||||
.flex-display();
|
.flex-display();
|
||||||
}
|
}
|
||||||
|
|
||||||
.queryMetricsSummaryHeader.queryMetricsSummaryTuple {
|
.queryMetricsSummaryHeader.queryMetricsSummaryTuple {
|
||||||
font-size: 10px;
|
font-size: 10px;
|
||||||
}
|
}
|
||||||
@@ -211,7 +207,7 @@
|
|||||||
.flex-display();
|
.flex-display();
|
||||||
.flex-direction();
|
.flex-direction();
|
||||||
}
|
}
|
||||||
|
|
||||||
.queryMetricsSummaryTuple {
|
.queryMetricsSummaryTuple {
|
||||||
border-bottom: 1px solid @BaseMedium;
|
border-bottom: 1px solid @BaseMedium;
|
||||||
height: 32px;
|
height: 32px;
|
||||||
@@ -225,14 +221,18 @@
|
|||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
flex: 0 0 50%;
|
flex: 0 1 auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:nth-child(2) {
|
||||||
|
flex: 1 1 auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
&:nth-child(3) {
|
&:nth-child(3) {
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
flex: 0 0 50%;
|
flex: 0 0 50%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.queryMetricInfoTooltip {
|
.queryMetricInfoTooltip {
|
||||||
@@ -264,7 +264,7 @@
|
|||||||
.tooltipTextAfter();
|
.tooltipTextAfter();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.queryEngineExeTimeInfo {
|
.queryEngineExeTimeInfo {
|
||||||
width: @QueryEngineExeInfo;
|
width: @QueryEngineExeInfo;
|
||||||
top: -85px;
|
top: -85px;
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
<div class="error-bar">
|
<div class="error-bar">
|
||||||
<div class="error-message" aria-label="Error Message" data-bind="visible: hasQueryError">
|
<div class="error-message" aria-label="Error Message" data-bind="visible: hasQueryError">
|
||||||
<span><img class="entity-error-Img" src="/error_red.svg"/></span>
|
<span><img class="entity-error-Img" src="/error_red.svg"/></span>
|
||||||
<span class="error-text" role="alert" data-bind="text: queryErrorMessage"></span>
|
<span class="error-text" data-bind="text: queryErrorMessage"></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- Tables Query Tab Errors - End-->
|
<!-- Tables Query Tab Errors - End-->
|
||||||
|
|||||||
@@ -1,14 +1,15 @@
|
|||||||
import * as ko from "knockout";
|
|
||||||
import * as monaco from "monaco-editor";
|
|
||||||
import Q from "q";
|
|
||||||
import DiscardIcon from "../../../images/discard.svg";
|
|
||||||
import SaveIcon from "../../../images/save-cosmos.svg";
|
|
||||||
import * as Constants from "../../Common/Constants";
|
import * as Constants from "../../Common/Constants";
|
||||||
import editable from "../../Common/EditableUtility";
|
import * as ko from "knockout";
|
||||||
|
import Q from "q";
|
||||||
|
|
||||||
import * as DataModels from "../../Contracts/DataModels";
|
import * as DataModels from "../../Contracts/DataModels";
|
||||||
import * as ViewModels from "../../Contracts/ViewModels";
|
import * as ViewModels from "../../Contracts/ViewModels";
|
||||||
import { CommandButtonComponentProps } from "../Controls/CommandButton/CommandButtonComponent";
|
|
||||||
import TabsBase from "./TabsBase";
|
import TabsBase from "./TabsBase";
|
||||||
|
import editable from "../../Common/EditableUtility";
|
||||||
|
import * as monaco from "monaco-editor";
|
||||||
|
import SaveIcon from "../../../images/save-cosmos.svg";
|
||||||
|
import DiscardIcon from "../../../images/discard.svg";
|
||||||
|
import { CommandButtonComponentProps } from "../Controls/CommandButton/CommandButtonComponent";
|
||||||
|
|
||||||
export default abstract class ScriptTabBase extends TabsBase implements ViewModels.WaitsForTemplate {
|
export default abstract class ScriptTabBase extends TabsBase implements ViewModels.WaitsForTemplate {
|
||||||
public ariaLabel: ko.Observable<string>;
|
public ariaLabel: ko.Observable<string>;
|
||||||
@@ -29,8 +30,7 @@ export default abstract class ScriptTabBase extends TabsBase implements ViewMode
|
|||||||
public formIsValid: ko.Computed<boolean>;
|
public formIsValid: ko.Computed<boolean>;
|
||||||
public formIsDirty: ko.Computed<boolean>;
|
public formIsDirty: ko.Computed<boolean>;
|
||||||
public isNew: ko.Observable<boolean>;
|
public isNew: ko.Observable<boolean>;
|
||||||
// TODO: Remove any. The SDK types for all the script.body are slightly incorrect which makes this REALLY hard to type correct.
|
public resource: ko.Observable<DataModels.Script>;
|
||||||
public resource: ko.Observable<any>;
|
|
||||||
public isTemplateReady: ko.Observable<boolean>;
|
public isTemplateReady: ko.Observable<boolean>;
|
||||||
protected _partitionKey: DataModels.PartitionKey;
|
protected _partitionKey: DataModels.PartitionKey;
|
||||||
|
|
||||||
@@ -194,8 +194,8 @@ export default abstract class ScriptTabBase extends TabsBase implements ViewMode
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract onSaveClick: () => Promise<any>;
|
public abstract onSaveClick: () => Q.Promise<any>;
|
||||||
public abstract onUpdateClick: () => Promise<any>;
|
public abstract onUpdateClick: () => Q.Promise<any>;
|
||||||
|
|
||||||
public onDiscard = (): Q.Promise<any> => {
|
public onDiscard = (): Q.Promise<any> => {
|
||||||
this.setBaselines();
|
this.setBaselines();
|
||||||
@@ -206,14 +206,14 @@ export default abstract class ScriptTabBase extends TabsBase implements ViewMode
|
|||||||
return Q();
|
return Q();
|
||||||
};
|
};
|
||||||
|
|
||||||
public onSaveOrUpdateClick(): Promise<any> {
|
public onSaveOrUpdateClick(): Q.Promise<any> {
|
||||||
if (this.saveButton.visible()) {
|
if (this.saveButton.visible()) {
|
||||||
return this.onSaveClick();
|
return this.onSaveClick();
|
||||||
} else if (this.updateButton.visible()) {
|
} else if (this.updateButton.visible()) {
|
||||||
return this.onUpdateClick();
|
return this.onUpdateClick();
|
||||||
}
|
}
|
||||||
|
|
||||||
return undefined;
|
return Q();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected getTabsButtons(): CommandButtonComponentProps[] {
|
protected getTabsButtons(): CommandButtonComponentProps[] {
|
||||||
|
|||||||
@@ -1,18 +1,17 @@
|
|||||||
import { Resource, StoredProcedureDefinition } from "@azure/cosmos";
|
|
||||||
import * as ko from "knockout";
|
import * as ko from "knockout";
|
||||||
import Q from "q";
|
|
||||||
import * as _ from "underscore";
|
import * as _ from "underscore";
|
||||||
import ExecuteQueryIcon from "../../../images/ExecuteQuery.svg";
|
import Q from "q";
|
||||||
import * as Constants from "../../Common/Constants";
|
import * as Constants from "../../Common/Constants";
|
||||||
import { createStoredProcedure } from "../../Common/dataAccess/createStoredProcedure";
|
import * as DataModels from "../../Contracts/DataModels";
|
||||||
import { updateStoredProcedure } from "../../Common/dataAccess/updateStoredProcedure";
|
|
||||||
import editable from "../../Common/EditableUtility";
|
|
||||||
import * as ViewModels from "../../Contracts/ViewModels";
|
import * as ViewModels from "../../Contracts/ViewModels";
|
||||||
import { Action } from "../../Shared/Telemetry/TelemetryConstants";
|
import { Action } from "../../Shared/Telemetry/TelemetryConstants";
|
||||||
import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
import editable from "../../Common/EditableUtility";
|
||||||
import { CommandButtonComponentProps } from "../Controls/CommandButton/CommandButtonComponent";
|
|
||||||
import StoredProcedure from "../Tree/StoredProcedure";
|
|
||||||
import ScriptTabBase from "./ScriptTabBase";
|
import ScriptTabBase from "./ScriptTabBase";
|
||||||
|
import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
||||||
|
import ExecuteQueryIcon from "../../../images/ExecuteQuery.svg";
|
||||||
|
import StoredProcedure from "../Tree/StoredProcedure";
|
||||||
|
import { createStoredProcedure, updateStoredProcedure } from "../../Common/DocumentClientUtilityBase";
|
||||||
|
import { CommandButtonComponentProps } from "../Controls/CommandButton/CommandButtonComponent";
|
||||||
|
|
||||||
enum ToggleState {
|
enum ToggleState {
|
||||||
Result = "result",
|
Result = "result",
|
||||||
@@ -25,6 +24,7 @@ export default class StoredProcedureTab extends ScriptTabBase {
|
|||||||
public executeResultsEditorId: string;
|
public executeResultsEditorId: string;
|
||||||
public executeLogsEditorId: string;
|
public executeLogsEditorId: string;
|
||||||
public toggleState: ko.Observable<ToggleState>;
|
public toggleState: ko.Observable<ToggleState>;
|
||||||
|
|
||||||
public originalSprocBody: ViewModels.Editable<string>;
|
public originalSprocBody: ViewModels.Editable<string>;
|
||||||
public resultsData: ko.Observable<string>;
|
public resultsData: ko.Observable<string>;
|
||||||
public logsData: ko.Observable<string>;
|
public logsData: ko.Observable<string>;
|
||||||
@@ -54,11 +54,13 @@ export default class StoredProcedureTab extends ScriptTabBase {
|
|||||||
this.buildCommandBarOptions();
|
this.buildCommandBarOptions();
|
||||||
}
|
}
|
||||||
|
|
||||||
public onSaveClick = (): Promise<StoredProcedureDefinition & Resource> => {
|
public onSaveClick = (): Q.Promise<DataModels.StoredProcedure> => {
|
||||||
return this._createStoredProcedure({
|
const resource: DataModels.StoredProcedure = <DataModels.StoredProcedure>{
|
||||||
id: this.id(),
|
id: this.id(),
|
||||||
body: this.editorContent()
|
body: this.editorContent()
|
||||||
});
|
};
|
||||||
|
|
||||||
|
return this._createStoredProcedure(resource);
|
||||||
};
|
};
|
||||||
|
|
||||||
public onDiscard = (): Q.Promise<any> => {
|
public onDiscard = (): Q.Promise<any> => {
|
||||||
@@ -70,8 +72,8 @@ export default class StoredProcedureTab extends ScriptTabBase {
|
|||||||
return Q();
|
return Q();
|
||||||
};
|
};
|
||||||
|
|
||||||
public onUpdateClick = (): Promise<any> => {
|
public onUpdateClick = (): Q.Promise<any> => {
|
||||||
const data = this._getResource();
|
const data: DataModels.StoredProcedure = this._getResource();
|
||||||
|
|
||||||
this.isExecutionError(false);
|
this.isExecutionError(false);
|
||||||
this.isExecuting(true);
|
this.isExecuting(true);
|
||||||
@@ -81,18 +83,18 @@ export default class StoredProcedureTab extends ScriptTabBase {
|
|||||||
dataExplorerArea: Constants.Areas.Tab,
|
dataExplorerArea: Constants.Areas.Tab,
|
||||||
tabTitle: this.tabTitle()
|
tabTitle: this.tabTitle()
|
||||||
});
|
});
|
||||||
return updateStoredProcedure(this.collection.databaseId, this.collection.id(), data)
|
return updateStoredProcedure(this.collection, data)
|
||||||
.then(
|
.then(
|
||||||
updatedResource => {
|
(updatedResource: DataModels.StoredProcedure) => {
|
||||||
this.resource(updatedResource);
|
this.resource(updatedResource);
|
||||||
this.tabTitle(updatedResource.id);
|
this.tabTitle(updatedResource.id);
|
||||||
this.node.id(updatedResource.id);
|
this.node.id(updatedResource.id);
|
||||||
this.node.body(updatedResource.body as string);
|
this.node.body(updatedResource.body);
|
||||||
this.setBaselines();
|
this.setBaselines();
|
||||||
|
|
||||||
const editorModel = this.editor() && this.editor().getModel();
|
const editorModel = this.editor() && this.editor().getModel();
|
||||||
editorModel && editorModel.setValue(updatedResource.body as string);
|
editorModel && editorModel.setValue(updatedResource.body);
|
||||||
this.editorContent.setBaseline(updatedResource.body as string);
|
this.editorContent.setBaseline(updatedResource.body);
|
||||||
TelemetryProcessor.traceSuccess(
|
TelemetryProcessor.traceSuccess(
|
||||||
Action.UpdateStoredProcedure,
|
Action.UpdateStoredProcedure,
|
||||||
{
|
{
|
||||||
@@ -218,14 +220,18 @@ export default class StoredProcedureTab extends ScriptTabBase {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private _getResource() {
|
private _getResource(): DataModels.StoredProcedure {
|
||||||
return {
|
const resource: DataModels.StoredProcedure = <DataModels.StoredProcedure>{
|
||||||
|
_rid: this.resource()._rid,
|
||||||
|
_self: this.resource()._self,
|
||||||
id: this.id(),
|
id: this.id(),
|
||||||
body: this.editorContent()
|
body: this.editorContent()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
return resource;
|
||||||
}
|
}
|
||||||
|
|
||||||
private _createStoredProcedure(resource: StoredProcedureDefinition): Promise<StoredProcedureDefinition & Resource> {
|
private _createStoredProcedure(resource: DataModels.StoredProcedure): Q.Promise<DataModels.StoredProcedure> {
|
||||||
this.isExecutionError(false);
|
this.isExecutionError(false);
|
||||||
this.isExecuting(true);
|
this.isExecuting(true);
|
||||||
const startKey: number = TelemetryProcessor.traceStart(Action.CreateStoredProcedure, {
|
const startKey: number = TelemetryProcessor.traceStart(Action.CreateStoredProcedure, {
|
||||||
@@ -235,7 +241,7 @@ export default class StoredProcedureTab extends ScriptTabBase {
|
|||||||
tabTitle: this.tabTitle()
|
tabTitle: this.tabTitle()
|
||||||
});
|
});
|
||||||
|
|
||||||
return createStoredProcedure(this.collection.databaseId, this.collection.id(), resource)
|
return createStoredProcedure(this.collection, resource)
|
||||||
.then(
|
.then(
|
||||||
createdResource => {
|
createdResource => {
|
||||||
this.tabTitle(createdResource.id);
|
this.tabTitle(createdResource.id);
|
||||||
@@ -250,8 +256,8 @@ export default class StoredProcedureTab extends ScriptTabBase {
|
|||||||
this.setBaselines();
|
this.setBaselines();
|
||||||
|
|
||||||
const editorModel = this.editor() && this.editor().getModel();
|
const editorModel = this.editor() && this.editor().getModel();
|
||||||
editorModel && editorModel.setValue(createdResource.body as string);
|
editorModel && editorModel.setValue(createdResource.body);
|
||||||
this.editorContent.setBaseline(createdResource.body as string);
|
this.editorContent.setBaseline(createdResource.body);
|
||||||
this.node = this.collection.createStoredProcedureNode(createdResource);
|
this.node = this.collection.createStoredProcedureNode(createdResource);
|
||||||
TelemetryProcessor.traceSuccess(
|
TelemetryProcessor.traceSuccess(
|
||||||
Action.CreateStoredProcedure,
|
Action.CreateStoredProcedure,
|
||||||
@@ -278,7 +284,7 @@ export default class StoredProcedureTab extends ScriptTabBase {
|
|||||||
},
|
},
|
||||||
startKey
|
startKey
|
||||||
);
|
);
|
||||||
return Promise.reject(createError);
|
return Q.reject(createError);
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
.finally(() => this.isExecuting(false));
|
.finally(() => this.isExecuting(false));
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
import { Resource, TriggerDefinition, TriggerOperation, TriggerType } from "@azure/cosmos";
|
import Q from "q";
|
||||||
import * as Constants from "../../Common/Constants";
|
import * as Constants from "../../Common/Constants";
|
||||||
import { createTrigger } from "../../Common/dataAccess/createTrigger";
|
import * as DataModels from "../../Contracts/DataModels";
|
||||||
import { updateTrigger } from "../../Common/dataAccess/updateTrigger";
|
|
||||||
import editable from "../../Common/EditableUtility";
|
|
||||||
import * as ViewModels from "../../Contracts/ViewModels";
|
import * as ViewModels from "../../Contracts/ViewModels";
|
||||||
import { Action } from "../../Shared/Telemetry/TelemetryConstants";
|
import { Action } from "../../Shared/Telemetry/TelemetryConstants";
|
||||||
|
import ScriptTabBase from "./ScriptTabBase";
|
||||||
|
import editable from "../../Common/EditableUtility";
|
||||||
import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
||||||
import Trigger from "../Tree/Trigger";
|
import Trigger from "../Tree/Trigger";
|
||||||
import ScriptTabBase from "./ScriptTabBase";
|
import { createTrigger, updateTrigger } from "../../Common/DocumentClientUtilityBase";
|
||||||
|
|
||||||
export default class TriggerTab extends ScriptTabBase {
|
export default class TriggerTab extends ScriptTabBase {
|
||||||
public collection: ViewModels.Collection;
|
public collection: ViewModels.Collection;
|
||||||
@@ -27,17 +27,13 @@ export default class TriggerTab extends ScriptTabBase {
|
|||||||
super.buildCommandBarOptions();
|
super.buildCommandBarOptions();
|
||||||
}
|
}
|
||||||
|
|
||||||
public onSaveClick = (): Promise<TriggerDefinition & Resource> => {
|
public onSaveClick = (): Q.Promise<DataModels.Trigger> => {
|
||||||
return this._createTrigger({
|
const data: DataModels.Trigger = this._getResource();
|
||||||
id: this.id(),
|
return this._createTrigger(data);
|
||||||
body: this.editorContent(),
|
|
||||||
triggerOperation: this.triggerOperation() as TriggerOperation,
|
|
||||||
triggerType: this.triggerType() as TriggerType
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
public onUpdateClick = (): Promise<any> => {
|
public onUpdateClick = (): Q.Promise<any> => {
|
||||||
const data = this._getResource();
|
const data: DataModels.Trigger = this._getResource();
|
||||||
this.isExecutionError(false);
|
this.isExecutionError(false);
|
||||||
this.isExecuting(true);
|
this.isExecuting(true);
|
||||||
const startKey: number = TelemetryProcessor.traceStart(Action.UpdateTrigger, {
|
const startKey: number = TelemetryProcessor.traceStart(Action.UpdateTrigger, {
|
||||||
@@ -46,19 +42,14 @@ export default class TriggerTab extends ScriptTabBase {
|
|||||||
tabTitle: this.tabTitle()
|
tabTitle: this.tabTitle()
|
||||||
});
|
});
|
||||||
|
|
||||||
return updateTrigger(this.collection.databaseId, this.collection.id(), {
|
return updateTrigger(this.collection, data)
|
||||||
id: this.id(),
|
|
||||||
body: this.editorContent(),
|
|
||||||
triggerOperation: this.triggerOperation() as TriggerOperation,
|
|
||||||
triggerType: this.triggerType() as TriggerType
|
|
||||||
})
|
|
||||||
.then(
|
.then(
|
||||||
createdResource => {
|
(createdResource: DataModels.Trigger) => {
|
||||||
this.resource(createdResource);
|
this.resource(createdResource);
|
||||||
this.tabTitle(createdResource.id);
|
this.tabTitle(createdResource.id);
|
||||||
|
|
||||||
this.node.id(createdResource.id);
|
this.node.id(createdResource.id);
|
||||||
this.node.body(createdResource.body as string);
|
this.node.body(createdResource.body);
|
||||||
this.node.triggerType(createdResource.triggerOperation);
|
this.node.triggerType(createdResource.triggerOperation);
|
||||||
this.node.triggerOperation(createdResource.triggerOperation);
|
this.node.triggerOperation(createdResource.triggerOperation);
|
||||||
TelemetryProcessor.traceSuccess(
|
TelemetryProcessor.traceSuccess(
|
||||||
@@ -75,8 +66,8 @@ export default class TriggerTab extends ScriptTabBase {
|
|||||||
this.setBaselines();
|
this.setBaselines();
|
||||||
|
|
||||||
const editorModel = this.editor().getModel();
|
const editorModel = this.editor().getModel();
|
||||||
editorModel.setValue(createdResource.body as string);
|
editorModel.setValue(createdResource.body);
|
||||||
this.editorContent.setBaseline(createdResource.body as string);
|
this.editorContent.setBaseline(createdResource.body);
|
||||||
},
|
},
|
||||||
(createError: any) => {
|
(createError: any) => {
|
||||||
this.isExecutionError(true);
|
this.isExecutionError(true);
|
||||||
@@ -98,7 +89,7 @@ export default class TriggerTab extends ScriptTabBase {
|
|||||||
public setBaselines() {
|
public setBaselines() {
|
||||||
super.setBaselines();
|
super.setBaselines();
|
||||||
|
|
||||||
const resource = this.resource();
|
const resource = <DataModels.Trigger>this.resource();
|
||||||
this.triggerOperation.setBaseline(resource.triggerOperation);
|
this.triggerOperation.setBaseline(resource.triggerOperation);
|
||||||
this.triggerType.setBaseline(resource.triggerType);
|
this.triggerType.setBaseline(resource.triggerType);
|
||||||
}
|
}
|
||||||
@@ -118,7 +109,7 @@ export default class TriggerTab extends ScriptTabBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private _createTrigger(resource: TriggerDefinition): Promise<TriggerDefinition & Resource> {
|
private _createTrigger(resource: DataModels.Trigger): Q.Promise<DataModels.Trigger> {
|
||||||
this.isExecutionError(false);
|
this.isExecutionError(false);
|
||||||
this.isExecuting(true);
|
this.isExecuting(true);
|
||||||
const startKey: number = TelemetryProcessor.traceStart(Action.CreateTrigger, {
|
const startKey: number = TelemetryProcessor.traceStart(Action.CreateTrigger, {
|
||||||
@@ -128,9 +119,9 @@ export default class TriggerTab extends ScriptTabBase {
|
|||||||
tabTitle: this.tabTitle()
|
tabTitle: this.tabTitle()
|
||||||
});
|
});
|
||||||
|
|
||||||
return createTrigger(this.collection.databaseId, this.collection.id(), resource)
|
return createTrigger(this.collection, resource)
|
||||||
.then(
|
.then(
|
||||||
createdResource => {
|
(createdResource: DataModels.Trigger) => {
|
||||||
this.tabTitle(createdResource.id);
|
this.tabTitle(createdResource.id);
|
||||||
this.isNew(false);
|
this.isNew(false);
|
||||||
this.resource(createdResource);
|
this.resource(createdResource);
|
||||||
@@ -143,8 +134,8 @@ export default class TriggerTab extends ScriptTabBase {
|
|||||||
this.setBaselines();
|
this.setBaselines();
|
||||||
|
|
||||||
const editorModel = this.editor().getModel();
|
const editorModel = this.editor().getModel();
|
||||||
editorModel.setValue(createdResource.body as string);
|
editorModel.setValue(createdResource.body);
|
||||||
this.editorContent.setBaseline(createdResource.body as string);
|
this.editorContent.setBaseline(createdResource.body);
|
||||||
|
|
||||||
this.node = this.collection.createTriggerNode(createdResource);
|
this.node = this.collection.createTriggerNode(createdResource);
|
||||||
TelemetryProcessor.traceSuccess(
|
TelemetryProcessor.traceSuccess(
|
||||||
@@ -172,18 +163,22 @@ export default class TriggerTab extends ScriptTabBase {
|
|||||||
},
|
},
|
||||||
startKey
|
startKey
|
||||||
);
|
);
|
||||||
return Promise.reject(createError);
|
return Q.reject(createError);
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
.finally(() => this.isExecuting(false));
|
.finally(() => this.isExecuting(false));
|
||||||
}
|
}
|
||||||
|
|
||||||
private _getResource() {
|
private _getResource(): DataModels.Trigger {
|
||||||
return {
|
const resource: DataModels.Trigger = <DataModels.Trigger>{
|
||||||
|
_rid: this.resource()._rid,
|
||||||
|
_self: this.resource()._self,
|
||||||
id: this.id(),
|
id: this.id(),
|
||||||
body: this.editorContent(),
|
body: this.editorContent(),
|
||||||
triggerOperation: this.triggerOperation(),
|
triggerOperation: this.triggerOperation(),
|
||||||
triggerType: this.triggerType()
|
triggerType: this.triggerType()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
return resource;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
import { Resource, UserDefinedFunctionDefinition } from "@azure/cosmos";
|
import Q from "q";
|
||||||
import * as Constants from "../../Common/Constants";
|
import * as Constants from "../../Common/Constants";
|
||||||
import { createUserDefinedFunction } from "../../Common/dataAccess/createUserDefinedFunction";
|
import * as DataModels from "../../Contracts/DataModels";
|
||||||
import { updateUserDefinedFunction } from "../../Common/dataAccess/updateUserDefinedFunction";
|
|
||||||
import * as ViewModels from "../../Contracts/ViewModels";
|
import * as ViewModels from "../../Contracts/ViewModels";
|
||||||
import { Action } from "../../Shared/Telemetry/TelemetryConstants";
|
import { Action } from "../../Shared/Telemetry/TelemetryConstants";
|
||||||
|
import ScriptTabBase from "./ScriptTabBase";
|
||||||
import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
||||||
import UserDefinedFunction from "../Tree/UserDefinedFunction";
|
import UserDefinedFunction from "../Tree/UserDefinedFunction";
|
||||||
import ScriptTabBase from "./ScriptTabBase";
|
import { createUserDefinedFunction, updateUserDefinedFunction } from "../../Common/DocumentClientUtilityBase";
|
||||||
|
|
||||||
export default class UserDefinedFunctionTab extends ScriptTabBase {
|
export default class UserDefinedFunctionTab extends ScriptTabBase {
|
||||||
public collection: ViewModels.Collection;
|
public collection: ViewModels.Collection;
|
||||||
@@ -19,13 +19,13 @@ export default class UserDefinedFunctionTab extends ScriptTabBase {
|
|||||||
super.buildCommandBarOptions();
|
super.buildCommandBarOptions();
|
||||||
}
|
}
|
||||||
|
|
||||||
public onSaveClick = (): Promise<UserDefinedFunctionDefinition & Resource> => {
|
public onSaveClick = (): Q.Promise<DataModels.UserDefinedFunction> => {
|
||||||
const data = this._getResource();
|
const data: DataModels.UserDefinedFunction = this._getResource();
|
||||||
return this._createUserDefinedFunction(data);
|
return this._createUserDefinedFunction(data);
|
||||||
};
|
};
|
||||||
|
|
||||||
public onUpdateClick = (): Promise<any> => {
|
public onUpdateClick = (): Q.Promise<any> => {
|
||||||
const data = this._getResource();
|
const data: DataModels.UserDefinedFunction = this._getResource();
|
||||||
this.isExecutionError(false);
|
this.isExecutionError(false);
|
||||||
this.isExecuting(true);
|
this.isExecuting(true);
|
||||||
const startKey: number = TelemetryProcessor.traceStart(Action.UpdateUDF, {
|
const startKey: number = TelemetryProcessor.traceStart(Action.UpdateUDF, {
|
||||||
@@ -35,14 +35,14 @@ export default class UserDefinedFunctionTab extends ScriptTabBase {
|
|||||||
tabTitle: this.tabTitle()
|
tabTitle: this.tabTitle()
|
||||||
});
|
});
|
||||||
|
|
||||||
return updateUserDefinedFunction(this.collection.databaseId, this.collection.id(), data)
|
return updateUserDefinedFunction(this.collection, data)
|
||||||
.then(
|
.then(
|
||||||
createdResource => {
|
(createdResource: DataModels.UserDefinedFunction) => {
|
||||||
this.resource(createdResource);
|
this.resource(createdResource);
|
||||||
this.tabTitle(createdResource.id);
|
this.tabTitle(createdResource.id);
|
||||||
|
|
||||||
this.node.id(createdResource.id);
|
this.node.id(createdResource.id);
|
||||||
this.node.body(createdResource.body as string);
|
this.node.body(createdResource.body);
|
||||||
TelemetryProcessor.traceSuccess(
|
TelemetryProcessor.traceSuccess(
|
||||||
Action.UpdateUDF,
|
Action.UpdateUDF,
|
||||||
{
|
{
|
||||||
@@ -57,8 +57,8 @@ export default class UserDefinedFunctionTab extends ScriptTabBase {
|
|||||||
this.setBaselines();
|
this.setBaselines();
|
||||||
|
|
||||||
const editorModel = this.editor().getModel();
|
const editorModel = this.editor().getModel();
|
||||||
editorModel.setValue(createdResource.body as string);
|
editorModel.setValue(createdResource.body);
|
||||||
this.editorContent.setBaseline(createdResource.body as string);
|
this.editorContent.setBaseline(createdResource.body);
|
||||||
},
|
},
|
||||||
(createError: any) => {
|
(createError: any) => {
|
||||||
this.isExecutionError(true);
|
this.isExecutionError(true);
|
||||||
@@ -93,8 +93,8 @@ export default class UserDefinedFunctionTab extends ScriptTabBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private _createUserDefinedFunction(
|
private _createUserDefinedFunction(
|
||||||
resource: UserDefinedFunctionDefinition
|
resource: DataModels.UserDefinedFunction
|
||||||
): Promise<UserDefinedFunctionDefinition & Resource> {
|
): Q.Promise<DataModels.UserDefinedFunction> {
|
||||||
this.isExecutionError(false);
|
this.isExecutionError(false);
|
||||||
this.isExecuting(true);
|
this.isExecuting(true);
|
||||||
const startKey: number = TelemetryProcessor.traceStart(Action.CreateUDF, {
|
const startKey: number = TelemetryProcessor.traceStart(Action.CreateUDF, {
|
||||||
@@ -104,9 +104,9 @@ export default class UserDefinedFunctionTab extends ScriptTabBase {
|
|||||||
tabTitle: this.tabTitle()
|
tabTitle: this.tabTitle()
|
||||||
});
|
});
|
||||||
|
|
||||||
return createUserDefinedFunction(this.collection.databaseId, this.collection.id(), resource)
|
return createUserDefinedFunction(this.collection, resource)
|
||||||
.then(
|
.then(
|
||||||
createdResource => {
|
(createdResource: DataModels.UserDefinedFunction) => {
|
||||||
this.tabTitle(createdResource.id);
|
this.tabTitle(createdResource.id);
|
||||||
this.isNew(false);
|
this.isNew(false);
|
||||||
this.resource(createdResource);
|
this.resource(createdResource);
|
||||||
@@ -118,8 +118,8 @@ export default class UserDefinedFunctionTab extends ScriptTabBase {
|
|||||||
this.setBaselines();
|
this.setBaselines();
|
||||||
|
|
||||||
const editorModel = this.editor().getModel();
|
const editorModel = this.editor().getModel();
|
||||||
editorModel.setValue(createdResource.body as string);
|
editorModel.setValue(createdResource.body);
|
||||||
this.editorContent.setBaseline(createdResource.body as string);
|
this.editorContent.setBaseline(createdResource.body);
|
||||||
|
|
||||||
this.node = this.collection.createUserDefinedFunctionNode(createdResource);
|
this.node = this.collection.createUserDefinedFunctionNode(createdResource);
|
||||||
TelemetryProcessor.traceSuccess(
|
TelemetryProcessor.traceSuccess(
|
||||||
@@ -147,14 +147,14 @@ export default class UserDefinedFunctionTab extends ScriptTabBase {
|
|||||||
},
|
},
|
||||||
startKey
|
startKey
|
||||||
);
|
);
|
||||||
return Promise.reject(createError);
|
return Q.reject(createError);
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
.finally(() => this.isExecuting(false));
|
.finally(() => this.isExecuting(false));
|
||||||
}
|
}
|
||||||
|
|
||||||
private _getResource() {
|
private _getResource() {
|
||||||
const resource = {
|
const resource: DataModels.UserDefinedFunction = <DataModels.UserDefinedFunction>{
|
||||||
_rid: this.resource()._rid,
|
_rid: this.resource()._rid,
|
||||||
_self: this.resource()._self,
|
_self: this.resource()._self,
|
||||||
id: this.id(),
|
id: this.id(),
|
||||||
|
|||||||
@@ -1,28 +1,23 @@
|
|||||||
import { Resource, StoredProcedureDefinition, TriggerDefinition, UserDefinedFunctionDefinition } from "@azure/cosmos";
|
|
||||||
import * as ko from "knockout";
|
import * as ko from "knockout";
|
||||||
import Q from "q";
|
import Q from "q";
|
||||||
import * as _ from "underscore";
|
import * as _ from "underscore";
|
||||||
import UploadWorker from "worker-loader!../../workers/upload";
|
import UploadWorker from "worker-loader!../../workers/upload";
|
||||||
import { AuthType } from "../../AuthType";
|
import { AuthType } from "../../AuthType";
|
||||||
import * as Constants from "../../Common/Constants";
|
import * as Constants from "../../Common/Constants";
|
||||||
import { readStoredProcedures } from "../../Common/dataAccess/readStoredProcedures";
|
|
||||||
import { readTriggers } from "../../Common/dataAccess/readTriggers";
|
|
||||||
import { readUserDefinedFunctions } from "../../Common/dataAccess/readUserDefinedFunctions";
|
|
||||||
import { createDocument, readCollectionQuotaInfo, readOffer, readOffers } from "../../Common/DocumentClientUtilityBase";
|
|
||||||
import * as Logger from "../../Common/Logger";
|
import * as Logger from "../../Common/Logger";
|
||||||
import { configContext } from "../../ConfigContext";
|
|
||||||
import * as DataModels from "../../Contracts/DataModels";
|
import * as DataModels from "../../Contracts/DataModels";
|
||||||
import * as ViewModels from "../../Contracts/ViewModels";
|
import * as ViewModels from "../../Contracts/ViewModels";
|
||||||
import { PlatformType } from "../../PlatformType";
|
import { PlatformType } from "../../PlatformType";
|
||||||
import { Action, ActionModifiers } from "../../Shared/Telemetry/TelemetryConstants";
|
import { Action, ActionModifiers } from "../../Shared/Telemetry/TelemetryConstants";
|
||||||
import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
||||||
import { userContext } from "../../UserContext";
|
|
||||||
import * as NotificationConsoleUtils from "../../Utils/NotificationConsoleUtils";
|
import * as NotificationConsoleUtils from "../../Utils/NotificationConsoleUtils";
|
||||||
import { OfferUtils } from "../../Utils/OfferUtils";
|
import { OfferUtils } from "../../Utils/OfferUtils";
|
||||||
import { StartUploadMessageParams, UploadDetails, UploadDetailsRecord } from "../../workers/upload/definitions";
|
import { StartUploadMessageParams, UploadDetails, UploadDetailsRecord } from "../../workers/upload/definitions";
|
||||||
import Explorer from "../Explorer";
|
|
||||||
import { ConsoleDataType } from "../Menus/NotificationConsole/NotificationConsoleComponent";
|
import { ConsoleDataType } from "../Menus/NotificationConsole/NotificationConsoleComponent";
|
||||||
import { CassandraAPIDataClient, CassandraTableKey, CassandraTableKeys } from "../Tables/TableDataClient";
|
import { CassandraAPIDataClient, CassandraTableKey, CassandraTableKeys } from "../Tables/TableDataClient";
|
||||||
|
import ConflictId from "./ConflictId";
|
||||||
|
|
||||||
|
import DocumentId from "./DocumentId";
|
||||||
import ConflictsTab from "../Tabs/ConflictsTab";
|
import ConflictsTab from "../Tabs/ConflictsTab";
|
||||||
import DocumentsTab from "../Tabs/DocumentsTab";
|
import DocumentsTab from "../Tabs/DocumentsTab";
|
||||||
import GraphTab from "../Tabs/GraphTab";
|
import GraphTab from "../Tabs/GraphTab";
|
||||||
@@ -32,11 +27,21 @@ import MongoShellTab from "../Tabs/MongoShellTab";
|
|||||||
import QueryTab from "../Tabs/QueryTab";
|
import QueryTab from "../Tabs/QueryTab";
|
||||||
import QueryTablesTab from "../Tabs/QueryTablesTab";
|
import QueryTablesTab from "../Tabs/QueryTablesTab";
|
||||||
import SettingsTab from "../Tabs/SettingsTab";
|
import SettingsTab from "../Tabs/SettingsTab";
|
||||||
import ConflictId from "./ConflictId";
|
|
||||||
import DocumentId from "./DocumentId";
|
|
||||||
import StoredProcedure from "./StoredProcedure";
|
import StoredProcedure from "./StoredProcedure";
|
||||||
import Trigger from "./Trigger";
|
import Trigger from "./Trigger";
|
||||||
import UserDefinedFunction from "./UserDefinedFunction";
|
import UserDefinedFunction from "./UserDefinedFunction";
|
||||||
|
import { configContext } from "../../ConfigContext";
|
||||||
|
import Explorer from "../Explorer";
|
||||||
|
import {
|
||||||
|
createDocument,
|
||||||
|
readTriggers,
|
||||||
|
readUserDefinedFunctions,
|
||||||
|
readStoredProcedures,
|
||||||
|
readCollectionQuotaInfo,
|
||||||
|
readOffer,
|
||||||
|
readOffers
|
||||||
|
} from "../../Common/DocumentClientUtilityBase";
|
||||||
|
import { userContext } from "../../UserContext";
|
||||||
|
|
||||||
export default class Collection implements ViewModels.Collection {
|
export default class Collection implements ViewModels.Collection {
|
||||||
public nodeKind: string;
|
public nodeKind: string;
|
||||||
@@ -849,21 +854,21 @@ export default class Collection implements ViewModels.Collection {
|
|||||||
Trigger.create(source, event);
|
Trigger.create(source, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
public createStoredProcedureNode(data: StoredProcedureDefinition & Resource): StoredProcedure {
|
public createStoredProcedureNode(data: DataModels.StoredProcedure): StoredProcedure {
|
||||||
const node = new StoredProcedure(this.container, this, data);
|
const node = new StoredProcedure(this.container, this, data);
|
||||||
this.container.selectedNode(node);
|
this.container.selectedNode(node);
|
||||||
this.children.push(node);
|
this.children.push(node);
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
public createUserDefinedFunctionNode(data: UserDefinedFunctionDefinition & Resource): UserDefinedFunction {
|
public createUserDefinedFunctionNode(data: DataModels.UserDefinedFunction): UserDefinedFunction {
|
||||||
const node = new UserDefinedFunction(this.container, this, data);
|
const node = new UserDefinedFunction(this.container, this, data);
|
||||||
this.container.selectedNode(node);
|
this.container.selectedNode(node);
|
||||||
this.children.push(node);
|
this.children.push(node);
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
public createTriggerNode(data: TriggerDefinition & Resource): Trigger {
|
public createTriggerNode(data: DataModels.Trigger): Trigger {
|
||||||
const node = new Trigger(this.container, this, data);
|
const node = new Trigger(this.container, this, data);
|
||||||
this.container.selectedNode(node);
|
this.container.selectedNode(node);
|
||||||
this.children.push(node);
|
this.children.push(node);
|
||||||
@@ -1057,8 +1062,8 @@ export default class Collection implements ViewModels.Collection {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public loadStoredProcedures(): Promise<any> {
|
public loadStoredProcedures(): Q.Promise<any> {
|
||||||
return readStoredProcedures(this.databaseId, this.id()).then(storedProcedures => {
|
return readStoredProcedures(this).then((storedProcedures: DataModels.StoredProcedure[]) => {
|
||||||
const storedProceduresNodes: ViewModels.TreeNode[] = storedProcedures.map(
|
const storedProceduresNodes: ViewModels.TreeNode[] = storedProcedures.map(
|
||||||
storedProcedure => new StoredProcedure(this.container, this, storedProcedure)
|
storedProcedure => new StoredProcedure(this.container, this, storedProcedure)
|
||||||
);
|
);
|
||||||
@@ -1068,8 +1073,8 @@ export default class Collection implements ViewModels.Collection {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public loadUserDefinedFunctions(): Promise<any> {
|
public loadUserDefinedFunctions(): Q.Promise<any> {
|
||||||
return readUserDefinedFunctions(this.databaseId, this.id()).then(userDefinedFunctions => {
|
return readUserDefinedFunctions(this).then((userDefinedFunctions: DataModels.UserDefinedFunction[]) => {
|
||||||
const userDefinedFunctionsNodes: ViewModels.TreeNode[] = userDefinedFunctions.map(
|
const userDefinedFunctionsNodes: ViewModels.TreeNode[] = userDefinedFunctions.map(
|
||||||
udf => new UserDefinedFunction(this.container, this, udf)
|
udf => new UserDefinedFunction(this.container, this, udf)
|
||||||
);
|
);
|
||||||
@@ -1079,8 +1084,8 @@ export default class Collection implements ViewModels.Collection {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public loadTriggers(): Promise<any> {
|
public loadTriggers(): Q.Promise<any> {
|
||||||
return readTriggers(this.databaseId, this.id()).then(triggers => {
|
return readTriggers(this, null /*options*/).then((triggers: DataModels.Trigger[]) => {
|
||||||
const triggerNodes: ViewModels.TreeNode[] = triggers.map(trigger => new Trigger(this.container, this, trigger));
|
const triggerNodes: ViewModels.TreeNode[] = triggers.map(trigger => new Trigger(this.container, this, trigger));
|
||||||
const otherNodes = this.children().filter(node => node.nodeKind !== "Trigger");
|
const otherNodes = this.children().filter(node => node.nodeKind !== "Trigger");
|
||||||
const allNodes = otherNodes.concat(triggerNodes);
|
const allNodes = otherNodes.concat(triggerNodes);
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
import { Resource, StoredProcedureDefinition } from "@azure/cosmos";
|
|
||||||
import * as ko from "knockout";
|
import * as ko from "knockout";
|
||||||
import * as Constants from "../../Common/Constants";
|
|
||||||
import { deleteStoredProcedure } from "../../Common/dataAccess/deleteStoredProcedure";
|
|
||||||
import { executeStoredProcedure } from "../../Common/DocumentClientUtilityBase";
|
|
||||||
import * as ViewModels from "../../Contracts/ViewModels";
|
import * as ViewModels from "../../Contracts/ViewModels";
|
||||||
|
import * as Constants from "../../Common/Constants";
|
||||||
|
import * as DataModels from "../../Contracts/DataModels";
|
||||||
import { Action, ActionModifiers } from "../../Shared/Telemetry/TelemetryConstants";
|
import { Action, ActionModifiers } from "../../Shared/Telemetry/TelemetryConstants";
|
||||||
|
|
||||||
|
import StoredProcedureTab from "../Tabs/StoredProcedureTab";
|
||||||
import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
||||||
import Explorer from "../Explorer";
|
import Explorer from "../Explorer";
|
||||||
import StoredProcedureTab from "../Tabs/StoredProcedureTab";
|
import { deleteStoredProcedure, executeStoredProcedure } from "../../Common/DocumentClientUtilityBase";
|
||||||
import TabsBase from "../Tabs/TabsBase";
|
import TabsBase from "../Tabs/TabsBase";
|
||||||
|
|
||||||
const sampleStoredProcedureBody: string = `// SAMPLE STORED PROCEDURE
|
const sampleStoredProcedureBody: string = `// SAMPLE STORED PROCEDURE
|
||||||
@@ -47,20 +47,20 @@ export default class StoredProcedure {
|
|||||||
public body: ko.Observable<string>;
|
public body: ko.Observable<string>;
|
||||||
public isExecuteEnabled: boolean;
|
public isExecuteEnabled: boolean;
|
||||||
|
|
||||||
constructor(container: Explorer, collection: ViewModels.Collection, data: StoredProcedureDefinition & Resource) {
|
constructor(container: Explorer, collection: ViewModels.Collection, data: DataModels.StoredProcedure) {
|
||||||
this.nodeKind = "StoredProcedure";
|
this.nodeKind = "StoredProcedure";
|
||||||
this.container = container;
|
this.container = container;
|
||||||
this.collection = collection;
|
this.collection = collection;
|
||||||
this.self = data._self;
|
this.self = data._self;
|
||||||
this.rid = data._rid;
|
this.rid = data._rid;
|
||||||
this.id = ko.observable(data.id);
|
this.id = ko.observable(data.id);
|
||||||
this.body = ko.observable(data.body as string);
|
this.body = ko.observable(data.body);
|
||||||
this.isExecuteEnabled = this.container.isFeatureEnabled(Constants.Features.executeSproc);
|
this.isExecuteEnabled = this.container.isFeatureEnabled(Constants.Features.executeSproc);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static create(source: ViewModels.Collection, event: MouseEvent) {
|
public static create(source: ViewModels.Collection, event: MouseEvent) {
|
||||||
const id = source.container.tabsManager.getTabs(ViewModels.CollectionTabKind.StoredProcedures).length + 1;
|
const id = source.container.tabsManager.getTabs(ViewModels.CollectionTabKind.StoredProcedures).length + 1;
|
||||||
const storedProcedure = <StoredProcedureDefinition>{
|
const storedProcedure = <DataModels.StoredProcedure>{
|
||||||
id: "",
|
id: "",
|
||||||
body: sampleStoredProcedureBody
|
body: sampleStoredProcedureBody
|
||||||
};
|
};
|
||||||
@@ -104,7 +104,7 @@ export default class StoredProcedure {
|
|||||||
if (storedProcedureTab) {
|
if (storedProcedureTab) {
|
||||||
this.container.tabsManager.activateTab(storedProcedureTab);
|
this.container.tabsManager.activateTab(storedProcedureTab);
|
||||||
} else {
|
} else {
|
||||||
const storedProcedureData = <StoredProcedureDefinition>{
|
const storedProcedureData = <DataModels.StoredProcedure>{
|
||||||
_rid: this.rid,
|
_rid: this.rid,
|
||||||
_self: this.self,
|
_self: this.self,
|
||||||
id: this.id(),
|
id: this.id(),
|
||||||
@@ -137,7 +137,14 @@ export default class StoredProcedure {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteStoredProcedure(this.collection.databaseId, this.collection.id(), this.id()).then(
|
const storedProcedureData = <DataModels.StoredProcedure>{
|
||||||
|
_rid: this.rid,
|
||||||
|
_self: this.self,
|
||||||
|
id: this.id(),
|
||||||
|
body: this.body()
|
||||||
|
};
|
||||||
|
|
||||||
|
deleteStoredProcedure(this.collection, storedProcedureData).then(
|
||||||
() => {
|
() => {
|
||||||
this.container.tabsManager.removeTabByComparator((tab: TabsBase) => tab.node && tab.node.rid === this.rid);
|
this.container.tabsManager.removeTabByComparator((tab: TabsBase) => tab.node && tab.node.rid === this.rid);
|
||||||
this.collection.children.remove(this);
|
this.collection.children.remove(this);
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
import { StoredProcedureDefinition } from "@azure/cosmos";
|
|
||||||
import * as ko from "knockout";
|
import * as ko from "knockout";
|
||||||
import * as Constants from "../../Common/Constants";
|
|
||||||
import { deleteTrigger } from "../../Common/dataAccess/deleteTrigger";
|
|
||||||
import * as ViewModels from "../../Contracts/ViewModels";
|
import * as ViewModels from "../../Contracts/ViewModels";
|
||||||
|
import * as Constants from "../../Common/Constants";
|
||||||
|
import * as DataModels from "../../Contracts/DataModels";
|
||||||
import { Action, ActionModifiers } from "../../Shared/Telemetry/TelemetryConstants";
|
import { Action, ActionModifiers } from "../../Shared/Telemetry/TelemetryConstants";
|
||||||
|
import TriggerTab from "../Tabs/TriggerTab";
|
||||||
import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
||||||
import Explorer from "../Explorer";
|
import Explorer from "../Explorer";
|
||||||
import TriggerTab from "../Tabs/TriggerTab";
|
import { deleteTrigger } from "../../Common/DocumentClientUtilityBase";
|
||||||
|
|
||||||
export default class Trigger {
|
export default class Trigger {
|
||||||
public nodeKind: string;
|
public nodeKind: string;
|
||||||
@@ -43,7 +43,7 @@ export default class Trigger {
|
|||||||
|
|
||||||
public static create(source: ViewModels.Collection, event: MouseEvent) {
|
public static create(source: ViewModels.Collection, event: MouseEvent) {
|
||||||
const id = source.container.tabsManager.getTabs(ViewModels.CollectionTabKind.Triggers).length + 1;
|
const id = source.container.tabsManager.getTabs(ViewModels.CollectionTabKind.Triggers).length + 1;
|
||||||
const trigger = <StoredProcedureDefinition>{
|
const trigger = <DataModels.Trigger>{
|
||||||
id: "",
|
id: "",
|
||||||
body: "function trigger(){}",
|
body: "function trigger(){}",
|
||||||
triggerOperation: "All",
|
triggerOperation: "All",
|
||||||
@@ -79,7 +79,7 @@ export default class Trigger {
|
|||||||
if (triggerTab) {
|
if (triggerTab) {
|
||||||
this.container.tabsManager.activateTab(triggerTab);
|
this.container.tabsManager.activateTab(triggerTab);
|
||||||
} else {
|
} else {
|
||||||
const triggerData = <StoredProcedureDefinition>{
|
const triggerData = <DataModels.Trigger>{
|
||||||
_rid: this.rid,
|
_rid: this.rid,
|
||||||
_self: this.self,
|
_self: this.self,
|
||||||
id: this.id(),
|
id: this.id(),
|
||||||
@@ -114,7 +114,16 @@ export default class Trigger {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteTrigger(this.collection.databaseId, this.collection.id(), this.id()).then(
|
const triggerData = <DataModels.Trigger>{
|
||||||
|
_rid: this.rid,
|
||||||
|
_self: this.self,
|
||||||
|
id: this.id(),
|
||||||
|
body: this.body(),
|
||||||
|
triggerOperation: this.triggerOperation(),
|
||||||
|
triggerType: this.triggerType()
|
||||||
|
};
|
||||||
|
|
||||||
|
deleteTrigger(this.collection, triggerData).then(
|
||||||
() => {
|
() => {
|
||||||
this.container.tabsManager.removeTabByComparator(tab => tab.node && tab.node.rid === this.rid);
|
this.container.tabsManager.removeTabByComparator(tab => tab.node && tab.node.rid === this.rid);
|
||||||
this.collection.children.remove(this);
|
this.collection.children.remove(this);
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
import { Resource, UserDefinedFunctionDefinition } from "@azure/cosmos";
|
|
||||||
import * as ko from "knockout";
|
import * as ko from "knockout";
|
||||||
import * as Constants from "../../Common/Constants";
|
|
||||||
import { deleteUserDefinedFunction } from "../../Common/dataAccess/deleteUserDefinedFunction";
|
|
||||||
import * as ViewModels from "../../Contracts/ViewModels";
|
import * as ViewModels from "../../Contracts/ViewModels";
|
||||||
|
import * as Constants from "../../Common/Constants";
|
||||||
|
import * as DataModels from "../../Contracts/DataModels";
|
||||||
import { Action, ActionModifiers } from "../../Shared/Telemetry/TelemetryConstants";
|
import { Action, ActionModifiers } from "../../Shared/Telemetry/TelemetryConstants";
|
||||||
|
import UserDefinedFunctionTab from "../Tabs/UserDefinedFunctionTab";
|
||||||
import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
||||||
import Explorer from "../Explorer";
|
import Explorer from "../Explorer";
|
||||||
import UserDefinedFunctionTab from "../Tabs/UserDefinedFunctionTab";
|
import { deleteUserDefinedFunction } from "../../Common/DocumentClientUtilityBase";
|
||||||
|
|
||||||
export default class UserDefinedFunction {
|
export default class UserDefinedFunction {
|
||||||
public nodeKind: string;
|
public nodeKind: string;
|
||||||
@@ -17,7 +17,7 @@ export default class UserDefinedFunction {
|
|||||||
public id: ko.Observable<string>;
|
public id: ko.Observable<string>;
|
||||||
public body: ko.Observable<string>;
|
public body: ko.Observable<string>;
|
||||||
|
|
||||||
constructor(container: Explorer, collection: ViewModels.Collection, data: UserDefinedFunctionDefinition & Resource) {
|
constructor(container: Explorer, collection: ViewModels.Collection, data: DataModels.UserDefinedFunction) {
|
||||||
this.nodeKind = "UserDefinedFunction";
|
this.nodeKind = "UserDefinedFunction";
|
||||||
this.container = container;
|
this.container = container;
|
||||||
|
|
||||||
@@ -25,12 +25,12 @@ export default class UserDefinedFunction {
|
|||||||
this.self = data._self;
|
this.self = data._self;
|
||||||
this.rid = data._rid;
|
this.rid = data._rid;
|
||||||
this.id = ko.observable(data.id);
|
this.id = ko.observable(data.id);
|
||||||
this.body = ko.observable(data.body as string);
|
this.body = ko.observable(data.body);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static create(source: ViewModels.Collection, event: MouseEvent) {
|
public static create(source: ViewModels.Collection, event: MouseEvent) {
|
||||||
const id = source.container.tabsManager.getTabs(ViewModels.CollectionTabKind.UserDefinedFunctions).length + 1;
|
const id = source.container.tabsManager.getTabs(ViewModels.CollectionTabKind.UserDefinedFunctions).length + 1;
|
||||||
const userDefinedFunction = {
|
const userDefinedFunction = <DataModels.UserDefinedFunction>{
|
||||||
id: "",
|
id: "",
|
||||||
body: "function userDefinedFunction(){}"
|
body: "function userDefinedFunction(){}"
|
||||||
};
|
};
|
||||||
@@ -64,7 +64,7 @@ export default class UserDefinedFunction {
|
|||||||
if (userDefinedFunctionTab) {
|
if (userDefinedFunctionTab) {
|
||||||
this.container.tabsManager.activateTab(userDefinedFunctionTab);
|
this.container.tabsManager.activateTab(userDefinedFunctionTab);
|
||||||
} else {
|
} else {
|
||||||
const userDefinedFunctionData = {
|
const userDefinedFunctionData = <DataModels.UserDefinedFunction>{
|
||||||
_rid: this.rid,
|
_rid: this.rid,
|
||||||
_self: this.self,
|
_self: this.self,
|
||||||
id: this.id(),
|
id: this.id(),
|
||||||
@@ -107,7 +107,13 @@ export default class UserDefinedFunction {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteUserDefinedFunction(this.collection.databaseId, this.collection.id(), this.id()).then(
|
const userDefinedFunctionData = <DataModels.UserDefinedFunction>{
|
||||||
|
_rid: this.rid,
|
||||||
|
_self: this.self,
|
||||||
|
id: this.id(),
|
||||||
|
body: this.body()
|
||||||
|
};
|
||||||
|
deleteUserDefinedFunction(this.collection, userDefinedFunctionData).then(
|
||||||
() => {
|
() => {
|
||||||
this.container.tabsManager.removeTabByComparator(tab => tab.node && tab.node.rid === this.rid);
|
this.container.tabsManager.removeTabByComparator(tab => tab.node && tab.node.rid === this.rid);
|
||||||
this.collection.children.remove(this);
|
this.collection.children.remove(this);
|
||||||
|
|||||||
@@ -70,8 +70,7 @@ export enum Action {
|
|||||||
NotebooksGitHubManualRepoAdd,
|
NotebooksGitHubManualRepoAdd,
|
||||||
NotebooksGitHubManageRepo,
|
NotebooksGitHubManageRepo,
|
||||||
NotebooksGitHubCommit,
|
NotebooksGitHubCommit,
|
||||||
NotebooksGitHubDisconnect,
|
NotebooksGitHubDisconnect
|
||||||
OpenTerminal
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const ActionModifiers = {
|
export const ActionModifiers = {
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ export function trace(action: Action, actionModifier: string = ActionModifiers.M
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
appInsights.trackEvent({ name: Action[action] }, getData(actionModifier, data));
|
appInsights.trackEvent({ name: Action[action] }, getData(data));
|
||||||
}
|
}
|
||||||
|
|
||||||
export function traceStart(action: Action, data?: unknown): number {
|
export function traceStart(action: Action, data?: unknown): number {
|
||||||
@@ -49,7 +49,7 @@ export function traceSuccess(action: Action, data?: unknown, timestamp?: number)
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
appInsights.stopTrackEvent(Action[action], getData(ActionModifiers.Success, data));
|
appInsights.stopTrackEvent(Action[action], getData(data));
|
||||||
}
|
}
|
||||||
|
|
||||||
export function traceFailure(action: Action, data?: unknown, timestamp?: number): void {
|
export function traceFailure(action: Action, data?: unknown, timestamp?: number): void {
|
||||||
@@ -63,7 +63,7 @@ export function traceFailure(action: Action, data?: unknown, timestamp?: number)
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
appInsights.stopTrackEvent(Action[action], getData(ActionModifiers.Failed, data));
|
appInsights.stopTrackEvent(Action[action], getData(data));
|
||||||
}
|
}
|
||||||
|
|
||||||
export function traceCancel(action: Action, data?: unknown, timestamp?: number): void {
|
export function traceCancel(action: Action, data?: unknown, timestamp?: number): void {
|
||||||
@@ -77,7 +77,7 @@ export function traceCancel(action: Action, data?: unknown, timestamp?: number):
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
appInsights.stopTrackEvent(Action[action], getData(ActionModifiers.Cancel, data));
|
appInsights.stopTrackEvent(Action[action], getData(data));
|
||||||
}
|
}
|
||||||
|
|
||||||
export function traceOpen(action: Action, data?: unknown, timestamp?: number): number {
|
export function traceOpen(action: Action, data?: unknown, timestamp?: number): number {
|
||||||
@@ -112,7 +112,7 @@ export function traceMark(action: Action, data?: unknown, timestamp?: number): n
|
|||||||
return validTimestamp;
|
return validTimestamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getData(actionModifier: string, data: unknown = {}): { [key: string]: string } | undefined {
|
function getData(data: unknown = {}): { [key: string]: string } | undefined {
|
||||||
if (typeof data === "string") {
|
if (typeof data === "string") {
|
||||||
data = { message: data };
|
data = { message: data };
|
||||||
}
|
}
|
||||||
@@ -124,7 +124,6 @@ function getData(actionModifier: string, data: unknown = {}): { [key: string]: s
|
|||||||
subscriptionId: userContext.subscriptionId as string,
|
subscriptionId: userContext.subscriptionId as string,
|
||||||
platform: configContext.platform,
|
platform: configContext.platform,
|
||||||
env: process.env.NODE_ENV as string,
|
env: process.env.NODE_ENV as string,
|
||||||
actionModifier,
|
|
||||||
...data
|
...data
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,8 @@ import { ApplicationInsights } from "@microsoft/applicationinsights-web";
|
|||||||
|
|
||||||
const appInsights = new ApplicationInsights({
|
const appInsights = new ApplicationInsights({
|
||||||
config: {
|
config: {
|
||||||
instrumentationKey: "fa645d97-6237-4656-9559-0ee0cb55ee49"
|
instrumentationKey: "fa645d97-6237-4656-9559-0ee0cb55ee49",
|
||||||
|
disableFetchTracking: false
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
appInsights.loadAppInsights();
|
appInsights.loadAppInsights();
|
||||||
|
|||||||
@@ -4,8 +4,6 @@ import "@jupyterlab/terminal/style/index.css";
|
|||||||
import "./index.css";
|
import "./index.css";
|
||||||
import { ServerConnection } from "@jupyterlab/services";
|
import { ServerConnection } from "@jupyterlab/services";
|
||||||
import { JupyterLabAppFactory } from "./JupyterLabAppFactory";
|
import { JupyterLabAppFactory } from "./JupyterLabAppFactory";
|
||||||
import { Action } from "../Shared/Telemetry/TelemetryConstants";
|
|
||||||
import * as TelemetryProcessor from "../Shared/Telemetry/TelemetryProcessor";
|
|
||||||
|
|
||||||
const getUrlVars = (): { [key: string]: string } => {
|
const getUrlVars = (): { [key: string]: string } => {
|
||||||
const vars: { [key: string]: string } = {};
|
const vars: { [key: string]: string } = {};
|
||||||
@@ -16,7 +14,10 @@ const getUrlVars = (): { [key: string]: string } => {
|
|||||||
return vars;
|
return vars;
|
||||||
};
|
};
|
||||||
|
|
||||||
const createServerSettings = (urlVars: { [key: string]: string }): ServerConnection.ISettings => {
|
const main = (): void => {
|
||||||
|
const urlVars = getUrlVars();
|
||||||
|
console.log("URL parameters", urlVars);
|
||||||
|
|
||||||
let body: BodyInit;
|
let body: BodyInit;
|
||||||
if (urlVars.hasOwnProperty("terminalEndpoint")) {
|
if (urlVars.hasOwnProperty("terminalEndpoint")) {
|
||||||
body = JSON.stringify({
|
body = JSON.stringify({
|
||||||
@@ -38,29 +39,14 @@ const createServerSettings = (urlVars: { [key: string]: string }): ServerConnect
|
|||||||
fetch: window.parent.fetch
|
fetch: window.parent.fetch
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
const serverSettings = ServerConnection.makeSettings(options);
|
||||||
|
|
||||||
return ServerConnection.makeSettings(options);
|
if (urlVars.hasOwnProperty("terminal")) {
|
||||||
};
|
JupyterLabAppFactory.createTerminalApp(serverSettings);
|
||||||
|
return;
|
||||||
const main = async (): Promise<void> => {
|
|
||||||
const urlVars = getUrlVars();
|
|
||||||
const serverSettings = createServerSettings(urlVars);
|
|
||||||
|
|
||||||
const startTime = TelemetryProcessor.traceStart(Action.OpenTerminal, {
|
|
||||||
baseUrl: serverSettings.baseUrl
|
|
||||||
});
|
|
||||||
|
|
||||||
try {
|
|
||||||
if (urlVars.hasOwnProperty("terminal")) {
|
|
||||||
await JupyterLabAppFactory.createTerminalApp(serverSettings);
|
|
||||||
} else {
|
|
||||||
throw new Error("Only terminal is supported");
|
|
||||||
}
|
|
||||||
|
|
||||||
TelemetryProcessor.traceSuccess(Action.OpenTerminal, startTime);
|
|
||||||
} catch (error) {
|
|
||||||
TelemetryProcessor.traceFailure(Action.OpenTerminal, startTime);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
throw new Error("Only terminal is supported");
|
||||||
};
|
};
|
||||||
|
|
||||||
window.addEventListener("load", main);
|
window.addEventListener("load", main);
|
||||||
|
|||||||
@@ -1,17 +0,0 @@
|
|||||||
export const stringToBlob = (data: string, contentType: string, sliceSize = 512): Blob => {
|
|
||||||
const byteArrays = [];
|
|
||||||
|
|
||||||
for (let offset = 0; offset < data.length; offset += sliceSize) {
|
|
||||||
const slice = data.slice(offset, offset + sliceSize);
|
|
||||||
|
|
||||||
const byteNumbers = new Array(slice.length);
|
|
||||||
for (let i = 0; i < slice.length; i++) {
|
|
||||||
byteNumbers[i] = slice.charCodeAt(i);
|
|
||||||
}
|
|
||||||
|
|
||||||
const byteArray = new Uint8Array(byteNumbers);
|
|
||||||
byteArrays.push(byteArray);
|
|
||||||
}
|
|
||||||
|
|
||||||
return new Blob(byteArrays, { type: contentType });
|
|
||||||
};
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
import { isInvalidParentFrameOrigin } from "./MessageValidation";
|
|
||||||
|
|
||||||
test.each`
|
|
||||||
domain | expected
|
|
||||||
${"https://cosmos.azure.com"} | ${false}
|
|
||||||
${"https://cosmos.azure.us"} | ${false}
|
|
||||||
${"https://cosmos.azure.cn"} | ${false}
|
|
||||||
${"https://cosmos.microsoftazure.de"} | ${false}
|
|
||||||
${"https://subdomain.portal.azure.com"} | ${false}
|
|
||||||
${"https://subdomain.portal.azure.us"} | ${false}
|
|
||||||
${"https://subdomain.portal.azure.cn"} | ${false}
|
|
||||||
${"https://subdomain.microsoftazure.de"} | ${false}
|
|
||||||
${"https://main.documentdb.ext.azure.com"} | ${false}
|
|
||||||
${"https://main.documentdb.ext.azure.us"} | ${false}
|
|
||||||
${"https://main.documentdb.ext.azure.cn"} | ${false}
|
|
||||||
${"https://main.documentdb.ext.microsoftazure.de"} | ${false}
|
|
||||||
${"https://random.domain"} | ${true}
|
|
||||||
${"https://malicious.cloudapp.azure.com"} | ${true}
|
|
||||||
`("returns $expected when called with $domain", ({ domain, expected }) => {
|
|
||||||
expect(isInvalidParentFrameOrigin({ origin: domain } as MessageEvent)).toBe(expected);
|
|
||||||
});
|
|
||||||
@@ -4,18 +4,13 @@ export function isInvalidParentFrameOrigin(event: MessageEvent): boolean {
|
|||||||
return !isValidOrigin(configContext.allowedParentFrameOrigins, event);
|
return !isValidOrigin(configContext.allowedParentFrameOrigins, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
function isValidOrigin(allowedOrigins: string[], event: MessageEvent): boolean {
|
function isValidOrigin(allowedOrigins: RegExp, event: MessageEvent): boolean {
|
||||||
const eventOrigin = (event && event.origin) || "";
|
const eventOrigin = (event && event.origin) || "";
|
||||||
const windowOrigin = (window && window.origin) || "";
|
const windowOrigin = (window && window.origin) || "";
|
||||||
if (eventOrigin === windowOrigin) {
|
if (eventOrigin === windowOrigin) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const origin of allowedOrigins) {
|
const result = allowedOrigins && allowedOrigins.test(eventOrigin);
|
||||||
const result = new RegExp(origin).test(eventOrigin);
|
return result;
|
||||||
if (result) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user