{"action":"created","comment":{"url":"https://api.github.com/repos/aerogear/mobile-developer-console/pulls/comments/235891973","pull_request_review_id":177863935,"id":235891973,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzNTg5MTk3Mw==","diff_hunk":"@@ -0,0 +1,68 @@\n+/* eslint no-continue: off */\n+/* eslint class-methods-use-this: off */\n+export class AbstractBindingValidator {\n+  constructor(platform, customProperties = {}) {\n+    this.customProperties = customProperties;\n+\n+    this.detectPlatform = customProperties.platformDetector;\n+    this.errorsKey = customProperties.errorField;\n+    this.platform = platform;\n+  }\n+\n+  addError(errors, key, message) {\n+    errors[this.errorsKey || key].addError(message);\n+  }\n+\n+  preFieldValidation(key, value) {\n+    if (this.customProperties.preValidate) {\n+      return this.customProperties.preValidate(key, value);\n+    }\n+    return false;\n+  }\n+\n+  validateField(key, value) {\n+    return false;\n+  }\n+\n+  postFieldValidation(key, value) {\n+    if (this.customProperties.postValidate) {\n+      return this.customProperties.postValidate(key, value);\n+    }\n+    return false;\n+  }\n+\n+  validate(formData, errors) {\n+    let hasErrors = false;\n+    if (this.platform && this.detectPlatform && this.detectPlatform() !== this.platform) {\n+      return false;\n+    }\n+\n+    for (const key in errors) {\n+      if (errors.hasOwnProperty(key)) {\n+        const value = formData[key];\n+\n+        let error = this.preFieldValidation(key, value);\n+        if (error) {\n+          hasErrors = true;\n+          this.addError(errors, key, error);\n+          continue;\n+        }\n+\n+        error = this.validateField(key, value);\n+        if (error) {\n+          hasErrors = true;\n+          this.addError(errors, key, error);\n+          continue;\n+        }\n+\n+        error = this.postFieldValidation(key, value);","path":"ui/src/components/mobileservices/validators/AbstractBindingValidator.js","position":58,"original_position":58,"commit_id":"caabe8e32372a6166a770e04575aaf6e58a92d5d","original_commit_id":"caabe8e32372a6166a770e04575aaf6e58a92d5d","user":{"login":"ziccardi","id":1125019,"node_id":"MDQ6VXNlcjExMjUwMTk=","avatar_url":"https://avatars3.githubusercontent.com/u/1125019?v=4","gravatar_id":"","url":"https://api.github.com/users/ziccardi","html_url":"https://github.com/ziccardi","followers_url":"https://api.github.com/users/ziccardi/followers","following_url":"https://api.github.com/users/ziccardi/following{/other_user}","gists_url":"https://api.github.com/users/ziccardi/gists{/gist_id}","starred_url":"https://api.github.com/users/ziccardi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ziccardi/subscriptions","organizations_url":"https://api.github.com/users/ziccardi/orgs","repos_url":"https://api.github.com/users/ziccardi/repos","events_url":"https://api.github.com/users/ziccardi/events{/privacy}","received_events_url":"https://api.github.com/users/ziccardi/received_events","type":"User","site_admin":false},"body":"The `preFieldValidation` and `postFieldValidation` are custom function that can be passed to the validators to perform custom `pre` or `post` validations.","created_at":"2018-11-23T10:04:44Z","updated_at":"2018-11-23T10:04:44Z","html_url":"https://github.com/aerogear/mobile-developer-console/pull/139#discussion_r235891973","pull_request_url":"https://api.github.com/repos/aerogear/mobile-developer-console/pulls/139","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/aerogear/mobile-developer-console/pulls/comments/235891973"},"html":{"href":"https://github.com/aerogear/mobile-developer-console/pull/139#discussion_r235891973"},"pull_request":{"href":"https://api.github.com/repos/aerogear/mobile-developer-console/pulls/139"}},"in_reply_to_id":235887799},"pull_request":{"url":"https://api.github.com/repos/aerogear/mobile-developer-console/pulls/139","id":233050592,"node_id":"MDExOlB1bGxSZXF1ZXN0MjMzMDUwNTky","html_url":"https://github.com/aerogear/mobile-developer-console/pull/139","diff_url":"https://github.com/aerogear/mobile-developer-console/pull/139.diff","patch_url":"https://github.com/aerogear/mobile-developer-console/pull/139.patch","issue_url":"https://api.github.com/repos/aerogear/mobile-developer-console/issues/139","number":139,"state":"open","locked":false,"title":"Improved binding UI","user":{"login":"ziccardi","id":1125019,"node_id":"MDQ6VXNlcjExMjUwMTk=","avatar_url":"https://avatars3.githubusercontent.com/u/1125019?v=4","gravatar_id":"","url":"https://api.github.com/users/ziccardi","html_url":"https://github.com/ziccardi","followers_url":"https://api.github.com/users/ziccardi/followers","following_url":"https://api.github.com/users/ziccardi/following{/other_user}","gists_url":"https://api.github.com/users/ziccardi/gists{/gist_id}","starred_url":"https://api.github.com/users/ziccardi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ziccardi/subscriptions","organizations_url":"https://api.github.com/users/ziccardi/orgs","repos_url":"https://api.github.com/users/ziccardi/repos","events_url":"https://api.github.com/users/ziccardi/events{/privacy}","received_events_url":"https://api.github.com/users/ziccardi/received_events","type":"User","site_admin":false},"body":"# Motivation\r\nIssue https://issues.jboss.org/browse/AEROGEAR-8133\r\n\r\n# What\r\nWhen you create a binding for the UPS, now when you select the platform, only the field for that platform are visualised.\r\nMoreover, validation against required fields is performed\r\n\r\n# Note\r\nNeeds [PR81](https://github.com/aerogearcatalog/unifiedpush-apb/pull/81) to work.\r\nYou can update your own `clusterserviceplan` using `oc edit clusterserviceplan` as a cluster admin (ie system:admin) to add `\"filterDisplayGroupBy\":\"CLIENT_TYPE\"` [here](https://github.com/aerogearcatalog/unifiedpush-apb/blob/master/apb.yml#L32)","created_at":"2018-11-22T18:00:05Z","updated_at":"2018-11-23T10:04:44Z","closed_at":null,"merged_at":null,"merge_commit_sha":"770b8d88634055346d5ec792a7b68ff36d39cbbd","assignee":null,"assignees":[],"requested_reviewers":[{"login":"secondsun","id":2413816,"node_id":"MDQ6VXNlcjI0MTM4MTY=","avatar_url":"https://avatars2.githubusercontent.com/u/2413816?v=4","gravatar_id":"","url":"https://api.github.com/users/secondsun","html_url":"https://github.com/secondsun","followers_url":"https://api.github.com/users/secondsun/followers","following_url":"https://api.github.com/users/secondsun/following{/other_user}","gists_url":"https://api.github.com/users/secondsun/gists{/gist_id}","starred_url":"https://api.github.com/users/secondsun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/secondsun/subscriptions","organizations_url":"https://api.github.com/users/secondsun/orgs","repos_url":"https://api.github.com/users/secondsun/repos","events_url":"https://api.github.com/users/secondsun/events{/privacy}","received_events_url":"https://api.github.com/users/secondsun/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/aerogear/mobile-developer-console/pulls/139/commits","review_comments_url":"https://api.github.com/repos/aerogear/mobile-developer-console/pulls/139/comments","review_comment_url":"https://api.github.com/repos/aerogear/mobile-developer-console/pulls/comments{/number}","comments_url":"https://api.github.com/repos/aerogear/mobile-developer-console/issues/139/comments","statuses_url":"https://api.github.com/repos/aerogear/mobile-developer-console/statuses/caabe8e32372a6166a770e04575aaf6e58a92d5d","head":{"label":"aerogear:AEROGEAR-8133","ref":"AEROGEAR-8133","sha":"caabe8e32372a6166a770e04575aaf6e58a92d5d","user":{"login":"aerogear","id":954205,"node_id":"MDEyOk9yZ2FuaXphdGlvbjk1NDIwNQ==","avatar_url":"https://avatars1.githubusercontent.com/u/954205?v=4","gravatar_id":"","url":"https://api.github.com/users/aerogear","html_url":"https://github.com/aerogear","followers_url":"https://api.github.com/users/aerogear/followers","following_url":"https://api.github.com/users/aerogear/following{/other_user}","gists_url":"https://api.github.com/users/aerogear/gists{/gist_id}","starred_url":"https://api.github.com/users/aerogear/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aerogear/subscriptions","organizations_url":"https://api.github.com/users/aerogear/orgs","repos_url":"https://api.github.com/users/aerogear/repos","events_url":"https://api.github.com/users/aerogear/events{/privacy}","received_events_url":"https://api.github.com/users/aerogear/received_events","type":"Organization","site_admin":false},"repo":{"id":141608523,"node_id":"MDEwOlJlcG9zaXRvcnkxNDE2MDg1MjM=","name":"mobile-developer-console","full_name":"aerogear/mobile-developer-console","private":false,"owner":{"login":"aerogear","id":954205,"node_id":"MDEyOk9yZ2FuaXphdGlvbjk1NDIwNQ==","avatar_url":"https://avatars1.githubusercontent.com/u/954205?v=4","gravatar_id":"","url":"https://api.github.com/users/aerogear","html_url":"https://github.com/aerogear","followers_url":"https://api.github.com/users/aerogear/followers","following_url":"https://api.github.com/users/aerogear/following{/other_user}","gists_url":"https://api.github.com/users/aerogear/gists{/gist_id}","starred_url":"https://api.github.com/users/aerogear/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aerogear/subscriptions","organizations_url":"https://api.github.com/users/aerogear/orgs","repos_url":"https://api.github.com/users/aerogear/repos","events_url":"https://api.github.com/users/aerogear/events{/privacy}","received_events_url":"https://api.github.com/users/aerogear/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/aerogear/mobile-developer-console","description":"Mobile Developer Console","fork":false,"url":"https://api.github.com/repos/aerogear/mobile-developer-console","forks_url":"https://api.github.com/repos/aerogear/mobile-developer-console/forks","keys_url":"https://api.github.com/repos/aerogear/mobile-developer-console/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aerogear/mobile-developer-console/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aerogear/mobile-developer-console/teams","hooks_url":"https://api.github.com/repos/aerogear/mobile-developer-console/hooks","issue_events_url":"https://api.github.com/repos/aerogear/mobile-developer-console/issues/events{/number}","events_url":"https://api.github.com/repos/aerogear/mobile-developer-console/events","assignees_url":"https://api.github.com/repos/aerogear/mobile-developer-console/assignees{/user}","branches_url":"https://api.github.com/repos/aerogear/mobile-developer-console/branches{/branch}","tags_url":"https://api.github.com/repos/aerogear/mobile-developer-console/tags","blobs_url":"https://api.github.com/repos/aerogear/mobile-developer-console/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aerogear/mobile-developer-console/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aerogear/mobile-developer-console/git/refs{/sha}","trees_url":"https://api.github.com/repos/aerogear/mobile-developer-console/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aerogear/mobile-developer-console/statuses/{sha}","languages_url":"https://api.github.com/repos/aerogear/mobile-developer-console/languages","stargazers_url":"https://api.github.com/repos/aerogear/mobile-developer-console/stargazers","contributors_url":"https://api.github.com/repos/aerogear/mobile-developer-console/contributors","subscribers_url":"https://api.github.com/repos/aerogear/mobile-developer-console/subscribers","subscription_url":"https://api.github.com/repos/aerogear/mobile-developer-console/subscription","commits_url":"https://api.github.com/repos/aerogear/mobile-developer-console/commits{/sha}","git_commits_url":"https://api.github.com/repos/aerogear/mobile-developer-console/git/commits{/sha}","comments_url":"https://api.github.com/repos/aerogear/mobile-developer-console/comments{/number}","issue_comment_url":"https://api.github.com/repos/aerogear/mobile-developer-console/issues/comments{/number}","contents_url":"https://api.github.com/repos/aerogear/mobile-developer-console/contents/{+path}","compare_url":"https://api.github.com/repos/aerogear/mobile-developer-console/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aerogear/mobile-developer-console/merges","archive_url":"https://api.github.com/repos/aerogear/mobile-developer-console/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aerogear/mobile-developer-console/downloads","issues_url":"https://api.github.com/repos/aerogear/mobile-developer-console/issues{/number}","pulls_url":"https://api.github.com/repos/aerogear/mobile-developer-console/pulls{/number}","milestones_url":"https://api.github.com/repos/aerogear/mobile-developer-console/milestones{/number}","notifications_url":"https://api.github.com/repos/aerogear/mobile-developer-console/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aerogear/mobile-developer-console/labels{/name}","releases_url":"https://api.github.com/repos/aerogear/mobile-developer-console/releases{/id}","deployments_url":"https://api.github.com/repos/aerogear/mobile-developer-console/deployments","created_at":"2018-07-19T17:02:21Z","updated_at":"2018-11-22T10:51:37Z","pushed_at":"2018-11-22T18:04:34Z","git_url":"git://github.com/aerogear/mobile-developer-console.git","ssh_url":"git@github.com:aerogear/mobile-developer-console.git","clone_url":"https://github.com/aerogear/mobile-developer-console.git","svn_url":"https://github.com/aerogear/mobile-developer-console","homepage":"","size":2074,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":11,"mirror_url":null,"archived":false,"open_issues_count":4,"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":11,"open_issues":4,"watchers":1,"default_branch":"master"}},"base":{"label":"aerogear:master","ref":"master","sha":"88d6c2275087be34ec8acfd33f64dfe592691b38","user":{"login":"aerogear","id":954205,"node_id":"MDEyOk9yZ2FuaXphdGlvbjk1NDIwNQ==","avatar_url":"https://avatars1.githubusercontent.com/u/954205?v=4","gravatar_id":"","url":"https://api.github.com/users/aerogear","html_url":"https://github.com/aerogear","followers_url":"https://api.github.com/users/aerogear/followers","following_url":"https://api.github.com/users/aerogear/following{/other_user}","gists_url":"https://api.github.com/users/aerogear/gists{/gist_id}","starred_url":"https://api.github.com/users/aerogear/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aerogear/subscriptions","organizations_url":"https://api.github.com/users/aerogear/orgs","repos_url":"https://api.github.com/users/aerogear/repos","events_url":"https://api.github.com/users/aerogear/events{/privacy}","received_events_url":"https://api.github.com/users/aerogear/received_events","type":"Organization","site_admin":false},"repo":{"id":141608523,"node_id":"MDEwOlJlcG9zaXRvcnkxNDE2MDg1MjM=","name":"mobile-developer-console","full_name":"aerogear/mobile-developer-console","private":false,"owner":{"login":"aerogear","id":954205,"node_id":"MDEyOk9yZ2FuaXphdGlvbjk1NDIwNQ==","avatar_url":"https://avatars1.githubusercontent.com/u/954205?v=4","gravatar_id":"","url":"https://api.github.com/users/aerogear","html_url":"https://github.com/aerogear","followers_url":"https://api.github.com/users/aerogear/followers","following_url":"https://api.github.com/users/aerogear/following{/other_user}","gists_url":"https://api.github.com/users/aerogear/gists{/gist_id}","starred_url":"https://api.github.com/users/aerogear/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aerogear/subscriptions","organizations_url":"https://api.github.com/users/aerogear/orgs","repos_url":"https://api.github.com/users/aerogear/repos","events_url":"https://api.github.com/users/aerogear/events{/privacy}","received_events_url":"https://api.github.com/users/aerogear/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/aerogear/mobile-developer-console","description":"Mobile Developer Console","fork":false,"url":"https://api.github.com/repos/aerogear/mobile-developer-console","forks_url":"https://api.github.com/repos/aerogear/mobile-developer-console/forks","keys_url":"https://api.github.com/repos/aerogear/mobile-developer-console/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aerogear/mobile-developer-console/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aerogear/mobile-developer-console/teams","hooks_url":"https://api.github.com/repos/aerogear/mobile-developer-console/hooks","issue_events_url":"https://api.github.com/repos/aerogear/mobile-developer-console/issues/events{/number}","events_url":"https://api.github.com/repos/aerogear/mobile-developer-console/events","assignees_url":"https://api.github.com/repos/aerogear/mobile-developer-console/assignees{/user}","branches_url":"https://api.github.com/repos/aerogear/mobile-developer-console/branches{/branch}","tags_url":"https://api.github.com/repos/aerogear/mobile-developer-console/tags","blobs_url":"https://api.github.com/repos/aerogear/mobile-developer-console/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aerogear/mobile-developer-console/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aerogear/mobile-developer-console/git/refs{/sha}","trees_url":"https://api.github.com/repos/aerogear/mobile-developer-console/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aerogear/mobile-developer-console/statuses/{sha}","languages_url":"https://api.github.com/repos/aerogear/mobile-developer-console/languages","stargazers_url":"https://api.github.com/repos/aerogear/mobile-developer-console/stargazers","contributors_url":"https://api.github.com/repos/aerogear/mobile-developer-console/contributors","subscribers_url":"https://api.github.com/repos/aerogear/mobile-developer-console/subscribers","subscription_url":"https://api.github.com/repos/aerogear/mobile-developer-console/subscription","commits_url":"https://api.github.com/repos/aerogear/mobile-developer-console/commits{/sha}","git_commits_url":"https://api.github.com/repos/aerogear/mobile-developer-console/git/commits{/sha}","comments_url":"https://api.github.com/repos/aerogear/mobile-developer-console/comments{/number}","issue_comment_url":"https://api.github.com/repos/aerogear/mobile-developer-console/issues/comments{/number}","contents_url":"https://api.github.com/repos/aerogear/mobile-developer-console/contents/{+path}","compare_url":"https://api.github.com/repos/aerogear/mobile-developer-console/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aerogear/mobile-developer-console/merges","archive_url":"https://api.github.com/repos/aerogear/mobile-developer-console/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aerogear/mobile-developer-console/downloads","issues_url":"https://api.github.com/repos/aerogear/mobile-developer-console/issues{/number}","pulls_url":"https://api.github.com/repos/aerogear/mobile-developer-console/pulls{/number}","milestones_url":"https://api.github.com/repos/aerogear/mobile-developer-console/milestones{/number}","notifications_url":"https://api.github.com/repos/aerogear/mobile-developer-console/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aerogear/mobile-developer-console/labels{/name}","releases_url":"https://api.github.com/repos/aerogear/mobile-developer-console/releases{/id}","deployments_url":"https://api.github.com/repos/aerogear/mobile-developer-console/deployments","created_at":"2018-07-19T17:02:21Z","updated_at":"2018-11-22T10:51:37Z","pushed_at":"2018-11-22T18:04:34Z","git_url":"git://github.com/aerogear/mobile-developer-console.git","ssh_url":"git@github.com:aerogear/mobile-developer-console.git","clone_url":"https://github.com/aerogear/mobile-developer-console.git","svn_url":"https://github.com/aerogear/mobile-developer-console","homepage":"","size":2074,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":11,"mirror_url":null,"archived":false,"open_issues_count":4,"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":11,"open_issues":4,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/aerogear/mobile-developer-console/pulls/139"},"html":{"href":"https://github.com/aerogear/mobile-developer-console/pull/139"},"issue":{"href":"https://api.github.com/repos/aerogear/mobile-developer-console/issues/139"},"comments":{"href":"https://api.github.com/repos/aerogear/mobile-developer-console/issues/139/comments"},"review_comments":{"href":"https://api.github.com/repos/aerogear/mobile-developer-console/pulls/139/comments"},"review_comment":{"href":"https://api.github.com/repos/aerogear/mobile-developer-console/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/aerogear/mobile-developer-console/pulls/139/commits"},"statuses":{"href":"https://api.github.com/repos/aerogear/mobile-developer-console/statuses/caabe8e32372a6166a770e04575aaf6e58a92d5d"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"ziccardi"}}