mirror of
https://github.com/datahub-project/datahub.git
synced 2025-08-29 03:25:58 +00:00
Merge pull request #1089 from theseyi/compliance-multi-tagging
creates fold functions for compliance change set mapping
This commit is contained in:
commit
e47b7dbf3e
@ -29,7 +29,8 @@ import {
|
||||
idTypeFieldsHaveLogicalType,
|
||||
changeSetFieldsRequiringReview,
|
||||
changeSetReviewableAttributeTriggers,
|
||||
mapSchemaColumnPropsToCurrentPrivacyPolicy
|
||||
mapSchemaColumnPropsToCurrentPrivacyPolicy,
|
||||
foldComplianceChangeSets
|
||||
} from 'wherehows-web/constants';
|
||||
import { isPolicyExpectedShape } from 'wherehows-web/utils/datasets/compliance-policy';
|
||||
import scrollMonitor from 'scrollmonitor';
|
||||
@ -49,6 +50,7 @@ import {
|
||||
IComplianceChangeSet,
|
||||
IComplianceFieldIdentifierOption,
|
||||
IDatasetComplianceActions,
|
||||
IdentifierFieldWithFieldChangeSetTuple,
|
||||
IDropDownOption,
|
||||
ISchemaFieldsToPolicy,
|
||||
ISchemaFieldsToSuggested,
|
||||
@ -689,6 +691,18 @@ export default class DatasetCompliance extends Component {
|
||||
}
|
||||
);
|
||||
|
||||
/**
|
||||
* Reduces the current filtered changeSet to a list of IdentifierFieldWithFieldChangeSetTuple
|
||||
* @type {ComputedProperty<Array<IdentifierFieldWithFieldChangeSetTuple>>}
|
||||
* @memberof DatasetCompliance
|
||||
*/
|
||||
foldedChangeSet: ComputedProperty<Array<IdentifierFieldWithFieldChangeSetTuple>> = computed(
|
||||
'filteredChangeSet',
|
||||
function(this: DatasetCompliance): Array<IdentifierFieldWithFieldChangeSetTuple> {
|
||||
return foldComplianceChangeSets(get(this, 'filteredChangeSet'));
|
||||
}
|
||||
);
|
||||
|
||||
/**
|
||||
* Invokes external action with flag indicating that at least 1 suggestion exists for a field in the changeSet
|
||||
* @param {Array<IComplianceChangeSet>} changeSet
|
||||
|
@ -9,6 +9,8 @@ import { decodeUrn } from 'wherehows-web/utils/validators/urn';
|
||||
import {
|
||||
IComplianceChangeSet,
|
||||
IComplianceFieldIdentifierOption,
|
||||
IdentifierFieldWithFieldChangeSetTuple,
|
||||
IIdentifierFieldWithFieldChangeSetObject,
|
||||
ISchemaFieldsToPolicy,
|
||||
ISchemaFieldsToSuggested
|
||||
} from 'wherehows-web/typings/app/dataset-compliance';
|
||||
@ -250,6 +252,31 @@ const mergeMappedColumnFieldsWithSuggestions = (
|
||||
return field;
|
||||
});
|
||||
|
||||
/**
|
||||
* Creates a map of compliance changeSet identifier field to compliance change sets
|
||||
* @param {IIdentifierFieldWithFieldChangeSetObject} identifierFieldMap
|
||||
* @param {IComplianceChangeSet} changeSet
|
||||
* @returns {IIdentifierFieldWithFieldChangeSetObject}
|
||||
*/
|
||||
const foldComplianceChangeSetToField = (
|
||||
identifierFieldMap: IIdentifierFieldWithFieldChangeSetObject,
|
||||
changeSet: IComplianceChangeSet
|
||||
): IIdentifierFieldWithFieldChangeSetObject => ({
|
||||
...identifierFieldMap,
|
||||
[changeSet.identifierField]: [...identifierFieldMap[changeSet.identifierField], changeSet]
|
||||
});
|
||||
|
||||
/**
|
||||
* Reduces a list of IComplianceChangeSet to a list of tuples with a complianceChangeSet identifierField
|
||||
* and a changeSet list
|
||||
* @param {Array<IComplianceChangeSet>} changeSet
|
||||
* @returns {Array<IdentifierFieldWithFieldChangeSetTuple>}
|
||||
*/
|
||||
const foldComplianceChangeSets = (
|
||||
changeSet: Array<IComplianceChangeSet>
|
||||
): Array<IdentifierFieldWithFieldChangeSetTuple> =>
|
||||
Object.entries<Array<IComplianceChangeSet>>(arrayReduce(foldComplianceChangeSetToField, {})(changeSet));
|
||||
|
||||
/**
|
||||
* Builds a default shape for securitySpecification & privacyCompliancePolicy with default / unset values
|
||||
* for non null properties as per Avro schema
|
||||
@ -364,5 +391,6 @@ export {
|
||||
idTypeFieldsHaveLogicalType,
|
||||
changeSetFieldsRequiringReview,
|
||||
changeSetReviewableAttributeTriggers,
|
||||
mapSchemaColumnPropsToCurrentPrivacyPolicy
|
||||
mapSchemaColumnPropsToCurrentPrivacyPolicy,
|
||||
foldComplianceChangeSets
|
||||
};
|
||||
|
@ -70,6 +70,19 @@ type IComplianceChangeSet = {
|
||||
suggestionAuthority?: SuggestionIntent;
|
||||
} & SchemaFieldToPolicyValue;
|
||||
|
||||
/**
|
||||
* Describes the mapping of an identifier field to it's compliance changeset list
|
||||
* @interface IIdentifierFieldWithFieldChangeSetObject
|
||||
*/
|
||||
interface IIdentifierFieldWithFieldChangeSetObject {
|
||||
[identifierField: string]: Array<IComplianceChangeSet>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines a type for identifierField with it's changeSet tuple
|
||||
*/
|
||||
type IdentifierFieldWithFieldChangeSetTuple = [string, Array<IComplianceChangeSet>];
|
||||
|
||||
/**
|
||||
* Defines the generic interface field identifier drop downs
|
||||
* @interface IDropDownOption
|
||||
@ -120,5 +133,7 @@ export {
|
||||
IDropDownOption,
|
||||
IComplianceFieldIdentifierOption,
|
||||
IComplianceFieldFormatOption,
|
||||
ISecurityClassificationOption
|
||||
ISecurityClassificationOption,
|
||||
IIdentifierFieldWithFieldChangeSetObject,
|
||||
IdentifierFieldWithFieldChangeSetTuple
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user