Move primary filed of document in first column
This commit is contained in:
parent
76ee413613
commit
68e2dcca94
3 changed files with 38 additions and 9 deletions
5
app/helpers/not-eq.js
Normal file
5
app/helpers/not-eq.js
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
import { helper } from '@ember/component/helper';
|
||||
|
||||
export default helper(function notEq([arg1, arg2] /*, named*/) {
|
||||
return arg1 !== arg2;
|
||||
});
|
||||
|
|
@ -33,16 +33,23 @@
|
|||
class='w-full'
|
||||
as |Column data|
|
||||
>
|
||||
<Column
|
||||
@name={{capitalize @model.index.primaryKey}}
|
||||
@prop={{@model.index.primaryKey}}
|
||||
@sortable={{includes @model.index.primaryKey @model.sortableAttributes}}
|
||||
/>
|
||||
{{#each-in @model.stats.fieldDistribution as |field|}}
|
||||
<Column
|
||||
@name={{capitalize field}}
|
||||
@prop={{field}}
|
||||
@sortable={{includes field @model.sortableAttributes}}
|
||||
>
|
||||
{{#let (get data field) as |value|}}
|
||||
{{if (eq (type-of value) 'object') (stringify value) value}}
|
||||
{{/let}}
|
||||
</Column>
|
||||
{{#if (not-eq field @model.index.primaryKey)}}
|
||||
<Column
|
||||
@name={{capitalize field}}
|
||||
@prop={{field}}
|
||||
@sortable={{includes field @model.sortableAttributes}}
|
||||
>
|
||||
{{#let (get data field) as |value|}}
|
||||
{{if (eq (type-of value) 'object') (stringify value) value}}
|
||||
{{/let}}
|
||||
</Column>
|
||||
{{/if}}
|
||||
{{/each-in}}
|
||||
<Column>
|
||||
{{#let
|
||||
|
|
|
|||
17
tests/integration/helpers/not-eq-test.js
Normal file
17
tests/integration/helpers/not-eq-test.js
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
import { module, test } from 'qunit';
|
||||
import { setupRenderingTest } from 'meiliadmin/tests/helpers';
|
||||
import { render } from '@ember/test-helpers';
|
||||
import { hbs } from 'ember-cli-htmlbars';
|
||||
|
||||
module('Integration | Helper | not-eq', function (hooks) {
|
||||
setupRenderingTest(hooks);
|
||||
|
||||
// TODO: Replace this with your real tests.
|
||||
test('it renders', async function (assert) {
|
||||
this.set('inputValue', '1234');
|
||||
|
||||
await render(hbs`{{not-eq this.inputValue}}`);
|
||||
|
||||
assert.dom(this.element).hasText('1234');
|
||||
});
|
||||
});
|
||||
Loading…
Reference in a new issue