diff --git a/app/components/createService/createServiceController.js b/app/components/createService/createServiceController.js index 3ede157b1..dc9831f92 100644 --- a/app/components/createService/createServiceController.js +++ b/app/components/createService/createServiceController.js @@ -302,10 +302,11 @@ function ($q, $scope, $state, Service, ServiceHelper, SecretHelper, SecretServic function initView() { $('#loadingViewSpinner').show(); + var apiVersion = $scope.applicationState.endpoint.apiVersion; $q.all({ volumes: VolumeService.volumes(), networks: NetworkService.retrieveSwarmNetworks(), - secrets: SecretService.secrets() + secrets: apiVersion >= 1.25 ? SecretService.secrets() : [] }) .then(function success(data) { $scope.availableVolumes = data.volumes; diff --git a/app/components/createService/createservice.html b/app/components/createService/createservice.html index 49e796069..5c8ab23d9 100644 --- a/app/components/createService/createservice.html +++ b/app/components/createService/createservice.html @@ -132,7 +132,7 @@
  • Network
  • Labels
  • Update config
  • -
  • Secrets
  • +
  • Secrets
  • Placement
  • diff --git a/app/components/service/includes/placementPreferences.html b/app/components/service/includes/placementPreferences.html index 210556e72..d92fae5d9 100644 --- a/app/components/service/includes/placementPreferences.html +++ b/app/components/service/includes/placementPreferences.html @@ -1,4 +1,4 @@ -
    +
    diff --git a/app/components/service/service.html b/app/components/service/service.html index 7cbe03a89..e11585c62 100644 --- a/app/components/service/service.html +++ b/app/components/service/service.html @@ -113,11 +113,11 @@
  • Network & published ports
  • Resource limits & reservations
  • Placement constraints
  • -
  • Placement preferences
  • +
  • Placement preferences
  • Restart policy
  • Update configuration
  • Service labels
  • -
  • Secrets
  • +
  • Secrets
  • Tasks
  • @@ -160,11 +160,11 @@

    Service specification

    -
    +
    -
    +
    diff --git a/app/components/service/serviceController.js b/app/components/service/serviceController.js index b61dbb256..abfe6140d 100644 --- a/app/components/service/serviceController.js +++ b/app/components/service/serviceController.js @@ -1,6 +1,6 @@ angular.module('service', []) -.controller('ServiceController', ['$q', '$scope', '$stateParams', '$state', '$location', '$timeout', '$anchorScroll', 'ServiceService', 'Secret', 'SecretHelper', 'Service', 'ServiceHelper', 'LabelHelper', 'TaskService', 'NodeService', 'Notifications', 'Pagination', 'ModalService', -function ($q, $scope, $stateParams, $state, $location, $timeout, $anchorScroll, ServiceService, Secret, SecretHelper, Service, ServiceHelper, LabelHelper, TaskService, NodeService, Notifications, Pagination, ModalService) { +.controller('ServiceController', ['$q', '$scope', '$stateParams', '$state', '$location', '$timeout', '$anchorScroll', 'ServiceService', 'SecretService', 'SecretHelper', 'Service', 'ServiceHelper', 'LabelHelper', 'TaskService', 'NodeService', 'Notifications', 'Pagination', 'ModalService', +function ($q, $scope, $stateParams, $state, $location, $timeout, $anchorScroll, ServiceService, SecretService, SecretHelper, Service, ServiceHelper, LabelHelper, TaskService, NodeService, Notifications, Pagination, ModalService) { $scope.state = {}; $scope.state.pagination_count = Pagination.getPaginationCount('service_tasks'); @@ -288,7 +288,7 @@ function ($q, $scope, $stateParams, $state, $location, $timeout, $anchorScroll, function initView() { $('#loadingViewSpinner').show(); - + var apiVersion = $scope.applicationState.endpoint.apiVersion; ServiceService.service($stateParams.id) .then(function success(data) { var service = data; @@ -304,21 +304,17 @@ function ($q, $scope, $stateParams, $state, $location, $timeout, $anchorScroll, return $q.all({ tasks: TaskService.serviceTasks(service.Name), nodes: NodeService.nodes(), - secrets: Secret.query({}).$promise + secrets: apiVersion >= 1.25 ? SecretService.secrets() : [] }); }) .then(function success(data) { $scope.tasks = data.tasks; $scope.nodes = data.nodes; - - $scope.secrets = data.secrets.map(function (secret) { - return new SecretViewModel(secret); - }); + $scope.secrets = data.secrets; $timeout(function() { $anchorScroll(); }); - }) .catch(function error(err) { $scope.secrets = []; @@ -329,20 +325,6 @@ function ($q, $scope, $stateParams, $state, $location, $timeout, $anchorScroll, }); } - function fetchSecrets() { - $('#loadSecretsSpinner').show(); - Secret.query({}, function (d) { - $scope.secrets = d.map(function (secret) { - return new SecretViewModel(secret); - }); - $('#loadSecretsSpinner').hide(); - }, function(e) { - $('#loadSecretsSpinner').hide(); - Notifications.error('Failure', e, 'Unable to retrieve secrets'); - $scope.secrets = []; - }); - } - $scope.updateServiceAttribute = function updateServiceAttribute(service, name) { if (service[name] !== originalService[name] || !(name in originalService)) { service.hasChanges = true;