{"action":"created","comment":{"url":"https://api.github.com/repos/mesosphere/marathon-ui/pulls/comments/44764789","id":44764789,"diff_hunk":"@@ -0,0 +1,159 @@\n+var classNames = require(\"classnames\");\n+var React = require(\"react/addons\");\n+\n+var OnClickOutsideMixin = require(\"react-onclickoutside\");\n+var Util = require(\"../helpers/Util\");\n+\n+var AppListItemLabelsComponent = React.createClass({\n+  displayName: \"AppListItemLabelsComponent\",\n+\n+  initialMarginTop: null,\n+\n+  mixins: [OnClickOutsideMixin],\n+\n+  propTypes: {\n+    children: React.PropTypes.node,\n+    labels: React.PropTypes.object,\n+    numberOfVisibleLabels: React.PropTypes.number\n+  },\n+\n+  getInitialState: function () {\n+    return {\n+      isDropdownVisible: false\n+    };\n+  },\n+\n+  componentDidUpdate: function () {\n+    if (this.state.isDropdownVisible === true) {\n+      this.recalculateDropdownPosition();\n+    }\n+  },\n+\n+  shouldComponentUpdate(nextProps, nextState) {\n+    return this.didPropsChange(nextProps, nextState);\n+  },\n+\n+  didPropsChange: function (props, state) {\n+    let keys = [\"labels\", \"numberOfVisibleLabels\"];\n+    return !Util.compareProperties(this.props, props, ...keys) ||\n+      this.state.isDropdownVisible !== state.isDropdownVisible;\n+  },\n+\n+  handleClickOutside: function () {\n+    this.setState({\n+      isDropdownVisible: false\n+    });\n+  },\n+\n+  handleShowMoreClick: function (event) {\n+    event.stopPropagation();\n+    this.setState({\n+      isDropdownVisible: !this.state.isDropdownVisible\n+    });\n+  },\n+\n+  recalculateDropdownPosition: function () {\n+    if (global.window == null) {\n+      return;\n+    }\n+\n+    let dropdownNode = React.findDOMNode(this.refs.labelsDropdown);\n+    let leftArrowNode = React.findDOMNode(this.refs.leftArrow);\n+\n+    // First time the dropdown becomes visible: get its initial top offset\n+    if (this.initialMarginTop == null) {\n+      this.initialMarginTop = Math.abs(dropdownNode.offsetTop);\n+    }\n+\n+    let height = dropdownNode.offsetHeight;\n+    let vh = document.documentElement.clientHeight;","path":"src/js/components/AppListItemLabelsComponent.jsx","position":69,"original_position":69,"commit_id":"7b33694711eb24c84674554332c39451707aeab4","original_commit_id":"7b33694711eb24c84674554332c39451707aeab4","user":{"login":"pierlo-upitup","id":1078545,"avatar_url":"https://avatars.githubusercontent.com/u/1078545?v=3","gravatar_id":"","url":"https://api.github.com/users/pierlo-upitup","html_url":"https://github.com/pierlo-upitup","followers_url":"https://api.github.com/users/pierlo-upitup/followers","following_url":"https://api.github.com/users/pierlo-upitup/following{/other_user}","gists_url":"https://api.github.com/users/pierlo-upitup/gists{/gist_id}","starred_url":"https://api.github.com/users/pierlo-upitup/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pierlo-upitup/subscriptions","organizations_url":"https://api.github.com/users/pierlo-upitup/orgs","repos_url":"https://api.github.com/users/pierlo-upitup/repos","events_url":"https://api.github.com/users/pierlo-upitup/events{/privacy}","received_events_url":"https://api.github.com/users/pierlo-upitup/received_events","type":"User","site_admin":false},"body":"viewport height – i took the inspiration from the CSS unit.","created_at":"2015-11-13T09:42:50Z","updated_at":"2015-11-13T09:42:50Z","html_url":"https://github.com/mesosphere/marathon-ui/pull/390#discussion_r44764789","pull_request_url":"https://api.github.com/repos/mesosphere/marathon-ui/pulls/390","_links":{"self":{"href":"https://api.github.com/repos/mesosphere/marathon-ui/pulls/comments/44764789"},"html":{"href":"https://github.com/mesosphere/marathon-ui/pull/390#discussion_r44764789"},"pull_request":{"href":"https://api.github.com/repos/mesosphere/marathon-ui/pulls/390"}}},"pull_request":{"url":"https://api.github.com/repos/mesosphere/marathon-ui/pulls/390","id":50552415,"html_url":"https://github.com/mesosphere/marathon-ui/pull/390","diff_url":"https://github.com/mesosphere/marathon-ui/pull/390.diff","patch_url":"https://github.com/mesosphere/marathon-ui/pull/390.patch","issue_url":"https://api.github.com/repos/mesosphere/marathon-ui/issues/390","number":390,"state":"open","locked":false,"title":"Feature/marathon 354 labels dropdown bis","user":{"login":"pierlo-upitup","id":1078545,"avatar_url":"https://avatars.githubusercontent.com/u/1078545?v=3","gravatar_id":"","url":"https://api.github.com/users/pierlo-upitup","html_url":"https://github.com/pierlo-upitup","followers_url":"https://api.github.com/users/pierlo-upitup/followers","following_url":"https://api.github.com/users/pierlo-upitup/following{/other_user}","gists_url":"https://api.github.com/users/pierlo-upitup/gists{/gist_id}","starred_url":"https://api.github.com/users/pierlo-upitup/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pierlo-upitup/subscriptions","organizations_url":"https://api.github.com/users/pierlo-upitup/orgs","repos_url":"https://api.github.com/users/pierlo-upitup/repos","events_url":"https://api.github.com/users/pierlo-upitup/events{/privacy}","received_events_url":"https://api.github.com/users/pierlo-upitup/received_events","type":"User","site_admin":false},"body":"This PR addresses most of the issues of the previous attempt, and does so by extracting the relevant labels part into a new component as suggested by @orlandohohmeier. \r\n\r\nIn order to use `position: absolute` (for the dropdown) within the parent with `postion: relative` (name cell) I had to remove the `overflow: hidden` of the .name cell. So the line-breaking ellipsis on smaller widths is still an issue. But we can solve that in a separate PR, even by simply toggling this className on/off under a certain min width of the container element.\r\n\r\n![dd](https://cloud.githubusercontent.com/assets/1078545/11128075/dc23b4cc-8977-11e5-8d40-3c300276d8d8.gif)\r\n","created_at":"2015-11-12T19:01:20Z","updated_at":"2015-11-13T09:42:50Z","closed_at":null,"merged_at":null,"merge_commit_sha":"16c96afc5bcb7b8570cbfd75938517030b019246","assignee":{"login":"aldipower","id":859154,"avatar_url":"https://avatars.githubusercontent.com/u/859154?v=3","gravatar_id":"","url":"https://api.github.com/users/aldipower","html_url":"https://github.com/aldipower","followers_url":"https://api.github.com/users/aldipower/followers","following_url":"https://api.github.com/users/aldipower/following{/other_user}","gists_url":"https://api.github.com/users/aldipower/gists{/gist_id}","starred_url":"https://api.github.com/users/aldipower/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aldipower/subscriptions","organizations_url":"https://api.github.com/users/aldipower/orgs","repos_url":"https://api.github.com/users/aldipower/repos","events_url":"https://api.github.com/users/aldipower/events{/privacy}","received_events_url":"https://api.github.com/users/aldipower/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/mesosphere/marathon-ui/pulls/390/commits","review_comments_url":"https://api.github.com/repos/mesosphere/marathon-ui/pulls/390/comments","review_comment_url":"https://api.github.com/repos/mesosphere/marathon-ui/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mesosphere/marathon-ui/issues/390/comments","statuses_url":"https://api.github.com/repos/mesosphere/marathon-ui/statuses/7b33694711eb24c84674554332c39451707aeab4","head":{"label":"mesosphere:feature/MARATHON-354-labels-dropdown-bis","ref":"feature/MARATHON-354-labels-dropdown-bis","sha":"7b33694711eb24c84674554332c39451707aeab4","user":{"login":"mesosphere","id":3458585,"avatar_url":"https://avatars.githubusercontent.com/u/3458585?v=3","gravatar_id":"","url":"https://api.github.com/users/mesosphere","html_url":"https://github.com/mesosphere","followers_url":"https://api.github.com/users/mesosphere/followers","following_url":"https://api.github.com/users/mesosphere/following{/other_user}","gists_url":"https://api.github.com/users/mesosphere/gists{/gist_id}","starred_url":"https://api.github.com/users/mesosphere/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mesosphere/subscriptions","organizations_url":"https://api.github.com/users/mesosphere/orgs","repos_url":"https://api.github.com/users/mesosphere/repos","events_url":"https://api.github.com/users/mesosphere/events{/privacy}","received_events_url":"https://api.github.com/users/mesosphere/received_events","type":"Organization","site_admin":false},"repo":{"id":36859608,"name":"marathon-ui","full_name":"mesosphere/marathon-ui","owner":{"login":"mesosphere","id":3458585,"avatar_url":"https://avatars.githubusercontent.com/u/3458585?v=3","gravatar_id":"","url":"https://api.github.com/users/mesosphere","html_url":"https://github.com/mesosphere","followers_url":"https://api.github.com/users/mesosphere/followers","following_url":"https://api.github.com/users/mesosphere/following{/other_user}","gists_url":"https://api.github.com/users/mesosphere/gists{/gist_id}","starred_url":"https://api.github.com/users/mesosphere/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mesosphere/subscriptions","organizations_url":"https://api.github.com/users/mesosphere/orgs","repos_url":"https://api.github.com/users/mesosphere/repos","events_url":"https://api.github.com/users/mesosphere/events{/privacy}","received_events_url":"https://api.github.com/users/mesosphere/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mesosphere/marathon-ui","description":"The web-ui for Marathon (https://github.com/mesosphere/marathon)","fork":false,"url":"https://api.github.com/repos/mesosphere/marathon-ui","forks_url":"https://api.github.com/repos/mesosphere/marathon-ui/forks","keys_url":"https://api.github.com/repos/mesosphere/marathon-ui/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mesosphere/marathon-ui/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mesosphere/marathon-ui/teams","hooks_url":"https://api.github.com/repos/mesosphere/marathon-ui/hooks","issue_events_url":"https://api.github.com/repos/mesosphere/marathon-ui/issues/events{/number}","events_url":"https://api.github.com/repos/mesosphere/marathon-ui/events","assignees_url":"https://api.github.com/repos/mesosphere/marathon-ui/assignees{/user}","branches_url":"https://api.github.com/repos/mesosphere/marathon-ui/branches{/branch}","tags_url":"https://api.github.com/repos/mesosphere/marathon-ui/tags","blobs_url":"https://api.github.com/repos/mesosphere/marathon-ui/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mesosphere/marathon-ui/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mesosphere/marathon-ui/git/refs{/sha}","trees_url":"https://api.github.com/repos/mesosphere/marathon-ui/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mesosphere/marathon-ui/statuses/{sha}","languages_url":"https://api.github.com/repos/mesosphere/marathon-ui/languages","stargazers_url":"https://api.github.com/repos/mesosphere/marathon-ui/stargazers","contributors_url":"https://api.github.com/repos/mesosphere/marathon-ui/contributors","subscribers_url":"https://api.github.com/repos/mesosphere/marathon-ui/subscribers","subscription_url":"https://api.github.com/repos/mesosphere/marathon-ui/subscription","commits_url":"https://api.github.com/repos/mesosphere/marathon-ui/commits{/sha}","git_commits_url":"https://api.github.com/repos/mesosphere/marathon-ui/git/commits{/sha}","comments_url":"https://api.github.com/repos/mesosphere/marathon-ui/comments{/number}","issue_comment_url":"https://api.github.com/repos/mesosphere/marathon-ui/issues/comments{/number}","contents_url":"https://api.github.com/repos/mesosphere/marathon-ui/contents/{+path}","compare_url":"https://api.github.com/repos/mesosphere/marathon-ui/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mesosphere/marathon-ui/merges","archive_url":"https://api.github.com/repos/mesosphere/marathon-ui/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mesosphere/marathon-ui/downloads","issues_url":"https://api.github.com/repos/mesosphere/marathon-ui/issues{/number}","pulls_url":"https://api.github.com/repos/mesosphere/marathon-ui/pulls{/number}","milestones_url":"https://api.github.com/repos/mesosphere/marathon-ui/milestones{/number}","notifications_url":"https://api.github.com/repos/mesosphere/marathon-ui/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mesosphere/marathon-ui/labels{/name}","releases_url":"https://api.github.com/repos/mesosphere/marathon-ui/releases{/id}","created_at":"2015-06-04T09:00:20Z","updated_at":"2015-11-06T07:15:49Z","pushed_at":"2015-11-12T23:41:43Z","git_url":"git://github.com/mesosphere/marathon-ui.git","ssh_url":"git@github.com:mesosphere/marathon-ui.git","clone_url":"https://github.com/mesosphere/marathon-ui.git","svn_url":"https://github.com/mesosphere/marathon-ui","homepage":"","size":11391,"stargazers_count":32,"watchers_count":32,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":17,"mirror_url":null,"open_issues_count":7,"forks":17,"open_issues":7,"watchers":32,"default_branch":"master"}},"base":{"label":"mesosphere:master","ref":"master","sha":"6ed1199185ad8036be4a192a69ba1b6dbd288d86","user":{"login":"mesosphere","id":3458585,"avatar_url":"https://avatars.githubusercontent.com/u/3458585?v=3","gravatar_id":"","url":"https://api.github.com/users/mesosphere","html_url":"https://github.com/mesosphere","followers_url":"https://api.github.com/users/mesosphere/followers","following_url":"https://api.github.com/users/mesosphere/following{/other_user}","gists_url":"https://api.github.com/users/mesosphere/gists{/gist_id}","starred_url":"https://api.github.com/users/mesosphere/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mesosphere/subscriptions","organizations_url":"https://api.github.com/users/mesosphere/orgs","repos_url":"https://api.github.com/users/mesosphere/repos","events_url":"https://api.github.com/users/mesosphere/events{/privacy}","received_events_url":"https://api.github.com/users/mesosphere/received_events","type":"Organization","site_admin":false},"repo":{"id":36859608,"name":"marathon-ui","full_name":"mesosphere/marathon-ui","owner":{"login":"mesosphere","id":3458585,"avatar_url":"https://avatars.githubusercontent.com/u/3458585?v=3","gravatar_id":"","url":"https://api.github.com/users/mesosphere","html_url":"https://github.com/mesosphere","followers_url":"https://api.github.com/users/mesosphere/followers","following_url":"https://api.github.com/users/mesosphere/following{/other_user}","gists_url":"https://api.github.com/users/mesosphere/gists{/gist_id}","starred_url":"https://api.github.com/users/mesosphere/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mesosphere/subscriptions","organizations_url":"https://api.github.com/users/mesosphere/orgs","repos_url":"https://api.github.com/users/mesosphere/repos","events_url":"https://api.github.com/users/mesosphere/events{/privacy}","received_events_url":"https://api.github.com/users/mesosphere/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mesosphere/marathon-ui","description":"The web-ui for Marathon (https://github.com/mesosphere/marathon)","fork":false,"url":"https://api.github.com/repos/mesosphere/marathon-ui","forks_url":"https://api.github.com/repos/mesosphere/marathon-ui/forks","keys_url":"https://api.github.com/repos/mesosphere/marathon-ui/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mesosphere/marathon-ui/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mesosphere/marathon-ui/teams","hooks_url":"https://api.github.com/repos/mesosphere/marathon-ui/hooks","issue_events_url":"https://api.github.com/repos/mesosphere/marathon-ui/issues/events{/number}","events_url":"https://api.github.com/repos/mesosphere/marathon-ui/events","assignees_url":"https://api.github.com/repos/mesosphere/marathon-ui/assignees{/user}","branches_url":"https://api.github.com/repos/mesosphere/marathon-ui/branches{/branch}","tags_url":"https://api.github.com/repos/mesosphere/marathon-ui/tags","blobs_url":"https://api.github.com/repos/mesosphere/marathon-ui/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mesosphere/marathon-ui/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mesosphere/marathon-ui/git/refs{/sha}","trees_url":"https://api.github.com/repos/mesosphere/marathon-ui/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mesosphere/marathon-ui/statuses/{sha}","languages_url":"https://api.github.com/repos/mesosphere/marathon-ui/languages","stargazers_url":"https://api.github.com/repos/mesosphere/marathon-ui/stargazers","contributors_url":"https://api.github.com/repos/mesosphere/marathon-ui/contributors","subscribers_url":"https://api.github.com/repos/mesosphere/marathon-ui/subscribers","subscription_url":"https://api.github.com/repos/mesosphere/marathon-ui/subscription","commits_url":"https://api.github.com/repos/mesosphere/marathon-ui/commits{/sha}","git_commits_url":"https://api.github.com/repos/mesosphere/marathon-ui/git/commits{/sha}","comments_url":"https://api.github.com/repos/mesosphere/marathon-ui/comments{/number}","issue_comment_url":"https://api.github.com/repos/mesosphere/marathon-ui/issues/comments{/number}","contents_url":"https://api.github.com/repos/mesosphere/marathon-ui/contents/{+path}","compare_url":"https://api.github.com/repos/mesosphere/marathon-ui/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mesosphere/marathon-ui/merges","archive_url":"https://api.github.com/repos/mesosphere/marathon-ui/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mesosphere/marathon-ui/downloads","issues_url":"https://api.github.com/repos/mesosphere/marathon-ui/issues{/number}","pulls_url":"https://api.github.com/repos/mesosphere/marathon-ui/pulls{/number}","milestones_url":"https://api.github.com/repos/mesosphere/marathon-ui/milestones{/number}","notifications_url":"https://api.github.com/repos/mesosphere/marathon-ui/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mesosphere/marathon-ui/labels{/name}","releases_url":"https://api.github.com/repos/mesosphere/marathon-ui/releases{/id}","created_at":"2015-06-04T09:00:20Z","updated_at":"2015-11-06T07:15:49Z","pushed_at":"2015-11-12T23:41:43Z","git_url":"git://github.com/mesosphere/marathon-ui.git","ssh_url":"git@github.com:mesosphere/marathon-ui.git","clone_url":"https://github.com/mesosphere/marathon-ui.git","svn_url":"https://github.com/mesosphere/marathon-ui","homepage":"","size":11391,"stargazers_count":32,"watchers_count":32,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":17,"mirror_url":null,"open_issues_count":7,"forks":17,"open_issues":7,"watchers":32,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mesosphere/marathon-ui/pulls/390"},"html":{"href":"https://github.com/mesosphere/marathon-ui/pull/390"},"issue":{"href":"https://api.github.com/repos/mesosphere/marathon-ui/issues/390"},"comments":{"href":"https://api.github.com/repos/mesosphere/marathon-ui/issues/390/comments"},"review_comments":{"href":"https://api.github.com/repos/mesosphere/marathon-ui/pulls/390/comments"},"review_comment":{"href":"https://api.github.com/repos/mesosphere/marathon-ui/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mesosphere/marathon-ui/pulls/390/commits"},"statuses":{"href":"https://api.github.com/repos/mesosphere/marathon-ui/statuses/7b33694711eb24c84674554332c39451707aeab4"}}}}