From 8d76558999910d465214e1746d21ceba760a488a Mon Sep 17 00:00:00 2001 From: William Emfinger Date: Sun, 22 Jul 2018 10:38:27 -0500 Subject: [PATCH] WIP #264 bugfix to header template creation - duplicate entries. --- src/plugins/SoftwareGenerator/configWidget.js | 104 +++++++----------- 1 file changed, 40 insertions(+), 64 deletions(-) diff --git a/src/plugins/SoftwareGenerator/configWidget.js b/src/plugins/SoftwareGenerator/configWidget.js index f1170d06..9e7df8bc 100644 --- a/src/plugins/SoftwareGenerator/configWidget.js +++ b/src/plugins/SoftwareGenerator/configWidget.js @@ -121,72 +121,48 @@ define([ }; ConfigWidget.prototype.makeArchConfig = function(architectures) { - var self = this, - archConfig = []; - - - var sectionTmpl = { - "name": "", - "displayName": "", - "valueType": "header", - "configStructure": [] - }; - - var enableTempl = { - "name": "", - "displayName": "", - "description": "Enable/Disable compilation for this architecture", - "value": true, - "valueType": "boolean", - "readOnly": false - }; - - var hostSelectorTempl = { - "name": "", - "displayName": "", - "description": "", - "value": "", - "valueType": "sortable", - "valueItems": [], - "readOnly": false - }; - - var hostJobTempl = { - "name": "", - "displayName": "", - "description": "", - "value": "", - "valueType": "string", - "readOnly": false - }; - - Object.keys(architectures).map(function(arch) { - var section = Object.assign({}, sectionTmpl); - section.name = arch + "_COMPILATION_CONFIG"; - section.displayName = "Compilation Options for " + arch; - - var archTempl = Object.assign({}, enableTempl); - archTempl.name = "enabled"; - archTempl.displayName = 'Compile on ' + arch; - section.configStructure.push( archTempl ); - - var jobTempl = Object.assign({}, hostJobTempl); - jobTempl.name = "jobs"; - jobTempl.displayName = arch + " Job Configuration"; - jobTempl.description = "Select the number of compilation jobs for "+arch+" - range: [1,nproc] - defaults to nproc if blank."; - section.configStructure.push( jobTempl ); - - var hostTempl = Object.assign({}, hostSelectorTempl); - hostTempl.name = "hostPriority"; - hostTempl.displayName = arch + " Compilation Priority"; - hostTempl.description = "Sort the "+arch+" hosts for compilation priority, top to bottom."; - hostTempl.valueItems = architectures[arch].map(host => `${host.path}::${host.name}`); - section.configStructure.push( hostTempl ); + var self = this; - archConfig.push(section); + return Object.keys(architectures).map(function(arch) { + var enableConfig = { + "name": "enabled", + "displayName": "Compile on " + arch, + "description": "Enable/Disable compilation for this architecture", + "value": true, + "valueType": "boolean", + "readOnly": false + }; + + var jobConfig = { + "name": "jobs", + "displayName": arch + " Job Configuration", + "description": "Select the number of compilation jobs for "+arch+" - range: [1,nproc] - defaults to nproc if blank.", + "value": "", + "valueType": "string", + "readOnly": false + }; + + var hostConfig = { + "name": "hostPriority", + "displayName": arch + " Compilation Priority", + "description": "Sort the "+arch+" hosts for compilation priority, top to bottom.", + "value": "", + "valueType": "sortable", + "valueItems": architectures[arch].map(host => `${host.path}::${host.name}`), + "readOnly": false + }; + + return { + "name": arch + "_COMPILATION_CONFIG", + "displayName": "Compilation Options for " + arch, + "valueType": "header", + "configStructure": [ + enableConfig, + jobConfig, + hostConfig + ] + }; }); - - return archConfig; }; return ConfigWidget;