diff --git a/ui/packages/consul-ui/app/abilities/nspace.js b/ui/packages/consul-ui/app/abilities/nspace.js index d4471e417..0271a5b3e 100644 --- a/ui/packages/consul-ui/app/abilities/nspace.js +++ b/ui/packages/consul-ui/app/abilities/nspace.js @@ -16,7 +16,7 @@ export default class NspaceAbility extends BaseAbility { } get canChoose() { - return this.canUse && (this.nspaces || []).length > 0; + return this.canUse; } get canUse() { diff --git a/ui/packages/consul-ui/app/abilities/partition.js b/ui/packages/consul-ui/app/abilities/partition.js index 4db971787..aea6ccfff 100644 --- a/ui/packages/consul-ui/app/abilities/partition.js +++ b/ui/packages/consul-ui/app/abilities/partition.js @@ -16,7 +16,7 @@ export default class PartitionAbility extends BaseAbility { } get canChoose() { - return this.canUse && (this.partitions || []).length > 0; + return this.canUse; } get canUse() { diff --git a/ui/packages/consul-ui/app/adapters/binding-rule.js b/ui/packages/consul-ui/app/adapters/binding-rule.js index 0226a276e..b157305e5 100644 --- a/ui/packages/consul-ui/app/adapters/binding-rule.js +++ b/ui/packages/consul-ui/app/adapters/binding-rule.js @@ -1,7 +1,7 @@ import Adapter from './application'; export default class BindingRuleAdapter extends Adapter { - requestForQuery(request, { dc, ns, partition, authmethod, index, id }) { + requestForQuery(request, { dc, ns, partition, authmethod, index }) { return request` GET /v1/acl/binding-rules?${{ dc, authmethod }} diff --git a/ui/packages/consul-ui/app/adapters/intention.js b/ui/packages/consul-ui/app/adapters/intention.js index 0f2357a5b..6bd10fbaa 100644 --- a/ui/packages/consul-ui/app/adapters/intention.js +++ b/ui/packages/consul-ui/app/adapters/intention.js @@ -21,6 +21,7 @@ export default class IntentionAdapter extends Adapter { } ${{ + partition: '', ns: '*', index, filter, diff --git a/ui/packages/consul-ui/app/adapters/kv.js b/ui/packages/consul-ui/app/adapters/kv.js index 8e39d9086..5f6686357 100644 --- a/ui/packages/consul-ui/app/adapters/kv.js +++ b/ui/packages/consul-ui/app/adapters/kv.js @@ -7,11 +7,11 @@ import { SLUG_KEY } from 'consul-ui/models/kv'; const API_KEYS_KEY = 'keys'; export default class KvAdapter extends Adapter { - requestForQuery(request, { dc, ns, partition, index, id, separator }) { + async requestForQuery(request, { dc, ns, partition, index, id, separator }) { if (typeof id === 'undefined') { throw new Error('You must specify an id'); } - return request` + const respond = await request` GET /v1/kv/${keyToArray(id)}?${{ [API_KEYS_KEY]: null, dc, separator }} ${{ @@ -20,9 +20,11 @@ export default class KvAdapter extends Adapter { index, }} `; + await respond((headers, body) => delete headers['x-consul-index']); + return respond; } - requestForQueryRecord(request, { dc, ns, partition, index, id }) { + async requestForQueryRecord(request, { dc, ns, partition, index, id }) { if (typeof id === 'undefined') { throw new Error('You must specify an id'); } diff --git a/ui/packages/consul-ui/app/adapters/node.js b/ui/packages/consul-ui/app/adapters/node.js index b16e71eae..3d8065c52 100644 --- a/ui/packages/consul-ui/app/adapters/node.js +++ b/ui/packages/consul-ui/app/adapters/node.js @@ -39,6 +39,7 @@ export default class NodeAdapter extends Adapter { `; } + // this does not require a partition parameter requestForQueryLeader(request, { dc, uri }) { return request` GET /v1/status/leader?${{ dc }} diff --git a/ui/packages/consul-ui/app/adapters/nspace.js b/ui/packages/consul-ui/app/adapters/nspace.js index ea71a06ee..cb340c508 100644 --- a/ui/packages/consul-ui/app/adapters/nspace.js +++ b/ui/packages/consul-ui/app/adapters/nspace.js @@ -3,9 +3,9 @@ import { SLUG_KEY } from 'consul-ui/models/nspace'; // namespaces aren't categorized by datacenter, therefore no dc export default class NspaceAdapter extends Adapter { - requestForQuery(request, { partition, index, uri }) { + requestForQuery(request, { dc, partition, index, uri }) { return request` - GET /v1/namespaces + GET /v1/namespaces?${{ dc }} X-Request-ID: ${uri} ${{ @@ -15,12 +15,12 @@ export default class NspaceAdapter extends Adapter { `; } - requestForQueryRecord(request, { partition, index, id }) { + requestForQueryRecord(request, { dc, partition, index, id }) { if (typeof id === 'undefined') { throw new Error('You must specify an name'); } return request` - GET /v1/namespace/${id} + GET /v1/namespace/${id}?${{ dc }} ${{ partition, @@ -32,6 +32,7 @@ export default class NspaceAdapter extends Adapter { requestForCreateRecord(request, serialized, data) { return request` PUT /v1/namespace/${data[SLUG_KEY]}?${{ + dc: data.Datacenter, partition: data.Partition, }} @@ -49,6 +50,7 @@ export default class NspaceAdapter extends Adapter { requestForUpdateRecord(request, serialized, data) { return request` PUT /v1/namespace/${data[SLUG_KEY]}?${{ + dc: data.Datacenter, partition: data.Partition, }} @@ -65,6 +67,7 @@ export default class NspaceAdapter extends Adapter { requestForDeleteRecord(request, serialized, data) { return request` DELETE /v1/namespace/${data[SLUG_KEY]}?${{ + dc: data.Datacenter, partition: data.Partition, }} `; diff --git a/ui/packages/consul-ui/app/adapters/partition.js b/ui/packages/consul-ui/app/adapters/partition.js new file mode 100644 index 000000000..bbcdd3a72 --- /dev/null +++ b/ui/packages/consul-ui/app/adapters/partition.js @@ -0,0 +1,28 @@ +import Adapter from './application'; + +// Blocking query support for partitions is currently disabled +export default class PartitionAdapter extends Adapter { + // FIXME: Check overall hierarchy again + async requestForQuery(request, { ns, dc, index }) { + const respond = await request` + GET /v1/partitions?${{ dc }} + + ${{ index }} + `; + await respond((headers, body) => delete headers['x-consul-index']); + return respond; + } + + async requestForQueryRecord(request, { ns, dc, index, id }) { + if (typeof id === 'undefined') { + throw new Error('You must specify an id'); + } + const respond = await request` + GET /v1/partition/${id}?${{ dc }} + + ${{ index }} + `; + await respond((headers, body) => delete headers['x-consul-index']); + return respond; + } +} diff --git a/ui/packages/consul-ui/app/adapters/permission.js b/ui/packages/consul-ui/app/adapters/permission.js index 74addd1f4..cb89f0773 100644 --- a/ui/packages/consul-ui/app/adapters/permission.js +++ b/ui/packages/consul-ui/app/adapters/permission.js @@ -21,7 +21,7 @@ export default class PermissionAdapter extends Adapter { resources = resources.map(item => ({ ...item, Partition: partition })); } return request` - POST /v1/internal/acl/authorize?${{ dc, index }} + POST /v1/internal/acl/authorize?${{ dc }} ${resources} `; diff --git a/ui/packages/consul-ui/app/adapters/token.js b/ui/packages/consul-ui/app/adapters/token.js index ab8fe8bad..286568877 100644 --- a/ui/packages/consul-ui/app/adapters/token.js +++ b/ui/packages/consul-ui/app/adapters/token.js @@ -17,12 +17,13 @@ export default class TokenAdapter extends Adapter { `; } - requestForQueryRecord(request, { dc, ns, partition, index, id }) { + async requestForQueryRecord(request, { dc, ns, partition, index, id }) { if (typeof id === 'undefined') { throw new Error('You must specify an id'); } - return request` + const respond = await request` GET /v1/acl/token/${id}?${{ dc }} + Cache-Control: no-store ${{ ns, @@ -30,6 +31,8 @@ export default class TokenAdapter extends Adapter { index, }} `; + respond((headers, body) => delete headers['x-consul-index']); + return respond; } requestForCreateRecord(request, serialized, data) { diff --git a/ui/packages/consul-ui/app/components/auth-dialog/index.hbs b/ui/packages/consul-ui/app/components/auth-dialog/index.hbs index e12a4d05d..c2cc07b6f 100644 --- a/ui/packages/consul-ui/app/components/auth-dialog/index.hbs +++ b/ui/packages/consul-ui/app/components/auth-dialog/index.hbs @@ -22,7 +22,11 @@ token=token ) (hash AuthProfile=(component 'auth-profile' item=token) - AuthForm=(component 'auth-form' dc=dc nspace=nspace onsubmit=(action sink.open value="data")) + AuthForm=(component 'auth-form' + dc=dc + partition=partition + nspace=nspace + onsubmit=(action sink.open value="data")) ) as |api components|}} {{#yield-slot name="authorized"}} diff --git a/ui/packages/consul-ui/app/components/auth-form/index.hbs b/ui/packages/consul-ui/app/components/auth-form/index.hbs index 66dddd505..518f0c0e4 100644 --- a/ui/packages/consul-ui/app/components/auth-form/index.hbs +++ b/ui/packages/consul-ui/app/components/auth-form/index.hbs @@ -77,7 +77,13 @@ {{#if (env 'CONSUL_SSO_ENABLED')}} {{!-- This `or` can be completely removed post 1.10 as 1.10 has optional params with default values --}} + {{!FIXME: default partition?}} {{yield}} {{#if isOpen}} {{/if}} diff --git a/ui/packages/consul-ui/app/components/consul/acl/disabled/index.hbs b/ui/packages/consul-ui/app/components/consul/acl/disabled/index.hbs new file mode 100644 index 000000000..5ce0e436c --- /dev/null +++ b/ui/packages/consul-ui/app/components/consul/acl/disabled/index.hbs @@ -0,0 +1,28 @@ + + +

+ Tokens +

+
+ + + +

Welcome to ACLs

+
+ +

+ ACLs are not enabled in this Consul cluster. We strongly encourage the use of ACLs in production environments for the best security practices. +

+
+ + + + +
+
+
+ diff --git a/ui/packages/consul-ui/app/components/consul/health-check/list/README.mdx b/ui/packages/consul-ui/app/components/consul/health-check/list/README.mdx index 6429edb3e..a37359bdd 100644 --- a/ui/packages/consul-ui/app/components/consul/health-check/list/README.mdx +++ b/ui/packages/consul-ui/app/components/consul/health-check/list/README.mdx @@ -6,7 +6,7 @@ A presentational component for rendering HealthChecks.
Grab some mock data...
- +
but only show a max of 2 items for docs purposes
diff --git a/ui/packages/consul-ui/app/components/consul/intention/form/index.hbs b/ui/packages/consul-ui/app/components/consul/intention/form/index.hbs index 096658810..254e1d50f 100644 --- a/ui/packages/consul-ui/app/components/consul/intention/form/index.hbs +++ b/ui/packages/consul-ui/app/components/consul/intention/form/index.hbs @@ -6,6 +6,7 @@ @type="intention" @dc={{@dc}} @nspace={{@nspace}} + @partition={{@partition}} @autofill={{@autofill}} @item={{@item}} @src={{@src}} @@ -73,15 +74,27 @@ as |api|> {{/let}} - {{#if (env 'CONSUL_NSPACES_ENABLED')}} + + {{#if (can 'use nspaces')}} {{/if}} + {{#if (and api.isCreate this.isManagedByCRDs)}} {{/if}} diff --git a/ui/packages/consul-ui/app/components/consul/kv/form/index.hbs b/ui/packages/consul-ui/app/components/consul/kv/form/index.hbs index da045157d..40d3ce3d8 100644 --- a/ui/packages/consul-ui/app/components/consul/kv/form/index.hbs +++ b/ui/packages/consul-ui/app/components/consul/kv/form/index.hbs @@ -1,6 +1,7 @@ Key or folder - + To create a folder, end a key with / {{/if}} -{{#if (or (eq (left-trim api.data.Key parent.Key) '') (not-eq (last api.data.Key) '/'))}} +{{#if (or (eq (left-trim api.data.Key parent) '') (not-eq (last api.data.Key) '/'))}}
@@ -72,7 +72,8 @@ {{#if (eq item.template 'node-identity')}} -
{{#if isScoped }} - diff --git a/ui/packages/consul-ui/app/components/policy-selector/index.hbs b/ui/packages/consul-ui/app/components/policy-selector/index.hbs index 07cec2ce2..98d0a9630 100644 --- a/ui/packages/consul-ui/app/components/policy-selector/index.hbs +++ b/ui/packages/consul-ui/app/components/policy-selector/index.hbs @@ -2,6 +2,7 @@ @disabled={{disabled}} @repo={{repo}} @dc={{dc}} + @partition={{partition}} @nspace={{nspace}} @type="policy" @placeholder="Search for policy" @@ -38,7 +39,13 @@

New Policy

- +