consul/ui/packages/consul-ui
hc-github-team-consul-core bf42dd6c4c
Backport of Cc 5545: Upgrade HDS packages and modifiers into release/1.17.x (#19245)
* server: run the api checks against the path without params (#19205)

* Clone proto into deepcopy correctly (#19204)

* chore: update version and nightly CI for 1.17 (#19208)

Update version file to 1.18-dev, and replace 1.13 nightly test with
1.17.

* mesh: add validation hook to proxy configuration (#19186)

* mesh: add more validations to Destinations resource (#19202)

* catalog, mesh: implement missing ACL hooks (#19143)

This change adds ACL hooks to the remaining catalog and mesh resources, excluding any computed ones. Those will for now continue using the default operator:x permissions.

It refactors a lot of the common testing functions so that they can be re-used between resources.

There are also some types that we don't yet support (e.g. virtual IPs) that this change adds ACL hooks to for future-proofing.

* NET-5073 - ProxyConfiguration: implement various connection options (#19187)

* NET-5073 - ProxyConfiguration: implement various connection options

* PR feedback - LocalConnection and InboundConnection do not affect exposed routes. configure L7 route destinations. fix connection proto sequence numbers.

* add timeout to L7 Route Destinations

* Relplat 897 copywrite bot workarounds (#19200)

Co-authored-by: Ronald Ekambi <ronekambi@gmail.com>

* mesh: add xRoute ACL hook tenancy tests (#19177)

Enhance the xRoute ACL hook tests to cover tenanted situations.
These tests will only execute in enterprise.

* resource: enforce lowercase v2 resource names (#19218)

* mesh: add DestinationPolicy ACL hook tenancy tests (#19178)

Enhance the DestinationPolicy ACL hook tests to cover tenanted situations.
These tests will only execute in enterprise.

* catalog: add FailoverPolicy ACL hook tenancy test (#19179)

* Upgrade @hashicorp/design-system-tokens to 1.9.0

* Upgrade @hashicorp/design-system-components to 1.8.1

* Upgrade @hashicorp/design-system-components and ember-in-viewport

* Explicitly install ember-modifier@4.1.0

* rename copy-button

* backport of commit 1a1b95127d

* backport of commit b7295ee1a7

* backport of commit 73089ed9ea

* backport of commit cea2ab90e6

* backport of commit 964ef50df3

* backport of commit 0fd98e7e05

* backport of commit 0519b9bd73

* backport of commit 50cbd00683

* backport of commit 838a8a9745

* backport of commit 4882490c6f

* backport of commit 42a9f03a2b

* backport of commit bbedb3fff0

* backport of commit 4576fbee1e

* backport of commit 07584faa58

* backport of commit ef39122bad

* backport of commit c77d8a06f3

* backport of commit 13e3d1cdb5

---------

Co-authored-by: R.B. Boyer <4903+rboyer@users.noreply.github.com>
Co-authored-by: Ashwin Venkatesh <ashwin@hashicorp.com>
Co-authored-by: Michael Zalimeni <michael.zalimeni@hashicorp.com>
Co-authored-by: Iryna Shustava <ishustava@users.noreply.github.com>
Co-authored-by: John Murret <john.murret@hashicorp.com>
Co-authored-by: modrake <12264057+modrake@users.noreply.github.com>
Co-authored-by: Ronald Ekambi <ronekambi@gmail.com>
Co-authored-by: Semir Patel <semir.patel@hashicorp.com>
Co-authored-by: wenincode <tyler.wendlandt@hashicorp.com>
Co-authored-by: Chris Hut <tophernuts@gmail.com>
2023-10-17 14:16:57 +00:00
..
app Backport of Cc 5545: Upgrade HDS packages and modifiers into release/1.17.x (#19245) 2023-10-17 14:16:57 +00:00
blueprints [COMPLIANCE] License changes (#18443) 2023-08-11 09:12:13 -04:00
config OSS -> CE (community edition) changes (#18517) 2023-08-22 09:46:03 -05:00
docs OSS -> CE (community edition) changes (#18517) 2023-08-22 09:46:03 -05:00
lib [COMPLIANCE] License changes (#18443) 2023-08-11 09:12:13 -04:00
mock-api feat: Change global-read-only policy to non editable (#18602) 2023-09-01 11:05:32 -07:00
node-tests/config [COMPLIANCE] License changes (#18443) 2023-08-11 09:12:13 -04:00
public
server [COMPLIANCE] License changes (#18443) 2023-08-11 09:12:13 -04:00
tests fix: remove Intention test with latency to make consul-enterprise rep… (#18654) 2023-09-01 13:44:44 -07:00
translations Backport of Cc 5545: Upgrade HDS packages and modifiers into release/1.17.x (#19245) 2023-10-17 14:16:57 +00:00
vendor [COMPLIANCE] License changes (#18443) 2023-08-11 09:12:13 -04:00
.docfy-config.js [COMPLIANCE] License changes (#18443) 2023-08-11 09:12:13 -04:00
.editorconfig
.ember-cli
.eslintignore [UI]: update Ember to 3.27 (#16227) 2023-02-10 13:32:19 -08:00
.eslintrc.js [COMPLIANCE] License changes (#18443) 2023-08-11 09:12:13 -04:00
.gitignore add scripts for testing locally consul-ui-toolkit (#16794) 2023-03-27 17:00:59 -07:00
.istanbul.yml [COMPLIANCE] License changes (#18443) 2023-08-11 09:12:13 -04:00
.prettierignore ui: chore - upgrade ember and friends (#14518) 2022-09-15 09:43:17 +01:00
.prettierrc
.prettierrc.js [COMPLIANCE] License changes (#18443) 2023-08-11 09:12:13 -04:00
.template-lintrc.js [COMPLIANCE] License changes (#18443) 2023-08-11 09:12:13 -04:00
.watchmanconfig
GNUmakefile OSS -> CE (community edition) changes (#18517) 2023-08-22 09:46:03 -05:00
README.md add scripts for testing locally consul-ui-toolkit (#16794) 2023-03-27 17:00:59 -07:00
ember-cli-build.js [COMPLIANCE] License changes (#18443) 2023-08-11 09:12:13 -04:00
package.json Backport of Cc 5545: Upgrade HDS packages and modifiers into release/1.17.x (#19245) 2023-10-17 14:16:57 +00:00
tailwind.config.js [COMPLIANCE] License changes (#18443) 2023-08-11 09:12:13 -04:00
testem.js [COMPLIANCE] License changes (#18443) 2023-08-11 09:12:13 -04:00

README.md

consul-ui

Prerequisites

You will need the following things properly installed on your computer.

Installation

  • git clone https://github.com/hashicorp/consul.git this repository
  • cd ui/packages/consul-ui

then:

To run the UI

From within ui/packages/consul-ui directory run:

  • make start

To run tests

From within ui/packages/consul-ui directory run:

  • make test-oss-view which will run the tests in Chrome

(see below and/or the testing section of the engineering docs for further detail)

Yarn Commands

Most used tooling scripts below primarily use make which will yarn install and in turn call node package scripts.

List of available project commands. yarn run <command-name>

Command Description
build:staging Builds the UI in staging mode (ready for PR preview site).
build:ci Builds the UI for CI.
build Builds the UI for production.
lint Runs all lint commands.
lint:hbs Lints hbs template files.
lint:js Lints js files.
format Runs all auto-formatters.
format:js Auto-formats js files using Prettier.
format:sass Auto-formats scss files using Prettier.
start Runs the development app on a local server using the mock API.
start:consul Runs the development app local server using a real consul instance as the backend.
start:staging Runs the staging app local server.
test Runs the ember tests in a headless browser.
test:view Runs the ember tests in a non-headless browser.
test:oss Runs only the OSS ember tests in a headless browser.
test:oss:view Runs only the OSS ember tests in a non-headless browser.
test:coverage:view Runs only the test specified for coverage in a non-headless browser.
test:node Runs tests that can't be run in ember using node.
doc:toc Automatically generates a table of contents for this README file.

Running / Development

The source code comes with a small development mode that runs enough of the consul API as a set of mocks/fixtures to be able to run the UI without having to run consul.

You can also run the UI against a normal Consul installation.

  • consul server -dev to start consul listening on http://localhost:8500
  • make start-consul to start the ember app proxying to consul (this will respect the CONSUL_HTTP_ADDR environment variable to locate the Consul installation.
  • Visit your app at http://localhost:4200.

Example:

CONSUL_HTTP_ADDR=http://10.0.0.1:8500 make start-consul

Environment Variables

See ./docs/index.mdx

Branching

We follow a ui/**/** branch naming pattern. This branch naming pattern allows front-end focused builds, such as FE tests, to run automatically in Pull Requests. Please note this only works if you are a member of the HashiCorp GitHub Org. If you are an external contributor these tests won't run and will instead be run by a member of our team during review.

Examples:

  • ui/feature/add...
  • ui/bugfix/fix...
  • ui/enhancement/update...

Contributing/Engineering Documentation

We have an in-app (only during development) component storybook and documentation site which can be visited using the Eng Docs link in the top navigation of the UI. Alternatively all of these docs are also readable via GitHub's UI, so folks can use whatever works best for them.

Browser 'Debug Utility' Functions and 'Environment' Variables

Run make start then visit http://localhost:4200/ui/docs/bookmarklets for a list of debug/engineering utilities you can use to help development of the UI under certain scenarios.

Code Generators

Many classes used in the UI can be generated with ember generators, try ember help generate for more details

Running Tests

Tests use the mock api (see ./mock-api for details), the mock-api runs automatically during testing, you don't need to run anything separately from the below commands in order for the tests to use the mock-api.

  • make test or yarn run test
  • make test-view or yarn run test:view to view the tests running in Chrome

For more guidance on running tests, see the testing section of the engineering docs.

OSS only tests can also be run using:

  • make test-oss or yarn run test:oss
  • make test-oss-view or yarn run test:oss:view to view the tests running in Chrome

Linting

make lint currently runs linting on the majority of js files and hbs files (using ember-template-lint).

See .eslintrc.js and .eslintignore for specific configuration.

Testing local changes to @hashicorp/consul-ui-toolkit

Command Description
yarn toolkit:link Similar to npm link it adds the dependency locally from yalc store
yarn toolkit:remove" It will remove package info from package.json and yarn.lock file

Building

  • make build builds the UI for production usage (env=production)
  • make build-ci builds the UI for CI/test usage (env=test)

Static files are built into ./dist

Running Tests in Parallel

You probably don't need to understand this if you are simply running some tests locally.

Alternatively, ember-exam can be used to split the tests across multiple browser instances for faster results. Most options are the same as ember test. To see a full list of options, run ember exam --help.

Note: The EMBER_EXAM_PARALLEL environment variable must be set to override the default parallel value of 1 browser instance in testem.js.

To quickly run the tests across 4 parallel browser instances:

make test-parallel

To run manually:

$ EMBER_EXAM_PARALLEL=true ./node_modules/.bin/ember exam --split <num> --parallel

More ways to split tests can be found in the ember-exam README.md.

Vercel Deploys

A Vercel preview deploy Github action triggers after each pushed change in a pull request. Vercel checks if there was changes within the UI folder in the last commit. If there are no changes the build is cancelled. If the build proceeds it will include a link to the preview deploy in your PRs feed.

If you were to push changes to the UI folder and then immediately follow it up with a change to something outside of the UI folder, the lastest Vercel build will be ignored. Because of this, the preview link will not get posted to the PR feed even if the original Vercel build completes. If that is the case, you may browse the Vercel deploys for the original build.

Another scenario to watch for is when you rebase a series of commits, but the last commit is outside of the UI folder. Doing this will not trigger a new Vercel deploy as the last commit doesn't have any changes in the UI folder.