From fc14a412fd1d06a3ace64fec280405212350d4b4 Mon Sep 17 00:00:00 2001 From: John Cowen Date: Wed, 15 Sep 2021 19:50:11 +0100 Subject: [PATCH] ui: Partitions Application Layer (#11017) * Add Partition to all our models * Add partitions into our serializers/fingerprinting * Make some amends to a few adapters ready for partitions * Amend blueprints to avoid linting error * Update all our repositories to include partitions, also Remove enabled/disable nspace repo and just use a nspace with conditionals * Ensure nspace and parition parameters always return '' no matter what * Ensure data-sink finds the model properly This will later be replaced by a @dataSink decorator but we are find kicking that can down the road a little more * Add all the new partition data layer * Add a way to set the title of the page from inside the route and make it accessibile via a route announcer * Make the Consul Route the default/basic one * Tweak nspace and partition abilities not to check the length * Thread partition through all the components that need it * Some ACL tweaks * Move the entire app to use partitions * Delete all the tests we no longer need * Update some Unit tests to use partition * Fix up KV title tests * Fix up a few more acceptance tests * Fixup and temporarily ignore some acceptance tests * Stop using ember-cli-page-objects fillable as it doesn't seem to work * Fix lint error * Remove old ACL related test * Add a tick after filling out forms * Fix token warning modal * Found some more places where we need a partition var * Fixup some more acceptance tests * Tokens still needs a repo service for CRUD * Remove acceptance tests we no longer need * Fixup and "FIXME ignore" a few tests * Remove an s * Disable blocking queries for KV to revert to previous release for now * Fixup adapter tests to follow async/function resolving interface * Fixup all the serializer integration tests * Fixup service/repo integration tests * Fixup deleting acceptance test * Fixup some ent tests * Make sure nspaces passes the dc through for when thats important * ...aaaand acceptance nspaces with the extra dc param --- ui/packages/consul-ui/app/abilities/nspace.js | 2 +- .../consul-ui/app/abilities/partition.js | 2 +- .../consul-ui/app/adapters/binding-rule.js | 2 +- .../consul-ui/app/adapters/intention.js | 1 + ui/packages/consul-ui/app/adapters/kv.js | 8 +- ui/packages/consul-ui/app/adapters/node.js | 1 + ui/packages/consul-ui/app/adapters/nspace.js | 11 +- .../consul-ui/app/adapters/partition.js | 28 ++++ .../consul-ui/app/adapters/permission.js | 2 +- ui/packages/consul-ui/app/adapters/token.js | 7 +- .../app/components/auth-dialog/index.hbs | 6 +- .../app/components/auth-form/index.hbs | 10 +- .../app/components/child-selector/index.hbs | 9 +- .../components/consul/acl/disabled/index.hbs | 28 ++++ .../consul/health-check/list/README.mdx | 2 +- .../consul/intention/form/index.hbs | 19 ++- .../app/components/consul/kv/form/index.hbs | 5 +- .../app/components/consul/kv/form/index.js | 2 +- .../consul/lock-session/form/index.hbs | 1 + .../consul/lock-session/list/README.mdx | 2 +- .../consul/metadata/list/README.mdx | 2 +- .../components/consul/nspace/list/README.mdx | 2 +- .../consul/policy/search-bar/index.hbs | 10 +- .../app/components/data-collection/README.mdx | 2 +- .../app/components/data-form/index.hbs | 6 +- .../app/components/data-form/index.js | 2 +- .../app/components/data-loader/README.mdx | 73 +++++++++ .../components/data-loader/chart.xstate.js | 3 + .../app/components/data-loader/index.hbs | 2 + .../app/components/data-source/README.mdx | 34 +++-- .../app/components/data-source/index.js | 17 +++ .../app/components/hashicorp-consul/index.hbs | 91 +++++++++-- .../components/main-nav-vertical/layout.scss | 1 + .../app/components/policy-form/index.hbs | 8 +- .../app/components/policy-selector/index.hbs | 18 ++- .../app/components/role-form/index.hbs | 1 + .../app/components/role-selector/index.hbs | 35 ++++- .../consul-ui/app/components/route/README.mdx | 20 ++- .../app/components/route/announcer/index.hbs | 3 + .../consul-ui/app/components/route/index.hbs | 11 +- .../consul-ui/app/components/route/index.js | 5 +- .../app/components/route/title/index.hbs | 15 ++ .../app/components/route/title/index.scss | 6 + .../app/components/token-source/README.mdx | 2 + .../app/components/token-source/index.hbs | 2 +- .../app/components/topology-metrics/index.hbs | 4 + .../topology-metrics/series/index.hbs | 4 +- .../topology-metrics/stats/index.hbs | 3 +- .../consul-ui/app/controllers/application.js | 13 +- .../app/controllers/dc/nspaces/edit.js | 16 +- .../consul-ui/app/controllers/settings.js | 25 --- .../consul-ui/app/initializers/routing.js | 8 + .../app/instance-initializers/container.js | 2 +- .../app/instance-initializers/nspace.js | 15 -- .../app/locations/fsm-with-optional.js | 4 +- .../consul-ui/app/mixins/creating-route.js | 26 ---- .../app/mixins/nspace/with-actions.js | 4 - .../app/mixins/policy/with-actions.js | 4 - .../consul-ui/app/mixins/role/with-actions.js | 4 - .../app/mixins/token/with-actions.js | 48 ------ .../app/mixins/with-blocking-actions.js | 43 +++++- .../consul-ui/app/models/auth-method.js | 1 + .../consul-ui/app/models/binding-rule.js | 1 + .../consul-ui/app/models/coordinate.js | 1 + .../consul-ui/app/models/discovery-chain.js | 1 + ui/packages/consul-ui/app/models/intention.js | 1 + ui/packages/consul-ui/app/models/kv.js | 1 + ui/packages/consul-ui/app/models/node.js | 1 + ui/packages/consul-ui/app/models/nspace.js | 7 +- .../consul-ui/app/models/oidc-provider.js | 1 + ui/packages/consul-ui/app/models/partition.js | 21 +++ ui/packages/consul-ui/app/models/policy.js | 1 + ui/packages/consul-ui/app/models/proxy.js | 1 + ui/packages/consul-ui/app/models/role.js | 1 + .../consul-ui/app/models/service-instance.js | 3 + ui/packages/consul-ui/app/models/service.js | 1 + ui/packages/consul-ui/app/models/session.js | 1 + ui/packages/consul-ui/app/models/token.js | 1 + ui/packages/consul-ui/app/models/topology.js | 1 + ui/packages/consul-ui/app/router.js | 6 +- .../consul-ui/app/routes/application.js | 109 +++---------- ui/packages/consul-ui/app/routes/dc.js | 51 +------ .../app/routes/dc/acls/auth-methods/index.js | 21 --- .../app/routes/dc/acls/auth-methods/show.js | 36 ----- .../dc/acls/auth-methods/show/auth-method.js | 16 -- .../acls/auth-methods/show/binding-rules.js | 16 -- .../routes/dc/acls/auth-methods/show/index.js | 6 +- .../dc/acls/auth-methods/show/nspace-rules.js | 16 -- .../app/routes/dc/acls/policies/create.js | 3 +- .../app/routes/dc/acls/policies/edit.js | 48 +----- .../app/routes/dc/acls/policies/index.js | 25 +-- .../app/routes/dc/acls/roles/create.js | 3 +- .../app/routes/dc/acls/roles/edit.js | 47 +----- .../app/routes/dc/acls/roles/index.js | 25 +-- .../app/routes/dc/acls/tokens/create.js | 3 +- .../app/routes/dc/acls/tokens/edit.js | 33 ++-- .../app/routes/dc/acls/tokens/index.js | 42 +---- ui/packages/consul-ui/app/routes/dc/index.js | 5 +- .../app/routes/dc/intentions/create.js | 2 +- .../app/routes/dc/intentions/edit.js | 38 ----- .../app/routes/dc/intentions/index.js | 13 -- .../consul-ui/app/routes/dc/kv/create.js | 2 +- .../consul-ui/app/routes/dc/kv/edit.js | 73 --------- .../consul-ui/app/routes/dc/kv/index.js | 45 +----- .../consul-ui/app/routes/dc/nodes/index.js | 20 --- .../consul-ui/app/routes/dc/nodes/show.js | 28 ---- .../app/routes/dc/nodes/show/healthchecks.js | 16 -- .../app/routes/dc/nodes/show/index.js | 16 -- .../app/routes/dc/nodes/show/metadata.js | 16 -- .../consul-ui/app/routes/dc/nodes/show/rtt.js | 27 ---- .../app/routes/dc/nodes/show/services.js | 16 -- .../app/routes/dc/nodes/show/sessions.js | 37 +---- .../consul-ui/app/routes/dc/nspaces/create.js | 10 +- .../consul-ui/app/routes/dc/nspaces/edit.js | 37 +---- .../consul-ui/app/routes/dc/nspaces/index.js | 17 +-- .../consul-ui/app/routes/dc/routing-config.js | 19 --- .../consul-ui/app/routes/dc/services/index.js | 20 --- .../app/routes/dc/services/instance.js | 50 ------ .../routes/dc/services/instance/addresses.js | 27 ---- .../dc/services/instance/exposedpaths.js | 16 -- .../dc/services/instance/healthchecks.js | 16 -- .../app/routes/dc/services/instance/index.js | 6 +- .../routes/dc/services/instance/metadata.js | 16 -- .../routes/dc/services/instance/upstreams.js | 16 -- .../consul-ui/app/routes/dc/services/show.js | 56 ------- .../app/routes/dc/services/show/index.js | 35 ----- .../app/routes/dc/services/show/instances.js | 16 -- .../app/routes/dc/services/show/intentions.js | 8 - .../dc/services/show/intentions/create.js | 2 +- .../dc/services/show/intentions/edit.js | 17 --- .../dc/services/show/intentions/index.js | 14 -- .../app/routes/dc/services/show/routing.js | 37 ----- .../app/routes/dc/services/show/services.js | 25 --- .../app/routes/dc/services/show/tags.js | 16 -- .../app/routes/dc/services/show/topology.js | 45 ++---- .../app/routes/dc/services/show/upstreams.js | 3 +- ui/packages/consul-ui/app/routes/index.js | 19 --- ui/packages/consul-ui/app/routes/notfound.js | 10 -- ui/packages/consul-ui/app/routes/settings.js | 53 +------ ui/packages/consul-ui/app/routing/route.js | 41 ++++- ui/packages/consul-ui/app/routing/single.js | 4 + .../consul-ui/app/serializers/application.js | 27 +++- .../consul-ui/app/serializers/nspace.js | 95 ++++++------ .../consul-ui/app/serializers/partition.js | 24 +++ .../app/serializers/service-instance.js | 5 + .../consul-ui/app/services/client/http.js | 16 +- .../app/services/data-sink/protocols/http.js | 19 +-- .../services/data-source/protocols/http.js | 30 ++-- .../consul-ui/app/services/repository.js | 13 ++ .../app/services/repository/auth-method.js | 4 +- .../app/services/repository/binding-rule.js | 6 +- .../app/services/repository/coordinate.js | 28 ++-- .../consul-ui/app/services/repository/dc.js | 46 ++---- .../services/repository/discovery-chain.js | 2 +- .../app/services/repository/intention.js | 28 +++- .../consul-ui/app/services/repository/kv.js | 23 ++- .../app/services/repository/metrics.js | 13 +- .../consul-ui/app/services/repository/node.js | 6 +- .../app/services/repository/nspace.js | 96 ++++++++++-- .../services/repository/nspace/disabled.js | 31 ---- .../app/services/repository/nspace/enabled.js | 79 ---------- .../app/services/repository/oidc-provider.js | 6 +- .../app/services/repository/partition.js | 69 +++++++++ .../app/services/repository/permission.js | 2 + .../app/services/repository/policy.js | 23 ++- .../app/services/repository/proxy.js | 4 +- .../consul-ui/app/services/repository/role.js | 27 +++- .../services/repository/service-instance.js | 6 +- .../app/services/repository/service.js | 6 +- .../app/services/repository/session.js | 4 +- .../app/services/repository/token.js | 43 ++++-- .../app/services/repository/topology.js | 2 +- ui/packages/consul-ui/app/services/routlet.js | 9 +- ui/packages/consul-ui/app/services/store.js | 14 +- .../consul-ui/app/services/ui-config.js | 33 +++- .../base/decoration/base-placeholders.scss | 6 +- .../consul-ui/app/styles/components.scss | 1 + ui/packages/consul-ui/app/styles/debug.scss | 17 ++- .../consul-ui/app/templates/application.hbs | 144 +++++++++++++++--- .../templates/dc/acls/auth-methods/index.hbs | 33 +++- .../templates/dc/acls/auth-methods/show.hbs | 105 ++++++++----- .../dc/acls/auth-methods/show/auth-method.hbs | 11 +- .../acls/auth-methods/show/binding-rules.hbs | 85 ++++++++--- .../acls/auth-methods/show/nspace-rules.hbs | 53 ++++--- .../app/templates/dc/acls/policies/-form.hbs | 28 +++- .../app/templates/dc/acls/policies/-view.hbs | 24 --- .../app/templates/dc/acls/policies/edit.hbs | 87 +++++++++-- .../app/templates/dc/acls/policies/index.hbs | 33 +++- .../app/templates/dc/acls/roles/-form.hbs | 33 +++- .../app/templates/dc/acls/roles/edit.hbs | 46 ++++-- .../app/templates/dc/acls/roles/index.hbs | 30 +++- .../templates/dc/acls/tokens/-fieldsets.hbs | 2 + .../app/templates/dc/acls/tokens/edit.hbs | 48 ++++-- .../app/templates/dc/acls/tokens/index.hbs | 33 +++- .../app/templates/dc/intentions/edit.hbs | 43 +++++- .../app/templates/dc/intentions/index.hbs | 21 ++- .../consul-ui/app/templates/dc/kv/edit.hbs | 127 ++++++++++++--- .../consul-ui/app/templates/dc/kv/index.hbs | 48 +++++- .../app/templates/dc/nodes/index.hbs | 42 ++++- .../consul-ui/app/templates/dc/nodes/show.hbs | 41 +++-- .../templates/dc/nodes/show/healthchecks.hbs | 2 +- .../app/templates/dc/nodes/show/index.hbs | 9 ++ .../app/templates/dc/nodes/show/metadata.hbs | 4 +- .../app/templates/dc/nodes/show/rtt.hbs | 8 + .../app/templates/dc/nodes/show/services.hbs | 2 +- .../app/templates/dc/nodes/show/sessions.hbs | 23 ++- .../app/templates/dc/nspaces/-form.hbs | 2 + .../app/templates/dc/nspaces/edit.hbs | 38 ++++- .../app/templates/dc/nspaces/index.hbs | 26 +++- .../app/templates/dc/routing-config.hbs | 34 ++++- .../app/templates/dc/services/index.hbs | 27 +++- .../app/templates/dc/services/instance.hbs | 69 +++++++-- .../dc/services/instance/addresses.hbs | 4 + .../dc/services/instance/exposedpaths.hbs | 4 + .../dc/services/instance/healthchecks.hbs | 2 +- .../dc/services/instance/metadata.hbs | 4 + .../dc/services/instance/upstreams.hbs | 7 +- .../app/templates/dc/services/show.hbs | 132 ++++++++++++---- .../app/templates/dc/services/show/index.hbs | 13 ++ .../templates/dc/services/show/instances.hbs | 2 +- .../dc/services/show/intentions/edit.hbs | 9 +- .../dc/services/show/intentions/index.hbs | 20 ++- .../templates/dc/services/show/routing.hbs | 31 +++- .../templates/dc/services/show/services.hbs | 23 ++- .../app/templates/dc/services/show/tags.hbs | 2 +- .../templates/dc/services/show/topology.hbs | 47 +++++- .../templates/dc/services/show/upstreams.hbs | 27 +++- ui/packages/consul-ui/app/templates/index.hbs | 10 ++ .../consul-ui/app/templates/notfound.hbs | 12 ++ .../consul-ui/app/templates/settings.hbs | 99 +++++++----- .../app/utils/create-fingerprinter.js | 20 ++- .../consul-ui/app/utils/http/consul.js | 1 + .../files/__root__/__path__/__name__.js | 2 +- .../model/files/__root__/__path__/__name__.js | 2 +- .../files/__root__/__path__/__name__.js | 2 +- .../files/__root__/__path__/__name__.js | 2 +- .../consul-ui/mock-api/v1/acl/auth-methods | 3 + .../consul-ui/mock-api/v1/acl/binding-rules | 3 +- .../consul-ui/mock-api/v1/acl/policies | 8 +- ui/packages/consul-ui/mock-api/v1/acl/roles | 3 + ui/packages/consul-ui/mock-api/v1/acl/tokens | 3 + .../consul-ui/mock-api/v1/health/service/_ | 3 + .../mock-api/v1/internal/ui/oidc-auth-methods | 3 +- ui/packages/consul-ui/mock-api/v1/kv/_ | 3 + ui/packages/consul-ui/mock-api/v1/namespaces | 6 + ui/packages/consul-ui/mock-api/v1/partitions | 30 ++++ .../acceptance/components/acl-filter.feature | 33 ---- .../acceptance/components/text-input.feature | 11 -- .../acceptance/dc/acls/list-order.feature | 40 ----- .../dc/acls/policies/as-many/nspaces.feature | 6 +- .../dc/acls/policies/delete.feature | 31 ++-- .../dc/acls/tokens/legacy/update.feature | 58 ------- .../dc/acls/tokens/own-no-delete.feature | 5 +- .../acceptance/dc/acls/tokens/use.feature | 7 +- .../tests/acceptance/dc/acls/update.feature | 49 ------ .../tests/acceptance/dc/acls/use.feature | 46 ------ .../tests/acceptance/dc/error.feature | 2 + .../tests/acceptance/dc/kvs/create.feature | 4 +- .../tests/acceptance/dc/kvs/index.feature | 2 +- .../tests/acceptance/dc/kvs/update.feature | 4 +- .../tests/acceptance/dc/list-blocking.feature | 2 + .../acceptance/dc/nspaces/create.feature | 2 +- .../acceptance/dc/nspaces/delete.feature | 16 +- .../acceptance/dc/nspaces/update.feature | 6 +- .../acceptance/dc/services/error.feature | 2 + .../dc/services/instances/error.feature | 2 +- .../dc/services/show-routing.feature | 29 ++-- .../tests/acceptance/dc/services/show.feature | 4 +- .../dc/services/show/topology/metrics.feature | 2 +- .../tests/acceptance/deleting.feature | 8 +- .../tests/acceptance/index-forwarding.feature | 4 +- .../tests/acceptance/login-errors.feature | 41 ----- .../tests/acceptance/page-navigation.feature | 81 +++++----- .../tests/acceptance/settings/show.feature | 50 +++--- .../tests/acceptance/submit-blank.feature | 1 - .../tests/acceptance/token-header.feature | 16 +- ui/packages/consul-ui/tests/helpers/repo.js | 1 + .../tests/integration/adapters/kv-test.js | 30 ++-- .../tests/integration/adapters/nspace-test.js | 10 +- .../integration/adapters/partition-test.js | 47 ++++++ .../tests/integration/adapters/token-test.js | 15 +- .../tests/integration/serializers/acl-test.js | 77 ---------- .../serializers/auth-method-test.js | 22 ++- .../serializers/binding-rule-test.js | 9 +- .../serializers/coordinate-test.js | 11 +- .../serializers/discovery-chain-test.js | 5 +- .../integration/serializers/intention-test.js | 13 +- .../tests/integration/serializers/kv-test.js | 23 ++- .../integration/serializers/node-test.js | 10 +- .../integration/serializers/nspace-test.js | 49 ++++-- .../serializers/oidc-provider-test.js | 17 ++- .../integration/serializers/partition-test.js | 64 ++++++++ .../integration/serializers/policy-test.js | 23 ++- .../integration/serializers/role-test.js | 24 ++- .../serializers/service-instance-test.js | 12 +- .../integration/serializers/service-test.js | 32 +++- .../integration/serializers/session-test.js | 20 ++- .../integration/serializers/token-test.js | 24 ++- .../integration/serializers/topology-test.js | 5 +- .../services/repository/acl-test.js | 67 -------- .../services/repository/auth-method-test.js | 11 +- .../services/repository/coordinate-test.js | 17 ++- .../repository/discovery-chain-test.js | 4 +- .../services/repository/kv-test.js | 36 ++++- .../services/repository/node-test.js | 26 +++- .../services/repository/policy-test.js | 36 ++++- .../services/repository/role-test.js | 36 ++++- .../services/repository/service-test.js | 19 ++- .../services/repository/session-test.js | 32 +++- .../services/repository/token-test.js | 60 ++++++-- .../services/repository/topology-test.js | 4 +- .../tests/steps/interactions/form.js | 16 +- .../partition-test.js} | 6 +- .../tests/unit/mixins/creating-route-test.js | 12 -- .../unit/mixins/nspace/with-actions-test.js | 24 --- .../unit/mixins/policy/with-actions-test.js | 24 --- .../unit/mixins/role/with-actions-test.js | 24 --- .../unit/mixins/token/with-actions-test.js | 24 --- .../tests/unit/models/partition-test.js | 13 ++ .../unit/routes/dc/intentions/edit-test.js | 11 -- .../tests/unit/routes/dc/kv/edit-test.js | 11 -- .../tests/unit/routes/dc/nodes/index-test.js | 11 -- .../tests/unit/routes/dc/nodes/show-test.js | 11 -- .../unit/routes/dc/routing-config-test.js | 11 -- .../unit/routes/dc/services/index-test.js | 11 -- .../unit/routes/dc/services/instance-test.js | 11 -- .../unit/routes/dc/services/show-test.js | 11 -- .../consul-ui/tests/unit/routes/index-test.js | 38 ----- .../tests/unit/routes/notfound-test.js | 11 -- .../tests/unit/serializers/kv-test.js | 17 ++- .../tests/unit/serializers/partition-test.js | 23 +++ .../enabled-test.js => nspace-test.js} | 4 +- .../disabled-test.js => partition-test.js} | 6 +- .../unit/utils/create-fingerprinter-test.js | 18 ++- 334 files changed, 3573 insertions(+), 3295 deletions(-) create mode 100644 ui/packages/consul-ui/app/adapters/partition.js create mode 100644 ui/packages/consul-ui/app/components/consul/acl/disabled/index.hbs create mode 100644 ui/packages/consul-ui/app/components/data-loader/README.mdx create mode 100644 ui/packages/consul-ui/app/components/route/announcer/index.hbs create mode 100644 ui/packages/consul-ui/app/components/route/title/index.hbs create mode 100644 ui/packages/consul-ui/app/components/route/title/index.scss delete mode 100644 ui/packages/consul-ui/app/controllers/settings.js create mode 100644 ui/packages/consul-ui/app/initializers/routing.js delete mode 100644 ui/packages/consul-ui/app/instance-initializers/nspace.js delete mode 100644 ui/packages/consul-ui/app/mixins/creating-route.js delete mode 100644 ui/packages/consul-ui/app/mixins/nspace/with-actions.js delete mode 100644 ui/packages/consul-ui/app/mixins/policy/with-actions.js delete mode 100644 ui/packages/consul-ui/app/mixins/role/with-actions.js delete mode 100644 ui/packages/consul-ui/app/mixins/token/with-actions.js create mode 100644 ui/packages/consul-ui/app/models/partition.js delete mode 100644 ui/packages/consul-ui/app/routes/dc/acls/auth-methods/show.js delete mode 100644 ui/packages/consul-ui/app/routes/dc/acls/auth-methods/show/auth-method.js delete mode 100644 ui/packages/consul-ui/app/routes/dc/acls/auth-methods/show/binding-rules.js delete mode 100644 ui/packages/consul-ui/app/routes/dc/acls/auth-methods/show/nspace-rules.js delete mode 100644 ui/packages/consul-ui/app/routes/dc/intentions/edit.js delete mode 100644 ui/packages/consul-ui/app/routes/dc/kv/edit.js delete mode 100644 ui/packages/consul-ui/app/routes/dc/nodes/show.js delete mode 100644 ui/packages/consul-ui/app/routes/dc/nodes/show/index.js delete mode 100644 ui/packages/consul-ui/app/routes/dc/nodes/show/metadata.js delete mode 100644 ui/packages/consul-ui/app/routes/dc/nodes/show/rtt.js delete mode 100644 ui/packages/consul-ui/app/routes/dc/routing-config.js delete mode 100644 ui/packages/consul-ui/app/routes/dc/services/instance.js delete mode 100644 ui/packages/consul-ui/app/routes/dc/services/instance/addresses.js delete mode 100644 ui/packages/consul-ui/app/routes/dc/services/instance/exposedpaths.js delete mode 100644 ui/packages/consul-ui/app/routes/dc/services/instance/metadata.js delete mode 100644 ui/packages/consul-ui/app/routes/dc/services/show.js delete mode 100644 ui/packages/consul-ui/app/routes/dc/services/show/index.js delete mode 100644 ui/packages/consul-ui/app/routes/dc/services/show/intentions.js delete mode 100644 ui/packages/consul-ui/app/routes/dc/services/show/intentions/edit.js delete mode 100644 ui/packages/consul-ui/app/routes/dc/services/show/routing.js delete mode 100644 ui/packages/consul-ui/app/routes/dc/services/show/tags.js delete mode 100644 ui/packages/consul-ui/app/routes/index.js delete mode 100644 ui/packages/consul-ui/app/routes/notfound.js create mode 100644 ui/packages/consul-ui/app/serializers/partition.js delete mode 100644 ui/packages/consul-ui/app/services/repository/nspace/disabled.js delete mode 100644 ui/packages/consul-ui/app/services/repository/nspace/enabled.js create mode 100644 ui/packages/consul-ui/app/services/repository/partition.js delete mode 100644 ui/packages/consul-ui/app/templates/dc/acls/policies/-view.hbs create mode 100644 ui/packages/consul-ui/app/templates/dc/nodes/show/index.hbs create mode 100644 ui/packages/consul-ui/app/templates/dc/services/show/index.hbs create mode 100644 ui/packages/consul-ui/app/templates/index.hbs create mode 100644 ui/packages/consul-ui/mock-api/v1/partitions delete mode 100644 ui/packages/consul-ui/tests/acceptance/components/acl-filter.feature delete mode 100644 ui/packages/consul-ui/tests/acceptance/dc/acls/list-order.feature delete mode 100644 ui/packages/consul-ui/tests/acceptance/dc/acls/tokens/legacy/update.feature delete mode 100644 ui/packages/consul-ui/tests/acceptance/dc/acls/update.feature delete mode 100644 ui/packages/consul-ui/tests/acceptance/dc/acls/use.feature create mode 100644 ui/packages/consul-ui/tests/integration/adapters/partition-test.js delete mode 100644 ui/packages/consul-ui/tests/integration/serializers/acl-test.js create mode 100644 ui/packages/consul-ui/tests/integration/serializers/partition-test.js delete mode 100644 ui/packages/consul-ui/tests/integration/services/repository/acl-test.js rename ui/packages/consul-ui/tests/unit/{controllers/settings-test.js => adapters/partition-test.js} (56%) delete mode 100644 ui/packages/consul-ui/tests/unit/mixins/creating-route-test.js delete mode 100644 ui/packages/consul-ui/tests/unit/mixins/nspace/with-actions-test.js delete mode 100644 ui/packages/consul-ui/tests/unit/mixins/policy/with-actions-test.js delete mode 100644 ui/packages/consul-ui/tests/unit/mixins/role/with-actions-test.js delete mode 100644 ui/packages/consul-ui/tests/unit/mixins/token/with-actions-test.js create mode 100644 ui/packages/consul-ui/tests/unit/models/partition-test.js delete mode 100644 ui/packages/consul-ui/tests/unit/routes/dc/intentions/edit-test.js delete mode 100644 ui/packages/consul-ui/tests/unit/routes/dc/kv/edit-test.js delete mode 100644 ui/packages/consul-ui/tests/unit/routes/dc/nodes/index-test.js delete mode 100644 ui/packages/consul-ui/tests/unit/routes/dc/nodes/show-test.js delete mode 100644 ui/packages/consul-ui/tests/unit/routes/dc/routing-config-test.js delete mode 100644 ui/packages/consul-ui/tests/unit/routes/dc/services/index-test.js delete mode 100644 ui/packages/consul-ui/tests/unit/routes/dc/services/instance-test.js delete mode 100644 ui/packages/consul-ui/tests/unit/routes/dc/services/show-test.js delete mode 100644 ui/packages/consul-ui/tests/unit/routes/index-test.js delete mode 100644 ui/packages/consul-ui/tests/unit/routes/notfound-test.js create mode 100644 ui/packages/consul-ui/tests/unit/serializers/partition-test.js rename ui/packages/consul-ui/tests/unit/services/repository/{nspace/enabled-test.js => nspace-test.js} (59%) rename ui/packages/consul-ui/tests/unit/services/repository/{nspace/disabled-test.js => partition-test.js} (52%) diff --git a/ui/packages/consul-ui/app/abilities/nspace.js b/ui/packages/consul-ui/app/abilities/nspace.js index d4471e4171..0271a5b3e5 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 4db971787c..aea6ccfffc 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 0226a276ee..b157305e52 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 0f2357a5bc..6bd10fbaa7 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 8e39d90864..5f66863579 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 b16e71eaed..3d8065c52b 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 ea71a06eeb..cb340c5080 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 0000000000..bbcdd3a728 --- /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 74addd1f48..cb89f07730 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 ab8fe8bad5..2865688773 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 e12a4d05d6..c2cc07b6fd 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 66dddd5051..518f0c0e41 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 0000000000..5ce0e436cb --- /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 6429edb3e0..a37359bdd2 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 096658810d..254e1d50f5 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 da045157dd..40d3ce3d8a 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 07cec2ce27..98d0a96305 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

- +