From fcf9dd59a4e5f91d0a43dbaf5d4b6a7ca551d3a2 Mon Sep 17 00:00:00 2001 From: Travis Ravert Date: Thu, 16 Dec 2021 15:53:11 -0500 Subject: [PATCH] Removing form.js and adding dynamic js features in form.yml.erb file. (#14) * Removing form.js and adding dynamic js features in form.yml.erb file. * Adjusting min. * Need the other mins since hugemem has a min set. --- form.js | 60 ---------------------------------------------------- form.yml.erb | 18 +++++++++++++--- 2 files changed, 15 insertions(+), 63 deletions(-) delete mode 100644 form.js diff --git a/form.js b/form.js deleted file mode 100644 index 65b921b..0000000 --- a/form.js +++ /dev/null @@ -1,60 +0,0 @@ -'use strict' - -/** - * Fix num cores, allowing blanks to remain - */ -function fix_num_cores() { - let node_type_input = $('#batch_connect_session_context_node_type'); - let node_type = node_type_input.val(); - let num_cores_input = $('#num_cores'); - - if(num_cores_input.val() === '') { - return; - } - - if(node_type === 'hugemem') { - set_ppn_owens_hugemem(num_cores_input); - } else { - set_ppn_owens_regular(num_cores_input); - } -} - -/** - * Sets the PPN limits available for Owens hugemem nodes. - * - * hugemem reservations are always assigned the full node - * - * @param {element} num_cores_input The input for num_cores - */ -function set_ppn_owens_hugemem(num_cores_input) { - const NUM_CORES = 48; - num_cores_input.attr('max', NUM_CORES); - num_cores_input.attr('min', NUM_CORES); - num_cores_input.val(NUM_CORES); -} - -/** - * Sets the PPN limits available for non hugemem Owens nodes. - * - * @param {element} num_cores_input The input for num_cores - */ -function set_ppn_owens_regular(num_cores_input) { - const NUM_CORES = 28; - num_cores_input.attr('max', NUM_CORES); - num_cores_input.attr('min', 1); - num_cores_input.val(Math.min(NUM_CORES, num_cores_input.val())); -} - -/** - * Change the maximum number of cores selected. - */ -function set_node_type_change_handler() { - let node_type_input = $('#batch_connect_session_context_node_type'); - node_type_input.change(node_type_input, fix_num_cores); -} - -$(document).ready(function() { - // Set the max value to be what was set in the last session - fix_num_cores(); - set_node_type_change_handler(); -}); \ No newline at end of file diff --git a/form.yml.erb b/form.yml.erb index c7dbda6..d128c54 100644 --- a/form.yml.erb +++ b/form.yml.erb @@ -50,9 +50,21 @@ attributes: available RAM as well as 48 cores. There are 16 of these nodes on Owens. These nodes always reserve the entire node. options: - - "any" - - "vis" - - "hugemem" + - [ + 'any', 'any', + data-max-num-cores: 28, + data-min-num-cores: 1, + ] + - [ + 'vis', 'vis', + data-max-num-cores: 28, + data-min-num-cores: 1, + ] + - [ + 'hugemem', 'hugemem', + data-max-num-cores: 48, + data-min-num-cores: 48, + ] version: widget: select label: "Abaqus/CAE version"