bd1ffcfe55ffbc4a280531a06b45eb75e83413d7
angie
  Fri Jan 9 14:24:57 2015 -0800
New javascript UI framework using ReactJS and ImmutableJS libraries.Files live in three subdirectories of hg/js/:

- external/ has minified releases of MIT- or BSD-licensed, well-tested external libraries
that are not already hosted on sufficiently fast content delivery networks (CDNs).
We can use CDNs for ReactJS, JQuery and JQueryUI.

- model/ has code for the "brains" of a CGI's UI: it maintains a data structure that encodes
the state of the UI, sends ajax requests to the CGI when necessary to respond to user actions,
and updates the UI state data structure in response to user actions and ajax responses.
model has a lib/ subdirectory and will have one subdir per CGI.
model/lib/ has these modules:
- cart.js: functions for sending JSON-encoded ajax requests to CGI with hgsid
- ImModel.js: base class for UI model that uses ImmutableJS to efficiently maintain
a series of immutable data structures encoding the entire UI state.  This enables
simpler reasoning about state changes, and as a bonus, easy undo/redo of user actions.
- CladeOrgDbMixin.js: this can be "mixed in" to a subclass of ImModel to handle
hgGateway-style clade, org/genome and db menus.
- PositionSearchMixin.js: this can be "mixed in" to a subclass of ImModel to handle
position search with autocomplete for genes (when a db has that info)

- react/ has code for the UI view, i.e. the elements that appear on the page and trigger
events when the user does something.  The React library efficiently implements a virtual
top-down re-render of the entire UI state whenever something changes, making DOM calls
only for DOM elements that need to change.  The use of ImmutableJS for the UI state
enables very efficient detection of changes.
The view modules are written in JSX, a superset of Javascript that adds HTML-like
syntax for instantiation of UI elements.  Compiling JSX to JS requires the installation
of node, npm (node package manager) and the react-tools package.  In order to avoid
that requirement for mirror installations, a bundle of compiled JSX files has been added
to git.  Developers who change .JSX files must set the JSX environment variable to jsx
(or complete path to jsx), and should also set JSXHINT to jsxhint.
react/ has the following subdirs:
- bundle/ contains compiled and minified version of JSX code
- lib/ has UI components written in JSX, some very basic (Section.jsx, CheckboxLabel.jsx),
some more complex (PositionSearch.jsx)
- mixins/ has JS (not JSX) modules that add functionality to components; PathUpdate.js
checks for properties that must be passed down in order to work with ImModel,
ImmutableUpdate adds efficient change detection using ImmutableJS.
- each CGI will have a subdir for its JSX code

Many thanks to Brian Craft for pointing me at React and Immutable.  Any flaws herein
are not Brian's fault!

diff --git src/hg/js/install.mk src/hg/js/install.mk
new file mode 100644
index 0000000..6e6644f7
--- /dev/null
+++ src/hg/js/install.mk
@@ -0,0 +1,23 @@
+# jsInstall.mk - user/alpha/beta installation rules shared by all js dirs.
+
+user:
+	if test -d ${DOCUMENTROOT}-${USER}; then \
+	    ${MAKE} doInstall DEST=${DOCUMENTROOT}-${USER}/js; \
+	else \
+	    ${MAKE} doInstall DEST=${DOCUMENTROOT}/js/${USER}; \
+	fi
+
+alpha:
+	${GITUP}
+	${MAKE} doInstall DEST=${DOCUMENTROOT}/js
+
+beta:
+	${GITUP} 
+	${MAKE} doInstall DEST=${DOCUMENTROOT}-beta/js extra=-forceVersionNumbers
+
+clean:
+
+compile:
+
+install:
+	${MAKE} doInstall DEST=${DOCUMENTROOT}/js