Created an oauth2 package which encapsulates all oauth2 providers,
utility functions, types, and interfaces. Previously some methods of the
Github provider were used as http.HandlerFuncs. These have now been
pulled into a concrete type called a JWTMux to implement other Oauth2
providers.
JWTMux has all of the functionality required to take a token from any
provider and store it as a JWT in a browser, and that is the extent of
its responsibilities. It implements the oauth2.Mux interface which would
potentially allow other strategies of oauth2 credential storage.
Open() wasn't a hard requirement, so it was a little surprising to need
to use it when creating an enterprise.Client in some circumstances but
not others. This returns an error when Querying if Open() was not
called, preventing panics which would otherwise result. Granted, this
would only be encountered by developers, but I believe a helpful error
is sometimes more useful than a mysterious panic when making libs that
devs actually enjoy using. Furthermore, a preflight check to see whether
dataNodes was initialized makes the Open() method idempotent.
This divides templates into two classes: autoflow and static. This is
controlled by a boolean "autoflow" property on templates. Any autoflow
templates that will be rendered for a host, have their cells arranged in
a left-to-right, top-to-bottom fashion.
Static templates, are assumed to have precise positioning information
for their graphs. The only adjustment made to them will be a translation
of their Y coords so they do not overlap other layouts.
The autoflow templates, after processing, become a static layout as
defined above and are positioned accordingly.
The JSON encoder was very upset with the ,string struct tag option. It
spat out the error:
json: invalid use of ,string struct tag, trying to unmarshal
"18aed9a7-dc83-406e-a4dc-40d53049541a" into string
The documentation appears to be incomplete on this struct tag option,
and removing it fixes this error.
React-grid-layout uses an "i" parameter in the JSON describing a layout
as an identifier. This is used to bind DOM elements' keys to Cells from
the API. Also, we need a "Name" to describe what each graph is to a
user.
Also, react-grid-layout specified widths and heights in terms of units
of the grid that it establishes. In order to have this properly
configured, the extents of this grid need to be spelled out when
creating a ReactGridLayout, hence the addition of "cols" and
"rowHeight" props to that component.
Finally, react-grid-layout incorporates some of its own styles. To
support this, some modifications needed to be made to the webpack config
to allow us to pull in includes from node_modules.