Merge pull request #709 from theseyi/new-field-modification-indicator

displays the new field indicator if the field has not been modified i…
This commit is contained in:
Seyi Adebajo 2017-08-28 15:52:22 -07:00 committed by GitHub
commit cf6cd75b13
3 changed files with 16 additions and 1 deletions

View File

@ -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);
}
},

View File

@ -10,6 +10,7 @@
suggestionAuthority=suggestionAuthority
suggestionResolution=suggestionResolution
suggestion=prediction
isNewField=isNewField
onFieldIdentifierTypeChange=(action 'onFieldIdentifierTypeChange')
onFieldClassificationChange=(action 'onFieldClassificationChange')
onFieldLogicalTypeChange=(action 'onFieldLogicalTypeChange')

View File

@ -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')