{"action":"created","comment":{"url":"https://api.github.com/repos/mesosphere/marathon-ui/pulls/comments/34931034","id":34931034,"diff_hunk":"@@ -60,14 +60,62 @@ var util = {\n     var field;\n     /*eslint-disable no-cond-assign */\n     while (field = nodeIterator.nextNode()) {\n-      var val = field.value;\n+      var val = field.value.replace(rCRLF, \"\\r\\n\");\n+      if (field.type === \"number\") {\n+        val = parseFloat(val);\n+      }\n+      if (field.type === \"checkbox\") {\n+        val = !!val;\n+      }\n       if (val) {\n-        serialized.push({name: field.name, value: val.replace(rCRLF, \"\\r\\n\")});\n+        serialized.push({name: field.name, value: val});\n       }\n     }\n     /*eslint-enable no-cond-assign */\n     return serialized;\n   },\n+  serializedArrayToDictionary: function (serializedArray = []) {\n+    let sanitizePath = function (path) {\n+      return path\n+        .replace(/^\\.|\\.$/, \"\") // leading/trailing dots\n+        .replace(/\\.\\.+/, \".\"); // multiple dots\n+    };\n+    let parsePath = function (obj, position, tokens, value) {\n+      if (position === tokens.length) {\n+        return value;\n+      }\n+      let token = tokens[position];\n+      let matches = token.match(/(\\w+)\\[(\\d*)]$/); // parse array notation\n+\n+      if (!matches) {\n+        if (obj[token] === undefined) {\n+          obj[token] = {};\n+        }\n+        obj[token] = parsePath(obj[token], position + 1, tokens, value);\n+      } else {\n+        let [key, index] = matches.slice(1);\n+        if (obj[key] === undefined) {\n+          obj[key] = [];\n+        }\n+        if (index.length === 0) {\n+          index = obj[key].length;\n+        }\n+        if (obj[key][index] === undefined) {\n+          obj[key][index] = {};\n+        }\n+        obj[key][index] = parsePath(obj[key][index], position + 1, tokens, value);\n+      }\n+      return obj;\n+    };\n+\n+    let json = {};\n+    for (let i = 0; i < serializedArray.length; i++) {\n+      const value = serializedArray[i].value;\n+      const tokens = sanitizePath(serializedArray[i].name).split(\".\");","path":"src/js/helpers/util.js","position":57,"original_position":57,"commit_id":"2be3f84f73658bd428614ee39f96aab5ab922578","original_commit_id":"2be3f84f73658bd428614ee39f96aab5ab922578","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":"Yeah, I got it wrong here. `let` only makes sense for `value` (as it holds a reference to primitive type, which means it will be actually treated as \"read only\") while for `tokens` I should have used a `let`, as it holds a reference to an array, whose contents might actually change without raising an exception. \r\n\r\nThe idea was to explicitly signal block scoping here, which in this case makes sense, imho.","created_at":"2015-07-17T21:05:42Z","updated_at":"2015-07-17T21:05:42Z","html_url":"https://github.com/mesosphere/marathon-ui/pull/95#discussion_r34931034","pull_request_url":"https://api.github.com/repos/mesosphere/marathon-ui/pulls/95","_links":{"self":{"href":"https://api.github.com/repos/mesosphere/marathon-ui/pulls/comments/34931034"},"html":{"href":"https://github.com/mesosphere/marathon-ui/pull/95#discussion_r34931034"},"pull_request":{"href":"https://api.github.com/repos/mesosphere/marathon-ui/pulls/95"}}},"pull_request":{"url":"https://api.github.com/repos/mesosphere/marathon-ui/pulls/95","id":40243444,"html_url":"https://github.com/mesosphere/marathon-ui/pull/95","diff_url":"https://github.com/mesosphere/marathon-ui/pull/95.diff","patch_url":"https://github.com/mesosphere/marathon-ui/pull/95.patch","issue_url":"https://api.github.com/repos/mesosphere/marathon-ui/issues/95","number":95,"state":"open","locked":false,"title":"New Application modal design update: add optional and container settings","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":"The optional settings inside the new application modal dialog are now  grouped together.\r\nIt is now possible to specify Docker container settings.\r\n\r\nThis fixes mesosphere/marathon#124","created_at":"2015-07-17T15:39:48Z","updated_at":"2015-07-17T21:05:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f47024e62d030cf3fdf6ae467b6bae338e89c9e4","assignee":{"login":"philipnrmn","id":2989362,"avatar_url":"https://avatars.githubusercontent.com/u/2989362?v=3","gravatar_id":"","url":"https://api.github.com/users/philipnrmn","html_url":"https://github.com/philipnrmn","followers_url":"https://api.github.com/users/philipnrmn/followers","following_url":"https://api.github.com/users/philipnrmn/following{/other_user}","gists_url":"https://api.github.com/users/philipnrmn/gists{/gist_id}","starred_url":"https://api.github.com/users/philipnrmn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/philipnrmn/subscriptions","organizations_url":"https://api.github.com/users/philipnrmn/orgs","repos_url":"https://api.github.com/users/philipnrmn/repos","events_url":"https://api.github.com/users/philipnrmn/events{/privacy}","received_events_url":"https://api.github.com/users/philipnrmn/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/mesosphere/marathon-ui/pulls/95/commits","review_comments_url":"https://api.github.com/repos/mesosphere/marathon-ui/pulls/95/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/95/comments","statuses_url":"https://api.github.com/repos/mesosphere/marathon-ui/statuses/2be3f84f73658bd428614ee39f96aab5ab922578","head":{"label":"mesosphere:fix/124-expose-all-attributes","ref":"fix/124-expose-all-attributes","sha":"2be3f84f73658bd428614ee39f96aab5ab922578","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-07-14T08:13:31Z","pushed_at":"2015-07-17T15:39:48Z","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":7643,"stargazers_count":14,"watchers_count":14,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":6,"forks":4,"open_issues":6,"watchers":14,"default_branch":"master"}},"base":{"label":"mesosphere:master","ref":"master","sha":"8b82effeb00cb10d92472f73430bbc054d89b697","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-07-14T08:13:31Z","pushed_at":"2015-07-17T15:39:48Z","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":7643,"stargazers_count":14,"watchers_count":14,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":6,"forks":4,"open_issues":6,"watchers":14,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mesosphere/marathon-ui/pulls/95"},"html":{"href":"https://github.com/mesosphere/marathon-ui/pull/95"},"issue":{"href":"https://api.github.com/repos/mesosphere/marathon-ui/issues/95"},"comments":{"href":"https://api.github.com/repos/mesosphere/marathon-ui/issues/95/comments"},"review_comments":{"href":"https://api.github.com/repos/mesosphere/marathon-ui/pulls/95/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/95/commits"},"statuses":{"href":"https://api.github.com/repos/mesosphere/marathon-ui/statuses/2be3f84f73658bd428614ee39f96aab5ab922578"}}}}