Skip to content

Commit

Permalink
Adding a few comments about custom schisto code
Browse files Browse the repository at this point in the history
  • Loading branch information
dcdenu4 committed Oct 31, 2024
1 parent 10fe5f4 commit cf04676
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ export function ArgInput(props) {
}
</Form.Control>
);
} else if (argSpec.type === 'csv' && formTable) {
} else if (argSpec.type === 'csv' && formTable) { // custom for Schisto plugin
const rows = [];
Object.entries(argSpec.columns).forEach(([key, spec]) => {
rows.push(
Expand Down Expand Up @@ -479,6 +479,7 @@ AboutModal.propTypes = {
argkey: PropTypes.string.isRequired,
};

// Custom functionality for the Schisto plugin.
export function FormTableInput(props) {
const {
argkeys,
Expand All @@ -503,6 +504,7 @@ export function FormTableInput(props) {

const { t } = useTranslation();

// Custom functionality for Schisto plugin
const initFormTableValues = {};
if (formTable) {
Object.keys(argSpec.columns).forEach((colName) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ class ArgsForm extends React.Component {
argsValidation,
argsEnabled,
argsDropdownOptions,
uiSpec,
userguide,
scrollEventCount,
} = this.props;
Expand All @@ -132,17 +131,16 @@ class ArgsForm extends React.Component {
argsOrder.forEach((groupArray) => {
k += 1;
const groupItems = [];
// FormTableInput was developed specifically for the Schisto Plugin project.
groupArray.forEach((argkey) => {
if (typeof argkey === 'object') {
console.log(argkey);
const groupName = Object.keys(argkey)[0];
const argkeys = argkey[groupName];
groupItems.push(
<FormTableInput
argkeys={argkeys}
argsSpec={argsSpec}
groupName={groupName}
// formTable={uiSpec.form_tables.includes(argkey)}
userguide={userguide}
dropdownOptions={argsDropdownOptions[argkey]}
argsEnabled={argsEnabled}
Expand All @@ -161,7 +159,6 @@ class ArgsForm extends React.Component {
<ArgInput
argkey={argkey}
argSpec={argsSpec[argkey]}
// formTable={uiSpec.form_tables.includes(argkey)}
userguide={userguide}
dropdownOptions={argsDropdownOptions[argkey]}
enabled={argsEnabled[argkey]}
Expand Down
13 changes: 1 addition & 12 deletions workbench/src/renderer/components/SetupTab/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,25 +46,19 @@ const { logger } = window.Workbench;
* args of type 'option_string'.
*/
function initializeArgValues(argsSpec, uiSpec, argsDict) {
console.log('argsvalues');
const initIsEmpty = Object.keys(argsDict).length === 0;
const argsValues = {};
const argsDropdownOptions = {};
console.log(argsSpec);
const argkeys = [];
// Custom handling of inputs for Schisto Plugin
uiSpec.order.flat().forEach((group) => {
console.log(group);
if (typeof group === 'string') {
console.log('string')
argkeys.push(group);
} else {
console.log('object')
argkeys.push(...Object.values(group)[0]);
}
});
console.log(argkeys);
argkeys.forEach((argkey) => {
console.log(argkey);
// When initializing with undefined values, assign defaults so that,
// a) values are handled well by the html inputs and
// b) the object exported to JSON on "Save" or "Execute" includes defaults.
Expand All @@ -82,8 +76,6 @@ function initializeArgValues(argsSpec, uiSpec, argsDict) {
}
}
argsDropdownOptions[argkey] = argsSpec[argkey].options;
// } else if (uiSpec.form_tables.includes(argkey)) {
// value = {};
} else {
value = argsDict[argkey] || '';
}
Expand Down Expand Up @@ -355,7 +347,6 @@ class SetupTab extends React.Component {
* @returns {undefined}
*/
updateArgTouched(key) {
console.log('update touched', key);
const { argsValues } = this.state;
if (!argsValues[key].touched) {
argsValues[key].touched = true;
Expand All @@ -378,7 +369,6 @@ class SetupTab extends React.Component {
updateArgValues(key, value) {
const { uiSpec } = this.props;
const { argsValues } = this.state;
console.log(argsValues, key);
argsValues[key].value = value;
this.setState({
argsValues: argsValues,
Expand Down Expand Up @@ -616,7 +606,6 @@ class SetupTab extends React.Component {
<Row>
<ArgsForm
argsSpec={argsSpec}
uiSpec={uiSpec}
argsValues={argsValues}
argsValidation={argsValidation}
argsEnabled={argsEnabled}
Expand Down

0 comments on commit cf04676

Please sign in to comment.