{"action":"created","comment":{"url":"https://api.github.com/repos/openshift/origin-web-console/pulls/comments/77867086","id":77867086,"diff_hunk":"@@ -0,0 +1,448 @@\n+'use strict';\n+\n+/**\n+ * @ngdoc function\n+ * @name openshiftConsole.controller:ReplicaSetController\n+ * @description\n+ * Controller of the openshiftConsole\n+ */\n+angular.module('openshiftConsole')\n+  .controller('ReplicaSetController',\n+              function ($scope,\n+                        $filter,\n+                        $routeParams,\n+                        AlertMessageService,\n+                        DataService,\n+                        HPAService,\n+                        MetricsService,\n+                        ProjectsService,\n+                        DeploymentsService,\n+                        ImageStreamResolver,\n+                        Navigate,\n+                        keyValueEditorUtils,\n+                        kind) {\n+    var hasDC = false;\n+    var displayKind = $filter('humanizeKind')(kind);\n+    switch (kind) {\n+    case 'ReplicaSet':\n+      $scope.breadcrumbs = [\n+        {\n+          title: \"Replica Sets\",\n+          link: \"project/\" + $routeParams.project + \"/browse/deployments\"\n+        }\n+      ];\n+\n+      $scope.resource = {\n+        group: \"extensions\",\n+        resource: \"replicasets\"\n+      };\n+      $scope.healthCheckURL = Navigate.healthCheckURL($routeParams.project,\n+                                                      \"ReplicaSet\",\n+                                                      $routeParams.replicaSet,\n+                                                      \"extensions\");\n+      break;\n+    case 'ReplicationController':\n+      $scope.breadcrumbs = [\n+        {\n+          title: \"Replication Controllers\",\n+          link: \"project/\" + $routeParams.project + \"/browse/deployments\"\n+        }\n+      ];\n+\n+      $scope.resource = 'replicationcontrollers';\n+      $scope.healthCheckURL = Navigate.healthCheckURL($routeParams.project,\n+                                                      \"ReplicationController\",\n+                                                      $routeParams.replicaSet);\n+      break;\n+    }\n+\n+    $scope.projectName = $routeParams.project;\n+    $scope.kind = kind;\n+    // Either a ReplicaSet or a ReplicaSetController\n+    // TODO: Rename scope var to avoid confusion with k8s deployments.\n+    $scope.deployment = null;\n+    $scope.deploymentConfig = null;\n+    $scope.deploymentConfigMissing = false;\n+    $scope.deployments = {};\n+    $scope.podTemplates = {};\n+    $scope.imageStreams = {};\n+    $scope.imagesByDockerReference = {};\n+    $scope.imageStreamImageRefByDockerReference = {}; // lets us determine if a particular container's docker image reference belongs to an imageStream\n+    $scope.builds = {};\n+    $scope.alerts = {};\n+    $scope.renderOptions = $scope.renderOptions || {};\n+    $scope.renderOptions.hideFilterWidget = true;\n+    $scope.forms = {};\n+    $scope.breadcrumbs.push({\n+      title: $routeParams.replicaSet\n+    });\n+\n+    // Check for a ?tab=<name> query param to allow linking directly to a tab.\n+    if ($routeParams.tab) {\n+      $scope.selectedTab = {};\n+      $scope.selectedTab[$routeParams.tab] = true;\n+    }\n+\n+    $scope.logOptions = {};\n+\n+    // get and clear any alerts\n+    AlertMessageService.getAlerts().forEach(function(alert) {\n+      $scope.alerts[alert.name] = alert.data;\n+    });\n+    AlertMessageService.clearAlerts();\n+\n+    var watches = [];\n+\n+    // Check if the metrics service is available so we know when to show the tab.\n+    MetricsService.isAvailable().then(function(available) {\n+      $scope.metricsAvailable = available;\n+    });\n+\n+    var setLogVars = function(deployment) {\n+      $scope.logCanRun = !(_.includes(['New', 'Pending'], $filter('deploymentStatus')(deployment)));\n+    };\n+\n+    var copyDeploymentAndEnsureEnv = function(deployment) {\n+      $scope.updatedDeployment = angular.copy(deployment);\n+      _.each($scope.updatedDeployment.spec.template.spec.containers, function(container) {\n+        container.env = container.env || [];\n+      });\n+    };\n+\n+    $scope.saveEnvVars = function() {\n+      _.each($scope.updatedDeployment.spec.template.spec.containers, function(container) {\n+        container.env = keyValueEditorUtils.compactEntries(angular.copy(container.env));\n+      });\n+      DataService\n+        .update(\n+          $scope.resource,\n+          $routeParams.replicaSet,\n+          angular.copy($scope.updatedDeployment),\n+          $scope.projectContext)\n+        .then(function() {\n+          $scope.alerts['saveEnvSuccess'] = {\n+            type: \"success\",\n+            // TODO:  improve success alert\n+            message: $scope.deployment.metadata.name + \" was updated.\"\n+          };\n+          $scope.forms.envForm.$setPristine();\n+        }, function(e) {\n+          $scope.alerts['saveEnvError'] = {\n+            type: \"error\",\n+            message: $scope.deployment.metadata.name + \" was not updated.\",\n+            details: \"Reason: \" + $filter('getErrorDetails')(e)\n+          };\n+        });\n+    };\n+\n+    $scope.clearEnvVarUpdates = function() {\n+      copyDeploymentAndEnsureEnv($scope.deployment);\n+      $scope.forms.envForm.$setPristine();\n+    };\n+\n+    var limitWatches = $filter('isIE')() || $filter('isEdge')();\n+\n+    ProjectsService\n+      .get($routeParams.project)\n+      .then(_.spread(function(project, context) {\n+        $scope.project = project;\n+        // FIXME: DataService.createStream() requires a scope with a\n+        // projectPromise rather than just a namespace, so we have to pass the\n+        // context into the log-viewer directive.\n+        $scope.projectContext = context;\n+\n+        var allHPA = {}, limitRanges = {};\n+        var updateHPA = function() {\n+          $scope.hpaForRS = HPAService.filterHPA(allHPA, kind, $routeParams.replicaSet);\n+          if ($scope.isActive) {\n+            // Show both HPAs that target the RC and the DC if this is the active deployment.\n+            var hpaForDC = HPAService.filterHPA(allHPA, 'DeploymentConfig', $scope.deploymentConfigName);\n+            $scope.autoscalers = $scope.hpaForRS.concat(hpaForDC);\n+          } else {\n+            $scope.autoscalers = $scope.hpaForRS;\n+          }\n+        };\n+\n+        var watchActiveDeployment = function() {\n+          // Watch all replication controllers so we know if this is the active deployment to enable scaling.\n+          watches.push(DataService.watch($scope.resource, context, function(deployments) {\n+            var activeDeployment,\n+                deploymentsForConfig = [],\n+                getAnnotation = $filter(\"annotation\");\n+            // Filter the list to just those deployments for this config.\n+            angular.forEach(deployments.by(\"metadata.name\"), function(deployment) {\n+              var depConfigName = getAnnotation(deployment, 'deploymentConfig') || \"\";\n+              if (depConfigName === $scope.deploymentConfigName) {\n+                deploymentsForConfig.push(deployment);\n+              }\n+            });\n+            activeDeployment = DeploymentsService.getActiveDeployment(deploymentsForConfig);\n+            $scope.isActive = activeDeployment && activeDeployment.metadata.uid === $scope.deployment.metadata.uid;\n+            updateHPA();\n+          }));\n+        };\n+\n+        var pods, selector;\n+        var updatePodsForDeployment = function() {\n+          if (!pods || !selector) {\n+            return;\n+          }\n+\n+          $scope.podsForDeployment = _.filter(pods, function(pod) {\n+            return selector.matches(pod);\n+          });\n+        };\n+\n+        var updateHPAWarnings = function() {\n+            HPAService.getHPAWarnings($scope.deployment, $scope.autoscalers, limitRanges, project)\n+                      .then(function(warnings) {\n+              $scope.hpaWarnings = warnings;\n+            });\n+        };\n+\n+        var updateDC = function(rc) {","path":"app/scripts/controllers/replicaSet.js","position":187,"original_position":203,"commit_id":"70fc0336a425fd22fbd7ffd586c599fc938fc540","original_commit_id":"1860434f9a525a8ed1f430fe58d2720f9452f79b","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":"Added TODO","created_at":"2016-09-07T17:21:56Z","updated_at":"2016-09-07T17:21:56Z","html_url":"https://github.com/openshift/origin-web-console/pull/508#discussion_r77867086","pull_request_url":"https://api.github.com/repos/openshift/origin-web-console/pulls/508","_links":{"self":{"href":"https://api.github.com/repos/openshift/origin-web-console/pulls/comments/77867086"},"html":{"href":"https://github.com/openshift/origin-web-console/pull/508#discussion_r77867086"},"pull_request":{"href":"https://api.github.com/repos/openshift/origin-web-console/pulls/508"}}},"pull_request":{"url":"https://api.github.com/repos/openshift/origin-web-console/pulls/508","id":83689133,"html_url":"https://github.com/openshift/origin-web-console/pull/508","diff_url":"https://github.com/openshift/origin-web-console/pull/508.diff","patch_url":"https://github.com/openshift/origin-web-console/pull/508.patch","issue_url":"https://api.github.com/repos/openshift/origin-web-console/issues/508","number":508,"state":"open","locked":false,"title":"Browse pages for k8s deployments and replica sets","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":"Add browse pages for deployments and replica sets. This does not update the overview or monitoring page.\r\n\r\n","created_at":"2016-09-01T19:07:45Z","updated_at":"2016-09-07T17:21:56Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3d6b0003a427ac318baeaa2a83fb60c53b0383ef","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/openshift/origin-web-console/pulls/508/commits","review_comments_url":"https://api.github.com/repos/openshift/origin-web-console/pulls/508/comments","review_comment_url":"https://api.github.com/repos/openshift/origin-web-console/pulls/comments{/number}","comments_url":"https://api.github.com/repos/openshift/origin-web-console/issues/508/comments","statuses_url":"https://api.github.com/repos/openshift/origin-web-console/statuses/70fc0336a425fd22fbd7ffd586c599fc938fc540","head":{"label":"spadgett:k8s-deployments","ref":"k8s-deployments","sha":"70fc0336a425fd22fbd7ffd586c599fc938fc540","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},"repo":{"id":58545409,"name":"origin-web-console","full_name":"spadgett/origin-web-console","owner":{"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},"private":false,"html_url":"https://github.com/spadgett/origin-web-console","description":"","fork":true,"url":"https://api.github.com/repos/spadgett/origin-web-console","forks_url":"https://api.github.com/repos/spadgett/origin-web-console/forks","keys_url":"https://api.github.com/repos/spadgett/origin-web-console/keys{/key_id}","collaborators_url":"https://api.github.com/repos/spadgett/origin-web-console/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/spadgett/origin-web-console/teams","hooks_url":"https://api.github.com/repos/spadgett/origin-web-console/hooks","issue_events_url":"https://api.github.com/repos/spadgett/origin-web-console/issues/events{/number}","events_url":"https://api.github.com/repos/spadgett/origin-web-console/events","assignees_url":"https://api.github.com/repos/spadgett/origin-web-console/assignees{/user}","branches_url":"https://api.github.com/repos/spadgett/origin-web-console/branches{/branch}","tags_url":"https://api.github.com/repos/spadgett/origin-web-console/tags","blobs_url":"https://api.github.com/repos/spadgett/origin-web-console/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/spadgett/origin-web-console/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/spadgett/origin-web-console/git/refs{/sha}","trees_url":"https://api.github.com/repos/spadgett/origin-web-console/git/trees{/sha}","statuses_url":"https://api.github.com/repos/spadgett/origin-web-console/statuses/{sha}","languages_url":"https://api.github.com/repos/spadgett/origin-web-console/languages","stargazers_url":"https://api.github.com/repos/spadgett/origin-web-console/stargazers","contributors_url":"https://api.github.com/repos/spadgett/origin-web-console/contributors","subscribers_url":"https://api.github.com/repos/spadgett/origin-web-console/subscribers","subscription_url":"https://api.github.com/repos/spadgett/origin-web-console/subscription","commits_url":"https://api.github.com/repos/spadgett/origin-web-console/commits{/sha}","git_commits_url":"https://api.github.com/repos/spadgett/origin-web-console/git/commits{/sha}","comments_url":"https://api.github.com/repos/spadgett/origin-web-console/comments{/number}","issue_comment_url":"https://api.github.com/repos/spadgett/origin-web-console/issues/comments{/number}","contents_url":"https://api.github.com/repos/spadgett/origin-web-console/contents/{+path}","compare_url":"https://api.github.com/repos/spadgett/origin-web-console/compare/{base}...{head}","merges_url":"https://api.github.com/repos/spadgett/origin-web-console/merges","archive_url":"https://api.github.com/repos/spadgett/origin-web-console/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/spadgett/origin-web-console/downloads","issues_url":"https://api.github.com/repos/spadgett/origin-web-console/issues{/number}","pulls_url":"https://api.github.com/repos/spadgett/origin-web-console/pulls{/number}","milestones_url":"https://api.github.com/repos/spadgett/origin-web-console/milestones{/number}","notifications_url":"https://api.github.com/repos/spadgett/origin-web-console/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/spadgett/origin-web-console/labels{/name}","releases_url":"https://api.github.com/repos/spadgett/origin-web-console/releases{/id}","deployments_url":"https://api.github.com/repos/spadgett/origin-web-console/deployments","created_at":"2016-05-11T13:03:37Z","updated_at":"2016-05-11T13:03:40Z","pushed_at":"2016-09-07T14:48:14Z","git_url":"git://github.com/spadgett/origin-web-console.git","ssh_url":"git@github.com:spadgett/origin-web-console.git","clone_url":"https://github.com/spadgett/origin-web-console.git","svn_url":"https://github.com/spadgett/origin-web-console","homepage":null,"size":13551,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"openshift:master","ref":"master","sha":"c801e3e079a7a86a95ecc1f7d53910ca632f4f37","user":{"login":"openshift","id":792337,"avatar_url":"https://avatars.githubusercontent.com/u/792337?v=3","gravatar_id":"","url":"https://api.github.com/users/openshift","html_url":"https://github.com/openshift","followers_url":"https://api.github.com/users/openshift/followers","following_url":"https://api.github.com/users/openshift/following{/other_user}","gists_url":"https://api.github.com/users/openshift/gists{/gist_id}","starred_url":"https://api.github.com/users/openshift/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openshift/subscriptions","organizations_url":"https://api.github.com/users/openshift/orgs","repos_url":"https://api.github.com/users/openshift/repos","events_url":"https://api.github.com/users/openshift/events{/privacy}","received_events_url":"https://api.github.com/users/openshift/received_events","type":"Organization","site_admin":false},"repo":{"id":58488264,"name":"origin-web-console","full_name":"openshift/origin-web-console","owner":{"login":"openshift","id":792337,"avatar_url":"https://avatars.githubusercontent.com/u/792337?v=3","gravatar_id":"","url":"https://api.github.com/users/openshift","html_url":"https://github.com/openshift","followers_url":"https://api.github.com/users/openshift/followers","following_url":"https://api.github.com/users/openshift/following{/other_user}","gists_url":"https://api.github.com/users/openshift/gists{/gist_id}","starred_url":"https://api.github.com/users/openshift/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openshift/subscriptions","organizations_url":"https://api.github.com/users/openshift/orgs","repos_url":"https://api.github.com/users/openshift/repos","events_url":"https://api.github.com/users/openshift/events{/privacy}","received_events_url":"https://api.github.com/users/openshift/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/openshift/origin-web-console","description":"","fork":false,"url":"https://api.github.com/repos/openshift/origin-web-console","forks_url":"https://api.github.com/repos/openshift/origin-web-console/forks","keys_url":"https://api.github.com/repos/openshift/origin-web-console/keys{/key_id}","collaborators_url":"https://api.github.com/repos/openshift/origin-web-console/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/openshift/origin-web-console/teams","hooks_url":"https://api.github.com/repos/openshift/origin-web-console/hooks","issue_events_url":"https://api.github.com/repos/openshift/origin-web-console/issues/events{/number}","events_url":"https://api.github.com/repos/openshift/origin-web-console/events","assignees_url":"https://api.github.com/repos/openshift/origin-web-console/assignees{/user}","branches_url":"https://api.github.com/repos/openshift/origin-web-console/branches{/branch}","tags_url":"https://api.github.com/repos/openshift/origin-web-console/tags","blobs_url":"https://api.github.com/repos/openshift/origin-web-console/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/openshift/origin-web-console/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/openshift/origin-web-console/git/refs{/sha}","trees_url":"https://api.github.com/repos/openshift/origin-web-console/git/trees{/sha}","statuses_url":"https://api.github.com/repos/openshift/origin-web-console/statuses/{sha}","languages_url":"https://api.github.com/repos/openshift/origin-web-console/languages","stargazers_url":"https://api.github.com/repos/openshift/origin-web-console/stargazers","contributors_url":"https://api.github.com/repos/openshift/origin-web-console/contributors","subscribers_url":"https://api.github.com/repos/openshift/origin-web-console/subscribers","subscription_url":"https://api.github.com/repos/openshift/origin-web-console/subscription","commits_url":"https://api.github.com/repos/openshift/origin-web-console/commits{/sha}","git_commits_url":"https://api.github.com/repos/openshift/origin-web-console/git/commits{/sha}","comments_url":"https://api.github.com/repos/openshift/origin-web-console/comments{/number}","issue_comment_url":"https://api.github.com/repos/openshift/origin-web-console/issues/comments{/number}","contents_url":"https://api.github.com/repos/openshift/origin-web-console/contents/{+path}","compare_url":"https://api.github.com/repos/openshift/origin-web-console/compare/{base}...{head}","merges_url":"https://api.github.com/repos/openshift/origin-web-console/merges","archive_url":"https://api.github.com/repos/openshift/origin-web-console/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/openshift/origin-web-console/downloads","issues_url":"https://api.github.com/repos/openshift/origin-web-console/issues{/number}","pulls_url":"https://api.github.com/repos/openshift/origin-web-console/pulls{/number}","milestones_url":"https://api.github.com/repos/openshift/origin-web-console/milestones{/number}","notifications_url":"https://api.github.com/repos/openshift/origin-web-console/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/openshift/origin-web-console/labels{/name}","releases_url":"https://api.github.com/repos/openshift/origin-web-console/releases{/id}","deployments_url":"https://api.github.com/repos/openshift/origin-web-console/deployments","created_at":"2016-05-10T19:31:50Z","updated_at":"2016-08-22T11:45:49Z","pushed_at":"2016-09-07T15:51:02Z","git_url":"git://github.com/openshift/origin-web-console.git","ssh_url":"git@github.com:openshift/origin-web-console.git","clone_url":"https://github.com/openshift/origin-web-console.git","svn_url":"https://github.com/openshift/origin-web-console","homepage":null,"size":13734,"stargazers_count":18,"watchers_count":18,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":43,"mirror_url":null,"open_issues_count":55,"forks":43,"open_issues":55,"watchers":18,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/openshift/origin-web-console/pulls/508"},"html":{"href":"https://github.com/openshift/origin-web-console/pull/508"},"issue":{"href":"https://api.github.com/repos/openshift/origin-web-console/issues/508"},"comments":{"href":"https://api.github.com/repos/openshift/origin-web-console/issues/508/comments"},"review_comments":{"href":"https://api.github.com/repos/openshift/origin-web-console/pulls/508/comments"},"review_comment":{"href":"https://api.github.com/repos/openshift/origin-web-console/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/openshift/origin-web-console/pulls/508/commits"},"statuses":{"href":"https://api.github.com/repos/openshift/origin-web-console/statuses/70fc0336a425fd22fbd7ffd586c599fc938fc540"}}}}
{"actor":{"display_login":"spadgett"}}