Skip to content

Commit

Permalink
Removing form.js and adding dynamic js features in form.yml.erb file. (
Browse files Browse the repository at this point in the history
…#33)

* Sharing to troubleshoot.

* Working to fix license fields.

* Removing cores js but leaving licensing in for now.
  • Loading branch information
Oglopf authored Dec 16, 2021
1 parent 03a3692 commit fc59528
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 69 deletions.
62 changes: 0 additions & 62 deletions form.js
Original file line number Diff line number Diff line change
@@ -1,67 +1,5 @@
'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', 0);
num_cores_input.val(Math.min(NUM_CORES, num_cores_input.val()));
}

/**
* Toggle the visibilty of a form group
*
* @param {string} form_id The form identifier
* @param {boolean} show Whether to show or hide
*/
function toggle_visibilty_of_form_group(form_id, show) {
let form_element = $(form_id);
let parent = form_element.parent();

if(show) {
parent.show();
} else {
form_element.val('');
parent.hide();
}
}

/**
* Toggle the visibilty of the license fields
Expand Down
25 changes: 18 additions & 7 deletions form.yml.erb
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,8 @@ attributes:
Number of cores on node type (4 GB per core unless requesting whole
node). Leave blank if requesting full node.
min: 0 # This is treated as requesting the max allowable
max: 48 # This will be updated by form.js
max: 28 # This will be updated by form.js
step: 1
id: num_cores
bc_num_slots:
help: |
Currently only Fluent and CFX have been tested to support multiple nodes.
Expand Down Expand Up @@ -63,9 +62,21 @@ attributes:
available RAM as well as 48 cores. There are 16 of these nodes on
Owens.
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: "ANSYS Workbench version"
Expand All @@ -84,8 +95,8 @@ attributes:
label: "License provider"
help: "Some users are required to provide their own license information"
options:
- ["I can use the OSC license", "osc"]
- ["I need to use an external license", "external"]
- ['I can use the OSC license', 'osc']
- ['I need to use an external license', 'external']
extern_license_server:
label: "External License Server"
placeholder: port@ip
Expand Down

0 comments on commit fc59528

Please sign in to comment.