From 80f61d443d716ca913a94db32848d076b66ce01c Mon Sep 17 00:00:00 2001 From: Ramesh Kumar <ramesh.p@matriotsolutions.com> Date: Thu, 15 Apr 2021 17:09:36 +0530 Subject: [PATCH] TMSS-631: Updated flag to avoid showing browser confirm dialog when custom dialog is displayed. --- SAS/TMSS/frontend/tmss_webapp/src/routes/Cycle/create.js | 1 + SAS/TMSS/frontend/tmss_webapp/src/routes/Cycle/edit.js | 2 ++ SAS/TMSS/frontend/tmss_webapp/src/routes/Project/create.js | 3 +++ SAS/TMSS/frontend/tmss_webapp/src/routes/Project/edit.js | 5 ++++- .../frontend/tmss_webapp/src/routes/Scheduling/create.js | 3 +++ SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/edit.js | 3 +++ SAS/TMSS/frontend/tmss_webapp/src/routes/Task/edit.js | 3 +++ 7 files changed, 19 insertions(+), 1 deletion(-) diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Cycle/create.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Cycle/create.js index 5634104ba72..947d3c1164b 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Cycle/create.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Cycle/create.js @@ -335,6 +335,7 @@ export class CycleCreate extends Component { * Function to cancel form creation and navigate to other page/component */ cancelCreate() { + publish('edit-dirty', false); this.setState({redirect: '/cycle'}); } 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 195f63836bb..fc08193ce91 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Cycle/edit.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Cycle/edit.js @@ -404,6 +404,8 @@ export class CycleEdit extends Component { cancelEdit() { publish('edit-dirty', false); this.props.history.goBack(); + this.setState({showDialog: false}); + this.props.history.goBack(); } render() { diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Project/create.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Project/create.js index e8e83a5f200..6e988255776 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Project/create.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Project/create.js @@ -371,6 +371,9 @@ export class ProjectCreate extends Component { * Function to cancel form creation and navigate to other page/component */ cancelCreate() { + publish('edit-dirty', false); + this.props.history.goBack(); + this.setState({showDialog: false}); this.props.history.goBack(); } 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 cf26715145e..a8c35a62b88 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Project/edit.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Project/edit.js @@ -424,7 +424,10 @@ export class ProjectEdit extends Component { * Cancel edit and redirect to Project View page */ cancelEdit() { - this.props.history.goBack(); + publish('edit-dirty', false); + this.props.history.goBack(); + this.setState({showDialog: false}); + this.props.history.goBack(); } render() { diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/create.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/create.js index 536ca2bd822..7f552ba2d3c 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/create.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/create.js @@ -424,6 +424,9 @@ export class SchedulingUnitCreate extends Component { * Cancel SU creation and redirect */ cancelCreate() { + publish('edit-dirty', false); + this.props.history.goBack(); + this.setState({showDialog: false}); this.props.history.goBack(); } diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/edit.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/edit.js index 3a2295b9748..d28fc907e58 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/edit.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/edit.js @@ -417,6 +417,9 @@ export class EditSchedulingUnit extends Component { * Cancel SU creation and redirect */ cancelCreate() { + publish('edit-dirty', false); + this.props.history.goBack(); + this.setState({showDialog: false}); this.props.history.goBack(); } diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Task/edit.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Task/edit.js index 7bb51d5b36e..e600a9b5005 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Task/edit.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Task/edit.js @@ -169,6 +169,9 @@ export class TaskEdit extends Component { } cancelEdit() { + publish('edit-dirty', false); + this.props.history.goBack(); + this.setState({showDialog: false}); this.props.history.goBack(); } -- GitLab