Commit Graph

453 Commits

Author SHA1 Message Date
John Cowen 1fdf60234c
ui: Discovery chain improvements (#7222)
* ui: remove the default word when describing routes

* ui: Avoid mutating the chain and look for the default edges more safely

* ui: Use not null check instead of a truthy check for showing disco-chain

* ui: Upgrade consul-api-double for better disco-chain mocks/fixtures
2020-02-06 12:06:47 +00:00
John Cowen 1d26be2415
ui: Ensure KV flags are passed through to Consul on update (#7216)
* ui: always pass KV flags through on update

* ui: Integration test to prove the flags queryParams gets passed through

* ui: Add Flags to the KV updating acceptance tests
2020-02-05 09:37:45 +00:00
Kenia 1eec7d561d
ui: Add ability to search nodes listing page with IP Address (#7204)
* Update search field placeholder to display `Search`

* Add an acceptance test to search node listings with node name and IP Address

* Update and add unit tests for filter/search node listing with IP Address
2020-02-04 10:45:25 -05:00
Kenia ea5d2ef8b6
ui: Hides the Routing tab for a service proxy (#7195)
* Adds conditional in route to not make discovery-chain request if service kind is equal to `connect-proxy` or `mesh-gateway`

* Adds conditional in template to not show Routing tab if `chain` returns as null

* Creates a new acceptance test to test the Routing tab not being displayed for a service proxy

* Adds `tabs` to the services/show page object
2020-02-03 10:09:15 -05:00
Kenia c4f4f4e3c6
ui: Adds an acceptance test for hiding Blocking Queries (#7162)
* Adds an acceptance test for hiding Blocking Queries

* Creates a new scenario - If a user adds CONSUL_UI_DISABLE_REALTIME to localStorage, the Blocking Queries section is hidden.

* Updates page assertion to accept functions and booleans as properties

* ui: Fix "don't see" step to watch for the different pageObject error

ember-cli-page object seems to throw a an error with a different message
depending on how you call a function:

currentPage()[property]() // message = 'Element not found'

const prop = currentPage()[property];
prop() // message = 'Something about destructuring'

This changes the step/test/assertion to ensure we check for both types of errors

Co-authored-by: John Cowen <johncowen@users.noreply.github.com>
2020-01-31 10:12:22 -05:00
John Cowen ca6f73abe2
ui: Move CI to use the Makefile for testing (+ tmporary removal of exam) (#7188)
* ui: Move CI to use the Makefile for testing (+ tmporary removal of exam)

* ui: make a specific test-ci target as we are using --path dist

--path dist looks for a previous build to test against, in CI this
exists as we run a build first, but locally potentially this dist folder
doesn't
2020-01-31 14:12:35 +00:00
John Cowen ce059a909b
ui: Fix sticky nspace menu (#7164)
* ui: Fix typo expanded > ariaExpanded

* ui: Add the things we need to test this

* ui: Add tests for testing the menu closes when clicked

* ui: Ensure the aria-menu closes on route change
2020-01-31 14:11:46 +00:00
John Cowen 281654bc5a
ui: Split splitter names in the discovery-chain (#7180)
Previous to 1.7 splitter names didn't include the namespace name

i.e. 'service-name'

as of 1.7 they now include the namespace

i.e. 'service-name.namespace'

This commit take account of that
2020-01-30 19:08:45 +00:00
John Cowen 85ea64211f
ui: Discovery-Chain: Cope with some edge case configs (#7174)
* ui: Discovery-Chain: Cope with redirects that have failovers

We found a few stranger configurations for discovery-chain, one of which
was redirects that can then failover.

We altered the parsing here to include 2 passes, one to organize the
nodes into resolvers and children/subsets based on the nodes themselves, which
includes adding the failovers to resolvers and subsets.

We then do a second pass which can more reliably figure out whether a
target is a redirect or a failover (target failovers don't have a
corresponding node), this then adds the redirect children to the already
exising resolver (from the first pass) and then checks if the redirect
also has failovers and adds those if so.

* ui: Check to see if we have a user configured default route or not

...if we don't add one so the visualization looks complete
2020-01-30 16:09:05 +00:00
John Cowen c5f184f61d
ui: Add live updates/blocking queries to the Intention listing page (#7161)
* ui: Enable blocking queries/live updates for intentions

* ui: Add acceptance tests for intention blocking queries

* ui: Add copy to explain that intentions are also now 'real time'
2020-01-29 16:22:31 +00:00
John Cowen cc1ce7bd49
ui: Add node based configuration / environment testing (#7140)
In an ember environment `config/environment.js` exports a JSON object
whereas the file itself exports a function that receives a string of the
environment name that would like returning.

This is so ember can automatically provide you with an already
configured object containing configuration values dependent on which
environment you passed to `ember-cli` using `serve`, `build` or `test`.

In order to bypass this so we can easily test what is returned for
different environments, we've installed a lightweight functional test
harness that is simple to use `substack/tape`, that can be run easily
outside of ember.

We've then written as simple test case using this to enable us to
test/assert that different environments return the correct configuration
values.

Additionally we've added some yarn scripts/make targets (yarn run
test-node / make test-node) to make this easy to run. We're yet to
integrate this into CI.
2020-01-28 17:33:20 +00:00
John Cowen 1f2b5a0091
ui: Fix wrapping service ids in the Node Detail > Services tab (#7149) 2020-01-28 14:43:32 +00:00
John Cowen 03f8bbb8a5
ui: Fix positioning of active icon in the selected menu item (#7148) 2020-01-28 14:42:20 +00:00
Kenia f6a7164d10
ui: Implements the ember-page-title addon to the UI (#7118)
* Installs ember-page-title 5.x

* Adds a page title to all template files that need one

* Adds an assertion step to test the page titles
2020-01-28 09:25:52 -05:00
John Cowen 0c12a0fef1
ui: Remove the Policy/Service Identity selector from nspaces (#7124)
When editing Nspaces, although you can assign policies to a nspace using
PolicyDefaults you cannot assign a Service Identity to a policy like you
can when adding a policy to a token.

This commit adds an extra attribute to our policy-form/policy-selector
component so you can disable this setting. At a later date we may change
this to have a conficgurable `<Slot />` instead.

Simple acceptance tests is included here
2020-01-28 09:39:09 +00:00
John Cowen 950745dfbe ui: Change environment switch statement to correct env vars 2020-01-24 16:56:21 +00:00
John Cowen fde7ca365a
ui: Acceptance test improvements to prepare for more NS tests (#6980)
* ui: Acceptance test improvements to prepare for more NS tests

* ui: Namespace acceptance testing (#7005)

* Update api-double and consul-api-double for http.body

* Adds places where we missed passing the nspace through

* Hardcode nspace CRUD to use the default nspace for policies and roles

* Alter test helpers to allow us to control nspaces from the outside

* Amends to allow tests to account for namespace, move ns from queryParam

1. We decided to move how we pass the namespace value through to the
backend when performing write actions (create, update). Previoulsy we
were using the queryParam although using the post body is the preferred
method to send the Namespace details through to the backend.
2. Other various amends to take into account testing across multiple
namespaced scenarios

* Enable nspace testing by default

* Remove last few occurances of old style http assertions

We had informally 'deprecated' our old style of http assertions that
relied on the order of http calls (even though that order was not
important for the assertion). Following on from our namespace work we
removed the majority of the old occrances of these old style assertions.

This commit removes the remaining few, and also then cleans up the
assertions/http.js file to only include the ones we are using.

This reduces our available step count further and prevents any confusion
over the usage of the old types and the new types.

* ui: Namespace CRUD acceptance tests (#7016)

* Upgrade consul-api-double

* Add all the things required for testing:

1. edit and index page objects
2. enable CONSUL_NSPACE_COUNT cookie setting
3. enable mutating HTTP response bodies based on URL

* Add acceptance test for nspace edit/delete/list and searching
2020-01-24 12:26:28 +00:00
Kenia fb578d769c
ui: Checks env CONSUL_UI_DISABLE_REALTIME to show/hide blocking queries toggle (#7099)
Adds a conditional that checks env CONSUL_UI_DISABLE_REALTIME to show/hide the Blocking Queries toggle in the Settings page.
2020-01-22 09:19:01 -05:00
John Cowen 72ff1f0607
ui: New Confirmation Dialogs (#7007)
* ui: Change action-group to use new popup-menu component in intentions

* ui: Slight amends to aria-menu to prevent scrolling

* ui: Begin to use aria-menu/popover-menu for other elements

* Use a simpler, hackier method to fix up zIndexing

* ui: Implement new confirmation dialogs in other list views (#7080)

This includes another amend to the popover-menu in order to allow
mutiple confirmations/subpanels in the same popover menu.

The functionality added here to allow this is likely to change in the
future.
2020-01-22 12:08:29 +00:00
John Cowen 1b512badd7
ui: Improve configuration/env/feature flag usage (also add build time year detection) (#7072)
* Add new getEnvironment util/function

* Use new-ish `env` function in all the places

* Clean up ember env file, add year detection from commit date
2020-01-21 17:52:40 +00:00
John Cowen 9dc83806d8
ui: Keyboard navigation improvements (#7090)
* ui: Improve keyboard access for some custom components

* ui: Add some accessibility related metadata
2020-01-20 14:15:15 +00:00
John Cowen 35c4fd03ab
ui: Discovery Chain Improvements (#7036)
* Reorganize resolvers so its clearer what's happening

* Use entire route definition for id

* Clean up a tiny bit more, use guid for ids instead of JSON

* ui: Externalize disco-chain utils and add initial unit testing

* Add some click outside-ness for de-highlighting things
2020-01-16 16:31:09 +00:00
John Cowen efdae83a87
ui: Use structure-icons as much as possible (#6851)
* ui: Delete a bunch of CSS that we recently moved elsewhere

* ui: Add some masking placeholders

* Switch out hashicorp logo for one from structure-icons

* Change copy-button to use new copy-action icon

* Change secret-button to use new visibility-hide/show icons

* New folder icon for KVs

* Cleanup some of the icons we no longer use

* Switch from %with-exit to standard-like %with-exit-icon

* Move all chevrons to use structure-icons properly

* Use star-fill as much as possible

* Remove the remaining icons from icons/index plus the file itself
2020-01-16 09:10:32 +00:00
John Cowen 6bf6002ab0
ui: Move slots to use attributes over positional params (#7032)
* Change all instances of yield/block-slots to use attributes over positional arguments

* Remove the ability to use yield/block-slots with positional params
2020-01-15 09:15:54 +00:00
John Cowen aa058a7162
ui: Make sure that the namespace is passed when changing a token via [Use] (#6973)
* Pass the namespace parameter through to the repo when using a token
* Refresh the namespace menu when somebody [Use]s a token
2019-12-20 14:57:10 +00:00
John Cowen 18c659b8e7
ui: Cope with the possibility of receiving no namespaces (#6975) 2019-12-20 14:56:18 +00:00
John Cowen 16d2e4365a
Ensure ember-data ids are created correct taking into account the nspace (#6974) 2019-12-20 14:30:19 +00:00
John Cowen 6e8a8a2bc0
ui: Various amends for 1.7beta (#6965)
* Remove empty init

* Actually make the disco chain endpoint send the nspace, note:

The backend doesn't support this as yet.

* Tweak the font size of flash-messages ever so slightly

* Make sure the nspace menu is kept up to date when creating a new one

* Move comment to the correct place

* Only refresh the namespace menu if you specifically created a nspace

* Change FIXMEs to TODOs as we are happy for these to wait until later
2019-12-18 18:27:54 +00:00
John Cowen e545c82e1e ui: Discovery Chain (#6746)
* Add data layer for discovery chain (model/adapter/serializer/repo)

* Add routing plus template for routing tab

* Add extra deps - consul-api-double upgrade plus ngraph for graphing

* Add discovery-chain and related components and helpers:

1. discovery-chain to orchestrate/view controller
2. route-card, splitter-card, resolver card to represent the 3 different
node types.
3. route-match helper for easy formatting of route rules
4. dom-position to figure out where things are in order to draw lines
5. svg-curve, simple wrapper around svg's <path d=""> attribute format.
6. data-structs service. This isn't super required but we are using
other data-structures provided by other third party npm modules in other
yet to be merged PRs. All of these types of things will live here for
easy access/injection/changability
7. Some additions to our css-var 'polyfill' for a couple of extra needed
rules

* Related CSS for discovery chain

1. We add a %card base component here, eventually this will go into our
base folder and %stats-card will also use it for a base component.
2. New icon for failovers

* ui: Discovery Chain Continued (#6939)

1. Add in the things we use for the animations
2 Use IntersectionObserver so we know when the tab is visible,
otherwise the dom-position helper won't work as the dom elements don't
have any display.
3. Add some base work for animations and use them a little
4. Try to detect if a resolver is a redirect. Right now this works for
datacenters and namespaces, but it can't work for services and subsets -
we are awaiting backend support for doing this properly.
5. Add a fake 'this service has no routes' route that says 'Default'
6. redirect icon
7. Add CSS.escape polyfill for Edge
2019-12-18 12:26:47 +00:00
John Cowen 31f36ce096 ui: Namespace Support (#6639)
Adds namespace support to the UI:

1. Namespace CRUD/management
2. Show Namespace in relevant areas (intentions, upstreams)
3. Main navigation bar improvements
4. Logic/integration to interact with a new `internal/acl/authorize` endpoint
2019-12-18 12:26:47 +00:00
John Cowen 3dfb41486e ui: %form-element-textarea > %form-area-textinput typo (#6952) 2019-12-18 12:26:46 +00:00
John Cowen e190615f97 ui: Fixes styling of 'duplicate intention' error message (#6936) 2019-12-18 12:26:46 +00:00
John Cowen 09b46dcfdc ui: Remove `writable` usage from policy and use the request instead (#6934) 2019-12-18 12:26:45 +00:00
John Cowen 1b5658d5ac ui: Use base fonts throughout the app (#6881)
We've had a set of %placeholders in our base styles for quite a while
but not butten the bullet to use them. This begins to use them.

We had to make a small amount of tweaks to base whilst doing this, but
its as we'd prefer there to be as few font placeholders as possible. We
might/should be able to reduce these further at somepoint, or
potentially rename them. We currently have six header fonts (or 4 header
fonts/2 strong body fonts) and 3 body fonts.

We also noticed an empty CSS file and deleted that while we were here.
We also noticed that the bottom border of structure tabs was a pixel
larger than ours so we tweaked that here also.
2019-12-18 12:26:45 +00:00
John Cowen 572e3891fe ui: Remove some javascript files we no longer use (#6853) 2019-12-18 12:26:44 +00:00
John Cowen 421bbd9987 ui: Ensure %app-content > %app-view-content rename is complete (#6843)
In https://github.com/hashicorp/consul/pull/6575 we changed the name of
%app-content to %app-view-content, but missed a few places that needed
renaming, this corrects that.
2019-12-18 12:26:44 +00:00
John Cowen f52e1f607d ui: Expose checks (#6575)
Adds visibility for `Expose.Checks` config setting for proxies.

1. Adds an 'Exposed Path' tab to the proxy detail page to show the user information on exposed paths.
2. If the users has exposed their healthchecks we also add this information to the Service detail page for this proxy (only for http2 and gRPC checks)
2019-12-18 12:26:43 +00:00
John Cowen eb7b69cc24 ui: CSS Upgrade (action-group,form-elements,sliding-toggle,breadcrumbs) (#6495)
This includes an update of our CSS npm module. The majority of this is
just moving files from one folder to another.

1. %breadrumbs: As well as moving we've added 'milestone' breadcrumbs
2. %checkbox-group: Moved
3. %radio-group: Moved
4. %sliding-toggle: Moved (used to be called just %toggle)
5. %form-elements: Moved and added a new %inline-alert for form field
messaging (see Structure design system)
6. %action-group is now a composition of %menu-panel, %toggle-button,
plus edits to existing style to bring the %action-groups inline with the
dropdowns from Structure). %action-group also includes a composed
%confirmation-alert that is yet to be include. This will be compiled out
until we integrate it.

We've also removed some of our old icon placeholders as the above
work seased to use some of them.

Now we done this I'd say all in all over half of our CSS components now
use the CSS npm module.

The CSS specific to Consul UI also uses much of this CSS module by way
of helper placeholders such as our %frames.
2019-12-18 12:26:43 +00:00
John Cowen 39010d2b76 ui: Adds ember-data blueprints for Consul specific HTTP adapter etc (#6461)
* ui: Adds ember-data blueprints for Consul specific HTTP adapter etc

These are currently quite Consul specific, but we also overwrite the
default model-test blueprint to keep the names consistent (dasherized)
for easy test filtering.

```
ember generate [adapter|serializer|model|repository|route] <name>
```
2019-12-18 12:26:42 +00:00
John Cowen 4c24e8b072 ui: Add optional name="" attribute so you can name slots with it (#6740)
Pretty soon we would like to move to XML/Angle Bracket style
components. As they are XML-y it means you can't use positional
parameters anymore (every 'argument' for the component requires it to
use an XML-like attribute).

This adds a `name=""` attribute to both block-slot and yield-slot
components so we can use attributes to specify the name. We prefer using
attributes from now on, whilst the positional parameter is still
available yet deprecated so we can move over at whatever speed fits.

We also did the same with the block params positional parameter.

As a final note this entire in repo addon is a fork of
`ember-block-slots`
2019-12-18 12:26:42 +00:00
John Cowen 976941ea5c ui: Add missed calls to `_super` (#6595) 2019-12-18 12:26:41 +00:00
John Cowen acdd22988a ui: [dev] Adds express middleware, removes need to run api dev server (#6750)
* ui: Adds some express middleware, removes need to run api dev server

@hashicorp/api-double comes with a basic express based server to run the
API double. This uses the express based server that ember-cli includes
and uses to run your app instead.

Eventually this will be moved to the @hashicorp/ember-cli-api-double
addon instead.

* Adds `make start-consul` to ease running a dev UI against Consul itself
2019-12-18 12:26:41 +00:00
John Cowen 8284912475 ui: Upgrade tooling to node 10 now we are on a more recent ember (#6610)
* ui: Upgrade tooling to node 10 now we are on a more recent ember

* build: Also update the conatiner for building the UI

We bump alpine here as 3.8 doesn't have node 10 by default whereas 3.9
does. Yarn is bumped to latest current version while we are here.
2019-12-18 12:26:40 +00:00
John Cowen fc951c9c0b ui: Remove `$radius-small` in favour of the `$decor-*` ones in `base` (#6605) 2019-12-18 12:26:40 +00:00
Matt Keeler 0c1a7970e3 ui: feature support templating for index.html (#6921) 2019-12-13 14:50:07 -05:00
John Cowen da49a418ce
ui: Explicitly remove properties that shouldn't be sent when saving (#6917) 2019-12-10 15:47:02 +00:00
John Cowen ee30288515
Ensure AbortErrors have a zero status (#6839) 2019-12-10 12:02:45 +00:00
John Cowen 338812f5c2
ui: UI Release Merge (ui-staging merge) (#6527)
## HTTPAdapter (#5637)

## Ember upgrade 2.18 > 3.12 (#6448)

### Proxies can no longer get away with not calling _super

This means that we can't use create anymore to define dynamic methods.
Therefore we dynamically make 2 extended Proxies on demand, and then
create from those. Therefore we can call _super in the init method of
the extended Proxies.

### We aren't allowed to reset a service anymore

We never actually need to now anyway, this is a remnant of the refactor
from browser based confirmations. We fix it as simply as possible here
but will revisit and remove the old browser confirm functionality at a
later date

### Revert classes to use ES5 style to workaround babel transp. probs

Using a mixture of ES6 classes (and hence super) and arrow functions
means that when babel transpiles the arrow functions down to ES5, a
reference to this is moved before the call to super, hence causing a js
error.

Furthermore, we the testing environment no longer lets use use
apply/call on the constructor.

These errors only manifests during testing (only in the testing
environment), the application itself runs fine with no problems without
this change.

Using ES5 style class definitions give us freedom to do all of the above
without causing any errors, so we reverted these classes back to ES5
class definitions

### Skip test that seems to have changed due to a change in RSVP timing

This test tests a usecase/area of the API that will probably never ever
be used, it was more testing out the API. We've skipped the test for now
as this doesn't affect the application itself, but left a note to come
back here later to investigate further

### Remove enumerableContentDidChange

Initial testing looks like we don't need to call this function anymore,
the function no longer exists

### Rework Changeset.isSaving to take into account new ember APIs

Setting/hanging a computedProperty of an instantiated object no longer
works. Move to setting it on the prototype/class definition instead

### Change how we detect whether something requires listening

New ember API's have changed how you can detect whether something is a
computedProperty or not. It's not immediately clear if its even possible
now. Therefore we change how we detect whether something should be
listened to or not by just looking for presence of `addEventListener`

### Potentially temporary change of ci test scripts to ensure deps exist

All our tooling scripts run through a Makefile (for people familiar with
only using those), which then call yarn scripts which can be called
independently (for people familar with only using yarn).

The Makefile targets always check to make sure all the dependencies are
installed before running anything that requires them (building, testing
etc).

The CI scripts/targets didn't follow this same route and called the yarn
scripts directly (usually CI builds a cache of the dependencies first).

For some reason this cache isn't doing what it usually does, and it
looks as though, in CI, ember isn't installed.

This commit makes the CI scripts consistently use the same method as all
of the other tooling scripts (Makefile target > Install Deps if
required > call yarn script). This should install the dependencies if
for some reason the CI cache building doesn't complete/isn't successful.

Potentially this commit may be reverted if, the root of the problem is
elsewhere, although consistency is always good, so it might be a good
idea to leave this commit as is even if we need to debug and fix things
elsewhere.

### Make test-parallel consistent with the rest of the tooling scripts

As we are here making changes for CI purposes (making test-ci
consistent), we spotted that test-parallel is also inconsistent and also
the README manual instructions won't work without `ember` installed
globally.

This commit makes everything consistent and changes the manual
instructions to use the local ember instance that gets installed via
yarn

### Re-wrangle catchable to fit with new ember 3.12 APIs

In the upgrade from ember 3.8 > 3.12 the public interfaces for
ComputedProperties have changed slightly. `meta` is no longer a public
property of ComputedProperty but of a ComputedDecoratorImpl mixin
instead.

7e4ba1096e/packages/%40ember/-internals/metal/lib/computed.ts (L725)

There seems to be no way, by just using publically available
methods, to replicate this behaviour so that we can create our own
'ComputedProperty` factory via injecting the ComputedProperty class as
we did previously.

3f333bada1/ui-v2/app/utils/computed/factory.js (L1-L18)

Instead we dynamically hang our `Catchable` `catch` method off the
instantiated ComputedProperty. In doing it like this `ComputedProperty`
has already has its `meta` method mixed in so we don't have to manually
mix it in ourselves (which doesn't seem possible)

This functionality is only used during our work in trying to ensure
our EventSource/BlockingQuery work was as 'ember-like' as possible (i.e.
using the traditional Route.model hooks and ember-like Controller
properties). Our ongoing/upcoming work on a componentized approach to
data a.k.a `<DataSource />` means we will be able to remove the majority
of the code involved here now that it seems to be under an amount of
flux in ember.

### Build bindata_assetfs.go with new UI changes
2019-09-30 14:47:49 +01:00
Dmitry Shemin 979570c7a3 ui: [bugfix] Tag wrapping on detail pages (#6478)
Makes sure that tags wrap on the detail pages for service and nodes whilst making sure they don't wrap on the listing pages.
2019-09-17 17:29:04 +01:00
John Cowen 0cc86d265e
ui: re-remove the `Type` header on the service listing page (#6439)
The `Type` column used for giving details on what type of a service each
item is was removed in https://github.com/hashicorp/consul/pull/6075.

As a result of keeping long running branches in sync, this change was
partly reverted in an earlier PR (the type header was re-added)
https://github.com/hashicorp/consul/pull/5913 following a rebase.

This commit re-removes the `Type` table header (the `<th>`)
2019-09-04 11:45:13 +01:00
John Cowen aac0406cb3
ui: Fix metaData test as result of new consul-api-double (#6436) 2019-09-04 10:13:43 +01:00
John Cowen 0038eb5dd7 ui: Netlify previews (#6419)
- Add netlify redirects file
- Add netlify makefile target and commented config settings
2019-09-04 08:35:17 +00:00
John Cowen a1bebaba4a ui: Adds a `sort-control` component for asc/desc sorting of columns etc (#6034)
This adds the component but doesn't yet use it anywhere. No tests
are added here as there isn't an awful lot to test.
2019-09-04 08:35:16 +00:00
John Cowen 5cf063fc8a ui: Leader icon for node listing view (#6265)
- yarn upgrade consul-api-double which includes `status/leader`
- add all the ember-data things required to call a new endpoint
- Pass the new leader variable through to the template
- use the new leader variable in the template to set a leader
- add acceptance testing to verify leaders are highlighted
- Change testing navigation/api requests to status/leader (on the node listing page, status/leader is now the last get request to
be called).
- Template whitespace commit (less indenting)
- adds a test to to assert no errors happen with an unelected leader
2019-09-04 08:35:16 +00:00
John Cowen 7db707c8b3 ui: fix/replace magnifier icon (#6308) 2019-09-04 08:35:15 +00:00
John Cowen 4aff12ffcd ui: add some additional env level URLs for easier linking (#6145)
Right now we only use CONSUL_DOCS_URL, the others are for future usage
2019-09-04 08:35:14 +00:00
John Cowen 429e27aaee ui: Enable blocking queries by default (#6194)
-Enable blocking queries by default
-Change assertion to check for the last PUT request, not just any request for session destruction from a node page.

Since we've now turned on blocking queries by default this means that a
second GET request is made after the PUT request that we are asserting
for but before the assertion itself, this meant the assertion failed. We
double checked this by turning off blocking queries for this test using

```
And settings from yaml
---
consul:client:
  blocking: 0
---
```

which made the test pass again.

As moving forwards blocking queries will be on by default, we didn't
want to disable blocking queries for this test, so we now assert the
last PUT request specifically. This means we continue to assert that the
session has been destroyed but means we don't get into problems of
ordering of requests here
2019-09-04 08:35:14 +00:00
John Cowen ff3c2582e2 ui: [Bugfix] - Sticky KV Sessions (#6166)
Initialize session value to `null` to prevent stickiness from a session the previous KV
2019-09-04 08:35:13 +00:00
John Cowen 834479d56f ui: Upgrade ember-cli-api-double. Adds new staging env (#6136)
ember-cli-api-double has been upgraded for 3 things:

1. Use the correct configuration flags
2. Automatically include the necessary files to enable the api doubles
without requiring a server. This can be disabled to provide custom
functionality (so we can stitch our BDD style testing in with this)
3. When used statically, read the cookies from the users browser to
enable basic ad-hoc double editing (e.g. CONSUL_SERVICE_COUNT=100000)

Once upgraded we've now moved the config to the correct place, added a
new environment (staging) to use the static-style of doubles
The test environment continues to use custom cookie setting and url
checking so we disable this 'auto importing' by setting 'auto-import' to
false for the configuration for the addon.

We also added a couple of new package script targets to explicitly serve
or build the UI with the entirely static UI.
2019-09-04 08:35:13 +00:00
John Cowen e6aaabaddb ui: Change layout styling for healthcheckoutput, add CheckID (#6195) 2019-09-04 08:35:12 +00:00
John Cowen 5749b642f1 ui: Show the correct message when a session has been removed from a KV (#6167) 2019-09-04 08:35:11 +00:00
John Cowen 5d2e1ce19b ui: Add `stats-card` component, integrate more `@hashicorp/structure-icons` (#6021)
1. Rebuild the heathchecked-resource component now we can copy and paste
2. As the above rebuild came with new icons, we also swapped out 'most'
of the other areas where we were using these new icons, plus any icons
that were effected by the new icon placeholders
3. Begin to remove more and more of the project specific icons (now
replaced by the shared ones)
2019-09-04 08:35:11 +00:00
John Cowen 39860ae995 ui: Add an additional 'more than 1 char' check for selection (#6022)
We'd rather 'play it safe' for our selection detection (which avoids
following links if you have some text selected). This commit adds an
additional check of 'more than 1 character' to the 'isSelected' check.
This is based on the fact that it's far quicker to type the character so
why would a user select on character? This therefore caters for any
fairly large (in the scheme of things) incidential mouse moves whilst
clicking a link.

Overall this is probably overkill
2019-09-04 08:35:10 +00:00
John Cowen cf83e9e8ad ui: Be more exact with intent for table truncation (#6023)
Truncation should only happen currently on table content if the tag
within the td is the only child
2019-09-04 08:35:09 +00:00
John Cowen cb51f9674d ui: Ensure event sources are closed to the correct state when connecting (#6036)
This fails the tests, but wouldn't produce an actual bug as the source
is still set to closing, just 1 tick later.
2019-09-04 08:35:08 +00:00
John Cowen bcc9dbba45 ui: removes `npm:` imports now we have standard importing (#6035) 2019-09-04 08:35:08 +00:00
John Cowen 2c5c84f9d2 ui: {{phrase-editor}} amends (#5991)
1. Re-focus the input element on phrase removal
2. Move all actions to `actions:`
3. Move to a form looking `value` rather than `items`
4. Move placeholder functionalit yinto the component
5. Force DDAU instead of two way binding with `slice` and `onchange`
6. Begin to deprecate the `searchable` interface
2019-09-04 08:35:07 +00:00
John Cowen 61d13237b6 ui: Adds the ability to frontend search instances by address (ip:port) (#5993) 2019-09-04 08:35:06 +00:00
John Cowen f7e2bb0712 ui: Small EventSource additions (#5978)
1. EventSources now pass themselves thorugh to the run function as a
second argument. This enables the use of arrow functions along with the
EventSources API
`(configuration, source) => source.close()`. Order of arguments could
potentially be switched at a later date.
2. BlockingEventSources now let you pass an 'event' through at
instantation time. If you do this, the event will immediately be dispatched
once the EventSource is opened. The usecase for this is for 'unfreezing' cached
BlockingEvents. This makes it easier to provide a cache for
BlockingEventSources by caching its data rather than the entire
BlockingEventSource itself.

```
new BlockingEventSource(
  (config, source) => { /* something */ },
  {
    cursor: 1024, // this would also come from a cache
    currentEvent: getFromSomeSortOfCache(eventSourceId) //this is the new bit
  }
);

// more realistically

new BlockingEventSource(
  (config, source) => { return data.findSomething(slug, config) },
  getFromSomeSortOfCache(eventSourceId)
);

```
2019-09-04 08:35:05 +00:00
John Cowen 011fb8a559 ui: Enable creating listeners using an object/hash (#5975)
Makes listening to multiple events on one target slightly easier.
Adding events can be rolled up into passing through an object, and the
returned remove function removes all of the handlers in the object

For example:

```
//this.listen...
const remove = listeners.add(
  {
    'message': handler,
    'error': handler
  }
);
remove(); // removes all listeners in the object
```

The entire API for listeners is now becoming slightly overloaded, so
potentially we'd use this API always and remove the ability to use a
string/function pair.
2019-09-04 08:35:04 +00:00
John Cowen e66a1b3874 ui: Reduce mutation of html.classList (#5974)
Throughout the app we mutate the value of the root node classList on
navigation between separate pages (basically on URL change).

Every template has a unique classList for example `template-service
template-show` and `template-service template-list` etc etc.

When navigating between 2 pages, both pages using the same template yet
with different data, previoulsy we would entirely clear out the
`html.classList` and then refill it again with eaxctly the same classes.

This commit moves this to perform a diff previous to mutating the
classList, and then potentially no classList mutating is needed when
moving between 2 pages of the same template.
2019-09-04 08:35:03 +00:00
John Cowen 74dbc71c84 ui: Change vocab of ReopenableEventSource from 'reopen' to 'open' (#5973)
You can potentially close an EventSource before its first tick by
immediately setting the readyState to a non-open state. Therefore it
never opens.

Calling `open` will then open it.

'Open' fits better than 'reopen' when taking the above into account
2019-09-04 08:35:02 +00:00
John Cowen e1a8a28cd2 ui: Include yadda/gherkin dictionaries we use for acc testing (#5956)
Currently these gherkin dictionaries are contained in
`ember-cli-api-double`, which isn't the correct place for them.
They belong with the steps themselves.
This is also less complicated now we can require/import javascript
using a standard approach

Also runs an update of `ember-cli-api-double` which will be the last
installation of version 1 of this module.
2019-09-04 08:35:01 +00:00
John Cowen 81637e2138 ui: CSS Components Migration (#5913)
Migrate roughly half of the base components into base
Adds a target for easily formatting CSS

Further CSS amends/migration (#5921)

1. tooltips within tables where a slightly bit troublesome due to a mix
of `inline-flex`, `overflow` and the need for truncation. This refineds
tooltips a slight bit more to work 'everywhere'.
2. We also move tooltip to use the correct color and min-width from
structure, but we overwrite the min-width here until we get confirmation
on widths/alignment of text within a tooltip.
3. Tiny fixes for breadcrumbs and toggle-buttons in tabular listings
4. Now we inline-flex our table cells, it means it is impossible to
truncate text without wrapping it in another element. This wraps all
Description like text in `<p>` tags. Generally the first column of text
is already wrapped in an `<a>` tag. Other items such as consul tags and
policy names etc get 'cutoff' rather than truncated.
5. We are now using all the icons from `@hashicorp/structure-icons`
2019-09-04 08:35:01 +00:00
John Cowen 7287185748 ui: Adds ember-auto-import and replaces the 3 places where we used npm: (#5952)
Also removes ember-browserify
2019-09-04 08:35:00 +00:00
John Cowen 55f6bac972 ui: Put some options in for event source runners (behind flags) (#5738) 2019-09-04 08:34:59 +00:00
John Cowen 3a14360da4 ui: Ensure an EventSource isn't opened if closed before first tick (#5703)
EventSources will wait for 1 tick before 'opening'. There is always the
chance that the EventSource is '.close()'ed before that tick. We
therefore check the 'readyState' before opening the EventSource
2019-09-04 08:34:59 +00:00
John Cowen 466c3c6899 ui: Allow text selection of clickable elements and their contents (#5770)
* ui: Allow text selection of clickable elements and their contents

This commit disables a click on mousedown be removing the `href`
attribute and moving it to a `data-href` attribute. On mouseup it will
only move it back if there is no selection. This means that an anchor
will only be followed on click _if_ there is no selection.

This fixes the fact that whenever you select some copy within a
clickable element it immediately throws you into the linked page when
you release your mouse.

Further notes:

We use the `isCollapsed` property here which 'seems' to be classed as
'experimental' in one place where I researched it:

https://developer.mozilla.org/en-US/docs/Web/API/Selection/isCollapsed

Although in others it makes no mention of this 'experimental' e.g:

- https://webplatform.github.io/docs/dom/Selection/isCollapsed/
- https://w3c.github.io/selection-api/#dom-selection-iscollapsed

I may have gone a little overboard in feature detection for this, but I
conscious of that fact that if `isCollapsed` doesn't exist at some point
in the future (something that seems unlikely). The code here will have
no effect on the UI. But I'd specifically like a second pair of eyes on
that.

* ui: Don't break right click, detects a secondary click on mousedown

* ui: Put anchor selection capability behind an ENV var
2019-09-04 08:34:58 +00:00
John Cowen f9710c2c92 ui: Reconcile ember-data store when records are deleted via blocking (#5745)
* ui: Reconciliate ember-data store when records are deleted via blocking

Currently we are barely using the ember-data store/cache, but it will
still cache records in the store even though technically we aren't using
it.

This adds a SyncTime to every record that uses blocking queries so we
can delete older records from the ember-data cache to prevent them
building up

* ui: Add basic timestamp method we can access from tests, fixup tests

Adds a timestamp method that we can access from within tests so we can
test that the SyncTime is being set.

There is probably a better way to do this, but this is also probably the
simplest approach - we are also likely to revisit this at a later date
2019-09-04 08:34:57 +00:00
John Cowen fdd8aa5f2e ui: Expands create-listeners API to allow recursive and functions (#5616)
1. Adds a Listeners class, which lets us...
2. Add Listeners recursively. So you can
createListeners().add(createListeners())
3. Also add the ability to `.add` as a plain function

This moves the entire idea more towards a generic teardown utility
2019-09-04 08:34:57 +00:00
John Cowen d3930d55aa
ui: Adds readonly meta data to the serviceInstance and node detail pages (#6196) 2019-08-02 13:53:52 +02:00
Jack Pearkes 776c69813b Merge remote-tracking branch 'origin/master' into release/1-6 2019-07-15 10:02:34 -07:00
John Cowen 9f7800e2f6
ui: Force upgrades lodash and lodash submodules: (#6137)
All related to:

- https://github.com/lodash/lodash/pull/4336
2019-07-15 14:48:51 +01:00
John Cowen f1b4a78d78
ui: Forced upgrade handlebars from 4.0 to 4.1 (#6077)
Force bumps [handelbars](https://github.com/wycats/handlebars.js) from 4.0 to 4.1.2 using `resolutions`

- [Release Notes](https://github.com/wycats/handlebars.js/blob/master/release-notes.md)
2019-07-15 14:06:26 +01:00
John Cowen b143a3bb66
ui: Gateway Addresses (#6075)
- Removes 'type' icons (basically the proxy icon, not the text itself)

- Add support for Mesh Gateways plus their addresses
This adds a 'Mesh Gateway' type label to service and service instance
pages, plus a new 'Addresses' tab if the service is a Mesh Gateway
showing a table of addresses for the service - plus tests
2019-07-05 09:07:25 +01:00
Joel Kuzmarski 15d7340a75 Fix text and add feature test for copy button (#5958)
`Copied IP Address!` > `Copied output!`

Adds feature test for copy button
2019-06-27 10:01:30 +01:00
Sarah Christoff e946ed9427
ui: modify content path (#5950)
* Add ui-content-path flag

* tests complete, regex validator on string, index.html updated

* cleaning up debugging stuff

* ui: Enable ember environment configuration to be set via the go binary at runtime (#5934)

* ui: Only inject {{.ContentPath}} if we are makeing a prod build...

...otherwise we just use the current rootURL

This gets injected into a <base /> node which solves the assets path
problem but not the ember problem

* ui: Pull out the <base href=""> value and inject it into ember env

See previous commit:

The <base href=""> value is 'sometimes' injected from go at index
serve time. We pass this value down to ember by overwriting the ember
config that is injected via a <meta> tag. This has to be done before
ember bootup.

Sometimes (during testing and development, basically not production)
this is injected with the already existing value, in which case this
essentially changes nothing.

The code here is slightly abstracted away from our specific usage to
make it easier for anyone else to use, and also make sure we can cope
with using this same method to pass variables down from the CLI through
to ember in the future.

* ui: We can't use <base /> move everything to javascript (#5941)

Unfortuantely we can't seem to be able to use <base> and rootURL
together as URL paths will get doubled up (`ui/ui/`).

This moves all the things that we need to interpolate with .ContentPath
to the `startup` javascript so we can conditionally print out
`{{.ContentPath}}` in lots of places (now we can't use base)

* fixed when we serve index.html

* ui: For writing a ContentPath, we also need to cope with testing... (#5945)

...and potentially more environments

Testing has more additional things in a separate index.html in `tests/`

This make the entire thing a little saner and uses just javascriopt
template literals instead of a pseudo handbrake synatx for our
templating of these files.

Intead of just templating the entire file this way, we still only
template `{{content-for 'head'}}` and `{{content-for 'body'}}`
in this way to ensure we support other plugins/addons

* build: Loosen up the regex for retrieving the CONSUL_VERSION (#5946)

* build: Loosen up the regex for retrieving the CONSUL_VERSION

1. Previously the `sed` replacement was searching for the CONSUL_VERSION
comment at the start of a line, it no longer does this to allow for
indentation.
2. Both `grep` and `sed` where looking for the omment at the end of the
line. We've removed this restriction here. We don't need to remove it
right now, but if we ever put the comment followed by something here the
searching would break.
3. Added `xargs` for trimming the resulting version string. We aren't
using this already in the rest of the scripts, but we are pretty sure
this is available on most systems.

* ui: Fix erroneous variable, and also force an ember cache clean on build

1. We referenced a variable incorrectly here, this fixes that.
2. We also made sure that every `make` target clears ember's `tmp` cache
to ensure that its not using any caches that have since been edited
everytime we call a `make` target.

* added docs, fixed encoding

* fixed go fmt

* Update agent/config/config.go

Co-Authored-By: R.B. Boyer <public@richardboyer.net>

* Completed Suggestions

* run gofmt on http.go

* fix testsanitize

* fix fullconfig/hcl by setting correct 'want'

* ran gofmt on agent/config/runtime_test.go

* Update website/source/docs/agent/options.html.md

Co-Authored-By: Hans Hasselberg <me@hans.io>

* Update website/source/docs/agent/options.html.md

Co-Authored-By: kaitlincarter-hc <43049322+kaitlincarter-hc@users.noreply.github.com>

* remove contentpath from redirectFS struct
2019-06-26 11:43:30 -05:00
John Cowen e4e209b748
ui: Implements a testable clipboard {{copy-button}} (#5967)
1. Remove ember-cli-clipboard dependency
2. Provide a new copy-button component implementing the same
interface as ^ but make the clipboard functionality injectable
3. Provide 2 implementations of a Clipboard. One using clipboard.js (as
previously) and an additional local storage 'clipboard'.
4. add a BDD step to assert whats in the clipboard (the fake one)

Main reason here is that `document.exec` must be called by a user
interaction
2019-06-21 11:42:40 +01:00
John Cowen 14c6152361
ui: Normal proxies link to services, sidecars to instances (#5944)
* ui: Normal proxies line to services, sidecars to instances

Following on from https://github.com/hashicorp/consul/pull/5933 we
noticed that 'normal' proxies should link to the service, rather than
the service instance. Additionally proxy 'searching' within the
repository should take into account the name of the node that the
originating service is on (sidecar proxies are generally co-located)

Added an additional test here to prove that a sidecar-proxy with the
same service id but on a different node does not show the sidecar proxy
link.
2019-06-20 09:37:17 +01:00
John Cowen 65cf56ad12
ui: Ensure Service Instance pages account for nodes (#5933)
Include node name in the URL for service instances
Integrate the node name slug into tests for service instance pages
2019-06-11 10:18:50 +01:00
John Cowen 5408d4bb53
ui: Upgrade js-yaml (#5926) 2019-06-06 22:21:25 +01:00
John Cowen 92bff1bbb3
ui: Adds ability to search by policy, role or service ident names (#5811) 2019-06-05 09:25:32 +01:00
John Cowen e48167d931
UI: Test readonly ServiceIdentity rules (#5865) 2019-06-04 17:55:10 +01:00
John Cowen 334e16a6cf
ui: Ensures nested policy forms are reset properly (#5838)
1. All {{ivy-codemirror}} components need 'refreshing' when they become
visible via our own `didAppear` method on the `{{code-editor}}`
component

(also see:)
- https://github.com/hashicorp/consul/pull/4190#discussion_r193270223
- 73db111db8 (r225264296)

2. On initial investigation, it looks like the component we are using
for the code editor doesn't distinguish between setting its `value`
programatically and a `keyup` event, i.e. an interaction from the user.
We currently pretend that whenever its `value` changes, it is a `keyup`
event. This means that when we reset the `value` to `""`
programmatically for form resetting purposes, a 'pretend keyup' event
would also be fired, which would in turn kick off the validation, which
would fail and show an error message for empty values in other fields of
the form - something that is perfectly valid if you haven't typed
anything yet. We solved this by checking for `isPristine` on fields that
are allowed to be empty before you have typed anything.
2019-06-04 15:57:35 +01:00
John Cowen 9999ccf503
ui: Replaces destroyRecord with unloadRecord for KV 404's (#5837)
Just because Consul gives us a 404 this doesn't guarantee the KV doesn't
exist, it doesn't even mean we don't have access to it. Furthermore we
should never destroyRecord's without user interaction (therefore only via the
repo.delete method).

This switches destroyRecord to unloadRecord which performs the
additional legwork to keep ember-data in sync with the actual truth.

unloadRecord unloads the record from ember-data rather than sending an API
delete request, which would have been the intent here.
2019-06-04 15:56:20 +01:00
John Cowen 52b71aaf96
ui: ACL Policies. Catch all server errors (#5836)
Always show any server errors under Rules, not just invalid HCL
2019-06-04 15:53:10 +01:00
John Cowen 5fc4053d3d
ui: Upgrade fstream (#5912)
Bumps [fstream](https://github.com/npm/fstream) from 1.0.11 to 1.0.12.
- [Release notes](https://github.com/npm/fstream/releases)
- [Commits](npm/fstream@v1.0.11...v1.0.12)
2019-06-03 11:08:40 +01:00
John Cowen e455648f96
ui: Adds tick whilst editing the link template in the Settings area (#5820)
1. Amends our `base` animation placeholder to always reset
transition-duration. This has no effect on other components that are
already using this animation.
2. Adds a confirming class whenever a key is pressed, to show the green
tick. Uses CSS via `transition-delay` for debouncing.
2019-05-17 12:33:12 +01:00
John Cowen cd382b4180
ui: Previously we were passing through 'fake' events, revert to real.. (#5810)
Previously we were creating a fake event and amending the name of the
fake event, this meant that other `event.target` properties weren't
being passed through (in this instance `checked`) this changes the
approach to not use fake events, and allows you to overwrite the name
that the form uses for `handleEvent`
2019-05-08 17:12:16 +01:00
John Cowen 4e8d4b1037
ui: Gives the minimal in-form token list use a maximum row size (#5807)
This means its more straightforwards to calculate the height of the
listing itself. This component is currently only used on the form pages for tokens and roles, should therefore be a restricted size.
2019-05-08 10:02:09 +01:00
John Cowen c50ca4f02c
ui: fix production build only empty role modal (#5806)
Adds the ability for multiple components to use the same dom buffer
2019-05-08 10:01:26 +01:00
John Cowen 211545f94e
ui: Remove old 'default' template keyword, we now use '' for default (#5805) 2019-05-08 10:00:23 +01:00
John Cowen 2507730feb
ui: Ensure room for non-hidden scrollbars (#5802) 2019-05-08 09:59:57 +01:00
John Cowen 9e9150d85a
ui: Make the proxy icon full size in service listings (#5799) 2019-05-08 09:59:26 +01:00
John Cowen 45bb711535
ui: Uses the default cursor instead of a pointer for upstream rows (#5785) 2019-05-07 14:09:57 +01:00
John Cowen 54548d5ffd
ui: Make the Rules readonly when creating ServiceIdentities (#5784)
Skipped test added for nagging for the moment
2019-05-07 14:09:23 +01:00
John Cowen 0566fa559f
ui: Upgrades the indirect dependency on jQuery to ^3.4.0 (#5783) 2019-05-03 11:51:48 +01:00
John Cowen 4ea660f2a8
ui: Don't look for isDescriptor on null (related to null proxies) (#5782) 2019-05-03 11:39:32 +01:00
John Cowen dc5d403c28 ui: Adds {{Datacenter}} keyword for URL template interpolation (#5768)
1. Includes Datacenter variable for intperolation
2. Amends text on the Settings page to reflect new keyword
3. Adds further acceptance testing around the new dashboard buttons
2019-05-02 18:29:43 +00:00
John Cowen 7a45019c29 ui: URL encodes any varaibles interpolated into the template... (#5766)
Encodes any variables passed in to be used for template interpolation, but importantly nothing else in the URL apart from the variables themselves. 'Generally' service names are reasonably URL safe, but we know of usecases using at least /s in service names.
2019-05-02 18:29:43 +00:00
John Cowen a43f523428 ui: Fix CSS related to icons and h2 changes done in different PRs
The way icons are positioned was changed to enable icons for policy
names, and in a separate PR h2's where altered to provide a nicer
looking settings page. Once these PR's where merged together they
slighly effected each other. This commit tweaks the CSS to refine, but
will be revisted at a later date
2019-05-01 19:01:32 +00:00
John Cowen ddc44a0b44 ui: Re-fix old erroneous link 2019-05-01 19:01:03 +00:00
John Cowen 7021433185 ui: dashboard links (#5704)
This PR adds a new {{template-anchor}} component. This component lets you specify a 'href template' in a handlebars like format instead of a normal string href. This template will be interpolated with the contents of a vars="" attribute.

Also contains code to add an extra UI Setting to be able to store a template to be used for this anchor in localStorage
2019-05-01 18:22:38 +00:00
John Cowen 81f209d71e UI: ACL Roles (#5635)
Adds support for ACL Roles and Service Identities CRUD, along with necessary changes to Tokens, and the CSS improvements required.

Also includes refinements/improvements for easier testing of deeply nested components.

1. ember-data adapter/serializer/model triplet for Roles
2. repository, form/validations and searching filter for Roles
3. Moves potentially, repeated, or soon to to repeated functionality
into a mixin (mainly for 'many policy' relationships)
4. A few styling tweaks for little edge cases around roles
5. Router additions, Route, Controller and templates for Roles

Also see: 

* UI: ACL Roles cont. plus Service Identities (#5661 and #5720)
2019-05-01 18:22:37 +00:00
John Cowen 08c5b376e7 ui: Search improvements (#5540)
* ui: Replaces Service listing filterbar with a phrase-editor search (#5507)

1. New phrase-editor restricting search to whole phrases (acts on
enter key). Allows removal of previously entered phrases
2. Searching now allows arrays of terms, multiple terms work via AND
2019-05-01 18:22:36 +00:00
John Cowen 839e79d16e ui: Adds easily accessible `env` for user settable 'debug' settings (#5668)
This is a synchronous only 'debug' setting accessor, uses localStorage
first and falls back to ember config.
2019-05-01 18:22:35 +00:00
John Cowen d18ef6fa02 ui: Closes the proxy blocking query for the service instance on dereg (#5667)
If a service instance show page is being viewed and the service instance
is deregistered, this closes the blocking query for the proxy as well as
the instance (the instances query will be clsed on the error)

Also adds skipped tests to nag in future
2019-05-01 18:22:34 +00:00
John Cowen 62ba4c9722 ui: Fixes RTT display, by ensuring use of ember proxies in tomography (#5666)
Previously the tomography wasn't using ember `get` so proxy updates
(specifically here whilst receiving a blocking update) wasn't working.

This adds `get` here until we update to newer `get`less ember and also
refactors slightly removing `n` and using `distance.length` instead

Skipped tests are adding here to nag us to come back here at some point.
2019-05-01 18:22:33 +00:00
John Cowen 27a3fc3276 ui: Alter resizing for tabular-collection for sizing based on rows (#5586) 2019-05-01 18:22:31 +00:00
John Cowen d2b1698c0d ui: Improvements to modal-dialog (#5585)
1. If the modal gets bigger than 80% of the viewport height a scrollbar
will be shown. Currently there isn't anywhere it can get this big, but
future work involves possible larger modals
2. Usually its difficult to figure out which was the 'unchecked' radio
button using an onchange event. Luckily ember/handlebars changes its
properties after the onchange event, so knowing that and using an extra
data-checked attribute set via ember, we can figure out which radio
button has been 'unchecked'. This means the logic for opening an
closing modals becomes slightly easier
2019-05-01 18:22:30 +00:00
John Cowen efb4341087 ui: Adds uid to tabular-details for/id's used in toggling for uniqueness (#5584) 2019-05-01 18:22:29 +00:00
John Cowen 1c0cc9353a ui: Adds _super in places where it had been missed (mainly dom-buffer) (#5583) 2019-05-01 18:22:27 +00:00
John Cowen 58b73d9966 ui: Increases the pause between blocking queries to 2000ms (#5582)
...also:

Temporarily overwrites native setTimeout and setInterval for e2e/acceptance
testing similar to how XHR is overwritten for e2e/acceptance testing.

This makes the blocking query acceptance tests run faster until we add a
better burstable rate limiter for blocking queries.
2019-05-01 18:22:26 +00:00
John Cowen acfe17e552 ui: Remove index.html from the docs URL so we just point to `/docs` (#5547) 2019-05-01 18:22:25 +00:00
John Cowen 006b6000a8 UI: Add support for blocking queries on the service instance detail page (#5487)
This commit includes several pieces of functionality to enable services
to be removed and the page to present information that this has happened
but also keep the deleted information on the page. Along with the more
usual blocking query based listing.

To enable this:

1. Implements `meta` on the model (only available on collections in
ember)
2. Adds new `catchable` ComputedProperty alongside a `listen` helper for
working with specific errors that can be thrown from EventSources in an
ember-like way. Briefly, normal computed properties update when a
property changes, EventSources can additionally throw errors so we can
catch them and show different visuals based on that.

Also:

Add support for blocking queries on the service instance detail page

1. Previous we could return  undefined when a service instance has no
proxy, but this means we have nothing to attach `meta` to. We've changed
this to return an almost empty object, so with only a meta property.
At first glance there doesn't seem to be any way to provide a proxy
object to templates and be able to detect whether it is actually null
or not so we instead change some conditional logic in the templates to
detect the property we are using to generate the anchor.
2. Made a `pauseUntil` test helper function for steps where we wait for
things. This helps for DRYness but also means if we can move away from
setInterval to something else later, we can do it in one place
3. Whilst running into point 1 here, we managed to make the blocking
queries eternally loop. Whilst this is due to an error in the code and
shouldn't ever happen whilst in actual use, we've added an extra check
so that we only recur/loop the blocking query if the previous response has a
`meta.cursor`

Adds support for blocking queries on the node detail page (#5489)

1. Moves data re-shaping for the templates variables into a repository
so they are easily covered by blocking queries (into coordinatesRepo)
2. The node API returns a 404 as signal for deregistration, we also
close the sessions and coordinates blocking queries when this happens
2019-05-01 18:22:23 +00:00
John Cowen 1625a09372 ui: Adds blocking query support to the service detail page (#5479)
This commit includes several pieces of functionality to enable services
to be removed and the page to present information that this has happened
but also keep the deleted information on the page. Along with the more
usual blocking query based listing.

To enable this:

1. Implements `meta` on the model (only available on collections in
ember)
2. Adds new `catchable` ComputedProperty alongside a `listen` helper for
working with specific errors that can be thrown from EventSources in an
ember-like way. Briefly, normal computed properties update when a
property changes, EventSources can additionally throw errors so we can
catch them and show different visuals based on that.
2019-05-01 18:22:22 +00:00
John Cowen 45a2fa5a01 UI: Add blocking cursor validation and more straightforward throttle (#5470)
More recommendations for blocking queries clients was added here:

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

This commit mainly adds cursor/index validation/correction based on
these recommendations (plus tests)

The recommendations also suggest that clients should include rate
limiting. Because of this, we've moved the throttling out of Consul UI
specific code and into Blocking Query specific code. Currently the 'rate
limiting' in this commit only adds a sleep to every iteration of the
loop, which is not the recommended approach, but the code here organizes
the throttling functionality into something we can work with later to
provide something more apt.
2019-05-01 18:22:21 +00:00
John Cowen f1c8db1447 UI: Amends blocking queries text and toggle component in settings (#5467) 2019-05-01 18:22:20 +00:00
John Cowen e615d9f7eb ui: Add proxy icons to proxy services and instances where appropriate (#5463) 2019-05-01 18:22:19 +00:00
John Cowen b5b32c10c4 ui: Fix erroneous HTML that was being fixed by either browser/ember (#5530)
The resulting DOM from this template was actually correct, we'd assume
it was being fixed by the browser
2019-05-01 18:22:17 +00:00
John Cowen 75d8abd562 UI: Add forking based on service instance id existence (#5392)
* ui: Add forking based on service instance id existence

Proxies come in 2 flavours, 'normal' and sidecar. We know when a proxy
is a sidecar proxy based on whether a DestinationServiceID is set.

LocalServiceAddress and LocalServicePort are only relevant for sidecar
proxies.

This adds template logic to show different text depending on this
information.

Additionally adds test around connect proxies (#5418)

1. Adds page object for the instance detail page
2. Adds further scenario steps used in the tests
3. Adds acceptance testing around the instance detail page. Services
with proxies and the sidecar proxies and proxies themselves
4. Adds datacenter column for upstreams
5. Fixes bug routing bug for decision as to whether to request proxy
information or not
2019-05-01 18:22:15 +00:00
John Cowen 6186e0c8d4 ui: remove call to super in setupController (#5383) 2019-05-01 18:22:14 +00:00
John Cowen d2de256fa4 ui: Amend breakpoints for new numberless filter buttons (#5381) 2019-05-01 18:22:13 +00:00
John Cowen bd1fc38371 UI: Use custom block-slots for changeableset 2019-05-01 18:22:12 +00:00
John Cowen b1d5409d1c UI: Service Numbers (#5348)
Add totals to some listing views, remove healthcheck totals

1. Adds markup to render totals for Services, Nodes, Intentions and v1
ACLs
2. Removes counts from healthcheck filters, and therefore simplify text,
moving the copy to the templates
3. Alter test to reflect the fact that the text of the buttons are no
static in the component template rather than a dynamic attribute
2019-05-01 18:22:11 +00:00
John Cowen e0326c3b0a UI: Service Instances (#5326)
This gives more prominence to 'Service Instances' as opposed to 'Services'. It also begins to surface Connect related 'nouns' such as 'Proxies' and 'Upstreams' and begins to interconnect them giving more visibility to operators.

Various smaller changes:

1. Move healthcheck-status component to healthcheck-output
2. Create a new healthcheck-status component for showing the number of
checks plus its icon
3. Create a new healthcheck-info component to group multiple statuses
plus a different view if there are no checks
4. Componentize tag-list
2019-05-01 18:22:10 +00:00
John Cowen eabb308ac2 UI: Add ember steps:list command for listing available steps (#5255)
* ui: Add ember steps:list command for listing available steps

1. Adds `command` addon to house the new command
2. Start to organize out the steps themselves, bring a bit more order to
things ready to dedupe and cleanup
2019-05-01 18:22:08 +00:00
John Cowen da36c2a0f9 UI: Add EventSource ready for implementing blocking queries (#5070)
- Maintain http headers as JSON-API meta for all API requests (#4946)
- Add EventSource ready for implementing blocking queries
- EventSource project implementation to enable blocking queries for service and node listings (#5267)
- Add setting to enable/disable blocking queries (#5352)
2019-05-01 18:22:06 +00:00
John Cowen 3d5072cd2d ui: Correctly rebase own token/no delete change 2019-05-01 18:22:03 +00:00
John Cowen 746201ed49 ui: Adds XHR connection management to HTTP/1.1 installs (#5083)
Adds xhr connection managment to http/1.1 installs

This includes various things:

1. An object pool to 'acquire', 'release' and 'dispose' of objects, also
a 'purge' to completely empty it
2. A `Request` data object, mainly for reasoning about the object better
3. A pseudo http 'client' which doens't actually control the request
itself but does help to manage the connections

An initializer is used to detect the script element of the consul-ui sourcecode
which we use later to sniff the protocol that we are most likely using for API access
2019-05-01 18:22:02 +00:00
John Cowen 4761277fd0 ui: Adds 2 computed utilities, a factory and a purify (#5079)
1. The factory is taken from the ember source, but makes it more
reusable
2. Purify converts conventional ember `computed` into a pure version

This commit only adds new files that could be used further down the line
2019-05-01 18:22:00 +00:00
John Cowen 232c1c0206 ui: Adds controller lifecycle `reset` hook (#5056) 2019-05-01 18:21:59 +00:00
John Cowen c4effc9734 ui: Adds `document` and `viewport` methods to the dom service (#5052)
`window` and `document` are easily injected anyhow, but this
primarily this keeps everything dom related in the same place.

Included here are changes to make all ember related objects use the dom
service `document` and `viewport` instead of just `document` and
`window`.

Quote from a previous PR (#4924) which explains the thinking around this:

> Now I have all these things in the dom service, it would make sense
to get window from there also. I was thinking of making a viewport
method, which would be a nice word whether window was a browser window,
an iframe (not really a window) like when ember testing, or anything
else. To me the viewport is what we are actually talking about here.
2019-05-01 18:21:57 +00:00
John Cowen 9a27b2c74d ui: ember-data AbortError should have a `0` status (#5048) 2019-05-01 18:21:55 +00:00
John Cowen 6311859877 ui: Prefer `cursor` over `index`, add `configuration` option to repos (#5042) 2019-05-01 18:21:54 +00:00
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