{"action":"created","comment":{"url":"https://api.github.com/repos/wso2/analytics-is/pulls/comments/92350491","pull_request_review_id":12862765,"id":92350491,"diff_hunk":"@@ -363,54 +364,94 @@ function getColumns(){\n                      { title: \"Remember Me Flag\" },\n                      { title: \"Timestamp\" }\n \n-                 ];\n+            ];\n             break;\n-        }\n+        default:\n+            throw \"Error - Unknown page name\";\n+    }\n     return result;\n+}\n+\n \n+function getPdfTableColumns(columns) {\n+\n+    var i = 0;\n+    var columns = getColumns();\n+    return columns.map(function(column) {\n+\n+        column[\"dataKey\"] = i;\n+        i++;\n+        return column;\n+    });\n }\n \n-function getPdfTableColsAndInfo(){\n-    this.getPdfTableColumns=function(columns) {\n-        var i = 0;\n-        var columns = getColumns();\n-        return columns.map(function (column){\n-            column[\"dataKey\"] = i;\n-            i++;\n-            return column;\n-        });\n+function getPdfTableInfo(maxRecords, totalRecords) {\n+\n+    var pdfInfo = {};\n+    switch (page.name) {\n+        case TYPE_OVERALL:\n+            pdfInfo[\"title\"] = \"OVERALL LOGIN ATTEMPTS\";\n+            break;\n+        case TYPE_LOCAL:\n+            pdfInfo[\"title\"] = \"LOCAL LOGIN ATTEMPTS\";\n+            break;\n+        case TYPE_FEDERATED:\n+            pdfInfo[\"title\"] = \"FEDERATED LOGIN ATTEMPTS\";\n+            break;\n+        case TYPE_SESSIONS:\n+            pdfInfo[\"title\"] = \"LOGIN SESSIONS\";\n+            break;\n+        default:\n+            throw \"Error - Unknown Page name\";\n     }\n-    this.getPdfTableInfo= function(maxRecords,totalRecords){\n-        var pdfInfo = {};\n-\n-        switch (page.name) {\n-                case TYPE_OVERALL:\n-                    pdfInfo[\"title\"] = \"OVERALL LOGIN ATTEMPTS\";\n-                    break;\n-                case TYPE_LOCAL:\n-                    pdfInfo[\"title\"] = \"LOCAL LOGIN ATTEMPTS\";\n-                    break;\n-                case TYPE_FEDERATED:\n-                    pdfInfo[\"title\"] = \"FEDERATED LOGIN ATTEMPTS\";\n-\n-                    break;\n-                case TYPE_SESSIONS:\n-                    pdfInfo[\"title\"] = \"LOGIN SESSIONS REPORT\";\n-                    break;\n-                }\n \n-        pdfInfo[\"headerInfo\"] = \"Starting Date   : \" + renderDateTime(parseInt(listnedTimeFromValue)) + \"\\n\\nEnding Date    : \" + renderDateTime(parseInt(listnedTimeToValue)) +\n-                                          \"\\n\\nTotal Records : \"+totalRecords;\n+    pdfInfo[\"headerInfo\"] = \"Starting Date   : \" + renderDateTime(parseInt(listnedTimeFromValue)) + \"\\n\\nEnding Date    : \" + renderDateTime(parseInt(listnedTimeToValue)) + \"\\n\\nTotal Records : \" + totalRecords;\n+    pdfInfo[\"fileName\"] = pdfInfo.title.toLowerCase().replace(/ /g, \"_\");\n+    pdfInfo[\"maxRecords\"] = maxRecords;\n+    pdfInfo[\"totalRecords\"] = totalRecords;\n+    return pdfInfo;\n+}\n \n-        pdfInfo[\"fileName\"]=\"Logins Report\";\n-        pdfInfo[\"maxRecords\"]= maxRecords;\n-        pdfInfo[\"totalRecords\"]= totalRecords;\n-        return pdfInfo;\n-    }\n+function renderDateTime(data, type, row) {\n \n-    function renderDateTime(data, type, row) {\n-        var date = new Date(data);\n-        return date.toLocaleString(\"en-US\");\n-    }\n+    var date = new Date(data);\n+    return date.toLocaleString(moment.locale());\n }\n \n+\n+function getPdfTableRows(rawData) {\n+\n+    return rawData.map(function(record) {\n+\n+        var columnData = getColumns();\n+        var newRecord = {};\n+        for (i = 0; i < columnData.length; i++) {\n+            if (page.name == TYPE_OVERALL && i == 8) {","path":"features/org.wso2.analytics.is.feature/src/main/capp/dashboard/IsAnalytics-Gadget-MessageTable_1.0.0/IsAnalytics_Gadget_MessageTable/js/main.js","position":173,"original_position":173,"commit_id":"778b67be1ea53d2141fe1da981316cacf2193064","original_commit_id":"96030f40f218d711e868e846ff8b2b38d1f2fe01","user":{"login":"mefarazath","id":5237653,"avatar_url":"https://avatars.githubusercontent.com/u/5237653?v=3","gravatar_id":"","url":"https://api.github.com/users/mefarazath","html_url":"https://github.com/mefarazath","followers_url":"https://api.github.com/users/mefarazath/followers","following_url":"https://api.github.com/users/mefarazath/following{/other_user}","gists_url":"https://api.github.com/users/mefarazath/gists{/gist_id}","starred_url":"https://api.github.com/users/mefarazath/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mefarazath/subscriptions","organizations_url":"https://api.github.com/users/mefarazath/orgs","repos_url":"https://api.github.com/users/mefarazath/repos","events_url":"https://api.github.com/users/mefarazath/events{/privacy}","received_events_url":"https://api.github.com/users/mefarazath/received_events","type":"User","site_admin":false},"body":"Using the column index is fine. But, Shall we declare a variable at the top and use it here instead of using the number 8 directly here?\r\nThat would make any changes to the table structure (say adding a column, reorder) easy to change in the code. WDYT?","created_at":"2016-12-14T09:25:13Z","updated_at":"2016-12-14T09:25:13Z","html_url":"https://github.com/wso2/analytics-is/pull/320#discussion_r92350491","pull_request_url":"https://api.github.com/repos/wso2/analytics-is/pulls/320","_links":{"self":{"href":"https://api.github.com/repos/wso2/analytics-is/pulls/comments/92350491"},"html":{"href":"https://github.com/wso2/analytics-is/pull/320#discussion_r92350491"},"pull_request":{"href":"https://api.github.com/repos/wso2/analytics-is/pulls/320"}}},"pull_request":{"url":"https://api.github.com/repos/wso2/analytics-is/pulls/320","id":97433423,"html_url":"https://github.com/wso2/analytics-is/pull/320","diff_url":"https://github.com/wso2/analytics-is/pull/320.diff","patch_url":"https://github.com/wso2/analytics-is/pull/320.patch","issue_url":"https://api.github.com/repos/wso2/analytics-is/issues/320","number":320,"state":"open","locked":false,"title":"Changes after the code review on adding pdf export support to IS Analytics","user":{"login":"DanojaDias","id":11630851,"avatar_url":"https://avatars.githubusercontent.com/u/11630851?v=3","gravatar_id":"","url":"https://api.github.com/users/DanojaDias","html_url":"https://github.com/DanojaDias","followers_url":"https://api.github.com/users/DanojaDias/followers","following_url":"https://api.github.com/users/DanojaDias/following{/other_user}","gists_url":"https://api.github.com/users/DanojaDias/gists{/gist_id}","starred_url":"https://api.github.com/users/DanojaDias/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DanojaDias/subscriptions","organizations_url":"https://api.github.com/users/DanojaDias/orgs","repos_url":"https://api.github.com/users/DanojaDias/repos","events_url":"https://api.github.com/users/DanojaDias/events{/privacy}","received_events_url":"https://api.github.com/users/DanojaDias/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-12-10T18:29:18Z","updated_at":"2016-12-14T09:25:13Z","closed_at":null,"merged_at":null,"merge_commit_sha":"87ba942eba3e21742cf2b200be231938643c5103","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/wso2/analytics-is/pulls/320/commits","review_comments_url":"https://api.github.com/repos/wso2/analytics-is/pulls/320/comments","review_comment_url":"https://api.github.com/repos/wso2/analytics-is/pulls/comments{/number}","comments_url":"https://api.github.com/repos/wso2/analytics-is/issues/320/comments","statuses_url":"https://api.github.com/repos/wso2/analytics-is/statuses/778b67be1ea53d2141fe1da981316cacf2193064","head":{"label":"DanojaDias:master","ref":"master","sha":"778b67be1ea53d2141fe1da981316cacf2193064","user":{"login":"DanojaDias","id":11630851,"avatar_url":"https://avatars.githubusercontent.com/u/11630851?v=3","gravatar_id":"","url":"https://api.github.com/users/DanojaDias","html_url":"https://github.com/DanojaDias","followers_url":"https://api.github.com/users/DanojaDias/followers","following_url":"https://api.github.com/users/DanojaDias/following{/other_user}","gists_url":"https://api.github.com/users/DanojaDias/gists{/gist_id}","starred_url":"https://api.github.com/users/DanojaDias/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DanojaDias/subscriptions","organizations_url":"https://api.github.com/users/DanojaDias/orgs","repos_url":"https://api.github.com/users/DanojaDias/repos","events_url":"https://api.github.com/users/DanojaDias/events{/privacy}","received_events_url":"https://api.github.com/users/DanojaDias/received_events","type":"User","site_admin":false},"repo":{"id":74540212,"name":"analytics-is","full_name":"DanojaDias/analytics-is","owner":{"login":"DanojaDias","id":11630851,"avatar_url":"https://avatars.githubusercontent.com/u/11630851?v=3","gravatar_id":"","url":"https://api.github.com/users/DanojaDias","html_url":"https://github.com/DanojaDias","followers_url":"https://api.github.com/users/DanojaDias/followers","following_url":"https://api.github.com/users/DanojaDias/following{/other_user}","gists_url":"https://api.github.com/users/DanojaDias/gists{/gist_id}","starred_url":"https://api.github.com/users/DanojaDias/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DanojaDias/subscriptions","organizations_url":"https://api.github.com/users/DanojaDias/orgs","repos_url":"https://api.github.com/users/DanojaDias/repos","events_url":"https://api.github.com/users/DanojaDias/events{/privacy}","received_events_url":"https://api.github.com/users/DanojaDias/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/DanojaDias/analytics-is","description":"Analytics for WSO2 Identity Server","fork":true,"url":"https://api.github.com/repos/DanojaDias/analytics-is","forks_url":"https://api.github.com/repos/DanojaDias/analytics-is/forks","keys_url":"https://api.github.com/repos/DanojaDias/analytics-is/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DanojaDias/analytics-is/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DanojaDias/analytics-is/teams","hooks_url":"https://api.github.com/repos/DanojaDias/analytics-is/hooks","issue_events_url":"https://api.github.com/repos/DanojaDias/analytics-is/issues/events{/number}","events_url":"https://api.github.com/repos/DanojaDias/analytics-is/events","assignees_url":"https://api.github.com/repos/DanojaDias/analytics-is/assignees{/user}","branches_url":"https://api.github.com/repos/DanojaDias/analytics-is/branches{/branch}","tags_url":"https://api.github.com/repos/DanojaDias/analytics-is/tags","blobs_url":"https://api.github.com/repos/DanojaDias/analytics-is/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DanojaDias/analytics-is/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DanojaDias/analytics-is/git/refs{/sha}","trees_url":"https://api.github.com/repos/DanojaDias/analytics-is/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DanojaDias/analytics-is/statuses/{sha}","languages_url":"https://api.github.com/repos/DanojaDias/analytics-is/languages","stargazers_url":"https://api.github.com/repos/DanojaDias/analytics-is/stargazers","contributors_url":"https://api.github.com/repos/DanojaDias/analytics-is/contributors","subscribers_url":"https://api.github.com/repos/DanojaDias/analytics-is/subscribers","subscription_url":"https://api.github.com/repos/DanojaDias/analytics-is/subscription","commits_url":"https://api.github.com/repos/DanojaDias/analytics-is/commits{/sha}","git_commits_url":"https://api.github.com/repos/DanojaDias/analytics-is/git/commits{/sha}","comments_url":"https://api.github.com/repos/DanojaDias/analytics-is/comments{/number}","issue_comment_url":"https://api.github.com/repos/DanojaDias/analytics-is/issues/comments{/number}","contents_url":"https://api.github.com/repos/DanojaDias/analytics-is/contents/{+path}","compare_url":"https://api.github.com/repos/DanojaDias/analytics-is/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DanojaDias/analytics-is/merges","archive_url":"https://api.github.com/repos/DanojaDias/analytics-is/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DanojaDias/analytics-is/downloads","issues_url":"https://api.github.com/repos/DanojaDias/analytics-is/issues{/number}","pulls_url":"https://api.github.com/repos/DanojaDias/analytics-is/pulls{/number}","milestones_url":"https://api.github.com/repos/DanojaDias/analytics-is/milestones{/number}","notifications_url":"https://api.github.com/repos/DanojaDias/analytics-is/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DanojaDias/analytics-is/labels{/name}","releases_url":"https://api.github.com/repos/DanojaDias/analytics-is/releases{/id}","deployments_url":"https://api.github.com/repos/DanojaDias/analytics-is/deployments","created_at":"2016-11-23T04:20:30Z","updated_at":"2016-11-23T04:20:33Z","pushed_at":"2016-12-14T09:14:43Z","git_url":"git://github.com/DanojaDias/analytics-is.git","ssh_url":"git@github.com:DanojaDias/analytics-is.git","clone_url":"https://github.com/DanojaDias/analytics-is.git","svn_url":"https://github.com/DanojaDias/analytics-is","homepage":"","size":9757,"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":"wso2:master","ref":"master","sha":"e878d0d813ce9f213d8740c43221e6758cf31c98","user":{"login":"wso2","id":533043,"avatar_url":"https://avatars.githubusercontent.com/u/533043?v=3","gravatar_id":"","url":"https://api.github.com/users/wso2","html_url":"https://github.com/wso2","followers_url":"https://api.github.com/users/wso2/followers","following_url":"https://api.github.com/users/wso2/following{/other_user}","gists_url":"https://api.github.com/users/wso2/gists{/gist_id}","starred_url":"https://api.github.com/users/wso2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wso2/subscriptions","organizations_url":"https://api.github.com/users/wso2/orgs","repos_url":"https://api.github.com/users/wso2/repos","events_url":"https://api.github.com/users/wso2/events{/privacy}","received_events_url":"https://api.github.com/users/wso2/received_events","type":"Organization","site_admin":false},"repo":{"id":57274099,"name":"analytics-is","full_name":"wso2/analytics-is","owner":{"login":"wso2","id":533043,"avatar_url":"https://avatars.githubusercontent.com/u/533043?v=3","gravatar_id":"","url":"https://api.github.com/users/wso2","html_url":"https://github.com/wso2","followers_url":"https://api.github.com/users/wso2/followers","following_url":"https://api.github.com/users/wso2/following{/other_user}","gists_url":"https://api.github.com/users/wso2/gists{/gist_id}","starred_url":"https://api.github.com/users/wso2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wso2/subscriptions","organizations_url":"https://api.github.com/users/wso2/orgs","repos_url":"https://api.github.com/users/wso2/repos","events_url":"https://api.github.com/users/wso2/events{/privacy}","received_events_url":"https://api.github.com/users/wso2/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/wso2/analytics-is","description":"Analytics for WSO2 Identity Server","fork":false,"url":"https://api.github.com/repos/wso2/analytics-is","forks_url":"https://api.github.com/repos/wso2/analytics-is/forks","keys_url":"https://api.github.com/repos/wso2/analytics-is/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wso2/analytics-is/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wso2/analytics-is/teams","hooks_url":"https://api.github.com/repos/wso2/analytics-is/hooks","issue_events_url":"https://api.github.com/repos/wso2/analytics-is/issues/events{/number}","events_url":"https://api.github.com/repos/wso2/analytics-is/events","assignees_url":"https://api.github.com/repos/wso2/analytics-is/assignees{/user}","branches_url":"https://api.github.com/repos/wso2/analytics-is/branches{/branch}","tags_url":"https://api.github.com/repos/wso2/analytics-is/tags","blobs_url":"https://api.github.com/repos/wso2/analytics-is/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wso2/analytics-is/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wso2/analytics-is/git/refs{/sha}","trees_url":"https://api.github.com/repos/wso2/analytics-is/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wso2/analytics-is/statuses/{sha}","languages_url":"https://api.github.com/repos/wso2/analytics-is/languages","stargazers_url":"https://api.github.com/repos/wso2/analytics-is/stargazers","contributors_url":"https://api.github.com/repos/wso2/analytics-is/contributors","subscribers_url":"https://api.github.com/repos/wso2/analytics-is/subscribers","subscription_url":"https://api.github.com/repos/wso2/analytics-is/subscription","commits_url":"https://api.github.com/repos/wso2/analytics-is/commits{/sha}","git_commits_url":"https://api.github.com/repos/wso2/analytics-is/git/commits{/sha}","comments_url":"https://api.github.com/repos/wso2/analytics-is/comments{/number}","issue_comment_url":"https://api.github.com/repos/wso2/analytics-is/issues/comments{/number}","contents_url":"https://api.github.com/repos/wso2/analytics-is/contents/{+path}","compare_url":"https://api.github.com/repos/wso2/analytics-is/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wso2/analytics-is/merges","archive_url":"https://api.github.com/repos/wso2/analytics-is/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wso2/analytics-is/downloads","issues_url":"https://api.github.com/repos/wso2/analytics-is/issues{/number}","pulls_url":"https://api.github.com/repos/wso2/analytics-is/pulls{/number}","milestones_url":"https://api.github.com/repos/wso2/analytics-is/milestones{/number}","notifications_url":"https://api.github.com/repos/wso2/analytics-is/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wso2/analytics-is/labels{/name}","releases_url":"https://api.github.com/repos/wso2/analytics-is/releases{/id}","deployments_url":"https://api.github.com/repos/wso2/analytics-is/deployments","created_at":"2016-04-28T05:39:28Z","updated_at":"2016-10-24T02:54:21Z","pushed_at":"2016-12-14T09:14:44Z","git_url":"git://github.com/wso2/analytics-is.git","ssh_url":"git@github.com:wso2/analytics-is.git","clone_url":"https://github.com/wso2/analytics-is.git","svn_url":"https://github.com/wso2/analytics-is","homepage":"","size":9909,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":30,"mirror_url":null,"open_issues_count":2,"forks":30,"open_issues":2,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/wso2/analytics-is/pulls/320"},"html":{"href":"https://github.com/wso2/analytics-is/pull/320"},"issue":{"href":"https://api.github.com/repos/wso2/analytics-is/issues/320"},"comments":{"href":"https://api.github.com/repos/wso2/analytics-is/issues/320/comments"},"review_comments":{"href":"https://api.github.com/repos/wso2/analytics-is/pulls/320/comments"},"review_comment":{"href":"https://api.github.com/repos/wso2/analytics-is/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/wso2/analytics-is/pulls/320/commits"},"statuses":{"href":"https://api.github.com/repos/wso2/analytics-is/statuses/778b67be1ea53d2141fe1da981316cacf2193064"}}}}
{"actor":{"display_login":"mefarazath"}}