{"action":"created","comment":{"url":"https://api.github.com/repos/redhat-developer/odo/pulls/comments/181783992","pull_request_review_id":112468457,"id":181783992,"diff_hunk":"@@ -60,21 +60,39 @@ func CreateFromDir(client *occlient.Client, name string, ctype string, dir strin\n \n // Delete whole component\n func Delete(client *occlient.Client, name string, applicationName string, projectName string) (string, error) {\n+\n \tcfg, err := config.New()\n \tif err != nil {\n-\t\treturn \"\", errors.Wrapf(err, \"unable to delete component %s\", name)\n+\t\treturn \"\", errors.Wrapf(err, \"unable to create new configuration to delete %s\", name)\n \t}\n \n \tlabels := componentlabels.GetLabels(name, applicationName, false)\n \n \toutput, err := client.Delete(\"all\", \"\", labels)\n \tif err != nil {\n-\t\treturn \"\", errors.Wrapf(err, \"unable to delete component %s\", name)\n+\t\treturn \"\", errors.Wrapf(err, \"error deleting component %s\", name)\n \t}\n \n-\terr = cfg.SetActiveComponent(\"\", projectName, applicationName)\n+\t// If there are components that still exist (len > 0) then set it to the default component..\n+\tcomponents, err := List(client, applicationName, projectName)\n \tif err != nil {\n-\t\treturn \"\", errors.Wrapf(err, \"unable to delete component %s\", name)\n+\t\treturn \"\", errors.Wrapf(err, \"unable to retrieve list of components\")\n+\t}\n+\n+\t// If there's more than one component, set it to the first one..\n+\tif len(components) > 0 {\n+\t\terr = cfg.SetActiveComponent(components[0].Name, applicationName, projectName)\n+\t\tif err != nil {\n+\t\t\tlog.Warnf(\"No active component found, setting active component to %s\", components[0].Name)\n+\t\t\treturn \"\", errors.Wrapf(err, \"unable to set current component %s\", name)\n+\t\t}\n+\t} else {\n+\t\t// Unset to blank\n+\t\terr = cfg.UnsetActiveComponent(applicationName, projectName)\n+\t\tif err != nil {\n+\t\t\treturn \"\", errors.Wrapf(err, \"error unsetting current component while deleting %s\", name)\n+\t\t}\n+\t\tlog.Warnf(\"No default component has been set\")","path":"pkg/component/component.go","position":40,"original_position":40,"commit_id":"24df1d127ec90d3894afb42ea50c0424968eddfc","original_commit_id":"24df1d127ec90d3894afb42ea50c0424968eddfc","user":{"login":"kadel","id":57206,"avatar_url":"https://avatars1.githubusercontent.com/u/57206?v=4","gravatar_id":"","url":"https://api.github.com/users/kadel","html_url":"https://github.com/kadel","followers_url":"https://api.github.com/users/kadel/followers","following_url":"https://api.github.com/users/kadel/following{/other_user}","gists_url":"https://api.github.com/users/kadel/gists{/gist_id}","starred_url":"https://api.github.com/users/kadel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kadel/subscriptions","organizations_url":"https://api.github.com/users/kadel/orgs","repos_url":"https://api.github.com/users/kadel/repos","events_url":"https://api.github.com/users/kadel/events{/privacy}","received_events_url":"https://api.github.com/users/kadel/received_events","type":"User","site_admin":false},"body":"I don't think this is Warn. It is the normal state. There are just no components left. \r\nI think that the message should say just that.\r\n","created_at":"2018-04-16T15:29:35Z","updated_at":"2018-04-16T15:29:36Z","html_url":"https://github.com/redhat-developer/odo/pull/345#discussion_r181783992","pull_request_url":"https://api.github.com/repos/redhat-developer/odo/pulls/345","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/redhat-developer/odo/pulls/comments/181783992"},"html":{"href":"https://github.com/redhat-developer/odo/pull/345#discussion_r181783992"},"pull_request":{"href":"https://api.github.com/repos/redhat-developer/odo/pulls/345"}}},"pull_request":{"url":"https://api.github.com/repos/redhat-developer/odo/pulls/345","id":180961544,"html_url":"https://github.com/redhat-developer/odo/pull/345","diff_url":"https://github.com/redhat-developer/odo/pull/345.diff","patch_url":"https://github.com/redhat-developer/odo/pull/345.patch","issue_url":"https://api.github.com/repos/redhat-developer/odo/issues/345","number":345,"state":"open","locked":false,"title":"Fixes error when deleting a component","user":{"login":"cdrage","id":6422176,"avatar_url":"https://avatars1.githubusercontent.com/u/6422176?v=4","gravatar_id":"","url":"https://api.github.com/users/cdrage","html_url":"https://github.com/cdrage","followers_url":"https://api.github.com/users/cdrage/followers","following_url":"https://api.github.com/users/cdrage/following{/other_user}","gists_url":"https://api.github.com/users/cdrage/gists{/gist_id}","starred_url":"https://api.github.com/users/cdrage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cdrage/subscriptions","organizations_url":"https://api.github.com/users/cdrage/orgs","repos_url":"https://api.github.com/users/cdrage/repos","events_url":"https://api.github.com/users/cdrage/events{/privacy}","received_events_url":"https://api.github.com/users/cdrage/received_events","type":"User","site_admin":false},"body":"Adds a new function that sets the current application / project to a\nblank \"activeComponent\".\n\nFixes: https://github.com/redhat-developer/ocdev/issues/251","created_at":"2018-04-11T16:33:17Z","updated_at":"2018-04-16T15:29:36Z","closed_at":null,"merged_at":null,"merge_commit_sha":"34b990b8accad31db9917948c743735a666db733","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/redhat-developer/odo/pulls/345/commits","review_comments_url":"https://api.github.com/repos/redhat-developer/odo/pulls/345/comments","review_comment_url":"https://api.github.com/repos/redhat-developer/odo/pulls/comments{/number}","comments_url":"https://api.github.com/repos/redhat-developer/odo/issues/345/comments","statuses_url":"https://api.github.com/repos/redhat-developer/odo/statuses/24df1d127ec90d3894afb42ea50c0424968eddfc","head":{"label":"cdrage:fix-deleting-error","ref":"fix-deleting-error","sha":"24df1d127ec90d3894afb42ea50c0424968eddfc","user":{"login":"cdrage","id":6422176,"avatar_url":"https://avatars1.githubusercontent.com/u/6422176?v=4","gravatar_id":"","url":"https://api.github.com/users/cdrage","html_url":"https://github.com/cdrage","followers_url":"https://api.github.com/users/cdrage/followers","following_url":"https://api.github.com/users/cdrage/following{/other_user}","gists_url":"https://api.github.com/users/cdrage/gists{/gist_id}","starred_url":"https://api.github.com/users/cdrage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cdrage/subscriptions","organizations_url":"https://api.github.com/users/cdrage/orgs","repos_url":"https://api.github.com/users/cdrage/repos","events_url":"https://api.github.com/users/cdrage/events{/privacy}","received_events_url":"https://api.github.com/users/cdrage/received_events","type":"User","site_admin":false},"repo":{"id":126372930,"name":"odo","full_name":"cdrage/odo","owner":{"login":"cdrage","id":6422176,"avatar_url":"https://avatars1.githubusercontent.com/u/6422176?v=4","gravatar_id":"","url":"https://api.github.com/users/cdrage","html_url":"https://github.com/cdrage","followers_url":"https://api.github.com/users/cdrage/followers","following_url":"https://api.github.com/users/cdrage/following{/other_user}","gists_url":"https://api.github.com/users/cdrage/gists{/gist_id}","starred_url":"https://api.github.com/users/cdrage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cdrage/subscriptions","organizations_url":"https://api.github.com/users/cdrage/orgs","repos_url":"https://api.github.com/users/cdrage/repos","events_url":"https://api.github.com/users/cdrage/events{/privacy}","received_events_url":"https://api.github.com/users/cdrage/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/cdrage/odo","description":"OpenShift Command line for Developers","fork":true,"url":"https://api.github.com/repos/cdrage/odo","forks_url":"https://api.github.com/repos/cdrage/odo/forks","keys_url":"https://api.github.com/repos/cdrage/odo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cdrage/odo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cdrage/odo/teams","hooks_url":"https://api.github.com/repos/cdrage/odo/hooks","issue_events_url":"https://api.github.com/repos/cdrage/odo/issues/events{/number}","events_url":"https://api.github.com/repos/cdrage/odo/events","assignees_url":"https://api.github.com/repos/cdrage/odo/assignees{/user}","branches_url":"https://api.github.com/repos/cdrage/odo/branches{/branch}","tags_url":"https://api.github.com/repos/cdrage/odo/tags","blobs_url":"https://api.github.com/repos/cdrage/odo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cdrage/odo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cdrage/odo/git/refs{/sha}","trees_url":"https://api.github.com/repos/cdrage/odo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cdrage/odo/statuses/{sha}","languages_url":"https://api.github.com/repos/cdrage/odo/languages","stargazers_url":"https://api.github.com/repos/cdrage/odo/stargazers","contributors_url":"https://api.github.com/repos/cdrage/odo/contributors","subscribers_url":"https://api.github.com/repos/cdrage/odo/subscribers","subscription_url":"https://api.github.com/repos/cdrage/odo/subscription","commits_url":"https://api.github.com/repos/cdrage/odo/commits{/sha}","git_commits_url":"https://api.github.com/repos/cdrage/odo/git/commits{/sha}","comments_url":"https://api.github.com/repos/cdrage/odo/comments{/number}","issue_comment_url":"https://api.github.com/repos/cdrage/odo/issues/comments{/number}","contents_url":"https://api.github.com/repos/cdrage/odo/contents/{+path}","compare_url":"https://api.github.com/repos/cdrage/odo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cdrage/odo/merges","archive_url":"https://api.github.com/repos/cdrage/odo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cdrage/odo/downloads","issues_url":"https://api.github.com/repos/cdrage/odo/issues{/number}","pulls_url":"https://api.github.com/repos/cdrage/odo/pulls{/number}","milestones_url":"https://api.github.com/repos/cdrage/odo/milestones{/number}","notifications_url":"https://api.github.com/repos/cdrage/odo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cdrage/odo/labels{/name}","releases_url":"https://api.github.com/repos/cdrage/odo/releases{/id}","deployments_url":"https://api.github.com/repos/cdrage/odo/deployments","created_at":"2018-03-22T17:36:50Z","updated_at":"2018-04-16T14:46:14Z","pushed_at":"2018-04-16T15:23:03Z","git_url":"git://github.com/cdrage/odo.git","ssh_url":"git@github.com:cdrage/odo.git","clone_url":"https://github.com/cdrage/odo.git","svn_url":"https://github.com/cdrage/odo","homepage":"","size":18515,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"redhat-developer:master","ref":"master","sha":"2bbbfee18df1aedd6e94a6bc0b7c4f10d324f845","user":{"login":"redhat-developer","id":11033755,"avatar_url":"https://avatars0.githubusercontent.com/u/11033755?v=4","gravatar_id":"","url":"https://api.github.com/users/redhat-developer","html_url":"https://github.com/redhat-developer","followers_url":"https://api.github.com/users/redhat-developer/followers","following_url":"https://api.github.com/users/redhat-developer/following{/other_user}","gists_url":"https://api.github.com/users/redhat-developer/gists{/gist_id}","starred_url":"https://api.github.com/users/redhat-developer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/redhat-developer/subscriptions","organizations_url":"https://api.github.com/users/redhat-developer/orgs","repos_url":"https://api.github.com/users/redhat-developer/repos","events_url":"https://api.github.com/users/redhat-developer/events{/privacy}","received_events_url":"https://api.github.com/users/redhat-developer/received_events","type":"Organization","site_admin":false},"repo":{"id":118630356,"name":"odo","full_name":"redhat-developer/odo","owner":{"login":"redhat-developer","id":11033755,"avatar_url":"https://avatars0.githubusercontent.com/u/11033755?v=4","gravatar_id":"","url":"https://api.github.com/users/redhat-developer","html_url":"https://github.com/redhat-developer","followers_url":"https://api.github.com/users/redhat-developer/followers","following_url":"https://api.github.com/users/redhat-developer/following{/other_user}","gists_url":"https://api.github.com/users/redhat-developer/gists{/gist_id}","starred_url":"https://api.github.com/users/redhat-developer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/redhat-developer/subscriptions","organizations_url":"https://api.github.com/users/redhat-developer/orgs","repos_url":"https://api.github.com/users/redhat-developer/repos","events_url":"https://api.github.com/users/redhat-developer/events{/privacy}","received_events_url":"https://api.github.com/users/redhat-developer/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/redhat-developer/odo","description":"OpenShift Command line for Developers","fork":false,"url":"https://api.github.com/repos/redhat-developer/odo","forks_url":"https://api.github.com/repos/redhat-developer/odo/forks","keys_url":"https://api.github.com/repos/redhat-developer/odo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/redhat-developer/odo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/redhat-developer/odo/teams","hooks_url":"https://api.github.com/repos/redhat-developer/odo/hooks","issue_events_url":"https://api.github.com/repos/redhat-developer/odo/issues/events{/number}","events_url":"https://api.github.com/repos/redhat-developer/odo/events","assignees_url":"https://api.github.com/repos/redhat-developer/odo/assignees{/user}","branches_url":"https://api.github.com/repos/redhat-developer/odo/branches{/branch}","tags_url":"https://api.github.com/repos/redhat-developer/odo/tags","blobs_url":"https://api.github.com/repos/redhat-developer/odo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/redhat-developer/odo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/redhat-developer/odo/git/refs{/sha}","trees_url":"https://api.github.com/repos/redhat-developer/odo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/redhat-developer/odo/statuses/{sha}","languages_url":"https://api.github.com/repos/redhat-developer/odo/languages","stargazers_url":"https://api.github.com/repos/redhat-developer/odo/stargazers","contributors_url":"https://api.github.com/repos/redhat-developer/odo/contributors","subscribers_url":"https://api.github.com/repos/redhat-developer/odo/subscribers","subscription_url":"https://api.github.com/repos/redhat-developer/odo/subscription","commits_url":"https://api.github.com/repos/redhat-developer/odo/commits{/sha}","git_commits_url":"https://api.github.com/repos/redhat-developer/odo/git/commits{/sha}","comments_url":"https://api.github.com/repos/redhat-developer/odo/comments{/number}","issue_comment_url":"https://api.github.com/repos/redhat-developer/odo/issues/comments{/number}","contents_url":"https://api.github.com/repos/redhat-developer/odo/contents/{+path}","compare_url":"https://api.github.com/repos/redhat-developer/odo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/redhat-developer/odo/merges","archive_url":"https://api.github.com/repos/redhat-developer/odo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/redhat-developer/odo/downloads","issues_url":"https://api.github.com/repos/redhat-developer/odo/issues{/number}","pulls_url":"https://api.github.com/repos/redhat-developer/odo/pulls{/number}","milestones_url":"https://api.github.com/repos/redhat-developer/odo/milestones{/number}","notifications_url":"https://api.github.com/repos/redhat-developer/odo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/redhat-developer/odo/labels{/name}","releases_url":"https://api.github.com/repos/redhat-developer/odo/releases{/id}","deployments_url":"https://api.github.com/repos/redhat-developer/odo/deployments","created_at":"2018-01-23T15:36:17Z","updated_at":"2018-04-16T15:23:59Z","pushed_at":"2018-04-16T15:23:56Z","git_url":"git://github.com/redhat-developer/odo.git","ssh_url":"git@github.com:redhat-developer/odo.git","clone_url":"https://github.com/redhat-developer/odo.git","svn_url":"https://github.com/redhat-developer/odo","homepage":"","size":18505,"stargazers_count":19,"watchers_count":19,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":15,"mirror_url":null,"archived":false,"open_issues_count":130,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":15,"open_issues":130,"watchers":19,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/redhat-developer/odo/pulls/345"},"html":{"href":"https://github.com/redhat-developer/odo/pull/345"},"issue":{"href":"https://api.github.com/repos/redhat-developer/odo/issues/345"},"comments":{"href":"https://api.github.com/repos/redhat-developer/odo/issues/345/comments"},"review_comments":{"href":"https://api.github.com/repos/redhat-developer/odo/pulls/345/comments"},"review_comment":{"href":"https://api.github.com/repos/redhat-developer/odo/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/redhat-developer/odo/pulls/345/commits"},"statuses":{"href":"https://api.github.com/repos/redhat-developer/odo/statuses/24df1d127ec90d3894afb42ea50c0424968eddfc"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"kadel"}}