Folders at Data Products and Layers
This commit is contained in:
1 parent
27130d6ca7
commit
327f5f826b
6 files changed
+241
-61
No files matched your search
@@ -1,11 +1,11 @@
|
||||
function newDataMineFunctions() {
|
||||
thisObject = {
|
||||
addMissingOutputDatasets: addMissingOutputDatasets
|
||||
addAllOutputDatasets: addAllOutputDatasets
|
||||
}
|
||||
|
||||
return thisObject
|
||||
|
||||
function addMissingOutputDatasets(node, functionLibraryUiObjectsFromNodes) {
|
||||
function addAllOutputDatasets(node, functionLibraryUiObjectsFromNodes) {
|
||||
|
||||
/* Validations to see if we can do this or not. */
|
||||
if (node.payload === undefined) { return }
|
||||
@@ -29,57 +29,16 @@ function newDataMineFunctions() {
|
||||
Output Dataset Folder, and for each Product Definition found we will create a Output Definition
|
||||
for each Dataset defined inside the Product Definition.
|
||||
*/
|
||||
scanForProductDefinitions(node.payload.parentNode.payload.parentNode, node)
|
||||
|
||||
function scanForProductDefinitions(originNode, destinationNode) {
|
||||
if (originNode === undefined) { return }
|
||||
if (destinationNode === undefined) { return }
|
||||
|
||||
/* Now we go down through all the children of the origin node, recreating at the destination node the same children structure*/
|
||||
let nodeDefinition = getNodeDefinition(originNode)
|
||||
if (nodeDefinition === undefined) { return }
|
||||
|
||||
if (nodeDefinition.properties !== undefined) {
|
||||
for (let i = 0; i < nodeDefinition.properties.length; i++) {
|
||||
let property = nodeDefinition.properties[i]
|
||||
|
||||
switch (property.name) {
|
||||
case 'products': {
|
||||
let originNodePropertyArray = originNode[property.name]
|
||||
for (let m = 0; m < originNodePropertyArray.length; m++) {
|
||||
let originProduct = originNodePropertyArray[m]
|
||||
for (let n = 0; n < originProduct.datasets.length; n++) {
|
||||
let datasetDefinition = originProduct.datasets[n]
|
||||
let outputDataset = functionLibraryUiObjectsFromNodes.addUIObject(destinationNode, 'Output Dataset')
|
||||
outputDataset.payload.referenceParent = datasetDefinition
|
||||
}
|
||||
}
|
||||
break
|
||||
}
|
||||
case 'productDefinitionFolders': {
|
||||
let originNodePropertyArray = originNode[property.name]
|
||||
let destinationNodePropertyArray = destinationNode['outputDatasetFolders']
|
||||
for (let m = 0; m < originNodePropertyArray.length; m++) {
|
||||
let originFolder = originNodePropertyArray[m]
|
||||
let found = false
|
||||
let destinationFolder
|
||||
for (let n = 0; n < destinationNodePropertyArray.length; n++) {
|
||||
destinationFolder = destinationNodePropertyArray[n]
|
||||
if (originFolder.name === destinationFolder.name) {
|
||||
found = true
|
||||
}
|
||||
}
|
||||
if (found === false) {
|
||||
destinationFolder = functionLibraryUiObjectsFromNodes.addUIObject(destinationNode, 'Output Dataset Folder')
|
||||
destinationFolder.name = originFolder.name
|
||||
}
|
||||
scanForProductDefinitions(originFolder, destinationFolder)
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
asymetricalFolderStructureCloning(
|
||||
node.payload.parentNode.payload.parentNode,
|
||||
node,
|
||||
'products',
|
||||
'productDefinitionFolders',
|
||||
'outputDatasetFolders',
|
||||
'Output Dataset',
|
||||
'Output Dataset Folder',
|
||||
'datasets',
|
||||
functionLibraryUiObjectsFromNodes
|
||||
)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user