From c0d41b4692b992cae4e8015d2c338bb074b53149 Mon Sep 17 00:00:00 2001 From: Matthew Munns Date: Tue, 9 Jul 2024 16:19:52 -0400 Subject: [PATCH 1/4] fix errors when loading read-only page in desktop mode --- frontend/src/components/Main/Actions/Actions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/components/Main/Actions/Actions.js b/frontend/src/components/Main/Actions/Actions.js index d58b840f..87d5caa0 100644 --- a/frontend/src/components/Main/Actions/Actions.js +++ b/frontend/src/components/Main/Actions/Actions.js @@ -107,7 +107,7 @@ class Actions extends Component { ) : (

Please save and execute analysis.

)} - {mainStore.isDesktop ? ( + {(mainStore.isDesktop && mainStore.canEdit) ? ( <>
Collections From 29c7be3fe4bddbee7144a7f96e45f49837ccdb19 Mon Sep 17 00:00:00 2001 From: Andy Shapiro Date: Wed, 17 Jul 2024 21:22:26 -0400 Subject: [PATCH 2/4] fix text alignment on detail pages --- frontend/src/components/IndividualModel/CDFTable.js | 2 +- frontend/src/components/IndividualModel/GoodnessFit.js | 2 +- .../src/components/Output/NestedDichotomous/BootstrapRuns.js | 1 + frontend/src/components/Output/NestedDichotomous/LitterData.js | 2 +- frontend/src/components/common/Table.js | 2 +- 5 files changed, 5 insertions(+), 4 deletions(-) diff --git a/frontend/src/components/IndividualModel/CDFTable.js b/frontend/src/components/IndividualModel/CDFTable.js index 7653b47c..b20324e3 100644 --- a/frontend/src/components/IndividualModel/CDFTable.js +++ b/frontend/src/components/IndividualModel/CDFTable.js @@ -16,7 +16,7 @@ class CDFTable extends Component { ff(bmd_dist[1][i]), ff(bmd_dist[0][i]), ]), - tblClasses: "table table-sm text-right col-l-1", + tblClasses: "table table-sm text-right", }; return ; } diff --git a/frontend/src/components/IndividualModel/GoodnessFit.js b/frontend/src/components/IndividualModel/GoodnessFit.js index 69a0711d..988c9843 100644 --- a/frontend/src/components/IndividualModel/GoodnessFit.js +++ b/frontend/src/components/IndividualModel/GoodnessFit.js @@ -106,7 +106,7 @@ class GoodnessFit extends Component { } else { data = getContinuousNormalData(dataset, dtype, model); } - data.tblClasses = "table table-sm text-right col-l-1"; + data.tblClasses = "table table-sm text-right"; data.subheader = "Goodness of Fit"; return
; diff --git a/frontend/src/components/Output/NestedDichotomous/BootstrapRuns.js b/frontend/src/components/Output/NestedDichotomous/BootstrapRuns.js index cecd54ab..a9f217eb 100644 --- a/frontend/src/components/Output/NestedDichotomous/BootstrapRuns.js +++ b/frontend/src/components/Output/NestedDichotomous/BootstrapRuns.js @@ -37,6 +37,7 @@ const getData = function(model) { "99th", ], subheader: "Bootstrap Runs", + tblClasses: "table table-sm text-right", rows, }; }; diff --git a/frontend/src/components/Output/NestedDichotomous/LitterData.js b/frontend/src/components/Output/NestedDichotomous/LitterData.js index dd0f604e..f2588940 100644 --- a/frontend/src/components/Output/NestedDichotomous/LitterData.js +++ b/frontend/src/components/Output/NestedDichotomous/LitterData.js @@ -10,7 +10,7 @@ const getData = function(model) { const litter = model.results.litter, n = _.size(litter.lsc); return { - tblClasses: "table table-sm text-right col-l-1", + tblClasses: "table table-sm text-right", headers: [ "Dose", "Litter Specific Covariance", diff --git a/frontend/src/components/common/Table.js b/frontend/src/components/common/Table.js index e9c167fe..569dd67a 100644 --- a/frontend/src/components/common/Table.js +++ b/frontend/src/components/common/Table.js @@ -23,7 +23,7 @@ class Table extends Component { {data.subheader ? ( - + ) : null} From 5657a26c0067bd772a0c18f59184306fa64dd66c Mon Sep 17 00:00:00 2001 From: Andy Shapiro Date: Wed, 17 Jul 2024 22:54:48 -0400 Subject: [PATCH 3/4] rewrite model table implementation --- frontend/src/common.js | 8 +- .../Main/ModelsForm/ModelsCheckBox.js | 19 +-- .../Main/ModelsForm/ModelsCheckBoxHeader.js | 151 +++++++++++------- .../Main/ModelsForm/ModelsCheckBoxList.js | 11 +- frontend/src/components/common/Icon.js | 10 +- frontend/src/stores/ModelsStore.js | 5 - 6 files changed, 116 insertions(+), 88 deletions(-) diff --git a/frontend/src/common.js b/frontend/src/common.js index 76d9c166..edb957d5 100644 --- a/frontend/src/common.js +++ b/frontend/src/common.js @@ -24,7 +24,13 @@ export const simulateClick = function(el) { }; }, checkOrEmpty = bool => { - return ; + return ( + + ); }, getLabel = function(value, mapping) { return _.find(mapping, d => d.value == value).label; diff --git a/frontend/src/components/Main/ModelsForm/ModelsCheckBox.js b/frontend/src/components/Main/ModelsForm/ModelsCheckBox.js index d78fdfe5..37f2546e 100644 --- a/frontend/src/components/Main/ModelsForm/ModelsCheckBox.js +++ b/frontend/src/components/Main/ModelsForm/ModelsCheckBox.js @@ -77,41 +77,30 @@ const ModelsCheckBox = observer(props => { - - - - - - - - - - ); - } - if (store.getModelType === mc.MODEL_DICHOTOMOUS) { + } else if (store.getModelType === mc.MODEL_DICHOTOMOUS) { return ( @@ -182,8 +171,7 @@ const ModelsCheckBox = observer(props => { ); - } - if (store.getModelType === mc.MODEL_NESTED_DICHOTOMOUS) { + } else if (store.getModelType === mc.MODEL_NESTED_DICHOTOMOUS) { return ( @@ -198,8 +186,9 @@ const ModelsCheckBox = observer(props => { ); + } else { + throw `Unknown modelType: ${store.getModelType}`; } - throw `Unknown modelType: ${store.getModelType}`; }); ModelsCheckBox.propTypes = { store: PropTypes.any, diff --git a/frontend/src/components/Main/ModelsForm/ModelsCheckBoxHeader.js b/frontend/src/components/Main/ModelsForm/ModelsCheckBoxHeader.js index b00ae1bc..456c69ea 100644 --- a/frontend/src/components/Main/ModelsForm/ModelsCheckBoxHeader.js +++ b/frontend/src/components/Main/ModelsForm/ModelsCheckBoxHeader.js @@ -5,78 +5,119 @@ import React from "react"; import * as mc from "@/constants/mainConstants"; import {allModelOptions} from "@/constants/modelConstants"; +import Button from "../../common/Button"; import CheckboxInput from "../../common/CheckboxInput"; -import HelpTextPopover from "../../common/HelpTextPopover"; +import LabelInput from "../../common/LabelInput"; const areAllModelsChecked = function(modelType, type, models) { return type in models && models[type].length === allModelOptions[modelType][type].length; }, SelectAllComponent = observer(props => { - const {store, type, disabled} = props; - return store.canEdit ? ( - - ) : ( - + const {store, type, disabled, label} = props, + id = `select_all_${type}`; + return ( + <> + store.enableAll(type, value)} + checked={areAllModelsChecked(store.getModelType, type, store.models)} + /> +   + + + ); + }), + ModelColGroup = observer(props => { + const {hasBayesianModels} = props, + cols = hasBayesianModels ? [20, 20, 20, 20, 20] : [33, 33, 34]; + return ( + + {cols.map((d, i) => ( + + ))} + ); }); const ModelsCheckBoxHeader = observer(props => { const {store} = props, - content = "Models were previewed in BMDS Excel 3.2 and will be formally peer reviewed.", - title = "Bayesian Model Averaging", - {hasBayesianModels} = store, - isContinuous = store.getModelType === mc.MODEL_CONTINUOUS, - isMultiTumor = store.getModelType === mc.MODEL_MULTI_TUMOR; + {canEdit} = store, + hasBayesianModels = store.getModelType === mc.MODEL_DICHOTOMOUS; return ( - - - - - {hasBayesianModels ? ( - + + - ) : null} - - - - - - - - - {hasBayesianModels ? ( - <> - - - - ) : null} - - + + {hasBayesianModels ? : null} + + + + + {hasBayesianModels ? ( + <> + + + + ) : null} + + + ); }); ModelsCheckBoxHeader.propTypes = { store: PropTypes.object, }; + export default ModelsCheckBoxHeader; diff --git a/frontend/src/components/Main/ModelsForm/ModelsCheckBoxList.js b/frontend/src/components/Main/ModelsForm/ModelsCheckBoxList.js index e4bfc3f5..e651eb7f 100644 --- a/frontend/src/components/Main/ModelsForm/ModelsCheckBoxList.js +++ b/frontend/src/components/Main/ModelsForm/ModelsCheckBoxList.js @@ -4,7 +4,6 @@ import React, {Component} from "react"; import {MODEL_MULTI_TUMOR} from "@/constants/mainConstants"; -import Button from "../../common/Button"; import ModelsCheckBox from "./ModelsCheckBox"; import ModelsCheckBoxHeader from "./ModelsCheckBoxHeader"; @@ -12,8 +11,7 @@ import ModelsCheckBoxHeader from "./ModelsCheckBoxHeader"; @observer class ModelsCheckBoxList extends Component { render() { - const {modelsStore} = this.props, - mainStore = modelsStore.rootStore.mainStore; + const {modelsStore} = this.props; if (modelsStore.getModelType === MODEL_MULTI_TUMOR) { return (
@@ -29,13 +27,6 @@ class ModelsCheckBoxList extends Component { } return (
- {mainStore.canEdit ? ( -
{data.subheader}
Exponential
Hill
Linear
Polynomial
Power
- -
ModelsMaximum Likelihood Estimate - Bayesian Model Averaging - {isContinuous ? ( - + <> + +
+ Model + {canEdit ? ( + <> +
RestrictedUnrestricted
Prior Weights
Maximum Likelihood EstimateBayesian Model Averaging
+ Restricted + {canEdit ? ( + <> +
+ + + ) : null} +
+ Unrestricted + {canEdit ? ( + <> +
+ + + ) : null} +
+ Include + {canEdit ? ( + <> +
+ + + ) : null} +
+ Prior Weight +
diff --git a/frontend/src/components/common/Icon.js b/frontend/src/components/common/Icon.js index 09c36bea..2950bc71 100644 --- a/frontend/src/components/common/Icon.js +++ b/frontend/src/components/common/Icon.js @@ -3,9 +3,14 @@ import React, {Component} from "react"; class Icon extends Component { render() { - const {name, classes, text} = this.props, + const {name, classes, text, title} = this.props, extra = text ? " mr-1 " : " ", - icon = ; + icon = ( + + ); if (text) { return ( <> @@ -21,6 +26,7 @@ Icon.propTypes = { name: PropTypes.string.isRequired, classes: PropTypes.string, text: PropTypes.string, + title: PropTypes.string, }; Icon.defaultProps = { classes: "", diff --git a/frontend/src/stores/ModelsStore.js b/frontend/src/stores/ModelsStore.js index 3c63b9bd..ed5265c5 100644 --- a/frontend/src/stores/ModelsStore.js +++ b/frontend/src/stores/ModelsStore.js @@ -34,11 +34,6 @@ class ModelsStore { return this.rootStore.mainStore.model_type; } - @computed get hasBayesianModels() { - const modelType = this.getModelType; - return modelType === mc.MODEL_DICHOTOMOUS || modelType === mc.MODEL_CONTINUOUS; - } - @action.bound setModels(models) { this.models = models; this.setDefaultsByDatasetType(); From 8f7ff90b411f0497a0490c1551e7b6be7dfc2892 Mon Sep 17 00:00:00 2001 From: Andy Shapiro Date: Wed, 17 Jul 2024 23:37:34 -0400 Subject: [PATCH 4/4] fix layout of option and model options --- bmds_ui/static/css/site.css | 4 ++++ frontend/src/components/Main/Actions/Actions.js | 2 +- .../Main/DatasetModelOptionList/DatasetModelOption.js | 2 +- .../Main/DatasetModelOptionList/DatasetModelOptionList.js | 6 +++--- frontend/src/components/Main/OptionsForm/OptionsFormList.js | 4 ++-- 5 files changed, 11 insertions(+), 7 deletions(-) diff --git a/bmds_ui/static/css/site.css b/bmds_ui/static/css/site.css index a83c0058..1bc78975 100644 --- a/bmds_ui/static/css/site.css +++ b/bmds_ui/static/css/site.css @@ -63,6 +63,10 @@ input[type=number] { visibility: visible; } +.table-fixed { + table-layout: fixed; +} + /* table column text alignment */ .col-r-1 td:nth-child(1), .col-r-1 th:nth-child(1), diff --git a/frontend/src/components/Main/Actions/Actions.js b/frontend/src/components/Main/Actions/Actions.js index 87d5caa0..ba2cfe66 100644 --- a/frontend/src/components/Main/Actions/Actions.js +++ b/frontend/src/components/Main/Actions/Actions.js @@ -107,7 +107,7 @@ class Actions extends Component { ) : (

Please save and execute analysis.

)} - {(mainStore.isDesktop && mainStore.canEdit) ? ( + {mainStore.isDesktop && mainStore.canEdit ? ( <>
Collections diff --git a/frontend/src/components/Main/DatasetModelOptionList/DatasetModelOption.js b/frontend/src/components/Main/DatasetModelOptionList/DatasetModelOption.js index 1215faa2..4f89e8a9 100644 --- a/frontend/src/components/Main/DatasetModelOptionList/DatasetModelOption.js +++ b/frontend/src/components/Main/DatasetModelOptionList/DatasetModelOption.js @@ -64,7 +64,7 @@ class DatasetModelOption extends Component { ) : (
- + {option.degree !== undefined ? ( diff --git a/frontend/src/components/Main/DatasetModelOptionList/DatasetModelOptionList.js b/frontend/src/components/Main/DatasetModelOptionList/DatasetModelOptionList.js index c5269b99..90775d5b 100644 --- a/frontend/src/components/Main/DatasetModelOptionList/DatasetModelOptionList.js +++ b/frontend/src/components/Main/DatasetModelOptionList/DatasetModelOptionList.js @@ -26,14 +26,14 @@ class DatasetModelOptionList extends Component { } return ( -
{checkOrEmpty(option.enabled)}{checkOrEmpty(option.enabled)} {dataset.metadata.name}{getDegreeText(dtype, option.degree)}
+
{dtype == Dtype.CONTINUOUS || dtype == Dtype.CONTINUOUS_INDIVIDUAL ? ( @@ -54,7 +54,7 @@ class DatasetModelOptionList extends Component { diff --git a/frontend/src/components/Main/OptionsForm/OptionsFormList.js b/frontend/src/components/Main/OptionsForm/OptionsFormList.js index 4c18e667..3c36d018 100644 --- a/frontend/src/components/Main/OptionsForm/OptionsFormList.js +++ b/frontend/src/components/Main/OptionsForm/OptionsFormList.js @@ -29,7 +29,7 @@ class OptionsFormList extends Component {
-
Enabled Dataset - Maximum polynomial degree  + Maximum Polynomial Degree  Adverse DirectionEnabled Dataset - Maximum multistage degree + Maximum Multistage Degree
+
@@ -78,7 +78,7 @@ class OptionsFormList extends Component { ) : null} {optionsStore.canEdit ? ( -
Option Set # +