Commit Graph

20 Commits

Author SHA1 Message Date
Jai Bhagat 3350f3fb11 ui: apply new qunit linting rules to tests
Async tests should use  in integrations tests.
Acceptance tests are using Mirage and can't use
since we can't know the number of assertions.
2022-01-20 10:01:35 -05:00
Jai Bhagat 3a9057a89c ui: prettify js files 2022-01-20 09:54:56 -05:00
Jai Bhagat c4bc5ab352 ui: fix auto-fixable linting errors 2022-01-20 09:46:45 -05:00
Buck Doyle 6d037633da
ui: Change global search to use fuzzy search API (#10412)
This updates the UI to use the new fuzzy search API. It’s a drop-in
replacement so the / shortcut to jump to search is preserved, and
results can be cycled through and chosen via arrow keys and the
enter key.

It doesn’t use everything returned by the API:
* deployments and evaluations: these match by id, doesn’t seem like
  people would know those or benefit from quick navigation to them
* namespaces: doesn’t seem useful as they currently function
* scaling policies
* tasks: the response doesn’t include an allocation id, which means they
  can’t be navigated to in the UI without an additional query
* CSI volumes: aren’t actually returned by the API

Since there’s no API to check the server configuration and know whether
the feature has been disabled, this adds another query in
route:application#beforeModel that acts as feature detection: if the
attempt to query fails (500), the global search field is hidden.

Upon having added another query on load, I realised that beforeModel was
being triggered any time service:router#transitionTo was being called,
which happens upon navigating to a search result, for instance, because
of refreshModel being present on the region query parameter. This PR
adds a check for transition.queryParamsOnly and skips rerunning the
onload queries (token permissions check, license check, fuzzy search
feature detection).

Implementation notes:

* there are changes to unrelated tests to ignore the on-load feature
  detection query
* some lifecycle-related guards against undefined were required to
  address failures when navigating to an allocation
* the minimum search length of 2 characters is hard-coded as there’s
  currently no way to determine min_term_length in the UI
2021-04-28 13:31:05 -05:00
Buck Doyle 07831ab455
Update to v4 of Ember Power Select (#10226)
This closes #10146.

Because of cibernox/ember-power-select#1203, which documents
the current impossibility of attaching test selectors to a
PowerSelect invocation, this uses test selectors on parent
containers instead, occasionally adding wrappers when needed.
I chose to leave the existing test selectors in the hopes that
we can return to using them eventually, but I could easily
remove them if it seems like extra noise now.

Presumably for the same reason, @class no longer works, so
this adjusts the scoping of global search CSS to preserve the style
of the search control.

I also included an update to the latest version of
ember-test-selectors, since we were far behind and I tried
that before finding the aforelinked issue.

Finally, this replaces ember-cli-uglify with ember-cli-terser to address
production build failures as described at ember-cli/ember-cli#9290.
2021-03-26 08:55:12 -05:00
Buck Doyle 7e4c746c82
Move breadcrumbs objects into shared layout object (#9576)
Various page objects had breadcrumbs and breadcrumbFor within them, this
moves those to the existing Layout page object that contains shared page objects.
2020-12-10 11:51:22 -06:00
Buck Doyle 8b5b2116ec
Fix job detail crash when recommendations off (#9269)
Without this, visiting any job detail page on Nomad OSS would crash with
an error like this:

Error: Ember Data Request GET
/v1/recommendations?job=ping%F0%9F%A5%B3&namespace=default returned a
404 Payload (text/xml)

The problem was twofold.

1. The recommendation ability didn’t include anything about checking
whether the feature was present. This adds a request to
/v1/operator/license on application load to determine which features are
present and store them in the system service. The ability now looks for
'Dynamic Application Sizing' in that feature list.

2. Second, I didn’t check permissions at all in the job-fetching or job
detail templates.
2020-11-06 08:21:38 -06:00
Michael Lange bae7002c73 Show the nomad agent version of the agent the UI is served from 2020-10-25 23:52:06 -07:00
Buck Doyle 29de8f4f76
Add component accessibility auditing and fixes (#8679)
This continues #8455 by adding accessibility audits to component integration
tests and fixing associated errors. It adds audits to existing tests rather than
adding separate ones to facilitate auditing the various permutations a
component’s rendering can go through.

It also adds linting to ensure audits happen in component tests. This
necessitated consolidating test files that were scattered.
2020-08-25 10:56:02 -05:00
Buck Doyle 7bed453de3
Add acceptance test accessibility auditing and fixes (#8455)
This introduces ember-a11y-testing to acceptance tests via a helper
wrapper that allows us to globally ignore rules that we can address
separately. It also adds fixes for the aXe rules that were failing.
2020-07-28 12:59:14 -05:00
Buck Doyle 66ab14144a
ui: Change Run Job availability based on ACLs (#5944)
This builds on API changes in #6017 and #6021 to conditionally turn off the
“Run Job” button based on the current token’s capabilities, or the capabilities
of the anonymous policy if no token is present.

If you try to visit the job-run route directly, it redirects to the job list.
2020-01-20 14:57:01 -06:00
Buck Doyle 8950626c55
UI: Update Mirage to 1.1.2 (#6166) 2019-09-26 13:47:07 -05:00
Buck Doyle 90c9b89b5e
UI: Add page titles (#5924)
This uses ember-page-title to add dynamic page titles throughout the
route hierarchy. When there’s more than one region, the current
current region is added before the final entry of “- Nomad”.
2019-07-17 15:02:58 -05:00
Michael Lange 9358713560 Speed up slow acceptance tests with shallow jobs and generally less models 2019-04-11 20:08:43 -07:00
Michael Lange 5008ab4b8d Fix page object issues with acceptance tests that couldn't be codemodded 2019-04-10 14:54:33 -07:00
Michael Lange e69d16b78d Use mirage test hooks 2019-04-10 14:54:31 -07:00
Michael Lange 517ef97343 Ember test-helpers codemod 2019-04-10 14:54:31 -07:00
Michael Lange a356ab5477 Ember QUnit Codemod 2019-04-10 14:54:30 -07:00
Michael Lange 8ca806f8f8 Use the model hook and setupController hook instead of afterModel
This is a more idiomatic way to handle the QP resetting in the
application controller.
2018-08-13 16:18:06 -07:00
Michael Lange 104e5196a6 Acceptance tests for the region switcher 2018-08-10 12:52:05 -07:00