Skip to content

Commit

Permalink
Merge pull request #1091 from hubmapconsortium/Publications
Browse files Browse the repository at this point in the history
Publications
  • Loading branch information
yuanzhou authored Apr 14, 2023
2 parents eb27733 + 3ef7183 commit 90ccf78
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 8 deletions.
24 changes: 17 additions & 7 deletions src/src/components/ingest/publications_edit.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,12 @@ class PublicationEdit extends Component {
});
};

cancelLookUpModal = () => {
this.setState({
LookUpShow: false,
lookUpCancelled: true
});
};

cancelGroupModal = () => {
this.setState({
Expand Down Expand Up @@ -1426,12 +1432,13 @@ class PublicationEdit extends Component {
renderButtons() {
var latestCheck = !this.state.editingPublication.next_revision_uuid ||this.state.editingPublication.next_revision_uuid === undefined;
var writeCheck = this.state.has_write_priv
var subCheck = this.state.has_submit_priv
var adminCheck = this.state.has_admin_priv
// var subCheck = this.state.has_submit_priv // Not Working for Pubs yet (/ingest-api/issues/301)
var versCheck = this.state.has_version_priv
var pubCheck = this.state.editingPublication.status === "Published"
var newCheck = this.state.editingPublication.status === "New"
var newFormCheck = this.props.newForm
console.table({latestCheck,writeCheck, subCheck, versCheck, pubCheck, newCheck, newFormCheck});
// console.table({latestCheck,writeCheck, adminCheck, versCheck, pubCheck, newCheck, newFormCheck});

return (
<div className="buttonWrapRight">
Expand All @@ -1441,7 +1448,7 @@ class PublicationEdit extends Component {
)}
{!pubCheck && writeCheck && (<>{this.saveButton()}</>)}
{newFormCheck && (<>{this.saveButton()}</>)}
{subCheck && !newFormCheck && newCheck && (<>{this.submitButton()}</>)}
{adminCheck && !newFormCheck && newCheck && (<>{this.submitButton()}</>)}
{this.cancelModalButton()}
</div>
);
Expand Down Expand Up @@ -1546,8 +1553,8 @@ class PublicationEdit extends Component {
<Button
type="button"
variant="contained"
onClick={() => this.handleSubmit("save")}>
{this.state.buttonSpinnerTarget === "save" && (
onClick={() => this.handleSubmit("submit")}>
{this.state.buttonSpinnerTarget === "submit" && (
<span>
<FontAwesomeIcon icon={faSpinner} spin />
</span>
Expand Down Expand Up @@ -1890,6 +1897,9 @@ class PublicationEdit extends Component {
custom_title="Search for a Source ID for your Publication"
filter_type="Publication"
modecheck="Source"
restrictions={{
entityType : "dataset"
}}
/>
</DialogContent>
<DialogActions>
Expand Down Expand Up @@ -1980,10 +1990,10 @@ class PublicationEdit extends Component {
{/* pub Status */}
<div className={"form-gropup mb-4 "+this.state.formErrors.publication_status}>
<FormControl
error={this.state.validationStatus.publication_status} >
error={ this.state.validationStatus.publication_status.length>0 ? true : false} >
<FormLabel
id="publication_status"
error={this.state.validationStatus.publication_status}>
error={ this.state.validationStatus.publication_status.length>0 ? true : false }>
Has this Publication been Published?
</FormLabel>
<RadioGroup
Expand Down
13 changes: 12 additions & 1 deletion src/src/components/search/SearchComponent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ class SearchComponent extends Component {
show_search: true,
table_loading:false,
updateSuccess: false,
restrictions:this.props.restrictions ? this.props.restrictions : {},
search_filters:{
entityType: "",
keywords: "",
Expand All @@ -71,8 +72,17 @@ class SearchComponent extends Component {
}

componentDidMount() {
console.debug("!!!SearchComponent: componentDidMount", this.state.restrictions, this.props.restrictions);
if(this.props.restrictions){
// So we can apply the object right to the state instead of do parse tango
var restrictedState = this.state.restrictions;
restrictedState.search_filters = this.state.restrictions;
this.setState(restrictedState,
function(){
this.handleSearchClick();
})
}
if(this.props.packagedQuery){

this.setState({
entityType: this.props.packagedQuery.entityType,
keywords: this.props.packagedQuery.keywords,
Expand Down Expand Up @@ -890,6 +900,7 @@ renderInfoPanel() {
name="entityType"
id="entityType"
className="select-css"
disabled={this.props.restrictions && this.props.restrictions.entityType ? true : false}
onChange={this.handleInputChange}
value={this.state.search_filters.entityType}
>
Expand Down

0 comments on commit 90ccf78

Please sign in to comment.