mirror of
https://github.com/datahub-project/datahub.git
synced 2025-10-19 04:47:21 +00:00
adds additional keys on policy metadata json download
This commit is contained in:
parent
97327eea66
commit
a90c932d9b
@ -1173,7 +1173,16 @@ export default class DatasetCompliance extends Component {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const policy = Object.assign({}, getProperties(currentPolicy, ['datasetClassification', 'complianceEntities']));
|
const policy = Object.assign(
|
||||||
|
{},
|
||||||
|
getProperties(currentPolicy, [
|
||||||
|
'datasetClassification',
|
||||||
|
'complianceEntities',
|
||||||
|
'compliancePurgeNote',
|
||||||
|
'complianceType',
|
||||||
|
'confidentiality'
|
||||||
|
])
|
||||||
|
);
|
||||||
const href = `data:text/json;charset=utf-8,${encodeURIComponent(JSON.stringify(policy))}`;
|
const href = `data:text/json;charset=utf-8,${encodeURIComponent(JSON.stringify(policy))}`;
|
||||||
const download = `${get(this, 'datasetName')}_policy.json`;
|
const download = `${get(this, 'datasetName')}_policy.json`;
|
||||||
const anchor = document.createElement('a');
|
const anchor = document.createElement('a');
|
||||||
|
@ -33,7 +33,7 @@ const datasetClassificationPropType = (prop: string): IMetadataType => ({
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines the shape of the dataset compliance metadata json object using the IMetadataType interface
|
* Defines the shape of the dataset compliance metadata json object using the IMetadataType interface
|
||||||
* @type {({'@type': string; '@name': string; '@props': Array<IMetadataType>} | {'@type': string; '@name': string; '@props': ({'@name': string; '@type': string} | {'@name': string; '@type': string[]} | {'@name': string; '@type': string[]; '@symbols': any[]} | {'@type': string[]; '@name': string})[]})[]}
|
* @type {Array<IMetadataType>}
|
||||||
*/
|
*/
|
||||||
const complianceMetadataTaxonomy: Array<IMetadataType> = [
|
const complianceMetadataTaxonomy: Array<IMetadataType> = [
|
||||||
{
|
{
|
||||||
@ -71,6 +71,18 @@ const complianceMetadataTaxonomy: Array<IMetadataType> = [
|
|||||||
'@type': ['string', 'null']
|
'@type': ['string', 'null']
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'@type': ['string', 'null'],
|
||||||
|
'@name': 'compliancePurgeNote'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'@type': 'string',
|
||||||
|
'@name': 'complianceType'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'@type': ['string', 'null'],
|
||||||
|
'@name': 'confidentiality'
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -104,11 +116,13 @@ const keyValueHasMatch = (object: IObject<any>) => (metadataType: IMetadataType)
|
|||||||
const innerType = metadataType['@props'];
|
const innerType = metadataType['@props'];
|
||||||
|
|
||||||
if (type.includes('object') && isObject(value)) {
|
if (type.includes('object') && isObject(value)) {
|
||||||
|
// recurse on object properties
|
||||||
return rootValueEquiv && keysEquiv(value, innerType!);
|
return rootValueEquiv && keysEquiv(value, innerType!);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type.includes('array') && Array.isArray(value)) {
|
if (type.includes('array') && Array.isArray(value)) {
|
||||||
return (
|
return (
|
||||||
|
// recursively reduce on array elements
|
||||||
rootValueEquiv &&
|
rootValueEquiv &&
|
||||||
arrayReduce((isEquiv: boolean, value: any) => isEquiv && keysEquiv(value, innerType!), rootValueEquiv)(value)
|
arrayReduce((isEquiv: boolean, value: any) => isEquiv && keysEquiv(value, innerType!), rootValueEquiv)(value)
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user