mirror of
https://github.com/status-im/consul.git
synced 2025-02-16 23:57:07 +00:00
ui: remove with-peers query param (#13756)
* Don't request nodes/services `with-peers` anymore This will be automatic - no need for the query-param anymore. * Return peering data based on feature flag mock-api services/nodes * Update tests to reflect removed with-peers query-param * setup cookie for turning peer feature flag on in mock-api in testing * Add missing `S` for renamed PEERING feature-flag cookie
This commit is contained in:
parent
363d855e87
commit
74ccbc5706
@ -1,5 +1,4 @@
|
|||||||
import Adapter from './application';
|
import Adapter from './application';
|
||||||
import { inject as service } from '@ember/service';
|
|
||||||
|
|
||||||
// TODO: Update to use this.formatDatacenter()
|
// TODO: Update to use this.formatDatacenter()
|
||||||
|
|
||||||
@ -11,25 +10,12 @@ import { inject as service } from '@ember/service';
|
|||||||
// to the node.
|
// to the node.
|
||||||
|
|
||||||
export default class NodeAdapter extends Adapter {
|
export default class NodeAdapter extends Adapter {
|
||||||
@service abilities;
|
|
||||||
|
|
||||||
get peeringQuery() {
|
|
||||||
const query = {};
|
|
||||||
|
|
||||||
if (this.abilities.can('use peers')) {
|
|
||||||
query['with-peers'] = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return query;
|
|
||||||
}
|
|
||||||
|
|
||||||
requestForQuery(request, { dc, ns, partition, index, id, uri }) {
|
requestForQuery(request, { dc, ns, partition, index, id, uri }) {
|
||||||
return request`
|
return request`
|
||||||
GET /v1/internal/ui/nodes?${{ dc }}
|
GET /v1/internal/ui/nodes?${{ dc }}
|
||||||
X-Request-ID: ${uri}
|
X-Request-ID: ${uri}
|
||||||
|
|
||||||
${{
|
${{
|
||||||
...this.peeringQuery,
|
|
||||||
ns,
|
ns,
|
||||||
partition,
|
partition,
|
||||||
index,
|
index,
|
||||||
|
@ -1,19 +1,6 @@
|
|||||||
import Adapter from './application';
|
import Adapter from './application';
|
||||||
import { inject as service } from '@ember/service';
|
|
||||||
|
|
||||||
export default class ServiceAdapter extends Adapter {
|
export default class ServiceAdapter extends Adapter {
|
||||||
@service abilities;
|
|
||||||
|
|
||||||
get peeringQuery() {
|
|
||||||
const query = {};
|
|
||||||
|
|
||||||
if (this.abilities.can('use peers')) {
|
|
||||||
query['with-peers'] = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return query;
|
|
||||||
}
|
|
||||||
|
|
||||||
requestForQuery(request, { dc, ns, partition, index, gateway, uri }) {
|
requestForQuery(request, { dc, ns, partition, index, gateway, uri }) {
|
||||||
if (typeof gateway !== 'undefined') {
|
if (typeof gateway !== 'undefined') {
|
||||||
return request`
|
return request`
|
||||||
@ -33,7 +20,6 @@ export default class ServiceAdapter extends Adapter {
|
|||||||
X-Request-ID: ${uri}
|
X-Request-ID: ${uri}
|
||||||
|
|
||||||
${{
|
${{
|
||||||
...this.peeringQuery,
|
|
||||||
ns,
|
ns,
|
||||||
partition,
|
partition,
|
||||||
index,
|
index,
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
{
|
{
|
||||||
"ID":"${fake.random.uuid()}",
|
"ID":"${fake.random.uuid()}",
|
||||||
"Node":"node-${i}",
|
"Node":"node-${i}",
|
||||||
${location.search["with-peers"] ? peerNameString : ''}
|
${env('CONSUL_PEERINGS_ENABLE') ? peerNameString : ''}
|
||||||
"Address":"${fake.internet.ip()}",
|
"Address":"${fake.internet.ip()}",
|
||||||
"TaggedAddresses":{
|
"TaggedAddresses":{
|
||||||
"lan":"${fake.internet.ip()}",
|
"lan":"${fake.internet.ip()}",
|
||||||
|
@ -53,7 +53,7 @@ ${typeof location.search.ns !== 'undefined' ? `
|
|||||||
${typeof location.search.partition !== 'undefined' ? `
|
${typeof location.search.partition !== 'undefined' ? `
|
||||||
"Partition": "${fake.helpers.randomize([env('CONSUL_PARTITION_EXPORTER', location.search.partition), location.search.partition])}",
|
"Partition": "${fake.helpers.randomize([env('CONSUL_PARTITION_EXPORTER', location.search.partition), location.search.partition])}",
|
||||||
` : ``}
|
` : ``}
|
||||||
${location.search['with-peers'] ? peerNameString : ''}
|
${env('CONSUL_PEERINGS_ENABLE') ? peerNameString : ''}
|
||||||
"Tags": [
|
"Tags": [
|
||||||
${
|
${
|
||||||
range(
|
range(
|
||||||
|
@ -27,7 +27,7 @@ Feature: dc / intentions / navigation
|
|||||||
ID: 755b72bd-f5ab-4c92-90cc-bed0e7d8e9f0
|
ID: 755b72bd-f5ab-4c92-90cc-bed0e7d8e9f0
|
||||||
---
|
---
|
||||||
When I click intention on the intentionList.intentions component
|
When I click intention on the intentionList.intentions component
|
||||||
Then a GET request was made to "/v1/internal/ui/services?dc=dc-1&with-peers=true&ns=*"
|
Then a GET request was made to "/v1/internal/ui/services?dc=dc-1&ns=*"
|
||||||
And I click "[data-test-back]"
|
And I click "[data-test-back]"
|
||||||
Then the url should be /dc-1/intentions
|
Then the url should be /dc-1/intentions
|
||||||
Scenario: Clicking the create button and back again
|
Scenario: Clicking the create button and back again
|
||||||
|
@ -45,7 +45,7 @@ Feature: dc / nodes / index
|
|||||||
---
|
---
|
||||||
Then the url should be /dc-1/nodes
|
Then the url should be /dc-1/nodes
|
||||||
And the title should be "Nodes - Consul"
|
And the title should be "Nodes - Consul"
|
||||||
And a GET request was made to "/v1/internal/ui/nodes?dc=dc-1&with-peers=true&ns=@namespace"
|
And a GET request was made to "/v1/internal/ui/nodes?dc=dc-1&ns=@namespace"
|
||||||
Then I see 3 node models
|
Then I see 3 node models
|
||||||
Scenario: Seeing the leader in node listing
|
Scenario: Seeing the leader in node listing
|
||||||
Given 3 node models from yaml
|
Given 3 node models from yaml
|
||||||
|
@ -16,7 +16,7 @@ Feature: dc / services / list
|
|||||||
dc: dc-1
|
dc: dc-1
|
||||||
---
|
---
|
||||||
Then the url should be /dc-1/services
|
Then the url should be /dc-1/services
|
||||||
And a GET request was made to "/v1/internal/ui/services?dc=dc-1&with-peers=true&ns=@namespace"
|
And a GET request was made to "/v1/internal/ui/services?dc=dc-1&ns=@namespace"
|
||||||
|
|
||||||
Then I see 3 service models
|
Then I see 3 service models
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ Feature: page-navigation
|
|||||||
Where:
|
Where:
|
||||||
---------------------------------------------------------------------------------------------------
|
---------------------------------------------------------------------------------------------------
|
||||||
| Link | URL | Endpoint |
|
| Link | URL | Endpoint |
|
||||||
| nodes | /dc1/nodes | /v1/internal/ui/nodes?dc=dc1&with-peers=true&ns=@namespace |
|
| nodes | /dc1/nodes | /v1/internal/ui/nodes?dc=dc1&ns=@namespace |
|
||||||
# FIXME
|
# FIXME
|
||||||
# | kvs | /dc1/kv | /v1/kv/?keys&dc=dc1&separator=%2F&ns=@namespace |
|
# | kvs | /dc1/kv | /v1/kv/?keys&dc=dc1&separator=%2F&ns=@namespace |
|
||||||
| tokens | /dc1/acls/tokens | /v1/acl/tokens?dc=dc1&ns=@namespace |
|
| tokens | /dc1/acls/tokens | /v1/acl/tokens?dc=dc1&ns=@namespace |
|
||||||
|
@ -11,7 +11,7 @@ Feature: token-header
|
|||||||
dc: dc1
|
dc: dc1
|
||||||
---
|
---
|
||||||
Then the url should be /dc1/services
|
Then the url should be /dc1/services
|
||||||
And a GET request was made to "/v1/internal/ui/services?dc=dc1&with-peers=true&ns=@namespace" from yaml
|
And a GET request was made to "/v1/internal/ui/services?dc=dc1&ns=@namespace" from yaml
|
||||||
---
|
---
|
||||||
headers:
|
headers:
|
||||||
X-Consul-Token: ''
|
X-Consul-Token: ''
|
||||||
@ -35,7 +35,7 @@ Feature: token-header
|
|||||||
dc: dc1
|
dc: dc1
|
||||||
---
|
---
|
||||||
Then the url should be /dc1/services
|
Then the url should be /dc1/services
|
||||||
And a GET request was made to "/v1/internal/ui/services?dc=dc1&with-peers=true&ns=@namespace" from yaml
|
And a GET request was made to "/v1/internal/ui/services?dc=dc1&ns=@namespace" from yaml
|
||||||
---
|
---
|
||||||
headers:
|
headers:
|
||||||
X-Consul-Token: [Token]
|
X-Consul-Token: [Token]
|
||||||
|
@ -5,6 +5,9 @@ export default function(type, value, doc = document) {
|
|||||||
if (!doc.cookie.includes('CONSUL_ACLS_ENABLE=0')) {
|
if (!doc.cookie.includes('CONSUL_ACLS_ENABLE=0')) {
|
||||||
obj['CONSUL_ACLS_ENABLE'] = 1;
|
obj['CONSUL_ACLS_ENABLE'] = 1;
|
||||||
}
|
}
|
||||||
|
if (!doc.cookie.includes('CONSUL_PEERINGS_ENABLE=0')) {
|
||||||
|
obj['CONSUL_PEERINGS_ENABLE'] = 1;
|
||||||
|
}
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case 'dc':
|
case 'dc':
|
||||||
key = 'CONSUL_DATACENTER_COUNT';
|
key = 'CONSUL_DATACENTER_COUNT';
|
||||||
|
@ -14,7 +14,7 @@ module('Integration | Adapter | node', function(hooks) {
|
|||||||
const adapter = this.owner.lookup('adapter:node');
|
const adapter = this.owner.lookup('adapter:node');
|
||||||
const client = this.owner.lookup('service:client/http');
|
const client = this.owner.lookup('service:client/http');
|
||||||
const request = client.requestParams.bind(client);
|
const request = client.requestParams.bind(client);
|
||||||
const expected = `GET /v1/internal/ui/nodes?dc=${dc}&with-peers=true${
|
const expected = `GET /v1/internal/ui/nodes?dc=${dc}${
|
||||||
shouldHaveNspace(nspace) ? `&ns=${nspace}` : ``
|
shouldHaveNspace(nspace) ? `&ns=${nspace}` : ``
|
||||||
}`;
|
}`;
|
||||||
const actual = adapter.requestForQuery(request, {
|
const actual = adapter.requestForQuery(request, {
|
||||||
|
@ -14,7 +14,7 @@ module('Integration | Adapter | service', function(hooks) {
|
|||||||
const adapter = this.owner.lookup('adapter:service');
|
const adapter = this.owner.lookup('adapter:service');
|
||||||
const client = this.owner.lookup('service:client/http');
|
const client = this.owner.lookup('service:client/http');
|
||||||
const request = client.requestParams.bind(client);
|
const request = client.requestParams.bind(client);
|
||||||
const expected = `GET /v1/internal/ui/services?dc=${dc}&with-peers=true${
|
const expected = `GET /v1/internal/ui/services?dc=${dc}${
|
||||||
shouldHaveNspace(nspace) ? `&ns=${nspace}` : ``
|
shouldHaveNspace(nspace) ? `&ns=${nspace}` : ``
|
||||||
}`;
|
}`;
|
||||||
let actual = adapter.requestForQuery(request, {
|
let actual = adapter.requestForQuery(request, {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user