Commit Graph

208 Commits

Author SHA1 Message Date
John Cowen 864ffdf79b ui: Adds better error passthrough, disable/unauthorize properly on error (#5041)
1. Ensure any unexpected developer errors are passed through/shown
2. Previously when errors where returns/resolved the special
isEnabled/isAuthorized would never get resolved. This was fine as they
were set to false to start with anyway, but this resolves them again to
false for completeness
3. Improved unit testing coverage
2019-05-01 18:21:53 +00:00
John Cowen d49cf9d3c4 ui: Adds warning flash messages (yellow with warning icon) (#5033) 2019-05-01 18:21:52 +00:00
John Cowen d083a13aa3 ui: Rename extended Component variables, tweak some comments (#5021) 2019-05-01 18:21:50 +00:00
John Cowen 589396b629 ui: Resolve bad rebase and add in KV test for change of GET for KVs (#5000) 2019-05-01 18:21:49 +00:00
John Cowen c64c88026a ui: Pass GET data and clean certain values for KV's ensuring consistency (#4991) 2019-05-01 18:21:48 +00:00
John Cowen 4f34ac7861 ui: Fixup tests to expect the new `meta` property on listings (#4990) 2019-05-01 18:21:47 +00:00
John Cowen 15473db84f ui: Maintain http headers as JSON-API meta for all API requests (#4946) 2019-05-01 18:21:46 +00:00
John Cowen 93ebf086e0 UI: Use buttons instead of anchors where appropriate (#4939)
Use buttons instead of anchors where appropriate
2019-05-01 18:21:45 +00:00
John Cowen 5049780134 ui: Move intention source/destination menus use text from the template (#4938) 2019-05-01 18:21:44 +00:00
John Cowen 5eed6dcef6 UI: Move legacy ACLs, KVs and Intentions to use `form` functionality (#4936)
Change legacy acls, kvs and intentions to use `form`s
2019-05-01 18:21:43 +00:00
John Cowen d6fd3f799c UI: Move legacy ACLs to use the new searchables/changeable-sets (#4933) 2019-05-01 18:21:42 +00:00
John Cowen a73e0958d5 UI: dom usage refactoring (#4924)
Move all the dom-things to use the dom service in tabular-collection, feedback-dialog, list-collection and node show. Move get-component-factory into utils/dom and use dom.root() in a few more places

This includes an additional `dom.components` method which gives you a
list of components matching the selector instead of just one.
2019-05-01 18:21:40 +00:00
John Cowen 99070f2983 UI: CSS Refactor (#4919)
- Adds full set of svg icons as CSS/Sass variables to the source
- Starts picking out some frame-grays, whilst commenting in possibles
- Remove color prefixing

The prefixes `ui-` and `brand-` for colors hav been removed. This makes
colors slightly easier to type.
In order to differentiate between brand colors and 'normal' colors, normal
colors are named as 'true colors' i.e. blue, red, green etc etc
whereas the brand colors used a more premium sounding name such as
'steel' for vault gray, 'magenta' for consul, 'cobalt' for vagrant etc etc.
2019-05-01 18:21:38 +00:00
John Cowen d7655ea356 ui: Prefer using `notOk(actual)` instead of `ok(!actual)` in tests (#4925)
And make sure its consistent throughout the app
2019-05-01 18:21:37 +00:00
John Cowen 5ec0318442 ui: Move ACL policy and token repos to use the RepositoryService (#4867) 2019-05-01 18:21:36 +00:00
John Cowen 8656c65a3d ui: Refactors the code-mirror linting/restrict legacy tokens to HCL (#4866) 2019-05-01 18:21:35 +00:00
John Cowen 74390f2d24 ui: Async Search (#4859)
This does several things to make improving the search experience easier
moving forwards:

1. Separate searching off from filtering. 'Searching' can be thought of
as specifically 'text searching' whilst filtering is more of a
boolean/flag search.
2. Decouple the actual searching functionality to almost pure,
isolated / unit testable units and unit test. (I still import embers get
which, once I upgrade to 3.5, I shouldn't need)
3. Searching rules are now configurable from the outside, i.e. not
wrapped in Controllers or Components.
4. General searching itself now can use an asynchronous approach based on
events. This prepares for future possibilities of handing off the
searching to a web worker or elsewhere, which should aid in large scale
searching and prepares the way for other searching methods.
5. Adds the possibility of have multiple searches in one
template/route/page.

Additionally, this adds a WithSearching mixin to aid linking the
searching to ember in an ember-like way in a single place. Plus a
WithListeners mixin to aid with cleaning up of event listeners on
Controller/Component destruction.

Post-initial work I slightly changed the API of create listeners:

Returning the handler from a `remover` means you can re-add it again if you
want to, this avoids having to save a reference to the handler elsewhere
to do the same.

The `remove` method itself now returns an array of handlers, again you
might want to use these again or something, and its also more useful
then just returning an empty array.

The more I look at this the more I doubt that you'll ever use `remove`
to remove individual handlers, you may aswell just use the `remover`
returned from add. I've added some comments to reflect this, but they'll
likely be removed once I'm absolutely sure of this.

I also added some comments for WithSearching to explain possible further
work re: moving `searchParams` so it can be `hung` off the
controller object
2019-05-01 18:21:34 +00:00
John Cowen 8483f0c27c
ui: Custom version of ember-block-slots compatible with ember 3 (#5245)
The original version of ember-block-slots doesn't support ember 3 and it
seems like development has stalled on the original version.

This adds a modified version as an in-repo-addon that is compatible with
ember 3.
2019-01-30 10:56:04 +00:00
John Cowen c7e0810372
ui: Bump footer date (#5279) 2019-01-28 17:50:37 +00:00
John Cowen 7d76fea123
ui: Removes delete button form pages that show your current token (#5241)
Tokens can no longer delete themselves see:

https://github.com/hashicorp/consul/pull/5210

...so we remove the button to allow you to do that from the UI
2019-01-23 13:51:36 +00:00
John Cowen 6ec6530e03
UI: [BUGFIX] Decode/encode urls (#5206)
In 858b05fc31 (diff-46ef88aa04507fb9b039344277531584)
we removed encoding values in pathnames as we thought they were
eventually being encoded by `ember`. It looks like this isn't the case.

Turns out sometimes they are encoded sometimes they aren't. It's complicated.
If at all possible refer to the PR https://github.com/hashicorp/consul/pull/5206.

It's related to the difference between `dynamic` routes and `wildcard` routes.

Partly related to this is a decision on whether we urlencode the slashes within service names or not. Whilst historically we haven't done this, we feel its a good time to change this behaviour, so we'll also be changing services to use dynamic routes instead of wildcard routes. So service links will then look like /ui/dc-1/services/application%2Fservice rather than /ui/dc-1/services/application/service

Here, we define our routes in a declarative format (for the moment at least JSON) outside of Router.map, and loop through this within Router.map to set all our routes using the standard this.route method. We essentially configure our Router from the outside. As this configuration is now done declaratively outside of Router.map we can also make this data available to href-to and paramsFor, allowing us to detect wildcard routes and therefore apply urlencoding/decoding.

Where I mention 'conditionally' below, this is detection is what is used for the decision.

We conditionally add url encoding to the `{{href-to}}` helper/addon. The
reasoning here is, if we are asking for a 'href/url' then whatever we
receive back should always be urlencoded. We've done this by reusing as much
code from the original `ember-href-to` addon as possible, after this
change every call to the `{{href-to}}` helper will be urlencoded.

As all links using `{{href-to}}` are now properly urlencoded. We also
need to decode them in the correct place 'on the other end', so..

We also override the default `Route.paramsFor` method to conditionally decode all
params before passing them to the `Route.model` hook.

Lastly (the revert), as we almost consistently use url params to
construct API calls, we make sure we re-encode any slugs that have been
passed in by the user/developer. The original API for the `createURL`
function was to allow you to pass values that didn't need encoding,
values that **did** need encoding, followed by query params (which again
require url encoding)

All in all this should make the entire ember app url encode/decode safe.
2019-01-23 13:46:59 +00:00
John Cowen 5eb5065f70
UI: Text change and clarity Node Health > Health Checks (#5115)
Text change Node Health > Health Checks
Also adds an info icon and tooltip to Health Checks column header
2019-01-17 09:20:00 +00:00
Jihoon Chung 788bf610ae ui: Fix typo in acl-migration guide link (#5135) 2019-01-17 09:03:23 +00:00
Alvin Huang fb62d4471c add documentation on how to use ember-exam 2019-01-03 23:50:02 -05:00
Alvin Huang 18bfab1db6 add test-parallel yarn command 2019-01-03 23:49:45 -05:00
Alvin Huang cdde1d7f7d change env to test 2019-01-03 22:27:17 -05:00
Alvin Huang 806f1a68b0 adding build-ci yarn target 2019-01-03 22:27:17 -05:00
Alvin Huang 961440870b output XML test results 2019-01-03 22:21:19 -05:00
Alvin Huang 4233509e83 enable ember-exam 2019-01-03 22:21:20 -05:00
Alvin Huang 9c1e0a75d0 update testem with newer conventions 2019-01-03 22:18:55 -05:00
Alvin Huang 898c725279 adding ember-exam package 2019-01-03 16:59:30 -05:00
Hans Hasselberg 03d7406fa5
ui: serve /robots.txt when UI is enabled. (#5089)
* serve /robots.txt
* robots.txt: disallow everything
2018-12-17 19:35:03 +01:00
John Cowen 741ae50c9b
ui: Correctly escape an inline svg icon (#5032) 2018-12-04 17:02:59 +00:00
John Cowen b33c361f53
ui: Add AWS external-source icon (#5030) 2018-11-30 09:59:02 +00:00
John Cowen 77ad621c04
ui: If a service has no external-source, don't show the icon (#4996) 2018-11-26 17:34:00 +00:00
John Cowen a641727208
ui: Adds the CONSUL_VERSION env var into the HTML source in a comment (#4993) 2018-11-26 14:27:56 +00:00
John Cowen 751f8552b2
UI: Removes success notification on faking a success response for `self` (#4906)
In order to continue supporting the legacy ACL system, we replace
the 500 error from a non-existent `self` endpoint with a response of a
`null` `AccessorID` - which makes sense (a null AccessorID means old
API)

We then redirect the user to the old ACL pages which then gives a 403
if their token was wrong which then redirects them back to the login page.

Due to the multiple redirects and not wanting to test the validity of the token
before redirecting (thus calling the same API endpoint twice), it is not
straightforwards to turn the 'faked' response from the `self` endpoint
into an error (flash messages are 'lost' through multiple redirects).

In order to make this a slightly better experience, you can now return a
`false` during execution of an action requiring success/failure
feedback, this essentially skips the notification, so if the action is
'successful' but you don't want to show the notification, you can. This
resolves showing a successful notification when the `self` endpoint
response is faked. The last part of the puzzle is to make sure that the
global 403 catching error in the application Route also produces an
erroneous notification.

Please note this can only happen with a ui client using the new ACL
system when communicating with a cluster using the old ACL system, and
only when you enter the wrong token.

Lastly, further acceptance tests have been added around this

This commit also adds functionality to avoid any possible double 
notification messages, to avoid UI overlapping
2018-11-07 15:57:41 +00:00
John Cowen d7e969f513
ui: Make empty Rules ('') take priority over a `Legacy: true` (#4899)
Even if an old style token has a Legacy of true, yet it has an empty set
of Rules, treat the token as a new style token, as its essentially the
same
2018-11-06 18:08:10 +00:00
John Cowen d1b3a63b2f
UI: Catch 500 error on token endpoint and revert to legacy tokens (#4874)
In some circumstances a consul 1.4 client could be running in an
un-upgraded 1.3 or lower cluster. Currently this gives a 500 error on
the new ACL token endpoint. Here we catch this specific 500 error/message
and set the users AccessorID to null. Elsewhere in the frontend we use
this fact (AccessorID being null) to decide whether to present the
legacy or the new ACL UI to the user.

Also:
- Re-adds in most of the old style ACL acceptance tests, now that we are keeping the old style UI
- Restricts code editors to HCL only mode for all `Rules` editing (legacy/'half legacy'/new style)
- Adds a [Stop using] button to the old style ACL rows so its possible to logout.
- Updates copy and documentation links for the upgrade notices
2018-11-02 14:44:36 +00:00
John Cowen 0acc5a5c4f
ui: Brings the new ACLs into line with the new repo folder structure (#4857)
This PR updates the folder structure and naming of the new ACLs, the same as #4694 .
2018-10-26 18:40:51 +01:00
John Cowen 54f293157b
ui: Some trivial test additions, support env var passing of port numbers (#4728)
1. Unskip some trivial tests that were being tested higher up
2. Istanbul ignore some code for coverage.
  1. Things that I didn't write and need to 100% follow
  2. The source code checking test that has Istanbul code injected into
  it
3. Add a few simple test cases
4. Support passing port numbers through to `ember serve` and `ember
test` for use cases that would benefit from being able to configure the
ports things are served over but still use `yarn run` thus reusing the
`yarn run` config in `package.json`
2018-10-26 17:50:43 +01:00
John Cowen a7228cf83d
ui: Move repo services to repository/ folder and standardize naming (#4694)
Repositories are a class of services to help with CRUD actions, most of
the functionality is reused across various Models. This creates a new
repository service that centralizes all this reused functionality.
Inheritance via ember `Service.extend` is used as opposed to
decorating via Mixins.

1. Move all repository services (and their tests) to a
services/repository folder
2. Standardize on a singular name format 'node vs nodes'
3. Create a new 'repository' service to centralize functionality. This
should be extended by 'repository' services
2018-10-26 17:36:15 +01:00
John Cowen 42919e91bb
ui: Adds multi syntax linting to the code editor (#4814) 2018-10-19 17:36:38 +01:00
John Cowen 52a62f2b8d UI: New ACLs (#4789)
UI to accompany the new ACLs APIs
2018-10-19 08:45:05 -07:00
John Cowen 3ec70b62a3
ui: Fix freetext searching within the nodes page (#4819)
Essentially this was missing a call to `super`. The error unfortuantely
didn't arise in the tests as it only errors when the node list has 4
items are more (the 4 columns), and the acceptence tests by change were
only filling the page with 3 nodes for test purposes.

I've bumped the amount of nodes up to 4 in the tests, which then causes
the tests to fail, made the fix by adding the `super` call, and the
tests now pass.

I also tested the UI/text searching on a 10,000 node system, and
everything now works as expected.
2018-10-19 14:31:22 +01:00
John Cowen ef891a23b5
ui: Improve layout of node cards on large and small screens (#4761)
1. The grid based unhealthy cards are now clamped to only four wide
maximum. This means that on larger screen the cards are much wider
meaning you can view more information. Grid gutters are also clamped at
a certain ideal width screen, remaining responsive for anything below
this.

2. The healthy node columns are finally responsive following the same
column rules as unhealthy nodes
2018-10-11 10:19:06 +01:00
John Cowen 0dface2010
ui: Add truncation to the `.Address` (#4760) 2018-10-11 10:17:56 +01:00
John Cowen 34f134caa0
ui: Cope with service names that contain slashes (#4756) 2018-10-11 10:14:04 +01:00
John Cowen 9fe12d2b10
ui: Reduce the breakpoint at which the smaller footer kicks in (#4723) 2018-10-11 10:13:17 +01:00
John Cowen 23a6f663cf
ui: Move the text encoding polyfill to a a proper detecting polyfill (#4767) 2018-10-08 17:47:44 +01:00