diff --git a/SAS/ResourceAssignment/ResourceAssignmentEditor/lib/static/app/controllers/cleanupcontroller.js b/SAS/ResourceAssignment/ResourceAssignmentEditor/lib/static/app/controllers/cleanupcontroller.js index 726771ccfc93f95a58696e037f9e3df278207fff..10baa4d077e98382f155673f5494d8a295ab949f 100644 --- a/SAS/ResourceAssignment/ResourceAssignmentEditor/lib/static/app/controllers/cleanupcontroller.js +++ b/SAS/ResourceAssignment/ResourceAssignmentEditor/lib/static/app/controllers/cleanupcontroller.js @@ -266,7 +266,9 @@ cleanupControllerMod.controller('CleanupController', ['$scope', '$uibModal', '$m <highchart id="chart_disk_usage" config="diskUsageChartConfig" style="width: 960px; height: 720px;" ></highchart>\ <p>\ <span style="margin-right:8px" title="You are looking at cached data which might be (too) old.\nClick refresh to update the cache.">Last updated at: {{leastRecentCacheTimestamp | date }}</span>\ - <button class="btn btn-primary glyphicon glyphicon-refresh" type="button" ng-click="refresh()" title="Force a refresh of the disk usage scan.\nCan take a while...\n (clicking multiple times doesn\'t make it go faster)"></button>\ + <button class="btn btn-primary glyphicon glyphicon-refresh" type="button" ng-click="refresh()" \ + ng-disabled="is_loading" \ + title="Force a refresh of the disk usage scan.\nCan take a while..."></button>\ </p>\ </div>\ <div class="modal-footer">\ @@ -284,6 +286,8 @@ cleanupControllerMod.controller('CleanupController', ['$scope', '$uibModal', '$m const OBJECT_TYPE_PROJECTS = 'projects'; $scope.watchedObjectType = OBJECT_TYPE_TASK; + $scope.is_loading = false; + $scope.current_otdb_id = undefined; $scope.current_project_name = undefined; @@ -444,7 +448,9 @@ cleanupControllerMod.controller('CleanupController', ['$scope', '$uibModal', '$m var loadTaskDiskUsage = function(otdb_id, force) { $scope.current_otdb_id = otdb_id; $scope.current_project_name = undefined; + $scope.is_loading = true; dataService.getTaskDiskUsageByOTDBId(otdb_id, force).then(function(result) { + $scope.is_loading = false; if(result.found) { $scope.watchedObjectType = OBJECT_TYPE_TASK; $scope.diskUsageChartConfig.title.text = result.task_directory.name + ' ' + result.task_directory.disk_usage_readable; @@ -470,8 +476,11 @@ cleanupControllerMod.controller('CleanupController', ['$scope', '$uibModal', '$m var loadTasksDiskUsage = function(tasks, force) { $scope.current_otdb_id = undefined; $scope.current_project_name = undefined; + $scope.is_loading = true; var du_promises = tasks.map(function(t) { return dataService.getTaskDiskUsageByOTDBId(t.otdb_id, force); }); $q.all(du_promises).then(function(du_results) { + $scope.is_loading = false; + var found_task_dus = du_results.filter(function(r) { return r.found;}).map(function(r) { return r.task_directory; }); if(found_task_dus.length > 0) { @@ -501,7 +510,10 @@ cleanupControllerMod.controller('CleanupController', ['$scope', '$uibModal', '$m var loadProjectDiskUsage = function(project_name, force) { $scope.current_otdb_id = undefined; $scope.current_project_name = project_name; + $scope.is_loading = true; dataService.getProjectDiskUsage(project_name, force).then(function(result) { + $scope.is_loading = false; + if(result.found) { $scope.watchedObjectType = OBJECT_TYPE_PROJECT; $scope.diskUsageChartConfig.title.text = result.projectdir.name + ' ' + result.projectdir.disk_usage_readable;