Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

auspice extension architecture #688

Merged
merged 27 commits into from
Jan 15, 2019
Merged

auspice extension architecture #688

merged 27 commits into from
Jan 15, 2019

Conversation

jameshadfield
Copy link
Member

@jameshadfield jameshadfield commented Jan 2, 2019

Prior to this PR auspice was a repository which generated

  • (a) the interactive visualisation app used in nextstrain.org
  • (b) the server code used in nextstrain.org to handle requests from the client
  • (c) a npm-installable program to visualise local datasets, with nextstrain branding

This PR changes auspice into a stand-alone program separate from nextstrain. Alone, it can be used to display local datasets (similar to before, but with new branding). It may also be extended by injecting code at build time. In this fashion, the viewer used in nextstrain.org will be one particular extended-version of auspice.

This PR also introduces docs for auspice, which are the best place to understand and try out the functionality introduced by this PR. They are located in ./docs-src and build into a webpage to be run off github pages from ./docs. This page is a working clone of the docs in this branch and is what nextstrain.github.io/auspice will look like when this is merged into master.


  • Server code is now the responsibility of the servers running extended versions of auspice. E.g. https://github.com/nextstrain/nextstrain.org/tree/whitelabel/auspice/server
  • The "whitelabel" branch of github.com/nextstrain/nextstrain.org is configured to build auspice from this PR. There are still a few bits missing (community builds, narratives). A PR will arrive there shortly. Upon merging of both PRs the live nextstrain.org site will then be built using whitelabelled/extendable auspice.
  • The client-server API is relatively unchanged from current master. Please see future server API #687 for discussion of this.
  • Likewise, the dataset JSON format is relatively unchanged from current master. Migrating to v2.0 is a priority but outside the scope of this PR.
  • The extension interfaces are preliminary, but working. Nextstrain can be built without aesthetic regressions. They should be improved in future PRs.
  • Similarly the github pages splash & docs pages should be thought of as a first pass. They do, however, provide a centralised place for auspice documentation and marketing which we currently lack.

This commit (and the PR to which it belongs)
moves auspice from a component of nextstrain
to a stand alone tool which can be extended
(e.g. with aesthetic or functional changes).
The auspice seen on nextstrain.org will
eventually be one such extension.
The splash page can now be replaced by
providing a compatable react component.
Babel upgraded to version 7.
This allows us to use babel.config.js to have more
control over the transpiling behavior.
This allows extension JS files living outside of the
auspice directory to be processed by babel.

There is still a bug related to react-hot-loader
when using JS files outside of the auspice dir.
This decouples the main app display from dataset loading.
This is needed for extensions which want to have control
over dataset loading (e.g. drag-and-drop).
Harcoded paths can be provided by the extension JSON
file. This API is experimental and is expected to change
in future commits / PRs.
The server code has been slightly re-organised
and (hopefully) simplified.
The "getAvailable" request now returns
both the avilable datasets and narratives.
The webpack configs have also been updated such
that "npm run build" works again.
Part of a move to a future where
auspice.us handles community datasets & narratives,
nextstrain.org handles S3 datasets

Github pages builds are currently not working as
(e.g.) `/dist/bundle.js` should be `dist/bundle.js`
But this change would break server builds.
Begin using styled components in auspice to define CSS-in-JS
and to utilise a theme which is inherited by multiple components.
Future commits will allow this theme to be provided via the
extension architecture.

Styled components was chosen because it is popular, well supported
and uses pure CSS (rather than a similar-but-different syntax).

Future commits will gradually remove our usage of global defined
styles and seperate CSS files and move towards consistent use
of styled components with themes.

in the sidebar to define styles and
supply them
The nextstrain navbar has been removed and is now
part of the nextstrain repository.
Extensions can define a theme which is passed to sidebar
components as a "theme" prop available using "styled components".
This allows extensions modify the appearence of the sidebar.
Previously the available datasets were included from the server
in the response to a "get dataset" request.
This forced the server-provided dataset JSON to deviate from the
published JSON spec.
As auspice becomes used in different websites it's important that the
JSON delivered to the client mirrors that delivered to the server.
by specifying the `browserTitle` property in the provided extension JSON
Accessing auspice is now via "node auspice.js" or
"auspice" if installed globally.
Subcommands are "auspice view", "auspice build" and
"auspice develop", each with their own help pages.
Code for these commands is found in "cli/" with "src/"
being used for the client source code.
see docs/README.md for build instructions etc
Everything needs tweaking, but this looks alright and provides the base for subsequent commits.
Github pages sourced from docs/ results in many (docusaurus-generated) files needing to live in that directory. It is confusing to have both these files as well as the docs/ and website/ folders live in the same place. docs/ and docs-src/ separates these concerns.
Content is now ready for release, with notices on most pages explaining the experimental nature of the current implementation.
Releasing auspice to npm no longer uploads the src to a s3 bucket nor triggers nextstrain.org to rebuild (this must be done from within the nextstrain.org repo). 
When not extended, auspice is focused on local builds therefore is not to be run on Heroku.
The nextstrain-specific features (travis badges, nextstrain logo) have been removed. These could be added back in the future via an extension.
Logging was used throughout development of the "extend" branch.
Update the auspice logo, include it in the docs footer & app splash page. Favicons for docs & app.
During development of the "extend" branch the second tree & tip-frequency fetching had been removed from the server. Full functionality is now restored. (Note that this code is completely separate from that in the nextstrain.org server. We could one day expose this and import it in the nextstrain.org repo.)
These were introduced during rebasing while working on the extend branch due to misconfigured (global) gitconfig (it would replace 8 spaces with a tab character)
@jameshadfield jameshadfield merged commit c8f94cc into master Jan 15, 2019
@jameshadfield
Copy link
Member Author

jameshadfield commented Jan 15, 2019

Merged following discussion during 2019-01-14 nextstrain meeting

@jameshadfield jameshadfield deleted the extend branch January 15, 2019 23:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant