{"action":"created","comment":{"url":"https://api.github.com/repos/cozy/cozy-proxy/pulls/comments/82602327","pull_request_review_id":3496438,"id":82602327,"diff_hunk":"@@ -0,0 +1,126 @@\n+# TODO: fournir un getter ici\n+# TODO: fournir un 2Nd oublet pour les actions\n+# TODO: séparer le state/store du getter!\n+\n+# Local class Step\n+class State\n+\n+    steps: [\n+        welcome = require './model/welcome',\n+        agreement = require './model/agreement',\n+        password = require './model/password',\n+        confirmation = require './model/confirmation',\n+    ]\n+\n+    constructor: () ->\n+        @_index = 0;\n+\n+\n+    getCurrent: ->\n+        @steps[@_index]\n+\n+\n+    getNext: ->\n+        index = @_index + 1\n+        @steps[nextIndex]\n+\n+\n+    getPrevious: ->\n+        index = @_index - 1\n+        @steps[nextIndex]\n+\n+\n+    # Returns an internal step by its name.\n+    getIndexOfStep: (stepName) ->\n+        steps = @steps.map (step) -> return stepName\n+        steps.indexOf stepName\n+\n+\n+    # Save current data\n+    # and keep trace of previous stateIndex\n+    # enable state history navigation\n+    # such as stateMachine\n+    save: ({ index }) ->\n+        unless (nextState = @steps[index])?\n+            throw Error 'Current step cannot be found in steps list'\n+\n+        if index isnt @_index\n+            @_previousIndex = @_index\n+            @_index = index\n+\n+            # Listen to this event\n+            # to redirect to other views\n+            _trigger 'onboardingModel:change', {\n+                step: @getCurrent(),\n+                previous: @getPrevious()\n+\n+\n+# Main class\n+# StateController is the component in charge of managing steps\n+class StateController\n+","path":"client/app/lib/onboarding/index.coffee","position":null,"original_position":61,"commit_id":"1daeb046d393ce5f4a28cbddff327deed33ca595","original_commit_id":"870e5c0ba52da38bba392cfe8141edaf9af79ff7","user":{"login":"gregorylegarec","id":776764,"avatar_url":"https://avatars.githubusercontent.com/u/776764?v=3","gravatar_id":"","url":"https://api.github.com/users/gregorylegarec","html_url":"https://github.com/gregorylegarec","followers_url":"https://api.github.com/users/gregorylegarec/followers","following_url":"https://api.github.com/users/gregorylegarec/following{/other_user}","gists_url":"https://api.github.com/users/gregorylegarec/gists{/gist_id}","starred_url":"https://api.github.com/users/gregorylegarec/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gregorylegarec/subscriptions","organizations_url":"https://api.github.com/users/gregorylegarec/orgs","repos_url":"https://api.github.com/users/gregorylegarec/repos","events_url":"https://api.github.com/users/gregorylegarec/events{/privacy}","received_events_url":"https://api.github.com/users/gregorylegarec/received_events","type":"User","site_admin":false},"body":"Le controller semble reprendre ici le code précédemment dans `Application`. Quel est l'objectif ?","created_at":"2016-10-10T13:24:16Z","updated_at":"2016-10-10T13:46:33Z","html_url":"https://github.com/cozy/cozy-proxy/pull/306#discussion_r82602327","pull_request_url":"https://api.github.com/repos/cozy/cozy-proxy/pulls/306","_links":{"self":{"href":"https://api.github.com/repos/cozy/cozy-proxy/pulls/comments/82602327"},"html":{"href":"https://github.com/cozy/cozy-proxy/pull/306#discussion_r82602327"},"pull_request":{"href":"https://api.github.com/repos/cozy/cozy-proxy/pulls/306"}}},"pull_request":{"url":"https://api.github.com/repos/cozy/cozy-proxy/pulls/306","id":88412603,"html_url":"https://github.com/cozy/cozy-proxy/pull/306","diff_url":"https://github.com/cozy/cozy-proxy/pull/306.diff","patch_url":"https://github.com/cozy/cozy-proxy/pull/306.patch","issue_url":"https://api.github.com/repos/cozy/cozy-proxy/issues/306","number":306,"state":"open","locked":false,"title":"[DO NOT MERGE] Try to adapt POC and API","user":{"login":"misstick","id":1177627,"avatar_url":"https://avatars.githubusercontent.com/u/1177627?v=3","gravatar_id":"","url":"https://api.github.com/users/misstick","html_url":"https://github.com/misstick","followers_url":"https://api.github.com/users/misstick/followers","following_url":"https://api.github.com/users/misstick/following{/other_user}","gists_url":"https://api.github.com/users/misstick/gists{/gist_id}","starred_url":"https://api.github.com/users/misstick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/misstick/subscriptions","organizations_url":"https://api.github.com/users/misstick/orgs","repos_url":"https://api.github.com/users/misstick/repos","events_url":"https://api.github.com/users/misstick/events{/privacy}","received_events_url":"https://api.github.com/users/misstick/received_events","type":"User","site_admin":false},"body":"### Why this PR?\r\n - StateMachine implementation was not fully implemented,\r\n - POC merged wasnt stick to API/Documentation,\r\n - misunderstanding with concept of `stateMachine`.\r\n\r\n### The aim of this PR\r\nAnswering the questions : \r\n - What is a StateMachine?\r\n - Why using a StateMachine?\r\n - Is it necessary to implement a stepByStepComponent?\r\n - If yes, is POC should be improved?\r\n - if not, what should we kept?\r\n - What about handling data into steps? (ie. password)\r\n - What's next (...step :) )?\r\n\r\n\r\n### What is MachineStatePattern about?\r\n - having `undo/redo` actions (ie. go back to previous step),\r\n - do not change data into views or subViews but into an agnostic model (here into `lib/onboarding` aka `OnboardingState`),\r\n - having more readable views,\r\n - routes are directly related to `OnboardingState`\r\n\r\nTo my mind a MachineState pattern isnt onboarding component.\r\nMachineState is the pattern to handle data, and we will use it first on an onboarding workflow.\r\n\r\n\r\n### Improvement into `./lib/onboarding`\r\n - [x] move files from `config/*` into `lib/onboarding/model/*`,\r\n - [ ] separate OnboardingLib into 3 objects: `Getter`, `ActionCreator` and `StateController`,\r\n - [ ] define these 3 concept (with comments into `OnboardingLib`),\r\n - `StateController` is about make it all works,\r\n - `ActionCreator` are called by views (here `BackboneViews`) to update `OnboardingState`,\r\n - `Getter` is here to get data from `OnboardingState` to `BackboneViews`.\r\n\r\n!!! To be consistent data can't/musnt be updated outside of `OnboardingLib`; otherwhise it's not a stateMachine anymore.\r\n\r\n### Tasks\r\n- [ ] adding a schema related to this architecture (with the objectNames),\r\n- [ ] make POC works,\r\n- [ ] FIX test.\r\n\r\n\r\n ","created_at":"2016-10-07T10:11:14Z","updated_at":"2016-10-10T13:46:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f43914448ba488fda25c6b739a22da1e85201d02","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/cozy/cozy-proxy/pulls/306/commits","review_comments_url":"https://api.github.com/repos/cozy/cozy-proxy/pulls/306/comments","review_comment_url":"https://api.github.com/repos/cozy/cozy-proxy/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cozy/cozy-proxy/issues/306/comments","statuses_url":"https://api.github.com/repos/cozy/cozy-proxy/statuses/1daeb046d393ce5f4a28cbddff327deed33ca595","head":{"label":"cozy:improvement/POC-stick-to-documentation","ref":"improvement/POC-stick-to-documentation","sha":"1daeb046d393ce5f4a28cbddff327deed33ca595","user":{"login":"cozy","id":7690525,"avatar_url":"https://avatars.githubusercontent.com/u/7690525?v=3","gravatar_id":"","url":"https://api.github.com/users/cozy","html_url":"https://github.com/cozy","followers_url":"https://api.github.com/users/cozy/followers","following_url":"https://api.github.com/users/cozy/following{/other_user}","gists_url":"https://api.github.com/users/cozy/gists{/gist_id}","starred_url":"https://api.github.com/users/cozy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cozy/subscriptions","organizations_url":"https://api.github.com/users/cozy/orgs","repos_url":"https://api.github.com/users/cozy/repos","events_url":"https://api.github.com/users/cozy/events{/privacy}","received_events_url":"https://api.github.com/users/cozy/received_events","type":"Organization","site_admin":false},"repo":{"id":3812481,"name":"cozy-proxy","full_name":"cozy/cozy-proxy","owner":{"login":"cozy","id":7690525,"avatar_url":"https://avatars.githubusercontent.com/u/7690525?v=3","gravatar_id":"","url":"https://api.github.com/users/cozy","html_url":"https://github.com/cozy","followers_url":"https://api.github.com/users/cozy/followers","following_url":"https://api.github.com/users/cozy/following{/other_user}","gists_url":"https://api.github.com/users/cozy/gists{/gist_id}","starred_url":"https://api.github.com/users/cozy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cozy/subscriptions","organizations_url":"https://api.github.com/users/cozy/orgs","repos_url":"https://api.github.com/users/cozy/repos","events_url":"https://api.github.com/users/cozy/events{/privacy}","received_events_url":"https://api.github.com/users/cozy/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cozy/cozy-proxy","description":"Cozy authentication and routing layer","fork":false,"url":"https://api.github.com/repos/cozy/cozy-proxy","forks_url":"https://api.github.com/repos/cozy/cozy-proxy/forks","keys_url":"https://api.github.com/repos/cozy/cozy-proxy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cozy/cozy-proxy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cozy/cozy-proxy/teams","hooks_url":"https://api.github.com/repos/cozy/cozy-proxy/hooks","issue_events_url":"https://api.github.com/repos/cozy/cozy-proxy/issues/events{/number}","events_url":"https://api.github.com/repos/cozy/cozy-proxy/events","assignees_url":"https://api.github.com/repos/cozy/cozy-proxy/assignees{/user}","branches_url":"https://api.github.com/repos/cozy/cozy-proxy/branches{/branch}","tags_url":"https://api.github.com/repos/cozy/cozy-proxy/tags","blobs_url":"https://api.github.com/repos/cozy/cozy-proxy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cozy/cozy-proxy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cozy/cozy-proxy/git/refs{/sha}","trees_url":"https://api.github.com/repos/cozy/cozy-proxy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cozy/cozy-proxy/statuses/{sha}","languages_url":"https://api.github.com/repos/cozy/cozy-proxy/languages","stargazers_url":"https://api.github.com/repos/cozy/cozy-proxy/stargazers","contributors_url":"https://api.github.com/repos/cozy/cozy-proxy/contributors","subscribers_url":"https://api.github.com/repos/cozy/cozy-proxy/subscribers","subscription_url":"https://api.github.com/repos/cozy/cozy-proxy/subscription","commits_url":"https://api.github.com/repos/cozy/cozy-proxy/commits{/sha}","git_commits_url":"https://api.github.com/repos/cozy/cozy-proxy/git/commits{/sha}","comments_url":"https://api.github.com/repos/cozy/cozy-proxy/comments{/number}","issue_comment_url":"https://api.github.com/repos/cozy/cozy-proxy/issues/comments{/number}","contents_url":"https://api.github.com/repos/cozy/cozy-proxy/contents/{+path}","compare_url":"https://api.github.com/repos/cozy/cozy-proxy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cozy/cozy-proxy/merges","archive_url":"https://api.github.com/repos/cozy/cozy-proxy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cozy/cozy-proxy/downloads","issues_url":"https://api.github.com/repos/cozy/cozy-proxy/issues{/number}","pulls_url":"https://api.github.com/repos/cozy/cozy-proxy/pulls{/number}","milestones_url":"https://api.github.com/repos/cozy/cozy-proxy/milestones{/number}","notifications_url":"https://api.github.com/repos/cozy/cozy-proxy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cozy/cozy-proxy/labels{/name}","releases_url":"https://api.github.com/repos/cozy/cozy-proxy/releases{/id}","deployments_url":"https://api.github.com/repos/cozy/cozy-proxy/deployments","created_at":"2012-03-23T20:53:26Z","updated_at":"2016-10-03T14:31:10Z","pushed_at":"2016-10-10T13:23:02Z","git_url":"git://github.com/cozy/cozy-proxy.git","ssh_url":"git@github.com:cozy/cozy-proxy.git","clone_url":"https://github.com/cozy/cozy-proxy.git","svn_url":"https://github.com/cozy/cozy-proxy","homepage":"https://cozy.io","size":7417,"stargazers_count":29,"watchers_count":29,"language":"CoffeeScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":35,"mirror_url":null,"open_issues_count":32,"forks":35,"open_issues":32,"watchers":29,"default_branch":"master"}},"base":{"label":"cozy:development","ref":"development","sha":"8e036e3d7dc1f6fd5b8f2eb387219fe387c8966d","user":{"login":"cozy","id":7690525,"avatar_url":"https://avatars.githubusercontent.com/u/7690525?v=3","gravatar_id":"","url":"https://api.github.com/users/cozy","html_url":"https://github.com/cozy","followers_url":"https://api.github.com/users/cozy/followers","following_url":"https://api.github.com/users/cozy/following{/other_user}","gists_url":"https://api.github.com/users/cozy/gists{/gist_id}","starred_url":"https://api.github.com/users/cozy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cozy/subscriptions","organizations_url":"https://api.github.com/users/cozy/orgs","repos_url":"https://api.github.com/users/cozy/repos","events_url":"https://api.github.com/users/cozy/events{/privacy}","received_events_url":"https://api.github.com/users/cozy/received_events","type":"Organization","site_admin":false},"repo":{"id":3812481,"name":"cozy-proxy","full_name":"cozy/cozy-proxy","owner":{"login":"cozy","id":7690525,"avatar_url":"https://avatars.githubusercontent.com/u/7690525?v=3","gravatar_id":"","url":"https://api.github.com/users/cozy","html_url":"https://github.com/cozy","followers_url":"https://api.github.com/users/cozy/followers","following_url":"https://api.github.com/users/cozy/following{/other_user}","gists_url":"https://api.github.com/users/cozy/gists{/gist_id}","starred_url":"https://api.github.com/users/cozy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cozy/subscriptions","organizations_url":"https://api.github.com/users/cozy/orgs","repos_url":"https://api.github.com/users/cozy/repos","events_url":"https://api.github.com/users/cozy/events{/privacy}","received_events_url":"https://api.github.com/users/cozy/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cozy/cozy-proxy","description":"Cozy authentication and routing layer","fork":false,"url":"https://api.github.com/repos/cozy/cozy-proxy","forks_url":"https://api.github.com/repos/cozy/cozy-proxy/forks","keys_url":"https://api.github.com/repos/cozy/cozy-proxy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cozy/cozy-proxy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cozy/cozy-proxy/teams","hooks_url":"https://api.github.com/repos/cozy/cozy-proxy/hooks","issue_events_url":"https://api.github.com/repos/cozy/cozy-proxy/issues/events{/number}","events_url":"https://api.github.com/repos/cozy/cozy-proxy/events","assignees_url":"https://api.github.com/repos/cozy/cozy-proxy/assignees{/user}","branches_url":"https://api.github.com/repos/cozy/cozy-proxy/branches{/branch}","tags_url":"https://api.github.com/repos/cozy/cozy-proxy/tags","blobs_url":"https://api.github.com/repos/cozy/cozy-proxy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cozy/cozy-proxy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cozy/cozy-proxy/git/refs{/sha}","trees_url":"https://api.github.com/repos/cozy/cozy-proxy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cozy/cozy-proxy/statuses/{sha}","languages_url":"https://api.github.com/repos/cozy/cozy-proxy/languages","stargazers_url":"https://api.github.com/repos/cozy/cozy-proxy/stargazers","contributors_url":"https://api.github.com/repos/cozy/cozy-proxy/contributors","subscribers_url":"https://api.github.com/repos/cozy/cozy-proxy/subscribers","subscription_url":"https://api.github.com/repos/cozy/cozy-proxy/subscription","commits_url":"https://api.github.com/repos/cozy/cozy-proxy/commits{/sha}","git_commits_url":"https://api.github.com/repos/cozy/cozy-proxy/git/commits{/sha}","comments_url":"https://api.github.com/repos/cozy/cozy-proxy/comments{/number}","issue_comment_url":"https://api.github.com/repos/cozy/cozy-proxy/issues/comments{/number}","contents_url":"https://api.github.com/repos/cozy/cozy-proxy/contents/{+path}","compare_url":"https://api.github.com/repos/cozy/cozy-proxy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cozy/cozy-proxy/merges","archive_url":"https://api.github.com/repos/cozy/cozy-proxy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cozy/cozy-proxy/downloads","issues_url":"https://api.github.com/repos/cozy/cozy-proxy/issues{/number}","pulls_url":"https://api.github.com/repos/cozy/cozy-proxy/pulls{/number}","milestones_url":"https://api.github.com/repos/cozy/cozy-proxy/milestones{/number}","notifications_url":"https://api.github.com/repos/cozy/cozy-proxy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cozy/cozy-proxy/labels{/name}","releases_url":"https://api.github.com/repos/cozy/cozy-proxy/releases{/id}","deployments_url":"https://api.github.com/repos/cozy/cozy-proxy/deployments","created_at":"2012-03-23T20:53:26Z","updated_at":"2016-10-03T14:31:10Z","pushed_at":"2016-10-10T13:23:02Z","git_url":"git://github.com/cozy/cozy-proxy.git","ssh_url":"git@github.com:cozy/cozy-proxy.git","clone_url":"https://github.com/cozy/cozy-proxy.git","svn_url":"https://github.com/cozy/cozy-proxy","homepage":"https://cozy.io","size":7417,"stargazers_count":29,"watchers_count":29,"language":"CoffeeScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":35,"mirror_url":null,"open_issues_count":32,"forks":35,"open_issues":32,"watchers":29,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/cozy/cozy-proxy/pulls/306"},"html":{"href":"https://github.com/cozy/cozy-proxy/pull/306"},"issue":{"href":"https://api.github.com/repos/cozy/cozy-proxy/issues/306"},"comments":{"href":"https://api.github.com/repos/cozy/cozy-proxy/issues/306/comments"},"review_comments":{"href":"https://api.github.com/repos/cozy/cozy-proxy/pulls/306/comments"},"review_comment":{"href":"https://api.github.com/repos/cozy/cozy-proxy/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cozy/cozy-proxy/pulls/306/commits"},"statuses":{"href":"https://api.github.com/repos/cozy/cozy-proxy/statuses/1daeb046d393ce5f4a28cbddff327deed33ca595"}}}}
{"actor":{"display_login":"gregorylegarec"}}