Merge branch 'main' into feat-typed-hc

This commit is contained in:
Dharini Jeeva authored and GitHub committed 2022-02-03 13:41:16 -08:00
commit c1eaed32bd
5 files changed
+42 -25

No files matched your search

+17
View File
@@ -0,0 +1,17 @@
import HostCatalogAbility from 'api/abilities/host-catalog';
export default class OverrideHostCatalogAbility extends HostCatalogAbility {
/**
* Navigating to a resource is allowed if either list or create grants
* are present, except in the following case. Navigating to hosts directly
* from a dynamic host catalog is not allowed, since this might present more
* hosts than is practical or useful.
* @type {boolean}
*/
get canNavigate() {
const { isPlugin } = this.model;
const isHostsCollection = this.collection === 'hosts';
const isDynamicHostsNavigation = isPlugin && isHostsCollection;
return !isDynamicHostsNavigation && (this.canList || this.canCreate);
}
}
@@ -2,12 +2,12 @@
<nav.link @route='scopes.scope.host-catalogs.host-catalog.index'>
{{t 'titles.details'}}
</nav.link>
{{#if (can 'navigate model' @model collection='hosts')}}
{{#if (can 'navigate host-catalog' @model collection='hosts')}}
<nav.link @route='scopes.scope.host-catalogs.host-catalog.hosts'>
{{t 'resources.host.title_plural'}}
</nav.link>
{{/if}}
{{#if (can 'navigate model' @model collection='host-sets')}}
{{#if (can 'navigate host-catalog' @model collection='host-sets')}}
<nav.link @route='scopes.scope.host-catalogs.host-catalog.host-sets'>
{{t 'resources.host-set.title_plural'}}
</nav.link>