diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Cycle/edit.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Cycle/edit.js index 7b367e380dd72d1319f16db577ed6835a646c868..2d63ed9597669c46a87a0fe766ac49102b8f3586 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Cycle/edit.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Cycle/edit.js @@ -332,6 +332,7 @@ export class CycleEdit extends Component { .then(async (cycle) => { if (cycle && this.state.cycle.updated_at !== cycle.updated_at) { this.saveCycleQuota(cycle); + this.props.history.length>2 && this.props.history.go(-2); } else { this.growl.show({severity: 'error', summary: 'Error Occured', detail: 'Unable to update Cycle'}); //this.setState({errors: cycle}); @@ -410,7 +411,7 @@ export class CycleEdit extends Component { */ cancelEdit() { publish('edit-dirty', false); - this.props.history.length>1?!this.state.isDirty?this.props.history.go(-2):this.props.history.go(-1):this.props.history.push(`/cycle/view/${this.props.match.params.id}`); + this.props.history.length>1?this.state.isDirty?this.props.history.go(-2):this.props.history.go(-1):this.props.history.push(`/cycle/view/${this.props.match.params.id}`); this.setState({showDialog: false}); } diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Project/edit.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Project/edit.js index 8d9fc05dd00276f262718de44877efe445f176b1..bad5ca428d5334570ca590c79ee96e1909f28166 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Project/edit.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Project/edit.js @@ -385,6 +385,7 @@ export class ProjectEdit extends Component { project.archive_location = archive_location; project.archiveId = archiveId; this.saveProjectQuota(project); + this.props.history.length>2 && this.props.history.go(-2); } else { this.growl.show({severity: 'error', summary: 'Error Occured', detail: 'Unable to update Project'}); this.setState({errors: project}); @@ -397,6 +398,8 @@ export class ProjectEdit extends Component { * Function to Create, Update & Delete project_quota for the project */ async saveProjectQuota(project) { + this.setState({isDirty: false}); + publish('edit-dirty', false); let dialog = {}; let quotaError = {}; let updatingProjectQuota = []; @@ -458,8 +461,7 @@ export class ProjectEdit extends Component { } else { dialog = {header: 'Error', detail: 'Project updated successfully but resource allocation not updated properly.'}; } - this.setState({dialogVisible: true, dialog: dialog, isDirty: false}); - publish('edit-dirty', false); + this.setState({dialogVisible: true, dialog: dialog}); } /** @@ -482,7 +484,7 @@ export class ProjectEdit extends Component { */ cancelEdit() { publish('edit-dirty', false); - this.props.history.length>1?!this.state.isDirty?this.props.history.go(-2):this.props.history.go(-1):this.props.history.push(`/project/view/${this.props.match.params.id}`); + this.props.history.length>1?this.state.isDirty?this.props.history.go(-2):this.props.history.go(-1):this.props.history.push(`/project/view/${this.props.match.params.id}`); this.setState({showDialog: false}); }