pass emptyActions through list view component and render into EmptyState

This commit is contained in:
Matthew Irish 2018-11-15 16:47:07 -06:00
parent d72c7db57e
commit 9e280fb198
6 changed files with 23 additions and 6 deletions

View file

@ -0,0 +1,2 @@
import OuterHTML from './outer-html';
export default OuterHTML.extend();

View file

@ -6,6 +6,9 @@ export default Component.extend({
tagName: '',
items: null,
itemNoun: 'item',
// the dasherized name of a component to render
// in the EmptyState component if there are no items in items.length
emptyActions: '',
emptyTitle: computed('itemNoun', function() {
let items = pluralize(this.get('itemNoun'));

View file

@ -0,0 +1,7 @@
{{#link-to "vault.cluster.access.namespaces.create"}}
Create namespace
{{/link-to}}
<LearnLink @path="/vault/security/namespaces">
Learn More
</LearnLink>

View file

@ -9,9 +9,13 @@
</p>
{{/if}}
{{#if hasBlock}}
<div class="empty-state-actions">
{{yield}}
</div>
<div class="empty-state-actions">
{{yield}}
</div>
{{else if emptyActions}}
<div class="empty-state-actions">
{{component emptyActions}}
</div>
{{/if}}
</div>
</div>

View file

@ -6,7 +6,8 @@
</div>
{{else}}
<EmptyState
@title={{emptyTitle}}
@message={{emptyMessage}}
@title={{this.emptyTitle}}
@message={{this.emptyMessage}}
@emptyActions={{this.emptyActions}}
/>
{{/if}}

View file

@ -12,7 +12,7 @@
{{/link-to}}
</p.levelRight>
</PageHeader>
<ListView @items={{model}} @itemNoun="namespace" as |list|>
<ListView @items={{model}} @itemNoun="namespace" @emptyActions="empty-action-namespaces" as |list|>
<ListItem as |Item|>
<Item.content>
{{list.item.id}}