From 62a959621c265634fda3fc8b2f6113a1992fdd07 Mon Sep 17 00:00:00 2001 From: Jeffrey Chiu Date: Thu, 14 Oct 2021 14:29:16 -0400 Subject: [PATCH 1/9] added validate button --- src/src/components/ingest/dataset_edit.jsx | 54 +++++++++++----------- src/src/components/uploads/editUploads.jsx | 53 +++++++++++++++++++-- 2 files changed, 77 insertions(+), 30 deletions(-) diff --git a/src/src/components/ingest/dataset_edit.jsx b/src/src/components/ingest/dataset_edit.jsx index 619176b6..c79e9bd9 100644 --- a/src/src/components/ingest/dataset_edit.jsx +++ b/src/src/components/ingest/dataset_edit.jsx @@ -102,7 +102,7 @@ class DatasetEdit extends Component { get_assay_type(other_dt, JSON.parse(localStorage.getItem("info")).nexus_token) .then((resp) => { if (resp.status === 200) { - console.log('Assay Type info...', resp.results); + //console.log('Assay Type info...', resp.results); if (resp.results) { this.setState({ @@ -131,7 +131,7 @@ class DatasetEdit extends Component { ingest_api_allowable_edit_states(this.props.editingDataset.uuid, JSON.parse(localStorage.getItem("info")).nexus_token) .then((resp) => { if (resp.status === 200) { - console.log('edit states...', resp.results); + //console.log('edit states...', resp.results); this.setState({ writeable: resp.results.has_write_priv, @@ -410,7 +410,7 @@ class DatasetEdit extends Component { break; } if (id.startsWith("dt")) { - //////console.log('ping!', id); + console.log('ping!', id); if (id === "dt_other") { const data_types = this.state.data_types; this.setState({ @@ -431,7 +431,14 @@ class DatasetEdit extends Component { } } else { //////console.log(id, e.target.checked) - if (e.target.checked) { + + const data_types = this.state.data_types; + data_types.add(value); + this.setState({ + data_types: data_types, + }); + console.log("data types is ", data_types); + /*if (e.target.checked) { const data_types = this.state.data_types; data_types.add(name); this.setState({ @@ -443,7 +450,7 @@ class DatasetEdit extends Component { this.setState({ data_types: data_types, }); - } + }*/ } //////console.log('data_types', this.state.data_types) @@ -1170,7 +1177,7 @@ class DatasetEdit extends Component { renderOneAssay(val, idx) { var idstr = 'dt_' + val.name.toLowerCase().replace(' ','_'); return (
- @@ -1200,11 +1207,18 @@ class DatasetEdit extends Component { } renderAssayColumn(min, max) { - return (
- {this.state.data_type_dicts.slice(min, max).map((val, idx) => - {return this.renderOneAssay(val, idx)})}
+ return ( + this.state.data_type_dicts.slice(min, max).map((val, idx) => + {return this.renderAssay(val, idx)}) ) } + + renderAssay(val, idx) { + var idstr = 'dt_' + val.name.toLowerCase().replace(' ','_'); + return ( + + ) + } renderAssayArray() { if (this.state.data_type_dicts.length) { @@ -1212,22 +1226,9 @@ class DatasetEdit extends Component { var entries_per_col = Math.ceil(len / 3); //var num_cols = Math.ceil(len / entries_per_col); return (<> -
{this.renderAssayColumn(0, entries_per_col)}
-
{this.renderAssayColumn(entries_per_col, 2*entries_per_col)}
-
{this.renderAssayColumn(2*entries_per_col, len+1)} -
- - -
+ {this.state.has_other_datatype && (
)} -
- + ) } else { diff --git a/src/src/components/uploads/editUploads.jsx b/src/src/components/uploads/editUploads.jsx index a7ca65cb..3c6e34db 100644 --- a/src/src/components/uploads/editUploads.jsx +++ b/src/src/components/uploads/editUploads.jsx @@ -24,7 +24,9 @@ import TableHead from '@material-ui/core/TableHead'; import TableRow from '@material-ui/core/TableRow'; import { ingest_api_get_globus_url, ingest_api_validate_upload, - ingest_api_submit_upload } from '../../service/ingest_api'; + ingest_api_submit_upload, + ingest_api_users_groups } from '../../service/ingest_api'; +import { GROUPS } from '../../service/groups' import { COLUMN_DEF_DATASET} from '../search/table_constants'; class EditUploads extends Component { @@ -370,13 +372,20 @@ class EditUploads extends Component { renderButtonBar(){ return ( -
+
{this.renderHelperText()} -
+ +
+ {this.renderValidateButton()} +
+ + +
+ {this.renderActionButton()} + + ) + } + } + ) + } + }); + } + + + + + } + renderActionButton() { + var local = JSON.parse(localStorage.getItem("info")); + console.debug(local); if (["NEW", "INVALID", "ERROR"].includes( this.state.status.toUpperCase() )){ From 49570e5b812cfa973f82254fc2a951cbba9d2d18 Mon Sep 17 00:00:00 2001 From: Jeffrey Chiu Date: Fri, 15 Oct 2021 12:44:29 -0400 Subject: [PATCH 2/9] changed dataset field to only take one --- src/src/components/ingest/dataset_edit.jsx | 49 +++++++++++++++++----- src/src/components/uploads/editUploads.jsx | 4 +- 2 files changed, 40 insertions(+), 13 deletions(-) diff --git a/src/src/components/ingest/dataset_edit.jsx b/src/src/components/ingest/dataset_edit.jsx index c79e9bd9..2e4e05df 100644 --- a/src/src/components/ingest/dataset_edit.jsx +++ b/src/src/components/ingest/dataset_edit.jsx @@ -388,6 +388,7 @@ class DatasetEdit extends Component { this.setState({ dataset_info: value, }); + break; case "status": this.setState({ new_status: value, @@ -431,14 +432,38 @@ class DatasetEdit extends Component { } } else { //////console.log(id, e.target.checked) - - const data_types = this.state.data_types; - data_types.add(value); - this.setState({ - data_types: data_types, - }); - console.log("data types is ", data_types); - /*if (e.target.checked) { + if (value == "other") { + const data_types = this.state.data_types; + data_types.clear(); + data_types.add(value); + this.setState({ + data_types: data_types, + has_other_datatype: value == "other", + }); + console.log("other", this.state.has_other_datatype); + if (value != "other") { + const data_type_options = new Set(this.state.data_type_dicts.map((elt, idx) => {return elt.name})); + const data_types = this.state.data_types; + const other_dt = Array.from(data_types).filter( + (dt) => !data_type_options.has(dt) + )[0]; + data_types.delete(other_dt); + this.setState({ + data_types: data_types, + other_dt: "", + }); + } + + } else { + const data_types = this.state.data_types; + data_types.clear(); + data_types.add(value); + this.setState({ + has_other_datatype: false, + data_types: data_types, + }); + console.log("data types is ", data_types); + }/*if (e.target.checked) { const data_types = this.state.data_types; data_types.add(name); this.setState({ @@ -1216,20 +1241,22 @@ class DatasetEdit extends Component { renderAssay(val, idx) { var idstr = 'dt_' + val.name.toLowerCase().replace(' ','_'); return ( - + ) } renderAssayArray() { if (this.state.data_type_dicts.length) { var len = this.state.data_type_dicts.length; - var entries_per_col = Math.ceil(len / 3); + //var entries_per_col = Math.ceil(len / 3); //var num_cols = Math.ceil(len / entries_per_col); return (<> - {this.renderAssayColumn(0, len)} + {this.state.has_other_datatype && ( +
{ - if (results.status == 200) { + if (results.status === 200) { results.results.forEach(function(result) { if (group_uuids.includes(result.uuid)) { return ( From bd6bcadabf7f54336c7ccbbb608cd3d8c958dfc8 Mon Sep 17 00:00:00 2001 From: Jeffrey Chiu Date: Fri, 15 Oct 2021 12:59:09 -0400 Subject: [PATCH 3/9] added alert to validate button --- src/src/components/ingest/dataset_edit.jsx | 4 ++++ src/src/components/uploads/editUploads.jsx | 8 ++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/src/components/ingest/dataset_edit.jsx b/src/src/components/ingest/dataset_edit.jsx index 2e4e05df..15a3fdb8 100644 --- a/src/src/components/ingest/dataset_edit.jsx +++ b/src/src/components/ingest/dataset_edit.jsx @@ -1244,12 +1244,15 @@ class DatasetEdit extends Component { ) } + + renderAssayArray() { if (this.state.data_type_dicts.length) { var len = this.state.data_type_dicts.length; //var entries_per_col = Math.ceil(len / 3); //var num_cols = Math.ceil(len / entries_per_col); + return (<> + - {this.state.has_other_datatype && ( + {this.state.has_other_datatype && (
+ className={"form-control " + + this.errorClass(this.state.formErrors.other_dt) + } + placeholder='Other Data Type' + value={this.state.other_dt} + onChange={this.handleInputChange} + />
- )} + )} - ) + ) + } else if (this.state.data_types.size === 1) { + + return (<> + + + + {this.state.has_other_datatype && ( + +
+ +
+ )} + + ) + } else { + return (<> + +
    + {this.renderMultipleAssays(0, len)} +
+ + ) + } } else { @@ -1877,7 +1929,7 @@ class DatasetEdit extends Component {
{this.state.formErrors.data_types && (
- At least one Dataa Type is Required. + At least one Data Type is Required.
)}
From 2a880ff91a0af4140a0a1b670dd7444fd147a9fc Mon Sep 17 00:00:00 2001 From: Jeffrey Chiu Date: Thu, 28 Oct 2021 16:28:04 -0400 Subject: [PATCH 8/9] fixed bug with number of datasets --- src/src/components/ingest/dataset_edit.jsx | 25 ++++++++++++---------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/src/components/ingest/dataset_edit.jsx b/src/src/components/ingest/dataset_edit.jsx index d1221ae2..168cefde 100644 --- a/src/src/components/ingest/dataset_edit.jsx +++ b/src/src/components/ingest/dataset_edit.jsx @@ -1453,18 +1453,21 @@ class DatasetEdit extends Component { ) } - renderMultipleAssays(min, max) { + renderListAssay(val) { return ( - this.state.data_type_dicts.slice(min, max).map((val, idx) => - {return this.renderListAssay(val,idx)}) - ) +
  • {val}
  • + ) } - renderListAssay(val, idx) { + renderMultipleAssays() { + var arr = Array.from(this.state.data_types) return ( -
  • {val.description}
  • - ) - } + arr.map((val) => + {return this.renderListAssay(val)}) + ) + } + + @@ -1501,7 +1504,7 @@ class DatasetEdit extends Component { )} ) - } else if (this.state.data_types.size === 1) { + } else if (this.state.data_types.size === 1 || this.state.data_types.size === 0) { return (<> @@ -1526,11 +1529,11 @@ class DatasetEdit extends Component { )} ) - } else { + } else if (this.state.data_types.size > 1) { return (<>
      - {this.renderMultipleAssays(0, len)} + {this.renderMultipleAssays()}
    ) From 6e6373535ad3bbf24b04ea24f8e802fb0196314f Mon Sep 17 00:00:00 2001 From: davism84 Date: Mon, 8 Nov 2021 12:25:40 -0500 Subject: [PATCH 9/9] fixed source description display for samples --- src/src/components/uuid/tissue_form_components/tissueForm.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/src/components/uuid/tissue_form_components/tissueForm.jsx b/src/src/components/uuid/tissue_form_components/tissueForm.jsx index a84e3dcf..0d97408e 100644 --- a/src/src/components/uuid/tissue_form_components/tissueForm.jsx +++ b/src/src/components/uuid/tissue_form_components/tissueForm.jsx @@ -319,7 +319,7 @@ class TissueForm extends Component { } ); - this.getSourceAncestorOrgan(this.state.editingEntity); + //this.getSourceAncestorOrgan(this.state.editingEntity); } else { @@ -503,7 +503,7 @@ class TissueForm extends Component { //////console.debug('Entity ancestors...', response.results); if (response.results.length > 0) { - ////////console.debug('Entity ancestors...ORGAN', ancestor_organ); + console.debug('Entity ancestors...', response.results); this.setState({ source_entity: response.results[0], ancestor_organ: response.results[0].organ // use "top" ancestor organ