Skip to content
Snippets Groups Projects
Commit ca1b2019 authored by piotr.kupczyk@id.ethz.ch's avatar piotr.kupczyk@id.ethz.ch
Browse files

SSDM-13463 : Export selection of fields from tables - UI part - adjust the...

SSDM-13463 : Export selection of fields from tables - UI part - adjust the structure of "export_fields"
parent 20e4bded
No related branches found
No related tags found
1 merge request!40SSDM-13578 : 2PT : Database and V3 Implementation - include the new AFS "free"...
...@@ -1313,25 +1313,32 @@ export default class GridController { ...@@ -1313,25 +1313,32 @@ export default class GridController {
} }
}) })
// build exported fields map: // build exported fields map: { kind: { type: [{ type: "PROPERTY/ATTRIBUTE", id: "propertyCode/attributeCode"}, ...], ... }, ... }
// - entities: { kind: { type: [{ type: "PROPERTY/ATTRIBUTE", id: "propertyCode/attributeCode"}, ...], ... }, ... }
// - non-entities: { kind: [{ type: "ATTRIBUTE", id: "attributeCode"}, ...], ... } const TYPE_KINDS = {
[GridExportOptions.EXPORTABLE_KIND.SAMPLE_TYPE]: true,
[GridExportOptions.EXPORTABLE_KIND.EXPERIMENT_TYPE]: true,
[GridExportOptions.EXPORTABLE_KIND.DATASET_TYPE]: true,
[GridExportOptions.EXPORTABLE_KIND.VOCABULARY]: true
}
exportedRows.forEach(exportedRow => { exportedRows.forEach(exportedRow => {
const { exportable_kind, type_perm_id } = exportedRow.exportableId let { exportable_kind, type_perm_id } = exportedRow.exportableId
if (!_.isNil(exportable_kind)) { if (!_.isNil(exportable_kind)) {
if (TYPE_KINDS[exportable_kind]) {
type_perm_id = exportable_kind
exportable_kind = 'TYPE'
}
let exportedFieldsForKind = exportedFieldsMap[exportable_kind] let exportedFieldsForKind = exportedFieldsMap[exportable_kind]
if (_.isNil(exportedFieldsForKind)) {
exportedFieldsMap[exportable_kind] = exportedFieldsForKind = {}
}
if (!_.isNil(type_perm_id)) { if (!_.isNil(type_perm_id)) {
if (_.isNil(exportedFieldsForKind)) {
exportedFieldsMap[exportable_kind] = exportedFieldsForKind = {}
}
exportedFieldsForKind[type_perm_id] = exportableFields exportedFieldsForKind[type_perm_id] = exportableFields
} else {
if (_.isNil(exportedFieldsForKind)) {
exportedFieldsMap[exportable_kind] = exportableFields
}
} }
} }
}) })
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment