diff --git a/.github/workflows/broken-link-check.yml b/.github/workflows/broken-link-check.yml index 2a8d77c5880f..d3dddccae795 100644 --- a/.github/workflows/broken-link-check.yml +++ b/.github/workflows/broken-link-check.yml @@ -6,7 +6,7 @@ name: Broken Link Check on: workflow_dispatch: schedule: - - cron: "0 0 * * 1" + - cron: "0 0 1 * *" jobs: linkChecker: @@ -30,4 +30,4 @@ jobs: with: title: Link Checker Report content-filepath: ./lychee/out.md - labels: report, automated issue \ No newline at end of file + labels: report, automated issue diff --git a/ui/package.json b/ui/package.json index 7ed39b1595ac..ea0babf05008 100644 --- a/ui/package.json +++ b/ui/package.json @@ -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;consul-peerings@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-peerings@0.1.0'" }, "devDependencies": { diff --git a/ui/packages/consul-hcp/app/components/consul/hcp/home/index.hbs b/ui/packages/consul-hcp/app/components/consul/hcp/home/index.hbs deleted file mode 100644 index 2e3b0f375c27..000000000000 --- a/ui/packages/consul-hcp/app/components/consul/hcp/home/index.hbs +++ /dev/null @@ -1,15 +0,0 @@ -{{! - Copyright (c) HashiCorp, Inc. - SPDX-License-Identifier: BUSL-1.1 -}} - -{{#let @list (env "CONSUL_HCP_URL") as |SNL hcpUrl|}} - {{#if (and SNL hcpUrl)}} - - {{/if}} -{{/let}} \ No newline at end of file diff --git a/ui/packages/consul-hcp/app/components/consul/hcp/home/index.test.js b/ui/packages/consul-hcp/app/components/consul/hcp/home/index.test.js deleted file mode 100644 index 0ffb7c48583f..000000000000 --- a/ui/packages/consul-hcp/app/components/consul/hcp/home/index.test.js +++ /dev/null @@ -1,80 +0,0 @@ -/** - * Copyright (c) HashiCorp, Inc. - * SPDX-License-Identifier: BUSL-1.1 - */ - -import { module, test } from 'qunit'; -import { setupRenderingTest } from 'ember-qunit'; -import { render } from '@ember/test-helpers'; -import hbs from 'htmlbars-inline-precompile'; - -import ConsulHcpHome from 'consul-ui/components/consul/hcp/home'; - -module('Integration | Component | consul hcp home', function(hooks) { - setupRenderingTest(hooks); - - test('it prints the value of CONSUL_HCP_URL', async function(assert) { - // temporary registration until we are running as separate applications - this.owner.register( - 'component:consul/hcp/home', - ConsulHcpHome - ); - // - - const Helper = this.owner.resolveRegistration('helper:env'); - this.owner.register( - 'helper:env', - class extends Helper { - compute([name, def]) { - switch(name) { - case 'CONSUL_HCP_URL': - return 'http://hcp'; - } - return super.compute(...arguments); - } - } - ); - - await render(hbs` - - - - `); - - assert.dom('[data-test-back-to-hcp]').isVisible(); - assert.dom('a').hasAttribute('href', 'http://hcp'); - - }); - - test('it does not output the Back to HCP link if CONSUL_HCP_URL is not present', async function(assert) { - // temporary registration until we are running as separate applications - this.owner.register( - 'component:consul/hcp/home', - ConsulHcpHome - ); - // - - const Helper = this.owner.resolveRegistration('helper:env'); - this.owner.register( - 'helper:env', - class extends Helper { - compute([name, def]) { - switch(name) { - case 'CONSUL_HCP_URL': - return undefined; - } - return super.compute(...arguments); - } - } - ); - - await render(hbs` - - - - `); - - assert.dom('[data-test-back-to-hcp]').doesNotExist(); - assert.dom('a').doesNotExist(); - }); -}); diff --git a/ui/packages/consul-hcp/package.json b/ui/packages/consul-hcp/package.json deleted file mode 100644 index bb35cc6f6e11..000000000000 --- a/ui/packages/consul-hcp/package.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "name": "consul-hcp", - "version": "0.1.0", - "private": true -} diff --git a/ui/packages/consul-hcp/vendor/consul-hcp/routes.js b/ui/packages/consul-hcp/vendor/consul-hcp/routes.js deleted file mode 100644 index ab573dea56ad..000000000000 --- a/ui/packages/consul-hcp/vendor/consul-hcp/routes.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (c) HashiCorp, Inc. - * SPDX-License-Identifier: BUSL-1.1 - */ - -(routes => routes({ - dc: { - show: null - }, -}))( - (json, data = (typeof document !== 'undefined' ? document.currentScript.dataset : module.exports)) => { - data[`routes`] = JSON.stringify(json); - } -); diff --git a/ui/packages/consul-hcp/vendor/consul-hcp/services.js b/ui/packages/consul-hcp/vendor/consul-hcp/services.js deleted file mode 100644 index d1c7820f7da5..000000000000 --- a/ui/packages/consul-hcp/vendor/consul-hcp/services.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (c) HashiCorp, Inc. - * SPDX-License-Identifier: BUSL-1.1 - */ - -(services => services({ - 'component:consul/hcp/home': { - class: 'consul-ui/components/consul/hcp/home', - }, -}))( - (json, data = (typeof document !== 'undefined' ? document.currentScript.dataset : module.exports)) => { - data[`services`] = JSON.stringify(json); - } -); diff --git a/ui/packages/consul-ui/app/components/hashicorp-consul/index.hbs b/ui/packages/consul-ui/app/components/hashicorp-consul/index.hbs index 58fc71920139..fc508b17c6b5 100644 --- a/ui/packages/consul-ui/app/components/hashicorp-consul/index.hbs +++ b/ui/packages/consul-ui/app/components/hashicorp-consul/index.hbs @@ -122,7 +122,7 @@ class='hds-side-nav-hide-when-minimized consul-side-nav__selector-group' as |SNL| > - + + {{/if}} +{{/let}} \ No newline at end of file diff --git a/ui/packages/consul-ui/app/components/hcp-nav-item/index.js b/ui/packages/consul-ui/app/components/hcp-nav-item/index.js new file mode 100644 index 000000000000..487984511ed2 --- /dev/null +++ b/ui/packages/consul-ui/app/components/hcp-nav-item/index.js @@ -0,0 +1,21 @@ +/** + * Copyright (c) HashiCorp, Inc. + * SPDX-License-Identifier: BUSL-1.1 + */ + +import Component from '@glimmer/component'; +import { inject as service } from '@ember/service'; + +/** + * If the user has accessed consul from HCP managed consul, we do NOT want to display the + * "HCP Consul Central↗️" link in the nav bar. As we're already displaying a BackLink to HCP. + */ +export default class HcpLinkItemComponent extends Component { + @service env; + + get shouldShowBackToHcpItem() { + const isConsulHcpUrlDefined = !!this.env.var('CONSUL_HCP_URL'); + const isConsulHcpEnabled = !!this.env.var('CONSUL_HCP_ENABLED'); + return isConsulHcpEnabled && isConsulHcpUrlDefined; + } +} diff --git a/ui/packages/consul-ui/ember-cli-build.js b/ui/packages/consul-ui/ember-cli-build.js index c483cbf678aa..653c18df5f75 100644 --- a/ui/packages/consul-ui/ember-cli-build.js +++ b/ui/packages/consul-ui/ember-cli-build.js @@ -39,7 +39,6 @@ module.exports = function (defaults, $ = process.env) { 'consul-peerings', 'consul-partitions', 'consul-nspaces', - 'consul-hcp', ].map((item) => { return { name: item, diff --git a/ui/packages/consul-ui/lib/startup/templates/body.html.js b/ui/packages/consul-ui/lib/startup/templates/body.html.js index 56b9b6d5770b..bf201960d253 100644 --- a/ui/packages/consul-ui/lib/startup/templates/body.html.js +++ b/ui/packages/consul-ui/lib/startup/templates/body.html.js @@ -75,10 +75,6 @@ ${ {{if .NamespacesEnabled}} {{end}} -{{if .HCPEnabled}} - - -{{end}} ` : ` diff --git a/ui/packages/consul-ui/package.json b/ui/packages/consul-ui/package.json index 3d5bb8441e71..2218dc819f88 100644 --- a/ui/packages/consul-ui/package.json +++ b/ui/packages/consul-ui/package.json @@ -91,7 +91,6 @@ "chalk": "^4.1.0", "clipboard": "^2.0.11", "consul-acls": "*", - "consul-hcp": "*", "consul-lock-sessions": "*", "consul-nspaces": "*", "consul-partitions": "*", diff --git a/ui/packages/consul-ui/tests/integration/components/consul/hcp/home-test.js b/ui/packages/consul-ui/tests/integration/components/consul/hcp/home-test.js deleted file mode 100644 index 99ac5e6e4a8d..000000000000 --- a/ui/packages/consul-ui/tests/integration/components/consul/hcp/home-test.js +++ /dev/null @@ -1,7 +0,0 @@ -/** - * Copyright (c) HashiCorp, Inc. - * SPDX-License-Identifier: BUSL-1.1 - */ - -// temporary import until we are running as separate applications -import 'consul-ui/components/consul/hcp/home/index.test'; diff --git a/ui/packages/consul-ui/tests/integration/components/hcp-nav-item-test.js b/ui/packages/consul-ui/tests/integration/components/hcp-nav-item-test.js new file mode 100644 index 000000000000..8fc7bfa97507 --- /dev/null +++ b/ui/packages/consul-ui/tests/integration/components/hcp-nav-item-test.js @@ -0,0 +1,76 @@ +/** + * Copyright (c) HashiCorp, Inc. + * SPDX-License-Identifier: BUSL-1.1 + */ + +import { module, test } from 'qunit'; +import { setupRenderingTest } from 'ember-qunit'; +import { render } from '@ember/test-helpers'; +import hbs from 'htmlbars-inline-precompile'; +import { EnvStub } from 'consul-ui/services/env'; + +module('Integration | Component | hcp nav item', function (hooks) { + setupRenderingTest(hooks); + + test('it prints the value of CONSUL_HCP_URL', async function (assert) { + this.owner.register( + 'service:env', + class Stub extends EnvStub { + stubEnv = { + CONSUL_HCP_URL: 'http://hcp.com', + CONSUL_HCP_ENABLED: true, + }; + } + ); + + await render(hbs` + + + + `); + + assert.dom('[data-test-back-to-hcp]').isVisible(); + assert.dom('a').hasAttribute('href', 'http://hcp.com'); + }); + + test('it does not output the Back to HCP link if CONSUL_HCP_URL is not present', async function (assert) { + this.owner.register( + 'service:env', + class Stub extends EnvStub { + stubEnv = { + CONSUL_HCP_ENABLED: true, + CONSUL_HCP_URL: undefined, + }; + } + ); + + await render(hbs` + + + + `); + + assert.dom('[data-test-back-to-hcp]').doesNotExist(); + assert.dom('a').doesNotExist(); + }); + test('it does not output the Back to HCP link if CONSUL_HCP_ENABLED is not present', async function (assert) { + this.owner.register( + 'service:env', + class Stub extends EnvStub { + stubEnv = { + CONSUL_HCP_URL: 'http://hcp.com', + CONSUL_HCP_ENABLED: undefined, + }; + } + ); + + await render(hbs` + + + + `); + + assert.dom('[data-test-back-to-hcp]').doesNotExist(); + assert.dom('a').doesNotExist(); + }); +}); diff --git a/ui/packages/consul-ui/tests/integration/components/link-to-hcp-banner-test.js b/ui/packages/consul-ui/tests/integration/components/link-to-hcp-banner-test.js index 54c7dd064eb5..8803cf616800 100644 --- a/ui/packages/consul-ui/tests/integration/components/link-to-hcp-banner-test.js +++ b/ui/packages/consul-ui/tests/integration/components/link-to-hcp-banner-test.js @@ -9,6 +9,7 @@ import { click, render } from '@ember/test-helpers'; import hbs from 'htmlbars-inline-precompile'; import Service from '@ember/service'; import sinon from 'sinon'; +import { EnvStub } from 'consul-ui/services/env'; const userDismissedBannerStub = sinon.stub(); const dismissHcpLinkBannerStub = sinon.stub(); @@ -24,16 +25,16 @@ module('Integration | Component | link-to-hcp-banner', function (hooks) { dismissHcpLinkBanner = dismissHcpLinkBannerStub; } - class EnvStub extends Service { - isEnterprise = false; - var(key) { - return key; - } - } - hooks.beforeEach(function () { this.owner.register('service:hcp-link-status', HcpLinkStatusStub); - this.owner.register('service:env', EnvStub); + this.owner.register( + 'service:env', + class Stub extends EnvStub { + stubEnv = { + isEnterprise: false, + }; + } + ); }); test('it renders banner when hcp-link-status says it should', async function (assert) { @@ -96,14 +97,16 @@ module('Integration | Component | link-to-hcp-banner', function (hooks) { }); test('it displays different banner text when consul is enterprise', async function (assert) { - class EnvStub extends Service { - isEnterprise = true; - var(key) { - return key; + this.owner.register( + 'service:env', + class Stub extends EnvStub { + stubEnv = { + isEnterprise: true, + }; } - } - this.owner.register('service:env', EnvStub); + ); this.linkData = { isLinked: false }; + await render(hbs``); assert .dom('[data-test-link-to-hcp-banner-description]') diff --git a/website/content/docs/connect/config-entries/service-resolver.mdx b/website/content/docs/connect/config-entries/service-resolver.mdx index fa92e08d6cef..4358e49b1cae 100644 --- a/website/content/docs/connect/config-entries/service-resolver.mdx +++ b/website/content/docs/connect/config-entries/service-resolver.mdx @@ -1113,7 +1113,7 @@ For examples, refer to the [failover example configurations](#service-failover). - [`namespace`](#spec-failover-targets-namespace) - [`partition`](#spec-failover-targets-partition) - [`datacenter`](#spec-failover-targets-datacenter) - - [`peer](#spec-failover-targets-peer) + - [`peer`](#spec-failover-targets-peer) ### `spec.failover.targets.service` diff --git a/website/content/docs/connect/manage-traffic/failover/sameness.mdx b/website/content/docs/connect/manage-traffic/failover/sameness.mdx index 2fb56b72d1f5..75a7e769f98b 100644 --- a/website/content/docs/connect/manage-traffic/failover/sameness.mdx +++ b/website/content/docs/connect/manage-traffic/failover/sameness.mdx @@ -92,7 +92,7 @@ When a sameness group is configured as the failover default, sameness group fail All services registered in the admin partition must failover to another member of the sameness group. You cannot choose subsets of services to use the sameness group as the failover default. If groups do not have identical services, or if a service is registered to some group members but not all members, this failover strategy may produce errors. -For more information about specifying sameness group members and failover, refer to [sameness group configuration entry reference](/consul/docs/connects/config-entries/sameness-group). +For more information about specifying sameness group members and failover, refer to [sameness group configuration entry reference](/consul/docs/connect/config-entries/sameness-group). ### Failover with a service resolver configuration entry @@ -200,4 +200,4 @@ The following example demonstrates a prepared query that can be referenced with } ``` -In prepared queries, the sameness group is mutually exclusive with the [`Failover`](/consul/api-docs/query#failover) field because the sameness group includes failover targets based on the sameness group’s members. For more information about using prepared queries, refer to [Enable dynamic DNS queries](/consul/docs/services/discovery/dns-dynamic-lookups). \ No newline at end of file +In prepared queries, the sameness group is mutually exclusive with the [`Failover`](/consul/api-docs/query#failover) field because the sameness group includes failover targets based on the sameness group’s members. For more information about using prepared queries, refer to [Enable dynamic DNS queries](/consul/docs/services/discovery/dns-dynamic-lookups).