Commit Graph

10561 Commits

Author SHA1 Message Date
R.B. Boyer c17e417cc8 cache: remove data race in agent cache
In normal operations there is a read/write race related to request
QueryOptions fields. An example race:

    WARNING: DATA RACE
    Read at 0x00c000836950 by goroutine 30:
      github.com/hashicorp/consul/agent/structs.(*ServiceConfigRequest).CacheInfo()
          /go/src/github.com/hashicorp/consul/agent/structs/config_entry.go:506 +0x109
      github.com/hashicorp/consul/agent/cache.(*Cache).getWithIndex()
          /go/src/github.com/hashicorp/consul/agent/cache/cache.go:262 +0x5c
      github.com/hashicorp/consul/agent/cache.(*Cache).notifyBlockingQuery()
          /go/src/github.com/hashicorp/consul/agent/cache/watch.go:89 +0xd7

    Previous write at 0x00c000836950 by goroutine 147:
      github.com/hashicorp/consul/agent/cache-types.(*ResolvedServiceConfig).Fetch()
          /go/src/github.com/hashicorp/consul/agent/cache-types/resolved_service_config.go:31 +0x219
      github.com/hashicorp/consul/agent/cache.(*Cache).fetch.func1()
          /go/src/github.com/hashicorp/consul/agent/cache/cache.go:495 +0x112

This patch does a lightweight copy of the request struct so that the
embedded QueryOptions fields that are mutated during Fetch() are scoped
to just that one RPC.
2019-09-12 16:18:01 -05:00
Matt Keeler ccd5b241ba
Also install tar for the website deploy job (#6482) 2019-09-12 17:05:02 -04:00
hashicorp-ci a42944542b
Release v1.6.1 2019-09-12 19:39:59 +00:00
hashicorp-ci 52bd29b337
update bindata_assetfs.go 2019-09-12 19:39:58 +00:00
Matt Keeler a179a4eb2c
Update CHANGELOG.md 2019-09-12 10:30:52 -04:00
Matt Keeler 01c3445a53
Update memberlist to v0.1.5 (#6479) 2019-09-12 10:28:57 -04:00
Hans Hasselberg dbc4f0f27f
Update CHANGELOG.md 2019-09-12 15:09:16 +02:00
R.B. Boyer ad067ae4a5
ci: inject missing tar binary (#6477) 2019-09-11 10:41:02 -05:00
Hans Hasselberg 8bab4b37e5
Update CHANGELOG.md 2019-09-11 15:08:10 +02:00
Hans Hasselberg f025a7440d
agent: handleEnterpriseLeave (#6453) 2019-09-11 11:01:37 +02:00
Jud White 25aab18339 docs: fix typo in install/performance (#6428) 2019-09-09 21:23:25 +01:00
dcallao 876a7cbef9 fixed broken links on consul program page (#6463) 2019-09-06 17:18:59 -04:00
dcallao 58f19c5918 docs: added Consul Integration Program Docs Page (#6459)
* adding the Consul Integration Program page in docs section
2019-09-06 14:52:18 -04:00
R.B. Boyer 4aaaad089f
test: actually wait for the TestAgent to be fully shutdown (#6441) 2019-09-05 13:36:26 -05:00
Alvin Huang 09692daf89
change DOCKER_LOGIN env name to DOCKER_USER (#6451) 2019-09-05 14:29:39 -04:00
Sarah Adams 8e673371df
test: ensure all TestAgent constructions use a constructor (#6443)
ensure all TestAgent constructions use a constructor to get start retries + test logs going to the right place

Fixes #6435
2019-09-05 10:24:36 -07:00
John Cowen 5134140b5b
docs: Fix discovery chain internals link (#6449) 2019-09-05 13:56:50 +01:00
Sarah Adams c6c5f9c494
remove funky panic/recover in agent tests (#6442) 2019-09-04 13:59:11 -07:00
John Cowen 2bc3e24f10
Update CHANGELOG.md 2019-09-04 13:36:55 +01:00
John Cowen b6d65ed36c
Merge pull request #6437 from hashicorp/ui-staging
ui: UI Release Merge (ui-staging merge)
2019-09-04 13:16:34 +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