From f52ac8fb12724f3f96bc373dbfcf25e6a86b571b Mon Sep 17 00:00:00 2001 From: Anthony Lapenna Date: Tue, 9 Jan 2018 10:40:30 +0100 Subject: [PATCH] feat(UX): improve UX for service update (#1558) --- app/components/service/service.html | 16 ++++++++++------ app/components/service/serviceController.js | 14 +++++++++++++- .../services-datatable/servicesDatatable.html | 18 ++++++++++-------- 3 files changed, 33 insertions(+), 15 deletions(-) diff --git a/app/components/service/service.html b/app/components/service/service.html index ba298a3d9..841fb4b44 100644 --- a/app/components/service/service.html +++ b/app/components/service/service.html @@ -38,8 +38,6 @@ ID {{ service.Id }} - - @@ -73,11 +71,17 @@ ng-model="service.Image" ng-change="updateServiceAttribute(service, 'Image')" id="image_name" ng-disabled="isUpdating"> - + -
- Logs -
+ Service logs + + diff --git a/app/components/service/serviceController.js b/app/components/service/serviceController.js index 2c4a5602e..e39b4a76f 100644 --- a/app/components/service/serviceController.js +++ b/app/components/service/serviceController.js @@ -2,7 +2,11 @@ angular.module('service', []) .controller('ServiceController', ['$q', '$scope', '$transition$', '$state', '$location', '$timeout', '$anchorScroll', 'ServiceService', 'ConfigService', 'ConfigHelper', 'SecretService', 'ImageService', 'SecretHelper', 'Service', 'ServiceHelper', 'LabelHelper', 'TaskService', 'NodeService', 'Notifications', 'ModalService', 'PluginService', function ($q, $scope, $transition$, $state, $location, $timeout, $anchorScroll, ServiceService, ConfigService, ConfigHelper, SecretService, ImageService, SecretHelper, Service, ServiceHelper, LabelHelper, TaskService, NodeService, Notifications, ModalService, PluginService) { - $scope.state = {}; + $scope.state = { + updateInProgress: false, + deletionInProgress: false + }; + $scope.tasks = []; $scope.availableImages = []; @@ -328,6 +332,7 @@ function ($q, $scope, $transition$, $state, $location, $timeout, $anchorScroll, }; function removeService() { + $scope.state.deletionInProgress = true; ServiceService.remove($scope.service) .then(function success(data) { Notifications.success('Service successfully deleted'); @@ -335,6 +340,9 @@ function ($q, $scope, $transition$, $state, $location, $timeout, $anchorScroll, }) .catch(function error(err) { Notifications.error('Failure', err, 'Unable to remove service'); + }) + .finally(function final() { + $scope.state.deletionInProgress = false; }); } @@ -353,6 +361,7 @@ function ($q, $scope, $transition$, $state, $location, $timeout, $anchorScroll, // As explained in https://github.com/docker/swarmkit/issues/2364 ForceUpdate can accept a random // value or an increment of the counter value to force an update. config.TaskTemplate.ForceUpdate++; + $scope.state.updateInProgress = true; ServiceService.update(service, config) .then(function success(data) { Notifications.success('Service successfully updated', service.Name); @@ -361,6 +370,9 @@ function ($q, $scope, $transition$, $state, $location, $timeout, $anchorScroll, }) .catch(function error(err) { Notifications.error('Failure', err, 'Unable to force update service', service.Name); + }) + .finally(function final() { + $scope.state.updateInProgress = false; }); } diff --git a/app/directives/ui/datatables/services-datatable/servicesDatatable.html b/app/directives/ui/datatables/services-datatable/servicesDatatable.html index bd458edd2..82b9c97d3 100644 --- a/app/directives/ui/datatables/services-datatable/servicesDatatable.html +++ b/app/directives/ui/datatables/services-datatable/servicesDatatable.html @@ -12,14 +12,16 @@
- - +
+ + +