From 17f8d150c2e15fc6e6d063709e63127247b1720d Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Tue, 23 Apr 2024 12:08:31 -0500 Subject: [PATCH 1/2] Issue 58: Unable to re-arrange the submission workflow in Manage Workflow. The organization is being changed but the dirty flag is not being set. Manually set the dirty flag before sending. The `OrganizationRepo` listeners are either not doing anything or they are not checking for when status is a failure. The `ApiResponseActions.READ` and `ApiResponseActions.BROADCAST` never do anything because the `resetManageOrganization()` only does anything when the organization is provided. No organization is being provided. --- .../organizationManagementController.js | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/main/webapp/app/controllers/settings/organizationManagementController.js b/src/main/webapp/app/controllers/settings/organizationManagementController.js index f89e475cd..67319754a 100644 --- a/src/main/webapp/app/controllers/settings/organizationManagementController.js +++ b/src/main/webapp/app/controllers/settings/organizationManagementController.js @@ -98,11 +98,13 @@ vireo.controller("OrganizationManagementController", function ($controller, $loc }; $scope.reorderWorkflowStepUp = function (workflowStepID) { + $scope.getSelectedOrganization().$dirty = true; AccordionService.closeAll(); return OrganizationRepo.reorderWorkflowSteps("up", workflowStepID); }; $scope.reorderWorkflowStepDown = function (workflowStepID) { + $scope.getSelectedOrganization().$dirty = true; AccordionService.closeAll(); return OrganizationRepo.reorderWorkflowSteps("down", workflowStepID); }; @@ -123,18 +125,12 @@ vireo.controller("OrganizationManagementController", function ($controller, $loc $scope.ready.then(function () { $scope.resetWorkflowSteps(); - OrganizationRepo.listen(function () { - $scope.resetWorkflowSteps(); - }); - - OrganizationRepo.listen(ApiResponseActions.READ, function () { - $scope.resetManageOrganization(); - }); - - OrganizationRepo.listen(ApiResponseActions.BROADCAST, function () { - $scope.resetManageOrganization(); + OrganizationRepo.listen(function (res) { + var resObj = !!res && !!res.body ? angular.fromJson(res.body) : {}; + if (!!resObj && !!resObj.meta && !!resObj.meta.status && resObj.meta.status === 'SUCCESS') { + $scope.resetWorkflowSteps(); + } }); - }); $scope.acceptsSubmissions = [{ From b393c6f373dc6eea1790414c9be05c46bb8266ec Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Tue, 23 Apr 2024 14:19:38 -0500 Subject: [PATCH 2/2] Issue 58: Continue to call the resetManageOrganization() in a way that does something. The `OrganizationRepo.listen(ApiResponseActions.READ,...` call was removed for being a no-op. Even older code suggests that this should in fact be doing something. Add the function call back, but this time add the selected organization if one exists so that the function is not a no-op. Whether or not this change fixes or breaks something is unclear. Be wary of regressions. Be hopeful of bonus bug fixes. --- .../settings/organizationManagementController.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/webapp/app/controllers/settings/organizationManagementController.js b/src/main/webapp/app/controllers/settings/organizationManagementController.js index 67319754a..884d5397b 100644 --- a/src/main/webapp/app/controllers/settings/organizationManagementController.js +++ b/src/main/webapp/app/controllers/settings/organizationManagementController.js @@ -131,6 +131,13 @@ vireo.controller("OrganizationManagementController", function ($controller, $loc $scope.resetWorkflowSteps(); } }); + + OrganizationRepo.listen(ApiResponseActions.READ, function (res) { + var resObj = !!res && !!res.body ? angular.fromJson(res.body) : {}; + if (!!resObj && !!resObj.meta && !!resObj.meta.status && resObj.meta.status === 'SUCCESS') { + $scope.resetManageOrganization($scope.getSelectedOrganization()); + } + }); }); $scope.acceptsSubmissions = [{