From 5d9b1778ef91aefd7969909d60b68ca55cbcc705 Mon Sep 17 00:00:00 2001 From: hiyao Date: Wed, 12 Dec 2018 18:06:38 +0800 Subject: [PATCH] fix repository reload got error in remove tags When I remove all tags, removeTags() will reload and do initView() again, but data.tags response null, that trigger data.tags.length got error. --- .../edit/registryRepositoryController.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/app/extensions/registry-management/views/repositories/edit/registryRepositoryController.js b/app/extensions/registry-management/views/repositories/edit/registryRepositoryController.js index de4521cb1..182a79134 100644 --- a/app/extensions/registry-management/views/repositories/edit/registryRepositoryController.js +++ b/app/extensions/registry-management/views/repositories/edit/registryRepositoryController.js @@ -81,9 +81,17 @@ angular.module('portainer.app') }); return $q.all(promises); }) - .then(function success() { + .then(function success(data) { Notifications.success('Success', 'Tags successfully deleted'); - $state.reload(); + if (data.length === 0) { + $state.go('portainer.registries.registry.repositories', { + id: $scope.registryId + }, { + reload: true + }); + } else { + $state.reload(); + } }) .catch(function error(err) { Notifications.error('Failure', err, 'Unable to delete tags');