{"action":"created","comment":{"url":"https://api.github.com/repos/Caltech-IPAC/firefly/pulls/comments/57177476","id":57177476,"diff_hunk":"@@ -5,84 +5,96 @@\n import {get} from 'lodash';\n import {flux} from '../Firefly.js';\n import {logError} from '../util/WebUtil.js';\n-import FieldGroupCntlr from './FieldGroupCntlr.js';\n+import FieldGroupCntlr, {dispatchValueChange} from './FieldGroupCntlr.js';\n+\n+\n+const includeForValidation= (f,includeUnmounted) => f.valid !== undefined && (f.mounted||includeUnmounted);\n+\n+\n+function validateResolvedSingle(groupKey,includeUnmounted, doneCallback) {\n+    var flds= getGroupFields(groupKey);\n+    var valid = Object.keys(flds).every( (key) => includeForValidation(flds[key]) ? flds[key].valid : true);\n+    doneCallback(valid);\n+}\n \n-/**\n- * make a promise for this field key to guarantee that all async validation has completed\n- * @param fields the fields\n- * @param fieldKey the field key to convert to non async\n- * @return Promise\n- */\n-var makeValidationPromise= function(fields,fieldKey) {\n-    if (fields[fieldKey].mounted && fields[fieldKey].asyncUpdatePromise) {\n-        return fields[fieldKey].asyncUpdatePromise;\n-    }\n-    else {\n-        return Promise.resolve(fieldKey);\n-    }\n-};\n \n /**\n- *\n- * @return Promise with the valid state true/false\n+ * \n+ * @param groupKey\n+ * @param includeUnmounted\n+ * @param doneCallback\n+ * @return Promise with the valid state true/false --- todo: the return value does not work\n  */\n-var validateSingle= function(groupKey, doneCallback) {\n+var validateSingle= function(groupKey, includeUnmounted, doneCallback) {\n     var fields= getGroupFields(groupKey);\n+\n+    //====== clear out all functions\n+    Object.keys(fields).forEach( (key) => {\n+        if (typeof fields[key].value === 'function') {\n+            var newValue= fields[key].value();\n+            if (typeof newValue=== 'object' &&       // check to see if return is an object with {value:string,valid:boolean}\n+                Object.keys(newValue).length===2 &&\n+                newValue.hasOwnProperty('valid') &&\n+                newValue.hasOwnProperty('value') ) {\n+                dispatchValueChange({fieldKey:key,groupKey,valid:newValue.valid,value:newValue.value});\n+            }\n+            else {\n+                dispatchValueChange({fieldKey:key,groupKey,valid:true,value:newValue});\n+            }\n+        }","path":"src/firefly/js/fieldGroup/FieldGroupUtils.js","position":58,"original_position":58,"commit_id":"894aac6d97bb753be9cefd3a6e8802eeb95ddd82","original_commit_id":"894aac6d97bb753be9cefd3a6e8802eeb95ddd82","user":{"login":"tgoldina","id":11876160,"avatar_url":"https://avatars.githubusercontent.com/u/11876160?v=3","gravatar_id":"","url":"https://api.github.com/users/tgoldina","html_url":"https://github.com/tgoldina","followers_url":"https://api.github.com/users/tgoldina/followers","following_url":"https://api.github.com/users/tgoldina/following{/other_user}","gists_url":"https://api.github.com/users/tgoldina/gists{/gist_id}","starred_url":"https://api.github.com/users/tgoldina/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tgoldina/subscriptions","organizations_url":"https://api.github.com/users/tgoldina/orgs","repos_url":"https://api.github.com/users/tgoldina/repos","events_url":"https://api.github.com/users/tgoldina/events{/privacy}","received_events_url":"https://api.github.com/users/tgoldina/received_events","type":"User","site_admin":false},"body":"I would like to understand this piece of code. When would the field value be a function?","created_at":"2016-03-23T15:19:42Z","updated_at":"2016-03-23T15:19:42Z","html_url":"https://github.com/Caltech-IPAC/firefly/pull/40#discussion_r57177476","pull_request_url":"https://api.github.com/repos/Caltech-IPAC/firefly/pulls/40","_links":{"self":{"href":"https://api.github.com/repos/Caltech-IPAC/firefly/pulls/comments/57177476"},"html":{"href":"https://github.com/Caltech-IPAC/firefly/pull/40#discussion_r57177476"},"pull_request":{"href":"https://api.github.com/repos/Caltech-IPAC/firefly/pulls/40"}}},"pull_request":{"url":"https://api.github.com/repos/Caltech-IPAC/firefly/pulls/40","id":63815310,"html_url":"https://github.com/Caltech-IPAC/firefly/pull/40","diff_url":"https://github.com/Caltech-IPAC/firefly/pull/40.diff","patch_url":"https://github.com/Caltech-IPAC/firefly/pull/40.patch","issue_url":"https://api.github.com/repos/Caltech-IPAC/firefly/issues/40","number":40,"state":"open","locked":false,"title":"DM-5488: Field group updates","user":{"login":"robyww","id":6730519,"avatar_url":"https://avatars.githubusercontent.com/u/6730519?v=3","gravatar_id":"","url":"https://api.github.com/users/robyww","html_url":"https://github.com/robyww","followers_url":"https://api.github.com/users/robyww/followers","following_url":"https://api.github.com/users/robyww/following{/other_user}","gists_url":"https://api.github.com/users/robyww/gists{/gist_id}","starred_url":"https://api.github.com/users/robyww/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robyww/subscriptions","organizations_url":"https://api.github.com/users/robyww/orgs","repos_url":"https://api.github.com/users/robyww/repos","events_url":"https://api.github.com/users/robyww/events{/privacy}","received_events_url":"https://api.github.com/users/robyww/received_events","type":"User","site_admin":false},"body":"- changed mixin to high order component: FieldGroupConnector\r\n- simplified field group reducer\r\n- now value change can take any object not just required fields, this was good for TargetPanel\r\n- cleanup, added dispatchers\r\n- support for function in value of InputField\r\n- tabs now can be wrapped with InputField\r\n- FieldGroup no longer export default\r\n- hidden values in FieldGroup, Field group class, use initValue prop\r\n- tab page now classes\r\n- removed mixin\r\n- added field group support unmounted fields\r\n- made new DialogCntlr.js","created_at":"2016-03-23T00:32:04Z","updated_at":"2016-03-23T15:19:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e90254e1cb279892f18cc6b7833a1e712df66a3f","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Caltech-IPAC/firefly/pulls/40/commits","review_comments_url":"https://api.github.com/repos/Caltech-IPAC/firefly/pulls/40/comments","review_comment_url":"https://api.github.com/repos/Caltech-IPAC/firefly/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Caltech-IPAC/firefly/issues/40/comments","statuses_url":"https://api.github.com/repos/Caltech-IPAC/firefly/statuses/894aac6d97bb753be9cefd3a6e8802eeb95ddd82","head":{"label":"Caltech-IPAC:dm-5488-field-group","ref":"dm-5488-field-group","sha":"894aac6d97bb753be9cefd3a6e8802eeb95ddd82","user":{"login":"Caltech-IPAC","id":9708378,"avatar_url":"https://avatars.githubusercontent.com/u/9708378?v=3","gravatar_id":"","url":"https://api.github.com/users/Caltech-IPAC","html_url":"https://github.com/Caltech-IPAC","followers_url":"https://api.github.com/users/Caltech-IPAC/followers","following_url":"https://api.github.com/users/Caltech-IPAC/following{/other_user}","gists_url":"https://api.github.com/users/Caltech-IPAC/gists{/gist_id}","starred_url":"https://api.github.com/users/Caltech-IPAC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Caltech-IPAC/subscriptions","organizations_url":"https://api.github.com/users/Caltech-IPAC/orgs","repos_url":"https://api.github.com/users/Caltech-IPAC/repos","events_url":"https://api.github.com/users/Caltech-IPAC/events{/privacy}","received_events_url":"https://api.github.com/users/Caltech-IPAC/received_events","type":"Organization","site_admin":false},"repo":{"id":33508214,"name":"firefly","full_name":"Caltech-IPAC/firefly","owner":{"login":"Caltech-IPAC","id":9708378,"avatar_url":"https://avatars.githubusercontent.com/u/9708378?v=3","gravatar_id":"","url":"https://api.github.com/users/Caltech-IPAC","html_url":"https://github.com/Caltech-IPAC","followers_url":"https://api.github.com/users/Caltech-IPAC/followers","following_url":"https://api.github.com/users/Caltech-IPAC/following{/other_user}","gists_url":"https://api.github.com/users/Caltech-IPAC/gists{/gist_id}","starred_url":"https://api.github.com/users/Caltech-IPAC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Caltech-IPAC/subscriptions","organizations_url":"https://api.github.com/users/Caltech-IPAC/orgs","repos_url":"https://api.github.com/users/Caltech-IPAC/repos","events_url":"https://api.github.com/users/Caltech-IPAC/events{/privacy}","received_events_url":"https://api.github.com/users/Caltech-IPAC/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Caltech-IPAC/firefly","description":"","fork":false,"url":"https://api.github.com/repos/Caltech-IPAC/firefly","forks_url":"https://api.github.com/repos/Caltech-IPAC/firefly/forks","keys_url":"https://api.github.com/repos/Caltech-IPAC/firefly/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Caltech-IPAC/firefly/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Caltech-IPAC/firefly/teams","hooks_url":"https://api.github.com/repos/Caltech-IPAC/firefly/hooks","issue_events_url":"https://api.github.com/repos/Caltech-IPAC/firefly/issues/events{/number}","events_url":"https://api.github.com/repos/Caltech-IPAC/firefly/events","assignees_url":"https://api.github.com/repos/Caltech-IPAC/firefly/assignees{/user}","branches_url":"https://api.github.com/repos/Caltech-IPAC/firefly/branches{/branch}","tags_url":"https://api.github.com/repos/Caltech-IPAC/firefly/tags","blobs_url":"https://api.github.com/repos/Caltech-IPAC/firefly/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Caltech-IPAC/firefly/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Caltech-IPAC/firefly/git/refs{/sha}","trees_url":"https://api.github.com/repos/Caltech-IPAC/firefly/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Caltech-IPAC/firefly/statuses/{sha}","languages_url":"https://api.github.com/repos/Caltech-IPAC/firefly/languages","stargazers_url":"https://api.github.com/repos/Caltech-IPAC/firefly/stargazers","contributors_url":"https://api.github.com/repos/Caltech-IPAC/firefly/contributors","subscribers_url":"https://api.github.com/repos/Caltech-IPAC/firefly/subscribers","subscription_url":"https://api.github.com/repos/Caltech-IPAC/firefly/subscription","commits_url":"https://api.github.com/repos/Caltech-IPAC/firefly/commits{/sha}","git_commits_url":"https://api.github.com/repos/Caltech-IPAC/firefly/git/commits{/sha}","comments_url":"https://api.github.com/repos/Caltech-IPAC/firefly/comments{/number}","issue_comment_url":"https://api.github.com/repos/Caltech-IPAC/firefly/issues/comments{/number}","contents_url":"https://api.github.com/repos/Caltech-IPAC/firefly/contents/{+path}","compare_url":"https://api.github.com/repos/Caltech-IPAC/firefly/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Caltech-IPAC/firefly/merges","archive_url":"https://api.github.com/repos/Caltech-IPAC/firefly/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Caltech-IPAC/firefly/downloads","issues_url":"https://api.github.com/repos/Caltech-IPAC/firefly/issues{/number}","pulls_url":"https://api.github.com/repos/Caltech-IPAC/firefly/pulls{/number}","milestones_url":"https://api.github.com/repos/Caltech-IPAC/firefly/milestones{/number}","notifications_url":"https://api.github.com/repos/Caltech-IPAC/firefly/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Caltech-IPAC/firefly/labels{/name}","releases_url":"https://api.github.com/repos/Caltech-IPAC/firefly/releases{/id}","deployments_url":"https://api.github.com/repos/Caltech-IPAC/firefly/deployments","created_at":"2015-04-06T22:03:13Z","updated_at":"2016-02-01T17:14:05Z","pushed_at":"2016-03-23T01:02:03Z","git_url":"git://github.com/Caltech-IPAC/firefly.git","ssh_url":"git@github.com:Caltech-IPAC/firefly.git","clone_url":"https://github.com/Caltech-IPAC/firefly.git","svn_url":"https://github.com/Caltech-IPAC/firefly","homepage":null,"size":138283,"stargazers_count":2,"watchers_count":2,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":4,"forks":1,"open_issues":4,"watchers":2,"default_branch":"dev"}},"base":{"label":"Caltech-IPAC:dev","ref":"dev","sha":"335866b63a1d1fdbf56afc290dd6e033f76adc1c","user":{"login":"Caltech-IPAC","id":9708378,"avatar_url":"https://avatars.githubusercontent.com/u/9708378?v=3","gravatar_id":"","url":"https://api.github.com/users/Caltech-IPAC","html_url":"https://github.com/Caltech-IPAC","followers_url":"https://api.github.com/users/Caltech-IPAC/followers","following_url":"https://api.github.com/users/Caltech-IPAC/following{/other_user}","gists_url":"https://api.github.com/users/Caltech-IPAC/gists{/gist_id}","starred_url":"https://api.github.com/users/Caltech-IPAC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Caltech-IPAC/subscriptions","organizations_url":"https://api.github.com/users/Caltech-IPAC/orgs","repos_url":"https://api.github.com/users/Caltech-IPAC/repos","events_url":"https://api.github.com/users/Caltech-IPAC/events{/privacy}","received_events_url":"https://api.github.com/users/Caltech-IPAC/received_events","type":"Organization","site_admin":false},"repo":{"id":33508214,"name":"firefly","full_name":"Caltech-IPAC/firefly","owner":{"login":"Caltech-IPAC","id":9708378,"avatar_url":"https://avatars.githubusercontent.com/u/9708378?v=3","gravatar_id":"","url":"https://api.github.com/users/Caltech-IPAC","html_url":"https://github.com/Caltech-IPAC","followers_url":"https://api.github.com/users/Caltech-IPAC/followers","following_url":"https://api.github.com/users/Caltech-IPAC/following{/other_user}","gists_url":"https://api.github.com/users/Caltech-IPAC/gists{/gist_id}","starred_url":"https://api.github.com/users/Caltech-IPAC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Caltech-IPAC/subscriptions","organizations_url":"https://api.github.com/users/Caltech-IPAC/orgs","repos_url":"https://api.github.com/users/Caltech-IPAC/repos","events_url":"https://api.github.com/users/Caltech-IPAC/events{/privacy}","received_events_url":"https://api.github.com/users/Caltech-IPAC/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Caltech-IPAC/firefly","description":"","fork":false,"url":"https://api.github.com/repos/Caltech-IPAC/firefly","forks_url":"https://api.github.com/repos/Caltech-IPAC/firefly/forks","keys_url":"https://api.github.com/repos/Caltech-IPAC/firefly/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Caltech-IPAC/firefly/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Caltech-IPAC/firefly/teams","hooks_url":"https://api.github.com/repos/Caltech-IPAC/firefly/hooks","issue_events_url":"https://api.github.com/repos/Caltech-IPAC/firefly/issues/events{/number}","events_url":"https://api.github.com/repos/Caltech-IPAC/firefly/events","assignees_url":"https://api.github.com/repos/Caltech-IPAC/firefly/assignees{/user}","branches_url":"https://api.github.com/repos/Caltech-IPAC/firefly/branches{/branch}","tags_url":"https://api.github.com/repos/Caltech-IPAC/firefly/tags","blobs_url":"https://api.github.com/repos/Caltech-IPAC/firefly/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Caltech-IPAC/firefly/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Caltech-IPAC/firefly/git/refs{/sha}","trees_url":"https://api.github.com/repos/Caltech-IPAC/firefly/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Caltech-IPAC/firefly/statuses/{sha}","languages_url":"https://api.github.com/repos/Caltech-IPAC/firefly/languages","stargazers_url":"https://api.github.com/repos/Caltech-IPAC/firefly/stargazers","contributors_url":"https://api.github.com/repos/Caltech-IPAC/firefly/contributors","subscribers_url":"https://api.github.com/repos/Caltech-IPAC/firefly/subscribers","subscription_url":"https://api.github.com/repos/Caltech-IPAC/firefly/subscription","commits_url":"https://api.github.com/repos/Caltech-IPAC/firefly/commits{/sha}","git_commits_url":"https://api.github.com/repos/Caltech-IPAC/firefly/git/commits{/sha}","comments_url":"https://api.github.com/repos/Caltech-IPAC/firefly/comments{/number}","issue_comment_url":"https://api.github.com/repos/Caltech-IPAC/firefly/issues/comments{/number}","contents_url":"https://api.github.com/repos/Caltech-IPAC/firefly/contents/{+path}","compare_url":"https://api.github.com/repos/Caltech-IPAC/firefly/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Caltech-IPAC/firefly/merges","archive_url":"https://api.github.com/repos/Caltech-IPAC/firefly/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Caltech-IPAC/firefly/downloads","issues_url":"https://api.github.com/repos/Caltech-IPAC/firefly/issues{/number}","pulls_url":"https://api.github.com/repos/Caltech-IPAC/firefly/pulls{/number}","milestones_url":"https://api.github.com/repos/Caltech-IPAC/firefly/milestones{/number}","notifications_url":"https://api.github.com/repos/Caltech-IPAC/firefly/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Caltech-IPAC/firefly/labels{/name}","releases_url":"https://api.github.com/repos/Caltech-IPAC/firefly/releases{/id}","deployments_url":"https://api.github.com/repos/Caltech-IPAC/firefly/deployments","created_at":"2015-04-06T22:03:13Z","updated_at":"2016-02-01T17:14:05Z","pushed_at":"2016-03-23T01:02:03Z","git_url":"git://github.com/Caltech-IPAC/firefly.git","ssh_url":"git@github.com:Caltech-IPAC/firefly.git","clone_url":"https://github.com/Caltech-IPAC/firefly.git","svn_url":"https://github.com/Caltech-IPAC/firefly","homepage":null,"size":138283,"stargazers_count":2,"watchers_count":2,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":4,"forks":1,"open_issues":4,"watchers":2,"default_branch":"dev"}},"_links":{"self":{"href":"https://api.github.com/repos/Caltech-IPAC/firefly/pulls/40"},"html":{"href":"https://github.com/Caltech-IPAC/firefly/pull/40"},"issue":{"href":"https://api.github.com/repos/Caltech-IPAC/firefly/issues/40"},"comments":{"href":"https://api.github.com/repos/Caltech-IPAC/firefly/issues/40/comments"},"review_comments":{"href":"https://api.github.com/repos/Caltech-IPAC/firefly/pulls/40/comments"},"review_comment":{"href":"https://api.github.com/repos/Caltech-IPAC/firefly/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Caltech-IPAC/firefly/pulls/40/commits"},"statuses":{"href":"https://api.github.com/repos/Caltech-IPAC/firefly/statuses/894aac6d97bb753be9cefd3a6e8802eeb95ddd82"}}}}