mirror of
https://github.com/datahub-project/datahub.git
synced 2025-11-01 19:25:56 +00:00
cleans up commented out code. modifies task to set all compliance fields as none using iteratee first each function
This commit is contained in:
parent
f3245032d0
commit
4f3d50b5fc
@ -42,7 +42,14 @@ import {
|
||||
buildFieldSuggestionsLookupTable,
|
||||
tagsPassingReview
|
||||
} from 'wherehows-web/constants';
|
||||
import { arrayFilter, arrayMap, arrayReduce, isListUnique, iterateArrayAsync } from 'wherehows-web/utils/array';
|
||||
import {
|
||||
arrayEach,
|
||||
arrayFilter,
|
||||
arrayMap,
|
||||
arrayReduce,
|
||||
isListUnique,
|
||||
iterateArrayAsync
|
||||
} from 'wherehows-web/utils/array';
|
||||
import { identity, noop } from 'wherehows-web/utils/helpers/functions';
|
||||
import { IComplianceDataType } from 'wherehows-web/typings/api/list/compliance-datatypes';
|
||||
import Notifications, { NotificationEvent } from 'wherehows-web/services/notifications';
|
||||
@ -67,7 +74,6 @@ import {
|
||||
} from 'wherehows-web/typings/app/dataset-compliance';
|
||||
import { uniqBy } from 'lodash';
|
||||
import { IColumnFieldProps } from 'wherehows-web/typings/app/dataset-columns';
|
||||
import { NonIdLogicalType } from 'wherehows-web/constants/datasets/compliance';
|
||||
import { trackableEvent, TrackableEventCategory } from 'wherehows-web/constants/analytics/event-tracking';
|
||||
import { notificationDialogActionFactory } from 'wherehows-web/utils/notifications/notifications';
|
||||
import { isMetadataObject, jsonValuesMatch } from 'wherehows-web/utils/datasets/compliance/metadata-schema';
|
||||
@ -928,19 +934,14 @@ export default class DatasetCompliance extends Component {
|
||||
|
||||
/**
|
||||
* Sets the identifierType attribute on IComplianceChangeSetFields without an identifierType to ComplianceFieldIdValue.None
|
||||
* @returns {Promise<Array<IComplianceChangeSet>>}
|
||||
* @type {Task<void, (a?: void) => TaskInstance<void>>}
|
||||
*/
|
||||
setUnspecifiedTagsAsNoneTask = task(function*(
|
||||
this: DatasetCompliance
|
||||
): IterableIterator<Promise<Array<ComplianceFieldIdValue | NonIdLogicalType>>> {
|
||||
setUnspecifiedTagsAsNoneTask = task(function*(this: DatasetCompliance): IterableIterator<void> {
|
||||
const unspecifiedTags = get(this, 'unspecifiedTags');
|
||||
// const setTagIdentifier = (value: ComplianceFieldIdValue | NonIdLogicalType) => (tag: IComplianceChangeSet) =>
|
||||
// set(tag, 'identifierType', value);
|
||||
|
||||
// yield iterateArrayAsync(arrayMap(setTagIdentifier(ComplianceFieldIdValue.None)))(unspecifiedTags);
|
||||
unspecifiedTags.forEach(tag => {
|
||||
const annotateIdentifierTypeAsNone = (tag: IComplianceChangeSet) =>
|
||||
set(tag, 'identifierType', ComplianceFieldIdValue.None);
|
||||
});
|
||||
|
||||
arrayEach(annotateIdentifierTypeAsNone)(unspecifiedTags);
|
||||
}).drop();
|
||||
|
||||
/**
|
||||
|
@ -36,6 +36,15 @@ const take = <T>(n: number = 0) => (list: Array<T>): Array<T> => Array.prototype
|
||||
const arrayMap = <T, U>(predicate: (param: T) => U): ((array: Array<T>) => Array<U>) => (array = []) =>
|
||||
array.map(predicate);
|
||||
|
||||
/**
|
||||
* Iteratee-first data-last each function
|
||||
* @template T type of elements in array
|
||||
* @param {(param: T) => void} predicate iteratee
|
||||
* @returns {((array: Array<T>) => void)}
|
||||
*/
|
||||
const arrayEach = <T>(predicate: (param: T) => void): ((array: Array<T>) => void) => (array = []) =>
|
||||
array.forEach(predicate);
|
||||
|
||||
/**
|
||||
* Partitions an array into a tuple containing elements that meet the predicate in the zeroth index,
|
||||
* and excluded elements in the next
|
||||
@ -253,6 +262,7 @@ export {
|
||||
take,
|
||||
arrayMap,
|
||||
arrayPipe,
|
||||
arrayEach,
|
||||
arrayFilter,
|
||||
arrayReduce,
|
||||
arrayPartition,
|
||||
|
Loading…
x
Reference in New Issue
Block a user