diff --git a/wherehows-web/app/components/dataset-compliance-row.js b/wherehows-web/app/components/dataset-compliance-row.js index 6b4da5d7d6..28120c0086 100644 --- a/wherehows-web/app/components/dataset-compliance-row.js +++ b/wherehows-web/app/components/dataset-compliance-row.js @@ -7,7 +7,7 @@ import { logicalTypesForGeneric } from 'wherehows-web/components/dataset-compliance'; -const { computed, get, getProperties } = Ember; +const { computed, get, getProperties, set } = Ember; /** * String indicating that the user affirms a suggestion * @type {string} @@ -105,6 +105,16 @@ export default DatasetTableRow.extend({ */ suggestionAuthority: computed.alias('field.suggestionAuthority'), + /** + * Checks that the field does not have a recently input value + * @type {Ember.computed} + * @return {boolean} + */ + isNewField: computed('isNewComplianceInfo', 'isModified', function() { + const { isNewComplianceInfo, isModified } = getProperties(this, ['isNewComplianceInfo', 'isModified']); + return isNewComplianceInfo && !isModified; + }), + /** * Maps the suggestion response to a string resolution * @type {Ember.computed} @@ -225,6 +235,7 @@ export default DatasetTableRow.extend({ const { onFieldIdentifierTypeChange } = this.attrs; if (typeof onFieldIdentifierTypeChange === 'function') { onFieldIdentifierTypeChange(get(this, 'field'), { value }); + set(this, 'isModified', true); } }, @@ -237,6 +248,7 @@ export default DatasetTableRow.extend({ const { onFieldLogicalTypeChange } = this.attrs; if (typeof onFieldLogicalTypeChange === 'function') { onFieldLogicalTypeChange(get(this, 'field'), { value }); + set(this, 'isModified', true); } }, @@ -248,6 +260,7 @@ export default DatasetTableRow.extend({ const { onFieldClassificationChange } = this.attrs; if (typeof onFieldClassificationChange === 'function') { onFieldClassificationChange(get(this, 'field'), { value }); + set(this, 'isModified', true); } }, diff --git a/wherehows-web/app/templates/components/dataset-compliance-row.hbs b/wherehows-web/app/templates/components/dataset-compliance-row.hbs index c433e7776e..b4976890ba 100644 --- a/wherehows-web/app/templates/components/dataset-compliance-row.hbs +++ b/wherehows-web/app/templates/components/dataset-compliance-row.hbs @@ -10,6 +10,7 @@ suggestionAuthority=suggestionAuthority suggestionResolution=suggestionResolution suggestion=prediction + isNewField=isNewField onFieldIdentifierTypeChange=(action 'onFieldIdentifierTypeChange') onFieldClassificationChange=(action 'onFieldClassificationChange') onFieldLogicalTypeChange=(action 'onFieldLogicalTypeChange') diff --git a/wherehows-web/app/templates/datasets/dataset-compliance/-dataset-compliance-entities.hbs b/wherehows-web/app/templates/datasets/dataset-compliance/-dataset-compliance-entities.hbs index 15a2f3acb4..9b44ef02ba 100644 --- a/wherehows-web/app/templates/datasets/dataset-compliance/-dataset-compliance-entities.hbs +++ b/wherehows-web/app/templates/datasets/dataset-compliance/-dataset-compliance-entities.hbs @@ -99,6 +99,7 @@ {{#each (sort-by table.sortBy table.data) as |field|}} {{#body.row field=field + isNewComplianceInfo=isNewComplianceInfo class=(if (and hasRecentSuggestions field.suggestion) "dataset-compliance-fields__has-suggestions") hasRecentSuggestions=hasRecentSuggestions onFieldLogicalTypeChange=(action 'onFieldLogicalTypeChange')