diff --git a/wherehows-web/app/components/dataset-table-group-compliance.js b/wherehows-web/app/components/dataset-table-group-compliance.js new file mode 100644 index 0000000000..efc49d84d8 --- /dev/null +++ b/wherehows-web/app/components/dataset-table-group-compliance.js @@ -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); + } + } +}); diff --git a/wherehows-web/app/components/dataset-table-org-compliance.js b/wherehows-web/app/components/dataset-table-org-compliance.js new file mode 100644 index 0000000000..4f4da451a4 --- /dev/null +++ b/wherehows-web/app/components/dataset-table-org-compliance.js @@ -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); + } + } +}); diff --git a/wherehows-web/app/templates/components/dataset-table-group-compliance.hbs b/wherehows-web/app/templates/components/dataset-table-group-compliance.hbs new file mode 100644 index 0000000000..dc682beb42 --- /dev/null +++ b/wherehows-web/app/templates/components/dataset-table-group-compliance.hbs @@ -0,0 +1,52 @@ +{{#dataset-table fields=fields + sortColumnWithName=sortColumnWithName + filterBy=filterBy + sortDirection=sortDirection + searchTerm=searchTerm as |table|}} + + + + {{#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}} diff --git a/wherehows-web/app/templates/components/dataset-table-org-compliance.hbs b/wherehows-web/app/templates/components/dataset-table-org-compliance.hbs new file mode 100644 index 0000000000..4e6b78432a --- /dev/null +++ b/wherehows-web/app/templates/components/dataset-table-org-compliance.hbs @@ -0,0 +1,52 @@ +{{#dataset-table fields=fields + sortColumnWithName=sortColumnWithName + filterBy=filterBy + sortDirection=sortDirection + searchTerm=searchTerm as |table|}} + + + + {{#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}} diff --git a/wherehows-web/tests/integration/components/dataset-table-group-compliance-test.js b/wherehows-web/tests/integration/components/dataset-table-group-compliance-test.js new file mode 100644 index 0000000000..c6bbbc687c --- /dev/null +++ b/wherehows-web/tests/integration/components/dataset-table-group-compliance-test.js @@ -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'); +}); diff --git a/wherehows-web/tests/integration/components/dataset-table-org-compliance-test.js b/wherehows-web/tests/integration/components/dataset-table-org-compliance-test.js new file mode 100644 index 0000000000..efd9717725 --- /dev/null +++ b/wherehows-web/tests/integration/components/dataset-table-org-compliance-test.js @@ -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'); +});