mirror of
https://github.com/datahub-project/datahub.git
synced 2025-07-23 17:39:59 +00:00
Merge pull request #1396 from theseyi/compliance-completed-filter
adds completed / passing tags filter to compliance entities table
This commit is contained in:
commit
37802e280b
@ -2,7 +2,7 @@ import Component from '@ember/component';
|
|||||||
import { computed, set, get, setProperties, getProperties, getWithDefault } from '@ember/object';
|
import { computed, set, get, setProperties, getProperties, getWithDefault } from '@ember/object';
|
||||||
import ComputedProperty, { not, or, alias } from '@ember/object/computed';
|
import ComputedProperty, { not, or, alias } from '@ember/object/computed';
|
||||||
import { run, schedule, next } from '@ember/runloop';
|
import { run, schedule, next } from '@ember/runloop';
|
||||||
import { classify } from '@ember/string';
|
import { classify, htmlSafe } from '@ember/string';
|
||||||
import { assert } from '@ember/debug';
|
import { assert } from '@ember/debug';
|
||||||
import { IDatasetView } from 'wherehows-web/typings/api/datasets/dataset';
|
import { IDatasetView } from 'wherehows-web/typings/api/datasets/dataset';
|
||||||
import { IDataPlatform } from 'wherehows-web/typings/api/list/platforms';
|
import { IDataPlatform } from 'wherehows-web/typings/api/list/platforms';
|
||||||
@ -39,7 +39,8 @@ import {
|
|||||||
TagFilter,
|
TagFilter,
|
||||||
tagSuggestionNeedsReview,
|
tagSuggestionNeedsReview,
|
||||||
ComplianceEdit,
|
ComplianceEdit,
|
||||||
buildFieldSuggestionsLookupTable
|
buildFieldSuggestionsLookupTable,
|
||||||
|
tagsPassingReview
|
||||||
} from 'wherehows-web/constants';
|
} from 'wherehows-web/constants';
|
||||||
import { arrayFilter, arrayMap, arrayReduce, isListUnique, iterateArrayAsync } from 'wherehows-web/utils/array';
|
import { arrayFilter, arrayMap, arrayReduce, isListUnique, iterateArrayAsync } from 'wherehows-web/utils/array';
|
||||||
import { identity, noop } from 'wherehows-web/utils/helpers/functions';
|
import { identity, noop } from 'wherehows-web/utils/helpers/functions';
|
||||||
@ -323,7 +324,8 @@ export default class DatasetCompliance extends Component {
|
|||||||
[TagFilter.showAll]: '',
|
[TagFilter.showAll]: '',
|
||||||
[TagFilter.showReview]: '? Please select at least one type for each field',
|
[TagFilter.showReview]: '? Please select at least one type for each field',
|
||||||
[TagFilter.showSuggested]:
|
[TagFilter.showSuggested]:
|
||||||
'! Please review suggestions and click thumbs up or down, based on the accuracy of the suggestion'
|
'! Please review suggestions and click thumbs up or down, based on the accuracy of the suggestion',
|
||||||
|
[TagFilter.showCompleted]: ''
|
||||||
})[fieldReviewOption];
|
})[fieldReviewOption];
|
||||||
|
|
||||||
return foldedChangeSet.length ? hint : '';
|
return foldedChangeSet.length ? hint : '';
|
||||||
@ -530,13 +532,15 @@ export default class DatasetCompliance extends Component {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* A list of ui values and labels for review filter drop-down
|
* A list of ui values and labels for review filter drop-down
|
||||||
* @type {Array<{value: string, label:string}>}
|
* @type {Array<{value: TagFilter, label:string}>}
|
||||||
* @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 fields missing a data type' },
|
{ value: TagFilter.showReview, label: '? Show fields missing a data type' },
|
||||||
{ value: TagFilter.showSuggested, label: '! Show fields that need review' }
|
{ value: TagFilter.showSuggested, label: '! Show fields that need review' },
|
||||||
|
//@ts-ignore htmlSafe type definition is incorrect in @types/ember contains TODO: to return Handlebars.SafeStringStatic
|
||||||
|
{ value: TagFilter.showCompleted, label: <string>htmlSafe(`✓ Show completed fields`) }
|
||||||
];
|
];
|
||||||
|
|
||||||
didReceiveAttrs(): void {
|
didReceiveAttrs(): void {
|
||||||
@ -820,11 +824,12 @@ export default class DatasetCompliance extends Component {
|
|||||||
[TagFilter.showAll]: identity,
|
[TagFilter.showAll]: identity,
|
||||||
[TagFilter.showReview]: tagsRequiringReview(complianceDataTypes, {
|
[TagFilter.showReview]: tagsRequiringReview(complianceDataTypes, {
|
||||||
checkSuggestions: false,
|
checkSuggestions: false,
|
||||||
suggestionConfidenceThreshold
|
suggestionConfidenceThreshold: 0
|
||||||
}),
|
}),
|
||||||
[TagFilter.showSuggested]: arrayFilter((tag: IComplianceChangeSet) =>
|
[TagFilter.showSuggested]: arrayFilter((tag: IComplianceChangeSet) =>
|
||||||
tagSuggestionNeedsReview({ ...tag, suggestionConfidenceThreshold })
|
tagSuggestionNeedsReview({ ...tag, suggestionConfidenceThreshold })
|
||||||
)
|
),
|
||||||
|
[TagFilter.showCompleted]: tagsPassingReview(complianceDataTypes)
|
||||||
})[get(this, 'fieldReviewOption')];
|
})[get(this, 'fieldReviewOption')];
|
||||||
|
|
||||||
return changeSetFilter(changeSet);
|
return changeSetFilter(changeSet);
|
||||||
|
@ -29,6 +29,7 @@ import { IDatasetColumn } from 'wherehows-web/typings/api/datasets/columns';
|
|||||||
import { ComplianceFieldIdValue } from 'wherehows-web/constants/datasets/compliance';
|
import { ComplianceFieldIdValue } from 'wherehows-web/constants/datasets/compliance';
|
||||||
import { isHighConfidenceSuggestion } from 'wherehows-web/utils/datasets/compliance-suggestions';
|
import { isHighConfidenceSuggestion } from 'wherehows-web/utils/datasets/compliance-suggestions';
|
||||||
import { validateRegExp } from 'wherehows-web/utils/validators/regexp';
|
import { validateRegExp } from 'wherehows-web/utils/validators/regexp';
|
||||||
|
import { not } from 'wherehows-web/utils/helpers/functions';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines a map of values for the compliance policy on a dataset
|
* Defines a map of values for the compliance policy on a dataset
|
||||||
@ -63,7 +64,8 @@ const changeSetReviewableAttributeTriggers =
|
|||||||
enum TagFilter {
|
enum TagFilter {
|
||||||
showAll = 'show-all',
|
showAll = 'show-all',
|
||||||
showReview = 'show-review',
|
showReview = 'show-review',
|
||||||
showSuggested = 'show-suggested'
|
showSuggested = 'show-suggested',
|
||||||
|
showCompleted = 'show-completed'
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -406,6 +408,18 @@ const singleTagsInChangeSet = (
|
|||||||
const tagsRequiringReview = (complianceDataTypes: Array<IComplianceDataType>, options: IComplianceTagReviewOptions) =>
|
const tagsRequiringReview = (complianceDataTypes: Array<IComplianceDataType>, options: IComplianceTagReviewOptions) =>
|
||||||
arrayFilter<IComplianceChangeSet>(tagNeedsReview(complianceDataTypes, options));
|
arrayFilter<IComplianceChangeSet>(tagNeedsReview(complianceDataTypes, options));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Takes a list of compliance data types to check if a tag is an idType as part of reviewable fields check, then filters
|
||||||
|
* out tags that are not reviewable
|
||||||
|
* @param {Array<IComplianceDataType>} complianceDataTypes list of IComplianceDataType objects
|
||||||
|
* @param {IComplianceTagReviewOptions} [options={ checkSuggestions: true, suggestionConfidenceThreshold: 0 }]
|
||||||
|
* @returns (complianceDataTypes: IComplianceDataType[], options?: IComplianceTagReviewOptions) => (array: IComplianceChangeSet[]) => IComplianceChangeSet[]
|
||||||
|
*/
|
||||||
|
const tagsPassingReview = (
|
||||||
|
complianceDataTypes: Array<IComplianceDataType>,
|
||||||
|
options: IComplianceTagReviewOptions = { checkSuggestions: true, suggestionConfidenceThreshold: 0 }
|
||||||
|
) => arrayFilter(not(tagNeedsReview(complianceDataTypes, options)));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Lists the tags for a specific identifier field that need to be reviewed
|
* Lists the tags for a specific identifier field that need to be reviewed
|
||||||
* @param {Array<IComplianceDataType>} complianceDataTypes
|
* @param {Array<IComplianceDataType>} complianceDataTypes
|
||||||
@ -677,6 +691,7 @@ export {
|
|||||||
isTagIdType,
|
isTagIdType,
|
||||||
mergeComplianceEntitiesWithSuggestions,
|
mergeComplianceEntitiesWithSuggestions,
|
||||||
tagsRequiringReview,
|
tagsRequiringReview,
|
||||||
|
tagsPassingReview,
|
||||||
tagsHaveNoneType,
|
tagsHaveNoneType,
|
||||||
fieldTagsRequiringReview,
|
fieldTagsRequiringReview,
|
||||||
tagsHaveNoneAndNotNoneType,
|
tagsHaveNoneAndNotNoneType,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user