Skip to content

Commit

Permalink
Merge pull request #711 from hubmapconsortium/test-release
Browse files Browse the repository at this point in the history
v2.1.3 release
  • Loading branch information
yuanzhou committed Nov 15, 2021
2 parents 42a6eb7 + 69ceec4 commit 8b67b22
Show file tree
Hide file tree
Showing 6 changed files with 185 additions and 49 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.1.2
2.1.3
2 changes: 1 addition & 1 deletion src/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ingest-ui",
"version": "2.1.2",
"version": "2.1.3",
"private": true,
"homepage": ".",
"dependencies": {
Expand Down
171 changes: 130 additions & 41 deletions src/src/components/ingest/dataset_edit.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,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({
Expand Down Expand Up @@ -150,7 +150,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,
Expand Down Expand Up @@ -448,7 +448,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({
Expand All @@ -469,7 +469,38 @@ class DatasetEdit extends Component {
}
} else {
//////console.log(id, e.target.checked)
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({
Expand All @@ -481,7 +512,7 @@ class DatasetEdit extends Component {
this.setState({
data_types: data_types,
});
}
}*/

}
//////console.log('data_types', this.state.data_types)
Expand Down Expand Up @@ -1376,8 +1407,10 @@ class DatasetEdit extends Component {

renderOneAssay(val, idx) {
var idstr = 'dt_' + val.name.toLowerCase().replace(' ','_');
return (<div className='form-group form-check ' key={idstr}>
<input type='checkbox' className={'form-check-input '+ this.errorClass(this.state.formErrors.data_types)} name={val.name} key={idstr} id={idstr}

return (<div className='form-group form-check' key={idstr}>
<input type='radio' className='form-check-input' name={val.name} key={idstr} id={idstr}

onChange={this.handleInputChange} checked={this.state.data_types.has(val.name)}
/>
<label className='form-check-label' htmlFor={idstr}>{val.description}</label>
Expand Down Expand Up @@ -1407,49 +1440,105 @@ class DatasetEdit extends Component {
}

renderAssayColumn(min, max) {
return (<div>
{this.state.data_type_dicts.slice(min, max).map((val, idx) =>
{return this.renderOneAssay(val, idx)})}</div>
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 (
<option value={val.name} onChange={this.handleInputChange} id={idstr}>{val.description}</option>
)
}

renderListAssay(val) {
return (
<li>{val}</li>
)
}

renderMultipleAssays() {
var arr = Array.from(this.state.data_types)
return (
arr.map((val) =>
{return this.renderListAssay(val)})
)
}





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 (<>
<div className='col-sm-4'> {this.renderAssayColumn(0, entries_per_col)} </div>
<div className='col-sm-4'> {this.renderAssayColumn(entries_per_col, 2*entries_per_col)} </div>
<div className='col-sm-4'> {this.renderAssayColumn(2*entries_per_col, len+1)}
<div className='form-group form-check'>
<input
type='checkbox'
className='form-check-input '
name='dt_other'
id='dt_other'
onChange={this.handleInputChange}
checked={this.state.has_other_datatype}
/>
<label className='form-check-label' htmlFor='dt_other'>
Other
</label>
</div>
{this.state.has_other_datatype && (
console.log("length is ", this.state.data_types.size)
console.log("other ", this.state.has_other_datatype)

if (this.state.data_types.size === 1 && this.state.has_other_datatype) {
console.log("runs")
return (<>

<select value={this.state.data_types.values().next().value} id="dt_select" onChange={this.handleInputChange}>
<option></option>
{this.renderAssayColumn(0, len)}
<option value="other">Other</option>
</select>

{this.state.has_other_datatype && (

<div className='form-group'>
<input type='text' name='other_dt' id='other_dt'
className={"form-control " +
this.errorClass(this.state.formErrors.other_dt)
}
placeholder='Other Data Type'
value={this.state.other_dt}
onChange={this.handleInputChange}
/>
className={"form-control " +
this.errorClass(this.state.formErrors.other_dt)
}
placeholder='Other Data Type'
value={this.state.other_dt}
onChange={this.handleInputChange}
/>
</div>
)}
</div>
</>
)
)}
</>
)
} else if (this.state.data_types.size === 1 || this.state.data_types.size === 0) {

return (<>

<select value={this.state.data_types.values().next().value} id="dt_select" onChange={this.handleInputChange}>
<option></option>
{this.renderAssayColumn(0, len)}
<option value="other">Other</option>
</select>

{this.state.has_other_datatype && (

<div className='form-group'>
<input type='text' name='other_dt' id='other_dt'
className={"form-control " +
this.errorClass(this.state.formErrors.other_dt)
}
placeholder='Other Data Type'
value={this.state.other_dt}
onChange={this.handleInputChange}
/>
</div>
)}
</>
)
} else if (this.state.data_types.size > 1) {
return (<>

<ul>
{this.renderMultipleAssays()}
</ul>

</>)
}

}
else {
return <h3>Loading assay types...</h3>;
Expand Down Expand Up @@ -1843,7 +1932,7 @@ class DatasetEdit extends Component {
<div className='col-sm-12'>
{this.state.formErrors.data_types && (
<div className='alert alert-danger'>
At least one Dataa Type is Required.
At least one Data Type is Required.
</div>
)}
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/src/components/search/SearchComponent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { COLUMN_DEF_DONOR, COLUMN_DEF_SAMPLE, COLUMN_DEF_DATASET, COLUMN_DEF_UPL

import { entity_api_get_entity } from '../../service/entity_api';
import { ingest_api_allowable_edit_states, ingest_api_users_groups } from '../../service/ingest_api';
import 'url-search-params-polyfill';
// import 'url-search-params-polyfill';

// Creation donor_form_components

Expand Down
53 changes: 50 additions & 3 deletions src/src/components/uploads/editUploads.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -370,13 +372,20 @@ class EditUploads extends Component {

renderButtonBar(){
return (
<div className='row'>
<div className='row justify-content-end'>
<div className="col-sm-12">
<Divider />
</div>

{this.renderHelperText()}
<div className='col-md-12 text-right pads'>

<div className='col-md-2 pads'>
{this.renderValidateButton()}
</div>


<div className='col-md-1 pads'>

{this.renderActionButton()}
<button
type='button'
Expand All @@ -390,8 +399,46 @@ class EditUploads extends Component {
);
}

renderValidateButton() {
var local = JSON.parse(localStorage.getItem("info"));
var group_uuids = ["89a69625-99d7-11ea-9366-0e98982705c1", "75804b96-d4a8-11e9-9da9-0ad4acb67ed4"];
console.log(group_uuids.length);
ingest_api_users_groups(local.nexus_token).then((results) => {
console.log(results.results);
});
if (["SUBMITTED", "INVALID", "ERROR"].includes(
this.state.status.toUpperCase()
)){
ingest_api_users_groups(local.nexus_token).then((results) => {
if (results.status === 200) {
results.results.forEach(function(result) {
if (group_uuids.includes(result.uuid)) {
return (
<React.Fragment>
<button
type='button'
className = 'btn btn-info mr-1'
onClick = {() => this.tempAlert()}
>
Validate
</button>
</React.Fragment>
)
}
}
)
}
});
}
}

tempAlert() {
window.alert("This function has not yet been implemented.");
}

renderActionButton() {
var local = JSON.parse(localStorage.getItem("info"));
console.debug(local);
if (["NEW", "INVALID", "ERROR"].includes(
this.state.status.toUpperCase()
)){
Expand Down
4 changes: 2 additions & 2 deletions src/src/components/uuid/tissue_form_components/tissueForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ class TissueForm extends Component {

} );

this.getSourceAncestorOrgan(this.state.editingEntity);
//this.getSourceAncestorOrgan(this.state.editingEntity);


} else {
Expand Down Expand Up @@ -505,7 +505,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
Expand Down

0 comments on commit 8b67b22

Please sign in to comment.