{"action":"created","comment":{"url":"https://api.github.com/repos/Microsoft/vscode-azureappservice/pulls/comments/221782487","pull_request_review_id":160516587,"id":221782487,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyMTc4MjQ4Nw==","diff_hunk":"@@ -0,0 +1,39 @@\n+/*---------------------------------------------------------------------------------------------\n+ *  Copyright (c) Microsoft Corporation. All rights reserved.\n+ *  Licensed under the MIT License. See License.txt in the project root for license information.\n+ *--------------------------------------------------------------------------------------------*/\n+\n+import { CosmosDBTreeItem } from 'src/explorer/CosmosDBTreeItem';\n+import * as vscode from 'vscode';\n+import { IAzureNode } from 'vscode-azureextensionui';\n+import * as constants from '../../constants';\n+import { IConnections } from './IConnections';\n+\n+export async function addCosmosDBConnection(node: IAzureNode<CosmosDBTreeItem>): Promise<void> {\n+    const connectionToAdd = <string>await vscode.commands.executeCommand('cosmosDB.api.getDatabase');\n+    if (!connectionToAdd) {\n+        return;\n+    }\n+\n+    const workspaceConfig = vscode.workspace.getConfiguration(constants.extensionPrefix);\n+    const allConnections = workspaceConfig.get<IConnections[]>(constants.configurationSettings.connections, []);\n+    let connectionsUnit = allConnections.find((x: IConnections) => x.webAppId === node.treeItem.client.id);\n+    if (!connectionsUnit) {\n+        connectionsUnit = <IConnections>{};\n+        allConnections.push(connectionsUnit);\n+        connectionsUnit.webAppId = node.treeItem.client.id;\n+    }\n+\n+    // tslint:disable-next-line:strict-boolean-expressions\n+    connectionsUnit.cosmosDB = connectionsUnit.cosmosDB || [];\n+    if (!connectionsUnit.cosmosDB.find((x: string) => x === connectionToAdd)) {\n+        connectionsUnit.cosmosDB.push(connectionToAdd);\n+        workspaceConfig.update(constants.configurationSettings.connections, allConnections);\n+        if (node.treeItem.contextValue === 'AddCosmosDBConnection') {\n+            // tslint:disable-next-line:no-non-null-assertion\n+            await node.parent!.refresh();","path":"src/commands/connections/addCosmosDBConnection.ts","position":34,"original_position":34,"commit_id":"9e4e6d463364bfe13d7cbf4fdf17ce82926a57e8","original_commit_id":"9e4e6d463364bfe13d7cbf4fdf17ce82926a57e8","user":{"login":"Omelianenko","id":15349723,"node_id":"MDQ6VXNlcjE1MzQ5NzIz","avatar_url":"https://avatars0.githubusercontent.com/u/15349723?v=4","gravatar_id":"","url":"https://api.github.com/users/Omelianenko","html_url":"https://github.com/Omelianenko","followers_url":"https://api.github.com/users/Omelianenko/followers","following_url":"https://api.github.com/users/Omelianenko/following{/other_user}","gists_url":"https://api.github.com/users/Omelianenko/gists{/gist_id}","starred_url":"https://api.github.com/users/Omelianenko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Omelianenko/subscriptions","organizations_url":"https://api.github.com/users/Omelianenko/orgs","repos_url":"https://api.github.com/users/Omelianenko/repos","events_url":"https://api.github.com/users/Omelianenko/events{/privacy}","received_events_url":"https://api.github.com/users/Omelianenko/received_events","type":"User","site_admin":false},"body":"Is this a good way to resolve the situation when there are no Cosmos DB connections and it provides node as 'Add Cosmos DB Connection' button?","created_at":"2018-10-01T22:57:55Z","updated_at":"2018-10-01T22:57:55Z","html_url":"https://github.com/Microsoft/vscode-azureappservice/pull/626#discussion_r221782487","pull_request_url":"https://api.github.com/repos/Microsoft/vscode-azureappservice/pulls/626","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/Microsoft/vscode-azureappservice/pulls/comments/221782487"},"html":{"href":"https://github.com/Microsoft/vscode-azureappservice/pull/626#discussion_r221782487"},"pull_request":{"href":"https://api.github.com/repos/Microsoft/vscode-azureappservice/pulls/626"}}},"pull_request":{"url":"https://api.github.com/repos/Microsoft/vscode-azureappservice/pulls/626","id":219080530,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE5MDgwNTMw","html_url":"https://github.com/Microsoft/vscode-azureappservice/pull/626","diff_url":"https://github.com/Microsoft/vscode-azureappservice/pull/626.diff","patch_url":"https://github.com/Microsoft/vscode-azureappservice/pull/626.patch","issue_url":"https://api.github.com/repos/Microsoft/vscode-azureappservice/issues/626","number":626,"state":"open","locked":false,"title":"Added CosmosDB to Connections node","user":{"login":"Omelianenko","id":15349723,"node_id":"MDQ6VXNlcjE1MzQ5NzIz","avatar_url":"https://avatars0.githubusercontent.com/u/15349723?v=4","gravatar_id":"","url":"https://api.github.com/users/Omelianenko","html_url":"https://github.com/Omelianenko","followers_url":"https://api.github.com/users/Omelianenko/followers","following_url":"https://api.github.com/users/Omelianenko/following{/other_user}","gists_url":"https://api.github.com/users/Omelianenko/gists{/gist_id}","starred_url":"https://api.github.com/users/Omelianenko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Omelianenko/subscriptions","organizations_url":"https://api.github.com/users/Omelianenko/orgs","repos_url":"https://api.github.com/users/Omelianenko/repos","events_url":"https://api.github.com/users/Omelianenko/events{/privacy}","received_events_url":"https://api.github.com/users/Omelianenko/received_events","type":"User","site_admin":false},"body":"Fixes #584 ","created_at":"2018-09-28T20:42:33Z","updated_at":"2018-10-01T22:57:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9eea5a656ef150bef61d52058adfa7e38e3ea355","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/Microsoft/vscode-azureappservice/pulls/626/commits","review_comments_url":"https://api.github.com/repos/Microsoft/vscode-azureappservice/pulls/626/comments","review_comment_url":"https://api.github.com/repos/Microsoft/vscode-azureappservice/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Microsoft/vscode-azureappservice/issues/626/comments","statuses_url":"https://api.github.com/repos/Microsoft/vscode-azureappservice/statuses/9e4e6d463364bfe13d7cbf4fdf17ce82926a57e8","head":{"label":"Microsoft:omelianenko/addItemToCosmosDBNode","ref":"omelianenko/addItemToCosmosDBNode","sha":"9e4e6d463364bfe13d7cbf4fdf17ce82926a57e8","user":{"login":"Microsoft","id":6154722,"node_id":"MDEyOk9yZ2FuaXphdGlvbjYxNTQ3MjI=","avatar_url":"https://avatars2.githubusercontent.com/u/6154722?v=4","gravatar_id":"","url":"https://api.github.com/users/Microsoft","html_url":"https://github.com/Microsoft","followers_url":"https://api.github.com/users/Microsoft/followers","following_url":"https://api.github.com/users/Microsoft/following{/other_user}","gists_url":"https://api.github.com/users/Microsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/Microsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Microsoft/subscriptions","organizations_url":"https://api.github.com/users/Microsoft/orgs","repos_url":"https://api.github.com/users/Microsoft/repos","events_url":"https://api.github.com/users/Microsoft/events{/privacy}","received_events_url":"https://api.github.com/users/Microsoft/received_events","type":"Organization","site_admin":false},"repo":{"id":98935458,"node_id":"MDEwOlJlcG9zaXRvcnk5ODkzNTQ1OA==","name":"vscode-azureappservice","full_name":"Microsoft/vscode-azureappservice","private":false,"owner":{"login":"Microsoft","id":6154722,"node_id":"MDEyOk9yZ2FuaXphdGlvbjYxNTQ3MjI=","avatar_url":"https://avatars2.githubusercontent.com/u/6154722?v=4","gravatar_id":"","url":"https://api.github.com/users/Microsoft","html_url":"https://github.com/Microsoft","followers_url":"https://api.github.com/users/Microsoft/followers","following_url":"https://api.github.com/users/Microsoft/following{/other_user}","gists_url":"https://api.github.com/users/Microsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/Microsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Microsoft/subscriptions","organizations_url":"https://api.github.com/users/Microsoft/orgs","repos_url":"https://api.github.com/users/Microsoft/repos","events_url":"https://api.github.com/users/Microsoft/events{/privacy}","received_events_url":"https://api.github.com/users/Microsoft/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/Microsoft/vscode-azureappservice","description":"Azure App Service extension for VS Code","fork":false,"url":"https://api.github.com/repos/Microsoft/vscode-azureappservice","forks_url":"https://api.github.com/repos/Microsoft/vscode-azureappservice/forks","keys_url":"https://api.github.com/repos/Microsoft/vscode-azureappservice/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Microsoft/vscode-azureappservice/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Microsoft/vscode-azureappservice/teams","hooks_url":"https://api.github.com/repos/Microsoft/vscode-azureappservice/hooks","issue_events_url":"https://api.github.com/repos/Microsoft/vscode-azureappservice/issues/events{/number}","events_url":"https://api.github.com/repos/Microsoft/vscode-azureappservice/events","assignees_url":"https://api.github.com/repos/Microsoft/vscode-azureappservice/assignees{/user}","branches_url":"https://api.github.com/repos/Microsoft/vscode-azureappservice/branches{/branch}","tags_url":"https://api.github.com/repos/Microsoft/vscode-azureappservice/tags","blobs_url":"https://api.github.com/repos/Microsoft/vscode-azureappservice/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Microsoft/vscode-azureappservice/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Microsoft/vscode-azureappservice/git/refs{/sha}","trees_url":"https://api.github.com/repos/Microsoft/vscode-azureappservice/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Microsoft/vscode-azureappservice/statuses/{sha}","languages_url":"https://api.github.com/repos/Microsoft/vscode-azureappservice/languages","stargazers_url":"https://api.github.com/repos/Microsoft/vscode-azureappservice/stargazers","contributors_url":"https://api.github.com/repos/Microsoft/vscode-azureappservice/contributors","subscribers_url":"https://api.github.com/repos/Microsoft/vscode-azureappservice/subscribers","subscription_url":"https://api.github.com/repos/Microsoft/vscode-azureappservice/subscription","commits_url":"https://api.github.com/repos/Microsoft/vscode-azureappservice/commits{/sha}","git_commits_url":"https://api.github.com/repos/Microsoft/vscode-azureappservice/git/commits{/sha}","comments_url":"https://api.github.com/repos/Microsoft/vscode-azureappservice/comments{/number}","issue_comment_url":"https://api.github.com/repos/Microsoft/vscode-azureappservice/issues/comments{/number}","contents_url":"https://api.github.com/repos/Microsoft/vscode-azureappservice/contents/{+path}","compare_url":"https://api.github.com/repos/Microsoft/vscode-azureappservice/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Microsoft/vscode-azureappservice/merges","archive_url":"https://api.github.com/repos/Microsoft/vscode-azureappservice/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Microsoft/vscode-azureappservice/downloads","issues_url":"https://api.github.com/repos/Microsoft/vscode-azureappservice/issues{/number}","pulls_url":"https://api.github.com/repos/Microsoft/vscode-azureappservice/pulls{/number}","milestones_url":"https://api.github.com/repos/Microsoft/vscode-azureappservice/milestones{/number}","notifications_url":"https://api.github.com/repos/Microsoft/vscode-azureappservice/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Microsoft/vscode-azureappservice/labels{/name}","releases_url":"https://api.github.com/repos/Microsoft/vscode-azureappservice/releases{/id}","deployments_url":"https://api.github.com/repos/Microsoft/vscode-azureappservice/deployments","created_at":"2017-07-31T22:30:17Z","updated_at":"2018-09-30T04:41:44Z","pushed_at":"2018-10-01T22:51:49Z","git_url":"git://github.com/Microsoft/vscode-azureappservice.git","ssh_url":"git@github.com:Microsoft/vscode-azureappservice.git","clone_url":"https://github.com/Microsoft/vscode-azureappservice.git","svn_url":"https://github.com/Microsoft/vscode-azureappservice","homepage":"https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-azureappservice","size":1308,"stargazers_count":30,"watchers_count":30,"language":"TypeScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":17,"mirror_url":null,"archived":false,"open_issues_count":76,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":17,"open_issues":76,"watchers":30,"default_branch":"master"}},"base":{"label":"Microsoft:master","ref":"master","sha":"112b68cf22e46585b71f2b4823576f0a983e8080","user":{"login":"Microsoft","id":6154722,"node_id":"MDEyOk9yZ2FuaXphdGlvbjYxNTQ3MjI=","avatar_url":"https://avatars2.githubusercontent.com/u/6154722?v=4","gravatar_id":"","url":"https://api.github.com/users/Microsoft","html_url":"https://github.com/Microsoft","followers_url":"https://api.github.com/users/Microsoft/followers","following_url":"https://api.github.com/users/Microsoft/following{/other_user}","gists_url":"https://api.github.com/users/Microsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/Microsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Microsoft/subscriptions","organizations_url":"https://api.github.com/users/Microsoft/orgs","repos_url":"https://api.github.com/users/Microsoft/repos","events_url":"https://api.github.com/users/Microsoft/events{/privacy}","received_events_url":"https://api.github.com/users/Microsoft/received_events","type":"Organization","site_admin":false},"repo":{"id":98935458,"node_id":"MDEwOlJlcG9zaXRvcnk5ODkzNTQ1OA==","name":"vscode-azureappservice","full_name":"Microsoft/vscode-azureappservice","private":false,"owner":{"login":"Microsoft","id":6154722,"node_id":"MDEyOk9yZ2FuaXphdGlvbjYxNTQ3MjI=","avatar_url":"https://avatars2.githubusercontent.com/u/6154722?v=4","gravatar_id":"","url":"https://api.github.com/users/Microsoft","html_url":"https://github.com/Microsoft","followers_url":"https://api.github.com/users/Microsoft/followers","following_url":"https://api.github.com/users/Microsoft/following{/other_user}","gists_url":"https://api.github.com/users/Microsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/Microsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Microsoft/subscriptions","organizations_url":"https://api.github.com/users/Microsoft/orgs","repos_url":"https://api.github.com/users/Microsoft/repos","events_url":"https://api.github.com/users/Microsoft/events{/privacy}","received_events_url":"https://api.github.com/users/Microsoft/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/Microsoft/vscode-azureappservice","description":"Azure App Service extension for VS Code","fork":false,"url":"https://api.github.com/repos/Microsoft/vscode-azureappservice","forks_url":"https://api.github.com/repos/Microsoft/vscode-azureappservice/forks","keys_url":"https://api.github.com/repos/Microsoft/vscode-azureappservice/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Microsoft/vscode-azureappservice/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Microsoft/vscode-azureappservice/teams","hooks_url":"https://api.github.com/repos/Microsoft/vscode-azureappservice/hooks","issue_events_url":"https://api.github.com/repos/Microsoft/vscode-azureappservice/issues/events{/number}","events_url":"https://api.github.com/repos/Microsoft/vscode-azureappservice/events","assignees_url":"https://api.github.com/repos/Microsoft/vscode-azureappservice/assignees{/user}","branches_url":"https://api.github.com/repos/Microsoft/vscode-azureappservice/branches{/branch}","tags_url":"https://api.github.com/repos/Microsoft/vscode-azureappservice/tags","blobs_url":"https://api.github.com/repos/Microsoft/vscode-azureappservice/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Microsoft/vscode-azureappservice/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Microsoft/vscode-azureappservice/git/refs{/sha}","trees_url":"https://api.github.com/repos/Microsoft/vscode-azureappservice/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Microsoft/vscode-azureappservice/statuses/{sha}","languages_url":"https://api.github.com/repos/Microsoft/vscode-azureappservice/languages","stargazers_url":"https://api.github.com/repos/Microsoft/vscode-azureappservice/stargazers","contributors_url":"https://api.github.com/repos/Microsoft/vscode-azureappservice/contributors","subscribers_url":"https://api.github.com/repos/Microsoft/vscode-azureappservice/subscribers","subscription_url":"https://api.github.com/repos/Microsoft/vscode-azureappservice/subscription","commits_url":"https://api.github.com/repos/Microsoft/vscode-azureappservice/commits{/sha}","git_commits_url":"https://api.github.com/repos/Microsoft/vscode-azureappservice/git/commits{/sha}","comments_url":"https://api.github.com/repos/Microsoft/vscode-azureappservice/comments{/number}","issue_comment_url":"https://api.github.com/repos/Microsoft/vscode-azureappservice/issues/comments{/number}","contents_url":"https://api.github.com/repos/Microsoft/vscode-azureappservice/contents/{+path}","compare_url":"https://api.github.com/repos/Microsoft/vscode-azureappservice/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Microsoft/vscode-azureappservice/merges","archive_url":"https://api.github.com/repos/Microsoft/vscode-azureappservice/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Microsoft/vscode-azureappservice/downloads","issues_url":"https://api.github.com/repos/Microsoft/vscode-azureappservice/issues{/number}","pulls_url":"https://api.github.com/repos/Microsoft/vscode-azureappservice/pulls{/number}","milestones_url":"https://api.github.com/repos/Microsoft/vscode-azureappservice/milestones{/number}","notifications_url":"https://api.github.com/repos/Microsoft/vscode-azureappservice/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Microsoft/vscode-azureappservice/labels{/name}","releases_url":"https://api.github.com/repos/Microsoft/vscode-azureappservice/releases{/id}","deployments_url":"https://api.github.com/repos/Microsoft/vscode-azureappservice/deployments","created_at":"2017-07-31T22:30:17Z","updated_at":"2018-09-30T04:41:44Z","pushed_at":"2018-10-01T22:51:49Z","git_url":"git://github.com/Microsoft/vscode-azureappservice.git","ssh_url":"git@github.com:Microsoft/vscode-azureappservice.git","clone_url":"https://github.com/Microsoft/vscode-azureappservice.git","svn_url":"https://github.com/Microsoft/vscode-azureappservice","homepage":"https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-azureappservice","size":1308,"stargazers_count":30,"watchers_count":30,"language":"TypeScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":17,"mirror_url":null,"archived":false,"open_issues_count":76,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":17,"open_issues":76,"watchers":30,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Microsoft/vscode-azureappservice/pulls/626"},"html":{"href":"https://github.com/Microsoft/vscode-azureappservice/pull/626"},"issue":{"href":"https://api.github.com/repos/Microsoft/vscode-azureappservice/issues/626"},"comments":{"href":"https://api.github.com/repos/Microsoft/vscode-azureappservice/issues/626/comments"},"review_comments":{"href":"https://api.github.com/repos/Microsoft/vscode-azureappservice/pulls/626/comments"},"review_comment":{"href":"https://api.github.com/repos/Microsoft/vscode-azureappservice/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Microsoft/vscode-azureappservice/pulls/626/commits"},"statuses":{"href":"https://api.github.com/repos/Microsoft/vscode-azureappservice/statuses/9e4e6d463364bfe13d7cbf4fdf17ce82926a57e8"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"Omelianenko"}}