{"action":"created","comment":{"url":"https://api.github.com/repos/wso2/carbon-dashboards/pulls/comments/214866196","pull_request_review_id":152003623,"id":214866196,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxNDg2NjE5Ng==","diff_hunk":"@@ -0,0 +1,114 @@\n+/*\n+ * Copyright (c) 2018, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.\n+ *\n+ * WSO2 Inc. licenses this file to you under the Apache License,\n+ * Version 2.0 (the \"License\"); you may not use this file except\n+ * in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ *   http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing,\n+ * software distributed under the License is distributed on an\n+ * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n+ * KIND, either express or implied.  See the License for the\n+ * specific language governing permissions and limitations\n+ * under the License.\n+ */\n+import React, { Component } from 'react';\n+import PropTypes from \"prop-types\";\n+import { Checkbox, FlatButton, Dialog } from 'material-ui';\n+import DashboardReportGenerator from '../../utils/DashboardReportGenerator';\n+\n+export default class WidgetReportConfigurationDialog extends Component {\n+    constructor(props) {\n+        super(props);\n+        this.state = {\n+            dialogOpen: false,\n+            includeTime: false,\n+        };\n+\n+        this.handleClose = this.handleClose.bind(this);\n+        this.handleOpen = this.handleOpen.bind(this);\n+        this.handleIncludeGenerateTime = this.handleIncludeGenerateTime.bind(this);\n+        this.handleIncludeNoOfRecords = this.handleIncludeNoOfRecords.bind(this);\n+        this.generateWidgetReport = this.generateWidgetReport.bind(this);\n+    }\n+\n+    generateWidgetReport() {\n+        this.handleClose();\n+        const element = this.props.widget;\n+        const docTitle = this.props.title;\n+        DashboardReportGenerator.generateWidgetPdf(element, docTitle, this.state.includeTime, this.state.includeRecords,\n+            this.props.themeName);\n+        this.state.includeRecords = false;\n+        this.state.includeTime = false;\n+    }\n+\n+    handleClose() {\n+        this.setState({ dialogOpen: false });\n+    }\n+\n+    handleOpen() {\n+        this.hasTable(this.props.widget);\n+        this.setState({ dialogOpen: true });\n+    }\n+\n+    handleIncludeGenerateTime() {\n+        this.setState({ includeTime: !this.state.includeTime });\n+    }\n+\n+    handleIncludeNoOfRecords() {\n+        this.setState({ includeRecords: !this.state.includeRecords });\n+    }\n+\n+    hasTable(element) {\n+        if (element.innerHTML.search('rt-table') > -1) {\n+            this.setState({ recordCountEnabled: true });","path":"components/dashboards-web-component/src/viewer/components/WidgetReportConfigurationDialog.jsx","position":67,"original_position":67,"commit_id":"ab5f03bf7137f4af742cd92bff7737cc74ed8f30","original_commit_id":"ab5f03bf7137f4af742cd92bff7737cc74ed8f30","user":{"login":"this","id":11549922,"node_id":"MDQ6VXNlcjExNTQ5OTIy","avatar_url":"https://avatars0.githubusercontent.com/u/11549922?v=4","gravatar_id":"","url":"https://api.github.com/users/this","html_url":"https://github.com/this","followers_url":"https://api.github.com/users/this/followers","following_url":"https://api.github.com/users/this/following{/other_user}","gists_url":"https://api.github.com/users/this/gists{/gist_id}","starred_url":"https://api.github.com/users/this/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/this/subscriptions","organizations_url":"https://api.github.com/users/this/orgs","repos_url":"https://api.github.com/users/this/repos","events_url":"https://api.github.com/users/this/events{/privacy}","received_events_url":"https://api.github.com/users/this/received_events","type":"User","site_admin":false},"body":"By the name of this function, it should be a pure function that returns a Boolean. But this manipulates the `state`.\r\n\r\n`hasTable` should only check the existence of a table and return true/false. ","created_at":"2018-09-04T10:35:09Z","updated_at":"2018-09-04T10:44:05Z","html_url":"https://github.com/wso2/carbon-dashboards/pull/1037#discussion_r214866196","pull_request_url":"https://api.github.com/repos/wso2/carbon-dashboards/pulls/1037","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/wso2/carbon-dashboards/pulls/comments/214866196"},"html":{"href":"https://github.com/wso2/carbon-dashboards/pull/1037#discussion_r214866196"},"pull_request":{"href":"https://api.github.com/repos/wso2/carbon-dashboards/pulls/1037"}}},"pull_request":{"url":"https://api.github.com/repos/wso2/carbon-dashboards/pulls/1037","id":212867339,"node_id":"MDExOlB1bGxSZXF1ZXN0MjEyODY3MzM5","html_url":"https://github.com/wso2/carbon-dashboards/pull/1037","diff_url":"https://github.com/wso2/carbon-dashboards/pull/1037.diff","patch_url":"https://github.com/wso2/carbon-dashboards/pull/1037.patch","issue_url":"https://api.github.com/repos/wso2/carbon-dashboards/issues/1037","number":1037,"state":"open","locked":false,"title":"Dashboard Report Generation","user":{"login":"kts-desilva","id":25476980,"node_id":"MDQ6VXNlcjI1NDc2OTgw","avatar_url":"https://avatars3.githubusercontent.com/u/25476980?v=4","gravatar_id":"","url":"https://api.github.com/users/kts-desilva","html_url":"https://github.com/kts-desilva","followers_url":"https://api.github.com/users/kts-desilva/followers","following_url":"https://api.github.com/users/kts-desilva/following{/other_user}","gists_url":"https://api.github.com/users/kts-desilva/gists{/gist_id}","starred_url":"https://api.github.com/users/kts-desilva/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kts-desilva/subscriptions","organizations_url":"https://api.github.com/users/kts-desilva/orgs","repos_url":"https://api.github.com/users/kts-desilva/repos","events_url":"https://api.github.com/users/kts-desilva/events{/privacy}","received_events_url":"https://api.github.com/users/kts-desilva/received_events","type":"User","site_admin":false},"body":"## Purpose\r\nTo generate reports from the dashboard components. \r\n\r\n## Approach\r\nWidgets and dashboard pages of a dashboard can be exported as reports. Currently reports are generated as pdf.","created_at":"2018-09-04T06:26:42Z","updated_at":"2018-09-04T10:44:05Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1a6a15fca772879096467b3ca1b311c57a6d28b4","assignee":null,"assignees":[],"requested_reviewers":[{"login":"TanyaM","id":3957104,"node_id":"MDQ6VXNlcjM5NTcxMDQ=","avatar_url":"https://avatars2.githubusercontent.com/u/3957104?v=4","gravatar_id":"","url":"https://api.github.com/users/TanyaM","html_url":"https://github.com/TanyaM","followers_url":"https://api.github.com/users/TanyaM/followers","following_url":"https://api.github.com/users/TanyaM/following{/other_user}","gists_url":"https://api.github.com/users/TanyaM/gists{/gist_id}","starred_url":"https://api.github.com/users/TanyaM/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TanyaM/subscriptions","organizations_url":"https://api.github.com/users/TanyaM/orgs","repos_url":"https://api.github.com/users/TanyaM/repos","events_url":"https://api.github.com/users/TanyaM/events{/privacy}","received_events_url":"https://api.github.com/users/TanyaM/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/wso2/carbon-dashboards/pulls/1037/commits","review_comments_url":"https://api.github.com/repos/wso2/carbon-dashboards/pulls/1037/comments","review_comment_url":"https://api.github.com/repos/wso2/carbon-dashboards/pulls/comments{/number}","comments_url":"https://api.github.com/repos/wso2/carbon-dashboards/issues/1037/comments","statuses_url":"https://api.github.com/repos/wso2/carbon-dashboards/statuses/ab5f03bf7137f4af742cd92bff7737cc74ed8f30","head":{"label":"kts-desilva:dashboard-report","ref":"dashboard-report","sha":"ab5f03bf7137f4af742cd92bff7737cc74ed8f30","user":{"login":"kts-desilva","id":25476980,"node_id":"MDQ6VXNlcjI1NDc2OTgw","avatar_url":"https://avatars3.githubusercontent.com/u/25476980?v=4","gravatar_id":"","url":"https://api.github.com/users/kts-desilva","html_url":"https://github.com/kts-desilva","followers_url":"https://api.github.com/users/kts-desilva/followers","following_url":"https://api.github.com/users/kts-desilva/following{/other_user}","gists_url":"https://api.github.com/users/kts-desilva/gists{/gist_id}","starred_url":"https://api.github.com/users/kts-desilva/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kts-desilva/subscriptions","organizations_url":"https://api.github.com/users/kts-desilva/orgs","repos_url":"https://api.github.com/users/kts-desilva/repos","events_url":"https://api.github.com/users/kts-desilva/events{/privacy}","received_events_url":"https://api.github.com/users/kts-desilva/received_events","type":"User","site_admin":false},"repo":{"id":141110498,"node_id":"MDEwOlJlcG9zaXRvcnkxNDExMTA0OTg=","name":"carbon-dashboards","full_name":"kts-desilva/carbon-dashboards","owner":{"login":"kts-desilva","id":25476980,"node_id":"MDQ6VXNlcjI1NDc2OTgw","avatar_url":"https://avatars3.githubusercontent.com/u/25476980?v=4","gravatar_id":"","url":"https://api.github.com/users/kts-desilva","html_url":"https://github.com/kts-desilva","followers_url":"https://api.github.com/users/kts-desilva/followers","following_url":"https://api.github.com/users/kts-desilva/following{/other_user}","gists_url":"https://api.github.com/users/kts-desilva/gists{/gist_id}","starred_url":"https://api.github.com/users/kts-desilva/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kts-desilva/subscriptions","organizations_url":"https://api.github.com/users/kts-desilva/orgs","repos_url":"https://api.github.com/users/kts-desilva/repos","events_url":"https://api.github.com/users/kts-desilva/events{/privacy}","received_events_url":"https://api.github.com/users/kts-desilva/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kts-desilva/carbon-dashboards","description":null,"fork":true,"url":"https://api.github.com/repos/kts-desilva/carbon-dashboards","forks_url":"https://api.github.com/repos/kts-desilva/carbon-dashboards/forks","keys_url":"https://api.github.com/repos/kts-desilva/carbon-dashboards/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kts-desilva/carbon-dashboards/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kts-desilva/carbon-dashboards/teams","hooks_url":"https://api.github.com/repos/kts-desilva/carbon-dashboards/hooks","issue_events_url":"https://api.github.com/repos/kts-desilva/carbon-dashboards/issues/events{/number}","events_url":"https://api.github.com/repos/kts-desilva/carbon-dashboards/events","assignees_url":"https://api.github.com/repos/kts-desilva/carbon-dashboards/assignees{/user}","branches_url":"https://api.github.com/repos/kts-desilva/carbon-dashboards/branches{/branch}","tags_url":"https://api.github.com/repos/kts-desilva/carbon-dashboards/tags","blobs_url":"https://api.github.com/repos/kts-desilva/carbon-dashboards/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kts-desilva/carbon-dashboards/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kts-desilva/carbon-dashboards/git/refs{/sha}","trees_url":"https://api.github.com/repos/kts-desilva/carbon-dashboards/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kts-desilva/carbon-dashboards/statuses/{sha}","languages_url":"https://api.github.com/repos/kts-desilva/carbon-dashboards/languages","stargazers_url":"https://api.github.com/repos/kts-desilva/carbon-dashboards/stargazers","contributors_url":"https://api.github.com/repos/kts-desilva/carbon-dashboards/contributors","subscribers_url":"https://api.github.com/repos/kts-desilva/carbon-dashboards/subscribers","subscription_url":"https://api.github.com/repos/kts-desilva/carbon-dashboards/subscription","commits_url":"https://api.github.com/repos/kts-desilva/carbon-dashboards/commits{/sha}","git_commits_url":"https://api.github.com/repos/kts-desilva/carbon-dashboards/git/commits{/sha}","comments_url":"https://api.github.com/repos/kts-desilva/carbon-dashboards/comments{/number}","issue_comment_url":"https://api.github.com/repos/kts-desilva/carbon-dashboards/issues/comments{/number}","contents_url":"https://api.github.com/repos/kts-desilva/carbon-dashboards/contents/{+path}","compare_url":"https://api.github.com/repos/kts-desilva/carbon-dashboards/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kts-desilva/carbon-dashboards/merges","archive_url":"https://api.github.com/repos/kts-desilva/carbon-dashboards/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kts-desilva/carbon-dashboards/downloads","issues_url":"https://api.github.com/repos/kts-desilva/carbon-dashboards/issues{/number}","pulls_url":"https://api.github.com/repos/kts-desilva/carbon-dashboards/pulls{/number}","milestones_url":"https://api.github.com/repos/kts-desilva/carbon-dashboards/milestones{/number}","notifications_url":"https://api.github.com/repos/kts-desilva/carbon-dashboards/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kts-desilva/carbon-dashboards/labels{/name}","releases_url":"https://api.github.com/repos/kts-desilva/carbon-dashboards/releases{/id}","deployments_url":"https://api.github.com/repos/kts-desilva/carbon-dashboards/deployments","created_at":"2018-07-16T08:35:15Z","updated_at":"2018-08-14T09:42:22Z","pushed_at":"2018-09-04T06:25:48Z","git_url":"git://github.com/kts-desilva/carbon-dashboards.git","ssh_url":"git@github.com:kts-desilva/carbon-dashboards.git","clone_url":"https://github.com/kts-desilva/carbon-dashboards.git","svn_url":"https://github.com/kts-desilva/carbon-dashboards","homepage":null,"size":20894,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"wso2:master","ref":"master","sha":"60eb68b7d7ef268bf36f6999a3a765f51dfcd57f","user":{"login":"wso2","id":533043,"node_id":"MDEyOk9yZ2FuaXphdGlvbjUzMzA0Mw==","avatar_url":"https://avatars3.githubusercontent.com/u/533043?v=4","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":36008880,"node_id":"MDEwOlJlcG9zaXRvcnkzNjAwODg4MA==","name":"carbon-dashboards","full_name":"wso2/carbon-dashboards","owner":{"login":"wso2","id":533043,"node_id":"MDEyOk9yZ2FuaXphdGlvbjUzMzA0Mw==","avatar_url":"https://avatars3.githubusercontent.com/u/533043?v=4","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/carbon-dashboards","description":null,"fork":false,"url":"https://api.github.com/repos/wso2/carbon-dashboards","forks_url":"https://api.github.com/repos/wso2/carbon-dashboards/forks","keys_url":"https://api.github.com/repos/wso2/carbon-dashboards/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wso2/carbon-dashboards/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wso2/carbon-dashboards/teams","hooks_url":"https://api.github.com/repos/wso2/carbon-dashboards/hooks","issue_events_url":"https://api.github.com/repos/wso2/carbon-dashboards/issues/events{/number}","events_url":"https://api.github.com/repos/wso2/carbon-dashboards/events","assignees_url":"https://api.github.com/repos/wso2/carbon-dashboards/assignees{/user}","branches_url":"https://api.github.com/repos/wso2/carbon-dashboards/branches{/branch}","tags_url":"https://api.github.com/repos/wso2/carbon-dashboards/tags","blobs_url":"https://api.github.com/repos/wso2/carbon-dashboards/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wso2/carbon-dashboards/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wso2/carbon-dashboards/git/refs{/sha}","trees_url":"https://api.github.com/repos/wso2/carbon-dashboards/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wso2/carbon-dashboards/statuses/{sha}","languages_url":"https://api.github.com/repos/wso2/carbon-dashboards/languages","stargazers_url":"https://api.github.com/repos/wso2/carbon-dashboards/stargazers","contributors_url":"https://api.github.com/repos/wso2/carbon-dashboards/contributors","subscribers_url":"https://api.github.com/repos/wso2/carbon-dashboards/subscribers","subscription_url":"https://api.github.com/repos/wso2/carbon-dashboards/subscription","commits_url":"https://api.github.com/repos/wso2/carbon-dashboards/commits{/sha}","git_commits_url":"https://api.github.com/repos/wso2/carbon-dashboards/git/commits{/sha}","comments_url":"https://api.github.com/repos/wso2/carbon-dashboards/comments{/number}","issue_comment_url":"https://api.github.com/repos/wso2/carbon-dashboards/issues/comments{/number}","contents_url":"https://api.github.com/repos/wso2/carbon-dashboards/contents/{+path}","compare_url":"https://api.github.com/repos/wso2/carbon-dashboards/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wso2/carbon-dashboards/merges","archive_url":"https://api.github.com/repos/wso2/carbon-dashboards/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wso2/carbon-dashboards/downloads","issues_url":"https://api.github.com/repos/wso2/carbon-dashboards/issues{/number}","pulls_url":"https://api.github.com/repos/wso2/carbon-dashboards/pulls{/number}","milestones_url":"https://api.github.com/repos/wso2/carbon-dashboards/milestones{/number}","notifications_url":"https://api.github.com/repos/wso2/carbon-dashboards/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wso2/carbon-dashboards/labels{/name}","releases_url":"https://api.github.com/repos/wso2/carbon-dashboards/releases{/id}","deployments_url":"https://api.github.com/repos/wso2/carbon-dashboards/deployments","created_at":"2015-05-21T11:25:31Z","updated_at":"2018-09-04T07:17:28Z","pushed_at":"2018-09-04T07:17:26Z","git_url":"git://github.com/wso2/carbon-dashboards.git","ssh_url":"git@github.com:wso2/carbon-dashboards.git","clone_url":"https://github.com/wso2/carbon-dashboards.git","svn_url":"https://github.com/wso2/carbon-dashboards","homepage":null,"size":20610,"stargazers_count":9,"watchers_count":9,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":95,"mirror_url":null,"archived":false,"open_issues_count":18,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":95,"open_issues":18,"watchers":9,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/wso2/carbon-dashboards/pulls/1037"},"html":{"href":"https://github.com/wso2/carbon-dashboards/pull/1037"},"issue":{"href":"https://api.github.com/repos/wso2/carbon-dashboards/issues/1037"},"comments":{"href":"https://api.github.com/repos/wso2/carbon-dashboards/issues/1037/comments"},"review_comments":{"href":"https://api.github.com/repos/wso2/carbon-dashboards/pulls/1037/comments"},"review_comment":{"href":"https://api.github.com/repos/wso2/carbon-dashboards/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/wso2/carbon-dashboards/pulls/1037/commits"},"statuses":{"href":"https://api.github.com/repos/wso2/carbon-dashboards/statuses/ab5f03bf7137f4af742cd92bff7737cc74ed8f30"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"this"}}