{"action":"created","issue":{"url":"https://api.github.com/repos/kolide/fleet/issues/1407","repository_url":"https://api.github.com/repos/kolide/fleet","labels_url":"https://api.github.com/repos/kolide/fleet/issues/1407/labels{/name}","comments_url":"https://api.github.com/repos/kolide/fleet/issues/1407/comments","events_url":"https://api.github.com/repos/kolide/fleet/issues/1407/events","html_url":"https://github.com/kolide/fleet/issues/1407","id":213941591,"node_id":"MDU6SXNzdWUyMTM5NDE1OTE=","number":1407,"title":"Front End Refactor","user":{"login":"murphybytes","id":504156,"node_id":"MDQ6VXNlcjUwNDE1Ng==","avatar_url":"https://avatars2.githubusercontent.com/u/504156?v=4","gravatar_id":"","url":"https://api.github.com/users/murphybytes","html_url":"https://github.com/murphybytes","followers_url":"https://api.github.com/users/murphybytes/followers","following_url":"https://api.github.com/users/murphybytes/following{/other_user}","gists_url":"https://api.github.com/users/murphybytes/gists{/gist_id}","starred_url":"https://api.github.com/users/murphybytes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/murphybytes/subscriptions","organizations_url":"https://api.github.com/users/murphybytes/orgs","repos_url":"https://api.github.com/users/murphybytes/repos","events_url":"https://api.github.com/users/murphybytes/events{/privacy}","received_events_url":"https://api.github.com/users/murphybytes/received_events","type":"User","site_admin":false},"labels":[{"id":499446648,"node_id":"MDU6TGFiZWw0OTk0NDY2NDg=","url":"https://api.github.com/repos/kolide/fleet/labels/Component:%20Frontend","name":"Component: Frontend","color":"1d76db","default":false},{"id":729805692,"node_id":"MDU6TGFiZWw3Mjk4MDU2OTI=","url":"https://api.github.com/repos/kolide/fleet/labels/Needs:%20Discussion","name":"Needs: Discussion","color":"fbca04","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2017-03-14T01:11:32Z","updated_at":"2018-08-15T19:15:27Z","closed_at":"2018-08-15T19:15:27Z","author_association":"CONTRIBUTOR","body":"The UI implementation of this feature can be considered a proof of concept for moving away from our current SPA/React based approach.  The idea is to follow a Rails like approach, creating a go module in Kolide that serves up html pages that are generated from go html templates.  We'd create a new set of urls as follows, and follow REST to route to pages for display, or manipulation of data.  \r\n```\r\n/kolide/decorators\r\n/kolide/users\r\n```\r\nThe pages would be served from the same endpoint as the Kolide API.  When implementing most of these pages we could use something loosely modeled after the MVC pattern.  kolide.Service would be analogous to the Controller, and kolide.Datastore is the Model.  The templates (View) embed calls to kolide.Service to be populated with data as opposed to making calls to the API.  Dynamic content could still be retrieved from the API via browser side javascript just like we do now.  One advantage of doing this would be that we would have a clean separation of concerns with the responsibility of managing state being solely the concern of the backend go app, and display concerns being restricted to the templates/browser.  We'd still have javascript code that manipulates the DOM but it would be restricted to where it is absolutely necessary.  \r\n\r\n## Workflow\r\nIn terms of work flow, whoever is working on the UI side of things would create simple static html files for a feature.  Data would be stubbed out.  Once the front end dev is happy with the look and feel of the page the backend developers would templatize them and load them into the binary via  go-bindata in much the same way that we do with email templates today. The bindata templates would be read and loaded when the application started, with panics occurring when the app starts if there are problems.  I think this would ultimately improve the quality of the UI.    The beauty of this approach is that front end guys can concentrate on what they know best, same with back end devs.  Hopefully this would also result in big productivity gains.  \r\n\r\n## Authentication\r\nPut the user token in a cookie instead of the Authentication header, and use go-kit middleware to validate the user, much as we do today in the API implementation.  This approach should facilitate the existing SPA and this new implementation co-existing allowing the SPA to call these new pages as needed.  If we are happy with this approach this would allow us to gradually migrate away from the SPA.  \r\n\r\n## Layouts \r\n\r\nOne of the advantages of the Rails way of doing things that results in productivity gains is template inheritance and layouts.  We could follow the pattern outlined [here]( https://elithrar.github.io/article/approximating-html-template-inheritance/) (thanks @groob) to implement the same thing in Go.  \r\n\r\n"},"comment":{"url":"https://api.github.com/repos/kolide/fleet/issues/comments/413304749","html_url":"https://github.com/kolide/fleet/issues/1407#issuecomment-413304749","issue_url":"https://api.github.com/repos/kolide/fleet/issues/1407","id":413304749,"node_id":"MDEyOklzc3VlQ29tbWVudDQxMzMwNDc0OQ==","user":{"login":"zwass","id":575602,"node_id":"MDQ6VXNlcjU3NTYwMg==","avatar_url":"https://avatars0.githubusercontent.com/u/575602?v=4","gravatar_id":"","url":"https://api.github.com/users/zwass","html_url":"https://github.com/zwass","followers_url":"https://api.github.com/users/zwass/followers","following_url":"https://api.github.com/users/zwass/following{/other_user}","gists_url":"https://api.github.com/users/zwass/gists{/gist_id}","starred_url":"https://api.github.com/users/zwass/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zwass/subscriptions","organizations_url":"https://api.github.com/users/zwass/orgs","repos_url":"https://api.github.com/users/zwass/repos","events_url":"https://api.github.com/users/zwass/events{/privacy}","received_events_url":"https://api.github.com/users/zwass/received_events","type":"User","site_admin":false},"created_at":"2018-08-15T19:15:27Z","updated_at":"2018-08-15T19:15:27Z","author_association":"CONTRIBUTOR","body":"There are no active plans to do a major rewrite of the frontend. We will continue with the STA for the foreseeable future."}}
{"actor":{"display_login":"zwass"}}