mirror of
https://github.com/datahub-project/datahub.git
synced 2025-08-30 12:06:00 +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,
|
idTypeFieldsHaveLogicalType,
|
||||||
changeSetFieldsRequiringReview,
|
changeSetFieldsRequiringReview,
|
||||||
changeSetReviewableAttributeTriggers,
|
changeSetReviewableAttributeTriggers,
|
||||||
mapSchemaColumnPropsToCurrentPrivacyPolicy
|
mapSchemaColumnPropsToCurrentPrivacyPolicy,
|
||||||
|
foldComplianceChangeSets
|
||||||
} from 'wherehows-web/constants';
|
} from 'wherehows-web/constants';
|
||||||
import { isPolicyExpectedShape } from 'wherehows-web/utils/datasets/compliance-policy';
|
import { isPolicyExpectedShape } from 'wherehows-web/utils/datasets/compliance-policy';
|
||||||
import scrollMonitor from 'scrollmonitor';
|
import scrollMonitor from 'scrollmonitor';
|
||||||
@ -49,6 +50,7 @@ import {
|
|||||||
IComplianceChangeSet,
|
IComplianceChangeSet,
|
||||||
IComplianceFieldIdentifierOption,
|
IComplianceFieldIdentifierOption,
|
||||||
IDatasetComplianceActions,
|
IDatasetComplianceActions,
|
||||||
|
IdentifierFieldWithFieldChangeSetTuple,
|
||||||
IDropDownOption,
|
IDropDownOption,
|
||||||
ISchemaFieldsToPolicy,
|
ISchemaFieldsToPolicy,
|
||||||
ISchemaFieldsToSuggested,
|
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
|
* Invokes external action with flag indicating that at least 1 suggestion exists for a field in the changeSet
|
||||||
* @param {Array<IComplianceChangeSet>} changeSet
|
* @param {Array<IComplianceChangeSet>} changeSet
|
||||||
|
@ -9,6 +9,8 @@ import { decodeUrn } from 'wherehows-web/utils/validators/urn';
|
|||||||
import {
|
import {
|
||||||
IComplianceChangeSet,
|
IComplianceChangeSet,
|
||||||
IComplianceFieldIdentifierOption,
|
IComplianceFieldIdentifierOption,
|
||||||
|
IdentifierFieldWithFieldChangeSetTuple,
|
||||||
|
IIdentifierFieldWithFieldChangeSetObject,
|
||||||
ISchemaFieldsToPolicy,
|
ISchemaFieldsToPolicy,
|
||||||
ISchemaFieldsToSuggested
|
ISchemaFieldsToSuggested
|
||||||
} from 'wherehows-web/typings/app/dataset-compliance';
|
} from 'wherehows-web/typings/app/dataset-compliance';
|
||||||
@ -250,6 +252,31 @@ const mergeMappedColumnFieldsWithSuggestions = (
|
|||||||
return field;
|
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
|
* Builds a default shape for securitySpecification & privacyCompliancePolicy with default / unset values
|
||||||
* for non null properties as per Avro schema
|
* for non null properties as per Avro schema
|
||||||
@ -364,5 +391,6 @@ export {
|
|||||||
idTypeFieldsHaveLogicalType,
|
idTypeFieldsHaveLogicalType,
|
||||||
changeSetFieldsRequiringReview,
|
changeSetFieldsRequiringReview,
|
||||||
changeSetReviewableAttributeTriggers,
|
changeSetReviewableAttributeTriggers,
|
||||||
mapSchemaColumnPropsToCurrentPrivacyPolicy
|
mapSchemaColumnPropsToCurrentPrivacyPolicy,
|
||||||
|
foldComplianceChangeSets
|
||||||
};
|
};
|
||||||
|
@ -70,6 +70,19 @@ type IComplianceChangeSet = {
|
|||||||
suggestionAuthority?: SuggestionIntent;
|
suggestionAuthority?: SuggestionIntent;
|
||||||
} & SchemaFieldToPolicyValue;
|
} & 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
|
* Defines the generic interface field identifier drop downs
|
||||||
* @interface IDropDownOption
|
* @interface IDropDownOption
|
||||||
@ -120,5 +133,7 @@ export {
|
|||||||
IDropDownOption,
|
IDropDownOption,
|
||||||
IComplianceFieldIdentifierOption,
|
IComplianceFieldIdentifierOption,
|
||||||
IComplianceFieldFormatOption,
|
IComplianceFieldFormatOption,
|
||||||
ISecurityClassificationOption
|
ISecurityClassificationOption,
|
||||||
|
IIdentifierFieldWithFieldChangeSetObject,
|
||||||
|
IdentifierFieldWithFieldChangeSetTuple
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user