ui: Remove unused helpers or swap for helpers in ember-string-fns (#9294)

* ui: Remove unused helpers or swap for helpers in ember-string-fns

* starts-with > string-starts-with
This commit is contained in:
John Cowen 2020-11-30 17:19:44 +00:00 committed by GitHub
parent 2a78aefc5a
commit 0f85357a6e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 6 additions and 100 deletions

View File

@ -126,7 +126,7 @@
</svg> </svg>
<svg class="resolver-inlets" viewBox={{concat '0 0 10 ' height}}> <svg class="resolver-inlets" viewBox={{concat '0 0 10 ' height}}>
{{#each routes as |item|}} {{#each routes as |item|}}
{{#if (starts-with 'resolver:' item.NextNode) }} {{#if (string-starts-with item.NextNode 'resolver:') }}
{{#let (dom-position (concat '#' item.NextNode) '.edges') as |dest|}} {{#let (dom-position (concat '#' item.NextNode) '.edges') as |dest|}}
<circle r="2.5" cx="5" cy={{add dest.y (div dest.height 2)}} /> <circle r="2.5" cx="5" cy={{add dest.y (div dest.height 2)}} />
{{/let}} {{/let}}
@ -142,7 +142,7 @@
</svg> </svg>
<svg class="splitter-inlets" viewBox={{concat '0 0 10 ' height}}> <svg class="splitter-inlets" viewBox={{concat '0 0 10 ' height}}>
{{#each routes as |item|}} {{#each routes as |item|}}
{{#if (starts-with 'splitter:' item.NextNode) }} {{#if (string-starts-with item.NextNode 'splitter:') }}
{{#let (dom-position (concat '#' item.NextNode) '.edges') as |dest|}} {{#let (dom-position (concat '#' item.NextNode) '.edges') as |dest|}}
<circle r="2.5" cx="5" cy={{add dest.y (div dest.height 2)}} /> <circle r="2.5" cx="5" cy={{add dest.y (div dest.height 2)}} />
{{/let}} {{/let}}

View File

@ -16,7 +16,7 @@ as |api|>
<BlockSlot @name="error" as |Notification|> <BlockSlot @name="error" as |Notification|>
<Notification> <Notification>
<p data-notification role="alert" class="error notification-update"> <p data-notification role="alert" class="error notification-update">
{{#if (starts-with 'duplicate intention found:' api.error.detail)}} {{#if (string-starts-with api.error.detail 'duplicate intention found:')}}
<strong>Intention exists</strong> <strong>Intention exists</strong>
An intention already exists for this Source-Destination pair. Please enter a different combination of Services, or search the intentions to edit an existing intention. An intention already exists for this Source-Destination pair. Please enter a different combination of Services, or search the intentions to edit an existing intention.
{{else}} {{else}}

View File

@ -1,10 +0,0 @@
import { helper } from '@ember/component/helper';
export function _default(params, hash) {
if (params[0] === '' || typeof params[0] === 'undefined') {
return params[1];
}
return params[0];
}
export default helper(_default);

View File

@ -1,9 +0,0 @@
import { helper } from '@ember/component/helper';
import { get } from '@ember/object';
export function difference(params, hash) {
return params[0].filter(function(item) {
return !params[1].findBy('ID', get(item, 'ID'));
});
}
export default helper(difference);

View File

@ -1,10 +0,0 @@
import { helper } from '@ember/component/helper';
export function objectEntries([obj = {}] /*, hash*/) {
if (obj == null) {
return [];
}
return Object.entries(obj);
}
export default helper(objectEntries);

View File

@ -1,7 +0,0 @@
import { helper } from '@ember/component/helper';
export function startsWith([needle, haystack = ''] /*, hash*/) {
return haystack.startsWith(needle);
}
export default helper(startsWith);

View File

@ -1,7 +1,7 @@
<div id="metadata" class="tab-section"> <div id="metadata" class="tab-section">
<div role="tabpanel"> <div role="tabpanel">
{{#if item.Meta}} {{#if item.Meta}}
<Consul::Metadata::List @items={{object-entries item.Meta}} /> <Consul::Metadata::List @items={{entries item.Meta}} />
{{else}} {{else}}
<EmptyState> <EmptyState>
<BlockSlot @name="body"> <BlockSlot @name="body">

View File

@ -3,7 +3,7 @@
{{#if item.Service.TaggedAddresses }} {{#if item.Service.TaggedAddresses }}
<TabularCollection <TabularCollection
data-test-addresses data-test-addresses
@items={{object-entries item.Service.TaggedAddresses}} as |taggedAddress index| @items={{entries item.Service.TaggedAddresses}} as |taggedAddress index|
> >
<BlockSlot @name="header"> <BlockSlot @name="header">
<th>Tag</th> <th>Tag</th>

View File

@ -17,7 +17,7 @@
<section class="metadata"> <section class="metadata">
<h3>Meta</h3> <h3>Meta</h3>
{{#if item.Meta}} {{#if item.Meta}}
<Consul::Metadata::List @items={{object-entries item.Meta}} /> <Consul::Metadata::List @items={{entries item.Meta}} />
{{else}} {{else}}
<EmptyState> <EmptyState>
<BlockSlot @name="body"> <BlockSlot @name="body">

View File

@ -1,24 +0,0 @@
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';
module('Integration | Helper | default', function(hooks) {
setupRenderingTest(hooks);
// Replace this with your real tests.
test('it renders', async function(assert) {
this.set('inputValue', '1234');
await render(hbs`{{default inputValue}}`);
assert.equal(this.element.textContent.trim(), '1234');
});
test('it renders the default value', async function(assert) {
this.set('inputValue', '');
await render(hbs`{{default inputValue '1234'}}`);
assert.equal(this.element.textContent.trim(), '1234');
});
});

View File

@ -1,17 +0,0 @@
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';
module('Integration | Helper | object-entries', function(hooks) {
setupRenderingTest(hooks);
// Replace this with your real tests.
test('it renders', async function(assert) {
this.set('inputValue', '1234');
await render(hbs`{{object-entries inputValue}}`);
assert.equal(this.element.textContent.trim(), Object.entries('1234').toString());
});
});

View File

@ -1,17 +0,0 @@
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';
module('Integration | Helper | starts-with', function(hooks) {
setupRenderingTest(hooks);
// Replace this with your real tests.
test('it renders', async function(assert) {
this.set('inputValue', '1234');
await render(hbs`{{starts-with inputValue}}`);
assert.equal(this.element.textContent.trim(), 'false');
});
});