Commit Graph

328 Commits (32ecf1b79605ba4db0c83d02ffec0730dbda7600)

Author SHA1 Message Date
Jared Scheib de9d0df860 Group flags more semantically consistently 2017-06-29 14:27:30 -07:00
Jared Scheib 788aec07db Improve description of custom link use, and give example (#1676) 2017-06-28 14:41:13 -07:00
Jared Scheib e9f6568074 Clarify error output for missing Name or URL 2017-06-27 13:40:26 -07:00
Jared Scheib 33127d7915 Error out server if CustomLinks invalid on run
Signed-off-by: Chris Goller <goller@gmail.com>
2017-06-27 13:31:35 -07:00
Jared Scheib 91bae804e1 Refactor links_test to use table test and cleaner error check
Signed-off-by: Jared Scheib <jared.scheib@gmail.com>
2017-06-27 13:30:34 -07:00
Jared Scheib 200225d2e2 Conserve memory allocation for customLinks slice
Signed-off-by: Chris Goller <goller@gmail.com>
2017-06-27 12:00:05 -07:00
Jared Scheib 3b76f82d47 Remove omitempty from CustomLink definition since should never b 2017-06-27 11:02:28 -07:00
Jared Scheib 0ab48663a8 Return and test for nil on invalid NewCustomLink input 2017-06-27 10:59:04 -07:00
Jared Scheib fcf9971d86 Pass through CustomLinks error message directly 2017-06-26 18:02:22 -05:00
Jared Scheib 3e3bf8988c Add full test coverage for NewCustomLinks 2017-06-26 17:18:53 -05:00
Jared Scheib b38439321d Move external links structs to links.go 2017-06-26 16:13:23 -05:00
Jared Scheib def34560e0 Only test one CustomLink to avoid map key order failing test 2017-06-26 16:12:54 -05:00
Jared Scheib 81aa909329 Add custom links to routes test 2017-06-26 16:00:27 -05:00
Jared Scheib 987141cffa Use appropriate error when NewCustomLinks fails 2017-06-26 15:44:56 -05:00
Jared Scheib a32c17a18d Comment CustomLink struct 2017-06-26 15:43:03 -05:00
Jared Scheib cac72eea60 Change 'Url' prop key to 'URL' to satisfy Go convention 2017-06-26 15:42:36 -05:00
Jared Scheib 9198e5cb7a Update comment for ServeHTTP to mention External Links 2017-06-26 15:35:42 -05:00
Jared Scheib 4bf242f955 Refactor CustomLinks transform into routes.go and new links.go
Rename generateCustomLinks to NewCustomLinks
Handle error from NewCustomLinks per app convention
2017-06-26 15:30:33 -05:00
Jared Scheib a6dcb3a382 Add 'custom' prop and example to /chronograf/v1 in swagger docs 2017-06-26 11:56:05 -07:00
Jared Scheib c1bdbcaa89 Generate custom links from env var and multiple CLI flags
Signed-off-by: Chris Goller <goller@gmail.com>
2017-06-26 11:48:47 -07:00
Jared Scheib a251071254 WIP Parse custom links from CLI 2017-06-23 15:12:02 -07:00
Tim Raymond 6c8e889b03 Add Auth0 to supported OAuth2 providers
Auth0 is an OpenID Connect compliant OAuth2 provider, so we're able to
re-use the generic OAuth2 provider to implement it. The routes required
by Auth0 have been hardcoded for user convenience.

Also, Auth0 requires users to register a subdomain of auth0.com when
signing up. This must be provided to chronograf through the
`--auth0-domain` parameter (or `AUTH0_DOMAIN` ENV). This is **distinct**
from the `PUBLIC_URL`. For example, for a Chronograf hosted at
`http://www.example.com`, and an Auth0 domain of
`http://oceanic-airlines.auth0.com`, a client-id of `notpennysboat` and a
client-secret of `4-8-15-16-23-42`, the command line options would look
like:

```
chronograf \
  --auth0-domain=http://oceanic-airlines.auth0.com \
  --auth0-client-id=notpennysboat \
  --auth0-secret=4-8-15-16-23-24
  --public-url=http://www.example.com
  -t `uuidgen`
```
2017-06-21 10:20:46 -04:00
Timothy J. Raymond 34808ddb9d Merge pull request #1619 from pragkent/generic-oauth-redirect-url
Add redirect url to generic oauth
2017-06-21 10:19:03 -04:00
Kent Wang 17984600cb Fix generic redirect URL 2017-06-21 12:19:21 +08:00
Kent Wang 9c597d2c8f Replace string concat to path.Join 2017-06-18 10:47:02 +08:00
Kent Wang 0bb20c8a0f Don't pass RedirectURL if PublicURL not set 2017-06-18 10:40:07 +08:00
Jared Scheib 7df4a6ed1a Merge branch 'master' into feature/status_page-1556 2017-06-16 17:52:16 -07:00
Jared Scheib 255daba611 Update default JSON feed URL to final, secure link 2017-06-16 14:23:46 -07:00
Kent Wang a231e9f942 Add redirect url to generic oauth 2017-06-16 17:35:57 +08:00
Jared Scheib 73fd58ef35 Update swagger docs for external and statusFeed props 2017-06-15 18:23:42 -07:00
Jared Scheib 59e184b1f1 Comment new StatusFeed member of AllRoutes 2017-06-15 17:55:46 -07:00
Jared Scheib 7a6131bd40 Refactor statusFeedURL to be set in CLI 'default'
Reverts to a clean separation of concerns between mux.go vs AllRoutes
AllRoutes now expects a StatusFeed url directly
2017-06-15 13:51:22 -07:00
Jared Scheib 95e2c18c5a Add test for all routes with ExternalLinks 2017-06-14 16:22:30 -07:00
Jared Scheib 741ce0c4b6 Remove unused fragment 2017-06-14 13:51:08 -07:00
Tim Raymond 1723f30bdf correct TemplateVar collection type in Queries 2017-06-14 10:52:29 -04:00
Jared Scheib 9e38616783 Add default InfluxData JSON feed url 2017-06-13 19:23:52 -07:00
Jared Scheib f63cba3581 Add status-feed-url build flag within new externalLinks prop in AllRoutes 2017-06-13 13:40:20 -07:00
Tim Raymond fd5036ed20 Add support for :autoGroupBy: template variable
This adds support for dynamic template variables that compute something
about themselves given some additional context.
2017-06-13 14:59:56 -04:00
Hunter Trujillo 87eff2c86c Update swagger docs. 2017-06-12 15:30:10 -06:00
Regan Kuchan 5a0abe2de7 Update version and changelog for v1.3.2.0 2017-06-02 13:34:23 -06:00
Jared Scheib cb394dd716 Refactor /chronograf/v1 to not return logoutLink if not using auth
Use logoutLink to determine if logout menu item is shown

Signed-off-by: Chris Goller <güllère@gmail.com>
2017-05-30 17:34:55 -07:00
Chris Goller 0c4c74ce36 Add kapacitor rule validation on update 2017-05-25 12:10:25 -05:00
Chris Goller d19f8062ec Fix kapacitor PUT/POST returning request rather than response 2017-05-24 15:30:45 -07:00
Regan Kuchan 7331971e23 Update version number and bumpversion 2017-05-22 11:57:23 -07:00
Tim Raymond befccf44d0 Fix infinite spinner with /chronograf basepath
When using a basepath of /chronograf, the app would present a
never-ending spinner when visiting the root route. This was because the
prefixingRedirector middleware which is responsible for appending the
basepath to redirects from downstream http.Handlers thought that the
prefix was already appended since it saw `/chronograf/v1`. In reality,
it should have produced a location like `/chronograf/chronograf/v1`.

The solution was to look beyond the first instance of a prefix and check
for the presence of another prefix to detect if a prefix was already
applied by a downstream handler.
2017-05-09 12:12:42 -07:00
Chris Goller 33b3ccc298 Update version to 1.3 for javascript and swagger 2017-05-09 08:24:04 -07:00
Tim Raymond b4d10754e4 Force prefixing in several locations
The Basepath option should be applied in anything that will be consumed
by the React application. This is because from its perspective, the
proxy sitting between it and the backend wants those prefixes regardless
of what it does with them before handing the request back to the
Chronograf backend. Consequently, there's situations in the backend
where we need to have the `opts.Basepath` or the `basepath` that we
alter when `opts.PrefixRoutes` is set. The `basepath` is strictly for
altering routing decisions made by the backend.

There's subtle places where routes are supplied to the frontend that
need to always have the `opts.Basepath` set as well. Another commit
addressed the "Location" header of Redirects, for example.
2017-05-08 14:40:50 -07:00
Tim Raymond 49feb39e90 Add PrefixedRedirect function
The router that we use has a feature that will automatically redirect
routes in certain situations where it feels a trailing slash would be
appropriate. Because the underlying router is totally unaware of
upstream prefixing activity, the "Location" that it sends clients to is
incorrect because it doesn't have the prefix.

This introduces a middleware that catches any downstream 3XX class
responses and replaces the Location header with the prefixed version of
it, plus a trailing slash. It does this only when the prefix has not
been applied already by some downstream middleware.
2017-05-08 14:40:50 -07:00
Tim Raymond ee5760bfd3 Add HTTP status code to logs
This adds the status code to the response log message to make it easier
to diagnose issues. It also replaces the placeholder "Success" message
with the decoded value of the HTTP Status, resulting in messages like:

INFO[0041] Response: Temporary Redirect                  code=307

...and so on. Both easily consumable by humans and machines.
2017-05-08 14:40:50 -07:00
Tim Raymond 0141f0870c Use Basepath over string concatenation
Basepath was previously not working here because the strings constructed
via concatenation had a trailing slash at the end:

Before:
  rootPath => "/someprefix/chronograf/v1/"

After:
  rootPath => "/someprefix/chronograf/v1"

The julienschmidt/httprouter that the bouk/httprouter is based on has
support for ignoring trailing slashes, which is behavior that we want.
However, routing decisions involving this rootPath string were being
made by a `strings.HasPrefix` function. This conditional seeks to
apply the token middleware only in cases where routes _under_
`/chronograf/v1` are accessed (e.g. `/chronograf/v1/sources`). In cases
where the paths were effectively equal, this conditional accidentally
worked because the string `/chronograf/v1` does not have the prefix
`/chronograf/v1/`. When this was corrected to use `path.Join`, this case
became true and caused the token middleware to be applied.

`path.Join` is the correct way to construct paths, since this prevents
issues where a fragment like `/foo/` is concatenated with a fragment
like `/bar/quux/` to yield the string `/foo//bar/quux/`.

Given that continuing to use concatenation is no longer an option, the
solution is to compare the lengths of the strings to ensure that the
path under comparison is longer than the prefix it's being tested
against. This guarantees that the subject path is a route underneath the
`/chronograf/v1` route.
2017-05-08 14:40:50 -07:00