mirror of https://github.com/hashicorp/consul
Browse Source
* Create service/exist helper to be used in ListCollection list items * Make only existing services in Upstreams linkabled with hover effectpull/8013/head
Kenia
5 years ago
committed by
John Cowen
5 changed files with 46 additions and 3 deletions
@ -1,6 +1,15 @@
|
||||
<EmberNativeScrollable @tagName="ul" @content-size={{_contentSize}} @scroll-left={{_scrollLeft}} @scroll-top={{_scrollTop}} @scrollChange={{action "scrollChange"}} @clientSizeChange={{action "clientSizeChange"}}> |
||||
<EmberNativeScrollable |
||||
@tagName="ul" |
||||
@content-size={{_contentSize}} |
||||
@scroll-left={{_scrollLeft}} |
||||
@scroll-top={{_scrollTop}} |
||||
@scrollChange={{action "scrollChange"}} |
||||
@clientSizeChange={{action "clientSizeChange"}} |
||||
> |
||||
<li></li> |
||||
{{~#each _cells as |cell|~}} |
||||
<li onclick={{action 'click'}} style={{{cell.style}}}>{{yield cell.item cell.index }}</li> |
||||
<li onclick={{action 'click'}} style={{{cell.style}}} class={{if (service/exists cell.item) 'linkable' }}> |
||||
{{yield cell.item cell.index }} |
||||
</li> |
||||
{{~/each~}} |
||||
</EmberNativeScrollable> |
@ -0,0 +1,11 @@
|
||||
import { helper } from '@ember/component/helper'; |
||||
|
||||
export function serviceExists([item], hash) { |
||||
if (typeof item.InstanceCount === 'undefined') { |
||||
return false; |
||||
} |
||||
|
||||
return item.InstanceCount > 0; |
||||
} |
||||
|
||||
export default helper(serviceExists); |
@ -0,0 +1,17 @@
|
||||
import { module, test } from 'qunit'; |
||||
import { setupRenderingTest } from 'ember-qunit'; |
||||
import { render } from '@ember/test-helpers'; |
||||
import { hbs } from 'ember-cli-htmlbars'; |
||||
|
||||
module('Integration | Helper | service/exists', function(hooks) { |
||||
setupRenderingTest(hooks); |
||||
|
||||
// Replace this with your real tests.
|
||||
test('it renders', async function(assert) { |
||||
this.set('inputValue', { InstanceCount: 3 }); |
||||
|
||||
await render(hbs`{{service/exists inputValue}}`); |
||||
|
||||
assert.equal(this.element.textContent.trim(), 'true'); |
||||
}); |
||||
}); |
Loading…
Reference in new issue