Merge pull request #1350 from theseyi/annotation-filters

updates visual hint for dataset compliance annotations. updates wordi…
This commit is contained in:
Seyi Adebajo 2018-08-30 16:50:54 -07:00 committed by GitHub
commit ed1344cd6e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 41 additions and 22 deletions

View File

@ -71,7 +71,6 @@ import { notificationDialogActionFactory } from 'wherehows-web/utils/notificatio
import { isMetadataObject, jsonValuesMatch } from 'wherehows-web/utils/datasets/compliance/metadata-schema'; import { isMetadataObject, jsonValuesMatch } from 'wherehows-web/utils/datasets/compliance/metadata-schema';
import { typeOf } from '@ember/utils'; import { typeOf } from '@ember/utils';
import { pick } from 'wherehows-web/utils/object'; import { pick } from 'wherehows-web/utils/object';
import { pluralize } from 'ember-inflector';
import { service } from '@ember-decorators/service'; import { service } from '@ember-decorators/service';
const { const {
@ -194,7 +193,7 @@ export default class DatasetCompliance extends Component {
}); });
/** /**
* Indicates if the first step does not need further user review to advance * Indicates if the compliance annotation does not need further user review to advance
* @type {ComputedProperty<boolean>} * @type {ComputedProperty<boolean>}
* @memberof DatasetCompliance * @memberof DatasetCompliance
*/ */
@ -295,23 +294,21 @@ export default class DatasetCompliance extends Component {
* @type {ComputedProperty<string>} * @type {ComputedProperty<string>}
* @memberof DatasetCompliance * @memberof DatasetCompliance
*/ */
fieldReviewHint: ComputedProperty<string> = computed('fieldReviewOption', 'changeSetReviewCount', function( fieldReviewHint: ComputedProperty<string> = computed('fieldReviewOption', 'foldedChangeSet.length', function(
this: DatasetCompliance this: DatasetCompliance
): string { ): string {
type TagFilterHint = { [K in TagFilter]: string }; type TagFilterHint = { [K in TagFilter]: string };
const { fieldReviewOption, changeSetReviewCount } = getProperties(this, [ const { fieldReviewOption, foldedChangeSet = [] } = getProperties(this, ['fieldReviewOption', 'foldedChangeSet']);
'fieldReviewOption',
'changeSetReviewCount'
]);
const hint = (<TagFilterHint>{ const hint = (<TagFilterHint>{
[TagFilter.showAll]: `${pluralize(changeSetReviewCount, 'field')} to be reviewed`, [TagFilter.showAll]: '',
[TagFilter.showReview]: 'It is required to select compliance info for all fields', [TagFilter.showReview]: '? Please select at least one type for each field',
[TagFilter.showSuggested]: 'Please review suggestions and provide feedback' [TagFilter.showSuggested]:
'! Please review suggestions and click thumbs up or down, based on the accuracy of the suggestion'
})[fieldReviewOption]; })[fieldReviewOption];
return changeSetReviewCount ? hint : ''; return foldedChangeSet.length ? hint : '';
}); });
/** /**
@ -519,9 +516,9 @@ export default class DatasetCompliance extends Component {
* @memberof DatasetCompliance * @memberof DatasetCompliance
*/ */
fieldReviewOptions: Array<{ value: DatasetCompliance['fieldReviewOption']; label: string }> = [ fieldReviewOptions: Array<{ value: DatasetCompliance['fieldReviewOption']; label: string }> = [
{ value: TagFilter.showAll, label: 'Show all fields' }, { value: TagFilter.showAll, label: ' Show all fields' },
{ value: TagFilter.showReview, label: 'Show required fields' }, { value: TagFilter.showReview, label: '? Show fields missing a data type' },
{ value: TagFilter.showSuggested, label: 'Show suggested fields' } { value: TagFilter.showSuggested, label: '! Show fields that need review' }
]; ];
didReceiveAttrs(): void { didReceiveAttrs(): void {
@ -887,7 +884,7 @@ export default class DatasetCompliance extends Component {
* @type {Array<IdentifierFieldWithFieldChangeSetTuple>} * @type {Array<IdentifierFieldWithFieldChangeSetTuple>}
* @memberof DatasetCompliance * @memberof DatasetCompliance
*/ */
foldedChangeSet: Array<IdentifierFieldWithFieldChangeSetTuple>; foldedChangeSet: Array<IdentifierFieldWithFieldChangeSetTuple> | void;
/** /**
* Task to retrieve platform policies and set supported policies for the current platform * Task to retrieve platform policies and set supported policies for the current platform

View File

@ -29,6 +29,23 @@
} }
} }
&__filter-count {
color: $compliance-suggestion-color;
margin-left: item-spacing(2);
}
&__subtitle {
display: flex;
align-items: center;
padding: item-spacing(2 0);
}
&__review-hint {
color: $compliance-suggestion-color;
height: item-spacing(5);
padding-left: item-spacing(5);
}
&__has-suggestions { &__has-suggestions {
color: $compliance-suggestion-color; color: $compliance-suggestion-color;
margin-left: item-spacing(2); margin-left: item-spacing(2);

View File

@ -44,11 +44,9 @@
selectionDidChange=(action "onFieldReviewChange") selectionDidChange=(action "onFieldReviewChange")
}} }}
{{#if fieldReviewHint}} <span class="dataset-compliance-fields__filter-count">
<span class="dataset-compliance-fields__has-suggestions"> {{pluralize foldedChangeSet.length "field"}}
{{fieldReviewHint}} </span>
</span>
{{/if}}
{{/if}} {{/if}}
{{#if isEditing}} {{#if isEditing}}
@ -89,6 +87,12 @@
{{/if}} {{/if}}
</section> </section>
<div class="dataset-compliance-fields__subtitle">
<div class="dataset-compliance-fields__review-hint">
{{fieldReviewHint}}
</div>
</div>
{{#if showGuidedComplianceEditMode}} {{#if showGuidedComplianceEditMode}}
{{#if foldedChangeSet.length}} {{#if foldedChangeSet.length}}
{{#dataset-table {{#dataset-table
@ -148,10 +152,11 @@
<tr class="{{if row.isReadonly 'dataset-compliance-fields--readonly'}}" ondblclick={{action <tr class="{{if row.isReadonly 'dataset-compliance-fields--readonly'}}" ondblclick={{action
row.onFragmentDblClick}}> row.onFragmentDblClick}}>
{{#row.cell}} {{#row.cell}}
{{! primary tag has an identifierType, field has a suggestion that does not match the identifierType, and suggestion resolution}}
{{#if {{#if
(and row.suggestion (and (not row.suggestionMatchesCurrentValue) (not row.suggestionResolution)))}} (and row.fieldProps.identifierType (and row.suggestion (and (not row.suggestionMatchesCurrentValue) (not row.suggestionResolution))))}}
<span class="nacho-tooltip" data-title="Has suggestions"> <span class="nacho-tooltip" data-title="Suggestion conflicts with data type">
<i class="fa fa-exclamation dataset-compliance-fields__has-suggestions__icon" <i class="fa fa-exclamation dataset-compliance-fields__has-suggestions__icon"
title="Compliance field has suggested values"></i> title="Compliance field has suggested values"></i>
</span> </span>