open-nomad/ui
Michael Klein e096a0a5ab
Upgrade Ember and friends 3.28 (#12215)
* chore: upgrade forward compatible packages

* chore: v3.20.2...v3.24.0

* chore: silence string prototype extension deprecation

* refact: don't test clicking disabled button job-list

Recent test-helper upgrades will guard against clicking disabled buttons
as this is not something that real users can do. We need to change our
tests accordingly.

* fix: await async test helper `expectError`

We have to await this async test function otherwise the test's
rendering context will be torn down before we run assertions
against it.

* fix: don't try to click disabled two-step-button

Recent test-helper updates prohibit clicking disabled buttons. We need
to adapt the tests accordingly.

* fix: recommendation-accordion

Use up-to-date semantics for handling list-accordion closing
in recommendation-accordion.

* fixes toggling recommendation-accordion toggle.

* fix: simple-unless linting error application.hbs

There's no reason to use unless here - we can use if instead.

* fix: no-quoteless-attributes recommendation accordion

* fix: no-quoteless-attributes recommendation-chart

* fix: allow `unless` - global-header.hbs

This is a valid use of unless in our opinion.

* fix: allow unless in job-diff

This is not a great use for unless but we don't want to change this
behavior atm.

* fix: no-attrs-in-components list-pager

There is no need to use this.attrs in classic components. When we
will convert to glimmer we will use `@`-instead.

* fix: simple-unless job/definition

We can convert to a simple if here.

* fix: allow inline-styles stats-box component

To make linter happy.

* fix: disable no-action and no-invalid-interactive

Will be adressed in follow-up PRs.

* chore: update ember-classic-decorator to latest

* chore: upgrade ember-can to latest

* chore: upgrade ember-composable-helpers to latest

* chore: upgrade ember-concurrency

* fix: recomputation deprecation `Trigger`

schedule `do` on actions queue to work around recomputation deprecation
when triggering Trigger on `did-insert`.

* chore: upgrade ember-cli-string-helpers

* chore: upgrade ember-copy

* chore: upgrade ember-data-model-fragments

* chore: upgrade ember-deprecation-workflow

* chore: upgrade ember-inline-svg

* chore: upgrade ember-modifier

* chore: upgrade ember-truth-helpers

* chore: upgrade ember-moment & ember-cli-moment-shim

* chore: upgrade ember-power-select

* chore: upgrade ember-responsive

* chore: upgrade ember-sinon

* chore: upgrade ember-cli-mirage

For now we will stay on 2.2 - upgrades > 2.3 break the build.

* chore: upgrade 3.24.0 to 3.28.5

* fix: add missing classic decorators on adapters

* fix: missing classic decorators to serializers

* fix: don't reopen Ember.Object anymore

* fix: remove unused useNativeEvents

ember-cli-page-objects doesn't provide this method anymore

* fix: add missing attributeBindings for test-selectors

ember-test-selectors doesn't provides automatic bindings for
data-test-* attributes anymore.

* fix: classic decorator for application serializer test

* fix: remove `removeContext` from tests.

It is unneeded and ember-cli-page-objects doesn't provides
this method anymore.

* fix: remove deprecations `run.*`-invocations

* fix: `collapseWhitespace` in optimize test

* fix: make sure to load async relationship before access

* fix: dependent keys for relationship computeds

We need to add `*.isFulfilled` as dependent keys for computeds that
access async relationships.

* fix: `computed.read`-invocations use `read` instead

* chore: prettify templates

* fix: use map instead of mapBy ember-cli-page-object

Doesn't work with updated ember-cli-page-object anymore.

* fix: remove remaining deprecated `run.*`-calls

* chore: add more deprecations deprecation-workflow

* fix: `implicit-injection`-deprecation

All routes that add watchers will need to inject the store-service
as the store service is internally used in watchers.

* fix: more implicit injection deprecations

* chore: silence implicit-injection deprecation

We can tackle the deprecation when we find the time.

* fix: new linting errors after upgrade

* fix: remove merge conflicts prettierignore

* chore: upgrade to run node 12.22 when building binaries
2022-03-08 12:28:36 -05:00
..
.storybook
.vercel
app Upgrade Ember and friends 3.28 (#12215) 2022-03-08 12:28:36 -05:00
blueprints/story
config Upgrade Ember and friends 3.28 (#12215) 2022-03-08 12:28:36 -05:00
lib/bulma
mirage
public
server
stories
tests Upgrade Ember and friends 3.28 (#12215) 2022-03-08 12:28:36 -05:00
vendor
.editorconfig
.ember-cli
.env
.eslintignore Upgrade Ember and friends 3.28 (#12215) 2022-03-08 12:28:36 -05:00
.eslintrc.js Upgrade Ember and friends 3.28 (#12215) 2022-03-08 12:28:36 -05:00
.nvmrc
.prettierignore
.prettierrc
.prettierrc.js
.template-lintrc.js Upgrade Ember and friends 3.28 (#12215) 2022-03-08 12:28:36 -05:00
.watchmanconfig
DEVELOPMENT_MODE.md
README.md Upgrade Ember and friends 3.28 (#12215) 2022-03-08 12:28:36 -05:00
ember-cli-build.js Upgrade Ember and friends 3.28 (#12215) 2022-03-08 12:28:36 -05:00
jsconfig.json
package.json Upgrade Ember and friends 3.28 (#12215) 2022-03-08 12:28:36 -05:00
testem.js
vercel.json
yarn.lock Upgrade Ember and friends 3.28 (#12215) 2022-03-08 12:28:36 -05:00

README.md

Nomad UI

The official Nomad UI.

Prerequisites

This is an ember.js project, and you will need the following tools installed on your computer.

Installation

The Nomad UI gets cloned along with the rest of Nomad. To install dependencies, do the following from the root of the Nomad project:

$ cd ui
$ yarn

Running / Development

UI in development mode defaults to using fake generated data, but you can configure it to proxy a live running nomad process by setting USE_MIRAGE environment variable to false. First, make sure nomad is running. The UI, in development mode, runs independently from Nomad, so this could be an official release or a dev branch. Likewise, Nomad can be running in server mode or dev mode. As long as the API is accessible, the UI will work as expected.

You may need to reference the direct path to ember, typically in ./node_modules/.bin/ember.

The fake data in development is generated from a stable seed of 1. To generate different data, you can include a query parameter of ?faker-seed=2 or any other number in the URL. To turn off the seed and get different data with every load, use ?faker=seed=0.

When running with Mirage, the default scenario is set in config/environment.js but can be overridden with a query parameter to any of the scenarios named in mirage/scenarios/default.js with something like ?mirage-scenario=emptyCluster.

Running / Development with Vagrant

All necessary tools for UI development are installed as part of the Vagrantfile. This is primarily to make it easy to build the UI from source while working on Nomad. Due to the filesystem requirements of Broccoli (which powers Ember CLI), it is strongly discouraged to use Vagrant for developing changes to the UI.

That said, development with Vagrant is still possible, but the ember serve command requires two modifications:

  • --watch polling: This allows the vm to notice file changes made in the host environment.
  • --port 4201: The default port 4200 is not forwarded, since local development is recommended.

This makes the full command for running the UI in development mode in Vagrant:

$ ember serve --watch polling --port 4201

Running Tests

Nomad UI tests can be run independently of Nomad golang tests.

  • ember test (single run, headless browser)
  • ember test --server (watches for changes, runs in a full browser)

You can use --filter <test name> to run a targetted set of tests, e.g. ember test --filter 'allocation detail'.

In the test environment, the fake data is generated with a random seed. If you want stable data, you can set a seed while running the test server by appending &faker-seed=1 (or any other non-zero number) to the URL.

Linting

  • yarn lint
  • yarn lint:fix

Building

Typically make release or make dev-ui will be the desired build workflow, but in the event that build artifacts need to be inspected, ember build will output compiled files in ui/dist.

  • ember build (development)
  • ember build --environment production (production)

Releasing

Nomad UI releases are in lockstep with Nomad releases and are integrated into the make release toolchain.

Conventions

  • UI branches should be prefix with f-ui- for feature work and b-ui- for bug fixes. This instructs CI to skip running nomad backend tests.

Storybook UI Library

The Storybook project provides a browser to see what components and patterns are present in the application and how to use them. You can run it locally with yarn storybook after you have ember serve running. The latest version from the main branch is at nomad-storybook-and-ui.vercel.app/storybook/.

To generate a new story for a component, run ember generate story component-name. You can use the existing stories as a guide.

Troubleshooting

The UI is running, but none of the API requests are working

By default (according to the .ember-cli file), a proxy address of http://localhost:4646 is used. If you are running Nomad at a different address, you will need to override this setting when running ember serve: ember serve --proxy http://newlocation:1111.

Also, ensure that USE_MIRAGE environment variable is set to false, so the UI proxy requests to Nomad process instead of using autogenerated test data.

Nomad is running in Vagrant, but I can't access the API from my host machine

Nomad binds to 127.0.0.1:4646 by default, which is the loopback address. Try running nomad bound to 0.0.0.0: bin/nomad -bind 0.0.0.0.

Ports also need to be forwarded in the Vagrantfile. 4646 is already forwarded, but if a port other than the default is being used, that port needs to be added to the Vagrantfile and vagrant reload needs to be run.