open-nomad/ui/app/routes
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
..
allocations Always show the file browser for allocations and tasks. 2020-10-25 22:24:56 -07:00
clients Create new monitor route for clients 2020-06-16 10:23:35 -07:00
csi Add linting for classic decorator (#8182) 2020-06-22 10:48:53 -05:00
exec/task-group Add massaged results of class codemod 2020-06-10 16:18:42 -05:00
jobs Add job version revert buttons (#10336) 2021-04-20 08:33:16 -05:00
optimize Add redirect to parent when filter excludes all 2020-11-10 09:38:46 -06:00
servers Refactor the servers/server pages to match the subnav style of nested pages 2020-06-16 10:23:36 -07:00
.gitkeep sync 2017-09-19 10:08:23 -05:00
application.js ui: Change global search to use fuzzy search API (#10412) 2021-04-28 13:31:05 -05:00
clients.js Remove superfluous uses of Object.freeze 2020-06-15 10:15:11 -05:00
exec.js Add manually-converted classes 2020-06-15 10:14:26 -05:00
index.js Add massaged results of class codemod 2020-06-10 16:18:42 -05:00
jobs.js Remove superfluous uses of Object.freeze 2020-06-15 10:15:11 -05:00
not-found.js Add massaged results of class codemod 2020-06-10 16:18:42 -05:00
optimize.js Add DAS subroute and copy button (#9201) 2020-11-04 12:22:24 -06:00
servers.js Remove superfluous uses of Object.freeze 2020-06-15 10:15:11 -05:00
topology.js Forbidden state for the topo viz 2020-11-04 12:32:22 -08:00