open-consul/ui/packages/consul-ui
John Cowen d157c63fe4
ui: Don't show the CRD menu for read-only intentions (#11149)
* ui: Don't show the CRD menu for read-only intentions

The UI bug here manifests itself only when a user/token is configured to have read-only access to intentions. Instead of only letting folks click to see a read only page of the intention, we would show an additional message saying that the intention was read-only due to it being 'Managed by [a kubernetes] CRD'. Whilst the intention was still read only, this extra message was still confusing for users.

This PR fixes up the conditional logic and further moves the logic to use ember-can - looking at the history of the files in question, this bug snuck itself in partly due to it being 'permission-y type stuff' previous to using ember-can and when something being editable or not was nothing to do with ACLs. Then we moved to start using ember-can without completely realising what IsEditable previously meant. So overall the code here is a tiny bit clearer/cleaner by adding a proper can view CRD intention instead of overloading the idea of 'editability'.
2021-09-27 17:19:32 +01:00
..
app ui: Don't show the CRD menu for read-only intentions (#11149) 2021-09-27 17:19:32 +01:00
blueprints ui: Partitions Application Layer (#11017) 2021-09-15 19:50:11 +01:00
config ui: Allow disabling of sourcemaps via env var (#10491) 2021-07-06 16:57:53 +01:00
docs ui: Add initial i18n docs page (#10888) 2021-09-22 18:51:39 +01:00
lib ui: Remove legacy ACLs (#11096) 2021-09-22 18:32:51 +01:00
mock-api ui: Add initial partition support to intentions (#11129) 2021-09-24 17:31:58 +01:00
node-tests/config ui: Add Admin Partition feature flag (#10051) 2021-04-22 12:22:40 +01:00
public Update brand assets (#10081) 2021-05-03 16:19:09 +01:00
server ui: Remove legacy ACLs (#11096) 2021-09-22 18:32:51 +01:00
tests ui: Adds a set of basic unit tests for abilities (#11132) 2021-09-27 16:46:26 +01:00
translations ui: Hide all metrics for ingress gateway services (#10858) 2021-08-26 14:08:31 -04:00
vendor ui: Remove legacy ACLs (#11096) 2021-09-22 18:32:51 +01:00
.dev.eslintrc.js ui: Move to Workspaced Structure (#8994) 2020-10-21 15:23:16 +01:00
.docfy-config.js ui: CopyButton amends (#10511) 2021-07-06 16:56:36 +01:00
.editorconfig ui: Move to Workspaced Structure (#8994) 2020-10-21 15:23:16 +01:00
.ember-cli ui: Default to glimmer components (#9121) 2020-11-06 14:54:44 +00:00
.eslintignore ui: Move linting to the `node:test` script (#9385) 2020-12-14 15:28:35 +00:00
.eslintrc.js ui: Remove storybook, add docfy (#9831) 2021-03-08 12:22:01 +00:00
.istanbul.yml ui: Move to Workspaced Structure (#8994) 2020-10-21 15:23:16 +01:00
.nvmrc ui: Bump node to v14 (#10238) 2021-05-18 16:30:19 +01:00
.prettierrc ui: Move to Workspaced Structure (#8994) 2020-10-21 15:23:16 +01:00
.template-lintrc.js ui: Search/filtering 'Filtered by:' search status (#9442) 2021-01-25 18:13:54 +00:00
.watchmanconfig ui: Move to Workspaced Structure (#8994) 2020-10-21 15:23:16 +01:00
GNUmakefile ui: Move linting to the `node:test` script (#9385) 2020-12-14 15:28:35 +00:00
README.md ui: Enable specifying additional docfy config as json (#10464) 2021-06-25 10:41:41 +01:00
ember-cli-build.js ui: Remove legacy ACLs (#11096) 2021-09-22 18:32:51 +01:00
package.json ui: Remove legacy ACLs (#11096) 2021-09-22 18:32:51 +01:00
testem.js ui: Add an optional environment variable to control how testem starts (#9793) 2021-02-22 14:53:05 +00: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
  • make start or yarn && yarn start

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

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.

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)

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

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.

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

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.