Update to ADO 5ed9b2130da7f822153531489d802c28986f5d30
This commit is contained in:
parent
36581fb6d9
commit
0494da4162
|
@ -13060,80 +13060,110 @@
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"office-ui-fabric-react": {
|
"office-ui-fabric-react": {
|
||||||
"version": "6.210.5",
|
"version": "7.115.0",
|
||||||
"resolved": "https://registry.npmjs.org/office-ui-fabric-react/-/office-ui-fabric-react-6.210.5.tgz",
|
"resolved": "https://registry.npmjs.org/office-ui-fabric-react/-/office-ui-fabric-react-7.115.0.tgz",
|
||||||
"integrity": "sha512-kq2nLG20qwxez5N8QdrEs5eFJwpKa/V1qemob9cqAUrioxR29GAlqAHRFSjg+U6UYEm6ypUBS0cF1235jwspWw==",
|
"integrity": "sha512-FZG5SM9ZHI+gTiJsW7RRpEVQReasCNni25BpsLY+sjvdn3jTpeXOYFXDmfV8yiUDetLvDBTf5O0b0intWCOCqw==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@microsoft/load-themed-styles": "^1.7.13",
|
"@fluentui/react-focus": "^7.11.7",
|
||||||
"@uifabric/foundation": "^0.8.3",
|
"@fluentui/react-icons": "^0.1.18",
|
||||||
"@uifabric/icons": "^6.5.5",
|
"@microsoft/load-themed-styles": "^1.10.26",
|
||||||
"@uifabric/merge-styles": "^6.19.4",
|
"@uifabric/foundation": "^7.7.16",
|
||||||
"@uifabric/set-version": "^1.1.3",
|
"@uifabric/icons": "^7.3.42",
|
||||||
"@uifabric/styling": "^6.50.7",
|
"@uifabric/merge-styles": "^7.14.0",
|
||||||
"@uifabric/utilities": "^6.45.1",
|
"@uifabric/react-hooks": "^7.3.7",
|
||||||
"prop-types": "^15.5.10",
|
"@uifabric/set-version": "^7.0.12",
|
||||||
"tslib": "^1.7.1"
|
"@uifabric/styling": "^7.12.9",
|
||||||
|
"@uifabric/utilities": "^7.17.3",
|
||||||
|
"prop-types": "^15.7.2",
|
||||||
|
"tslib": "^1.10.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@uifabric/foundation": {
|
"@fluentui/react-focus": {
|
||||||
"version": "0.8.3",
|
"version": "7.11.7",
|
||||||
"resolved": "https://registry.npmjs.org/@uifabric/foundation/-/foundation-0.8.3.tgz",
|
"resolved": "https://registry.npmjs.org/@fluentui/react-focus/-/react-focus-7.11.7.tgz",
|
||||||
"integrity": "sha512-r3WhRj7Out8QAOe50BGA36R8zgRPy0D0GNPuwFK9BB9oIidf91ycj7/miY8U0TZRZi5fB3Kg+dy/uxSDfgC6Og==",
|
"integrity": "sha512-EHPwScf8k4Rlzki6M7cWA09D80rZiN7E0tZmh6yoZVvdPY0AcrnUTLy0lWIVRk/1oAt7Ko4Yhss7aaYX7jqNXQ==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@uifabric/set-version": "^1.1.3",
|
"@fluentui/keyboard-key": "^0.2.0",
|
||||||
"@uifabric/styling": "^6.50.7",
|
"@uifabric/merge-styles": "^7.14.0",
|
||||||
"@uifabric/utilities": "^6.41.7",
|
"@uifabric/set-version": "^7.0.12",
|
||||||
"tslib": "^1.7.1"
|
"@uifabric/styling": "^7.12.9",
|
||||||
|
"@uifabric/utilities": "^7.17.3",
|
||||||
|
"tslib": "^1.10.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"@fluentui/react-icons": {
|
||||||
|
"version": "0.1.18",
|
||||||
|
"resolved": "https://registry.npmjs.org/@fluentui/react-icons/-/react-icons-0.1.18.tgz",
|
||||||
|
"integrity": "sha512-63u5sO568nI4ORgwewqKynB+M+NkGQys1F8EDkW/wYcF24uNuAQUID4JIBvIbB57M10YDDYHCqXYB8RTJy1Cww==",
|
||||||
|
"requires": {
|
||||||
|
"@uifabric/set-version": "^7.0.12",
|
||||||
|
"@uifabric/styling": "^7.12.9",
|
||||||
|
"@uifabric/utilities": "^7.17.3",
|
||||||
|
"tslib": "^1.10.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"@uifabric/foundation": {
|
||||||
|
"version": "7.7.16",
|
||||||
|
"resolved": "https://registry.npmjs.org/@uifabric/foundation/-/foundation-7.7.16.tgz",
|
||||||
|
"integrity": "sha512-9ED+nyAmfBcLbL5LuVDoSSxGxexGs11fCsDyVoPoJ4Er2qmSIH30STe/+AwFHq3nEBD1ztiHDIVcKfLf4GT7VQ==",
|
||||||
|
"requires": {
|
||||||
|
"@uifabric/merge-styles": "^7.14.0",
|
||||||
|
"@uifabric/set-version": "^7.0.12",
|
||||||
|
"@uifabric/styling": "^7.12.9",
|
||||||
|
"@uifabric/utilities": "^7.17.3",
|
||||||
|
"tslib": "^1.10.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@uifabric/icons": {
|
"@uifabric/icons": {
|
||||||
"version": "6.5.5",
|
"version": "7.3.42",
|
||||||
"resolved": "https://registry.npmjs.org/@uifabric/icons/-/icons-6.5.5.tgz",
|
"resolved": "https://registry.npmjs.org/@uifabric/icons/-/icons-7.3.42.tgz",
|
||||||
"integrity": "sha512-cGjzdpT0jzQ2RJvzlCVTrewaHCi4rb+ZNL2LWoceMi+5h196Y32qJwKMsc0ggR6u5CjMrzBiAxUFNppBSCutdA==",
|
"integrity": "sha512-RWGXdOBWaEjIqtOc4y/xwp3Cgc0gmU5ApBXw8AipjdwJyEPuV2UGjtk4URs0Iog42WoUxDfDKnRrH4dAjGV34g==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@uifabric/set-version": "^1.1.3",
|
"@uifabric/set-version": "^7.0.12",
|
||||||
"@uifabric/styling": "^6.50.7",
|
"@uifabric/styling": "^7.12.9",
|
||||||
"tslib": "^1.7.1"
|
"tslib": "^1.10.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@uifabric/merge-styles": {
|
"@uifabric/merge-styles": {
|
||||||
"version": "6.19.4",
|
"version": "7.14.0",
|
||||||
"resolved": "https://registry.npmjs.org/@uifabric/merge-styles/-/merge-styles-6.19.4.tgz",
|
"resolved": "https://registry.npmjs.org/@uifabric/merge-styles/-/merge-styles-7.14.0.tgz",
|
||||||
"integrity": "sha512-bjQdDHxmRIZVPwL//MtErODhEfcRJ2y+zJXoIWNh3T8JfAepeRDdoJ/pGNnnyJxA/AHMtlWt0IgMaz150/nfAA==",
|
"integrity": "sha512-LR70l856QTVYfceUA1HtHws0iFUQI3pN1Z2fyH2M1RPeBA35NimpaGkEaNSPHsCAiJ09evVsG6JP7iTUItWHUQ==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@uifabric/set-version": "^1.1.3",
|
"@uifabric/set-version": "^7.0.12",
|
||||||
"tslib": "^1.7.1"
|
"tslib": "^1.10.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@uifabric/set-version": {
|
"@uifabric/react-hooks": {
|
||||||
"version": "1.1.3",
|
"version": "7.3.7",
|
||||||
"resolved": "https://registry.npmjs.org/@uifabric/set-version/-/set-version-1.1.3.tgz",
|
"resolved": "https://registry.npmjs.org/@uifabric/react-hooks/-/react-hooks-7.3.7.tgz",
|
||||||
"integrity": "sha512-IYpwVIuN7MJOeiWzZzr9AmFSvA5zc6gJn4fNHtEFIQnNB8WVWIcYrvx8Tbf7wWj9MvhdHYp70F054zZlHbL/Ag==",
|
"integrity": "sha512-hNMma78ewtM4adwpVS+nFKvJpZ9blYz5AuNFjUfsn85YmutmfJ2BuV//SWnELKgX+ahASZSdSIwJLVYXHwYrKw==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"tslib": "^1.7.1"
|
"@uifabric/set-version": "^7.0.12",
|
||||||
|
"@uifabric/utilities": "^7.17.3",
|
||||||
|
"tslib": "^1.10.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@uifabric/styling": {
|
"@uifabric/styling": {
|
||||||
"version": "6.50.7",
|
"version": "7.12.9",
|
||||||
"resolved": "https://registry.npmjs.org/@uifabric/styling/-/styling-6.50.7.tgz",
|
"resolved": "https://registry.npmjs.org/@uifabric/styling/-/styling-7.12.9.tgz",
|
||||||
"integrity": "sha512-F2aBiB30ZiFxlZzy5hzLXODWOl6jySvPFAsoaTofk37xucHiunBLZYjX6WkfZrCWiyGPva+DLssNcwly9ZHVjg==",
|
"integrity": "sha512-eImcC3YiLoCp6RaxtQLqcRSj5ErcI/96+nvGlR+7F+KZ0aAj4vWDCCU5cUd5UI+wL11yCREN7DnWTQWpP98I7Q==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@microsoft/load-themed-styles": "^1.7.13",
|
"@microsoft/load-themed-styles": "^1.10.26",
|
||||||
"@uifabric/merge-styles": "^6.19.4",
|
"@uifabric/merge-styles": "^7.14.0",
|
||||||
"@uifabric/set-version": "^1.1.3",
|
"@uifabric/set-version": "^7.0.12",
|
||||||
"@uifabric/utilities": "^6.41.7",
|
"@uifabric/utilities": "^7.17.3",
|
||||||
"tslib": "^1.7.1"
|
"tslib": "^1.10.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@uifabric/utilities": {
|
"@uifabric/utilities": {
|
||||||
"version": "6.45.2",
|
"version": "7.17.3",
|
||||||
"resolved": "https://registry.npmjs.org/@uifabric/utilities/-/utilities-6.45.2.tgz",
|
"resolved": "https://registry.npmjs.org/@uifabric/utilities/-/utilities-7.17.3.tgz",
|
||||||
"integrity": "sha512-JiC92OjMOkVoiIAeS2b3R9B1XQU0cJ5bDr9B7VvrxlwKe1W9xMtVsCer7b8gNCU5NFNYBN5ckM3Q7x2Zs5cH0A==",
|
"integrity": "sha512-NeLL6Bsg7F/1BMYrg/dcnxm7LjwPm9OSg14aK/YI60iBSO6QQpPJ6UrSTflVh6JKBAAA26kTR9/3fJiLxO+2PA==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@uifabric/merge-styles": "^6.19.4",
|
"@uifabric/merge-styles": "^7.14.0",
|
||||||
"@uifabric/set-version": "^1.1.3",
|
"@uifabric/set-version": "^7.0.12",
|
||||||
"prop-types": "^15.5.10",
|
"prop-types": "^15.7.2",
|
||||||
"tslib": "^1.7.1"
|
"tslib": "^1.10.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,7 @@
|
||||||
"knockout": "3.5.1",
|
"knockout": "3.5.1",
|
||||||
"monaco-editor": "0.15.6",
|
"monaco-editor": "0.15.6",
|
||||||
"object.entries": "1.1.0",
|
"object.entries": "1.1.0",
|
||||||
"office-ui-fabric-react": "6.210.5",
|
"office-ui-fabric-react": "7.115.0",
|
||||||
"plotly.js-cartesian-dist-min": "1.52.3",
|
"plotly.js-cartesian-dist-min": "1.52.3",
|
||||||
"promise-polyfill": "8.1.0",
|
"promise-polyfill": "8.1.0",
|
||||||
"promise.prototype.finally": "3.1.0",
|
"promise.prototype.finally": "3.1.0",
|
||||||
|
|
|
@ -41,7 +41,7 @@ export class ArmApiVersions {
|
||||||
public static readonly arcadiaLivy: string = "2019-11-01-preview";
|
public static readonly arcadiaLivy: string = "2019-11-01-preview";
|
||||||
public static readonly arm: string = "2015-11-01";
|
public static readonly arm: string = "2015-11-01";
|
||||||
public static readonly armFeatures: string = "2014-08-01-preview";
|
public static readonly armFeatures: string = "2014-08-01-preview";
|
||||||
public static readonly publicVersion = "2020-03-01";
|
public static readonly publicVersion = "2020-04-01";
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ArmResourceTypes {
|
export class ArmResourceTypes {
|
||||||
|
@ -334,11 +334,13 @@ export class HttpHeaders {
|
||||||
public static populateCollectionThroughputInfo = "x-ms-documentdb-populatecollectionthroughputinfo";
|
public static populateCollectionThroughputInfo = "x-ms-documentdb-populatecollectionthroughputinfo";
|
||||||
public static supportSpatialLegacyCoordinates = "x-ms-documentdb-supportspatiallegacycoordinates";
|
public static supportSpatialLegacyCoordinates = "x-ms-documentdb-supportspatiallegacycoordinates";
|
||||||
public static usePolygonsSmallerThanAHemisphere = "x-ms-documentdb-usepolygonssmallerthanahemisphere";
|
public static usePolygonsSmallerThanAHemisphere = "x-ms-documentdb-usepolygonssmallerthanahemisphere";
|
||||||
public static autoPilotThroughput = "ProvisionedThroughputSettings";
|
public static autoPilotThroughput = "autoscaleSettings";
|
||||||
|
public static autoPilotThroughputSDK = "x-ms-cosmos-offer-autopilot-settings";
|
||||||
public static autoPilotTier = "x-ms-cosmos-offer-autopilot-tier";
|
public static autoPilotTier = "x-ms-cosmos-offer-autopilot-tier";
|
||||||
public static partitionKey: string = "x-ms-documentdb-partitionkey";
|
public static partitionKey: string = "x-ms-documentdb-partitionkey";
|
||||||
public static migrateOfferToManualThroughput: string = "x-ms-cosmos-migrate-offer-to-manual-throughput";
|
public static migrateOfferToManualThroughput: string = "x-ms-cosmos-migrate-offer-to-manual-throughput";
|
||||||
public static migrateOfferToAutopilot: string = "x-ms-cosmos-migrate-offer-to-autopilot";
|
public static migrateOfferToAutopilot: string = "x-ms-cosmos-migrate-offer-to-autopilot";
|
||||||
|
public static mongoFixedCollectionWithSharedThroughput: string = "InsertSystemPartitionKey";
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ApiType {
|
export class ApiType {
|
||||||
|
|
|
@ -544,7 +544,7 @@ export abstract class DataAccessUtilityBase {
|
||||||
const initialHeaders = request.autoPilot
|
const initialHeaders = request.autoPilot
|
||||||
? !hasAutoPilotV2FeatureFlag
|
? !hasAutoPilotV2FeatureFlag
|
||||||
? {
|
? {
|
||||||
[Constants.HttpHeaders.autoPilotThroughput]: JSON.stringify({
|
[Constants.HttpHeaders.autoPilotThroughputSDK]: JSON.stringify({
|
||||||
maxThroughput: request.autoPilot.maxThroughput
|
maxThroughput: request.autoPilot.maxThroughput
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -654,7 +654,7 @@ export abstract class DataAccessUtilityBase {
|
||||||
const initialHeaders = autoPilot
|
const initialHeaders = autoPilot
|
||||||
? !hasAutoPilotV2FeatureFlag
|
? !hasAutoPilotV2FeatureFlag
|
||||||
? {
|
? {
|
||||||
[Constants.HttpHeaders.autoPilotThroughput]: JSON.stringify({ maxThroughput: autoPilot.maxThroughput })
|
[Constants.HttpHeaders.autoPilotThroughputSDK]: JSON.stringify({ maxThroughput: autoPilot.maxThroughput })
|
||||||
}
|
}
|
||||||
: {
|
: {
|
||||||
[Constants.HttpHeaders.autoPilotTier]: autoPilot.autopilotTier
|
[Constants.HttpHeaders.autoPilotTier]: autoPilot.autopilotTier
|
||||||
|
|
|
@ -259,15 +259,19 @@ describe("MongoProxyClient", () => {
|
||||||
sid: "a2",
|
sid: "a2",
|
||||||
rg: "c1",
|
rg: "c1",
|
||||||
dba: "main",
|
dba: "main",
|
||||||
is: false
|
is: false,
|
||||||
|
isFixedCollectionWithSharedThroughputBeingCreated: true
|
||||||
};
|
};
|
||||||
_createMongoCollectionWithARM("management.azure.com", properties, { "x-ms-cosmos-offer-autopilot-tier": "1" });
|
_createMongoCollectionWithARM("management.azure.com", properties, { "x-ms-cosmos-offer-autopilot-tier": "1" });
|
||||||
expect(
|
expect(resourceProviderClientPutAsyncSpy).toHaveBeenCalledWith(
|
||||||
resourceProviderClientPutAsyncSpy
|
|
||||||
).toHaveBeenCalledWith(
|
|
||||||
"subscriptions/a2/resourceGroups/c1/providers/Microsoft.DocumentDB/databaseAccounts/foo/mongodbDatabases/a1-db/collections/abc-collection",
|
"subscriptions/a2/resourceGroups/c1/providers/Microsoft.DocumentDB/databaseAccounts/foo/mongodbDatabases/a1-db/collections/abc-collection",
|
||||||
"2020-03-01",
|
"2020-04-01",
|
||||||
{ properties: { options: { "x-ms-cosmos-offer-autopilot-tier": "1" }, resource: { id: "abc-collection" } } }
|
{
|
||||||
|
properties: {
|
||||||
|
options: { "x-ms-cosmos-offer-autopilot-tier": "1", InsertSystemPartitionKey: "true" },
|
||||||
|
resource: { id: "abc-collection" }
|
||||||
|
}
|
||||||
|
}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
it("should create a collection with provisioned throughput when provisioned throughput is selected + shared throughput is false", () => {
|
it("should create a collection with provisioned throughput when provisioned throughput is selected + shared throughput is false", () => {
|
||||||
|
@ -282,15 +286,19 @@ describe("MongoProxyClient", () => {
|
||||||
rg: "c1",
|
rg: "c1",
|
||||||
dba: "main",
|
dba: "main",
|
||||||
is: false,
|
is: false,
|
||||||
offerThroughput: 400
|
offerThroughput: 400,
|
||||||
|
isFixedCollectionWithSharedThroughputBeingCreated: true
|
||||||
};
|
};
|
||||||
_createMongoCollectionWithARM("management.azure.com", properties, undefined);
|
_createMongoCollectionWithARM("management.azure.com", properties, undefined);
|
||||||
expect(
|
expect(resourceProviderClientPutAsyncSpy).toHaveBeenCalledWith(
|
||||||
resourceProviderClientPutAsyncSpy
|
|
||||||
).toHaveBeenCalledWith(
|
|
||||||
"subscriptions/a2/resourceGroups/c1/providers/Microsoft.DocumentDB/databaseAccounts/foo/mongodbDatabases/a1-db/collections/abc-collection",
|
"subscriptions/a2/resourceGroups/c1/providers/Microsoft.DocumentDB/databaseAccounts/foo/mongodbDatabases/a1-db/collections/abc-collection",
|
||||||
"2020-03-01",
|
"2020-04-01",
|
||||||
{ properties: { options: { throughput: "400" }, resource: { id: "abc-collection" } } }
|
{
|
||||||
|
properties: {
|
||||||
|
options: { throughput: "400", InsertSystemPartitionKey: "true" },
|
||||||
|
resource: { id: "abc-collection" }
|
||||||
|
}
|
||||||
|
}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -356,6 +356,7 @@ export function createMongoCollectionWithARM(
|
||||||
armEndpoint: string,
|
armEndpoint: string,
|
||||||
databaseId: string,
|
databaseId: string,
|
||||||
analyticalStorageTtl: number,
|
analyticalStorageTtl: number,
|
||||||
|
isFixedCollectionWithSharedThroughputBeingCreated: boolean,
|
||||||
collectionId: string,
|
collectionId: string,
|
||||||
offerThroughput: number,
|
offerThroughput: number,
|
||||||
shardKey: string,
|
shardKey: string,
|
||||||
|
@ -379,7 +380,8 @@ export function createMongoCollectionWithARM(
|
||||||
sid: CosmosClient.subscriptionId(),
|
sid: CosmosClient.subscriptionId(),
|
||||||
rg: CosmosClient.resourceGroup(),
|
rg: CosmosClient.resourceGroup(),
|
||||||
dba: databaseAccount.name,
|
dba: databaseAccount.name,
|
||||||
analyticalStorageTtl
|
analyticalStorageTtl,
|
||||||
|
isFixedCollectionWithSharedThroughputBeingCreated
|
||||||
};
|
};
|
||||||
|
|
||||||
if (createDatabase) {
|
if (createDatabase) {
|
||||||
|
@ -451,6 +453,11 @@ export async function _createMongoCollectionWithARM(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (params.isFixedCollectionWithSharedThroughputBeingCreated) {
|
||||||
|
rpPayloadToCreateCollection.properties.options[Constants.HttpHeaders.mongoFixedCollectionWithSharedThroughput] =
|
||||||
|
"true";
|
||||||
|
}
|
||||||
|
|
||||||
if (params.analyticalStorageTtl) {
|
if (params.analyticalStorageTtl) {
|
||||||
rpPayloadToCreateCollection.properties.resource.analyticalStorageTtl = params.analyticalStorageTtl;
|
rpPayloadToCreateCollection.properties.resource.analyticalStorageTtl = params.analyticalStorageTtl;
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@ interface Config {
|
||||||
// Default configuration
|
// Default configuration
|
||||||
let config: Config = {
|
let config: Config = {
|
||||||
platform: Platform.Portal,
|
platform: Platform.Portal,
|
||||||
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$/,
|
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$/,
|
||||||
// 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/",
|
||||||
|
|
|
@ -301,6 +301,7 @@ export enum AutopilotTier {
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface RpOptions {
|
export interface RpOptions {
|
||||||
|
// tier is sent as string, autoscale as object (AutoPilotCreationSettings)
|
||||||
[key: string]: string | AutoPilotCreationSettings;
|
[key: string]: string | AutoPilotCreationSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -546,6 +547,7 @@ export interface MongoParameters extends RpParameters {
|
||||||
autoPilotTier?: string;
|
autoPilotTier?: string;
|
||||||
autoPilotThroughput?: string;
|
autoPilotThroughput?: string;
|
||||||
analyticalStorageTtl?: number;
|
analyticalStorageTtl?: number;
|
||||||
|
isFixedCollectionWithSharedThroughputBeingCreated?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GraphParameters extends RpParameters {
|
export interface GraphParameters extends RpParameters {
|
||||||
|
|
|
@ -77,6 +77,7 @@ export interface Explorer {
|
||||||
|
|
||||||
isAccountReady: ko.Observable<boolean>;
|
isAccountReady: ko.Observable<boolean>;
|
||||||
|
|
||||||
|
collectionCreationDefaults: CollectionCreationDefaults;
|
||||||
isEmulator: boolean;
|
isEmulator: boolean;
|
||||||
features: ko.Observable<any>;
|
features: ko.Observable<any>;
|
||||||
serverId: ko.Observable<string>;
|
serverId: ko.Observable<string>;
|
||||||
|
@ -1257,6 +1258,26 @@ export interface DataExplorerInputsFrame {
|
||||||
sharedThroughputDefault?: number;
|
sharedThroughputDefault?: number;
|
||||||
dataExplorerVersion?: string;
|
dataExplorerVersion?: string;
|
||||||
isAuthWithresourceToken?: boolean;
|
isAuthWithresourceToken?: boolean;
|
||||||
|
defaultCollectionThroughput?: CollectionCreationDefaults;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CollectionCreationDefaults {
|
||||||
|
storage: string;
|
||||||
|
throughput: ThroughputDefaults;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ThroughputDefaults {
|
||||||
|
fixed: number;
|
||||||
|
unlimited:
|
||||||
|
| number
|
||||||
|
| {
|
||||||
|
collectionThreshold: number;
|
||||||
|
lessThanOrEqualToThreshold: number;
|
||||||
|
greatThanThreshold: number;
|
||||||
|
};
|
||||||
|
unlimitedmax: number;
|
||||||
|
unlimitedmin: number;
|
||||||
|
shared: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum SubscriptionType {
|
export enum SubscriptionType {
|
||||||
|
|
|
@ -90,7 +90,10 @@ describe("test function", () => {
|
||||||
|
|
||||||
const wrapper = mount(<DefaultDirectoryDropdownComponent {...props} />);
|
const wrapper = mount(<DefaultDirectoryDropdownComponent {...props} />);
|
||||||
|
|
||||||
wrapper.find("div.defaultDirectoryDropdown").simulate("click");
|
wrapper
|
||||||
|
.find("div.defaultDirectoryDropdown")
|
||||||
|
.find("div.ms-Dropdown")
|
||||||
|
.simulate("click");
|
||||||
expect(wrapper.exists("div.ms-Callout-main")).toBe(true);
|
expect(wrapper.exists("div.ms-Callout-main")).toBe(true);
|
||||||
wrapper
|
wrapper
|
||||||
.find("button.ms-Dropdown-item")
|
.find("button.ms-Dropdown-item")
|
||||||
|
@ -99,7 +102,10 @@ describe("test function", () => {
|
||||||
expect(props.onDefaultDirectoryChange).toBeCalled();
|
expect(props.onDefaultDirectoryChange).toBeCalled();
|
||||||
expect(props.onDefaultDirectoryChange).toHaveBeenCalled();
|
expect(props.onDefaultDirectoryChange).toHaveBeenCalled();
|
||||||
|
|
||||||
wrapper.find("div.defaultDirectoryDropdown").simulate("click");
|
wrapper
|
||||||
|
.find("div.defaultDirectoryDropdown")
|
||||||
|
.find("div.ms-Dropdown")
|
||||||
|
.simulate("click");
|
||||||
expect(wrapper.exists("div.ms-Callout-main")).toBe(true);
|
expect(wrapper.exists("div.ms-Callout-main")).toBe(true);
|
||||||
wrapper
|
wrapper
|
||||||
.find("button.ms-Dropdown-item")
|
.find("button.ms-Dropdown-item")
|
||||||
|
|
|
@ -51,7 +51,7 @@ export class DirectoryListComponent extends React.Component<DirectoryListProps,
|
||||||
const textFieldProps: ITextFieldProps = {
|
const textFieldProps: ITextFieldProps = {
|
||||||
className: "directoryListFilterTextBox",
|
className: "directoryListFilterTextBox",
|
||||||
placeholder: "Filter by directory name",
|
placeholder: "Filter by directory name",
|
||||||
onBeforeChange: this._onFilterChanged,
|
onChange: this._onFilterChanged,
|
||||||
ariaLabel: "Directory filter text box"
|
ariaLabel: "Directory filter text box"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ export class DirectoryListComponent extends React.Component<DirectoryListProps,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private _onFilterChanged = (text: string): void => {
|
private _onFilterChanged = (event: React.FormEvent<HTMLInputElement | HTMLTextAreaElement>, text?: string): void => {
|
||||||
this.setState({
|
this.setState({
|
||||||
filterText: text
|
filterText: text
|
||||||
});
|
});
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -2,13 +2,13 @@ import { DefaultButton, IButtonProps, ITextFieldProps, TextField } from "office-
|
||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
import * as ViewModels from "../../../Contracts/ViewModels";
|
import * as ViewModels from "../../../Contracts/ViewModels";
|
||||||
import * as Constants from "../../../Common/Constants";
|
import * as Constants from "../../../Common/Constants";
|
||||||
import { Action, ActionModifiers } from "../../../Shared/Telemetry/TelemetryConstants";
|
import { Action } from "../../../Shared/Telemetry/TelemetryConstants";
|
||||||
import { Areas } from "../../../Common/Constants";
|
|
||||||
import { RepoListItem } from "./GitHubReposComponent";
|
import { RepoListItem } from "./GitHubReposComponent";
|
||||||
import { ChildrenMargin } from "./GitHubStyleConstants";
|
import { ChildrenMargin } from "./GitHubStyleConstants";
|
||||||
import { GitHubUtils } from "../../../Utils/GitHubUtils";
|
import { GitHubUtils } from "../../../Utils/GitHubUtils";
|
||||||
import { IGitHubRepo } from "../../../GitHub/GitHubClient";
|
import { IGitHubRepo } from "../../../GitHub/GitHubClient";
|
||||||
import TelemetryProcessor from "../../../Shared/Telemetry/TelemetryProcessor";
|
import TelemetryProcessor from "../../../Shared/Telemetry/TelemetryProcessor";
|
||||||
|
import UrlUtility from "../../../Common/UrlUtility";
|
||||||
|
|
||||||
export interface AddRepoComponentProps {
|
export interface AddRepoComponentProps {
|
||||||
container: ViewModels.Explorer;
|
container: ViewModels.Explorer;
|
||||||
|
@ -80,24 +80,24 @@ export class AddRepoComponent extends React.Component<AddRepoComponentProps, Add
|
||||||
});
|
});
|
||||||
let enteredUrl = this.state.textFieldValue;
|
let enteredUrl = this.state.textFieldValue;
|
||||||
if (enteredUrl.indexOf("/tree/") === -1) {
|
if (enteredUrl.indexOf("/tree/") === -1) {
|
||||||
enteredUrl = `${enteredUrl}/tree/${AddRepoComponent.DefaultBranchName}`;
|
enteredUrl = UrlUtility.createUri(enteredUrl, `tree/${AddRepoComponent.DefaultBranchName}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const gitHubInfo = GitHubUtils.fromGitHubUri(enteredUrl);
|
const repoInfo = GitHubUtils.fromRepoUri(enteredUrl);
|
||||||
if (gitHubInfo) {
|
if (repoInfo) {
|
||||||
this.setState({
|
this.setState({
|
||||||
textFieldValue: "",
|
textFieldValue: "",
|
||||||
textFieldErrorMessage: undefined
|
textFieldErrorMessage: undefined
|
||||||
});
|
});
|
||||||
|
|
||||||
const repo = await this.props.getRepo(gitHubInfo.owner, gitHubInfo.repo);
|
const repo = await this.props.getRepo(repoInfo.owner, repoInfo.repo);
|
||||||
if (repo) {
|
if (repo) {
|
||||||
const item: RepoListItem = {
|
const item: RepoListItem = {
|
||||||
key: GitHubUtils.toRepoFullName(repo.owner.login, repo.name),
|
key: GitHubUtils.toRepoFullName(repo.owner.login, repo.name),
|
||||||
repo,
|
repo,
|
||||||
branches: [
|
branches: [
|
||||||
{
|
{
|
||||||
name: gitHubInfo.branch
|
name: repoInfo.branch
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { DefaultButton, IButtonProps, Link, PrimaryButton } from "office-ui-fabric-react";
|
import { DefaultButton, IButtonProps, PrimaryButton } from "office-ui-fabric-react";
|
||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
import { IGitHubBranch, IGitHubRepo } from "../../../GitHub/GitHubClient";
|
import { IGitHubBranch, IGitHubRepo } from "../../../GitHub/GitHubClient";
|
||||||
import { AddRepoComponent, AddRepoComponentProps } from "./AddRepoComponent";
|
import { AddRepoComponent, AddRepoComponentProps } from "./AddRepoComponent";
|
||||||
|
|
|
@ -204,7 +204,9 @@ export class ReposListComponent extends React.Component<ReposListComponentProps>
|
||||||
return <Dropdown {...dropdownProps} />;
|
return <Dropdown {...dropdownProps} />;
|
||||||
};
|
};
|
||||||
|
|
||||||
private onRenderBranchesDropdownList = (props: ISelectableDroppableTextProps<IDropdown, IDropdown>): JSX.Element => {
|
private onRenderBranchesDropdownList = (
|
||||||
|
props: ISelectableDroppableTextProps<IDropdown, HTMLDivElement>
|
||||||
|
): JSX.Element => {
|
||||||
const renderedList: JSX.Element[] = [];
|
const renderedList: JSX.Element[] = [];
|
||||||
props.options.forEach((option: IDropdownOption) => {
|
props.options.forEach((option: IDropdownOption) => {
|
||||||
const item = (
|
const item = (
|
||||||
|
|
|
@ -112,6 +112,7 @@ export default class Explorer implements ViewModels.Explorer {
|
||||||
public collapsedResourceTreeWidth: number = ExplorerMetrics.CollapsedResourceTreeWidth;
|
public collapsedResourceTreeWidth: number = ExplorerMetrics.CollapsedResourceTreeWidth;
|
||||||
|
|
||||||
public databaseAccount: ko.Observable<ViewModels.DatabaseAccount>;
|
public databaseAccount: ko.Observable<ViewModels.DatabaseAccount>;
|
||||||
|
public collectionCreationDefaults: ViewModels.CollectionCreationDefaults = SharedConstants.CollectionCreationDefaults;
|
||||||
public subscriptionType: ko.Observable<ViewModels.SubscriptionType>;
|
public subscriptionType: ko.Observable<ViewModels.SubscriptionType>;
|
||||||
public quotaId: ko.Observable<string>;
|
public quotaId: ko.Observable<string>;
|
||||||
public defaultExperience: ko.Observable<string>;
|
public defaultExperience: ko.Observable<string>;
|
||||||
|
@ -2161,6 +2162,9 @@ export default class Explorer implements ViewModels.Explorer {
|
||||||
const authorizationToken = inputs.authorizationToken || "";
|
const authorizationToken = inputs.authorizationToken || "";
|
||||||
const masterKey = inputs.masterKey || "";
|
const masterKey = inputs.masterKey || "";
|
||||||
const databaseAccount = inputs.databaseAccount || null;
|
const databaseAccount = inputs.databaseAccount || null;
|
||||||
|
if (inputs.defaultCollectionThroughput) {
|
||||||
|
this.collectionCreationDefaults = inputs.defaultCollectionThroughput;
|
||||||
|
}
|
||||||
this.features(inputs.features);
|
this.features(inputs.features);
|
||||||
this.serverId(inputs.serverId);
|
this.serverId(inputs.serverId);
|
||||||
this.extensionEndpoint(inputs.extensionEndpoint || "");
|
this.extensionEndpoint(inputs.extensionEndpoint || "");
|
||||||
|
@ -2575,7 +2579,7 @@ export default class Explorer implements ViewModels.Explorer {
|
||||||
}
|
}
|
||||||
|
|
||||||
public async importAndOpen(path: string): Promise<boolean> {
|
public async importAndOpen(path: string): Promise<boolean> {
|
||||||
const name = NotebookUtil.getContentName(path);
|
const name = NotebookUtil.getName(path);
|
||||||
const item = NotebookUtil.createNotebookContentItem(name, path, "file");
|
const item = NotebookUtil.createNotebookContentItem(name, path, "file");
|
||||||
const parent = this.resourceTree.myNotebooksContentRoot;
|
const parent = this.resourceTree.myNotebooksContentRoot;
|
||||||
|
|
||||||
|
@ -3106,14 +3110,15 @@ export default class Explorer implements ViewModels.Explorer {
|
||||||
})
|
})
|
||||||
.then(() => this.resourceTree.triggerRender())
|
.then(() => this.resourceTree.triggerRender())
|
||||||
.catch(reason => {
|
.catch(reason => {
|
||||||
NotificationConsoleUtils.logConsoleMessage(ConsoleDataType.Error, reason);
|
const error = `Failed to create a new notebook: ${reason}`;
|
||||||
|
NotificationConsoleUtils.logConsoleMessage(ConsoleDataType.Error, error);
|
||||||
TelemetryProcessor.traceFailure(
|
TelemetryProcessor.traceFailure(
|
||||||
Action.CreateNewNotebook,
|
Action.CreateNewNotebook,
|
||||||
{
|
{
|
||||||
databaseAccountName: this.databaseAccount().name,
|
databaseAccountName: this.databaseAccount().name,
|
||||||
defaultExperience: this.defaultExperience(),
|
defaultExperience: this.defaultExperience(),
|
||||||
dataExplorerArea: Constants.Areas.Notebook,
|
dataExplorerArea: Constants.Areas.Notebook,
|
||||||
error: JSON.stringify(reason)
|
error
|
||||||
},
|
},
|
||||||
startKey
|
startKey
|
||||||
);
|
);
|
||||||
|
|
|
@ -28,6 +28,7 @@ exports[`test render renders signed in with full info 1`] = `
|
||||||
<FocusZone
|
<FocusZone
|
||||||
direction={2}
|
direction={2}
|
||||||
isCircularNavigation={false}
|
isCircularNavigation={false}
|
||||||
|
preventDefaultWhenHandled={true}
|
||||||
>
|
>
|
||||||
<CustomizedDefaultButton
|
<CustomizedDefaultButton
|
||||||
className="mecontrolHeaderButton"
|
className="mecontrolHeaderButton"
|
||||||
|
|
|
@ -60,7 +60,7 @@ export class NotebookContentProvider implements IContentProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
private getContentProvider(path: string): IContentProvider {
|
private getContentProvider(path: string): IContentProvider {
|
||||||
if (GitHubUtils.fromGitHubUri(path)) {
|
if (GitHubUtils.fromContentUri(path)) {
|
||||||
return this.gitHubContentProvider;
|
return this.gitHubContentProvider;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -141,8 +141,7 @@ export class NotebookContentClient implements ViewModels.INotebookContentClient
|
||||||
targetName += extension;
|
targetName += extension;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const parsedPath = NotebookContentClient.parsePath(sourcePath);
|
const targetPath = NotebookUtil.replaceName(sourcePath, targetName);
|
||||||
const targetPath = `${parsedPath.dirpath}${targetName}`;
|
|
||||||
return this.contentProvider
|
return this.contentProvider
|
||||||
.update<"file" | "notebook" | "directory">(this.getServerConfig(), sourcePath, { path: targetPath })
|
.update<"file" | "notebook" | "directory">(this.getServerConfig(), sourcePath, { path: targetPath })
|
||||||
.toPromise()
|
.toPromise()
|
||||||
|
@ -214,21 +213,6 @@ export class NotebookContentClient implements ViewModels.INotebookContentClient
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param path
|
|
||||||
* @returns basename and dirpath. Note: dirpath has trailing / already
|
|
||||||
*/
|
|
||||||
private static parsePath(path: string): { dirpath: string; basename: string } {
|
|
||||||
const basename = path.split("/").pop();
|
|
||||||
const dirpath = path.split(basename).shift();
|
|
||||||
|
|
||||||
return {
|
|
||||||
dirpath,
|
|
||||||
basename
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
private deleteNotebookFile(path: string): Promise<string> {
|
private deleteNotebookFile(path: string): Promise<string> {
|
||||||
return this.contentProvider
|
return this.contentProvider
|
||||||
.remove(this.getServerConfig(), path)
|
.remove(this.getServerConfig(), path)
|
||||||
|
|
|
@ -0,0 +1,49 @@
|
||||||
|
import { NotebookUtil } from "./NotebookUtil";
|
||||||
|
import { GitHubUtils } from "../../Utils/GitHubUtils";
|
||||||
|
|
||||||
|
const fileName = "file";
|
||||||
|
const notebookName = "file.ipynb";
|
||||||
|
const filePath = `folder/${fileName}`;
|
||||||
|
const notebookPath = `folder/${notebookName}`;
|
||||||
|
const gitHubFileUri = GitHubUtils.toContentUri("owner", "repo", "branch", filePath);
|
||||||
|
const gitHubNotebookUri = GitHubUtils.toContentUri("owner", "repo", "branch", notebookPath);
|
||||||
|
|
||||||
|
describe("NotebookUtil", () => {
|
||||||
|
describe("isNotebookFile", () => {
|
||||||
|
it("works for jupyter file paths", () => {
|
||||||
|
expect(NotebookUtil.isNotebookFile(filePath)).toBeFalsy();
|
||||||
|
expect(NotebookUtil.isNotebookFile(notebookPath)).toBeTruthy();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("works for github file uris", () => {
|
||||||
|
expect(NotebookUtil.isNotebookFile(gitHubFileUri)).toBeFalsy();
|
||||||
|
expect(NotebookUtil.isNotebookFile(gitHubNotebookUri)).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("getName", () => {
|
||||||
|
it("works for jupyter file paths", () => {
|
||||||
|
expect(NotebookUtil.getName(filePath)).toEqual(fileName);
|
||||||
|
expect(NotebookUtil.getName(notebookPath)).toEqual(notebookName);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("works for github file uris", () => {
|
||||||
|
expect(NotebookUtil.getName(gitHubFileUri)).toEqual(fileName);
|
||||||
|
expect(NotebookUtil.getName(gitHubNotebookUri)).toEqual(notebookName);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("replaceName", () => {
|
||||||
|
it("works for jupyter file paths", () => {
|
||||||
|
expect(NotebookUtil.replaceName(filePath, "newName")).toEqual(filePath.replace(fileName, "newName"));
|
||||||
|
expect(NotebookUtil.replaceName(notebookPath, "newName")).toEqual(notebookPath.replace(notebookName, "newName"));
|
||||||
|
});
|
||||||
|
|
||||||
|
it("works for github file uris", () => {
|
||||||
|
expect(NotebookUtil.replaceName(gitHubFileUri, "newName")).toEqual(gitHubFileUri.replace(fileName, "newName"));
|
||||||
|
expect(NotebookUtil.replaceName(gitHubNotebookUri, "newName")).toEqual(
|
||||||
|
gitHubNotebookUri.replace(notebookName, "newName")
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
|
@ -2,6 +2,7 @@ import path from "path";
|
||||||
import { ImmutableNotebook } from "@nteract/commutable";
|
import { ImmutableNotebook } from "@nteract/commutable";
|
||||||
import { NotebookContentItem, NotebookContentItemType } from "./NotebookContentItem";
|
import { NotebookContentItem, NotebookContentItemType } from "./NotebookContentItem";
|
||||||
import { StringUtils } from "../../Utils/StringUtils";
|
import { StringUtils } from "../../Utils/StringUtils";
|
||||||
|
import { GitHubUtils } from "../../Utils/GitHubUtils";
|
||||||
|
|
||||||
// Must match rx-jupyter' FileType
|
// Must match rx-jupyter' FileType
|
||||||
export type FileType = "directory" | "file" | "notebook";
|
export type FileType = "directory" | "file" | "notebook";
|
||||||
|
@ -11,7 +12,8 @@ export class NotebookUtil {
|
||||||
* It's a notebook file if the filename ends with .ipynb.
|
* It's a notebook file if the filename ends with .ipynb.
|
||||||
*/
|
*/
|
||||||
public static isNotebookFile(notebookPath: string): boolean {
|
public static isNotebookFile(notebookPath: string): boolean {
|
||||||
return StringUtils.endsWith(notebookPath, ".ipynb");
|
const fileName = NotebookUtil.getName(notebookPath);
|
||||||
|
return !!fileName && StringUtils.endsWith(fileName, ".ipynb");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -68,8 +70,34 @@ export class NotebookUtil {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public static getContentName(uri: string): string | undefined {
|
public static getName(path: string): undefined | string {
|
||||||
const parts = uri.split("/");
|
let relativePath: string = path;
|
||||||
return parts.pop() || parts.pop(); // handle potential trailing slash
|
const contentInfo = GitHubUtils.fromContentUri(path);
|
||||||
|
if (contentInfo) {
|
||||||
|
relativePath = contentInfo.path;
|
||||||
|
}
|
||||||
|
|
||||||
|
return relativePath.split("/").pop();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static replaceName(path: string, newName: string): string {
|
||||||
|
const contentInfo = GitHubUtils.fromContentUri(path);
|
||||||
|
if (contentInfo) {
|
||||||
|
const contentName = contentInfo.path.split("/").pop();
|
||||||
|
if (!contentName) {
|
||||||
|
throw new Error(`Failed to extract name from github path ${contentInfo.path}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
const basePath = contentInfo.path.split(contentName).shift();
|
||||||
|
return GitHubUtils.toContentUri(contentInfo.owner, contentInfo.repo, contentInfo.branch, `${basePath}${newName}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
const contentName = path.split("/").pop();
|
||||||
|
if (!contentName) {
|
||||||
|
throw new Error(`Failed to extract name from path ${path}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
const basePath = path.split(contentName).shift();
|
||||||
|
return `${basePath}${newName}`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@ import { TextFieldProps } from "./Controls/DialogReactComponent/DialogComponent"
|
||||||
import { UploadDetails } from "../workers/upload/definitions";
|
import { UploadDetails } from "../workers/upload/definitions";
|
||||||
import { UploadFilePane } from "./Panes/UploadFilePane";
|
import { UploadFilePane } from "./Panes/UploadFilePane";
|
||||||
import { Versions } from "../../src/Contracts/ExplorerContracts";
|
import { Versions } from "../../src/Contracts/ExplorerContracts";
|
||||||
|
import { CollectionCreationDefaults } from "../Shared/Constants";
|
||||||
|
|
||||||
export class ExplorerStub implements ViewModels.Explorer {
|
export class ExplorerStub implements ViewModels.Explorer {
|
||||||
public flight: ko.Observable<string>;
|
public flight: ko.Observable<string>;
|
||||||
|
@ -32,6 +33,7 @@ export class ExplorerStub implements ViewModels.Explorer {
|
||||||
public collectionTreeNodeAltText: ko.Observable<string>;
|
public collectionTreeNodeAltText: ko.Observable<string>;
|
||||||
public refreshTreeTitle: ko.Observable<string>;
|
public refreshTreeTitle: ko.Observable<string>;
|
||||||
public collapsedResourceTreeWidth: number;
|
public collapsedResourceTreeWidth: number;
|
||||||
|
public collectionCreationDefaults: ViewModels.CollectionCreationDefaults = CollectionCreationDefaults;
|
||||||
public hasWriteAccess: ko.Observable<boolean> = ko.observable<boolean>(false);
|
public hasWriteAccess: ko.Observable<boolean> = ko.observable<boolean>(false);
|
||||||
public databaseAccount: ko.Observable<ViewModels.DatabaseAccount>;
|
public databaseAccount: ko.Observable<ViewModels.DatabaseAccount>;
|
||||||
public subscriptionType: ko.Observable<ViewModels.SubscriptionType>;
|
public subscriptionType: ko.Observable<ViewModels.SubscriptionType>;
|
||||||
|
|
|
@ -13,13 +13,13 @@ import EnvironmentUtility from "../../Common/EnvironmentUtility";
|
||||||
import Q from "q";
|
import Q from "q";
|
||||||
import TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
import TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
||||||
import { Action, ActionModifiers } from "../../Shared/Telemetry/TelemetryConstants";
|
import { Action, ActionModifiers } from "../../Shared/Telemetry/TelemetryConstants";
|
||||||
|
import { config, Platform } from "../../Config";
|
||||||
import { ContextualPaneBase } from "./ContextualPaneBase";
|
import { ContextualPaneBase } from "./ContextualPaneBase";
|
||||||
import { CosmosClient } from "../../Common/CosmosClient";
|
import { CosmosClient } from "../../Common/CosmosClient";
|
||||||
import { createMongoCollectionWithARM, createMongoCollectionWithProxy } from "../../Common/MongoProxyClient";
|
import { createMongoCollectionWithARM, createMongoCollectionWithProxy } from "../../Common/MongoProxyClient";
|
||||||
import { DynamicListItem } from "../Controls/DynamicList/DynamicListComponent";
|
import { DynamicListItem } from "../Controls/DynamicList/DynamicListComponent";
|
||||||
import { HashMap } from "../../Common/HashMap";
|
import { HashMap } from "../../Common/HashMap";
|
||||||
import { PlatformType } from "../../PlatformType";
|
import { PlatformType } from "../../PlatformType";
|
||||||
import { config, Platform } from "../../Config";
|
|
||||||
|
|
||||||
export default class AddCollectionPane extends ContextualPaneBase implements ViewModels.AddCollectionPane {
|
export default class AddCollectionPane extends ContextualPaneBase implements ViewModels.AddCollectionPane {
|
||||||
public defaultExperience: ko.Computed<string>;
|
public defaultExperience: ko.Computed<string>;
|
||||||
|
@ -832,7 +832,7 @@ export default class AddCollectionPane extends ContextualPaneBase implements Vie
|
||||||
const isAadUser = EnvironmentUtility.isAadUser();
|
const isAadUser = EnvironmentUtility.isAadUser();
|
||||||
|
|
||||||
// note: v3 autopilot not supported yet for Mongo fixed collections (only tier supported)
|
// note: v3 autopilot not supported yet for Mongo fixed collections (only tier supported)
|
||||||
if (!isAadUser || isFixedCollectionWithSharedThroughputBeingCreated) {
|
if (!isAadUser) {
|
||||||
createCollectionFunc = () =>
|
createCollectionFunc = () =>
|
||||||
Q(
|
Q(
|
||||||
createMongoCollectionWithProxy(
|
createMongoCollectionWithProxy(
|
||||||
|
@ -853,6 +853,7 @@ export default class AddCollectionPane extends ContextualPaneBase implements Vie
|
||||||
this.container.armEndpoint(),
|
this.container.armEndpoint(),
|
||||||
databaseId,
|
databaseId,
|
||||||
this._getAnalyticalStorageTtl(),
|
this._getAnalyticalStorageTtl(),
|
||||||
|
isFixedCollectionWithSharedThroughputBeingCreated,
|
||||||
collectionId,
|
collectionId,
|
||||||
offerThroughput,
|
offerThroughput,
|
||||||
partitionKeyPath,
|
partitionKeyPath,
|
||||||
|
@ -1007,14 +1008,14 @@ export default class AddCollectionPane extends ContextualPaneBase implements Vie
|
||||||
this.uniqueKeys([]);
|
this.uniqueKeys([]);
|
||||||
this.useIndexingForSharedThroughput(true);
|
this.useIndexingForSharedThroughput(true);
|
||||||
|
|
||||||
const subscriptionType = this.container.subscriptionType();
|
const defaultStorage = this.container.collectionCreationDefaults.storage;
|
||||||
const flight = this.container.flight();
|
|
||||||
const defaultStorage = AddCollectionUtility.Utilities.getDefaultStorage(flight, subscriptionType);
|
|
||||||
this.storage(defaultStorage);
|
this.storage(defaultStorage);
|
||||||
|
|
||||||
const defaultThroughput = AddCollectionUtility.Utilities.getDefaultThroughput(flight, subscriptionType);
|
const defaultThroughput = this.container.collectionCreationDefaults.throughput;
|
||||||
this.throughputSinglePartition(defaultThroughput.fixed);
|
this.throughputSinglePartition(defaultThroughput.fixed);
|
||||||
this.throughputMultiPartition(defaultThroughput.unlimited(this.container));
|
this.throughputMultiPartition(
|
||||||
|
AddCollectionUtility.Utilities.getMaxThroughput(this.container.collectionCreationDefaults, this.container)
|
||||||
|
);
|
||||||
|
|
||||||
this.throughputDatabase(defaultThroughput.shared);
|
this.throughputDatabase(defaultThroughput.shared);
|
||||||
this.databaseCreateNew(true);
|
this.databaseCreateNew(true);
|
||||||
|
@ -1211,7 +1212,7 @@ export default class AddCollectionPane extends ContextualPaneBase implements Vie
|
||||||
) {
|
) {
|
||||||
return !this.hasAutoPilotV2FeatureFlag()
|
return !this.hasAutoPilotV2FeatureFlag()
|
||||||
? {
|
? {
|
||||||
[Constants.HttpHeaders.autoPilotThroughput]: `{ "maxThroughput": ${this.sharedAutoPilotThroughput() * 1} }`
|
[Constants.HttpHeaders.autoPilotThroughput]: { maxThroughput: this.sharedAutoPilotThroughput() * 1 }
|
||||||
}
|
}
|
||||||
: { [Constants.HttpHeaders.autoPilotTier]: this.selectedSharedAutoPilotTier().toString() };
|
: { [Constants.HttpHeaders.autoPilotTier]: this.selectedSharedAutoPilotTier().toString() };
|
||||||
}
|
}
|
||||||
|
@ -1221,7 +1222,7 @@ export default class AddCollectionPane extends ContextualPaneBase implements Vie
|
||||||
) {
|
) {
|
||||||
return !this.hasAutoPilotV2FeatureFlag()
|
return !this.hasAutoPilotV2FeatureFlag()
|
||||||
? {
|
? {
|
||||||
[Constants.HttpHeaders.autoPilotThroughput]: `{ "maxThroughput": ${this.autoPilotThroughput() * 1} }`
|
[Constants.HttpHeaders.autoPilotThroughput]: { maxThroughput: this.autoPilotThroughput() * 1 }
|
||||||
}
|
}
|
||||||
: { [Constants.HttpHeaders.autoPilotTier]: this.selectedAutoPilotTier().toString() };
|
: { [Constants.HttpHeaders.autoPilotTier]: this.selectedAutoPilotTier().toString() };
|
||||||
}
|
}
|
||||||
|
@ -1268,12 +1269,16 @@ export default class AddCollectionPane extends ContextualPaneBase implements Vie
|
||||||
}
|
}
|
||||||
|
|
||||||
private _updateThroughputLimitByCollectionStorage() {
|
private _updateThroughputLimitByCollectionStorage() {
|
||||||
const subscriptionType = this.container.subscriptionType();
|
|
||||||
const flight = this.container.flight();
|
|
||||||
const storage = this.storage();
|
const storage = this.storage();
|
||||||
const minThroughputRU = AddCollectionUtility.Utilities.getMinRUForStorageOption(subscriptionType, flight, storage);
|
const minThroughputRU = AddCollectionUtility.Utilities.getMinRUForStorageOption(
|
||||||
|
this.container.collectionCreationDefaults,
|
||||||
|
storage
|
||||||
|
);
|
||||||
|
|
||||||
let maxThroughputRU = AddCollectionUtility.Utilities.getMaxRUForStorageOption(subscriptionType, flight, storage);
|
let maxThroughputRU = AddCollectionUtility.Utilities.getMaxRUForStorageOption(
|
||||||
|
this.container.collectionCreationDefaults,
|
||||||
|
storage
|
||||||
|
);
|
||||||
if (this.isTryCosmosDBSubscription()) {
|
if (this.isTryCosmosDBSubscription()) {
|
||||||
maxThroughputRU = Constants.TryCosmosExperience.maxRU;
|
maxThroughputRU = Constants.TryCosmosExperience.maxRU;
|
||||||
}
|
}
|
||||||
|
@ -1283,10 +1288,7 @@ export default class AddCollectionPane extends ContextualPaneBase implements Vie
|
||||||
}
|
}
|
||||||
|
|
||||||
private _updateThroughputLimitByDatabase() {
|
private _updateThroughputLimitByDatabase() {
|
||||||
const subscriptionType = this.container.subscriptionType();
|
const defaultThruoghput = this.container.collectionCreationDefaults.throughput;
|
||||||
const flight = this.container.flight();
|
|
||||||
const defaultThruoghput = AddCollectionUtility.Utilities.getDefaultThroughput(flight, subscriptionType);
|
|
||||||
|
|
||||||
this.maxThroughputRU(defaultThruoghput.unlimitedmax);
|
this.maxThroughputRU(defaultThruoghput.unlimitedmax);
|
||||||
this.minThroughputRU(defaultThruoghput.unlimitedmin);
|
this.minThroughputRU(defaultThruoghput.unlimitedmin);
|
||||||
}
|
}
|
||||||
|
|
|
@ -578,7 +578,7 @@ export default class AddDatabasePane extends ContextualPaneBase implements ViewM
|
||||||
) {
|
) {
|
||||||
return !this.hasAutoPilotV2FeatureFlag()
|
return !this.hasAutoPilotV2FeatureFlag()
|
||||||
? {
|
? {
|
||||||
[Constants.HttpHeaders.autoPilotThroughput]: `{ "maxThroughput": ${this.maxAutoPilotThroughputSet() * 1} }`
|
[Constants.HttpHeaders.autoPilotThroughput]: { maxThroughput: this.maxAutoPilotThroughputSet() * 1 }
|
||||||
}
|
}
|
||||||
: { [Constants.HttpHeaders.autoPilotTier]: this.selectedAutoPilotTier().toString() };
|
: { [Constants.HttpHeaders.autoPilotTier]: this.selectedAutoPilotTier().toString() };
|
||||||
}
|
}
|
||||||
|
@ -586,13 +586,7 @@ export default class AddDatabasePane extends ContextualPaneBase implements ViewM
|
||||||
}
|
}
|
||||||
|
|
||||||
private _updateThroughputLimitByDatabase() {
|
private _updateThroughputLimitByDatabase() {
|
||||||
const subscriptionType = this.container.subscriptionType();
|
const throughputDefaults = this.container.collectionCreationDefaults.throughput;
|
||||||
const flight = this.container.flight();
|
|
||||||
const throughputDefaults: AddCollectionUtility.ThroughputDefaults = AddCollectionUtility.Utilities.getDefaultThroughput(
|
|
||||||
flight,
|
|
||||||
subscriptionType
|
|
||||||
);
|
|
||||||
|
|
||||||
this.throughput(throughputDefaults.shared);
|
this.throughput(throughputDefaults.shared);
|
||||||
this.maxThroughputRU(throughputDefaults.unlimitedmax);
|
this.maxThroughputRU(throughputDefaults.unlimitedmax);
|
||||||
this.minThroughputRU(throughputDefaults.unlimitedmin);
|
this.minThroughputRU(throughputDefaults.unlimitedmin);
|
||||||
|
|
|
@ -74,10 +74,7 @@ export default class CassandraAddCollectionPane extends ContextualPaneBase
|
||||||
});
|
});
|
||||||
this.keyspaceId.extend({ rateLimit: 100 });
|
this.keyspaceId.extend({ rateLimit: 100 });
|
||||||
this.dedicateTableThroughput = ko.observable<boolean>(false);
|
this.dedicateTableThroughput = ko.observable<boolean>(false);
|
||||||
|
const throughputDefaults = this.container.collectionCreationDefaults.throughput;
|
||||||
const flight = this.container.flight();
|
|
||||||
const subscriptionType = this.container.subscriptionType();
|
|
||||||
const throughputDefaults = AddCollectionUtility.Utilities.getDefaultThroughput(flight, subscriptionType);
|
|
||||||
this.maxThroughputRU = ko.observable<number>(throughputDefaults.unlimitedmax);
|
this.maxThroughputRU = ko.observable<number>(throughputDefaults.unlimitedmax);
|
||||||
this.minThroughputRU = ko.observable<number>(throughputDefaults.unlimitedmin);
|
this.minThroughputRU = ko.observable<number>(throughputDefaults.unlimitedmin);
|
||||||
|
|
||||||
|
@ -489,17 +486,16 @@ export default class CassandraAddCollectionPane extends ContextualPaneBase
|
||||||
|
|
||||||
public resetData() {
|
public resetData() {
|
||||||
super.resetData();
|
super.resetData();
|
||||||
const throughputDefaults = AddCollectionUtility.Utilities.getDefaultThroughput(
|
const throughputDefaults = this.container.collectionCreationDefaults.throughput;
|
||||||
this.container.flight(),
|
|
||||||
this.container.subscriptionType()
|
|
||||||
);
|
|
||||||
this.isAutoPilotSelected(false);
|
this.isAutoPilotSelected(false);
|
||||||
this.isSharedAutoPilotSelected(false);
|
this.isSharedAutoPilotSelected(false);
|
||||||
this.selectedAutoPilotTier(null);
|
this.selectedAutoPilotTier(null);
|
||||||
this.selectedSharedAutoPilotTier(null);
|
this.selectedSharedAutoPilotTier(null);
|
||||||
this.selectedAutoPilotThroughput(AutoPilotUtils.minAutoPilotThroughput);
|
this.selectedAutoPilotThroughput(AutoPilotUtils.minAutoPilotThroughput);
|
||||||
this.sharedAutoPilotThroughput(AutoPilotUtils.minAutoPilotThroughput);
|
this.sharedAutoPilotThroughput(AutoPilotUtils.minAutoPilotThroughput);
|
||||||
this.throughput(throughputDefaults.unlimited(this.container));
|
this.throughput(
|
||||||
|
AddCollectionUtility.Utilities.getMaxThroughput(this.container.collectionCreationDefaults, this.container)
|
||||||
|
);
|
||||||
this.keyspaceThroughput(throughputDefaults.shared);
|
this.keyspaceThroughput(throughputDefaults.shared);
|
||||||
this.maxThroughputRU(throughputDefaults.unlimitedmax);
|
this.maxThroughputRU(throughputDefaults.unlimitedmax);
|
||||||
this.minThroughputRU(throughputDefaults.unlimitedmin);
|
this.minThroughputRU(throughputDefaults.unlimitedmin);
|
||||||
|
|
|
@ -13,6 +13,7 @@ import { GitHubReposComponentAdapter } from "../Controls/GitHub/GitHubReposCompo
|
||||||
import { BranchesProps, PinnedReposProps, UnpinnedReposProps } from "../Controls/GitHub/ReposListComponent";
|
import { BranchesProps, PinnedReposProps, UnpinnedReposProps } from "../Controls/GitHub/ReposListComponent";
|
||||||
import { ConsoleDataType } from "../Menus/NotificationConsole/NotificationConsoleComponent";
|
import { ConsoleDataType } from "../Menus/NotificationConsole/NotificationConsoleComponent";
|
||||||
import { ContextualPaneBase } from "./ContextualPaneBase";
|
import { ContextualPaneBase } from "./ContextualPaneBase";
|
||||||
|
import { JunoUtils } from "../../Utils/JunoUtils";
|
||||||
|
|
||||||
export class GitHubReposPane extends ContextualPaneBase {
|
export class GitHubReposPane extends ContextualPaneBase {
|
||||||
private static readonly PageSize = 30;
|
private static readonly PageSize = 30;
|
||||||
|
@ -84,7 +85,7 @@ export class GitHubReposPane extends ContextualPaneBase {
|
||||||
|
|
||||||
public async submit(): Promise<void> {
|
public async submit(): Promise<void> {
|
||||||
const pinnedReposUpdated = this.pinnedReposUpdated;
|
const pinnedReposUpdated = this.pinnedReposUpdated;
|
||||||
const reposToPin: IPinnedRepo[] = this.pinnedReposProps.repos.map(repo => GitHubUtils.toPinnedRepo(repo));
|
const reposToPin: IPinnedRepo[] = this.pinnedReposProps.repos.map(repo => JunoUtils.toPinnedRepo(repo));
|
||||||
|
|
||||||
// Submit resets data too
|
// Submit resets data too
|
||||||
super.submit();
|
super.submit();
|
||||||
|
@ -298,7 +299,7 @@ export class GitHubReposPane extends ContextualPaneBase {
|
||||||
({
|
({
|
||||||
key: GitHubUtils.toRepoFullName(pinnedRepo.owner, pinnedRepo.name),
|
key: GitHubUtils.toRepoFullName(pinnedRepo.owner, pinnedRepo.name),
|
||||||
branches: pinnedRepo.branches,
|
branches: pinnedRepo.branches,
|
||||||
repo: GitHubUtils.toGitHubRepo(pinnedRepo)
|
repo: JunoUtils.toGitHubRepo(pinnedRepo)
|
||||||
} as RepoListItem)
|
} as RepoListItem)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -245,11 +245,7 @@ export default class DatabaseSettingsTab extends TabsBase
|
||||||
if (collectionThroughputInfo && !!collectionThroughputInfo.minimumRUForCollection) {
|
if (collectionThroughputInfo && !!collectionThroughputInfo.minimumRUForCollection) {
|
||||||
return collectionThroughputInfo.minimumRUForCollection;
|
return collectionThroughputInfo.minimumRUForCollection;
|
||||||
}
|
}
|
||||||
|
const throughputDefaults = this.container.collectionCreationDefaults.throughput;
|
||||||
const flight = this.container.flight();
|
|
||||||
const subscriptionType = this.container.subscriptionType();
|
|
||||||
const throughputDefaults = AddCollectionUtility.Utilities.getDefaultThroughput(flight, subscriptionType);
|
|
||||||
|
|
||||||
return throughputDefaults.unlimitedmin;
|
return throughputDefaults.unlimitedmin;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -269,10 +265,7 @@ export default class DatabaseSettingsTab extends TabsBase
|
||||||
return SharedConstants.CollectionCreation.MaxRUPerPartition * numPartitions;
|
return SharedConstants.CollectionCreation.MaxRUPerPartition * numPartitions;
|
||||||
}
|
}
|
||||||
|
|
||||||
const flight = this.container.flight();
|
const throughputDefaults = this.container.collectionCreationDefaults.throughput;
|
||||||
const subscriptionType = this.container.subscriptionType();
|
|
||||||
const throughputDefaults = AddCollectionUtility.Utilities.getDefaultThroughput(flight, subscriptionType);
|
|
||||||
|
|
||||||
return throughputDefaults.unlimitedmax;
|
return throughputDefaults.unlimitedmax;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -329,7 +329,6 @@ export default class QueryTab extends TabsBase implements ViewModels.QueryTab, V
|
||||||
this.requestChargeDisplayText(`${queryResults.requestCharge} RUs`);
|
this.requestChargeDisplayText(`${queryResults.requestCharge} RUs`);
|
||||||
|
|
||||||
if (!this.queryResults() && !results) {
|
if (!this.queryResults() && !results) {
|
||||||
const appInsights: any = (<any>window).appInsights;
|
|
||||||
const errorMessage: string = JSON.stringify({
|
const errorMessage: string = JSON.stringify({
|
||||||
error: `Returned no results after query execution`,
|
error: `Returned no results after query execution`,
|
||||||
accountName: this.collection && this.collection.container.databaseAccount(),
|
accountName: this.collection && this.collection.container.databaseAccount(),
|
||||||
|
@ -341,7 +340,6 @@ export default class QueryTab extends TabsBase implements ViewModels.QueryTab, V
|
||||||
responseHeaders: queryResults && queryResults.headers
|
responseHeaders: queryResults && queryResults.headers
|
||||||
});
|
});
|
||||||
Logger.logError(errorMessage, "QueryTab");
|
Logger.logError(errorMessage, "QueryTab");
|
||||||
appInsights && appInsights.trackTrace(errorMessage);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.queryResults(results);
|
this.queryResults(results);
|
||||||
|
|
|
@ -106,10 +106,7 @@
|
||||||
</throughput-input>
|
</throughput-input>
|
||||||
<!-- /ko -->
|
<!-- /ko -->
|
||||||
|
|
||||||
<div
|
<div class="storageCapacityTitle throughputStorageValue" data-bind="html: storageCapacityTitle"></div>
|
||||||
class="storageCapacityTitle throughputStorageValue"
|
|
||||||
data-bind="html: storageCapacityTitle, visible: !isAutoPilotSelected()"
|
|
||||||
></div>
|
|
||||||
<!-- /ko -->
|
<!-- /ko -->
|
||||||
|
|
||||||
<div data-bind="visible: rupmVisible">
|
<div data-bind="visible: rupmVisible">
|
||||||
|
|
|
@ -103,10 +103,11 @@ export class ResourceTreeAdapter implements ReactAdapter {
|
||||||
|
|
||||||
this.sampleNotebooksContentRoot = {
|
this.sampleNotebooksContentRoot = {
|
||||||
name: "Sample Notebooks (View Only)",
|
name: "Sample Notebooks (View Only)",
|
||||||
path: GitHubUtils.toGitHubUriForRepoAndBranch(
|
path: GitHubUtils.toContentUri(
|
||||||
ResourceTreeAdapter.SamplesRepo.owner.login,
|
ResourceTreeAdapter.SamplesRepo.owner.login,
|
||||||
ResourceTreeAdapter.SamplesRepo.name,
|
ResourceTreeAdapter.SamplesRepo.name,
|
||||||
ResourceTreeAdapter.SamplesBranch.name
|
ResourceTreeAdapter.SamplesBranch.name,
|
||||||
|
""
|
||||||
),
|
),
|
||||||
type: NotebookContentItemType.Directory
|
type: NotebookContentItemType.Directory
|
||||||
};
|
};
|
||||||
|
@ -157,7 +158,7 @@ export class ResourceTreeAdapter implements ReactAdapter {
|
||||||
pinnedRepo.branches.forEach(branch => {
|
pinnedRepo.branches.forEach(branch => {
|
||||||
repoTreeItem.children.push({
|
repoTreeItem.children.push({
|
||||||
name: branch.name,
|
name: branch.name,
|
||||||
path: GitHubUtils.toGitHubUriForRepoAndBranch(pinnedRepo.owner, pinnedRepo.name, branch.name),
|
path: GitHubUtils.toContentUri(pinnedRepo.owner, pinnedRepo.name, branch.name, ""),
|
||||||
type: NotebookContentItemType.Directory
|
type: NotebookContentItemType.Directory
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -620,7 +621,7 @@ export class ResourceTreeAdapter implements ReactAdapter {
|
||||||
];
|
];
|
||||||
|
|
||||||
// For GitHub paths remove "Delete", "Rename", "New Directory", "Upload File"
|
// For GitHub paths remove "Delete", "Rename", "New Directory", "Upload File"
|
||||||
if (GitHubUtils.fromGitHubUri(item.path)) {
|
if (GitHubUtils.fromContentUri(item.path)) {
|
||||||
items = items.filter(
|
items = items.filter(
|
||||||
item =>
|
item =>
|
||||||
item.label !== "Delete" &&
|
item.label !== "Delete" &&
|
||||||
|
|
|
@ -28,8 +28,6 @@ export interface IGitHubFile {
|
||||||
path: string;
|
path: string;
|
||||||
content?: string;
|
content?: string;
|
||||||
sha: string;
|
sha: string;
|
||||||
url: string;
|
|
||||||
html_url: string;
|
|
||||||
|
|
||||||
// Custom properties
|
// Custom properties
|
||||||
children?: IGitHubFile[];
|
children?: IGitHubFile[];
|
||||||
|
@ -68,6 +66,10 @@ export class GitHubClient {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private static readonly samplesBranch: IGitHubBranch = {
|
||||||
|
name: "master"
|
||||||
|
};
|
||||||
|
|
||||||
private static readonly samplesTopCommit: IGitHubCommit = {
|
private static readonly samplesTopCommit: IGitHubCommit = {
|
||||||
sha: "41b964f442b638097a75a3f3b6a6451db05a12bf",
|
sha: "41b964f442b638097a75a3f3b6a6451db05a12bf",
|
||||||
committer: {
|
committer: {
|
||||||
|
@ -82,8 +84,6 @@ export class GitHubClient {
|
||||||
path: ".github",
|
path: ".github",
|
||||||
sha: "5e6794a8177a0c07a8719f6e1d7b41cce6f92e1e",
|
sha: "5e6794a8177a0c07a8719f6e1d7b41cce6f92e1e",
|
||||||
size: 0,
|
size: 0,
|
||||||
url: "https://api.github.com/repos/Azure-Samples/cosmos-notebooks/contents/.github?ref=master",
|
|
||||||
html_url: "https://github.com/Azure-Samples/cosmos-notebooks/tree/master/.github",
|
|
||||||
type: "dir"
|
type: "dir"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -91,8 +91,6 @@ export class GitHubClient {
|
||||||
path: ".gitignore",
|
path: ".gitignore",
|
||||||
sha: "3e759b75bf455ac809d0987d369aab89137b5689",
|
sha: "3e759b75bf455ac809d0987d369aab89137b5689",
|
||||||
size: 5582,
|
size: 5582,
|
||||||
url: "https://api.github.com/repos/Azure-Samples/cosmos-notebooks/contents/.gitignore?ref=master",
|
|
||||||
html_url: "https://github.com/Azure-Samples/cosmos-notebooks/blob/master/.gitignore",
|
|
||||||
type: "file"
|
type: "file"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -100,8 +98,6 @@ export class GitHubClient {
|
||||||
path: "1. GettingStarted.ipynb",
|
path: "1. GettingStarted.ipynb",
|
||||||
sha: "0732ff5366e4aefdc4c378c61cbd968664f0acec",
|
sha: "0732ff5366e4aefdc4c378c61cbd968664f0acec",
|
||||||
size: 3933,
|
size: 3933,
|
||||||
url: "https://api.github.com/repos/Azure-Samples/cosmos-notebooks/contents/1.%20GettingStarted.ipynb?ref=master",
|
|
||||||
html_url: "https://github.com/Azure-Samples/cosmos-notebooks/blob/master/1.%20GettingStarted.ipynb",
|
|
||||||
type: "file"
|
type: "file"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -109,8 +105,6 @@ export class GitHubClient {
|
||||||
path: "2. Visualization.ipynb",
|
path: "2. Visualization.ipynb",
|
||||||
sha: "f480134ac4adf2f50ce5fe66836c6966749d3ca1",
|
sha: "f480134ac4adf2f50ce5fe66836c6966749d3ca1",
|
||||||
size: 814261,
|
size: 814261,
|
||||||
url: "https://api.github.com/repos/Azure-Samples/cosmos-notebooks/contents/2.%20Visualization.ipynb?ref=master",
|
|
||||||
html_url: "https://github.com/Azure-Samples/cosmos-notebooks/blob/master/2.%20Visualization.ipynb",
|
|
||||||
type: "file"
|
type: "file"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -118,8 +112,6 @@ export class GitHubClient {
|
||||||
path: "3. RequestUnits.ipynb",
|
path: "3. RequestUnits.ipynb",
|
||||||
sha: "252b79a4adc81e9f2ffde453231b695d75e270e8",
|
sha: "252b79a4adc81e9f2ffde453231b695d75e270e8",
|
||||||
size: 9490,
|
size: 9490,
|
||||||
url: "https://api.github.com/repos/Azure-Samples/cosmos-notebooks/contents/3.%20RequestUnits.ipynb?ref=master",
|
|
||||||
html_url: "https://github.com/Azure-Samples/cosmos-notebooks/blob/master/3.%20RequestUnits.ipynb",
|
|
||||||
type: "file"
|
type: "file"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -127,8 +119,6 @@ export class GitHubClient {
|
||||||
path: "4. Indexing.ipynb",
|
path: "4. Indexing.ipynb",
|
||||||
sha: "e10dd67bd1c55c345226769e4f80e43659ef9cd5",
|
sha: "e10dd67bd1c55c345226769e4f80e43659ef9cd5",
|
||||||
size: 10394,
|
size: 10394,
|
||||||
url: "https://api.github.com/repos/Azure-Samples/cosmos-notebooks/contents/4.%20Indexing.ipynb?ref=master",
|
|
||||||
html_url: "https://github.com/Azure-Samples/cosmos-notebooks/blob/master/4.%20Indexing.ipynb",
|
|
||||||
type: "file"
|
type: "file"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -136,9 +126,6 @@ export class GitHubClient {
|
||||||
path: "5. StoredProcedures.ipynb",
|
path: "5. StoredProcedures.ipynb",
|
||||||
sha: "949941949920de4d2d111149e2182e9657cc8134",
|
sha: "949941949920de4d2d111149e2182e9657cc8134",
|
||||||
size: 11818,
|
size: 11818,
|
||||||
url:
|
|
||||||
"https://api.github.com/repos/Azure-Samples/cosmos-notebooks/contents/5.%20StoredProcedures.ipynb?ref=master",
|
|
||||||
html_url: "https://github.com/Azure-Samples/cosmos-notebooks/blob/master/5.%20StoredProcedures.ipynb",
|
|
||||||
type: "file"
|
type: "file"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -146,9 +133,6 @@ export class GitHubClient {
|
||||||
path: "6. GlobalDistribution.ipynb",
|
path: "6. GlobalDistribution.ipynb",
|
||||||
sha: "b91c31dacacbc9e35750d9054063dda4a5309f3b",
|
sha: "b91c31dacacbc9e35750d9054063dda4a5309f3b",
|
||||||
size: 11375,
|
size: 11375,
|
||||||
url:
|
|
||||||
"https://api.github.com/repos/Azure-Samples/cosmos-notebooks/contents/6.%20GlobalDistribution.ipynb?ref=master",
|
|
||||||
html_url: "https://github.com/Azure-Samples/cosmos-notebooks/blob/master/6.%20GlobalDistribution.ipynb",
|
|
||||||
type: "file"
|
type: "file"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -156,9 +140,6 @@ export class GitHubClient {
|
||||||
path: "7. IoTAnomalyDetection.ipynb",
|
path: "7. IoTAnomalyDetection.ipynb",
|
||||||
sha: "82057ae52a67721a5966e2361317f5dfbd0ee595",
|
sha: "82057ae52a67721a5966e2361317f5dfbd0ee595",
|
||||||
size: 377939,
|
size: 377939,
|
||||||
url:
|
|
||||||
"https://api.github.com/repos/Azure-Samples/cosmos-notebooks/contents/7.%20IoTAnomalyDetection.ipynb?ref=master",
|
|
||||||
html_url: "https://github.com/Azure-Samples/cosmos-notebooks/blob/master/7.%20IoTAnomalyDetection.ipynb",
|
|
||||||
type: "file"
|
type: "file"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -166,8 +147,6 @@ export class GitHubClient {
|
||||||
path: "All_API_quickstarts",
|
path: "All_API_quickstarts",
|
||||||
sha: "07054293e6c8fc00771fccd0cde207f5c8053978",
|
sha: "07054293e6c8fc00771fccd0cde207f5c8053978",
|
||||||
size: 0,
|
size: 0,
|
||||||
url: "https://api.github.com/repos/Azure-Samples/cosmos-notebooks/contents/All_API_quickstarts?ref=master",
|
|
||||||
html_url: "https://github.com/Azure-Samples/cosmos-notebooks/tree/master/All_API_quickstarts",
|
|
||||||
type: "dir"
|
type: "dir"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -175,8 +154,6 @@ export class GitHubClient {
|
||||||
path: "CSharp_quickstarts",
|
path: "CSharp_quickstarts",
|
||||||
sha: "10e7f5704e6b56a40cac74bc39f15b7708954f52",
|
sha: "10e7f5704e6b56a40cac74bc39f15b7708954f52",
|
||||||
size: 0,
|
size: 0,
|
||||||
url: "https://api.github.com/repos/Azure-Samples/cosmos-notebooks/contents/CSharp_quickstarts?ref=master",
|
|
||||||
html_url: "https://github.com/Azure-Samples/cosmos-notebooks/tree/master/CSharp_quickstarts",
|
|
||||||
type: "dir"
|
type: "dir"
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
@ -315,7 +292,9 @@ export class GitHubClient {
|
||||||
if (GitHubClient.isSamplesCall(owner, repo, branch) && path === "") {
|
if (GitHubClient.isSamplesCall(owner, repo, branch) && path === "") {
|
||||||
return {
|
return {
|
||||||
status: HttpStatusCodes.OK,
|
status: HttpStatusCodes.OK,
|
||||||
data: GitHubClient.samplesFiles
|
data: GitHubClient.samplesFiles.map(file =>
|
||||||
|
GitHubClient.toGitHubFile(file, GitHubClient.samplesRepo, GitHubClient.samplesBranch)
|
||||||
|
)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -515,8 +494,6 @@ export class GitHubClient {
|
||||||
path: element.path,
|
path: element.path,
|
||||||
content: element.content,
|
content: element.content,
|
||||||
sha: element.sha,
|
sha: element.sha,
|
||||||
url: element.url,
|
|
||||||
html_url: element.html_url,
|
|
||||||
repo,
|
repo,
|
||||||
branch
|
branch
|
||||||
};
|
};
|
||||||
|
|
|
@ -3,13 +3,13 @@ import { fixture } from "@nteract/fixtures";
|
||||||
import { HttpStatusCodes } from "../Common/Constants";
|
import { HttpStatusCodes } from "../Common/Constants";
|
||||||
import { GitHubClient, IGitHubCommit, IGitHubFile } from "./GitHubClient";
|
import { GitHubClient, IGitHubCommit, IGitHubFile } from "./GitHubClient";
|
||||||
import { GitHubContentProvider } from "./GitHubContentProvider";
|
import { GitHubContentProvider } from "./GitHubContentProvider";
|
||||||
|
import { GitHubUtils } from "../Utils/GitHubUtils";
|
||||||
|
|
||||||
const gitHubClient = new GitHubClient("token", () => {});
|
const gitHubClient = new GitHubClient("token", () => {});
|
||||||
const gitHubContentProvider = new GitHubContentProvider({
|
const gitHubContentProvider = new GitHubContentProvider({
|
||||||
gitHubClient,
|
gitHubClient,
|
||||||
promptForCommitMsg: () => Promise.resolve("commit msg")
|
promptForCommitMsg: () => Promise.resolve("commit msg")
|
||||||
});
|
});
|
||||||
const sampleGitHubUri = `https://github.com/login/repo/blob/branch/dir/name.ipynb`;
|
|
||||||
const sampleFile: IGitHubFile = {
|
const sampleFile: IGitHubFile = {
|
||||||
type: "file",
|
type: "file",
|
||||||
encoding: "encoding",
|
encoding: "encoding",
|
||||||
|
@ -18,8 +18,6 @@ const sampleFile: IGitHubFile = {
|
||||||
path: "dir/name.ipynb",
|
path: "dir/name.ipynb",
|
||||||
content: btoa(fixture),
|
content: btoa(fixture),
|
||||||
sha: "sha",
|
sha: "sha",
|
||||||
url: "url",
|
|
||||||
html_url: sampleGitHubUri,
|
|
||||||
repo: {
|
repo: {
|
||||||
owner: {
|
owner: {
|
||||||
login: "login"
|
login: "login"
|
||||||
|
@ -31,9 +29,15 @@ const sampleFile: IGitHubFile = {
|
||||||
name: "branch"
|
name: "branch"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
const sampleGitHubUri = GitHubUtils.toContentUri(
|
||||||
|
sampleFile.repo.owner.login,
|
||||||
|
sampleFile.repo.name,
|
||||||
|
sampleFile.branch.name,
|
||||||
|
sampleFile.path
|
||||||
|
);
|
||||||
const sampleNotebookModel: IContent<"notebook"> = {
|
const sampleNotebookModel: IContent<"notebook"> = {
|
||||||
name: sampleFile.name,
|
name: sampleFile.name,
|
||||||
path: sampleFile.html_url,
|
path: sampleGitHubUri,
|
||||||
type: "notebook",
|
type: "notebook",
|
||||||
writable: true,
|
writable: true,
|
||||||
created: "",
|
created: "",
|
||||||
|
|
|
@ -7,6 +7,7 @@ import { Logger } from "../Common/Logger";
|
||||||
import { NotebookUtil } from "../Explorer/Notebook/NotebookUtil";
|
import { NotebookUtil } from "../Explorer/Notebook/NotebookUtil";
|
||||||
import { GitHubClient, IGitHubFile, IGitHubResponse, IGitHubCommit } from "./GitHubClient";
|
import { GitHubClient, IGitHubFile, IGitHubResponse, IGitHubCommit } from "./GitHubClient";
|
||||||
import { GitHubUtils } from "../Utils/GitHubUtils";
|
import { GitHubUtils } from "../Utils/GitHubUtils";
|
||||||
|
import UrlUtility from "../Common/UrlUtility";
|
||||||
|
|
||||||
export interface GitHubContentProviderParams {
|
export interface GitHubContentProviderParams {
|
||||||
gitHubClient: GitHubClient;
|
gitHubClient: GitHubClient;
|
||||||
|
@ -53,12 +54,12 @@ export class GitHubContentProvider implements IContentProvider {
|
||||||
throw new GitHubContentProviderError("Failed to get content", content.status);
|
throw new GitHubContentProviderError("Failed to get content", content.status);
|
||||||
}
|
}
|
||||||
|
|
||||||
const gitHubInfo = GitHubUtils.fromGitHubUri(uri);
|
const contentInfo = GitHubUtils.fromContentUri(uri);
|
||||||
const commitResponse = await this.params.gitHubClient.getCommitsAsync(
|
const commitResponse = await this.params.gitHubClient.getCommitsAsync(
|
||||||
gitHubInfo.owner,
|
contentInfo.owner,
|
||||||
gitHubInfo.repo,
|
contentInfo.repo,
|
||||||
gitHubInfo.branch,
|
contentInfo.branch,
|
||||||
gitHubInfo.path,
|
contentInfo.path,
|
||||||
1,
|
1,
|
||||||
1
|
1
|
||||||
);
|
);
|
||||||
|
@ -95,7 +96,7 @@ export class GitHubContentProvider implements IContentProvider {
|
||||||
gitHubFile.branch.name,
|
gitHubFile.branch.name,
|
||||||
commitMsg,
|
commitMsg,
|
||||||
gitHubFile.path,
|
gitHubFile.path,
|
||||||
GitHubUtils.fromGitHubUri(newUri).path
|
GitHubUtils.fromContentUri(newUri).path
|
||||||
);
|
);
|
||||||
if (response.status !== HttpStatusCodes.OK) {
|
if (response.status !== HttpStatusCodes.OK) {
|
||||||
throw new GitHubContentProviderError("Failed to rename", response.status);
|
throw new GitHubContentProviderError("Failed to rename", response.status);
|
||||||
|
@ -134,8 +135,8 @@ export class GitHubContentProvider implements IContentProvider {
|
||||||
throw new GitHubContentProviderError("Unsupported content type");
|
throw new GitHubContentProviderError("Unsupported content type");
|
||||||
}
|
}
|
||||||
|
|
||||||
const gitHubInfo = GitHubUtils.fromGitHubUri(uri);
|
const contentInfo = GitHubUtils.fromContentUri(uri);
|
||||||
if (!gitHubInfo) {
|
if (!contentInfo) {
|
||||||
throw new GitHubContentProviderError(`Failed to parse ${uri}`);
|
throw new GitHubContentProviderError(`Failed to parse ${uri}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -151,14 +152,14 @@ export class GitHubContentProvider implements IContentProvider {
|
||||||
};
|
};
|
||||||
const name = `Untitled-${new Date().toLocaleString("default", options)}.ipynb`;
|
const name = `Untitled-${new Date().toLocaleString("default", options)}.ipynb`;
|
||||||
let path = name;
|
let path = name;
|
||||||
if (gitHubInfo.path) {
|
if (contentInfo.path) {
|
||||||
path = `${gitHubInfo.path}/${name}`;
|
path = UrlUtility.createUri(contentInfo.path, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
const response = await this.params.gitHubClient.createOrUpdateFileAsync(
|
const response = await this.params.gitHubClient.createOrUpdateFileAsync(
|
||||||
gitHubInfo.owner,
|
contentInfo.owner,
|
||||||
gitHubInfo.repo,
|
contentInfo.repo,
|
||||||
gitHubInfo.branch,
|
contentInfo.branch,
|
||||||
path,
|
path,
|
||||||
commitMsg,
|
commitMsg,
|
||||||
content
|
content
|
||||||
|
@ -167,12 +168,7 @@ export class GitHubContentProvider implements IContentProvider {
|
||||||
throw new GitHubContentProviderError("Failed to create", response.status);
|
throw new GitHubContentProviderError("Failed to create", response.status);
|
||||||
}
|
}
|
||||||
|
|
||||||
const newUri = GitHubUtils.toGitHubUriForRepoAndBranch(
|
const newUri = GitHubUtils.toContentUri(contentInfo.owner, contentInfo.repo, contentInfo.branch, path);
|
||||||
gitHubInfo.owner,
|
|
||||||
gitHubInfo.repo,
|
|
||||||
gitHubInfo.branch,
|
|
||||||
path
|
|
||||||
);
|
|
||||||
const newContentResponse = await this.getContent(newUri);
|
const newContentResponse = await this.getContent(newUri);
|
||||||
if (newContentResponse.status !== HttpStatusCodes.OK) {
|
if (newContentResponse.status !== HttpStatusCodes.OK) {
|
||||||
throw new GitHubContentProviderError("Failed to get content after creating", newContentResponse.status);
|
throw new GitHubContentProviderError("Failed to get content after creating", newContentResponse.status);
|
||||||
|
@ -288,9 +284,9 @@ export class GitHubContentProvider implements IContentProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
private getContent(uri: string): Promise<IGitHubResponse<IGitHubFile | IGitHubFile[]>> {
|
private getContent(uri: string): Promise<IGitHubResponse<IGitHubFile | IGitHubFile[]>> {
|
||||||
const gitHubInfo = GitHubUtils.fromGitHubUri(uri);
|
const contentInfo = GitHubUtils.fromContentUri(uri);
|
||||||
if (gitHubInfo) {
|
if (contentInfo) {
|
||||||
const { owner, repo, branch, path } = gitHubInfo;
|
const { owner, repo, branch, path } = contentInfo;
|
||||||
return this.params.gitHubClient.getContentsAsync(owner, repo, branch, path);
|
return this.params.gitHubClient.getContentsAsync(owner, repo, branch, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -324,7 +320,7 @@ export class GitHubContentProvider implements IContentProvider {
|
||||||
commit: IGitHubCommit
|
commit: IGitHubCommit
|
||||||
): IContent<"directory"> {
|
): IContent<"directory"> {
|
||||||
return {
|
return {
|
||||||
name: NotebookUtil.getContentName(uri),
|
name: GitHubUtils.fromContentUri(uri).path,
|
||||||
path: uri,
|
path: uri,
|
||||||
type: "directory",
|
type: "directory",
|
||||||
writable: true, // TODO: tamitta: we don't know this info here
|
writable: true, // TODO: tamitta: we don't know this info here
|
||||||
|
@ -333,9 +329,14 @@ export class GitHubContentProvider implements IContentProvider {
|
||||||
mimetype: undefined,
|
mimetype: undefined,
|
||||||
content: gitHubFiles?.map(
|
content: gitHubFiles?.map(
|
||||||
(file: IGitHubFile) =>
|
(file: IGitHubFile) =>
|
||||||
this.createContentModel(GitHubUtils.toGitHubUriForFile(file), file, commit, {
|
this.createContentModel(
|
||||||
|
GitHubUtils.toContentUri(file.repo.owner.login, file.repo.name, file.branch.name, file.path),
|
||||||
|
file,
|
||||||
|
commit,
|
||||||
|
{
|
||||||
content: 0
|
content: 0
|
||||||
}) as IEmptyContent<FileType>
|
}
|
||||||
|
) as IEmptyContent<FileType>
|
||||||
),
|
),
|
||||||
format: "json"
|
format: "json"
|
||||||
};
|
};
|
||||||
|
@ -350,7 +351,12 @@ export class GitHubContentProvider implements IContentProvider {
|
||||||
gitHubFile.content && params.content !== 0 ? JSON.parse(atob(gitHubFile.content)) : undefined;
|
gitHubFile.content && params.content !== 0 ? JSON.parse(atob(gitHubFile.content)) : undefined;
|
||||||
return {
|
return {
|
||||||
name: gitHubFile.name,
|
name: gitHubFile.name,
|
||||||
path: GitHubUtils.toGitHubUriForFile(gitHubFile),
|
path: GitHubUtils.toContentUri(
|
||||||
|
gitHubFile.repo.owner.login,
|
||||||
|
gitHubFile.repo.name,
|
||||||
|
gitHubFile.branch.name,
|
||||||
|
gitHubFile.path
|
||||||
|
),
|
||||||
type: "notebook",
|
type: "notebook",
|
||||||
writable: true, // TODO: tamitta: we don't know this info here
|
writable: true, // TODO: tamitta: we don't know this info here
|
||||||
created: "", // TODO: tamitta: we don't know this info here
|
created: "", // TODO: tamitta: we don't know this info here
|
||||||
|
@ -369,7 +375,12 @@ export class GitHubContentProvider implements IContentProvider {
|
||||||
const content: string = gitHubFile.content && params.content !== 0 ? atob(gitHubFile.content) : undefined;
|
const content: string = gitHubFile.content && params.content !== 0 ? atob(gitHubFile.content) : undefined;
|
||||||
return {
|
return {
|
||||||
name: gitHubFile.name,
|
name: gitHubFile.name,
|
||||||
path: GitHubUtils.toGitHubUriForFile(gitHubFile),
|
path: GitHubUtils.toContentUri(
|
||||||
|
gitHubFile.repo.owner.login,
|
||||||
|
gitHubFile.repo.name,
|
||||||
|
gitHubFile.branch.name,
|
||||||
|
gitHubFile.path
|
||||||
|
),
|
||||||
type: "file",
|
type: "file",
|
||||||
writable: true, // TODO: tamitta: we don't know this info here
|
writable: true, // TODO: tamitta: we don't know this info here
|
||||||
created: "", // TODO: tamitta: we don't know this info here
|
created: "", // TODO: tamitta: we don't know this info here
|
||||||
|
|
|
@ -1,13 +1,5 @@
|
||||||
import * as ViewModels from "../Contracts/ViewModels";
|
|
||||||
import ko from "knockout";
|
|
||||||
import { AddDbUtilities } from "../Shared/AddDatabaseUtility";
|
import { AddDbUtilities } from "../Shared/AddDatabaseUtility";
|
||||||
import {
|
import { CreateCollectionUtilities, CreateSqlCollectionUtilities, Utilities } from "./AddCollectionUtility";
|
||||||
CollectionDefaults,
|
|
||||||
CreateCollectionUtilities,
|
|
||||||
CreateSqlCollectionUtilities,
|
|
||||||
Utilities
|
|
||||||
} from "./AddCollectionUtility";
|
|
||||||
import { CollectionStub, DatabaseStub, ExplorerStub } from "../Explorer/OpenActionsStubs";
|
|
||||||
jest.mock("AddDatabaseUtility");
|
jest.mock("AddDatabaseUtility");
|
||||||
|
|
||||||
const armEndpoint = "https://management.azure.com";
|
const armEndpoint = "https://management.azure.com";
|
||||||
|
@ -159,985 +151,3 @@ describe("Add Collection Utitlity", () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("Add Collection Utilility", () => {
|
|
||||||
describe("_getDefaults()", () => {
|
|
||||||
describe("default storage", () => {
|
|
||||||
describe("for Benefits subscriptions", () => {
|
|
||||||
it("should be '100' in flight '0'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("0", ViewModels.SubscriptionType.Benefits);
|
|
||||||
expect(value.storage).toBe("100");
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be '100' in flight '1'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("1", ViewModels.SubscriptionType.Benefits);
|
|
||||||
expect(value.storage).toBe("100");
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be '100' in flight '2'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("2", ViewModels.SubscriptionType.Benefits);
|
|
||||||
expect(value.storage).toBe("100");
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be '100' in flight '3'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("3", ViewModels.SubscriptionType.Benefits);
|
|
||||||
expect(value.storage).toBe("100");
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe("for EA subscriptions", () => {
|
|
||||||
it("should be '100' in flight '0'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("0", ViewModels.SubscriptionType.EA);
|
|
||||||
expect(value.storage).toBe("100");
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be '100' in flight '1'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("1", ViewModels.SubscriptionType.EA);
|
|
||||||
expect(value.storage).toBe("100");
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be '100' in flight '2'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("2", ViewModels.SubscriptionType.EA);
|
|
||||||
expect(value.storage).toBe("100");
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be '100' in flight '3'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("3", ViewModels.SubscriptionType.EA);
|
|
||||||
expect(value.storage).toBe("100");
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe("for Free subscriptions", () => {
|
|
||||||
it("should be '100' in flight '0'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("0", ViewModels.SubscriptionType.Free);
|
|
||||||
expect(value.storage).toBe("100");
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be '100' in flight '1'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("1", ViewModels.SubscriptionType.Free);
|
|
||||||
expect(value.storage).toBe("100");
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be '100' in flight '2'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("2", ViewModels.SubscriptionType.Free);
|
|
||||||
expect(value.storage).toBe("100");
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be '100' in flight '3'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("3", ViewModels.SubscriptionType.Free);
|
|
||||||
expect(value.storage).toBe("100");
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe("for Internal subscriptions", () => {
|
|
||||||
it("should be '100' in flight '0'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("0", ViewModels.SubscriptionType.Internal);
|
|
||||||
expect(value.storage).toBe("100");
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be '100' in flight '1'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("1", ViewModels.SubscriptionType.Internal);
|
|
||||||
expect(value.storage).toBe("100");
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be '100' in flight '2'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("2", ViewModels.SubscriptionType.Internal);
|
|
||||||
expect(value.storage).toBe("100");
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be '100' in flight '3'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("3", ViewModels.SubscriptionType.Internal);
|
|
||||||
expect(value.storage).toBe("100");
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe("for PAYG subscriptions", () => {
|
|
||||||
it("should be '100' in flight '0'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("0", ViewModels.SubscriptionType.PAYG);
|
|
||||||
expect(value.storage).toBe("100");
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be '100' in flight '1'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("1", ViewModels.SubscriptionType.PAYG);
|
|
||||||
expect(value.storage).toBe("100");
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be '100' in flight '2'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("2", ViewModels.SubscriptionType.PAYG);
|
|
||||||
expect(value.storage).toBe("100");
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be '100' in flight '3'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("3", ViewModels.SubscriptionType.PAYG);
|
|
||||||
expect(value.storage).toBe("100");
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe("default throughput for fixed collections", () => {
|
|
||||||
describe("for Benefits subscriptions", () => {
|
|
||||||
it("should be 400 in flight '0'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("0", ViewModels.SubscriptionType.Benefits);
|
|
||||||
expect(value.throughput.fixed).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '1'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("1", ViewModels.SubscriptionType.Benefits);
|
|
||||||
expect(value.throughput.fixed).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '2'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("2", ViewModels.SubscriptionType.Benefits);
|
|
||||||
expect(value.throughput.fixed).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '3'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("3", ViewModels.SubscriptionType.Benefits);
|
|
||||||
expect(value.throughput.fixed).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '20190618.1'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("20190618.1", ViewModels.SubscriptionType.Benefits);
|
|
||||||
expect(value.throughput.fixed).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '20190618.2'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("20190618.2", ViewModels.SubscriptionType.Benefits);
|
|
||||||
expect(value.throughput.fixed).toBe(400);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe("for EA subscriptions", () => {
|
|
||||||
it("should be 400 in flight '0'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("0", ViewModels.SubscriptionType.EA);
|
|
||||||
expect(value.throughput.fixed).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '1'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("1", ViewModels.SubscriptionType.EA);
|
|
||||||
expect(value.throughput.fixed).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '2'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("2", ViewModels.SubscriptionType.EA);
|
|
||||||
expect(value.throughput.fixed).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '3'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("3", ViewModels.SubscriptionType.EA);
|
|
||||||
expect(value.throughput.fixed).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '20190618.1'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("20190618.1", ViewModels.SubscriptionType.EA);
|
|
||||||
expect(value.throughput.fixed).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '20190618.2'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("20190618.2", ViewModels.SubscriptionType.EA);
|
|
||||||
expect(value.throughput.fixed).toBe(400);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe("for Free subscriptions", () => {
|
|
||||||
it("should be 400 in flight '0'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("0", ViewModels.SubscriptionType.Free);
|
|
||||||
expect(value.throughput.fixed).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '1'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("1", ViewModels.SubscriptionType.Free);
|
|
||||||
expect(value.throughput.fixed).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '2'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("2", ViewModels.SubscriptionType.Free);
|
|
||||||
expect(value.throughput.fixed).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '3'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("3", ViewModels.SubscriptionType.Free);
|
|
||||||
expect(value.throughput.fixed).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '20190618.1'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("20190618.1", ViewModels.SubscriptionType.Free);
|
|
||||||
expect(value.throughput.fixed).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '20190618.2'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("20190618.2", ViewModels.SubscriptionType.Free);
|
|
||||||
expect(value.throughput.fixed).toBe(400);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe("for Internal subscriptions", () => {
|
|
||||||
it("should be 400 in flight '0'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("0", ViewModels.SubscriptionType.Internal);
|
|
||||||
expect(value.throughput.fixed).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '1'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("1", ViewModels.SubscriptionType.Internal);
|
|
||||||
expect(value.throughput.fixed).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '2'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("2", ViewModels.SubscriptionType.Internal);
|
|
||||||
expect(value.throughput.fixed).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '3'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("3", ViewModels.SubscriptionType.Internal);
|
|
||||||
expect(value.throughput.fixed).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '20190618.1'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("20190618.1", ViewModels.SubscriptionType.Internal);
|
|
||||||
expect(value.throughput.fixed).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '20190618.2'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("20190618.2", ViewModels.SubscriptionType.Internal);
|
|
||||||
expect(value.throughput.fixed).toBe(400);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe("for PAYG subscriptions", () => {
|
|
||||||
it("should be 400 in flight '0'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("0", ViewModels.SubscriptionType.PAYG);
|
|
||||||
expect(value.throughput.fixed).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '1'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("1", ViewModels.SubscriptionType.PAYG);
|
|
||||||
expect(value.throughput.fixed).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '2'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("2", ViewModels.SubscriptionType.PAYG);
|
|
||||||
expect(value.throughput.fixed).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '3'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("3", ViewModels.SubscriptionType.PAYG);
|
|
||||||
expect(value.throughput.fixed).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '20190618.1'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("20190618.1", ViewModels.SubscriptionType.PAYG);
|
|
||||||
expect(value.throughput.fixed).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '20190618.2'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("20190618.2", ViewModels.SubscriptionType.PAYG);
|
|
||||||
expect(value.throughput.fixed).toBe(400);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe("default throughput for unlimited collections", () => {
|
|
||||||
describe("for Benefits subscriptions", () => {
|
|
||||||
it("should be 400 in flight '0'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("0", ViewModels.SubscriptionType.Benefits);
|
|
||||||
expect(value.throughput.unlimited(null)).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '1'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("1", ViewModels.SubscriptionType.Benefits);
|
|
||||||
expect(value.throughput.unlimited(null)).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '2'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("2", ViewModels.SubscriptionType.Benefits);
|
|
||||||
expect(value.throughput.unlimited(null)).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '3'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("3", ViewModels.SubscriptionType.Benefits);
|
|
||||||
expect(value.throughput.unlimited(null)).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '20190618.1'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("20190618.1", ViewModels.SubscriptionType.Benefits);
|
|
||||||
expect(value.throughput.unlimited(null)).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '20190618.2'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("20190618.2", ViewModels.SubscriptionType.Benefits);
|
|
||||||
expect(value.throughput.unlimited(null)).toBe(400);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe("for EA subscriptions", () => {
|
|
||||||
const explorer5 = new ExplorerStub();
|
|
||||||
explorer5.databases = ko.observableArray([
|
|
||||||
new DatabaseStub({
|
|
||||||
id: ko.observable("db"),
|
|
||||||
collections: ko.observableArray([
|
|
||||||
new CollectionStub({
|
|
||||||
id: ko.observable("1")
|
|
||||||
}),
|
|
||||||
new CollectionStub({
|
|
||||||
id: ko.observable("2")
|
|
||||||
}),
|
|
||||||
new CollectionStub({
|
|
||||||
id: ko.observable("3")
|
|
||||||
}),
|
|
||||||
new CollectionStub({
|
|
||||||
id: ko.observable("4")
|
|
||||||
}),
|
|
||||||
new CollectionStub({
|
|
||||||
id: ko.observable("5")
|
|
||||||
})
|
|
||||||
])
|
|
||||||
})
|
|
||||||
]);
|
|
||||||
|
|
||||||
const explorer6 = new ExplorerStub();
|
|
||||||
explorer6.databases = ko.observableArray([
|
|
||||||
new DatabaseStub({
|
|
||||||
id: ko.observable("db"),
|
|
||||||
collections: ko.observableArray([
|
|
||||||
new CollectionStub({
|
|
||||||
id: ko.observable("1")
|
|
||||||
}),
|
|
||||||
new CollectionStub({
|
|
||||||
id: ko.observable("2")
|
|
||||||
}),
|
|
||||||
new CollectionStub({
|
|
||||||
id: ko.observable("3")
|
|
||||||
}),
|
|
||||||
new CollectionStub({
|
|
||||||
id: ko.observable("4")
|
|
||||||
}),
|
|
||||||
new CollectionStub({
|
|
||||||
id: ko.observable("5")
|
|
||||||
}),
|
|
||||||
new CollectionStub({
|
|
||||||
id: ko.observable("6")
|
|
||||||
})
|
|
||||||
])
|
|
||||||
})
|
|
||||||
]);
|
|
||||||
|
|
||||||
it("should be 400 in flight '0'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("0", ViewModels.SubscriptionType.EA);
|
|
||||||
expect(value.throughput.unlimited(null)).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '1'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("1", ViewModels.SubscriptionType.EA);
|
|
||||||
expect(value.throughput.unlimited(null)).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '2'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("2", ViewModels.SubscriptionType.EA);
|
|
||||||
expect(value.throughput.unlimited(null)).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '3'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("3", ViewModels.SubscriptionType.EA);
|
|
||||||
expect(value.throughput.unlimited(null)).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 10,000 in flight '20190618.1' and database with 5 collections or less", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("20190618.1", ViewModels.SubscriptionType.EA);
|
|
||||||
expect(value.throughput.unlimited(explorer5)).toBe(10000);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 10,000 in flight '20190618.1' and database with more than 5 collections", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("20190618.1", ViewModels.SubscriptionType.EA);
|
|
||||||
expect(value.throughput.unlimited(explorer6)).toBe(1000);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 1,000 in flight '20190618.2'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("20190618.2", ViewModels.SubscriptionType.EA);
|
|
||||||
expect(value.throughput.unlimited(null)).toBe(1000);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe("for Free subscriptions", () => {
|
|
||||||
it("should be 400 in flight '0'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("0", ViewModels.SubscriptionType.Free);
|
|
||||||
expect(value.throughput.unlimited(null)).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '1'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("1", ViewModels.SubscriptionType.Free);
|
|
||||||
expect(value.throughput.unlimited(null)).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '2'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("2", ViewModels.SubscriptionType.Free);
|
|
||||||
expect(value.throughput.unlimited(null)).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '3'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("3", ViewModels.SubscriptionType.Free);
|
|
||||||
expect(value.throughput.unlimited(null)).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '20190618.1'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("20190618.1", ViewModels.SubscriptionType.Free);
|
|
||||||
expect(value.throughput.unlimited(null)).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '20190618.2'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("20190618.2", ViewModels.SubscriptionType.Free);
|
|
||||||
expect(value.throughput.unlimited(null)).toBe(400);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe("for Internal subscriptions", () => {
|
|
||||||
it("should be 400 in flight '0'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("0", ViewModels.SubscriptionType.Internal);
|
|
||||||
expect(value.throughput.unlimited(null)).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '1'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("1", ViewModels.SubscriptionType.Internal);
|
|
||||||
expect(value.throughput.unlimited(null)).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '2'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("2", ViewModels.SubscriptionType.Internal);
|
|
||||||
expect(value.throughput.unlimited(null)).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '3'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("3", ViewModels.SubscriptionType.Internal);
|
|
||||||
expect(value.throughput.unlimited(null)).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '20190618.1'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("20190618.1", ViewModels.SubscriptionType.Internal);
|
|
||||||
expect(value.throughput.unlimited(null)).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '20190618.2'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("20190618.2", ViewModels.SubscriptionType.Internal);
|
|
||||||
expect(value.throughput.unlimited(null)).toBe(400);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe("for PAYG subscriptions", () => {
|
|
||||||
it("should be 400 in flight '0'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("0", ViewModels.SubscriptionType.PAYG);
|
|
||||||
expect(value.throughput.unlimited(null)).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '1'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("1", ViewModels.SubscriptionType.PAYG);
|
|
||||||
expect(value.throughput.unlimited(null)).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '2'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("2", ViewModels.SubscriptionType.PAYG);
|
|
||||||
expect(value.throughput.unlimited(null)).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '3'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("3", ViewModels.SubscriptionType.PAYG);
|
|
||||||
expect(value.throughput.unlimited(null)).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '20190618.1'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("20190618.1", ViewModels.SubscriptionType.PAYG);
|
|
||||||
expect(value.throughput.unlimited(null)).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '20190618.2'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("20190618.2", ViewModels.SubscriptionType.PAYG);
|
|
||||||
expect(value.throughput.unlimited(null)).toBe(400);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe("min throughput for unlimited collections", () => {
|
|
||||||
describe("for Benefits subscriptions", () => {
|
|
||||||
it("should be 400 in flight '0'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("0", ViewModels.SubscriptionType.Benefits);
|
|
||||||
expect(value.throughput.unlimitedmin).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '1'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("1", ViewModels.SubscriptionType.Benefits);
|
|
||||||
expect(value.throughput.unlimitedmin).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '2'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("2", ViewModels.SubscriptionType.Benefits);
|
|
||||||
expect(value.throughput.unlimitedmin).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '3'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("3", ViewModels.SubscriptionType.Benefits);
|
|
||||||
expect(value.throughput.unlimitedmin).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '20190618.1'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("20190618.1", ViewModels.SubscriptionType.Benefits);
|
|
||||||
expect(value.throughput.unlimitedmin).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '20190618.2'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("20190618.2", ViewModels.SubscriptionType.Benefits);
|
|
||||||
expect(value.throughput.unlimitedmin).toBe(400);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe("for EA subscriptions", () => {
|
|
||||||
it("should be 400 in flight '0'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("0", ViewModels.SubscriptionType.EA);
|
|
||||||
expect(value.throughput.unlimitedmin).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '1'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("1", ViewModels.SubscriptionType.EA);
|
|
||||||
expect(value.throughput.unlimitedmin).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '2'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("2", ViewModels.SubscriptionType.EA);
|
|
||||||
expect(value.throughput.unlimitedmin).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '3'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("3", ViewModels.SubscriptionType.EA);
|
|
||||||
expect(value.throughput.unlimitedmin).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '20190618.1'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("20190618.1", ViewModels.SubscriptionType.EA);
|
|
||||||
expect(value.throughput.unlimitedmin).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '20190618.2'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("20190618.2", ViewModels.SubscriptionType.EA);
|
|
||||||
expect(value.throughput.unlimitedmin).toBe(400);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe("for Free subscriptions", () => {
|
|
||||||
it("should be 400 in flight '0'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("0", ViewModels.SubscriptionType.Free);
|
|
||||||
expect(value.throughput.unlimitedmin).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '1'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("1", ViewModels.SubscriptionType.Free);
|
|
||||||
expect(value.throughput.unlimitedmin).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '2'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("2", ViewModels.SubscriptionType.Free);
|
|
||||||
expect(value.throughput.unlimitedmin).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '3'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("3", ViewModels.SubscriptionType.Free);
|
|
||||||
expect(value.throughput.unlimitedmin).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '20190618.1'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("20190618.1", ViewModels.SubscriptionType.Free);
|
|
||||||
expect(value.throughput.unlimitedmin).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '20190618.2'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("20190618.2", ViewModels.SubscriptionType.Free);
|
|
||||||
expect(value.throughput.unlimitedmin).toBe(400);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe("for Internal subscriptions", () => {
|
|
||||||
it("should be 400 in flight '0'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("0", ViewModels.SubscriptionType.Internal);
|
|
||||||
expect(value.throughput.unlimitedmin).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '1'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("1", ViewModels.SubscriptionType.Internal);
|
|
||||||
expect(value.throughput.unlimitedmin).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '2'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("2", ViewModels.SubscriptionType.Internal);
|
|
||||||
expect(value.throughput.unlimitedmin).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '3'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("3", ViewModels.SubscriptionType.Internal);
|
|
||||||
expect(value.throughput.unlimitedmin).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '20190618.1'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("20190618.1", ViewModels.SubscriptionType.Internal);
|
|
||||||
expect(value.throughput.unlimitedmin).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '20190618.2'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("20190618.2", ViewModels.SubscriptionType.Internal);
|
|
||||||
expect(value.throughput.unlimitedmin).toBe(400);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe("for PAYG subscriptions", () => {
|
|
||||||
it("should be 400 in flight '0'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("0", ViewModels.SubscriptionType.PAYG);
|
|
||||||
expect(value.throughput.unlimitedmin).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '1'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("1", ViewModels.SubscriptionType.PAYG);
|
|
||||||
expect(value.throughput.unlimitedmin).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '2'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("2", ViewModels.SubscriptionType.PAYG);
|
|
||||||
expect(value.throughput.unlimitedmin).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '3'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("3", ViewModels.SubscriptionType.PAYG);
|
|
||||||
expect(value.throughput.unlimitedmin).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '20190618.1'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("20190618.1", ViewModels.SubscriptionType.PAYG);
|
|
||||||
expect(value.throughput.unlimitedmin).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '20190618.2'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("20190618.2", ViewModels.SubscriptionType.PAYG);
|
|
||||||
expect(value.throughput.unlimitedmin).toBe(400);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe("max throughput for unlimited collections", () => {
|
|
||||||
describe("for Benefits subscriptions", () => {
|
|
||||||
it("should be 100,000 in flight '0'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("0", ViewModels.SubscriptionType.Benefits);
|
|
||||||
expect(value.throughput.unlimitedmax).toBe(100000);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 100,000 in flight '1'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("1", ViewModels.SubscriptionType.Benefits);
|
|
||||||
expect(value.throughput.unlimitedmax).toBe(100000);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 100,000 in flight '2'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("2", ViewModels.SubscriptionType.Benefits);
|
|
||||||
expect(value.throughput.unlimitedmax).toBe(100000);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 100,000 in flight '3'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("3", ViewModels.SubscriptionType.Benefits);
|
|
||||||
expect(value.throughput.unlimitedmax).toBe(100000);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 100,000 in flight '20190618.1'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("20190618.1", ViewModels.SubscriptionType.Benefits);
|
|
||||||
expect(value.throughput.unlimitedmax).toBe(100000);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 100,000 in flight '20190618.2'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("20190618.2", ViewModels.SubscriptionType.Benefits);
|
|
||||||
expect(value.throughput.unlimitedmax).toBe(100000);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe("for EA subscriptions", () => {
|
|
||||||
it("should be 1,000,000 in flight '0'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("0", ViewModels.SubscriptionType.EA);
|
|
||||||
expect(value.throughput.unlimitedmax).toBe(1000000);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 1,000,000 in flight '1'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("1", ViewModels.SubscriptionType.EA);
|
|
||||||
expect(value.throughput.unlimitedmax).toBe(1000000);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 1,000,000 in flight '2'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("2", ViewModels.SubscriptionType.EA);
|
|
||||||
expect(value.throughput.unlimitedmax).toBe(1000000);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 1,000,000 in flight '3'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("3", ViewModels.SubscriptionType.EA);
|
|
||||||
expect(value.throughput.unlimitedmax).toBe(1000000);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 1,000,000 in flight '20190618.1'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("20190618.1", ViewModels.SubscriptionType.EA);
|
|
||||||
expect(value.throughput.unlimitedmax).toBe(1000000);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 1,000,000 in flight '20190618.2'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("20190618.2", ViewModels.SubscriptionType.EA);
|
|
||||||
expect(value.throughput.unlimitedmax).toBe(1000000);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe("for Free subscriptions", () => {
|
|
||||||
it("should be 100,000 in flight '0'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("0", ViewModels.SubscriptionType.Free);
|
|
||||||
expect(value.throughput.unlimitedmax).toBe(100000);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 100,000 in flight '1'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("1", ViewModels.SubscriptionType.Free);
|
|
||||||
expect(value.throughput.unlimitedmax).toBe(100000);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 100,000 in flight '2'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("2", ViewModels.SubscriptionType.Free);
|
|
||||||
expect(value.throughput.unlimitedmax).toBe(100000);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 100,000 in flight '3'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("3", ViewModels.SubscriptionType.Free);
|
|
||||||
expect(value.throughput.unlimitedmax).toBe(100000);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 100,000 in flight '20190618.1'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("20190618.1", ViewModels.SubscriptionType.Free);
|
|
||||||
expect(value.throughput.unlimitedmax).toBe(100000);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 100,000 in flight '20190618.2'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("20190618.2", ViewModels.SubscriptionType.Free);
|
|
||||||
expect(value.throughput.unlimitedmax).toBe(100000);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe("for Internal subscriptions", () => {
|
|
||||||
it("should be 100,000 in flight '0'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("0", ViewModels.SubscriptionType.Internal);
|
|
||||||
expect(value.throughput.unlimitedmax).toBe(100000);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 100,000 in flight '1'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("1", ViewModels.SubscriptionType.Internal);
|
|
||||||
expect(value.throughput.unlimitedmax).toBe(100000);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 100,000 in flight '2'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("2", ViewModels.SubscriptionType.Internal);
|
|
||||||
expect(value.throughput.unlimitedmax).toBe(100000);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 100,000 in flight '3'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("3", ViewModels.SubscriptionType.Internal);
|
|
||||||
expect(value.throughput.unlimitedmax).toBe(100000);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 100,000 in flight '20190618.1'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("20190618.1", ViewModels.SubscriptionType.Internal);
|
|
||||||
expect(value.throughput.unlimitedmax).toBe(100000);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 100,000 in flight '20190618.2'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("20190618.2", ViewModels.SubscriptionType.Internal);
|
|
||||||
expect(value.throughput.unlimitedmax).toBe(100000);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe("for PAYG subscriptions", () => {
|
|
||||||
it("should be 1,000,000 in flight '0'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("0", ViewModels.SubscriptionType.PAYG);
|
|
||||||
expect(value.throughput.unlimitedmax).toBe(1000000);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 1,000,000 in flight '1'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("1", ViewModels.SubscriptionType.PAYG);
|
|
||||||
expect(value.throughput.unlimitedmax).toBe(1000000);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 1,000,000 in flight '2'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("2", ViewModels.SubscriptionType.PAYG);
|
|
||||||
expect(value.throughput.unlimitedmax).toBe(1000000);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 1,000,000 in flight '3'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("3", ViewModels.SubscriptionType.PAYG);
|
|
||||||
expect(value.throughput.unlimitedmax).toBe(1000000);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 1,000,000 in flight '20190618.1'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("20190618.1", ViewModels.SubscriptionType.PAYG);
|
|
||||||
expect(value.throughput.unlimitedmax).toBe(1000000);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 1,000,000 in flight '20190618.2'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("20190618.2", ViewModels.SubscriptionType.PAYG);
|
|
||||||
expect(value.throughput.unlimitedmax).toBe(1000000);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe("default throughput for shared offers", () => {
|
|
||||||
describe("for Benefits subscriptions", () => {
|
|
||||||
it("should be 400 in flight '0'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("0", ViewModels.SubscriptionType.Benefits);
|
|
||||||
expect(value.throughput.shared).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '1'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("1", ViewModels.SubscriptionType.Benefits);
|
|
||||||
expect(value.throughput.shared).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '2'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("2", ViewModels.SubscriptionType.Benefits);
|
|
||||||
expect(value.throughput.shared).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '3'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("3", ViewModels.SubscriptionType.Benefits);
|
|
||||||
expect(value.throughput.shared).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '20190618.1'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("20190618.1", ViewModels.SubscriptionType.Benefits);
|
|
||||||
expect(value.throughput.shared).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '20190618.2'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("20190618.2", ViewModels.SubscriptionType.Benefits);
|
|
||||||
expect(value.throughput.shared).toBe(400);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe("for EA subscriptions", () => {
|
|
||||||
it("should be 400 in flight '0'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("0", ViewModels.SubscriptionType.EA);
|
|
||||||
expect(value.throughput.shared).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '1'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("1", ViewModels.SubscriptionType.EA);
|
|
||||||
expect(value.throughput.shared).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '2'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("2", ViewModels.SubscriptionType.EA);
|
|
||||||
expect(value.throughput.shared).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '3'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("3", ViewModels.SubscriptionType.EA);
|
|
||||||
expect(value.throughput.shared).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 20,000 in flight '20190618.1'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("20190618.1", ViewModels.SubscriptionType.EA);
|
|
||||||
expect(value.throughput.shared).toBe(20000);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 5,000 in flight '20190618.2'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("20190618.2", ViewModels.SubscriptionType.EA);
|
|
||||||
expect(value.throughput.shared).toBe(5000);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe("for Free subscriptions", () => {
|
|
||||||
it("should be 400 in flight '0'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("0", ViewModels.SubscriptionType.Free);
|
|
||||||
expect(value.throughput.shared).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '1'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("1", ViewModels.SubscriptionType.Free);
|
|
||||||
expect(value.throughput.shared).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '2'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("2", ViewModels.SubscriptionType.Free);
|
|
||||||
expect(value.throughput.shared).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '3'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("3", ViewModels.SubscriptionType.Free);
|
|
||||||
expect(value.throughput.shared).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '20190618.1'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("20190618.1", ViewModels.SubscriptionType.Free);
|
|
||||||
expect(value.throughput.shared).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '20190618.2'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("20190618.2", ViewModels.SubscriptionType.Free);
|
|
||||||
expect(value.throughput.shared).toBe(400);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe("for Internal subscriptions", () => {
|
|
||||||
it("should be 400 in flight '0'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("0", ViewModels.SubscriptionType.Internal);
|
|
||||||
expect(value.throughput.shared).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '1'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("1", ViewModels.SubscriptionType.Internal);
|
|
||||||
expect(value.throughput.shared).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '2'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("2", ViewModels.SubscriptionType.Internal);
|
|
||||||
expect(value.throughput.shared).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '3'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("3", ViewModels.SubscriptionType.Internal);
|
|
||||||
expect(value.throughput.shared).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '20190618.1'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("20190618.1", ViewModels.SubscriptionType.Internal);
|
|
||||||
expect(value.throughput.shared).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '20190618.2'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("20190618.2", ViewModels.SubscriptionType.Internal);
|
|
||||||
expect(value.throughput.shared).toBe(400);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe("for PAYG subscriptions", () => {
|
|
||||||
it("should be 400 in flight '0'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("0", ViewModels.SubscriptionType.PAYG);
|
|
||||||
expect(value.throughput.shared).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '1'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("1", ViewModels.SubscriptionType.PAYG);
|
|
||||||
expect(value.throughput.shared).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '2'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("2", ViewModels.SubscriptionType.PAYG);
|
|
||||||
expect(value.throughput.shared).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '3'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("3", ViewModels.SubscriptionType.PAYG);
|
|
||||||
expect(value.throughput.shared).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '20190618.1'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("20190618.1", ViewModels.SubscriptionType.PAYG);
|
|
||||||
expect(value.throughput.shared).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should be 400 in flight '20190618.2'", () => {
|
|
||||||
const value: CollectionDefaults = Utilities._getDefaults("20190618.2", ViewModels.SubscriptionType.PAYG);
|
|
||||||
expect(value.throughput.shared).toBe(400);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
|
@ -11,7 +11,6 @@ import { MessageHandler } from "../Common/MessageHandler";
|
||||||
import { MessageTypes } from "../Contracts/ExplorerContracts";
|
import { MessageTypes } from "../Contracts/ExplorerContracts";
|
||||||
import { NotificationConsoleUtils } from "../Utils/NotificationConsoleUtils";
|
import { NotificationConsoleUtils } from "../Utils/NotificationConsoleUtils";
|
||||||
import { ResourceProviderClient } from "../ResourceProvider/ResourceProviderClient";
|
import { ResourceProviderClient } from "../ResourceProvider/ResourceProviderClient";
|
||||||
import { SubscriptionType } from "../Contracts/ViewModels";
|
|
||||||
|
|
||||||
export class CreateSqlCollectionUtilities {
|
export class CreateSqlCollectionUtilities {
|
||||||
public static createSqlCollection(
|
public static createSqlCollection(
|
||||||
|
@ -243,61 +242,43 @@ export class Utilities {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static getDefaultStorage(flight: string, subscriptionType: SubscriptionType): string {
|
|
||||||
const flightDefaults: string = Utilities._getDefaults(flight, subscriptionType).storage;
|
|
||||||
return flightDefaults;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static getDefaultThroughput(flight: string, subscriptionType: SubscriptionType): ThroughputDefaults {
|
|
||||||
const flightDefaults: ThroughputDefaults = Utilities._getDefaults(flight, subscriptionType).throughput;
|
|
||||||
return flightDefaults;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static getMaxRUForStorageOption(
|
public static getMaxRUForStorageOption(
|
||||||
subscriptionType = SharedConstants.CollectionCreation.DefaultSubscriptionType,
|
defaults: ViewModels.CollectionCreationDefaults,
|
||||||
flight = SharedConstants.CollectionCreation.DefaultAddCollectionDefaultFlight,
|
|
||||||
storageOption: string
|
storageOption: string
|
||||||
): number {
|
): number {
|
||||||
if (storageOption === SharedConstants.CollectionCreation.storage10Gb) {
|
if (storageOption === SharedConstants.CollectionCreation.storage10Gb) {
|
||||||
return SharedConstants.CollectionCreation.DefaultCollectionRUs10K;
|
return SharedConstants.CollectionCreation.DefaultCollectionRUs10K;
|
||||||
}
|
}
|
||||||
|
|
||||||
const defaults = Utilities._getDefaults(flight, subscriptionType);
|
|
||||||
return defaults.throughput.unlimitedmax;
|
return defaults.throughput.unlimitedmax;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static getMinRUForStorageOption(
|
public static getMinRUForStorageOption(
|
||||||
subscriptionType = SharedConstants.CollectionCreation.DefaultSubscriptionType,
|
defaults: ViewModels.CollectionCreationDefaults,
|
||||||
flight = SharedConstants.CollectionCreation.DefaultAddCollectionDefaultFlight,
|
|
||||||
storageOption: string
|
storageOption: string
|
||||||
): number {
|
): number {
|
||||||
if (storageOption === SharedConstants.CollectionCreation.storage10Gb) {
|
if (storageOption === SharedConstants.CollectionCreation.storage10Gb) {
|
||||||
return SharedConstants.CollectionCreation.DefaultCollectionRUs400;
|
return SharedConstants.CollectionCreation.DefaultCollectionRUs400;
|
||||||
}
|
}
|
||||||
|
|
||||||
const collectionDefaults = Utilities._getCollectionDefaults(subscriptionType, flight);
|
return defaults.throughput.unlimitedmin;
|
||||||
|
|
||||||
return collectionDefaults.throughput.unlimitedmin;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static _getDefaults(flight: string, subscriptionType: SubscriptionType): CollectionDefaults {
|
public static getMaxThroughput(
|
||||||
return Utilities._getCollectionDefaults(subscriptionType, flight);
|
defaults: ViewModels.CollectionCreationDefaults,
|
||||||
|
container: ViewModels.Explorer
|
||||||
|
): number {
|
||||||
|
const throughput = defaults.throughput.unlimited;
|
||||||
|
if (typeof throughput === "number") {
|
||||||
|
return throughput;
|
||||||
|
} else {
|
||||||
|
return this._exceedsThreshold(throughput.collectionThreshold, container)
|
||||||
|
? throughput.greatThanThreshold
|
||||||
|
: throughput.lessThanOrEqualToThreshold;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static _getCollectionDefaults(
|
private static _exceedsThreshold(unlimitedThreshold: number, container: ViewModels.Explorer): boolean {
|
||||||
subscriptionType = SharedConstants.CollectionCreation.DefaultSubscriptionType,
|
|
||||||
flight = SharedConstants.CollectionCreation.DefaultAddCollectionDefaultFlight
|
|
||||||
): CollectionDefaults {
|
|
||||||
if (!(flight in Utilities._defaultsMap)) {
|
|
||||||
flight = SharedConstants.CollectionCreation.DefaultAddCollectionDefaultFlight;
|
|
||||||
}
|
|
||||||
|
|
||||||
return Utilities._defaultsMap[flight][SubscriptionType[subscriptionType]];
|
|
||||||
}
|
|
||||||
|
|
||||||
private static _exceedsThreshold(container: ViewModels.Explorer): boolean {
|
|
||||||
const unlimitedThreshold: number = 5;
|
|
||||||
|
|
||||||
const databases = (container && container.databases && container.databases()) || [];
|
const databases = (container && container.databases && container.databases()) || [];
|
||||||
return _.any(
|
return _.any(
|
||||||
databases,
|
databases,
|
||||||
|
@ -306,340 +287,9 @@ export class Utilities {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static _defaultsMap: { [flight: string]: { [subscriptionType: string]: CollectionDefaults } } = {
|
|
||||||
"0": {
|
|
||||||
Benefits: {
|
|
||||||
storage: SharedConstants.CollectionCreation.storage100Gb,
|
|
||||||
throughput: {
|
|
||||||
fixed: SharedConstants.CollectionCreation.DefaultCollectionRUs400,
|
|
||||||
unlimited: () => SharedConstants.CollectionCreation.DefaultCollectionRUs400,
|
|
||||||
unlimitedmax: SharedConstants.CollectionCreation.DefaultCollectionRUs100K,
|
|
||||||
unlimitedmin: SharedConstants.CollectionCreation.DefaultCollectionRUs400,
|
|
||||||
shared: SharedConstants.CollectionCreation.DefaultCollectionRUs400
|
|
||||||
}
|
|
||||||
},
|
|
||||||
Free: {
|
|
||||||
storage: SharedConstants.CollectionCreation.storage100Gb,
|
|
||||||
throughput: {
|
|
||||||
fixed: SharedConstants.CollectionCreation.DefaultCollectionRUs400,
|
|
||||||
unlimited: () => SharedConstants.CollectionCreation.DefaultCollectionRUs400,
|
|
||||||
unlimitedmax: SharedConstants.CollectionCreation.DefaultCollectionRUs100K,
|
|
||||||
unlimitedmin: SharedConstants.CollectionCreation.DefaultCollectionRUs400,
|
|
||||||
shared: SharedConstants.CollectionCreation.DefaultCollectionRUs400
|
|
||||||
}
|
|
||||||
},
|
|
||||||
EA: {
|
|
||||||
storage: SharedConstants.CollectionCreation.storage100Gb,
|
|
||||||
throughput: {
|
|
||||||
fixed: SharedConstants.CollectionCreation.DefaultCollectionRUs400,
|
|
||||||
unlimited: () => SharedConstants.CollectionCreation.DefaultCollectionRUs400,
|
|
||||||
unlimitedmax: SharedConstants.CollectionCreation.DefaultCollectionRUs1Million,
|
|
||||||
unlimitedmin: SharedConstants.CollectionCreation.DefaultCollectionRUs400,
|
|
||||||
shared: SharedConstants.CollectionCreation.DefaultCollectionRUs400
|
|
||||||
}
|
|
||||||
},
|
|
||||||
Internal: {
|
|
||||||
storage: SharedConstants.CollectionCreation.storage100Gb,
|
|
||||||
throughput: {
|
|
||||||
fixed: SharedConstants.CollectionCreation.DefaultCollectionRUs400,
|
|
||||||
unlimited: () => SharedConstants.CollectionCreation.DefaultCollectionRUs400,
|
|
||||||
unlimitedmax: SharedConstants.CollectionCreation.DefaultCollectionRUs100K,
|
|
||||||
unlimitedmin: SharedConstants.CollectionCreation.DefaultCollectionRUs400,
|
|
||||||
shared: SharedConstants.CollectionCreation.DefaultCollectionRUs400
|
|
||||||
}
|
|
||||||
},
|
|
||||||
PAYG: {
|
|
||||||
storage: SharedConstants.CollectionCreation.storage100Gb,
|
|
||||||
throughput: {
|
|
||||||
fixed: SharedConstants.CollectionCreation.DefaultCollectionRUs400,
|
|
||||||
unlimited: () => SharedConstants.CollectionCreation.DefaultCollectionRUs400,
|
|
||||||
unlimitedmax: SharedConstants.CollectionCreation.DefaultCollectionRUs1Million,
|
|
||||||
unlimitedmin: SharedConstants.CollectionCreation.DefaultCollectionRUs400,
|
|
||||||
shared: SharedConstants.CollectionCreation.DefaultCollectionRUs400
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"1": {
|
|
||||||
Benefits: {
|
|
||||||
storage: SharedConstants.CollectionCreation.storage100Gb,
|
|
||||||
throughput: {
|
|
||||||
fixed: SharedConstants.CollectionCreation.DefaultCollectionRUs400,
|
|
||||||
unlimited: () => SharedConstants.CollectionCreation.DefaultCollectionRUs400,
|
|
||||||
unlimitedmax: SharedConstants.CollectionCreation.DefaultCollectionRUs100K,
|
|
||||||
unlimitedmin: SharedConstants.CollectionCreation.DefaultCollectionRUs400,
|
|
||||||
shared: SharedConstants.CollectionCreation.DefaultCollectionRUs400
|
|
||||||
}
|
|
||||||
},
|
|
||||||
Free: {
|
|
||||||
storage: SharedConstants.CollectionCreation.storage100Gb,
|
|
||||||
throughput: {
|
|
||||||
fixed: SharedConstants.CollectionCreation.DefaultCollectionRUs400,
|
|
||||||
unlimited: () => SharedConstants.CollectionCreation.DefaultCollectionRUs400,
|
|
||||||
unlimitedmax: SharedConstants.CollectionCreation.DefaultCollectionRUs100K,
|
|
||||||
unlimitedmin: SharedConstants.CollectionCreation.DefaultCollectionRUs400,
|
|
||||||
shared: SharedConstants.CollectionCreation.DefaultCollectionRUs400
|
|
||||||
}
|
|
||||||
},
|
|
||||||
EA: {
|
|
||||||
storage: SharedConstants.CollectionCreation.storage100Gb,
|
|
||||||
throughput: {
|
|
||||||
fixed: SharedConstants.CollectionCreation.DefaultCollectionRUs400,
|
|
||||||
unlimited: () => SharedConstants.CollectionCreation.DefaultCollectionRUs400,
|
|
||||||
unlimitedmax: SharedConstants.CollectionCreation.DefaultCollectionRUs1Million,
|
|
||||||
unlimitedmin: SharedConstants.CollectionCreation.DefaultCollectionRUs400,
|
|
||||||
shared: SharedConstants.CollectionCreation.DefaultCollectionRUs400
|
|
||||||
}
|
|
||||||
},
|
|
||||||
Internal: {
|
|
||||||
storage: SharedConstants.CollectionCreation.storage100Gb,
|
|
||||||
throughput: {
|
|
||||||
fixed: SharedConstants.CollectionCreation.DefaultCollectionRUs400,
|
|
||||||
unlimited: () => SharedConstants.CollectionCreation.DefaultCollectionRUs400,
|
|
||||||
unlimitedmax: SharedConstants.CollectionCreation.DefaultCollectionRUs100K,
|
|
||||||
unlimitedmin: SharedConstants.CollectionCreation.DefaultCollectionRUs400,
|
|
||||||
shared: SharedConstants.CollectionCreation.DefaultCollectionRUs400
|
|
||||||
}
|
|
||||||
},
|
|
||||||
PAYG: {
|
|
||||||
storage: SharedConstants.CollectionCreation.storage100Gb,
|
|
||||||
throughput: {
|
|
||||||
fixed: SharedConstants.CollectionCreation.DefaultCollectionRUs400,
|
|
||||||
unlimited: () => SharedConstants.CollectionCreation.DefaultCollectionRUs400,
|
|
||||||
unlimitedmax: SharedConstants.CollectionCreation.DefaultCollectionRUs1Million,
|
|
||||||
unlimitedmin: SharedConstants.CollectionCreation.DefaultCollectionRUs400,
|
|
||||||
shared: SharedConstants.CollectionCreation.DefaultCollectionRUs400
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"2": {
|
|
||||||
Benefits: {
|
|
||||||
storage: SharedConstants.CollectionCreation.storage100Gb,
|
|
||||||
throughput: {
|
|
||||||
fixed: SharedConstants.CollectionCreation.DefaultCollectionRUs400,
|
|
||||||
unlimited: () => SharedConstants.CollectionCreation.DefaultCollectionRUs400,
|
|
||||||
unlimitedmax: SharedConstants.CollectionCreation.DefaultCollectionRUs100K,
|
|
||||||
unlimitedmin: SharedConstants.CollectionCreation.DefaultCollectionRUs400,
|
|
||||||
shared: SharedConstants.CollectionCreation.DefaultCollectionRUs400
|
|
||||||
}
|
|
||||||
},
|
|
||||||
Free: {
|
|
||||||
storage: SharedConstants.CollectionCreation.storage100Gb,
|
|
||||||
throughput: {
|
|
||||||
fixed: SharedConstants.CollectionCreation.DefaultCollectionRUs400,
|
|
||||||
unlimited: () => SharedConstants.CollectionCreation.DefaultCollectionRUs400,
|
|
||||||
unlimitedmax: SharedConstants.CollectionCreation.DefaultCollectionRUs100K,
|
|
||||||
unlimitedmin: SharedConstants.CollectionCreation.DefaultCollectionRUs400,
|
|
||||||
shared: SharedConstants.CollectionCreation.DefaultCollectionRUs400
|
|
||||||
}
|
|
||||||
},
|
|
||||||
EA: {
|
|
||||||
storage: SharedConstants.CollectionCreation.storage100Gb,
|
|
||||||
throughput: {
|
|
||||||
fixed: SharedConstants.CollectionCreation.DefaultCollectionRUs400,
|
|
||||||
unlimited: () => SharedConstants.CollectionCreation.DefaultCollectionRUs400,
|
|
||||||
unlimitedmax: SharedConstants.CollectionCreation.DefaultCollectionRUs1Million,
|
|
||||||
unlimitedmin: SharedConstants.CollectionCreation.DefaultCollectionRUs400,
|
|
||||||
shared: SharedConstants.CollectionCreation.DefaultCollectionRUs400
|
|
||||||
}
|
|
||||||
},
|
|
||||||
Internal: {
|
|
||||||
storage: SharedConstants.CollectionCreation.storage100Gb,
|
|
||||||
throughput: {
|
|
||||||
fixed: SharedConstants.CollectionCreation.DefaultCollectionRUs400,
|
|
||||||
unlimited: () => SharedConstants.CollectionCreation.DefaultCollectionRUs400,
|
|
||||||
unlimitedmax: SharedConstants.CollectionCreation.DefaultCollectionRUs100K,
|
|
||||||
unlimitedmin: SharedConstants.CollectionCreation.DefaultCollectionRUs400,
|
|
||||||
shared: SharedConstants.CollectionCreation.DefaultCollectionRUs400
|
|
||||||
}
|
|
||||||
},
|
|
||||||
PAYG: {
|
|
||||||
storage: SharedConstants.CollectionCreation.storage100Gb,
|
|
||||||
throughput: {
|
|
||||||
fixed: SharedConstants.CollectionCreation.DefaultCollectionRUs400,
|
|
||||||
unlimited: () => SharedConstants.CollectionCreation.DefaultCollectionRUs400,
|
|
||||||
unlimitedmax: SharedConstants.CollectionCreation.DefaultCollectionRUs1Million,
|
|
||||||
unlimitedmin: SharedConstants.CollectionCreation.DefaultCollectionRUs400,
|
|
||||||
shared: SharedConstants.CollectionCreation.DefaultCollectionRUs400
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"3": {
|
|
||||||
Benefits: {
|
|
||||||
storage: SharedConstants.CollectionCreation.storage100Gb,
|
|
||||||
throughput: {
|
|
||||||
fixed: SharedConstants.CollectionCreation.DefaultCollectionRUs400,
|
|
||||||
unlimited: () => SharedConstants.CollectionCreation.DefaultCollectionRUs400,
|
|
||||||
unlimitedmax: SharedConstants.CollectionCreation.DefaultCollectionRUs100K,
|
|
||||||
unlimitedmin: SharedConstants.CollectionCreation.DefaultCollectionRUs400,
|
|
||||||
shared: SharedConstants.CollectionCreation.DefaultCollectionRUs400
|
|
||||||
}
|
|
||||||
},
|
|
||||||
Free: {
|
|
||||||
storage: SharedConstants.CollectionCreation.storage100Gb,
|
|
||||||
throughput: {
|
|
||||||
fixed: SharedConstants.CollectionCreation.DefaultCollectionRUs400,
|
|
||||||
unlimited: () => SharedConstants.CollectionCreation.DefaultCollectionRUs400,
|
|
||||||
unlimitedmax: SharedConstants.CollectionCreation.DefaultCollectionRUs100K,
|
|
||||||
unlimitedmin: SharedConstants.CollectionCreation.DefaultCollectionRUs400,
|
|
||||||
shared: SharedConstants.CollectionCreation.DefaultCollectionRUs400
|
|
||||||
}
|
|
||||||
},
|
|
||||||
EA: {
|
|
||||||
storage: SharedConstants.CollectionCreation.storage100Gb,
|
|
||||||
throughput: {
|
|
||||||
fixed: SharedConstants.CollectionCreation.DefaultCollectionRUs400,
|
|
||||||
unlimited: () => SharedConstants.CollectionCreation.DefaultCollectionRUs400,
|
|
||||||
unlimitedmax: SharedConstants.CollectionCreation.DefaultCollectionRUs1Million,
|
|
||||||
unlimitedmin: SharedConstants.CollectionCreation.DefaultCollectionRUs400,
|
|
||||||
shared: SharedConstants.CollectionCreation.DefaultCollectionRUs400
|
|
||||||
}
|
|
||||||
},
|
|
||||||
Internal: {
|
|
||||||
storage: SharedConstants.CollectionCreation.storage100Gb,
|
|
||||||
throughput: {
|
|
||||||
fixed: SharedConstants.CollectionCreation.DefaultCollectionRUs400,
|
|
||||||
unlimited: () => SharedConstants.CollectionCreation.DefaultCollectionRUs400,
|
|
||||||
unlimitedmax: SharedConstants.CollectionCreation.DefaultCollectionRUs100K,
|
|
||||||
unlimitedmin: SharedConstants.CollectionCreation.DefaultCollectionRUs400,
|
|
||||||
shared: SharedConstants.CollectionCreation.DefaultCollectionRUs400
|
|
||||||
}
|
|
||||||
},
|
|
||||||
PAYG: {
|
|
||||||
storage: SharedConstants.CollectionCreation.storage100Gb,
|
|
||||||
throughput: {
|
|
||||||
fixed: SharedConstants.CollectionCreation.DefaultCollectionRUs400,
|
|
||||||
unlimited: () => SharedConstants.CollectionCreation.DefaultCollectionRUs400,
|
|
||||||
unlimitedmax: SharedConstants.CollectionCreation.DefaultCollectionRUs1Million,
|
|
||||||
unlimitedmin: SharedConstants.CollectionCreation.DefaultCollectionRUs400,
|
|
||||||
shared: SharedConstants.CollectionCreation.DefaultCollectionRUs400
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"20190618.1": {
|
|
||||||
Benefits: {
|
|
||||||
storage: SharedConstants.CollectionCreation.storage100Gb,
|
|
||||||
throughput: {
|
|
||||||
fixed: SharedConstants.CollectionCreation.DefaultCollectionRUs400,
|
|
||||||
unlimited: () => SharedConstants.CollectionCreation.DefaultCollectionRUs400,
|
|
||||||
unlimitedmax: SharedConstants.CollectionCreation.DefaultCollectionRUs100K,
|
|
||||||
unlimitedmin: SharedConstants.CollectionCreation.DefaultCollectionRUs400,
|
|
||||||
shared: SharedConstants.CollectionCreation.DefaultCollectionRUs400
|
|
||||||
}
|
|
||||||
},
|
|
||||||
Free: {
|
|
||||||
storage: SharedConstants.CollectionCreation.storage100Gb,
|
|
||||||
throughput: {
|
|
||||||
fixed: SharedConstants.CollectionCreation.DefaultCollectionRUs400,
|
|
||||||
unlimited: () => SharedConstants.CollectionCreation.DefaultCollectionRUs400,
|
|
||||||
unlimitedmax: SharedConstants.CollectionCreation.DefaultCollectionRUs100K,
|
|
||||||
unlimitedmin: SharedConstants.CollectionCreation.DefaultCollectionRUs400,
|
|
||||||
shared: SharedConstants.CollectionCreation.DefaultCollectionRUs400
|
|
||||||
}
|
|
||||||
},
|
|
||||||
EA: {
|
|
||||||
storage: SharedConstants.CollectionCreation.storage100Gb,
|
|
||||||
throughput: {
|
|
||||||
fixed: SharedConstants.CollectionCreation.DefaultCollectionRUs400,
|
|
||||||
unlimited: container =>
|
|
||||||
Utilities._exceedsThreshold(container)
|
|
||||||
? SharedConstants.CollectionCreation.DefaultCollectionRUs1000
|
|
||||||
: SharedConstants.CollectionCreation.DefaultCollectionRUs10K,
|
|
||||||
unlimitedmax: SharedConstants.CollectionCreation.DefaultCollectionRUs1Million,
|
|
||||||
unlimitedmin: SharedConstants.CollectionCreation.DefaultCollectionRUs400,
|
|
||||||
shared: SharedConstants.CollectionCreation.DefaultCollectionRUs20000
|
|
||||||
}
|
|
||||||
},
|
|
||||||
Internal: {
|
|
||||||
storage: SharedConstants.CollectionCreation.storage100Gb,
|
|
||||||
throughput: {
|
|
||||||
fixed: SharedConstants.CollectionCreation.DefaultCollectionRUs400,
|
|
||||||
unlimited: () => SharedConstants.CollectionCreation.DefaultCollectionRUs400,
|
|
||||||
unlimitedmax: SharedConstants.CollectionCreation.DefaultCollectionRUs100K,
|
|
||||||
unlimitedmin: SharedConstants.CollectionCreation.DefaultCollectionRUs400,
|
|
||||||
shared: SharedConstants.CollectionCreation.DefaultCollectionRUs400
|
|
||||||
}
|
|
||||||
},
|
|
||||||
PAYG: {
|
|
||||||
storage: SharedConstants.CollectionCreation.storage100Gb,
|
|
||||||
throughput: {
|
|
||||||
fixed: SharedConstants.CollectionCreation.DefaultCollectionRUs400,
|
|
||||||
unlimited: () => SharedConstants.CollectionCreation.DefaultCollectionRUs400,
|
|
||||||
unlimitedmax: SharedConstants.CollectionCreation.DefaultCollectionRUs1Million,
|
|
||||||
unlimitedmin: SharedConstants.CollectionCreation.DefaultCollectionRUs400,
|
|
||||||
shared: SharedConstants.CollectionCreation.DefaultCollectionRUs400
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"20190618.2": {
|
|
||||||
Benefits: {
|
|
||||||
storage: SharedConstants.CollectionCreation.storage100Gb,
|
|
||||||
throughput: {
|
|
||||||
fixed: SharedConstants.CollectionCreation.DefaultCollectionRUs400,
|
|
||||||
unlimited: () => SharedConstants.CollectionCreation.DefaultCollectionRUs400,
|
|
||||||
unlimitedmax: SharedConstants.CollectionCreation.DefaultCollectionRUs100K,
|
|
||||||
unlimitedmin: SharedConstants.CollectionCreation.DefaultCollectionRUs400,
|
|
||||||
shared: SharedConstants.CollectionCreation.DefaultCollectionRUs400
|
|
||||||
}
|
|
||||||
},
|
|
||||||
Free: {
|
|
||||||
storage: SharedConstants.CollectionCreation.storage100Gb,
|
|
||||||
throughput: {
|
|
||||||
fixed: SharedConstants.CollectionCreation.DefaultCollectionRUs400,
|
|
||||||
unlimited: () => SharedConstants.CollectionCreation.DefaultCollectionRUs400,
|
|
||||||
unlimitedmax: SharedConstants.CollectionCreation.DefaultCollectionRUs100K,
|
|
||||||
unlimitedmin: SharedConstants.CollectionCreation.DefaultCollectionRUs400,
|
|
||||||
shared: SharedConstants.CollectionCreation.DefaultCollectionRUs400
|
|
||||||
}
|
|
||||||
},
|
|
||||||
EA: {
|
|
||||||
storage: SharedConstants.CollectionCreation.storage100Gb,
|
|
||||||
throughput: {
|
|
||||||
fixed: SharedConstants.CollectionCreation.DefaultCollectionRUs400,
|
|
||||||
unlimited: () => SharedConstants.CollectionCreation.DefaultCollectionRUs1000,
|
|
||||||
unlimitedmax: SharedConstants.CollectionCreation.DefaultCollectionRUs1Million,
|
|
||||||
unlimitedmin: SharedConstants.CollectionCreation.DefaultCollectionRUs400,
|
|
||||||
shared: SharedConstants.CollectionCreation.DefaultCollectionRUs5000
|
|
||||||
}
|
|
||||||
},
|
|
||||||
Internal: {
|
|
||||||
storage: SharedConstants.CollectionCreation.storage100Gb,
|
|
||||||
throughput: {
|
|
||||||
fixed: SharedConstants.CollectionCreation.DefaultCollectionRUs400,
|
|
||||||
unlimited: () => SharedConstants.CollectionCreation.DefaultCollectionRUs400,
|
|
||||||
unlimitedmax: SharedConstants.CollectionCreation.DefaultCollectionRUs100K,
|
|
||||||
unlimitedmin: SharedConstants.CollectionCreation.DefaultCollectionRUs400,
|
|
||||||
shared: SharedConstants.CollectionCreation.DefaultCollectionRUs400
|
|
||||||
}
|
|
||||||
},
|
|
||||||
PAYG: {
|
|
||||||
storage: SharedConstants.CollectionCreation.storage100Gb,
|
|
||||||
throughput: {
|
|
||||||
fixed: SharedConstants.CollectionCreation.DefaultCollectionRUs400,
|
|
||||||
unlimited: () => SharedConstants.CollectionCreation.DefaultCollectionRUs400,
|
|
||||||
unlimitedmax: SharedConstants.CollectionCreation.DefaultCollectionRUs1Million,
|
|
||||||
unlimitedmin: SharedConstants.CollectionCreation.DefaultCollectionRUs400,
|
|
||||||
shared: SharedConstants.CollectionCreation.DefaultCollectionRUs400
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
private static _getAzureTableUri(params: DataModels.CreateDatabaseAndCollectionRequest): string {
|
private static _getAzureTableUri(params: DataModels.CreateDatabaseAndCollectionRequest): string {
|
||||||
return `subscriptions/${CosmosClient.subscriptionId()}/resourceGroups/${CosmosClient.resourceGroup()}/providers/Microsoft.DocumentDB/databaseAccounts/${
|
return `subscriptions/${CosmosClient.subscriptionId()}/resourceGroups/${CosmosClient.resourceGroup()}/providers/Microsoft.DocumentDB/databaseAccounts/${
|
||||||
CosmosClient.databaseAccount().name
|
CosmosClient.databaseAccount().name
|
||||||
}/tables/${params.collectionId}`;
|
}/tables/${params.collectionId}`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CollectionDefaults {
|
|
||||||
storage: string;
|
|
||||||
throughput: ThroughputDefaults;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ThroughputDefaults {
|
|
||||||
fixed: number;
|
|
||||||
unlimited: (explorer: ViewModels.Explorer) => number;
|
|
||||||
unlimitedmax: number;
|
|
||||||
unlimitedmin: number;
|
|
||||||
shared: number;
|
|
||||||
}
|
|
||||||
|
|
|
@ -51,7 +51,7 @@ describe("Add Database Utitlity", () => {
|
||||||
resourceProviderClientPutAsyncSpy
|
resourceProviderClientPutAsyncSpy
|
||||||
).toHaveBeenCalledWith(
|
).toHaveBeenCalledWith(
|
||||||
"subscriptions/a1/resourceGroups/b1/providers/Microsoft.DocumentDB/databaseAccounts/main/gremlinDatabases/a1-db",
|
"subscriptions/a1/resourceGroups/b1/providers/Microsoft.DocumentDB/databaseAccounts/main/gremlinDatabases/a1-db",
|
||||||
"2020-03-01",
|
"2020-04-01",
|
||||||
{ properties: { options: { throughput: "50000" }, resource: { id: "a1-db" } } }
|
{ properties: { options: { throughput: "50000" }, resource: { id: "a1-db" } } }
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -63,7 +63,7 @@ describe("Add Database Utitlity", () => {
|
||||||
resourceProviderClientPutAsyncSpy
|
resourceProviderClientPutAsyncSpy
|
||||||
).toHaveBeenCalledWith(
|
).toHaveBeenCalledWith(
|
||||||
"subscriptions/a1/resourceGroups/b1/providers/Microsoft.DocumentDB/databaseAccounts/main/gremlinDatabases/a1-db",
|
"subscriptions/a1/resourceGroups/b1/providers/Microsoft.DocumentDB/databaseAccounts/main/gremlinDatabases/a1-db",
|
||||||
"2020-03-01",
|
"2020-04-01",
|
||||||
{ properties: { options: { "x-ms-cosmos-offer-autopilot-tier": "1" }, resource: { id: "a1-db" } } }
|
{ properties: { options: { "x-ms-cosmos-offer-autopilot-tier": "1" }, resource: { id: "a1-db" } } }
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -85,7 +85,7 @@ describe("Add Database Utitlity", () => {
|
||||||
resourceProviderClientPutAsyncSpy
|
resourceProviderClientPutAsyncSpy
|
||||||
).toHaveBeenCalledWith(
|
).toHaveBeenCalledWith(
|
||||||
"subscriptions/a2/resourceGroups/c1/providers/Microsoft.DocumentDB/databaseAccounts/main/gremlinDatabases/a2-db",
|
"subscriptions/a2/resourceGroups/c1/providers/Microsoft.DocumentDB/databaseAccounts/main/gremlinDatabases/a2-db",
|
||||||
"2020-03-01",
|
"2020-04-01",
|
||||||
{ properties: { options: {}, resource: { id: "a2-db" } } }
|
{ properties: { options: {}, resource: { id: "a2-db" } } }
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -111,7 +111,7 @@ describe("Add Database Utitlity", () => {
|
||||||
resourceProviderClientPutAsyncSpy
|
resourceProviderClientPutAsyncSpy
|
||||||
).toHaveBeenCalledWith(
|
).toHaveBeenCalledWith(
|
||||||
"subscriptions/a1/resourceGroups/b1/providers/Microsoft.DocumentDB/databaseAccounts/main/sqlDatabases/a1-db",
|
"subscriptions/a1/resourceGroups/b1/providers/Microsoft.DocumentDB/databaseAccounts/main/sqlDatabases/a1-db",
|
||||||
"2020-03-01",
|
"2020-04-01",
|
||||||
{ properties: { options: { throughput: "50000" }, resource: { id: "a1-db" } } }
|
{ properties: { options: { throughput: "50000" }, resource: { id: "a1-db" } } }
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -123,7 +123,7 @@ describe("Add Database Utitlity", () => {
|
||||||
resourceProviderClientPutAsyncSpy
|
resourceProviderClientPutAsyncSpy
|
||||||
).toHaveBeenCalledWith(
|
).toHaveBeenCalledWith(
|
||||||
"subscriptions/a1/resourceGroups/b1/providers/Microsoft.DocumentDB/databaseAccounts/main/sqlDatabases/a1-db",
|
"subscriptions/a1/resourceGroups/b1/providers/Microsoft.DocumentDB/databaseAccounts/main/sqlDatabases/a1-db",
|
||||||
"2020-03-01",
|
"2020-04-01",
|
||||||
{ properties: { options: { "x-ms-cosmos-offer-autopilot-tier": "1" }, resource: { id: "a1-db" } } }
|
{ properties: { options: { "x-ms-cosmos-offer-autopilot-tier": "1" }, resource: { id: "a1-db" } } }
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -145,7 +145,7 @@ describe("Add Database Utitlity", () => {
|
||||||
resourceProviderClientPutAsyncSpy
|
resourceProviderClientPutAsyncSpy
|
||||||
).toHaveBeenCalledWith(
|
).toHaveBeenCalledWith(
|
||||||
"subscriptions/a2/resourceGroups/c1/providers/Microsoft.DocumentDB/databaseAccounts/main/sqlDatabases/a2-db",
|
"subscriptions/a2/resourceGroups/c1/providers/Microsoft.DocumentDB/databaseAccounts/main/sqlDatabases/a2-db",
|
||||||
"2020-03-01",
|
"2020-04-01",
|
||||||
{ properties: { options: {}, resource: { id: "a2-db" } } }
|
{ properties: { options: {}, resource: { id: "a2-db" } } }
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -183,6 +183,17 @@ export class CollectionCreation {
|
||||||
public static readonly TablesAPIDefaultDatabase: string = "TablesDB";
|
public static readonly TablesAPIDefaultDatabase: string = "TablesDB";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const CollectionCreationDefaults = {
|
||||||
|
storage: CollectionCreation.storage100Gb,
|
||||||
|
throughput: {
|
||||||
|
fixed: CollectionCreation.DefaultCollectionRUs400,
|
||||||
|
unlimited: CollectionCreation.DefaultCollectionRUs400,
|
||||||
|
unlimitedmax: CollectionCreation.DefaultCollectionRUs1Million,
|
||||||
|
unlimitedmin: CollectionCreation.DefaultCollectionRUs400,
|
||||||
|
shared: CollectionCreation.DefaultCollectionRUs400
|
||||||
|
}
|
||||||
|
} as const;
|
||||||
|
|
||||||
export class IndexingPolicies {
|
export class IndexingPolicies {
|
||||||
public static SharedDatabaseDefault = {
|
public static SharedDatabaseDefault = {
|
||||||
indexingMode: "consistent",
|
indexingMode: "consistent",
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
import { Action, ActionModifiers } from "./TelemetryConstants";
|
import { Action, ActionModifiers } from "./TelemetryConstants";
|
||||||
import { MessageHandler } from "../../Common/MessageHandler";
|
import { MessageHandler } from "../../Common/MessageHandler";
|
||||||
import { MessageTypes } from "../../Contracts/ExplorerContracts";
|
import { MessageTypes } from "../../Contracts/ExplorerContracts";
|
||||||
|
import { appInsights } from "../appInsights";
|
||||||
|
import { config } from "../../Config";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class that persists telemetry data to the portal tables.
|
* Class that persists telemetry data to the portal tables.
|
||||||
|
@ -18,11 +20,7 @@ export default class TelemetryProcessor {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const appInsights: Microsoft.ApplicationInsights.IAppInsights = (<any>window).appInsights;
|
appInsights.trackEvent({ name: Action[action] }, TelemetryProcessor.getData(data));
|
||||||
if (!appInsights) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
appInsights.trackEvent(Action[action], data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static traceStart(action: Action, data?: any): number {
|
public static traceStart(action: Action, data?: any): number {
|
||||||
|
@ -37,10 +35,7 @@ export default class TelemetryProcessor {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const appInsights: Microsoft.ApplicationInsights.IAppInsights = (<any>window).appInsights;
|
|
||||||
if (appInsights) {
|
|
||||||
appInsights.startTrackEvent(Action[action]);
|
appInsights.startTrackEvent(Action[action]);
|
||||||
}
|
|
||||||
return timestamp;
|
return timestamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,11 +50,7 @@ export default class TelemetryProcessor {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const appInsights: Microsoft.ApplicationInsights.IAppInsights = (<any>window).appInsights;
|
appInsights.stopTrackEvent(Action[action], TelemetryProcessor.getData(data));
|
||||||
if (!appInsights) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
appInsights.stopTrackEvent(Action[action], data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static traceFailure(action: Action, data?: any, timestamp?: number): void {
|
public static traceFailure(action: Action, data?: any, timestamp?: number): void {
|
||||||
|
@ -73,11 +64,7 @@ export default class TelemetryProcessor {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const appInsights: Microsoft.ApplicationInsights.IAppInsights = (<any>window).appInsights;
|
appInsights.stopTrackEvent(Action[action], TelemetryProcessor.getData(data));
|
||||||
if (!appInsights) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
appInsights.stopTrackEvent(Action[action], data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static traceCancel(action: Action, data?: any, timestamp?: number): void {
|
public static traceCancel(action: Action, data?: any, timestamp?: number): void {
|
||||||
|
@ -91,11 +78,7 @@ export default class TelemetryProcessor {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const appInsights: Microsoft.ApplicationInsights.IAppInsights = (<any>window).appInsights;
|
appInsights.stopTrackEvent(Action[action], TelemetryProcessor.getData(data));
|
||||||
if (!appInsights) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
appInsights.stopTrackEvent(Action[action], data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static traceOpen(action: Action, data?: any, timestamp?: number): number {
|
public static traceOpen(action: Action, data?: any, timestamp?: number): number {
|
||||||
|
@ -109,10 +92,7 @@ export default class TelemetryProcessor {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const appInsights: Microsoft.ApplicationInsights.IAppInsights = (<any>window).appInsights;
|
|
||||||
if (appInsights) {
|
|
||||||
appInsights.startTrackEvent(Action[action]);
|
appInsights.startTrackEvent(Action[action]);
|
||||||
}
|
|
||||||
return timestamp;
|
return timestamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -127,10 +107,14 @@ export default class TelemetryProcessor {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const appInsights: Microsoft.ApplicationInsights.IAppInsights = (<any>window).appInsights;
|
|
||||||
if (appInsights) {
|
|
||||||
appInsights.startTrackEvent(Action[action]);
|
appInsights.startTrackEvent(Action[action]);
|
||||||
}
|
|
||||||
return timestamp;
|
return timestamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static getData(data?: any): any {
|
||||||
|
return {
|
||||||
|
platform: config.platform,
|
||||||
|
...(data ? data : [])
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,50 +1,32 @@
|
||||||
import { GitHubUtils } from "./GitHubUtils";
|
import { GitHubUtils } from "./GitHubUtils";
|
||||||
|
|
||||||
|
const owner = "owner-1";
|
||||||
|
const repo = "repo-1";
|
||||||
|
const branch = "branch/name.1-2";
|
||||||
|
const path = "folder name/file name1:2.ipynb";
|
||||||
|
|
||||||
describe("GitHubUtils", () => {
|
describe("GitHubUtils", () => {
|
||||||
describe("fromGitHubUri", () => {
|
it("fromRepoUri parses github repo url correctly", () => {
|
||||||
it("parses github repo url for a branch", () => {
|
const repoInfo = GitHubUtils.fromRepoUri(`https://github.com/${owner}/${repo}/tree/${branch}`);
|
||||||
const gitHubInfo = GitHubUtils.fromGitHubUri("https://github.com/owner/repo/tree/branch");
|
expect(repoInfo).toEqual({
|
||||||
expect(gitHubInfo).toEqual({
|
owner,
|
||||||
owner: "owner",
|
repo,
|
||||||
repo: "repo",
|
branch
|
||||||
branch: "branch",
|
|
||||||
path: ""
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it("parses github file url", () => {
|
it("toContentUri generates github uris correctly", () => {
|
||||||
const gitHubInfo = GitHubUtils.fromGitHubUri("https://github.com/owner/repo/blob/branch/dir/file.ext");
|
const uri = GitHubUtils.toContentUri(owner, repo, branch, path);
|
||||||
expect(gitHubInfo).toEqual({
|
expect(uri).toBe(`github://${owner}/${repo}/${path}?ref=${branch}`);
|
||||||
owner: "owner",
|
|
||||||
repo: "repo",
|
|
||||||
branch: "branch",
|
|
||||||
path: "dir/file.ext"
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("parses github file url with spaces", () => {
|
it("fromContentUri parses the github uris correctly", () => {
|
||||||
const gitHubInfo = GitHubUtils.fromGitHubUri("https://github.com/owner/repo/blob/branch/dir/file name.ext");
|
const contentInfo = GitHubUtils.fromContentUri(`github://${owner}/${repo}/${path}?ref=${branch}`);
|
||||||
expect(gitHubInfo).toEqual({
|
expect(contentInfo).toEqual({
|
||||||
owner: "owner",
|
owner,
|
||||||
repo: "repo",
|
repo,
|
||||||
branch: "branch",
|
branch,
|
||||||
path: "dir/file name.ext"
|
path
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it("parses github file url with encoded chars", () => {
|
|
||||||
const gitHubInfo = GitHubUtils.fromGitHubUri("https://github.com/owner/repo/blob/branch/dir/file%20name.ext");
|
|
||||||
expect(gitHubInfo).toEqual({
|
|
||||||
owner: "owner",
|
|
||||||
repo: "repo",
|
|
||||||
branch: "branch",
|
|
||||||
path: "dir/file%20name.ext"
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it("toRepoFullName returns full name in expected format", () => {
|
|
||||||
const fullName = GitHubUtils.toRepoFullName("owner", "repo");
|
|
||||||
expect(fullName).toBe("owner/repo");
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,56 +1,46 @@
|
||||||
import UrlUtility from "../Common/UrlUtility";
|
|
||||||
import { RepoListItem } from "../Explorer/Controls/GitHub/GitHubReposComponent";
|
|
||||||
import { IGitHubFile, IGitHubRepo } from "../GitHub/GitHubClient";
|
|
||||||
import { IPinnedRepo } from "../Juno/JunoClient";
|
|
||||||
|
|
||||||
export class GitHubUtils {
|
export class GitHubUtils {
|
||||||
// The pattern is https://github.com/<owner>/<repo>/(blob|tree)/<branch>/<path>
|
// https://github.com/<owner>/<repo>/tree/<branch>
|
||||||
private static readonly UriPattern = "https://github.com/([^/]*)/([^/]*)/(blob|tree)/([^/]*)/?(.*)";
|
// The url when users visit a repo/branch on github.com
|
||||||
|
private static readonly RepoUriPattern = /https:\/\/github.com\/([^/]*)\/([^/]*)\/tree\/([^?]*)/;
|
||||||
|
|
||||||
|
// github://<owner>/<repo>/<path>?ref=<branch>
|
||||||
|
// Custom scheme for github content
|
||||||
|
private static readonly ContentUriPattern = /github:\/\/([^/]*)\/([^/]*)\/([^?]*)\?ref=(.*)/;
|
||||||
|
|
||||||
public static toRepoFullName(owner: string, repo: string): string {
|
public static toRepoFullName(owner: string, repo: string): string {
|
||||||
return `${owner}/${repo}`;
|
return `${owner}/${repo}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static toGitHubUriForRepoAndBranch(owner: string, repo: string, branch: string, path?: string): string {
|
public static fromRepoUri(repoUri: string): undefined | { owner: string; repo: string; branch: string } {
|
||||||
return UrlUtility.createUri(`https://github.com/${owner}/${repo}/tree/${branch}`, path);
|
const matches = repoUri.match(GitHubUtils.RepoUriPattern);
|
||||||
|
if (matches && matches.length > 3) {
|
||||||
|
return {
|
||||||
|
owner: matches[1],
|
||||||
|
repo: matches[2],
|
||||||
|
branch: matches[3]
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public static toGitHubUriForFile(gitHubFile: IGitHubFile): string {
|
return undefined;
|
||||||
return decodeURIComponent(gitHubFile.html_url);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static fromGitHubUri(
|
public static fromContentUri(
|
||||||
gitHubUri: string
|
contentUri: string
|
||||||
): undefined | { owner: string; repo: string; branch: string; path: string } {
|
): undefined | { owner: string; repo: string; branch: string; path: string } {
|
||||||
try {
|
const matches = contentUri.match(GitHubUtils.ContentUriPattern);
|
||||||
const matches = gitHubUri.match(GitHubUtils.UriPattern);
|
if (matches && matches.length > 4) {
|
||||||
return {
|
return {
|
||||||
owner: matches[1],
|
owner: matches[1],
|
||||||
repo: matches[2],
|
repo: matches[2],
|
||||||
branch: matches[4],
|
branch: matches[4],
|
||||||
path: matches[5]
|
path: matches[3]
|
||||||
};
|
};
|
||||||
} catch (error) {
|
}
|
||||||
|
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public static toPinnedRepo(item: RepoListItem): IPinnedRepo {
|
public static toContentUri(owner: string, repo: string, branch: string, path: string): string {
|
||||||
return {
|
return `github://${owner}/${repo}/${path}?ref=${branch}`;
|
||||||
owner: item.repo.owner.login,
|
|
||||||
name: item.repo.name,
|
|
||||||
private: item.repo.private,
|
|
||||||
branches: item.branches.map(element => ({ name: element.name }))
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
public static toGitHubRepo(pinnedRepo: IPinnedRepo): IGitHubRepo {
|
|
||||||
return {
|
|
||||||
owner: {
|
|
||||||
login: pinnedRepo.owner
|
|
||||||
},
|
|
||||||
name: pinnedRepo.name,
|
|
||||||
private: pinnedRepo.private
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
import * as DataModels from "../Contracts/DataModels";
|
import * as DataModels from "../Contracts/DataModels";
|
||||||
import { config } from "../Config";
|
import { config } from "../Config";
|
||||||
|
import { RepoListItem } from "../Explorer/Controls/GitHub/GitHubReposComponent";
|
||||||
|
import { IPinnedRepo } from "../Juno/JunoClient";
|
||||||
|
import { IGitHubRepo } from "../GitHub/GitHubClient";
|
||||||
|
|
||||||
export class JunoUtils {
|
export class JunoUtils {
|
||||||
public static async getLikedNotebooks(authorizationToken: string): Promise<DataModels.LikedNotebooksJunoResponse> {
|
public static async getLikedNotebooks(authorizationToken: string): Promise<DataModels.LikedNotebooksJunoResponse> {
|
||||||
|
@ -41,4 +44,23 @@ export class JunoUtils {
|
||||||
return undefined;
|
return undefined;
|
||||||
//TODO: add notebookMetadata updation code
|
//TODO: add notebookMetadata updation code
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static toPinnedRepo(item: RepoListItem): IPinnedRepo {
|
||||||
|
return {
|
||||||
|
owner: item.repo.owner.login,
|
||||||
|
name: item.repo.name,
|
||||||
|
private: item.repo.private,
|
||||||
|
branches: item.branches.map(element => ({ name: element.name }))
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public static toGitHubRepo(pinnedRepo: IPinnedRepo): IGitHubRepo {
|
||||||
|
return {
|
||||||
|
owner: {
|
||||||
|
login: pinnedRepo.owner
|
||||||
|
},
|
||||||
|
name: pinnedRepo.name,
|
||||||
|
private: pinnedRepo.private
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,9 +13,11 @@
|
||||||
"./src/Common/Constants.ts",
|
"./src/Common/Constants.ts",
|
||||||
"./src/Common/DeleteFeedback.ts",
|
"./src/Common/DeleteFeedback.ts",
|
||||||
"./src/Common/HashMap.ts",
|
"./src/Common/HashMap.ts",
|
||||||
|
"./src/Common/MessageHandler.ts",
|
||||||
"./src/Common/ObjectCache.ts",
|
"./src/Common/ObjectCache.ts",
|
||||||
"./src/Common/ThemeUtility.ts",
|
"./src/Common/ThemeUtility.ts",
|
||||||
"./src/Common/UrlUtility.ts",
|
"./src/Common/UrlUtility.ts",
|
||||||
|
"./src/Config.ts",
|
||||||
"./src/Contracts/ActionContracts.ts",
|
"./src/Contracts/ActionContracts.ts",
|
||||||
"./src/Contracts/DataModels.ts",
|
"./src/Contracts/DataModels.ts",
|
||||||
"./src/Contracts/Diagnostics.ts",
|
"./src/Contracts/Diagnostics.ts",
|
||||||
|
@ -23,6 +25,7 @@
|
||||||
"./src/Contracts/Versions.ts",
|
"./src/Contracts/Versions.ts",
|
||||||
"./src/Controls/Heatmap/HeatmapDatatypes.ts",
|
"./src/Controls/Heatmap/HeatmapDatatypes.ts",
|
||||||
"./src/Definitions/plotly.js-cartesian-dist.d-min.ts",
|
"./src/Definitions/plotly.js-cartesian-dist.d-min.ts",
|
||||||
|
"./src/Explorer/Controls/Notebook/NotebookAppMessageHandler.ts",
|
||||||
"./src/Explorer/Controls/Toolbar/IToolbarAction.ts",
|
"./src/Explorer/Controls/Toolbar/IToolbarAction.ts",
|
||||||
"./src/Explorer/Controls/Toolbar/IToolbarDisplayable.ts",
|
"./src/Explorer/Controls/Toolbar/IToolbarDisplayable.ts",
|
||||||
"./src/Explorer/Controls/Toolbar/IToolbarDropDown.ts",
|
"./src/Explorer/Controls/Toolbar/IToolbarDropDown.ts",
|
||||||
|
@ -32,6 +35,7 @@
|
||||||
"./src/Explorer/Controls/Toolbar/KeyCodes.ts",
|
"./src/Explorer/Controls/Toolbar/KeyCodes.ts",
|
||||||
"./src/Explorer/Notebook/FileSystemUtil.ts",
|
"./src/Explorer/Notebook/FileSystemUtil.ts",
|
||||||
"./src/Explorer/Notebook/NotebookComponent/actions.ts",
|
"./src/Explorer/Notebook/NotebookComponent/actions.ts",
|
||||||
|
"./src/Explorer/Notebook/NotebookComponent/loadTransform.ts",
|
||||||
"./src/Explorer/Notebook/NotebookContentItem.ts",
|
"./src/Explorer/Notebook/NotebookContentItem.ts",
|
||||||
"./src/Explorer/Notebook/NotebookUtil.ts",
|
"./src/Explorer/Notebook/NotebookUtil.ts",
|
||||||
"./src/Explorer/Panes/Tables/Validators/EntityPropertyNameValidator.ts",
|
"./src/Explorer/Panes/Tables/Validators/EntityPropertyNameValidator.ts",
|
||||||
|
@ -44,6 +48,9 @@
|
||||||
"./src/ResourceProvider/IResourceProviderClient.ts",
|
"./src/ResourceProvider/IResourceProviderClient.ts",
|
||||||
"./src/Shared/StringUtility.ts",
|
"./src/Shared/StringUtility.ts",
|
||||||
"./src/Shared/Telemetry/TelemetryConstants.ts",
|
"./src/Shared/Telemetry/TelemetryConstants.ts",
|
||||||
|
"./src/Shared/appInsights.ts",
|
||||||
|
"./src/Utils/GitHubUtils.ts",
|
||||||
|
"./src/Utils/MessageValidation.ts",
|
||||||
"./src/Utils/OfferUtils.ts",
|
"./src/Utils/OfferUtils.ts",
|
||||||
"./src/Utils/StringUtils.ts",
|
"./src/Utils/StringUtils.ts",
|
||||||
"./src/quickstart.ts",
|
"./src/quickstart.ts",
|
||||||
|
|
Loading…
Reference in New Issue