a509655d0b
This PR mainly adds partition to our HTTP adapter. Additionally and perhaps most importantly, we've also taken the opportunity to move our 'conditional namespaces' deeper into the app. The reason for doing this was, we like that namespaces should be thought of as required instead of conditional, 'special' things and would like the same thinking to be applied to partitions. Now, instead of using code throughout the app throughout the adapters to add/remove namespaces or partitions depending on whether they are enabled or not. As a UI engineer you just pretend that namespaces and partitions are always enabled, and we remove them for you deeper in the app, out of the way of you forgetting to treat these properties as a special case. Notes: Added a PartitionAbility while we were there (not used as yet) Started to remove the CONSTANT variables we had just for property names. I prefer that our adapters are as readable and straightforwards as possible, it just looks like HTTP. We'll probably remove our formatDatacenter method we use also at some point, it was mainly too make it look the same as our previous formatNspace, but now we don't have that, it instead now looks different! We enable parsing of partition in the UIs URL, but this is feature flagged so still does nothing just yet. All of the test changes were related to the fact that we were treating client.url as a function rather than a method, and now that we reference this in client.url (etc) it needs binding to client. |
||
---|---|---|
.. | ||
app | ||
blueprints | ||
config | ||
docs | ||
lib | ||
mock-api | ||
node-tests/config | ||
public | ||
server | ||
tests | ||
translations | ||
vendor | ||
.dev.eslintrc.js | ||
.docfy-config.js | ||
.editorconfig | ||
.ember-cli | ||
.eslintignore | ||
.eslintrc.js | ||
.istanbul.yml | ||
.nvmrc | ||
.prettierrc | ||
.template-lintrc.js | ||
.watchmanconfig | ||
GNUmakefile | ||
README.md | ||
ember-cli-build.js | ||
package.json | ||
testem.js |
README.md
consul-ui
Prerequisites
You will need the following things properly installed on your computer.
-
Node.js (with npm)
Installation
git clone https://github.com/hashicorp/consul.git
this repositorycd ui/packages/consul-ui
make start
oryarn && 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.
make start
oryarn start
to start the ember app- Visit your app at http://localhost:4200.
You can also run the UI against a normal Consul installation.
consul server -dev
to start consul listening on http://localhost:8500make start-consul
to start the ember app proxying toconsul
(this will respect theCONSUL_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
oryarn run test
make test-view
oryarn run test:view
to view the tests running in Chrome
OSS only tests can also be run using:
make test-oss
oryarn run test:oss
make test-oss-view
oryarn 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.