mirror of
https://github.com/datahub-project/datahub.git
synced 2025-11-18 12:23:34 +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,
|
buildFieldSuggestionsLookupTable,
|
||||||
tagsPassingReview
|
tagsPassingReview
|
||||||
} from 'wherehows-web/constants';
|
} 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 { identity, noop } from 'wherehows-web/utils/helpers/functions';
|
||||||
import { IComplianceDataType } from 'wherehows-web/typings/api/list/compliance-datatypes';
|
import { IComplianceDataType } from 'wherehows-web/typings/api/list/compliance-datatypes';
|
||||||
import Notifications, { NotificationEvent } from 'wherehows-web/services/notifications';
|
import Notifications, { NotificationEvent } from 'wherehows-web/services/notifications';
|
||||||
@ -67,7 +74,6 @@ import {
|
|||||||
} from 'wherehows-web/typings/app/dataset-compliance';
|
} from 'wherehows-web/typings/app/dataset-compliance';
|
||||||
import { uniqBy } from 'lodash';
|
import { uniqBy } from 'lodash';
|
||||||
import { IColumnFieldProps } from 'wherehows-web/typings/app/dataset-columns';
|
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 { trackableEvent, TrackableEventCategory } from 'wherehows-web/constants/analytics/event-tracking';
|
||||||
import { notificationDialogActionFactory } from 'wherehows-web/utils/notifications/notifications';
|
import { notificationDialogActionFactory } from 'wherehows-web/utils/notifications/notifications';
|
||||||
import { isMetadataObject, jsonValuesMatch } from 'wherehows-web/utils/datasets/compliance/metadata-schema';
|
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
|
* 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*(
|
setUnspecifiedTagsAsNoneTask = task(function*(this: DatasetCompliance): IterableIterator<void> {
|
||||||
this: DatasetCompliance
|
|
||||||
): IterableIterator<Promise<Array<ComplianceFieldIdValue | NonIdLogicalType>>> {
|
|
||||||
const unspecifiedTags = get(this, 'unspecifiedTags');
|
const unspecifiedTags = get(this, 'unspecifiedTags');
|
||||||
// const setTagIdentifier = (value: ComplianceFieldIdValue | NonIdLogicalType) => (tag: IComplianceChangeSet) =>
|
const annotateIdentifierTypeAsNone = (tag: IComplianceChangeSet) =>
|
||||||
// set(tag, 'identifierType', value);
|
|
||||||
|
|
||||||
// yield iterateArrayAsync(arrayMap(setTagIdentifier(ComplianceFieldIdValue.None)))(unspecifiedTags);
|
|
||||||
unspecifiedTags.forEach(tag => {
|
|
||||||
set(tag, 'identifierType', ComplianceFieldIdValue.None);
|
set(tag, 'identifierType', ComplianceFieldIdValue.None);
|
||||||
});
|
|
||||||
|
arrayEach(annotateIdentifierTypeAsNone)(unspecifiedTags);
|
||||||
}).drop();
|
}).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 = []) =>
|
const arrayMap = <T, U>(predicate: (param: T) => U): ((array: Array<T>) => Array<U>) => (array = []) =>
|
||||||
array.map(predicate);
|
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,
|
* Partitions an array into a tuple containing elements that meet the predicate in the zeroth index,
|
||||||
* and excluded elements in the next
|
* and excluded elements in the next
|
||||||
@ -253,6 +262,7 @@ export {
|
|||||||
take,
|
take,
|
||||||
arrayMap,
|
arrayMap,
|
||||||
arrayPipe,
|
arrayPipe,
|
||||||
|
arrayEach,
|
||||||
arrayFilter,
|
arrayFilter,
|
||||||
arrayReduce,
|
arrayReduce,
|
||||||
arrayPartition,
|
arrayPartition,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user