replaces the purgeNote on an IDatasetRetention object if the policy is not exempt
import { IComplianceInfo } from 'wherehows-web/typings/api/datasets/compliance';
import { IDatasetRetention } from 'wherehows-web/typings/api/datasets/retention';
import { pick } from 'wherehows-web/utils/object';
+import { isExempt } from 'wherehows-web/constants';
/**
* Extracts values from an IComplianceInfo instance to create an instance of IDatasetRetention
@@ -8,14 +9,14 @@ import { pick } from 'wherehows-web/utils/object';
* @returns {IDatasetRetention}
*/
const extractRetentionFromComplianceInfo = (complianceInfo: IComplianceInfo): IDatasetRetention => {
- const { datasetUrn, compliancePurgeNote, complianceType } = pick(complianceInfo, [
+ let { datasetUrn, compliancePurgeNote, complianceType } = pick(complianceInfo, [
'complianceType',
'compliancePurgeNote',
'datasetUrn'
]);
return {
- purgeNote: compliancePurgeNote,
+ purgeNote: complianceType && isExempt(complianceType) ? compliancePurgeNote : '',
purgeType: complianceType,
datasetUrn: datasetUrn!
};
