Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Missing Publication Status Revert Function & button #1534

Merged
merged 1 commit into from
Feb 3, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 40 additions & 16 deletions src/src/components/ingest/publications_edit.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Dialog from "@material-ui/core/Dialog";
import DialogActions from "@material-ui/core/DialogActions";
import DialogContent from "@material-ui/core/DialogContent";
import Button from "@mui/material/Button";

import LoadingButton from '@mui/lab/LoadingButton';
import Collapse from '@mui/material/Collapse';
import FormGroup from '@mui/material/FormGroup';
import FormControlLabel from '@mui/material/FormControlLabel';
Expand Down Expand Up @@ -953,6 +953,37 @@ class PublicationEdit extends Component {
window.location.reload();
};

handleStatusSet = (e) => {
this.setState({submittingUpdate:true});
var newStatus = this.state.newStatus;
entity_api_update_entity(
this.props.editingPublication.uuid,
{"status":newStatus},
JSON.parse(localStorage.getItem("info")).groups_token)
.then((response) => {
if (response.status < 300) {
this.setState({
submit_error:false,
submitting:false,
submittingUpdate:false,
});
this.props.onUpdated(response.results);
} else {
this.setState({
submit_error:true,
submitting:false,
submittingUpdate:false,
submitErrorResponse:response.results.statusText
});
}
})
.catch((error) => {
this.setState({submit_error:true,
submitting:false,});
});
}


handleSubmit = (submitIntention) => {

this.setState({
Expand Down Expand Up @@ -1611,19 +1642,14 @@ class PublicationEdit extends Component {
{this.state.statusSetLabel}
</Button>
{this.state.toggleStatusSet && (
<Button
variant="contained"
<LoadingButton
className="mx-1"
onClick={() => this.handleStatusSet() }>
{this.state.submitting && (
<FontAwesomeIcon
className='inline-icon'
icon={faSpinner}
spin
/>
)}
{!this.state.submittingUpdate && "Update"}
</Button>
loading={this.state.submittingUpdate}
onClick={() => this.handleStatusSet()}
variant="contained">
Update
</LoadingButton>

)}
<Collapse in={this.state.toggleStatusSet} className="col-7">
<FormGroup controlId="status">
Expand Down Expand Up @@ -2365,9 +2391,7 @@ class PublicationEdit extends Component {
show={this.state.GroupSelectShow}
groups={this.state.groups}
hide={()=> this.hideGroupSelectModal()}
submit={() => this.handleSubmit("save")} // It'll only be askign which group pn create
// submit={this.handleSubmit}
// submit={this.handleSubmit} Modal only appears when theres no group, which only happens on new form. Intent is blank
submit={() => this.handleSubmit("save")}
handleInputChange={this.handleInputChange}
/>
<HIPPA show={this.state.show} handleClose={this.hideModal} />
Expand Down