mirror of https://github.com/status-im/consul.git
ui: Move peers to a subapplication (#13725)
This commit is contained in:
parent
610038ce67
commit
f6edc37d0c
|
@ -34,7 +34,7 @@ references:
|
|||
ember: &EMBER_IMAGE docker.mirror.hashicorp.services/circleci/node:14-browsers
|
||||
ubuntu: &UBUNTU_CI_IMAGE ubuntu-2004:202201-02
|
||||
cache:
|
||||
yarn: &YARN_CACHE_KEY consul-ui-v8-{{ checksum "ui/yarn.lock" }}
|
||||
yarn: &YARN_CACHE_KEY consul-ui-v9-{{ checksum "ui/yarn.lock" }}
|
||||
|
||||
steps:
|
||||
install-gotestsum: &install-gotestsum
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
"scripts": {
|
||||
"doc:toc": "doctoc README.md",
|
||||
"compliance": "npm-run-all compliance:*",
|
||||
"compliance:licenses": "license-checker --summary --onlyAllow 'Python-2.0;Apache*;Apache License, Version 2.0;Apache-2.0;Apache 2.0;Artistic-2.0;BSD;BSD-3-Clause;CC-BY-3.0;CC-BY-4.0;CC0-1.0;ISC;MIT;MPL-2.0;Public Domain;Unicode-TOU;Unlicense;WTFPL' --excludePackages 'consul-ui@2.2.0;consul-acls@0.1.0;consul-lock-sessions@0.1.0;consul-partitions@0.1.0;consul-nspaces@0.1.0;consul-hcp@0.1.0'"
|
||||
"compliance:licenses": "license-checker --summary --onlyAllow 'Python-2.0;Apache*;Apache License, Version 2.0;Apache-2.0;Apache 2.0;Artistic-2.0;BSD;BSD-3-Clause;CC-BY-3.0;CC-BY-4.0;CC0-1.0;ISC;MIT;MPL-2.0;Public Domain;Unicode-TOU;Unlicense;WTFPL' --excludePackages 'consul-ui@2.2.0;consul-acls@0.1.0;consul-lock-sessions@0.1.0;consul-partitions@0.1.0;consul-nspaces@0.1.0;consul-hcp@0.1.0;consul-peerings@0.1.0'"
|
||||
|
||||
},
|
||||
"devDependencies": {
|
||||
|
|
|
@ -8,12 +8,16 @@ Searchbar tailored for searching Peers. Follows our more generic
|
|||
@search={{this.search}}
|
||||
@onsearch={{fn (mut this.search) value="target.value"}}
|
||||
|
||||
@sort={{hash
|
||||
value='Name:asc'
|
||||
@sort={{hash
|
||||
value='State:asc'
|
||||
change=(noop)
|
||||
}}
|
||||
|
||||
@filter={{hash
|
||||
state=(hash
|
||||
value=(array "PENDING")
|
||||
change=(noop)
|
||||
)
|
||||
searchproperty=(hash
|
||||
value=(array)
|
||||
change=(noop)
|
|
@ -81,7 +81,7 @@ as |key value|}}
|
|||
{{#each
|
||||
(get
|
||||
(require '/models/peer'
|
||||
path='schema'
|
||||
export='schema'
|
||||
from='/components/consul/peer/search-bar'
|
||||
)
|
||||
'State.allowedValues'
|
|
@ -0,0 +1,36 @@
|
|||
# Consul::Peer::Selector
|
||||
|
||||
A conditional, autoloading, menu component specifically for navigating to peers.
|
||||
|
||||
Please note:
|
||||
|
||||
- Currently at least, you must add this inside of a `<ul>` element.
|
||||
- For the moment, make sure you have enabled peers using developer debug
|
||||
cookies.
|
||||
|
||||
```hbs preview-template
|
||||
<ul>
|
||||
<Consul::Peer::Selector
|
||||
@dc={{hash
|
||||
Name='dc-1'
|
||||
}}
|
||||
@nspace='default'
|
||||
@partition='default'
|
||||
/>
|
||||
</ul>
|
||||
```
|
||||
|
||||
|
||||
## Arguments
|
||||
|
||||
| Argument/Attribute | Type | Default | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| `dc` | `object` | | The current datacenter |
|
||||
| `nspace` | `string` | | The name of the current namespace |
|
||||
| `partition` | `string` | | The name of the current partition |
|
||||
|
||||
## See
|
||||
|
||||
- [Template Source Code](./index.hbs)
|
||||
|
||||
---
|
|
@ -0,0 +1,20 @@
|
|||
<li
|
||||
class="peers-separator"
|
||||
role="separator"
|
||||
...attributes
|
||||
>
|
||||
Organization
|
||||
</li>
|
||||
<li
|
||||
data-test-main-nav-peers
|
||||
class={{if (is-href 'dc.peers' @dc.Name) 'is-active'}}
|
||||
>
|
||||
<a
|
||||
href={{href-to 'dc.peers' @dc.Name
|
||||
params=(hash peer=undefined)
|
||||
}}
|
||||
>
|
||||
Peers
|
||||
</a>
|
||||
</li>
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"name": "consul-peerings",
|
||||
"version": "0.1.0",
|
||||
"private": true
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
(routes => routes({
|
||||
dc: {
|
||||
peers: {
|
||||
_options: {
|
||||
path: '/peers'
|
||||
},
|
||||
index: {
|
||||
_options: {
|
||||
path: '/',
|
||||
queryParams: {
|
||||
sortBy: 'sort',
|
||||
state: 'state',
|
||||
searchproperty: {
|
||||
as: 'searchproperty',
|
||||
empty: [['Name']],
|
||||
},
|
||||
search: {
|
||||
as: 'filter',
|
||||
replace: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
edit: {
|
||||
_options: {
|
||||
path: '/:name'
|
||||
},
|
||||
addresses: {
|
||||
_options: {
|
||||
path: '/addresses',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}))(
|
||||
(json, data = (typeof document !== 'undefined' ? document.currentScript.dataset : module.exports)) => {
|
||||
data[`routes`] = JSON.stringify(json);
|
||||
}
|
||||
);
|
|
@ -0,0 +1,9 @@
|
|||
(services => services({
|
||||
"component:consul/peer/selector": {
|
||||
"class": "consul-ui/components/consul/peer/selector"
|
||||
}
|
||||
}))(
|
||||
(json, data = (typeof document !== 'undefined' ? document.currentScript.dataset : module.exports)) => {
|
||||
data[`services`] = JSON.stringify(json);
|
||||
}
|
||||
);
|
|
@ -112,6 +112,12 @@ module.exports = {
|
|||
urlSchema: 'auto',
|
||||
urlPrefix: 'docs/consul-lock-sessions',
|
||||
},
|
||||
{
|
||||
root: `${path.dirname(require.resolve('consul-peerings/package.json'))}/app/components`,
|
||||
pattern: '**/README.mdx',
|
||||
urlSchema: 'auto',
|
||||
urlPrefix: 'docs/consul-peerings',
|
||||
},
|
||||
{
|
||||
root: `${path.dirname(require.resolve('consul-partitions/package.json'))}/app/components`,
|
||||
pattern: '**/README.mdx',
|
||||
|
|
|
@ -18,6 +18,6 @@ export default class PeerAbility extends BaseAbility {
|
|||
}
|
||||
|
||||
get canUse() {
|
||||
return this.env.var('CONSUL_PEERING_ENABLED');
|
||||
return this.env.var('CONSUL_PEERINGS_ENABLED');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -146,14 +146,11 @@
|
|||
@partition={{@partition}}
|
||||
@nspace={{@nspace}}
|
||||
/>
|
||||
{{#if (can "use peers")}}
|
||||
<li role="separator">
|
||||
Organization
|
||||
</li>
|
||||
<li data-test-main-nav-peers class={{if (is-href 'dc.peers' @dc.Name) 'is-active' }}>
|
||||
<a href={{href-to 'dc.peers' @dc.Name params=(hash peer=undefined)}}>Peers</a>
|
||||
</li>
|
||||
{{/if}}
|
||||
<Consul::Peer::Selector
|
||||
@dc={{@dc}}
|
||||
@partition={{@partition}}
|
||||
@nspace={{@nspace}}
|
||||
/>
|
||||
</ul>
|
||||
</:main-nav>
|
||||
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
import { inject as service } from '@ember/service';
|
||||
import Route from '@ember/routing/route';
|
||||
|
||||
export default class PeersRoute extends Route {
|
||||
@service abilities;
|
||||
|
||||
beforeModel() {
|
||||
if (!this.abilities.can('use peers')) {
|
||||
this.transitionTo('dc.services.index');
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
import Route from 'consul-ui/routing/route';
|
||||
|
||||
export default class PeersRoute extends Route {
|
||||
queryParams = {
|
||||
sortBy: 'sort',
|
||||
state: 'state',
|
||||
searchproperty: {
|
||||
as: 'searchproperty',
|
||||
empty: [['Name']],
|
||||
},
|
||||
search: {
|
||||
as: 'filter',
|
||||
replace: true,
|
||||
},
|
||||
};
|
||||
}
|
|
@ -124,7 +124,7 @@ export default function(config = {}, win = window, doc = document) {
|
|||
return typeof operatorConfig.PartitionsEnabled === 'undefined'
|
||||
? false
|
||||
: operatorConfig.PartitionsEnabled;
|
||||
case 'CONSUL_PEERING_ENABLED':
|
||||
case 'CONSUL_PEERINGS_ENABLED':
|
||||
return typeof operatorConfig.PeeringEnabled === 'undefined'
|
||||
? false
|
||||
: operatorConfig.PeeringEnabled;
|
||||
|
@ -213,8 +213,8 @@ export default function(config = {}, win = window, doc = document) {
|
|||
case 'CONSUL_METRICS_PROXY_ENABLE':
|
||||
prev['CONSUL_METRICS_PROXY_ENABLED'] = !!JSON.parse(String(value).toLowerCase());
|
||||
break;
|
||||
case 'CONSUL_PEERING_ENABLE':
|
||||
prev['CONSUL_PEERING_ENABLED'] = !!JSON.parse(String(value).toLowerCase());
|
||||
case 'CONSUL_PEERINGS_ENABLE':
|
||||
prev['CONSUL_PEERINGS_ENABLED'] = !!JSON.parse(String(value).toLowerCase());
|
||||
break;
|
||||
case 'CONSUL_UI_CONFIG':
|
||||
prev['CONSUL_UI_CONFIG'] = JSON.parse(value);
|
||||
|
@ -248,7 +248,7 @@ export default function(config = {}, win = window, doc = document) {
|
|||
case 'CONSUL_DATACENTER_PRIMARY':
|
||||
case 'CONSUL_ACLS_ENABLED':
|
||||
case 'CONSUL_NSPACES_ENABLED':
|
||||
case 'CONSUL_PEERING_ENABLED':
|
||||
case 'CONSUL_PEERINGS_ENABLED':
|
||||
case 'CONSUL_SSO_ENABLED':
|
||||
case 'CONSUL_PARTITIONS_ENABLED':
|
||||
case 'CONSUL_METRICS_PROVIDER':
|
||||
|
|
|
@ -82,7 +82,7 @@ module.exports = function(environment, $ = process.env) {
|
|||
ACLsEnabled: false,
|
||||
NamespacesEnabled: false,
|
||||
SSOEnabled: false,
|
||||
PeeringEnabled: env('CONSUL_PEERING_ENABLED', false),
|
||||
PeeringEnabled: false,
|
||||
PartitionsEnabled: false,
|
||||
LocalDatacenter: env('CONSUL_DATACENTER_LOCAL', 'dc1'),
|
||||
PrimaryDatacenter: env('CONSUL_DATACENTER_PRIMARY', 'dc1'),
|
||||
|
@ -107,7 +107,7 @@ module.exports = function(environment, $ = process.env) {
|
|||
NamespacesEnabled: env('CONSUL_NSPACES_ENABLED', false),
|
||||
SSOEnabled: env('CONSUL_SSO_ENABLED', false),
|
||||
// in testing peering feature is on by default
|
||||
PeeringEnabled: env('CONSUL_PEERING_ENABLED', true),
|
||||
PeeringEnabled: env('CONSUL_PEERINGS_ENABLED', true),
|
||||
PartitionsEnabled: env('CONSUL_PARTITIONS_ENABLED', false),
|
||||
LocalDatacenter: env('CONSUL_DATACENTER_LOCAL', 'dc1'),
|
||||
PrimaryDatacenter: env('CONSUL_DATACENTER_PRIMARY', 'dc1'),
|
||||
|
@ -158,6 +158,7 @@ module.exports = function(environment, $ = process.env) {
|
|||
ACLsEnabled: env('CONSUL_ACLS_ENABLED', true),
|
||||
NamespacesEnabled: env('CONSUL_NSPACES_ENABLED', true),
|
||||
SSOEnabled: env('CONSUL_SSO_ENABLED', true),
|
||||
PeeringEnabled: env('CONSUL_PEERINGS_ENABLED', true),
|
||||
PartitionsEnabled: env('CONSUL_PARTITIONS_ENABLED', true),
|
||||
LocalDatacenter: env('CONSUL_DATACENTER_LOCAL', 'dc1'),
|
||||
PrimaryDatacenter: env('CONSUL_DATACENTER_PRIMARY', 'dc1'),
|
||||
|
|
|
@ -12,7 +12,7 @@ Below is a list of the most commonly used functions as bookmarklets followed by
|
|||
| [Enable ACLs](javascript:Scenario('CONSUL_ACLS_ENABLE=1')) | Enable ACLs |
|
||||
| [Enable TProxy](javascript:Scenario('CONSUL_TPROXY_ENABLE=1')) | Enable TProxy |
|
||||
| [Enable Nspaces](javascript:Scenario('CONSUL_NSPACES_ENABLE=1')) | Enable Namespace Support |
|
||||
| [Enable Peers](javascript:Scenario('CONSUL_PEERING_ENABLE=1')) | Enable Peers Support |
|
||||
| [Enable Peers](javascript:Scenario('CONSUL_PEERINGS_ENABLE=1')) | Enable Peering Support |
|
||||
| [Enable Partitions](javascript:Scenario('CONSUL_PARTITIONS_ENABLE=1')) | Enable Admin Partition Support |
|
||||
| [Enable SSO](javascript:Scenario('CONSUL_SSO_ENABLE=1')) | Enable SSO Support |
|
||||
| [Enable Metrics](javascript:Scenario('CONSUL_METRICS_PROXY_ENABLE=1;CONSUL_METRICS_PROVIDER=prometheus')) | Enable all configuration required for viewing the full Metrics Visualization |
|
||||
|
|
|
@ -30,6 +30,7 @@ module.exports = function(defaults, $ = process.env) {
|
|||
'consul-ui',
|
||||
'consul-acls',
|
||||
'consul-lock-sessions',
|
||||
'consul-peerings',
|
||||
'consul-partitions',
|
||||
'consul-nspaces',
|
||||
'consul-hcp'
|
||||
|
|
|
@ -59,6 +59,10 @@ ${
|
|||
{{if .ACLsEnabled}}
|
||||
<script src="${rootURL}assets/consul-acls/routes.js"></script>
|
||||
{{end}}
|
||||
{{if .PeeringEnabled}}
|
||||
<script src="${rootURL}assets/consul-peerings/services.js"></script>
|
||||
<script src="${rootURL}assets/consul-peerings/routes.js"></script>
|
||||
{{end}}
|
||||
{{if .PartitionsEnabled}}
|
||||
<script src="${rootURL}assets/consul-partitions/services.js"></script>
|
||||
<script src="${rootURL}assets/consul-partitions/routes.js"></script>
|
||||
|
@ -87,6 +91,7 @@ ${
|
|||
key => document.cookie.split('; ').find(item => item.startsWith(\`\${key}=\`)),
|
||||
{
|
||||
'CONSUL_ACLS_ENABLE': 'consul-acls',
|
||||
'CONSUL_PEERINGS_ENABLE': 'consul-peerings',
|
||||
'CONSUL_PARTITIONS_ENABLE': 'consul-partitions',
|
||||
'CONSUL_NSPACES_ENABLE': 'consul-nspaces',
|
||||
'CONSUL_HCP_ENABLE': 'consul-hcp'
|
||||
|
|
|
@ -20,8 +20,8 @@ test(
|
|||
ACLsEnabled: true,
|
||||
NamespacesEnabled: false,
|
||||
SSOEnabled: false,
|
||||
PeeringEnabled: true,
|
||||
PartitionsEnabled: false,
|
||||
PeeringEnabled: true,
|
||||
LocalDatacenter: 'dc1',
|
||||
PrimaryDatacenter: 'dc1',
|
||||
}
|
||||
|
@ -36,8 +36,8 @@ test(
|
|||
ACLsEnabled: true,
|
||||
NamespacesEnabled: true,
|
||||
SSOEnabled: false,
|
||||
PeeringEnabled: true,
|
||||
PartitionsEnabled: false,
|
||||
PeeringEnabled: true,
|
||||
LocalDatacenter: 'dc1',
|
||||
PrimaryDatacenter: 'dc1',
|
||||
}
|
||||
|
@ -52,8 +52,8 @@ test(
|
|||
ACLsEnabled: true,
|
||||
NamespacesEnabled: false,
|
||||
SSOEnabled: true,
|
||||
PeeringEnabled: true,
|
||||
PartitionsEnabled: false,
|
||||
PeeringEnabled: true,
|
||||
LocalDatacenter: 'dc1',
|
||||
PrimaryDatacenter: 'dc1',
|
||||
}
|
||||
|
@ -66,6 +66,7 @@ test(
|
|||
NamespacesEnabled: true,
|
||||
SSOEnabled: true,
|
||||
PartitionsEnabled: true,
|
||||
PeeringEnabled: true,
|
||||
LocalDatacenter: 'dc1',
|
||||
PrimaryDatacenter: 'dc1',
|
||||
}
|
||||
|
|
|
@ -82,6 +82,7 @@
|
|||
"consul-hcp": "*",
|
||||
"consul-lock-sessions": "*",
|
||||
"consul-nspaces": "*",
|
||||
"consul-peerings": "*",
|
||||
"consul-partitions": "*",
|
||||
"css.escape": "^1.5.1",
|
||||
"d3-array": "^2.8.0",
|
||||
|
|
|
@ -34,24 +34,6 @@
|
|||
},
|
||||
},
|
||||
},
|
||||
peers: {
|
||||
_options: { path: '/peers' },
|
||||
index: {
|
||||
_options: {
|
||||
path: '/',
|
||||
},
|
||||
},
|
||||
edit: {
|
||||
_options: {
|
||||
path: '/:name'
|
||||
},
|
||||
addresses: {
|
||||
_options: {
|
||||
path: '/addresses',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
services: {
|
||||
_options: { path: '/services' },
|
||||
index: {
|
||||
|
|
|
@ -15,6 +15,9 @@
|
|||
'component:consul/partition/selector': {
|
||||
class: '@glimmer/component',
|
||||
},
|
||||
'component:consul/peer/selector': {
|
||||
class: '@glimmer/component',
|
||||
},
|
||||
}))(
|
||||
(
|
||||
json,
|
||||
|
|
Loading…
Reference in New Issue