DSS-6551 Adds table components for organizations and group ids: There is definitely potential to refactor this to one wrapper component that is instantiated 3 times with different props, this is however already a container component for dataset-table.

This commit is contained in:
Seyi Adebajo 2017-03-27 18:28:41 -07:00 committed by Mars Lan
parent e3ccb71fb2
commit 03270406bb
6 changed files with 180 additions and 0 deletions

View File

@ -0,0 +1,13 @@
import Ember from 'ember';
export default Ember.Component.extend({
actions: {
onFormatChange() {
this.sendAction('onFormatChange', ...arguments);
},
onPrivacyChange() {
this.sendAction('onPrivacyChange', 'group', ...arguments);
}
}
});

View File

@ -0,0 +1,13 @@
import Ember from 'ember';
export default Ember.Component.extend({
actions: {
onFormatChange() {
this.sendAction('onFormatChange', ...arguments);
},
onPrivacyChange() {
this.sendAction('onPrivacyChange', 'organisation', ...arguments);
}
}
});

View File

@ -0,0 +1,52 @@
{{#dataset-table fields=fields
sortColumnWithName=sortColumnWithName
filterBy=filterBy
sortDirection=sortDirection
searchTerm=searchTerm as |table|}}
<caption>
<input
type="text"
title="Filter fields"
placeholder="Filter fields"
value="{{table.searchTerm}}"
oninput={{action table.filterDidChange value="target.value"}}>
</caption>
{{#table.head as |head|}}
{{#head.column columnName="identifierField"}}Field{{/head.column}}
{{#head.column columnName="dataType"}}Data Type{{/head.column}}
{{#head.column}}Group Identifier?{{/head.column}}
{{#head.column}}Field Format{{/head.column}}
{{/table.head}}
{{#table.body as |body|}}
{{#each
(slice table.beginOffset table.endOffset (sort-by table.sortBy table.data)) as |field|}}
{{#body.row as |row|}}
{{#row.cell}}
{{field.identifierField}}
{{/row.cell}}
{{#row.cell}}
{{field.dataType}}
{{/row.cell}}
{{#row.cell}}
{{input type="checkbox" checked=field.hasPrivacyData change=(action "onPrivacyChange" field)}}
{{/row.cell}}
{{#row.cell}}
{{ember-selector values=fieldFormats
disabled=(not field.hasPrivacyData)
selected=field.logicalType
selectionDidChange=(action "onFormatChange" field)}}
{{/row.cell}}
{{/body.row}}
{{/each}}
{{/table.body}}
{{#table.foot}}
{{dataset-table-pager data=table.data
page=table.page
limit=table.limit
pageLengths=table.pageLengths
beginOffset=table.beginOffset
endOffset=table.endOffset
onLimitChanged=table.onLimitChanged
onPageChanged=table.onPageChanged}}
{{/table.foot}}
{{/dataset-table}}

View File

@ -0,0 +1,52 @@
{{#dataset-table fields=fields
sortColumnWithName=sortColumnWithName
filterBy=filterBy
sortDirection=sortDirection
searchTerm=searchTerm as |table|}}
<caption>
<input
type="text"
title="Filter fields"
placeholder="Filter fields"
value="{{table.searchTerm}}"
oninput={{action table.filterDidChange value="target.value"}}>
</caption>
{{#table.head as |head|}}
{{#head.column columnName="identifierField"}}Field{{/head.column}}
{{#head.column columnName="dataType"}}Data Type{{/head.column}}
{{#head.column}}Organization Identifier?{{/head.column}}
{{#head.column}}Field Format{{/head.column}}
{{/table.head}}
{{#table.body as |body|}}
{{#each
(slice table.beginOffset table.endOffset (sort-by table.sortBy table.data)) as |field|}}
{{#body.row as |row|}}
{{#row.cell}}
{{field.identifierField}}
{{/row.cell}}
{{#row.cell}}
{{field.dataType}}
{{/row.cell}}
{{#row.cell}}
{{input type="checkbox" checked=field.hasPrivacyData change=(action "onPrivacyChange" field)}}
{{/row.cell}}
{{#row.cell}}
{{ember-selector values=fieldFormats
disabled=(not field.hasPrivacyData)
selected=field.logicalType
selectionDidChange=(action "onFormatChange" field)}}
{{/row.cell}}
{{/body.row}}
{{/each}}
{{/table.body}}
{{#table.foot}}
{{dataset-table-pager data=table.data
page=table.page
limit=table.limit
pageLengths=table.pageLengths
beginOffset=table.beginOffset
endOffset=table.endOffset
onLimitChanged=table.onLimitChanged
onPageChanged=table.onPageChanged}}
{{/table.foot}}
{{/dataset-table}}

View File

@ -0,0 +1,25 @@
import { moduleForComponent, test } from 'ember-qunit';
import hbs from 'htmlbars-inline-precompile';
moduleForComponent('dataset-table-group-compliance', 'Integration | Component | dataset table group compliance', {
integration: true
});
test('it renders', function(assert) {
// Set any properties with this.set('myProperty', 'value');
// Handle any actions with this.on('myAction', function(val) { ... });
this.render(hbs`{{dataset-table-group-compliance}}`);
assert.equal(this.$().text().trim(), '');
// Template block usage:
this.render(hbs`
{{#dataset-table-group-compliance}}
template block text
{{/dataset-table-group-compliance}}
`);
assert.equal(this.$().text().trim(), 'template block text');
});

View File

@ -0,0 +1,25 @@
import { moduleForComponent, test } from 'ember-qunit';
import hbs from 'htmlbars-inline-precompile';
moduleForComponent('dataset-table-org-compliance', 'Integration | Component | dataset table org compliance', {
integration: true
});
test('it renders', function(assert) {
// Set any properties with this.set('myProperty', 'value');
// Handle any actions with this.on('myAction', function(val) { ... });
this.render(hbs`{{dataset-table-org-compliance}}`);
assert.equal(this.$().text().trim(), '');
// Template block usage:
this.render(hbs`
{{#dataset-table-org-compliance}}
template block text
{{/dataset-table-org-compliance}}
`);
assert.equal(this.$().text().trim(), 'template block text');
});