{"action":"created","comment":{"url":"https://api.github.com/repos/jwforres/origin/pulls/comments/59711286","id":59711286,"diff_hunk":"@@ -270,22 +276,41 @@ angular.module('openshiftConsole')\n         return;\n       }\n \n-      self.create(resource, null, object, context, opts).then(\n-        function (data) {\n-          // include the original object, so the error handler can display the kind/name\n-          data.object = object;\n-          successResults.push(data);\n-          remaining--;\n-          _checkDone();\n-        },\n-        function (data) {\n-          // include the original object, so the handler can display the kind/name\n-          data.object = object;\n-          failureResults.push(data);\n-          remaining--;\n-          _checkDone();\n-        }\n-      );\n+      if (action === \"update\") {\n+        self.update(resource, object.metadata.name, object, context, opts).then(\n+          function (data) {\n+            // include the original object, so the error handler can display the kind/name\n+            data.object = object;\n+            successResults.push(data);\n+            remaining--;\n+            _checkDone();\n+          },\n+          function (data) {\n+            // include the original object, so the handler can display the kind/name\n+            data.object = object;\n+            failureResults.push(data);\n+            remaining--;\n+            _checkDone();\n+          }\n+        );\n+      } else {\n+        self.create(resource, null, object, context, opts).then(\n+          function (data) {\n+            // include the original object, so the error handler can display the kind/name\n+            data.object = object;\n+            successResults.push(data);\n+            remaining--;\n+            _checkDone();\n+          },\n+          function (data) {\n+            // include the original object, so the handler can display the kind/name\n+            data.object = object;\n+            failureResults.push(data);\n+            remaining--;\n+            _checkDone();\n+          }\n+        );","path":"assets/app/scripts/services/data.js","position":66,"original_position":83,"commit_id":"26b6811bc0abd0a1d96a1a6d9a4beddea1516a76","original_commit_id":"26b6811bc0abd0a1d96a1a6d9a4beddea1516a76","user":{"login":"spadgett","id":1167259,"avatar_url":"https://avatars.githubusercontent.com/u/1167259?v=3","gravatar_id":"","url":"https://api.github.com/users/spadgett","html_url":"https://github.com/spadgett","followers_url":"https://api.github.com/users/spadgett/followers","following_url":"https://api.github.com/users/spadgett/following{/other_user}","gists_url":"https://api.github.com/users/spadgett/gists{/gist_id}","starred_url":"https://api.github.com/users/spadgett/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spadgett/subscriptions","organizations_url":"https://api.github.com/users/spadgett/orgs","repos_url":"https://api.github.com/users/spadgett/repos","events_url":"https://api.github.com/users/spadgett/events{/privacy}","received_events_url":"https://api.github.com/users/spadgett/received_events","type":"User","site_admin":false},"body":"Since the callbacks are the same, make them named functions that you can reuse.\r\n\r\n```javascript\r\nvar success = function(data) {\r\n // ...\r\n};\r\nvar failure = function(data) {\r\n // ...\r\n};\r\n\r\nswitch(action) {\r\ncase \"update\":\r\n  self.update(resource, object.metadata.name, object, context, opts).then(success, failure);\r\n  break;\r\ndefault:\r\n  self.create(resource, null, object, context, opts).then(success, failure);\r\n  break;\r\n}\r\n```","created_at":"2016-04-14T12:55:15Z","updated_at":"2016-04-14T12:55:15Z","html_url":"https://github.com/jwforres/origin/pull/53#discussion_r59711286","pull_request_url":"https://api.github.com/repos/jwforres/origin/pulls/53","_links":{"self":{"href":"https://api.github.com/repos/jwforres/origin/pulls/comments/59711286"},"html":{"href":"https://github.com/jwforres/origin/pull/53#discussion_r59711286"},"pull_request":{"href":"https://api.github.com/repos/jwforres/origin/pulls/53"}}},"pull_request":{"url":"https://api.github.com/repos/jwforres/origin/pulls/53","id":66344967,"html_url":"https://github.com/jwforres/origin/pull/53","diff_url":"https://github.com/jwforres/origin/pull/53.diff","patch_url":"https://github.com/jwforres/origin/pull/53.patch","issue_url":"https://api.github.com/repos/jwforres/origin/issues/53","number":53,"state":"open","locked":false,"title":"Upload component during the create flow","user":{"login":"jhadvig","id":1668218,"avatar_url":"https://avatars.githubusercontent.com/u/1668218?v=3","gravatar_id":"","url":"https://api.github.com/users/jhadvig","html_url":"https://github.com/jhadvig","followers_url":"https://api.github.com/users/jhadvig/followers","following_url":"https://api.github.com/users/jhadvig/following{/other_user}","gists_url":"https://api.github.com/users/jhadvig/gists{/gist_id}","starred_url":"https://api.github.com/users/jhadvig/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jhadvig/subscriptions","organizations_url":"https://api.github.com/users/jhadvig/orgs","repos_url":"https://api.github.com/users/jhadvig/repos","events_url":"https://api.github.com/users/jhadvig/events{/privacy}","received_events_url":"https://api.github.com/users/jhadvig/received_events","type":"User","site_admin":false},"body":"Adding option to add to project any component that we expose to the users. For this I've created a separate tab in the 'Add to project' page\r\nComponent could be added in a multiple ways:\r\n1. Browse trough the file on users local machine by hitting the \"Browse\" button right to the input field. \r\n2. Paste component description into ace editor beneath the input field.\r\n3. Drag and Drop the file from users local machine to the area of the input field or ace editor.\r\nJSON and YAML format are supported.\r\n\r\nWhen using drag&drop the drop area will be highlighted(picture 1,2). Had to update the oscFileInput scope with an fileExtension and dropArea variable. Originally wanted to have whole filename, but realize that more valid information then filename(which could be anything) is the file extention. The dropArea variable points to a area which should respond to Drag'n'Drop action.\r\n\r\nPicture 1\r\n![screenshot-12](https://cloud.githubusercontent.com/assets/1668218/14499547/0ab48060-019f-11e6-829f-fd02672c6b9e.png)\r\nPicture 2\r\n![screenshot-11](https://cloud.githubusercontent.com/assets/1668218/14499553/0ef60b44-019f-11e6-90d2-63fa2cb3433c.png)\r\n\r\nAlso update the oscRouting together with osc-routing.html to work similarly:\r\n![screenshot-13](https://cloud.githubusercontent.com/assets/1668218/14499623/594c32c2-019f-11e6-8fc7-02a654bcc727.png)\r\n![screenshot-14](https://cloud.githubusercontent.com/assets/1668218/14499624/5adfd576-019f-11e6-98a7-426425666595.png)\r\n\r\n@spadgett @jwforres PTAL\r\n\r\n\r\nThe styling of the d'n'd will might need some additional adjustments ... cc'ing @sg00dwin","created_at":"2016-04-13T15:47:57Z","updated_at":"2016-04-14T12:55:15Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7e6cbb03adfccbde3398b8ea5c6c6946f8b4289c","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/jwforres/origin/pulls/53/commits","review_comments_url":"https://api.github.com/repos/jwforres/origin/pulls/53/comments","review_comment_url":"https://api.github.com/repos/jwforres/origin/pulls/comments{/number}","comments_url":"https://api.github.com/repos/jwforres/origin/issues/53/comments","statuses_url":"https://api.github.com/repos/jwforres/origin/statuses/26b6811bc0abd0a1d96a1a6d9a4beddea1516a76","head":{"label":"jhadvig:add-component-jessica-rebase","ref":"add-component-jessica-rebase","sha":"26b6811bc0abd0a1d96a1a6d9a4beddea1516a76","user":{"login":"jhadvig","id":1668218,"avatar_url":"https://avatars.githubusercontent.com/u/1668218?v=3","gravatar_id":"","url":"https://api.github.com/users/jhadvig","html_url":"https://github.com/jhadvig","followers_url":"https://api.github.com/users/jhadvig/followers","following_url":"https://api.github.com/users/jhadvig/following{/other_user}","gists_url":"https://api.github.com/users/jhadvig/gists{/gist_id}","starred_url":"https://api.github.com/users/jhadvig/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jhadvig/subscriptions","organizations_url":"https://api.github.com/users/jhadvig/orgs","repos_url":"https://api.github.com/users/jhadvig/repos","events_url":"https://api.github.com/users/jhadvig/events{/privacy}","received_events_url":"https://api.github.com/users/jhadvig/received_events","type":"User","site_admin":false},"repo":{"id":24180023,"name":"origin","full_name":"jhadvig/origin","owner":{"login":"jhadvig","id":1668218,"avatar_url":"https://avatars.githubusercontent.com/u/1668218?v=3","gravatar_id":"","url":"https://api.github.com/users/jhadvig","html_url":"https://github.com/jhadvig","followers_url":"https://api.github.com/users/jhadvig/followers","following_url":"https://api.github.com/users/jhadvig/following{/other_user}","gists_url":"https://api.github.com/users/jhadvig/gists{/gist_id}","starred_url":"https://api.github.com/users/jhadvig/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jhadvig/subscriptions","organizations_url":"https://api.github.com/users/jhadvig/orgs","repos_url":"https://api.github.com/users/jhadvig/repos","events_url":"https://api.github.com/users/jhadvig/events{/privacy}","received_events_url":"https://api.github.com/users/jhadvig/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jhadvig/origin","description":"OpenShift 3 - build, deploy, and manage your applications with Docker and Kubernetes","fork":true,"url":"https://api.github.com/repos/jhadvig/origin","forks_url":"https://api.github.com/repos/jhadvig/origin/forks","keys_url":"https://api.github.com/repos/jhadvig/origin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jhadvig/origin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jhadvig/origin/teams","hooks_url":"https://api.github.com/repos/jhadvig/origin/hooks","issue_events_url":"https://api.github.com/repos/jhadvig/origin/issues/events{/number}","events_url":"https://api.github.com/repos/jhadvig/origin/events","assignees_url":"https://api.github.com/repos/jhadvig/origin/assignees{/user}","branches_url":"https://api.github.com/repos/jhadvig/origin/branches{/branch}","tags_url":"https://api.github.com/repos/jhadvig/origin/tags","blobs_url":"https://api.github.com/repos/jhadvig/origin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jhadvig/origin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jhadvig/origin/git/refs{/sha}","trees_url":"https://api.github.com/repos/jhadvig/origin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jhadvig/origin/statuses/{sha}","languages_url":"https://api.github.com/repos/jhadvig/origin/languages","stargazers_url":"https://api.github.com/repos/jhadvig/origin/stargazers","contributors_url":"https://api.github.com/repos/jhadvig/origin/contributors","subscribers_url":"https://api.github.com/repos/jhadvig/origin/subscribers","subscription_url":"https://api.github.com/repos/jhadvig/origin/subscription","commits_url":"https://api.github.com/repos/jhadvig/origin/commits{/sha}","git_commits_url":"https://api.github.com/repos/jhadvig/origin/git/commits{/sha}","comments_url":"https://api.github.com/repos/jhadvig/origin/comments{/number}","issue_comment_url":"https://api.github.com/repos/jhadvig/origin/issues/comments{/number}","contents_url":"https://api.github.com/repos/jhadvig/origin/contents/{+path}","compare_url":"https://api.github.com/repos/jhadvig/origin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jhadvig/origin/merges","archive_url":"https://api.github.com/repos/jhadvig/origin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jhadvig/origin/downloads","issues_url":"https://api.github.com/repos/jhadvig/origin/issues{/number}","pulls_url":"https://api.github.com/repos/jhadvig/origin/pulls{/number}","milestones_url":"https://api.github.com/repos/jhadvig/origin/milestones{/number}","notifications_url":"https://api.github.com/repos/jhadvig/origin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jhadvig/origin/labels{/name}","releases_url":"https://api.github.com/repos/jhadvig/origin/releases{/id}","deployments_url":"https://api.github.com/repos/jhadvig/origin/deployments","created_at":"2014-09-18T08:22:36Z","updated_at":"2015-08-13T16:47:19Z","pushed_at":"2016-04-13T15:25:35Z","git_url":"git://github.com/jhadvig/origin.git","ssh_url":"git@github.com:jhadvig/origin.git","clone_url":"https://github.com/jhadvig/origin.git","svn_url":"https://github.com/jhadvig/origin","homepage":"https://openshift.github.io","size":243248,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"jwforres:console_1.3","ref":"console_1.3","sha":"3c6f25bf0e6cc0addb150b6fd24cad576e23ee6b","user":{"login":"jwforres","id":1467629,"avatar_url":"https://avatars.githubusercontent.com/u/1467629?v=3","gravatar_id":"","url":"https://api.github.com/users/jwforres","html_url":"https://github.com/jwforres","followers_url":"https://api.github.com/users/jwforres/followers","following_url":"https://api.github.com/users/jwforres/following{/other_user}","gists_url":"https://api.github.com/users/jwforres/gists{/gist_id}","starred_url":"https://api.github.com/users/jwforres/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jwforres/subscriptions","organizations_url":"https://api.github.com/users/jwforres/orgs","repos_url":"https://api.github.com/users/jwforres/repos","events_url":"https://api.github.com/users/jwforres/events{/privacy}","received_events_url":"https://api.github.com/users/jwforres/received_events","type":"User","site_admin":false},"repo":{"id":22971182,"name":"origin","full_name":"jwforres/origin","owner":{"login":"jwforres","id":1467629,"avatar_url":"https://avatars.githubusercontent.com/u/1467629?v=3","gravatar_id":"","url":"https://api.github.com/users/jwforres","html_url":"https://github.com/jwforres","followers_url":"https://api.github.com/users/jwforres/followers","following_url":"https://api.github.com/users/jwforres/following{/other_user}","gists_url":"https://api.github.com/users/jwforres/gists{/gist_id}","starred_url":"https://api.github.com/users/jwforres/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jwforres/subscriptions","organizations_url":"https://api.github.com/users/jwforres/orgs","repos_url":"https://api.github.com/users/jwforres/repos","events_url":"https://api.github.com/users/jwforres/events{/privacy}","received_events_url":"https://api.github.com/users/jwforres/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jwforres/origin","description":"OpenShift 3 - build, deploy, and manage your applications with Docker and Kubernetes","fork":true,"url":"https://api.github.com/repos/jwforres/origin","forks_url":"https://api.github.com/repos/jwforres/origin/forks","keys_url":"https://api.github.com/repos/jwforres/origin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jwforres/origin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jwforres/origin/teams","hooks_url":"https://api.github.com/repos/jwforres/origin/hooks","issue_events_url":"https://api.github.com/repos/jwforres/origin/issues/events{/number}","events_url":"https://api.github.com/repos/jwforres/origin/events","assignees_url":"https://api.github.com/repos/jwforres/origin/assignees{/user}","branches_url":"https://api.github.com/repos/jwforres/origin/branches{/branch}","tags_url":"https://api.github.com/repos/jwforres/origin/tags","blobs_url":"https://api.github.com/repos/jwforres/origin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jwforres/origin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jwforres/origin/git/refs{/sha}","trees_url":"https://api.github.com/repos/jwforres/origin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jwforres/origin/statuses/{sha}","languages_url":"https://api.github.com/repos/jwforres/origin/languages","stargazers_url":"https://api.github.com/repos/jwforres/origin/stargazers","contributors_url":"https://api.github.com/repos/jwforres/origin/contributors","subscribers_url":"https://api.github.com/repos/jwforres/origin/subscribers","subscription_url":"https://api.github.com/repos/jwforres/origin/subscription","commits_url":"https://api.github.com/repos/jwforres/origin/commits{/sha}","git_commits_url":"https://api.github.com/repos/jwforres/origin/git/commits{/sha}","comments_url":"https://api.github.com/repos/jwforres/origin/comments{/number}","issue_comment_url":"https://api.github.com/repos/jwforres/origin/issues/comments{/number}","contents_url":"https://api.github.com/repos/jwforres/origin/contents/{+path}","compare_url":"https://api.github.com/repos/jwforres/origin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jwforres/origin/merges","archive_url":"https://api.github.com/repos/jwforres/origin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jwforres/origin/downloads","issues_url":"https://api.github.com/repos/jwforres/origin/issues{/number}","pulls_url":"https://api.github.com/repos/jwforres/origin/pulls{/number}","milestones_url":"https://api.github.com/repos/jwforres/origin/milestones{/number}","notifications_url":"https://api.github.com/repos/jwforres/origin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jwforres/origin/labels{/name}","releases_url":"https://api.github.com/repos/jwforres/origin/releases{/id}","deployments_url":"https://api.github.com/repos/jwforres/origin/deployments","created_at":"2014-08-14T22:53:50Z","updated_at":"2016-03-23T15:27:09Z","pushed_at":"2016-04-13T20:38:17Z","git_url":"git://github.com/jwforres/origin.git","ssh_url":"git@github.com:jwforres/origin.git","clone_url":"https://github.com/jwforres/origin.git","svn_url":"https://github.com/jwforres/origin","homepage":"https://openshift.github.io","size":248347,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":10,"forks":0,"open_issues":10,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/jwforres/origin/pulls/53"},"html":{"href":"https://github.com/jwforres/origin/pull/53"},"issue":{"href":"https://api.github.com/repos/jwforres/origin/issues/53"},"comments":{"href":"https://api.github.com/repos/jwforres/origin/issues/53/comments"},"review_comments":{"href":"https://api.github.com/repos/jwforres/origin/pulls/53/comments"},"review_comment":{"href":"https://api.github.com/repos/jwforres/origin/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/jwforres/origin/pulls/53/commits"},"statuses":{"href":"https://api.github.com/repos/jwforres/origin/statuses/26b6811bc0abd0a1d96a1a6d9a4beddea1516a76"}}}}