mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2024-11-25 15:06:55 +00:00
Fix connection string renew token pane (#136)
* Fix IcM issue + conn string parsing * format code * Undo fix for IcM issue
This commit is contained in:
parent
0011007d5f
commit
08ee86ecf1
@ -14,7 +14,10 @@ export class BackendEndpoints {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class EndpointsRegex {
|
export class EndpointsRegex {
|
||||||
public static readonly cassandra = "AccountEndpoint=(.*).cassandra.cosmosdb.azure.com";
|
public static readonly cassandra = [
|
||||||
|
"AccountEndpoint=(.*).cassandra.cosmosdb.azure.com",
|
||||||
|
"HostName=(.*).cassandra.cosmos.azure.com"
|
||||||
|
];
|
||||||
public static readonly mongo = "mongodb://.*:(.*)@(.*).documents.azure.com";
|
public static readonly mongo = "mongodb://.*:(.*)@(.*).documents.azure.com";
|
||||||
public static readonly mongoCompute = "mongodb://.*:(.*)@(.*).mongo.cosmos.azure.com";
|
public static readonly mongoCompute = "mongodb://.*:(.*)@(.*).mongo.cosmos.azure.com";
|
||||||
public static readonly sql = "AccountEndpoint=https://(.*).documents.azure.com";
|
public static readonly sql = "AccountEndpoint=https://(.*).documents.azure.com";
|
||||||
|
@ -20,9 +20,13 @@ export class ConnectionStringParser {
|
|||||||
const matches: string[] = connectionStringPart.match(Constants.EndpointsRegex.mongoCompute);
|
const matches: string[] = connectionStringPart.match(Constants.EndpointsRegex.mongoCompute);
|
||||||
accessInput.accountName = matches && matches.length > 1 && matches[2];
|
accessInput.accountName = matches && matches.length > 1 && matches[2];
|
||||||
accessInput.apiKind = DataModels.ApiKind.MongoDBCompute;
|
accessInput.apiKind = DataModels.ApiKind.MongoDBCompute;
|
||||||
} else if (RegExp(Constants.EndpointsRegex.cassandra).test(connectionStringPart)) {
|
} else if (Constants.EndpointsRegex.cassandra.some(regex => RegExp(regex).test(connectionStringPart))) {
|
||||||
accessInput.accountName = connectionStringPart.match(Constants.EndpointsRegex.cassandra)[1];
|
Constants.EndpointsRegex.cassandra.forEach(regex => {
|
||||||
accessInput.apiKind = DataModels.ApiKind.Cassandra;
|
if (RegExp(regex).test(connectionStringPart)) {
|
||||||
|
accessInput.accountName = connectionStringPart.match(regex)[1];
|
||||||
|
accessInput.apiKind = DataModels.ApiKind.Cassandra;
|
||||||
|
}
|
||||||
|
});
|
||||||
} else if (RegExp(Constants.EndpointsRegex.table).test(connectionStringPart)) {
|
} else if (RegExp(Constants.EndpointsRegex.table).test(connectionStringPart)) {
|
||||||
accessInput.accountName = connectionStringPart.match(Constants.EndpointsRegex.table)[1];
|
accessInput.accountName = connectionStringPart.match(Constants.EndpointsRegex.table)[1];
|
||||||
accessInput.apiKind = DataModels.ApiKind.Table;
|
accessInput.apiKind = DataModels.ApiKind.Table;
|
||||||
|
Loading…
Reference in New Issue
Block a user