open-nomad/ui/app/templates/components/global-header.hbs

61 lines
1.6 KiB
Handlebars
Raw Normal View History

<nav class="navbar is-primary" title="navigation">
<div class="navbar-brand">
<span
data-test-header-gutter-toggle
class="gutter-toggle"
aria-label="menu"
onclick={{action this.onHamburgerClick}}
>
<HamburgerMenu />
2018-07-26 00:06:39 +00:00
</span>
<LinkTo @route="jobs" class="navbar-item is-logo" aria-label="Home">
<NomadLogo />
</LinkTo>
2017-09-19 14:47:10 +00:00
</div>
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 18:31:05 +00:00
{{#if this.system.fuzzySearchEnabled}}
{{#unless (media "isMobile")}}
<GlobalSearch::Control />
{{/unless}}
{{/if}}
<div class="navbar-end">
{{#if this.config.APP.showStorybookLink}}
<a href="/storybook/" class="navbar-item">
Storybook
</a>
{{/if}}
{{#if this.system.agent.config.UI.Consul.BaseUIURL}}
<a
data-test-header-consul-link
href={{this.system.agent.config.UI.Consul.BaseUIURL}}
class="navbar-item"
>
Consul
</a>
{{/if}}
{{#if this.system.agent.config.UI.Vault.BaseUIURL}}
<a
data-test-header-vault-link
href={{this.system.agent.config.UI.Vault.BaseUIURL}}
class="navbar-item"
>
Vault
</a>
{{/if}}
<a href="https://nomadproject.io/docs" class="navbar-item">
Documentation
</a>
<LinkTo @route="settings.tokens" class="navbar-item">
ACL Tokens
</LinkTo>
2017-09-19 14:47:10 +00:00
</div>
</nav>
<div class="navbar is-secondary">
2018-08-03 17:11:47 +00:00
<div class="navbar-item is-gutter">
<RegionSwitcher @decoration="is-outlined" />
2018-08-03 17:11:47 +00:00
</div>
<nav class="breadcrumb is-large" title="breadcrumb navigation">
<ul>
2017-09-19 14:47:10 +00:00
{{yield}}
</ul>
</nav>
</div>