open-nomad/ui/app
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
..
abilities Fix job detail crash when recommendations off (#9269) 2020-11-06 08:21:38 -06:00
adapters Add job version revert buttons (#10336) 2021-04-20 08:33:16 -05:00
components ui: Change global search to use fuzzy search API (#10412) 2021-04-28 13:31:05 -05:00
controllers ui: Change global search to use fuzzy search API (#10412) 2021-04-28 13:31:05 -05:00
helpers Use common helpers and utils for formatting hertz 2021-03-31 09:29:14 -07:00
initializers Remove test code 2020-05-26 14:54:59 -07:00
mixins Update Ember/Ember CLI to 3.20 (#9641) 2021-02-17 15:01:44 -06:00
models Add job version revert buttons (#10336) 2021-04-20 08:33:16 -05:00
modifiers Quick window resize modifier 2020-10-15 02:54:13 -07:00
routes ui: Change global search to use fuzzy search API (#10412) 2021-04-28 13:31:05 -05:00
serializers Update Ember/Ember CLI to 3.20 (#9641) 2021-02-17 15:01:44 -06:00
services ui: Change global search to use fuzzy search API (#10412) 2021-04-28 13:31:05 -05:00
styles ui: Change global search to use fuzzy search API (#10412) 2021-04-28 13:31:05 -05:00
templates ui: Change global search to use fuzzy search API (#10412) 2021-04-28 13:31:05 -05:00
utils Add exchange of one-time token on UI load (#10066) 2021-04-01 13:21:30 -05:00
app.js Update Ember/Ember CLI to 3.20 (#9641) 2021-02-17 15:01:44 -06:00
breakpoints.js Change breakpoints to match Nomad/Bulma widths 2019-04-10 10:34:10 -05:00
index.html sync 2017-09-19 10:08:23 -05:00
router.js Update Ember/Ember CLI to 3.20 (#9641) 2021-02-17 15:01:44 -06:00