From 8dbef4668c57e062f0f1056d6ae6ddc4bcad3fbd Mon Sep 17 00:00:00 2001 From: zombieJ Date: Tue, 20 Jun 2017 17:28:36 +0800 Subject: [PATCH 1/2] support delete publisher --- .../partials/integration/publisherList.html | 12 ++++++++--- .../dev/public/js/ctrls/integrationCtrl.js | 20 +++++++++++++++++-- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/eagle-server/src/main/webapp/app/dev/partials/integration/publisherList.html b/eagle-server/src/main/webapp/app/dev/partials/integration/publisherList.html index ff7c0e0bc4..3976aebb07 100644 --- a/eagle-server/src/main/webapp/app/dev/partials/integration/publisherList.html +++ b/eagle-server/src/main/webapp/app/dev/partials/integration/publisherList.html @@ -17,14 +17,16 @@ -->
-
+ + +
- + @@ -32,7 +34,11 @@ - +
Name Policies Properties
{{item.name}} {{item.policyIds.length}}
{{item.properties | json: 4}}
+ +
diff --git a/eagle-server/src/main/webapp/app/dev/public/js/ctrls/integrationCtrl.js b/eagle-server/src/main/webapp/app/dev/public/js/ctrls/integrationCtrl.js index 6cc17e5e37..331b10c370 100644 --- a/eagle-server/src/main/webapp/app/dev/public/js/ctrls/integrationCtrl.js +++ b/eagle-server/src/main/webapp/app/dev/public/js/ctrls/integrationCtrl.js @@ -447,11 +447,14 @@ // ====================================================================================== // = Publisher = // ====================================================================================== - eagleControllers.controller('integrationPublisherListCtrl', function ($sce, $scope, $wrapState, PageConfig, Entity) { + eagleControllers.controller('integrationPublisherListCtrl', function ($sce, $scope, $wrapState, PageConfig, Entity, UI) { PageConfig.title = "Integration"; PageConfig.subTitle = "Publishers"; - $scope.publisherList = Entity.queryMetadata("publishments"); + function refreshPublishList() { + $scope.publisherList = Entity.queryMetadata("publishments"); + } + $scope.gotoPolicy = function (policyName) { var encodePolicyName = encodeURIComponent(policyName); var policyList = Entity.queryMetadata("policies/" + encodePolicyName); @@ -488,5 +491,18 @@ content: $ul, }); }; + + $scope.deletePublisher = function ($event, publisher) { + $event.stopPropagation(); + + UI.deleteConfirm(publisher.name)(function (entity, closeFunc) { + Entity.deleteMetadata("publishments/" + publisher.name)._promise.finally(function () { + closeFunc(); + refreshPublishList(); + }); + }); + }; + + refreshPublishList(); }); }()); From f74177efa7ab9535d716adc8351136bb83379864 Mon Sep 17 00:00:00 2001 From: zombieJ Date: Tue, 20 Jun 2017 17:34:20 +0800 Subject: [PATCH 2/2] check code status --- .../webapp/app/dev/public/js/ctrls/integrationCtrl.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/eagle-server/src/main/webapp/app/dev/public/js/ctrls/integrationCtrl.js b/eagle-server/src/main/webapp/app/dev/public/js/ctrls/integrationCtrl.js index 331b10c370..5aa7036673 100644 --- a/eagle-server/src/main/webapp/app/dev/public/js/ctrls/integrationCtrl.js +++ b/eagle-server/src/main/webapp/app/dev/public/js/ctrls/integrationCtrl.js @@ -496,9 +496,17 @@ $event.stopPropagation(); UI.deleteConfirm(publisher.name)(function (entity, closeFunc) { - Entity.deleteMetadata("publishments/" + publisher.name)._promise.finally(function () { + Entity.deleteMetadata("publishments/" + publisher.name)._promise.finally(function (res) { + var data = res.data; closeFunc(); refreshPublishList(); + + if (data.code !== 200) { + $.dialog({ + title: 'OPS', + content: data.message, + }); + } }); }); };