diff options
author | 2017-02-08 10:13:29 -0500 | |
---|---|---|
committer | 2017-02-08 10:15:00 -0500 | |
commit | f8a8d5192b1e5013d9e2f699be54b072ef39d5f0 (patch) | |
tree | b7a65bb0a7d70a9dc24c064113868e5f3b8e6a09 /dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp | |
parent | 72a80fbff7120630576ccd5aa67c20818c2943c7 (diff) |
Initial OpenECOMP UI/DMaapBC commit
Change-Id: Ia492e1b88311b9bed4c31f593b28deaaad73b7e4
Signed-off-by: talasila <talasila@research.att.com>
Diffstat (limited to 'dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp')
45 files changed, 4699 insertions, 0 deletions
diff --git a/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/att-globe-16x16.ico b/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/att-globe-16x16.ico Binary files differnew file mode 100644 index 0000000..d2c5e0f --- /dev/null +++ b/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/att-globe-16x16.ico diff --git a/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/datarouter/dr-feed-list-controller.js b/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/datarouter/dr-feed-list-controller.js new file mode 100644 index 0000000..36b7dd0 --- /dev/null +++ b/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/datarouter/dr-feed-list-controller.js @@ -0,0 +1,286 @@ +/*- + * ================================================================================ + * DCAE DMaaP Bus Controller Web Application + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +app.controller('drFeedListCtrl', function($scope, $log, $modal, modalService, DRFeedService) { + + // populates the table of Data Router feeds + 'use strict'; + + // this object holds all app data and functions + $scope.dbcapp = {}; + // models for controls on screen + $scope.dbcapp.tableData = []; + $scope.dbcapp.currentPageNum = 1; + $scope.dbcapp.totalPages = 1; + $scope.dbcapp.viewPerPage = 100; + $scope.dbcapp.viewPerPageOptions = [ + { index : 0, value : 100 }, + { index : 1, value : 500 }, + { index : 2, value : 1000 }, + { index : 3, value : 2500 } + ]; + // other + $scope.dbcapp.errMsg = null; + $scope.dbcapp.isDataLoading = true; + $scope.dbcapp.isRequestFailed = false; + + /** + * Answers an array of the specified size - makes Angular iteration easy. + */ + $scope.dbcapp.buildArraySizeN = function(num) { + // $log.debug("buildArraySizeN: invoked with " + num); + return new Array(num); + } + + /** + * Loads the table of data router feeds. + * + * Interprets the remote controller's response and copies to scope + * variables. The response is either list to be assigned to tableData, or an + * error to be shown. + */ + $scope.dbcapp.loadTable = function() { + $scope.dbcapp.isDataLoading = true; + DRFeedService.getFeedsByPage($scope.dbcapp.currentPageNum, $scope.dbcapp.viewPerPage) + .then(function(jsonObj) { + if (jsonObj.error) { + $scope.dbcapp.isRequestFailed = true; + $scope.dbcapp.errMsg = jsonObj.error; + $scope.dbcapp.tableData = []; + } else { + $scope.dbcapp.isRequestFailed = false; + $scope.dbcapp.errMsg = null; + $scope.dbcapp.profileName = jsonObj.profileName; + $scope.dbcapp.dmaapName=jsonObj.dmaapName; + $scope.dbcapp.dcaeLocations=jsonObj.dcaeLocations; + $scope.dbcapp.totalPages = jsonObj.totalPages; + $scope.dbcapp.tableData = jsonObj.data; + } + $scope.dbcapp.isDataLoading = false; + }, function(error) { + $log.error("drFeedListCtrl.loadTable failed: " + error); + $scope.dbcapp.isRequestFailed = true; + $scope.dbcapp.errMsg = error; + $scope.dbcapp.tableData = []; + $scope.dbcapp.isDataLoading = false; + }); + }; + + /** + * Shows a modal pop-up to add a feed. + * Passes data in via an object named "message". + * On success, updates the table. + */ + $scope.dbcapp.addFeedModalPopup = function() { + $scope.dbcapp.editFeed = null; + var modalInstance = $modal.open({ + templateUrl : 'add_feed_popup.html', + controller : 'feedPopupCtrl', + resolve : { + message : function() { + var dataForPopup = { + feed : $scope.dbcapp.editFeed, + feedList : $scope.dbcapp.tableData, + dcaeList: $scope.dbcapp.dcaeLocations + }; + return dataForPopup; + } + } + }); + modalInstance.result.then(function(response) { + // $log.debug('addFeedModalPopup: response: ' + JSON.stringify(response)); + if (response == null) { + // $log.debug('addFeedModalPopup: user closed dialog'); + } + else { + if (response.error != null) + modalService.showFailure('Add Failed', + 'Failed to add feed:\n' + response.error); + else + // success, get the updated list. + $scope.dbcapp.loadTable() + } + }); + }; + + /** + * Shows a modal pop-up to edit a feed. + * Passes data in via an object named "message". + * Always updates the table, even on failure, to discard + * user-entered changes that were not persisted. + */ + $scope.dbcapp.editFeedModalPopup = function(feed) { + $scope.dbcapp.editFeed = feed; + var modalInstance = $modal.open({ + templateUrl : 'edit_feed_popup.html', + controller : 'feedPopupCtrl', + resolve : { + message : function() { + var dataForPopup = { + feed : $scope.dbcapp.editFeed, + feedList : $scope.dbcapp.tableData + }; + return dataForPopup; + } + } + }); + modalInstance.result.then(function(response) { + if (response == null) { + // $log.debug('editFeedModalPopup: user closed dialog'); + } + else { + // $log.debug('editFeedModalPopup: response: ' + JSON.stringify(response)); + if (response.error != null) + modalService.showFailure('Edit Failed', + 'Failed to edit feed ' + feed.feedName + + '\n' + response.error); + // refresh in all cases + $scope.dbcapp.loadTable(); + } + }); + }; + + /** + * Shows a modal pop-up to confirm deletion of a feed. + * On successful completion, updates the table. + */ + $scope.dbcapp.deleteFeedModalPopup = function(feed) { + modalService.popupConfirmWin("Confirm", "Delete the feed: " + + feed.feedName + "\nContinue?", function() { + DRFeedService.deleteFeed(feed.feedId).then( + function(response) { + // $log.debug('deleteFeedModalPopup: response: ' + JSON.stringify(response)); + if (response.error != null) { + $log.error('deleteFeedModalPopup: failed to delete: ' + response.error); + modalService.showFailure('Delete Failed', + 'Failed to delete feed ' + feed.feedName + + '\n' + response.error); + } + else { + // success, get the updated list. + $scope.dbcapp.loadTable() + } + }, + function(error) { + $log.error('deleteFeed failed'); + modalService.showFailure('Delete Failed', 'feedListCtrl failed to delete object: ' + + JSON.stringify(error)); + }); + }) + }; + + /** + * Shows a modal pop-up with all publishers and subscribers of a feed. + * Passes data in via an object named "message". + */ + $scope.dbcapp.showFeedPubsSubsModalPopup = function(feed) { + var modalInstance = $modal.open({ + templateUrl : 'feed_pub_sub_list_popup.html', + controller : 'feedPubSubListPopupCtrl', + resolve : { + message : function() { + var dataForPopup = { + feed : feed + }; + return dataForPopup; + } + } + }); + modalInstance.result.then(function(response) { + // No response expected. + }); + }; + + /** + * Shows a modal pop-up to add a feed publisher. + * Passes data in via an object named "message". + * On successful completion, updates the table. + */ + $scope.dbcapp.addFeedPublisherModalPopup = function(feed) { + $scope.dbcapp.editPub = { feedId : feed.feedId } + var modalInstance = $modal.open({ + templateUrl : 'edit_pub_popup.html', + controller : 'pubPopupCtrl', + resolve : { + message : function() { + var dataForPopup = { + pub : $scope.dbcapp.editPub, + pubList : [], + dcaeList: $scope.dbcapp.dcaeLocations + }; + return dataForPopup; + } + } + }); + modalInstance.result.then(function(response) { + if (response == null) { + // $log.debug('addFeedPublisherModalPopup: user closed dialog'); + } + else { + if (response.error != null) + modalService.showFailure('Add Publisher Failed', + 'Failed to add publisher to feed:\n' + response.error); + else + // success, get the updated list. + $scope.dbcapp.loadTable(); + } + }); + }; + + /** + * Shows a modal pop-up to add a feed subscriber. + * Passes data in via an object named "message". + * On successful completion, updates the table. + */ + $scope.dbcapp.addFeedSubscriberModalPopup = function(feed) { + // Create a subscriber object with the feed ID + $scope.dbcapp.editSub = { feedId : feed.feedId } + var modalInstance = $modal.open({ + templateUrl : 'edit_sub_popup.html', + controller : 'subPopupCtrl', + resolve : { + message : function() { + var dataForPopup = { + sub : $scope.dbcapp.editSub, + subList : [], + dcaeList: $scope.dbcapp.dcaeLocations + }; + return dataForPopup; + } + } + }); + modalInstance.result.then(function(response) { + if (response == null) { + // $log.debug('addFeedSubscriberModalPopup: user closed dialog'); + } + else { + if (response.error != null) + modalService.showFailure('Add Subscriber Failed', + 'Failed to add subscriber to feed:\n' + response.error); + else + // success, get the updated list. + $scope.dbcapp.loadTable(); + } + }); + }; + + // Populate the table on load. + $scope.dbcapp.loadTable(); + +}); diff --git a/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/datarouter/dr-feed-popup-controller.js b/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/datarouter/dr-feed-popup-controller.js new file mode 100644 index 0000000..4efef98 --- /dev/null +++ b/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/datarouter/dr-feed-popup-controller.js @@ -0,0 +1,125 @@ +/*- + * ================================================================================ + * DCAE DMaaP Bus Controller Web Application + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +app.controller('feedPopupCtrl', function($scope, $log, $modalInstance, modalService, message, DRFeedService) { + 'use strict'; + + // this object holds all app data and functions + $scope.dbcapp = {}; + + // Set the label variable for the template + if (message.feed == null) { + $scope.dbcapp.label = 'Add Feed'; + // Must add publisher with a feed. + $scope.dbcapp.editFeed = + { + pubs: [ + { username: null } + ] + }; + } + else { + $scope.dbcapp.label = 'Edit Feed'; + $scope.dbcapp.editFeed = message.feed; + } + $scope.dbcapp.dcaeList = message.dcaeList; + + // for populating selection boxes on add and edit popup templates + $scope.dbcapp.asprClassificationList = [ + "unclassified", + "Non-Sensitive Customer Data", + "AT&T Proprietary (Internal Use Only)", + "AT&T Proprietary (Secure Restricted)", + "AT&T Proprietary (Restricted)", + "AT&T Proprietary (Sensitive Personal Information)", + "Customer Sensitive Data", + "Customer Data Conduit", + ]; + + /** + * Validates content of user-editable fields. + * Uses the list in message.feedList + * Returns null if all is well, + * a descriptive error message otherwise. + */ + $scope.dbcapp.validateFeed = function(feed) { + if (feed == null) + return "No data found.\nPlease enter some values."; + if (feed.feedName == null || feed.feedName.trim() == '') + return "Name is required.\nPlease enter a value."; + if (feed.feedVersion == null || feed.feedVersion.trim() == '') + return "Version is required.\nPlease enter a value."; + if (feed.feedDescription == null || feed.feedDescription.trim() == '') + return "Description is required.\nPlease enter a value."; + if (feed.asprClassification == null || feed.asprClassification.trim() == '') + return "ASPR Classification is required.\nPlease select a value."; + for (var x in message.feedList) { + // Ignore the one being edited. + if (message.feedList[x].feedId == feed.feedId) + continue; + if (message.feedList[x].feedName == feed.feedName) + return "Name " + feed.feedName + " exists.\n" + + "Please choose a different name."; + } + // Extra validation if adding a new feed - check first publisher + if (feed.feedId == null && feed.pubs != null && feed.pubs[0] != null) { + $log.info('validateFeed: pubs[0] is ' + JSON.stringify(feed.pubs[0])); + if (feed.pubs[0].dcaeLocationName == null) + return "DCAE Location is required.\nPlease select a value."; + // username, userpwd are optional + } + return null; + } + + $scope.dbcapp.saveFeed = function(feed) { + var validateMsg = $scope.dbcapp.validateFeed(feed); + if (validateMsg != null) { + modalService.showFailure("Invalid Content", validateMsg); + return; + } + + if (feed.feedId == null) { + // No id, so create a new one + DRFeedService.addFeed(feed) + .then(function(response) { + $modalInstance.close(response); + }, + function (error) { + $log.error('feedPopupCtrl: error while adding: ' + error); + } + ); + } + else { + // Has id, so update an existing one + DRFeedService.updateFeed(feed) + .then(function(response) { + $modalInstance.close(response); + }, + function (error) { + $log.error('feedPopupCtrl: error while updating: ' + error); + } + ); + } + + }; + + $scope.dbcapp.close = function() { + $modalInstance.close(); + }; +}); diff --git a/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/datarouter/dr-feed-pub-sub-list-popup-controller.js b/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/datarouter/dr-feed-pub-sub-list-popup-controller.js new file mode 100644 index 0000000..3c15370 --- /dev/null +++ b/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/datarouter/dr-feed-pub-sub-list-popup-controller.js @@ -0,0 +1,38 @@ +/*- + * ================================================================================ + * DCAE DMaaP Bus Controller Web Application + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +app.controller('feedPubSubListPopupCtrl', function($scope, $log, $modalInstance, modalService, message) { + + 'use strict'; + + // this object holds all app data and functions + $scope.dbcapp = {}; + + // Set the label variable for the template + $scope.dbcapp.label = 'Pub/Sub of Feed ' + message.feed.feedName; + + // Source of data table + $scope.dbcapp.showFeed = message.feed; + + // $log.debug('feedPubSubListPopupCtrl: showFeed.pubs is ' + JSON.stringify($scope.dbcapp.showFeed.pubs)); + + $scope.dbcapp.close = function() { + $modalInstance.close(); + }; +}); diff --git a/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/datarouter/dr-feed-service.js b/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/datarouter/dr-feed-service.js new file mode 100644 index 0000000..a3700dd --- /dev/null +++ b/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/datarouter/dr-feed-service.js @@ -0,0 +1,105 @@ +/*- + * ================================================================================ + * DCAE DMaaP Bus Controller Web Application + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +app.factory('DRFeedService', function ($http, $q, $log) { + return { + /** + * Gets one page of data router feed objects. + * @param {Number} pageNum - page number; e.g., 1 + * @param {Number} viewPerPage - number of items per page; e.g., 25 + * @return {JSON} Response object from remote side + */ + getFeedsByPage: function(pageNum,viewPerPage) { + // cache control for IE + var cc = "&cc=" + new Date().getTime().toString(); + return $http({ + method: 'GET', + url: 'dr_feed?pageNum=' + pageNum + '&viewPerPage=' + viewPerPage + cc, + cache: false, + responseType: 'json' }) + .then(function(response) { + if (response.data == null || typeof response.data != 'object') + return $q.reject('DRFeedService.getFeedsByPage: response.data null or not object'); + else + return response.data; + }, + function(error) { + $log.error('DRFeedService.getFeedsByPage failed: ' + error); + return $q.reject(error.data); + }); + }, + + // Creates a new feed. + addFeed: function(feed) { + return $http({ + method: 'POST', + url: 'dr_feed', + data: feed, + responseType: 'json' }) + .then(function(response) { + if (response.data == null || typeof response.data != 'object') + return $q.reject('DRFeedService.addFeed: response.data null or not object'); + else + return response.data; + }, + function(error) { + $log.error('DRFeedService.addFeed failed: ' + error); + return $q.reject(error.data); + }); + }, + + // Updates an existing feed. + updateFeed: function(feed) { + return $http({ + method: 'PUT', + url: 'dr_feed/' + feed.feedId, + data: feed, + responseType: 'json' }) + .then(function(response) { + if (response.data == null || typeof response.data != 'object') + return $q.reject('DRFeedService.updateFeed: response.data null or not object'); + else + return response.data; + }, + function(error) { + $log.error('DRFeedService.updateFeed failed: ' + error); + return $q.reject(error.data); + }); + }, + + // Deletes the feed with the specified ID. + deleteFeed: function(feedId) { + return $http({ + method: 'DELETE', + url: 'dr_feed/' + feedId, + responseType: 'json' }) + .then(function(response) { + if (response.data == null || typeof response.data != 'object') + return $q.reject('DRFeedService.deleteFeed: response.data null or not object'); + else + return response.data; + }, + function(error) { + $log.error('DRFeedService.deleteFeed failed: ' + error); + return $q.reject(error.data); + }); + }, + + }; +}); diff --git a/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/datarouter/dr-pub-list-controller.js b/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/datarouter/dr-pub-list-controller.js new file mode 100644 index 0000000..ba90900 --- /dev/null +++ b/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/datarouter/dr-pub-list-controller.js @@ -0,0 +1,149 @@ +/*- + * ================================================================================ + * DCAE DMaaP Bus Controller Web Application + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +app.controller('drPubListCtrl', function($scope, $log, $modal, modalService, DRPubService) { + + // populates the list of Data Router publishers. + 'use strict'; + + // this object holds all app data and functions + $scope.dbcapp = {}; + // models for controls on screen + $scope.dbcapp.tableData=[]; + $scope.dbcapp.currentPageNum=1; + $scope.dbcapp.totalPages=1; + $scope.dbcapp.viewPerPage = 100; + $scope.dbcapp.viewPerPageOptions = [ + { index : 0, value : 100 }, + { index : 1, value : 500 }, + { index : 2, value : 1000 }, + { index : 3, value : 2500 } + ]; + // other + $scope.dbcapp.errMsg=null; + $scope.dbcapp.isDataLoading=true; + $scope.dbcapp.isRequestFailed=false; + + /** + * Answers an array of the specified size - makes Angular iteration easy. + */ + $scope.dbcapp.buildArraySizeN = function(num) { + // $log.debug("buildArraySizeN: invoked with " + num); + return new Array(num); + } + + /** + * Loads the table of data router publishers. + * + * Interprets the remote controller's response and copies to scope + * variables. The response is either list to be assigned to tableData, or an + * error to be shown. + */ + $scope.dbcapp.loadTable = function() { + $scope.dbcapp.isDataLoading = true; + DRPubService.getPubsByPage($scope.dbcapp.currentPageNum,$scope.dbcapp.viewPerPage) + .then(function(jsonObj) { + if (jsonObj.error) { + $scope.dbcapp.isRequestFailed = true; + $scope.dbcapp.errMsg = jsonObj.error; + $scope.dbcapp.tableData = []; + } + else { + $scope.dbcapp.isRequestFailed = false; + $scope.dbcapp.errMsg = null; + $scope.dbcapp.profileName = jsonObj.profileName; + $scope.dbcapp.dmaapName = jsonObj.dmaapName; + $scope.dbcapp.dcaeLocations = jsonObj.dcaeLocations; + $scope.dbcapp.totalPages = jsonObj.totalPages; + $scope.dbcapp.tableData = jsonObj.data; + } + $scope.dbcapp.isDataLoading = false; + },function(error){ + $log.error("drPubListCtrl.loadTable failed: " + error); + $scope.dbcapp.isRequestFailed = true; + $scope.dbcapp.errMsg = error; + $scope.dbcapp.tableData = []; + $scope.dbcapp.isDataLoading = false; + }); + }; + + /** + * Shows a modal pop-up to edit a publisher. + * Passes data in via an object named "message". + * Always updates the table, even on failure, to discard + * user-entered changes that were not persisted. + */ + $scope.dbcapp.editPubModalPopup = function(pub) { + $scope.dbcapp.editPub = pub; + var modalInstance = $modal.open({ + templateUrl : 'edit_pub_popup.html', + controller : 'pubPopupCtrl', + resolve : { + message : function() { + var dataForPopup = { + pub : $scope.dbcapp.editPub, + pubList : $scope.dbcapp.tableData, + dcaeList : $scope.dbcapp.dcaeLocations + }; + return dataForPopup; + } + } + }); + modalInstance.result.then(function(response) { + if (response == null) { + // $log.debug('editPubModalPopup: user closed dialog'); + } + else { + if (response.error != null) + modalService.showFailure('Update Failed', + 'Failed to update publisher:\n' + response.error); + // refresh in all cases + $scope.dbcapp.loadTable(); + } + }); + }; + + /** + * Shows a modal pop-up to confirm deletion of a publisher. + * On successful completion, updates the table. + */ + $scope.dbcapp.deletePubModalPopup = function(pub) { + modalService.popupConfirmWin("Confirm", "Delete the publisher: " + + pub.pubId + "\nContinue?", function() { + DRPubService.deletePub(pub.pubId).then( + function(response) { + if (response.error != null) + modalService.showFailure('Delete Failed', + 'Failed to delete publisher ' + pub.pubId + + '\n' + response.error); + else + // success, get the updated list. + $scope.dbcapp.loadTable() + }, + function(error) { + modalService.showFailure('Delete Failed', 'pubListCtrl failed to delete: ' + + JSON.stringify(error)); + }); + }) + }; + + // Populate the table on load. + $scope.dbcapp.loadTable(); + +}); diff --git a/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/datarouter/dr-pub-popup-controller.js b/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/datarouter/dr-pub-popup-controller.js new file mode 100644 index 0000000..07b80e4 --- /dev/null +++ b/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/datarouter/dr-pub-popup-controller.js @@ -0,0 +1,82 @@ +/*- + * ================================================================================ + * DCAE DMaaP Bus Controller Web Application + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +app.controller('pubPopupCtrl', function($scope, $log, $modalInstance, modalService, message, DRPubService) { + 'use strict'; + + // this object holds all app data and functions + $scope.dbcapp = {}; + + // Set the label variable for the template + if (message.pub == null || message.pub.subId == null) + $scope.dbcapp.label = 'Add Publisher'; + else + $scope.dbcapp.label = 'Edit Publisher'; + $scope.dbcapp.editPub = message.pub; + $scope.dbcapp.dcaeList = message.dcaeList; + + /** + * Validates content of user-editable fields. + * Returns null if all is well, + * a descriptive error message otherwise. + */ + $scope.dbcapp.validatePub = function(pub) { + if (pub == null) + return "No data found.\nPlease enter some values."; + if (pub.dcaeLocationName == null) + return "DCAE Location is required.\nPlease select a value."; + return null; + } + + $scope.dbcapp.savePub = function(pub) { + var validateMsg = $scope.dbcapp.validatePub(pub); + if (validateMsg != null) { + modalService.showFailure("Invalid Content", validateMsg); + return; + } + + if (pub.pubId == null) { + // No id, so create a new one + DRPubService.addPub(pub) + .then(function(response) { + $modalInstance.close(response); + }, + function (error) { + $log.error('pubPopupCtrl: error while adding: ' + error); + } + ); + } + else { + // Has id, so update an existing one + DRPubService.updatePub(pub) + .then(function(response) { + $modalInstance.close(response); + }, + function (error) { + $log.error('pubPopupCtrl: error while updating: ' + error); + } + ); + } + + }; + + $scope.dbcapp.close = function() { + $modalInstance.close(); + }; +}); diff --git a/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/datarouter/dr-pub-service.js b/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/datarouter/dr-pub-service.js new file mode 100644 index 0000000..f317c0f --- /dev/null +++ b/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/datarouter/dr-pub-service.js @@ -0,0 +1,106 @@ +/*- + * ================================================================================ + * DCAE DMaaP Bus Controller Web Application + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +app.factory('DRPubService', function ($http, $q, $log) { + return { + /** + * Gets one page of data router publisher objects. + * @param {Number} pageNum - page number; e.g., 1 + * @param {Number} viewPerPage - number of items per page; e.g., 25 + * @return {JSON} Response object from remote side + */ + getPubsByPage: function(pageNum,viewPerPage) { + // cache control for IE + var cc = "&cc=" + new Date().getTime().toString(); + return $http({ + method: 'GET', + url: 'dr_pub?pageNum=' + pageNum + '&viewPerPage=' + viewPerPage + cc, + cache: false, + responseType: 'json' }) + .then(function(response) { + if (response.data == null || typeof response.data != 'object') + return $q.reject('DRPubService.getPubsByPage: response.data null or not object'); + else + return response.data; + }, + function(error) { + $log.error('DRPubService.getPubsByPage failed: ' + error); + return $q.reject(error.data); + }); + }, + + // Creates a new publisher. + addPub: function(pub) { + return $http({ + method: 'POST', + url: 'dr_pub', + data: pub, + responseType: 'json' }) + .then(function(response) { + // $log.debug('DRPubService.addPub: response: ' + JSON.stringify(response)); + if (response.data == null || typeof response.data != 'object') + return $q.reject('DRPubService.addPub: response.data null or not object'); + else + return response.data; + }, + function(error) { + $log.error('DRPubService.addPub failed: ' + error); + return $q.reject(error.data); + }); + }, + + // Updates an existing publisher. + updatePub: function(pub) { + return $http({ + method: 'PUT', + url: 'dr_pub/' + pub.pubId, + data: pub, + responseType: 'json' }) + .then(function(response) { + if (response.data == null || typeof response.data != 'object') + return $q.reject('DRPubService.updatePub: response.data null or not object'); + else + return response.data; + }, + function(error) { + $log.error('DRPubService.updatePub failed: ' + error); + return $q.reject(error.data); + }); + }, + + // Deletes the publisher with the specified ID. + deletePub: function(pubId) { + return $http({ + method: 'DELETE', + url: 'dr_pub/' + pubId, + responseType: 'json' }) + .then(function(response) { + if (response.data == null || typeof response.data != 'object') + return $q.reject('DRPubService.deletePub: response.data null or not object'); + else + return response.data; + }, + function(error) { + $log.error('DRPubService.deletePub failed: ' + error); + return $q.reject(error.data); + }); + }, + + }; +}); diff --git a/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/datarouter/dr-sub-list-controller.js b/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/datarouter/dr-sub-list-controller.js new file mode 100644 index 0000000..4faf695 --- /dev/null +++ b/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/datarouter/dr-sub-list-controller.js @@ -0,0 +1,149 @@ +/*- + * ================================================================================ + * DCAE DMaaP Bus Controller Web Application + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +app.controller('drSubListCtrl', function($scope, $log, $modal, modalService, DRSubService) { + + // populates the list of Data Router subscribers. + 'use strict'; + + // this object holds all app data and functions + $scope.dbcapp = {}; + // models for controls on screen + $scope.dbcapp.tableData=[]; + $scope.dbcapp.currentPageNum=1; + $scope.dbcapp.totalPages=1; + $scope.dbcapp.viewPerPage = 100; + $scope.dbcapp.viewPerPageOptions = [ + { index : 0, value : 100 }, + { index : 1, value : 500 }, + { index : 2, value : 1000 }, + { index : 3, value : 2500 } + ]; + // other + $scope.dbcapp.errMsg=null; + $scope.dbcapp.isDataLoading=true; + $scope.dbcapp.isRequestFailed=false; + + /** + * Answers an array of the specified size - makes Angular iteration easy. + */ + $scope.dbcapp.buildArraySizeN = function(num) { + // $log.debug("buildArraySizeN: invoked with " + num); + return new Array(num); + } + + /** + * Loads the table of data router subscribers. + * + * Interprets the remote controller's response and copies to scope + * variables. The response is either list to be assigned to tableData, or an + * error to be shown. + */ + $scope.dbcapp.loadTable = function() { + $scope.dbcapp.isDataLoading = true; + DRSubService.getSubsByPage($scope.dbcapp.currentPageNum,$scope.dbcapp.viewPerPage) + .then(function(jsonObj){ + if (jsonObj.error) { + $scope.dbcapp.isRequestFailed = true; + $scope.dbcapp.errMsg = jsonObj.error; + $scope.dbcapp.tableData = []; + } + else { + $scope.dbcapp.isRequestFailed = false; + $scope.dbcapp.errMsg = null; + $scope.dbcapp.profileName = jsonObj.profileName; + $scope.dbcapp.dmaapName = jsonObj.dmaapName; + $scope.dbcapp.dcaeLocations = jsonObj.dcaeLocations; + $scope.dbcapp.totalPages = jsonObj.totalPages; + $scope.dbcapp.tableData = jsonObj.data; + } + $scope.dbcapp.isDataLoading = false; + },function(error){ + $log.error("drSubListCtrl.loadTable failed: " + error); + $scope.dbcapp.isRequestFailed = true; + $scope.dbcapp.errMsg = error; + $scope.dbcapp.tableData = []; + $scope.dbcapp.isDataLoading = false; + }); + }; + + /** + * Shows a modal pop-up to edit a subscriber. + * Passes data in via an object named "message". + * Always updates the table, even on failure, to discard + * user-entered changes that were not persisted. + */ + $scope.dbcapp.editSubModalPopup = function(sub) { + $scope.dbcapp.editSub = sub; + var modalInstance = $modal.open({ + templateUrl : 'edit_sub_popup.html', + controller : 'subPopupCtrl', + resolve : { + message : function() { + var dataForPopup = { + sub : $scope.dbcapp.editSub, + subList : $scope.dbcapp.tableData, + dcaeList : $scope.dbcapp.dcaeLocations + }; + return dataForPopup; + } + } + }); + modalInstance.result.then(function(response) { + if (response == null) { + // $log.debug('editSubModalPopup: user closed dialog'); + } + else { + if (response.error != null) + modalService.showFailure('Update Failed', + 'Failed to update subscriber:\n' + response.error); + // refresh in all cases + $scope.dbcapp.loadTable(); + } + }); + }; + + /** + * Shows a modal pop-up to confirm deletion of a subscriber. + * On successful completion, updates the table. + */ + $scope.dbcapp.deleteSubModalPopup = function(sub) { + modalService.popupConfirmWin("Confirm", "Delete the subscriber: " + + sub.subId + "\nContinue?", function() { + DRSubService.deleteSub(sub.subId).then( + function(response) { + if (response.error != null) + modalService.showFailure('Delete Failed', + 'Failed to delete subscriber ' + sub.subId + + '\n' + response.error); + else + // success, get the updated list. + $scope.dbcapp.loadTable() + }, + function(error) { + modalService.showFailure('Delete Failed', 'subListCtrl failed to delete: ' + + JSON.stringify(error)); + }); + }) + }; + + // Populate the table on load. + $scope.dbcapp.loadTable(); + +}); diff --git a/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/datarouter/dr-sub-popup-controller.js b/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/datarouter/dr-sub-popup-controller.js new file mode 100644 index 0000000..c920fc1 --- /dev/null +++ b/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/datarouter/dr-sub-popup-controller.js @@ -0,0 +1,89 @@ +/*- + * ================================================================================ + * DCAE DMaaP Bus Controller Web Application + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +app.controller('subPopupCtrl', function($scope, $log, $modalInstance, modalService, message, DRSubService) { + 'use strict'; + + // this object holds all app data and functions + $scope.dbcapp = {}; + + // Set the label variable for the template + if (message.sub == null || message.sub.subId == null) + $scope.dbcapp.label = 'Add Subscriber'; + else + $scope.dbcapp.label = 'Edit Subscriber'; + $scope.dbcapp.editSub = message.sub; + $scope.dbcapp.dcaeList = message.dcaeList; + + /** + * Validates content of user-editable fields. + * Returns null if all is well, + * a descriptive error message otherwise. + */ + $scope.dbcapp.validateSub = function(sub) { + if (sub == null) + return "No data found.\nPlease enter some values."; + if (sub.dcaeLocationName == null) + return "DCAE Location is required.\nPlease select a value."; + if (sub.deliveryURL == null || sub.deliveryURL.trim() == '') + return "Delivery URL is required.\nPlease enter a value."; + if (sub.username == null || sub.username.trim() == '') + return "User Name is required.\nPlease enter a value."; + if (sub.userpwd == null || sub.userpwd.trim() == '') + return "Password is required.\nPlease enter a value."; + return null; + } + + $scope.dbcapp.saveSub = function(sub) { + var validateMsg = $scope.dbcapp.validateSub(sub); + if (validateMsg != null) { + modalService.showFailure("Invalid Content", validateMsg); + return; + } + + if (sub.subId == null) { + // No id, so create a new one + DRSubService.addSub(sub) + .then(function(response) { + // $log.debug('subPopupCtrl.saveSub: ' + JSON.stringify(response)); + $modalInstance.close(response); + }, + function (error) { + $log.error('subPopupCtrl: error while adding: ' + error); + } + ); + } + else { + // Has id, so update an existing one + DRSubService.updateSub(sub) + .then(function(response) { + $modalInstance.close(response); + }, + function (error) { + $log.error('subPopupCtrl: error while updating: ' + error); + } + ); + } + + }; + + $scope.dbcapp.close = function() { + $modalInstance.close(); + }; +}); diff --git a/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/datarouter/dr-sub-service.js b/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/datarouter/dr-sub-service.js new file mode 100644 index 0000000..f399282 --- /dev/null +++ b/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/datarouter/dr-sub-service.js @@ -0,0 +1,105 @@ +/*- + * ================================================================================ + * DCAE DMaaP Bus Controller Web Application + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +app.factory('DRSubService', function ($http, $q, $log) { + return { + /** + * Gets one page of data router subscriber objects. + * @param {Number} pageNum - page number; e.g., 1 + * @param {Number} viewPerPage - number of items per page; e.g., 25 + * @return {JSON} Response object from remote side + */ + getSubsByPage: function(pageNum,viewPerPage) { + // cache control for IE + var cc = "&cc=" + new Date().getTime().toString(); + return $http({ + method: 'GET', + url: 'dr_sub?pageNum=' + pageNum + '&viewPerPage=' + viewPerPage + cc, + cache: false, + responseType: 'json'}) + .then(function(response) { + if (response.data == null || typeof response.data != 'object') + return $q.reject('DRSubService.getSubsByPage: response.data null or not object'); + else + return response.data; + }, + function(error) { + $log.error('DRSubService.getSubsByPage failed: ' + error); + return $q.reject(error.data); + }); + }, + + // Creates a new subscriber. + addSub: function(sub) { + return $http({ + method: 'POST', + url: 'dr_sub', + data: sub, + responseType: 'json' }) + .then(function(response) { + if (response.data == null || typeof response.data != 'object') + return $q.reject('DRSubService.addSub: response.data null or not object'); + else + return response.data; + }, + function(error) { + $log.error('DRSubService.addSub failed: ' + error); + return $q.reject(error.data); + }); + }, + + // Updates an existing subscriber. + updateSub: function(sub) { + return $http({ + method: 'PUT', + url: 'dr_sub/' + sub.subId, + data: sub, + responseType: 'json' }) + .then(function(response) { + if (response.data == null || typeof response.data != 'object') + return $q.reject('DRSubService.updateSub: response.data null or not object'); + else + return response.data; + }, + function(error) { + $log.error('DRSubService.updateSub failed: ' + error); + return $q.reject(error.data); + }); + }, + + // Deletes the subscriber with the specified ID. + deleteSub: function(subId) { + return $http({ + method: 'DELETE', + url: 'dr_sub/' + subId, + responseType: 'json' }) + .then(function(response) { + if (response.data == null || typeof response.data != 'object') + return $q.reject('DRSubService.deleteSub: response.data null or not object'); + else + return response.data; + }, + function(error) { + $log.error('DRSubService.deleteSub failed: ' + error); + return $q.reject(error.data); + }); + }, + + }; +}); diff --git a/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/datarouter/dr_feed_add_popup_template.html b/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/datarouter/dr_feed_add_popup_template.html new file mode 100644 index 0000000..d0d6d94 --- /dev/null +++ b/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/datarouter/dr_feed_add_popup_template.html @@ -0,0 +1,104 @@ +<!-- + ================================================================================ + DCAE DMaaP Bus Controller Web Application + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ================================================================================ + --> +<Script type="text/ng-template" id="add_feed_popup.html"> + <div class="modal__informative font-showcase" style="width:550px;"> + <div class="modal__header"> + <h2 class="font-showcase-font-name" style="width: 500px;">{{dbcapp.label}}</h2> + </div> + <div class="divider-container"> + <hr> + </div> + <div class="modal__content"> + + <!-- left column --> + <div class="fn-ebz-container" > + Feed Name:<sup><b>*</b></sup> + <br/> + <!--autofocus is HTML5 attribute; doesn't work in Firefox--> + <input type="text" class="fn-ebz-text" ng-model="dbcapp.editFeed.feedName" autofocus /> + </div> + <!-- right column --> + <div class="fn-ebz-container"> + DCAE Location:<sup><b>*</b></sup> + <br/> + <select class="fn-ebz-select dbcselect" ng-model="dbcapp.editFeed.pubs[0].dcaeLocationName" ng-options="d for d in dbcapp.dcaeList"></select> + </div> + + <br/> + + <!-- left column --> + <div class="fn-ebz-container" > + Feed Version:<sup><b>*</b></sup> + <br/> + <input type="text" class="fn-ebz-text" ng-model="dbcapp.editFeed.feedVersion" /> + </div> + <!-- right column --> + <div class="fn-ebz-container" > + Publish User Name: + <br/> + <input type="text" class="fn-ebz-text" ng-model="dbcapp.editFeed.pubs[0].username" /> + </div> + + <br/> + + <!-- left column --> + <div class="fn-ebz-container" > + Description:<sup><b>*</b></sup> + <br/> + <input type="text" class="fn-ebz-text" ng-model="dbcapp.editFeed.feedDescription" /> + </div> + <!-- right column --> + <div class="fn-ebz-container" > + Publish Password: + <br/> + <input type="password" class="fn-ebz-text dbcpassword" ng-model="dbcapp.editFeed.pubs[0].userpwd" /> + </div> + + <br/> + + <!-- left column --> + <div class="fn-ebz-container" > + ASPR Classification:<sup><b>*</b></sup> + <br/> + <!-- is wider than others because values are long --> + <select class="fn-ebz-select" ng-model="dbcapp.editFeed.asprClassification" ng-options="a for a in dbcapp.asprClassificationList"></select> + </div> + + <br/> + <div class="fn-ebz-container" > + Suspended: + <br/> + <input type="checkbox" att-checkbox ng-model="dbcapp.editFeed.suspended" /> + </div> + </div> + <div class="modal__footer"> + <button class="button button--primary button--small" + href="javascript:void(0)" + ng-click="dbcapp.saveFeed(dbcapp.editFeed);"> + Save + </button> + <button class="button button--primary button--small" + href="javascript:void(0)" + ng-click="dbcapp.close()"> + Close + </button> + </div> + </div> +</script> diff --git a/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/datarouter/dr_feed_edit_popup_template.html b/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/datarouter/dr_feed_edit_popup_template.html new file mode 100644 index 0000000..3fc6d74 --- /dev/null +++ b/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/datarouter/dr_feed_edit_popup_template.html @@ -0,0 +1,75 @@ +<!-- + ================================================================================ + DCAE DMaaP Bus Controller Web Application + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ================================================================================ + --> +<Script type="text/ng-template" id="edit_feed_popup.html"> + <div class="modal__informative font-showcase" style="width:400px;"> + <div class="modal__header"> + <h2 class="font-showcase-font-name" style="width: 500px;">{{dbcapp.label}}</h2> + </div> + <div class="divider-container"> + <hr> + </div> + <div class="modal__content"> + + <div class="fn-ebz-container" > + Feed Name:<sup><b>*</b></sup> + <br/> + <!--autofocus is HTML5 attribute; doesn't work in Firefox--> + <input type="text" class="fn-ebz-text" ng-model="dbcapp.editFeed.feedName" autofocus /> + </div> + <br/> + <div class="fn-ebz-container" > + Feed Version:<sup><b>*</b></sup> + <br/> + <input type="text" class="fn-ebz-text" ng-model="dbcapp.editFeed.feedVersion" /> + </div> + <br/> + <div class="fn-ebz-container" > + Description:<sup><b>*</b></sup> + <br/> + <input type="text" class="fn-ebz-text" ng-model="dbcapp.editFeed.feedDescription" /> + </div> + <br/> + <div class="fn-ebz-container" > + ASPR Classification:<sup><b>*</b></sup> + <br/> + <!-- is wider than others because values are long --> + <select class="fn-ebz-select" ng-model="dbcapp.editFeed.asprClassification" ng-options="a for a in dbcapp.asprClassificationList"></select> + </div> + <br/> + <div class="fn-ebz-container" > + Suspended: + <br/> + <input type="checkbox" att-checkbox ng-model="dbcapp.editFeed.suspended" /> + </div> + </div> + <div class="modal__footer"> + <button class="button button--primary button--small" + href="javascript:void(0)" + ng-click="dbcapp.saveFeed(dbcapp.editFeed);"> + Save + </button> + <button class="button button--primary button--small" + href="javascript:void(0)" + ng-click="dbcapp.close()"> + Close + </button> + </div> + </div> +</script> diff --git a/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/datarouter/dr_feed_list.html b/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/datarouter/dr_feed_list.html new file mode 100644 index 0000000..1cff03b --- /dev/null +++ b/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/datarouter/dr_feed_list.html @@ -0,0 +1,177 @@ +<!-- + ================================================================================ + DCAE DMaaP Bus Controller Web Application + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ================================================================================ + --> +<!-- controller is specified by route provider --> + +<div class="pageTitle"> + <h3 class="heading3" style="margin-top: 10px; margin-bottom: 10px;">Data Router Feeds</h3> +</div> + +<div id="button-search-row"> + <button att-button + type="submit" + ng-click="dbcapp.addFeedModalPopup();" + btn-type="primary" + size="small"> + Add Feed... + </button> + <div style="float:right;"> + <div class="form-field form-field__small"> + <input class="fn-ebz-text.search" + type="text" + placeholder="Search feeds" + ng-model="dbcapp.searchString"/> + <i class="ion-search" style="position:relative;line-height:10px;top:-25px;right:-190px"></i> + </div> + </div> + </div> + +<!-- show progress indicator --> +<div ng-show="dbcapp.isDataLoading"> + <div att-loading></div> +</div> + +<div ng-hide="dbcapp.isDataLoading"> + + <div ng-show="dbcapp.isRequestFailed"> + <span class="errorMessageText">{{dbcapp.errMsg}}</span> + </div> + + <div ng-hide="dbcapp.isRequestFailed"> + Access Profile <strong>{{dbcapp.profileName}}</strong>, DMaaP Name <strong>{{dbcapp.dmaapName}}</strong> + </div> + + <table att-table + id="feeds-table" + table-data="dbcapp.tableData" + search-string="dbcapp.searchString" + view-per-page="dbcapp.viewPerPageIgnored" + current-page="dbcapp.currentPageIgnored" + total-page="dbcapp.totalPageIgnored"> + + <thead att-table-row + type="header"> + <tr> + <th att-table-header sortable="true" key="feedId">ID</th> + <th att-table-header sortable="true" key="feedName">Name</th> + <th att-table-header sortable="true" key="feedVersion">Ver</th> + <th att-table-header sortable="true" key="feedDescription">Description</th> + <th att-table-header sortable="true" key="asprClassification">Classification</th> + <th att-table-header sortable="true" key="publishURL">Publish URL</th> + <th att-table-header sortable="true" key="logURL">Log URL</th> + <th att-table-header sortable="true" key="owner">Owner</th> + <th att-table-header sortable="true" key="status">Status</th> + <th att-table-header sortable="true" key="suspended">Susp</th> + <th att-table-header sortable="false">P+S</th> + <th att-table-header sortable="false">Pub</th> + <th att-table-header sortable="false">Sub</th> + <th att-table-header sortable="false">Del</th> + </tr> + </thead> + <tbody att-table-row + type="body" + row-repeat="rowData in dbcapp.tableData"> + <tr id="tr-rowData"> + <td att-table-body + ng-bind="rowData.feedId" + ng-click="dbcapp.editFeedModalPopup(rowData)"/> + <td att-table-body + ng-bind="rowData.feedName" + ng-click="dbcapp.editFeedModalPopup(rowData)"/> + <td att-table-body + ng-bind="rowData.feedVersion" + ng-click="dbcapp.editFeedModalPopup(rowData)"/> + <td att-table-body + ng-bind="rowData.feedDescription" + ng-click="dbcapp.editFeedModalPopup(rowData)"/> + <td att-table-body + ng-bind="rowData.asprClassification" + ng-click="dbcapp.editFeedModalPopup(rowData)"/> + <td att-table-body + ng-bind="rowData.publishURL" + ng-click="dbcapp.editFeedModalPopup(rowData)"/> + <td att-table-body + ng-bind="rowData.logURL" + ng-click="dbcapp.editFeedModalPopup(rowData)"/> + <td att-table-body + ng-bind="rowData.owner" + ng-click="dbcapp.editFeedModalPopup(rowData)"/> + <td att-table-body + ng-bind="rowData.status" + ng-click="dbcapp.editFeedModalPopup(rowData)"/> + <td att-table-body + ng-click="dbcapp.editFeedModalPopup(rowData)"> + {{rowData.suspended | dbcYesNoFilter}} + </td> + <td att-table-body + ng-bind="rowData.pubs.length + rowData.subs.length" + ng-click="dbcapp.showFeedPubsSubsModalPopup(rowData)"> + </td> + <td att-table-body> + <div ng-click="dbcapp.addFeedPublisherModalPopup(rowData);" style="font-size:20px;"> + <a href="">+P</a> + </div> + </td> + <td att-table-body> + <div ng-click="dbcapp.addFeedSubscriberModalPopup(rowData);" style="font-size:20px;"> + <a href="">+S</a> + </div> + </td> + <td att-table-body> + <div ng-click="dbcapp.deleteFeedModalPopup(rowData);" style="font-size:20px;"> + <a href="" class="ion-trash-b"></a> + </div> + </td> + </tr> + </tbody> + </table> + + <div class="fn-ebz-container" > + Page Number: + <select class="fn-ebz-select dbcpageselect" + name="currentPageNumSelector" + ng-model="dbcapp.currentPageNum" + ng-change="dbcapp.loadTable()"> + <option ng-repeat="p in dbcapp.buildArraySizeN(dbcapp.totalPages) track by $index" + value="{{$index+1}}" + ng-selected="{{$index+1}}=={{dbcapp.currentPageNum}}"> + {{$index+1}} + </option> + </select> + Page Count: + <input class="fn-ebz-text dbcpagenum" + type="text" + ng-model="dbcapp.totalPages" + readonly="true"> + Rows per Page: + <select class="fn-ebz-select dbcpageselect" + name="viewPerPageSelector" + ng-model="dbcapp.viewPerPage" + ng-change="dbcapp.loadTable()" + style="height: 30px;"> + <option ng-repeat="v in dbcapp.viewPerPageOptions" + value="{{v.value}}" + ng-selected="{{v.value}}=={{dbcapp.viewPerPage}}"> + {{v.value}} + </option> + </select> + </div> + +</div> +<!-- loading --> diff --git a/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/datarouter/dr_feed_pub_sub_list_popup_template.html b/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/datarouter/dr_feed_pub_sub_list_popup_template.html new file mode 100644 index 0000000..80fe26e --- /dev/null +++ b/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/datarouter/dr_feed_pub_sub_list_popup_template.html @@ -0,0 +1,122 @@ +<!-- + ================================================================================ + DCAE DMaaP Bus Controller Web Application + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ================================================================================ + --> +<script type="text/ng-template" id="feed_pub_sub_list_popup.html"> + <div class="modal__informative font-showcase" style="width:900px;"> + + <div class="modal__header"> + <h2 class="font-showcase-font-name" style="width: 900px;">{{dbcapp.label}}</h2> + </div> + <div class="divider-container"> + <hr> + </div> + <div class="modal__content"> + <div class="fn-ebz-container"> + + <h4>Publishers</h4> + + <table att-table + id="pubs-table" + table-data="dbcapp.showFeed.pubs" + search-string="dbcapp.searchString" + view-per-page="dbcapp.viewPerPageIgnored" + current-page="dbcapp.currentPageIgnored" + total-page="dbcapp.totalPageIgnored"> + + <thead att-table-row type="header"> + <tr> + <th att-table-header sortable="false" key="pubId">Pub ID</th> + <th att-table-header sortable="false" key="dcaeLocationName">DCAE Location Name</th> + <th att-table-header sortable="false" key="status">Status</th> + <th att-table-header sortable="false" key="username">User Name</th> + </tr> + </thead> + <tbody att-table-row type="body" row-repeat="rowData in dbcapp.showFeed.pubs"> + <tr> + <td att-table-body + ng-bind="rowData.pubId"/> + <td att-table-body + ng-bind="rowData.dcaeLocationName"/> + <td att-table-body + ng-bind="rowData.status"/> + <td att-table-body + ng-bind="rowData.username" + ng-click="dbcapp.editPubModalPopup(rowData)"/> + </tr> + </tbody> + </table> + + <h4>Subscribers</h4> + + <table att-table + id="subs-table" + table-data="dbcapp.showFeed.subs" + search-string="dbcapp.searchString" + view-per-page="dbcapp.viewPerPageIgnored" + current-page="dbcapp.currentPageIgnored" + total-page="dbcapp.totalPageIgnored"> + + <thead att-table-row type="header"> + <tr> + <th att-table-header sortable="false">Sub ID</th> + <th att-table-header sortable="false">DCAE Location Name</th> + <th att-table-header sortable="false">Delivery URL</th> + <th att-table-header sortable="false">Log URL</th> + <th att-table-header sortable="false">Owner</th> + <th att-table-header sortable="false">Status</th> + <th att-table-header sortable="false">Susp</th> + <th att-table-header sortable="false">User Name</th> + </tr> + </thead> + <tbody att-table-row type="body" row-repeat="rowData in dbcapp.showFeed.subs"> + <tr> + <td att-table-body + ng-bind="rowData.subId"/> + <td att-table-body + ng-bind="rowData.dcaeLocationName"/> + <td att-table-body + ng-bind="rowData.deliveryURL"/> + <td att-table-body + ng-bind="rowData.logURL"/> + <td att-table-body + ng-bind="rowData.owner"/> + <td att-table-body + ng-bind="rowData.status"/> + <td att-table-body> + {{rowData.suspended | dbcYesNoFilter}} + </td> + <td att-table-body + ng-bind="rowData.username"/> + </tr> + </tbody> + </table> + + </div> + + <div class="modal__footer"> + <button class="button button--primary button--small" + href="javascript:void(0)" + ng-click="dbcapp.close()"> + Close + </button> + </div> + + </div> + +</script> diff --git a/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/datarouter/dr_pub_list.html b/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/datarouter/dr_pub_list.html new file mode 100644 index 0000000..300ec99 --- /dev/null +++ b/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/datarouter/dr_pub_list.html @@ -0,0 +1,130 @@ +<!-- + ================================================================================ + DCAE DMaaP Bus Controller Web Application + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ================================================================================ + --> +<!-- controller is specified by route provider --> + +<div class="pageTitle"> + <h3 class="heading3" style="margin-top: 10px; margin-bottom: 10px;">Feed Publishers</h3> +</div> + +<div id="button-search-row"> + <!-- NO "add" button on this page --> + <div style="float:right;"> + <div class="form-field form-field__small"> + <input class="fn-ebz-text.search" + type="text" + placeholder="Search publishers" + ng-model="dbcapp.searchString"/> + <i class="ion-search" style="position:relative;line-height:10px;top:-25px;right:-190px"></i> + </div> + </div> + </div> + +<!-- show progress indicator --> +<div ng-show="dbcapp.isDataLoading"> + <div att-loading></div> +</div> + +<div ng-hide="dbcapp.isDataLoading"> + + <div ng-show="dbcapp.isRequestFailed"> + <span class="errorMessageText">{{dbcapp.errMsg}}</span> + </div> + + <div ng-hide="dbcapp.isRequestFailed"> + Access Profile <strong>{{dbcapp.profileName}}</strong>, DMaaP Name <strong>{{dbcapp.dmaapName}}</strong> + </div> + + <table att-table + id="pubs-table" + table-data="dbcapp.tableData" + search-string="dbcapp.searchString" + view-per-page="dbcapp.viewPerPageIgnored" + current-page="dbcapp.currentPageIgnored" + total-page="dbcapp.totalPageIgnored"> + + <thead att-table-row type="header"> + <tr> + <th att-table-header sortable="true" key="pubId">Pub ID</th> + <th att-table-header sortable="true" key="feedId">Feed ID</th> + <th att-table-header sortable="true" key="dcaeLocationName">DCAE Location Name</th> + <th att-table-header sortable="true" key="status">Status</th> + <th att-table-header sortable="true" key="username">User Name</th> + <th att-table-header sortable="false">Delete</th> + </tr> + </thead> + <tbody att-table-row type="body" row-repeat="rowData in dbcapp.tableData"> + <tr> + <td att-table-body + ng-bind="rowData.pubId" + ng-click="dbcapp.editPubModalPopup(rowData)"/> + <td att-table-body + ng-bind="rowData.feedId" + ng-click="dbcapp.editPubModalPopup(rowData)"/> + <td att-table-body + ng-bind="rowData.dcaeLocationName" + ng-click="dbcapp.editPubModalPopup(rowData)"/> + <td att-table-body + ng-bind="rowData.status" + ng-click="dbcapp.editPubModalPopup(rowData)"/> + <td att-table-body + ng-bind="rowData.username" + ng-click="dbcapp.editPubModalPopup(rowData)"/> + <td att-table-body> + <div ng-click="dbcapp.deletePubModalPopup(rowData);" style="font-size:20px;"> + <a href="" class="ion-trash-b"></a> + </div> + </td> + </tr> + </tbody> + </table> + + <div class="fn-ebz-container" > + Page Number: + <select class="fn-ebz-select dbcpageselect" + name="currentPageNumSelector" + ng-model="dbcapp.currentPageNum" + ng-change="dbcapp.loadTable()"> + <option ng-repeat="p in dbcapp.buildArraySizeN(dbcapp.totalPages) track by $index" + value="{{$index+1}}" + ng-selected="{{$index+1}}=={{dbcapp.currentPageNum}}"> + {{$index+1}} + </option> + </select> + Page Count: + <input class="fn-ebz-text dbcpagenum" + type="text" + ng-model="dbcapp.totalPages" + readonly="true"> + Rows per Page: + <select class="fn-ebz-select dbcpageselect" + name="viewPerPageSelector" + ng-model="dbcapp.viewPerPage" + ng-change="dbcapp.loadTable()" + style="height: 30px;"> + <option ng-repeat="v in dbcapp.viewPerPageOptions" + value="{{v.value}}" + ng-selected="{{v.value}}=={{dbcapp.viewPerPage}}"> + {{v.value}} + </option> + </select> + </div> + +</div> +<!-- loading --> diff --git a/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/datarouter/dr_pub_popup_template.html b/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/datarouter/dr_pub_popup_template.html new file mode 100644 index 0000000..0e42f62 --- /dev/null +++ b/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/datarouter/dr_pub_popup_template.html @@ -0,0 +1,60 @@ +<!-- + ================================================================================ + DCAE DMaaP Bus Controller Web Application + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ================================================================================ + --> +<Script type="text/ng-template" id="edit_pub_popup.html"> + <div class="modal__informative font-showcase" style="width:400px;"> + <div class="modal__header"> + <h2 class="font-showcase-font-name" style="width: 500px;">{{dbcapp.label}}</h2> + </div> + <div class="divider-container"> + <hr> + </div> + <div class="modal__content"> + <div class="fn-ebz-container"> + DCAE Location:<sup><b>*</b></sup> + <br/> + <select class="fn-ebz-select dbcselect" ng-model="dbcapp.editPub.dcaeLocationName" ng-options="d for d in dbcapp.dcaeList"></select> + </div> + <br/> + <div class="fn-ebz-container" > + User Name: + <br/> + <input type="text" class="fn-ebz-text" ng-model="dbcapp.editPub.username" /> + </div> + <br/> + <div class="fn-ebz-container" > + Password: + <br/> + <input type="password" class="fn-ebz-text dbcpassword" ng-model="dbcapp.editPub.userpwd" /> + </div> + </div> + <div class="modal__footer"> + <button class="button button--primary button--small" + href="javascript:void(0)" + ng-click="dbcapp.savePub(dbcapp.editPub);"> + Save + </button> + <button class="button button--primary button--small" + href="javascript:void(0)" + ng-click="dbcapp.close()"> + Close + </button> + </div> + </div> +</script> diff --git a/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/datarouter/dr_sub_list.html b/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/datarouter/dr_sub_list.html new file mode 100644 index 0000000..c5d2525 --- /dev/null +++ b/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/datarouter/dr_sub_list.html @@ -0,0 +1,156 @@ +<!-- + ================================================================================ + DCAE DMaaP Bus Controller Web Application + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ================================================================================ + --> +<!-- controller is specified by route provider --> + +<div class="pageTitle"> + <h3 class="heading3" style="margin-top: 10px; margin-bottom: 10px;">Feed Subscribers</h3> +</div> + +<div id="button-search-row"> + <!-- NO "add" button on this page --> + <div style="float:right;"> + <div class="form-field form-field__small"> + <input class="fn-ebz-text.search" + type="text" + placeholder="Search subscribers" + ng-model="dbcapp.searchString"/> + <i class="ion-search" style="position:relative;line-height:10px;top:-25px;right:-190px"></i> + </div> + </div> + </div> + +<!-- show progress indicator --> +<div ng-show="dbcapp.isDataLoading"> + <div att-loading></div> +</div> + +<div ng-hide="dbcapp.isDataLoading"> + + <div ng-show="dbcapp.isRequestFailed"> + <span class="errorMessageText">{{dbcapp.errMsg}}</span> + </div> + + <div ng-hide="dbcapp.isRequestFailed"> + Access Profile <strong>{{dbcapp.profileName}}</strong>, DMaaP Name <strong>{{dbcapp.dmaapName}}</strong> + </div> + + <table att-table + id="subs-table" + table-data="dbcapp.tableData" + search-string="dbcapp.searchString" + view-per-page="dbcapp.viewPerPageIgnored" + current-page="dbcapp.currentPageIgnored" + total-page="dbcapp.totalPageIgnored"> + + <thead att-table-row type="header"> + <tr> + <th att-table-header sortable="true" key="subId">Sub ID</th> + <th att-table-header sortable="true" key="feedId">Feed ID</th> + <th att-table-header sortable="true" key="dcaeLocationName">DCAE Location Name</th> + <th att-table-header sortable="true" key="deliveryURL">Delivery URL</th> + <th att-table-header sortable="true" key="logURL">Log URL</th> + <th att-table-header sortable="true" key="owner">Owner</th> + <th att-table-header sortable="true" key="status">Status</th> + <th att-table-header sortable="true" key="suspended">Susp</th> + <!-- Ignore until someone explains this field + <th att-table-header sortable="true" key="use100">Use 100</th> + --> + <th att-table-header sortable="true" key="username">User Name</th> + <th att-table-header sortable="false">Delete</th> + </tr> + </thead> + <tbody att-table-row type="body" row-repeat="rowData in dbcapp.tableData"> + <tr> + <td att-table-body + ng-bind="rowData.subId" + ng-click="dbcapp.editSubModalPopup(rowData)"/> + <td att-table-body + ng-bind="rowData.feedId" + ng-click="dbcapp.editSubModalPopup(rowData)"/> + <td att-table-body + ng-bind="rowData.dcaeLocationName" + ng-click="dbcapp.editSubModalPopup(rowData)"/> + <td att-table-body + ng-bind="rowData.deliveryURL" + ng-click="dbcapp.editSubModalPopup(rowData)"/> + <td att-table-body + ng-bind="rowData.logURL" + ng-click="dbcapp.editSubModalPopup(rowData)"/> + <td att-table-body + ng-bind="rowData.owner" + ng-click="dbcapp.editSubModalPopup(rowData)"/> + <td att-table-body + ng-bind="rowData.status" + ng-click="dbcapp.editSubModalPopup(rowData)"/> + <td att-table-body + ng-click="dbcapp.editSubModalPopup(rowData)"> + {{rowData.suspended | dbcYesNoFilter}} + </td> + <!-- Ignore until someone explains this field + <td att-table-body + ng-click="dbcapp.editSubModalPopup(rowData)"> + {{rowData.use100 | dbcYesNoFilter}} + </td> + --> + <td att-table-body + ng-bind="rowData.username" + ng-click="dbcapp.editSubModalPopup(rowData)"/> + <td att-table-body> + <div ng-click="dbcapp.deleteSubModalPopup(rowData);" style="font-size:20px;"> + <a href="" class="ion-trash-b"></a> + </div> + </td> + </tr> + </tbody> + </table> + + <div class="fn-ebz-container" > + Page Number: + <select class="fn-ebz-select dbcpageselect" + name="currentPageNumSelector" + ng-model="dbcapp.currentPageNum" + ng-change="dbcapp.loadTable()"> + <option ng-repeat="p in dbcapp.buildArraySizeN(dbcapp.totalPages) track by $index" + value="{{$index+1}}" + ng-selected="{{$index+1}}=={{dbcapp.currentPageNum}}"> + {{$index+1}} + </option> + </select> + Page Count: + <input class="fn-ebz-text dbcpagenum" + type="text" + ng-model="dbcapp.totalPages" + readonly="true"> + Rows per Page: + <select class="fn-ebz-select dbcpageselect" + name="viewPerPageSelector" + ng-model="dbcapp.viewPerPage" + ng-change="dbcapp.loadTable()" + style="height: 30px;"> + <option ng-repeat="v in dbcapp.viewPerPageOptions" + value="{{v.value}}" + ng-selected="{{v.value}}=={{dbcapp.viewPerPage}}"> + {{v.value}} + </option> + </select> + </div> + +</div> +<!-- loading --> diff --git a/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/datarouter/dr_sub_popup_template.html b/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/datarouter/dr_sub_popup_template.html new file mode 100644 index 0000000..10f923c --- /dev/null +++ b/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/datarouter/dr_sub_popup_template.html @@ -0,0 +1,72 @@ +<!-- + ================================================================================ + DCAE DMaaP Bus Controller Web Application + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ================================================================================ + --> +<Script type="text/ng-template" id="edit_sub_popup.html"> + <div class="modal__informative font-showcase" style="width:400px;"> + <div class="modal__header"> + <h2 class="font-showcase-font-name" style="width: 500px;">{{dbcapp.label}}</h2> + </div> + <div class="divider-container"> + <hr> + </div> + <div class="modal__content"> + <div class="fn-ebz-container"> + DCAE Location:<sup><b>*</b></sup> + <br/> + <select class="fn-ebz-select dbcselect" ng-model="dbcapp.editSub.dcaeLocationName" ng-options="d for d in dbcapp.dcaeList"></select> + </div> + <br/> + <div class="fn-ebz-container" > + Delivery URL:<sup><b>*</b></sup> + <br/> + <input type="text" class="fn-ebz-text" ng-model="dbcapp.editSub.deliveryURL" /> + </div> + <br/> + <div class="fn-ebz-container" > + User Name:<sup><b>*</b></sup> + <br/> + <input type="text" class="fn-ebz-text" ng-model="dbcapp.editSub.username" /> + </div> + <br/> + <div class="fn-ebz-container" > + Password:<sup><b>*</b></sup> + <br/> + <input type="password" class="fn-ebz-text dbcpassword" ng-model="dbcapp.editSub.userpwd" /> + </div> + <br/> + <div class="fn-ebz-container" > + Suspend? + <br/> + <input type="checkbox" att-checkbox ng-model="dbcapp.editSub.suspended" /> + </div> + </div> + <div class="modal__footer"> + <button class="button button--primary button--small" + href="javascript:void(0)" + ng-click="dbcapp.saveSub(dbcapp.editSub);"> + Save + </button> + <button class="button button--primary button--small" + href="javascript:void(0)" + ng-click="dbcapp.close()"> + Close + </button> + </div> + </div> +</script> diff --git a/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/dmaapaccess/dmaap-access-list-controller.js b/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/dmaapaccess/dmaap-access-list-controller.js new file mode 100644 index 0000000..0c60aee --- /dev/null +++ b/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/dmaapaccess/dmaap-access-list-controller.js @@ -0,0 +1,194 @@ +/*- + * ================================================================================ + * DCAE DMaaP Bus Controller Web Application + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +app.controller('dmaapAccessListCtrl', function ($scope, $log, $modal, modalService, DmaapAccessService) { + 'use strict'; + + // this object holds all app data and functions + $scope.dbcapp = {}; + // Model for radio-button selection group. + // Uses database row ID as unique value. + $scope.dbcapp.selectDmaapModel = { id: null }; + $("#dialog").hide(); + $scope.dbcapp.isDataLoading=true; + + /** + * Loads the table of DMaaP access profiles. + * + * Interprets the remote controller's response and copies to scope + * variables. The response is either list to be assigned to tableData, + * or an error to be shown. + */ + $scope.dbcapp.loadTable = function() { + $scope.dbcapp.isDataLoading = true; + DmaapAccessService.getDmaapAccessList() + .then(function(jsonObj) { + if (jsonObj.error) { + $scope.dbcapp.isRequestFailed = true; + $scope.dbcapp.errMsg = jsonObj.error; + $scope.dbcapp.tableData = []; + } else { + $scope.dbcapp.isRequestFailed = false; + $scope.dbcapp.errMsg = null; + $scope.dbcapp.tableData = jsonObj.data; + $scope.dbcapp.updateDmaapAccessSelection(); + } + $scope.dbcapp.isDataLoading = false; + }, function(error) { + // Called with a string, not JSON obj. + $log.error("dmaapAccessListCtrl.getDmaapAccessList failed: " + error); + $scope.dbcapp.isRequestFailed = true; + $scope.dbcapp.errMsg = error; + $scope.dbcapp.tableData = []; + $scope.dbcapp.isDataLoading = false; + }); + }; + + /** + * Sets a value in the model for the radio-button selection group. + */ + $scope.dbcapp.updateDmaapAccessSelection = function() { + for (var i in $scope.dbcapp.tableData) { + var da = $scope.dbcapp.tableData[i]; + // Set radio button for the selected profile + // $log.info('dmaapAccessListCtrl: examining ' + JSON.stringify(da)); + if (da.selected) { + // $log.info('dmaapAccessListCtrl: selecting id ' + da.id); + $scope.dbcapp.selectDmaapModel.id = da.id; + } + } + }; + + /** + * Handles a click on radio button to select a profile. + */ + $scope.dbcapp.selectDmaapAccess = function(dmaapAccess) { + if (dmaapAccess == null || dmaapAccess.id == null) + $log.error('selectDmaapAccess invoked with null'); + else + DmaapAccessService.setSelectedDmaapAccess(dmaapAccess.id); + }; + + /** + * Shows a modal pop-up to add a DMaaP access profile. + * Passes data in via an object named "message". + * On successful completion, updates the profile list. + * + * After implementing DE238329, this is never called. + */ + $scope.dbcapp.addDmaapAccessModalPopup = function() { + $scope.dbcapp.editDmaapAccess = null; + var modalInstance = $modal.open({ + templateUrl: 'edit_dmaap_access_popup.html', + controller: 'dmaapAccessPopupCtrl', + resolve: { + message: function () { + var dataForPopup = { + dmaapAccess : $scope.dbcapp.editDmaapAccess, + dmaapAccessList : $scope.dbcapp.tableData + }; + return dataForPopup; + } + } + }); + modalInstance.result.then(function(response) { + if (response == null) { + // $log.debug('addDmaapAccessModelPopup: user closed dialog'); + } + else { + if (response.error != null) + modalService.showFailure('Add Profile Failed', + 'Failed to add access profile:\n' + response.error); + else + // success, get the updated list. + $scope.dbcapp.loadTable(); + } + }); + }; + + /** + * Shows a modal pop-up to edit a DMaaP access profile. + * Passes data in via an object named "message". + * On successful completion, updates the profile list. + */ + $scope.dbcapp.editDmaapAccessModalPopup = function(dmaapAccess) { + // edit a copy, not the model for the table row. + $scope.dbcapp.editDmaapAccess = JSON.parse(JSON.stringify(dmaapAccess)); + var modalInstance = $modal.open({ + templateUrl: 'edit_dmaap_access_popup.html', + controller: 'dmaapAccessPopupCtrl', + resolve: { + message: function () { + var dataForPopup = { + dmaapAccess : $scope.dbcapp.editDmaapAccess, + dmaapAccessList : $scope.dbcapp.tableData + }; + return dataForPopup; + } + } + }); + modalInstance.result.then(function(response) { + if (response == null) { + // $log.debug('addDmaapAccessModelPopup: user closed dialog'); + } + else { + if (response.error != null) + modalService.showFailure('Edit Profile Failed', + 'Failed to edit access profile:\n' + response.error); + else + // success, get the updated list. + $scope.dbcapp.loadTable(); + } + }); + }; + + /** + * Shows a modal pop-up to confirm deletion of a DMaaP access profile. + * On successful completion, updates the profile list. + * + * After implementing DE238329, this is never called. + */ + $scope.dbcapp.deleteDmaapAccess = function(dmaapAccess) { + modalService.popupConfirmWin("Confirm", "Delete the DMaaP access profile: " + + dmaapAccess.name + "\nContinue?", + function() { + // $log.debug('deleteDmaapAccess: deleting id ' + dmaapAccess.id); + DmaapAccessService.deleteDmaapAccess(dmaapAccess.id).then( + function(response) { + if (response.error != null) { + $log.error('deleteDmaapAccess: failed to delete: ' + response.error); + modalService.showFailure('Delete Failed', + 'Failed to delete access profile:\n' + response.error); + } + else { + // success, get the updated list. + $scope.dbcapp.loadTable() + } + }, + function(error) { + $log.error('deleteDmaapAccess failed: ' + error); + modalService.showFailure("Fail", "dmaapAccessListCtrl failed to delete object"); + }); + }) + }; + + // Populate the table on load. + $scope.dbcapp.loadTable(); + +}); diff --git a/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/dmaapaccess/dmaap-access-popup-controller.js b/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/dmaapaccess/dmaap-access-popup-controller.js new file mode 100644 index 0000000..d4d2301 --- /dev/null +++ b/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/dmaapaccess/dmaap-access-popup-controller.js @@ -0,0 +1,125 @@ +/*- + * ================================================================================ + * DCAE DMaaP Bus Controller Web Application + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +app.controller('dmaapAccessPopupCtrl', function($scope, $log, $modalInstance, modalService, message, DmaapAccessService) { + 'use strict'; + + // this object holds all app data and functions + $scope.dbcapp = {}; + + // Set the label variable for the template + if (message.dmaapAccess == null) + $scope.dbcapp.label = 'Add Access Profile'; + else + $scope.dbcapp.label = 'Edit Access Profile'; + $scope.dbcapp.editDmaapAccess = message.dmaapAccess; + + /** + * Validates content of user-editable fields. + * Returns null if all is well, + * a descriptive error message otherwise. + */ + $scope.dbcapp.validateProfile = function(dmaapAccess) { + if (dmaapAccess == null) + return "No data found.\nPlease enter some values."; + if (dmaapAccess.name == null || dmaapAccess.name.trim() == '') + return "Name is required.\nPlease enter a value."; + // User cannot edit URL + //if (dmaapAccess.dmaapUrl == null || dmaapAccess.dmaapUrl.trim() == '') + // return "URL is required.\nPlease enter a value."; + //if (dmaapAccess.dmaapUrl.toLowerCase().indexOf('http') != 0) + // return "Unexpected URL prefix.\nPlease enter a URL starting with 'http'."; + for (var x in message.dmaapAccessList) { + // $log.debug('saveDmaapAccess: checking item >' + message.dmaapAccessList[x].name + '<'); + // Ignore the name in the one being edited. + if (message.dmaapAccessList[x].id == dmaapAccess.id) + continue; + if (message.dmaapAccessList[x].name == dmaapAccess.name) + return "Name " + dmaapAccess.name + " exists.\nPlease enter a different name."; + } + return null; + } + + /** + * Tests the URL for validity. Shows a modal dialog to display test result. + * Returns nothing. + */ + $scope.dbcapp.testDmaapAccess = function(dmaapAccess) { + if (dmaapAccess == null || dmaapAccess.dmaapUrl == null || dmaapAccess.dmaapUrl.trim() == '') { + modalService.showFailure("Missing Input", "No URL found.\nPlease enter a URL."); + return; + } + // result should have a data aggregate that's a serialized DMaaP object + DmaapAccessService.testDmaapAccess(dmaapAccess) + .then(function(response) { + if (response.error != null) + modalService.showFailure("Invalid Content", response.error); + else + modalService.showSuccess("Valid URL", "DMaaP name is " + response.data.dmaapName) + }, + function (error) { + modalService.showFailure("Invalid Content", error); + } + ); + } + + /** + * Validates the content; on success, calls service to save it. + */ + $scope.dbcapp.saveDmaapAccess = function(dmaapAccess) { + var validateMsg = $scope.dbcapp.validateProfile(dmaapAccess); + if (validateMsg != null) { + modalService.showFailure("Invalid Content", validateMsg); + return; + } + + // Set the selected flag if this is the only access profile. + if (dmaapAccess.id == null && message.dmaapAccessList.length == 0) + dmaapAccess.selected = true; + + if (dmaapAccess.id == null) { + // No id, so create a new one + DmaapAccessService.addDmaapAccess(dmaapAccess) + .then(function(dmaapAccessList) { + + $modalInstance.close(dmaapAccessList); + }, + function (error) { + $log.error('dmaapAccessPopupCtrl: error while adding: ' + error); + } + ); + } + else { + // Has id, so update an existing one + DmaapAccessService.updateDmaapAccess(dmaapAccess) + .then(function(dmaapAccessList) { + $modalInstance.close(dmaapAccessList); + }, + function (error) { + $log.error('dmaapAccessPopupCtrl: error while updating: ' + error); + } + ); + } + + }; + + $scope.dbcapp.close = function() { + $modalInstance.close(); + }; +}); diff --git a/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/dmaapaccess/dmaap-access-service.js b/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/dmaapaccess/dmaap-access-service.js new file mode 100644 index 0000000..8e92c67 --- /dev/null +++ b/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/dmaapaccess/dmaap-access-service.js @@ -0,0 +1,160 @@ +/*- + * ================================================================================ + * DCAE DMaaP Bus Controller Web Application + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +app.factory('DmaapAccessService', function ($http, $q, $log) { + return { + /** + * Gets the list of DMaaP access profiles for the current user (not paginated). + * @return {JSON} Response object from remote side + */ + getDmaapAccessList: function() { + // cache control for IE + var cc = "?cc=" + new Date().getTime().toString(); + return $http({ + method: 'GET', + url: 'dmaap_access' + cc, + cache: false, + responseType: 'json'}) + .then(function(response) { + if (response.data == null || typeof response.data != 'object') + return $q.reject('DmaapAccessService.getDmaapAccessList: response.data null or not object'); + else + return response.data; + }, function(error) { + $log.error('DmaapAccessService.getDmaapAccessList failed: ' + error.data); + return $q.reject(error.data); + }); + }, + + // Gets and returns the selected DMaaP access profile for the current user. + getSelectedDmaapAccess: function() { + // cache control for IE + var cc = "?cc=" + new Date().getTime().toString(); + return $http({ + method: 'GET', + url: 'select_dmaap_access' + cc, + cache: false, + responseType: 'json'}) + .then(function(response) { + if (response.data == null || typeof response.data != 'object') + return $q.reject('DmaapAccessService.getSelectedDmaapAccess: response.data null or not object'); + else + return response.data; + }, function(error) { + $log.error('DmaapAccessService.getSelectedDmaapAccess failed: ' + error); + return $q.reject(error.data); + }); + }, + + // Selects the specified DMaaP access profile for the current user. + // Returns nothing. + setSelectedDmaapAccess: function(dmaapId) { + return $http({ + method: 'PUT', + url: 'select_dmaap_access/' + dmaapId, + responseType: 'json' }) + .then(function(response) { + // successful response is status:200 + // $log.info('setSelectedDmaapAccess complete: ' + JSON.stringify(response)); + }, function(error) { + $log.error('DmaapAccessService.setSelectedDmaapAccess failed: ' + error); + return $q.reject(error.data); + }); + }, + + // Creates a new DMaaP access profile for the current user. + // Returns the current DMaaP access list. + addDmaapAccess: function(dmaapAccess) { + return $http({ + method: 'POST', + url: 'dmaap_access', + data: dmaapAccess, + responseType: 'json' }) + .then(function(response) { + if (response.data == null || typeof response.data != 'object') + return $q.reject('DmaapAccessService.addDmaapAccess: response.data null or not object'); + else + return response.data; + }, + function(error) { + $log.error('DmaapAccessService.addDmaapAccess failed: ' + error); + return $q.reject(error.data); + }); + }, + + // Updates an existing DMaaP access profile for the current user + // Returns the current DMaaP access list. + updateDmaapAccess: function(dmaapAccess) { + return $http({ + method: 'PUT', + url: 'dmaap_access/' + dmaapAccess.id, + data: dmaapAccess, + responseType: 'json' }) + .then(function(response) { + if (response.data == null || typeof response.data != 'object') + return $q.reject('DmaapAccessService.updateDmaapAccess: response.data null or not object'); + else + return response.data; + }, + function(error) { + $log.error('DmaapAccessService.updateDmaapAccess failed: ' + error); + return $q.reject(error.data); + }); + }, + + // Deletes the specified DMaaP access profile for the current user. + // Returns the current DMaaP access list. + deleteDmaapAccess: function(dmaapId) { + return $http({ + method: 'DELETE', + url: 'dmaap_access/' + dmaapId, + responseType: 'json' }) + .then(function(response) { + if (response.data == null || typeof response.data != 'object') + return $q.reject('DmaapAccessService.deleteDmaapAccess: response.data null or not object'); + else + return response.data; + }, + function(error) { + $log.error('DmaapAccessService.deleteDmaapAccess failed: ' + error); + return $q.reject(error.data); + }); + }, + + // Tests the URL in the access profile by fetching the DMaaP object from it. + testDmaapAccess: function(dmaapAccess) { + return $http({ + method: 'POST', + url: 'test_dmaap_access', + data: dmaapAccess, + responseType: 'json' }) + .then(function(response) { + if (response.data == null || typeof response.data != 'object') + return $q.reject('DmaapAccessService.testDmaapAccess: response.data null or not object'); + else + return response.data; + }, function(error) { + $log.error('DmaapAccessService.testDmaapAccess failed: ' + error); + return $q.reject(error.data); + }); + }, + + + }; +}); diff --git a/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/dmaapaccess/dmaap_access_list.html b/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/dmaapaccess/dmaap_access_list.html new file mode 100644 index 0000000..381a850 --- /dev/null +++ b/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/dmaapaccess/dmaap_access_list.html @@ -0,0 +1,108 @@ +<!-- + ================================================================================ + DCAE DMaaP Bus Controller Web Application + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ================================================================================ + --> +<!-- controller is specified by route provider --> + +<div class="pageTitle"> + <h3 class="heading3" style="margin-top: 10px; margin-bottom: 10px;">DMaaP + Access Profiles</h3> +</div> + +<div id="button-search-row"> + <!-- add disabled for DE238329 + <button att-button + type="submit" + ng-click="dbcapp.addDmaapAccessModalPopup();" + btn-type="primary" + size="small"> + Add profile... + </button> + --> + <div style="float: right;"> + <div class="form-field form-field__small"> + <input class="fn-ebz-text.search" type="text" + placeholder="Search profiles" ng-model="dbcapp.searchString" /> <i + class="ion-search" style="position:relative;line-height:10px;top:-25px;right:-190px"></i> + </div> + </div> +</div> + +<!-- show progress indicator --> +<div ng-show="isDataLoading"> + <div att-loading></div> +</div> + +<div ng-hide="isDataLoading"> + + <div ng-show="dbcapp.isRequestFailed"> + <span class="errorMessageText">{{dbcapp.errMsg}}</span> + </div> + + <div ng-hide="dbcapp.isRequestFailed"> + <div style="text-align: justify; text-align-last: auto;"> + Click on a radio button to select that profile for use in this web application. + </div> + </div> + + <div id="dmaapAccessTable"> + <table att-table table-data="dbcapp.dmaapAccessList" + search-string="dbcapp.searchString" + view-per-page="dbcapp.viewPerPageIgnored" + current-page="dbcapp.currentPageIgnored" + total-page="dbcapp.totalPageIgnored"> + + <thead att-table-row type="header"> + <tr> + <th att-table-header sortable="false">Selected</th> + <th att-table-header sortable="true" key="name">Name</th> + <th att-table-header sortable="true" key="dmaapUrl">URL</th> + <th att-table-header sortable="true" key="mechId">Mech ID</th> + <!-- delete disabled for DE238329 + <th att-table-header sortable="false">Delete</th> --> + </tr> + </thead> + <!-- row-repeat enables sorting --> + <tbody att-table-row type="body" + row-repeat="rowData in dbcapp.tableData"> + <tr> + <td att-table-body> + <!-- att-radio control does not work; not selected by controller successfully --> + <input type="radio" name="dmaapSelGroup" title="rowData.id" + ng-value="rowData.id" ng-model="dbcapp.selectDmaapModel.id" + ng-change="dbcapp.selectDmaapAccess(rowData);" /> + </td> + <td att-table-body ng-bind="rowData.name" + ng-click="dbcapp.editDmaapAccessModalPopup(rowData)"></td> + <td att-table-body ng-bind="rowData.dmaapUrl" + ng-click="dbcapp.editDmaapAccessModalPopup(rowData)"></td> + <td att-table-body ng-bind="rowData.mechId" + ng-click="dbcapp.editDmaapAccessModalPopup(rowData)"></td> + <!-- delete disabled for DE238329 + <td att-table-body> + <div ng-click="dbcapp.deleteDmaapAccess(rowData);" style="font-size:20px;"> + <a href="" class="ion-trash-b"></a> + </div> + </td> + --> + </tr> + </tbody> + </table> + </div> + +</div> diff --git a/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/dmaapaccess/dmaap_access_popup_template.html b/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/dmaapaccess/dmaap_access_popup_template.html new file mode 100644 index 0000000..c64f28c --- /dev/null +++ b/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/dmaapaccess/dmaap_access_popup_template.html @@ -0,0 +1,73 @@ +<!-- + ================================================================================ + DCAE DMaaP Bus Controller Web Application + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ================================================================================ + --> +<script type="text/ng-template" id="edit_dmaap_access_popup.html"> + <div class="modal__informative font-showcase" style="width:425px;"> + <div class="modal__header"> + <h2 class="font-showcase-font-name" style="width: 500px;">{{dbcapp.label}}</h2> + </div> + <div class="divider-container"> + <hr> + </div> + <div class="modal__content"> + <div class="fn-ebz-container" > + Name:<sup><b>*</b></sup> + <br/> + <!--autofocus is HTML5 attribute; doesn't work in Firefox--> + <input type="text" class="fn-ebz-text" ng-model="dbcapp.editDmaapAccess.name" /> + </div> + <br/> + <div class="fn-ebz-container" > + URL:<sup><b>*</b></sup> + <br/> + <!-- edit disabled for DE238329 --> + <input type="text" class="fn-ebz-text" ng-model="dbcapp.editDmaapAccess.dmaapUrl" disabled="disabled" /> + <button class="button button--primary button--small" + href="javascript:void(0)" + ng-click="dbcapp.testDmaapAccess(dbcapp.editDmaapAccess);"> + Test... + </button> + </div> + <br/> + <div class="fn-ebz-container" > + Mech ID: + <br/> + <input type="text" class="fn-ebz-text" ng-model="dbcapp.editDmaapAccess.mechId" /> + </div> + <br/> + <div class="fn-ebz-container" > + Password: + <br/> + <input type="password" class="fn-ebz-text dbcpassword" ng-model="dbcapp.editDmaapAccess.password" /> + </div> + </div> + <div class="modal__footer"> + <button class="button button--primary button--small" + href="javascript:void(0)" + ng-click="dbcapp.saveDmaapAccess(dbcapp.editDmaapAccess);"> + Save + </button> + <button class="button button--primary button--small" + href="javascript:void(0)" + ng-click="dbcapp.close()"> + Close + </button> + </div> + </div> +</script> diff --git a/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/dmaapaccess/modal-popup-controller.js b/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/dmaapaccess/modal-popup-controller.js new file mode 100644 index 0000000..00b6e3e --- /dev/null +++ b/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/dmaapaccess/modal-popup-controller.js @@ -0,0 +1,26 @@ +/*- + * ================================================================================ + * DCAE DMaaP Bus Controller Web Application + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +app.controller('modalpopupController', function ($scope, $modalInstance, message) { + 'use strict'; + // The modalService from modalService.js requires this controller. + // One is provided by fusion/scripts/controllers/modelpopupController.js + // (yes, with spelling error) but that has cruft not required here. + $scope.message = message; +}); diff --git a/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/home/dbc-home-controller.js b/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/home/dbc-home-controller.js new file mode 100644 index 0000000..5b9dbca --- /dev/null +++ b/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/home/dbc-home-controller.js @@ -0,0 +1,66 @@ +/*- + * ================================================================================ + * DCAE DMaaP Bus Controller Web Application + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +app.controller('dbcHomeCtrl', function($scope, $log, DmaapAccessService, ManifestService) { + // Loads info to show on the welcome page. + + // this object holds all app data and functions + $scope.dbcapp = {}; + $scope.dbcapp.selectedDmaapAccess=null; + $scope.dbcapp.isDataLoading = true; + $scope.dbcapp.isRequestFailed = false; + $scope.dbcapp.errMsg = null; + $scope.dbcapp.manifest=null; + + DmaapAccessService.getSelectedDmaapAccess() + .then(function(jsonObj) { + // must match keys in java controller's method + if (jsonObj.error) { + $scope.dbcapp.isRequestFailed = true; + $scope.dbcapp.errMsg = jsonObj.error; + } + else { + $scope.dbcapp.isRequestFailed = false; + $scope.dbcapp.errMsg = null; + $scope.dbcapp.selectedDmaapAccess=jsonObj.data; + + // Next get the manifest + ManifestService.getManifest() + .then(function(jsonObj) { + // $log.debug("dbcHomeCtrl: getManifest returned " + JSON.stringify(jsonObj)); + if (jsonObj.error) { + $scope.dbcapp.isRequestFailed = true; + $scope.dbcapp.errMsg = jsonObj.error; + } + else { + $scope.dbcapp.manifest=jsonObj.manifest; + } + },function(error){ + $log.error("dbcHomeCtrl getManifest failed: " + error); + }); + + } + $scope.dbcapp.isDataLoading=false; + },function(error){ + $log.error("dbcHomeCtrl: getSelectdDmaapAccess failed: " + error); + $scope.dbcapp.isDataLoading=false; + }); + + +}); diff --git a/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/home/dbc-spa-controller.js b/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/home/dbc-spa-controller.js new file mode 100644 index 0000000..1be3ffc --- /dev/null +++ b/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/home/dbc-spa-controller.js @@ -0,0 +1,50 @@ +/*- + * ================================================================================ + * DCAE DMaaP Bus Controller Web Application + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +app.config(function($routeProvider) { + $routeProvider + .when('/dmaap', { + templateUrl: 'app/dbcapp/dmaapaccess/dmaap_access_list.html', + controller : 'dmaapAccessListCtrl' + }) + .when('/dr_feed', { + templateUrl: 'app/dbcapp/datarouter/dr_feed_list.html', + controller : 'drFeedListCtrl' + }) + .when('/dr_pub', { + templateUrl: 'app/dbcapp/datarouter/dr_pub_list.html', + controller: 'drPubListCtrl' + }) + .when('/dr_sub', { + templateUrl: 'app/dbcapp/datarouter/dr_sub_list.html', + controller: 'drSubListCtrl' + }) + .when('/mr_topic', { + templateUrl: 'app/dbcapp/messagerouter/mr_topic_list.html', + controller : "mrTopicListCtrl" + }) + .when('/mr_client', { + templateUrl: 'app/dbcapp/messagerouter/mr_client_list.html', + controller: 'mrClientListCtrl' + }) + .otherwise({ + templateUrl: 'app/dbcapp/home/dbc_home_body.html', + controller: 'dbcHomeCtrl' + }); +}); diff --git a/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/home/dbc-style.css b/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/home/dbc-style.css new file mode 100644 index 0000000..86944fb --- /dev/null +++ b/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/home/dbc-style.css @@ -0,0 +1,77 @@ +/*- + * ================================================================================ + * DCAE DMaaP Bus Controller Web Application + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ + +/* Tweak height and width of password as set fn-ebz.css */ +input[type="password"].fn-ebz-text.dbcpassword { + -webkit-border-radius: 6px; + -moz-border-radius: 6px; + border-radius: 6px; + height: 40px; + width: 210px; + border: 1px solid gray; + font-size: .875rem; + padding-left: 10px; + margin-top: 0px; /* override */ + margin-right: 20px; +} + +input[type="text"].fn-ebz-text.dbcpagenum { + width: 85px; + height: 30px; + margin-right: 10px; +} + +/* Adjusts height and width to be narrow */ +select.fn-ebz-select.dbcpageselect { + -webkit-border-radius: 6px; + -moz-border-radius: 6px; + border-radius: 6px; + height: 30px; + width: 85px; + padding-left: 10px; + padding-right: 10px; + background-color: white; + color: black; + margin-top: 8px; + margin-right: 10px; + font-size: 12px; + appearance: none; /* not supported in IE */ + -webkit-appearance: none; /* not supported in IE */ + -moz-appearance: none; /* not supported in IE */ +} + +/* Adjusts height, width and top margin to match text fields */ +select.fn-ebz-select.dbcselect { + -webkit-border-radius: 6px; + -moz-border-radius: 6px; + border-radius: 6px; + height: 40px; + width: 210px; + padding-left: 10px; + padding-right: 10px; + background-color: white; + color: black; + margin-top: 0px; + margin-right: 10px; + font-size: 12px; + appearance: none; /* not supported in IE */ + -webkit-appearance: none; /* not supported in IE */ + -moz-appearance: none; /* not supported in IE */ +} diff --git a/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/home/dbc-yn-filter.js b/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/home/dbc-yn-filter.js new file mode 100644 index 0000000..79eb99d --- /dev/null +++ b/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/home/dbc-yn-filter.js @@ -0,0 +1,26 @@ +/*- + * ================================================================================ + * DCAE DMaaP Bus Controller Web Application + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +app.filter('dbcYesNoFilter', + function() { + return function(input) { + return input ? 'Y' : 'N'; + } + } +); diff --git a/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/home/dbc_home_body.html b/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/home/dbc_home_body.html new file mode 100644 index 0000000..9aa56d4 --- /dev/null +++ b/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/home/dbc_home_body.html @@ -0,0 +1,51 @@ +<!-- + ================================================================================ + DCAE DMaaP Bus Controller Web Application + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ================================================================================ + --> +<!-- controller is specified by route provider --> +<h1 class="heading1" style="margin-top: 10px;">DMaaP Bus Controller</h1> + +<P>Welcome to the DMaaP Bus Controller web application.</P> + +<div ng-show="dbcapp.isDataLoading"> + <div att-loading></div> +</div> + +<div ng-hide="dbcapp.isDataLoading"> + + <div ng-show="dbcapp.isRequestFailed"> + <span class="errorMessageText">{{dbcapp.errMsg}}</span> + </div> + + <div ng-hide="dbcapp.isRequestFailed"> + <a href="dbc#/dmaap">Selected DMaaP access profile:</a> + <ul> + <li>Name: <span style="font-weight: bold">{{dbcapp.selectedDmaapAccess.name}}</span></li> + <li>URL: <span style="font-weight: bold">{{dbcapp.selectedDmaapAccess.dmaapUrl}}</span></li> + </ul> + + <span style="font-size: 8pt; color: grey;"> Manifest + information: + <UL> + <LI>Build-Number: {{dbcapp.manifest['Build-Number']}}</LI> + <LI>Build-Time: {{dbcapp.manifest['Build-Time']}}</LI> + </UL> + </span> + </div> + +</div> diff --git a/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/home/dbc_popup_templates.html b/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/home/dbc_popup_templates.html new file mode 100644 index 0000000..cf2b77d --- /dev/null +++ b/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/home/dbc_popup_templates.html @@ -0,0 +1,73 @@ +<!-- + ================================================================================ + DCAE DMaaP Bus Controller Web Application + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ================================================================================ + --> +<script type="text/ng-template" id="modal_informative.html"> + <div class="modal__informative font-showcase"> + <div class="modal__header"> + <h2 class="font-showcase-font-name">Success!</h2> + <div class="modal__header--icon"></div> + </div> + <div class="divider-container"><hr></div> + <div class="modal__content" style="white-space: pre-wrap;">{{message.text}}</div> + <div class="modal__footer"> + <button class="button button--primary button--small" herf="javascript:void(0)" ng-click="$dismiss()">Dismiss</button> + </div> + </div> +</script> + +<script type="text/ng-template" id="confirmation_informative.html"> + <div class="modal__warning font-showcase" > + <div class="modal__header"> + <h2 class="font-showcase-font-name">{{message.title}}</h2> + <div class="modal__header--icon"></div> + </div> + <div class="divider-container"><hr> </div> + <div class="modal__content" style="white-space: pre-wrap;">{{message.text}}<br/></div> + <div class="modal__footer"> + <button class="button button--primary button--small" + href="javascript:void(0)" + ng-click="$close()"> + OK + </button> + <button class="button button--primary button--small" + href="javascript:void(0)" + ng-click="$dismiss()"> + Cancel + </button> + </div> + </div> +</script> + +<script type="text/ng-template" id="modal_warning.html"> + <div class="modal__warning font-showcase" > + <div class="modal__header"> + <h2 class="font-showcase-font-name">{{message.title}}</h2> + <div class="modal__header--icon"></div> + </div> + <div class="divider-container"><hr> </div> + <div class="modal__content" style="white-space: pre-wrap;">{{message.text}}<br/></div> + <div class="modal__footer"> + <button class="button button--primary button--small" + href="javascript:void(0)" + ng-click="$dismiss()"> + Dismiss + </button> + </div> + </div> +</script> diff --git a/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/home/dbc_spa.html b/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/home/dbc_spa.html new file mode 100644 index 0000000..d9d2546 --- /dev/null +++ b/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/home/dbc_spa.html @@ -0,0 +1,139 @@ +<!DOCTYPE html> +<!-- + ================================================================================ + DCAE DMaaP Bus Controller Web Application + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ================================================================================ + --> + +<html> + <!-- Data Bus Controller single-page application --> + + <head> + <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> + <meta http-equiv="cache-control" content="max-age=0" /> + <meta http-equiv="cache-control" content="no-cache" /> + <meta http-equiv="expires" content="0" /> + <meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT" /> + <meta http-equiv="pragma" content="no-cache" /> + <link rel="icon" type="image/ico" href="app/dbcapp/att-globe-16x16.ico" /> + + <!-- CSS --> + <link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/fn-ebz.css" > + <link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/sandbox/styles/demo.css" > + <link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/sandbox/styles/base.css" > + <link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/sandbox/styles/btn.css" > + <link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/sandbox/styles/dtpk.css" > + <link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/sandbox/styles/frms.css" > + <link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/sandbox/styles/sldr.css" > + <link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/sandbox/styles/style.css" > + <link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/sandbox/styles/tbs.css" > + <link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/ebz_header/portal_ebz_header.css"> + <link rel="stylesheet" type="text/css" href="static/fusion/css/jquery-ui.css"> + <link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/ebz_header/header.css"> + <link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/ebz_header/footer.css" > + <link rel="stylesheet" type="text/css" href="app/dbcapp/home/dbc-style.css"> + + <!-- Basic AngularJS --> + <script src="app/fusion/external/ebz/angular_js/angular.js"></script> + <script src="app/fusion/external/ebz/angular_js/angular-sanitize.js"></script> + <script src="app/fusion/external/ebz/angular_js/angular-route.min.js"></script> + <script src="app/fusion/external/ebz/angular_js/angular-cookies.js"></script> + <script src="app/fusion/external/ebz/angular_js/gestures.js"></script> + <script src="app/fusion/external/ebz/angular_js/app.js"></script> + <script src="app/fusion/external/ebz/sandbox/att-abs-tpls.js" type="text/javascript"></script> + <!-- jQuery --> + <script src="static/js/jquery-1.10.2.js"></script> + <script src="static/js/jquery.mask.min.js" type="text/javascript"></script> + <script src="static/js/jquery-ui.js" type="text/javascript"></script> + <!-- AngularJS Gridster --> + <script src="static/fusion/js/att_angular_gridster/ui-gridster-tpls.js"></script> + <script src="static/fusion/js/att_angular_gridster/angular-gridster.js"></script> + <!-- AngularJS Config --> + <script src= "app/fusion/external/ebz/angular_js/checklist-model.js"></script> + <!-- Utility --> + <script src="app/fusion/scripts/modalService.js"></script> + <script src="app/fusion/external/angular-ui/ui-bootstrap-tpls-1.1.2.min.js"></script> + <script src="app/fusion/ase/scripts/bower_components/lodash/lodash.min.js"></script> + + <!-- Header and Footer --> + <script src="app/fusion/scripts/directives/footer.js"></script> + <script src="app/fusion/external/ebz/js/footer.js"></script> + <script src="app/fusion/scripts/directives/header.js"></script> + <script src="app/fusion/scripts/directives/leftMenu.js"></script> + + <!-- core services --> + <script src="app/fusion/scripts/services/userInfoService.js"></script> + <script src="app/fusion/scripts/services/leftMenuService.js"></script> + + <!-- filters --> + <script src="app/dbcapp/home/dbc-yn-filter.js"></script> + + <!-- dmaaap access --> + <script src="app/dbcapp/dmaapaccess/dmaap-access-list-controller.js"></script> + <script src="app/dbcapp/dmaapaccess/dmaap-access-popup-controller.js"></script> + <script src="app/dbcapp/dmaapaccess/dmaap-access-service.js"></script> + <script src="app/dbcapp/dmaapaccess/modal-popup-controller.js"></script> + <!-- popup requires templates; their file is loaded below --> + + <!-- data router --> + <script src="app/dbcapp/datarouter/dr-feed-service.js"></script> + <script src="app/dbcapp/datarouter/dr-feed-list-controller.js"></script> + <script src="app/dbcapp/datarouter/dr-feed-popup-controller.js"></script> + <script src="app/dbcapp/datarouter/dr-feed-pub-sub-list-popup-controller.js"></script> + <script src="app/dbcapp/datarouter/dr-pub-service.js"></script> + <script src="app/dbcapp/datarouter/dr-pub-list-controller.js"></script> + <script src="app/dbcapp/datarouter/dr-pub-popup-controller.js"></script> + <script src="app/dbcapp/datarouter/dr-sub-service.js"></script> + <script src="app/dbcapp/datarouter/dr-sub-list-controller.js"></script> + <script src="app/dbcapp/datarouter/dr-sub-popup-controller.js"></script> + + <!-- message router --> + <script src="app/dbcapp/messagerouter/mr-client-service.js"></script> + <script src="app/dbcapp/messagerouter/mr-client-list-controller.js"></script> + <script src="app/dbcapp/messagerouter/mr-client-popup-controller.js"></script> + <script src="app/dbcapp/messagerouter/mr-topic-client-list-popup-controller.js"></script> + <script src="app/dbcapp/messagerouter/mr-topic-service.js"></script> + <script src="app/dbcapp/messagerouter/mr-topic-list-controller.js"></script> + <script src="app/dbcapp/messagerouter/mr-topic-popup-controller.js"></script> + + <!-- main page --> + <script src="app/dbcapp/home/manifest-service.js"></script> + <script src="app/dbcapp/home/dbc-home-controller.js"></script> + <script src="app/dbcapp/home/dbc-spa-controller.js"></script> + + <!-- Icon --> + <link rel="stylesheet" type="text/css" href="app/fusion/external/ionicons-2.0.1/css/ionicons.css" /> + </head> + <body class="appBody" ng-app="abs"> + <!-- double quotation marks are required for the popup templates - values are string literals! --> + <div ng-include src="'app/dbcapp/home/dbc_popup_templates.html'"></div> + <div ng-include src="'app/dbcapp/dmaapaccess/dmaap_access_popup_template.html'"></div> + <div ng-include src="'app/dbcapp/datarouter/dr_feed_add_popup_template.html'"></div> + <div ng-include src="'app/dbcapp/datarouter/dr_feed_edit_popup_template.html'"></div> + <div ng-include src="'app/dbcapp/datarouter/dr_feed_pub_sub_list_popup_template.html'"></div> + <div ng-include src="'app/dbcapp/datarouter/dr_pub_popup_template.html'"></div> + <div ng-include src="'app/dbcapp/datarouter/dr_sub_popup_template.html'"></div> + <div ng-include src="'app/dbcapp/messagerouter/mr_client_popup_template.html'"></div> + <div ng-include src="'app/dbcapp/messagerouter/mr_topic_popup_template.html'"></div> + <div ng-include src="'app/dbcapp/messagerouter/mr_topic_client_list_popup_template.html'"></div> + <div q-header></div> + <div q-menu class="appLeftMenu"></div> + <div ng-view id="rightContentFeeds" style="min-height: 450px;margin-top:-50px;margin-left:210px;margin-right:110px;"> + </div> + <div q-footer class="appFooter"></div> + </body> +</html> diff --git a/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/home/manifest-service.js b/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/home/manifest-service.js new file mode 100644 index 0000000..03f143a --- /dev/null +++ b/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/home/manifest-service.js @@ -0,0 +1,43 @@ +/*- + * ================================================================================ + * DCAE DMaaP Bus Controller Web Application + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +app.factory('ManifestService', function ($http, $q, $log) { + return { + // Gets and returns the manifest for the webapp. + getManifest: function() { + // cache control for IE + var cc = "?cc=" + new Date().getTime().toString(); + return $http({ + method: 'GET', + url: 'manifest' + cc, + cache: false, + responseType: 'json'}) + .then(function(response) { + // $log.debug("ManifestService.getManifest: " + JSON.stringify(response)); + if (response.data == null || typeof response.data != 'object') + return $q.reject('ManifestService.getManifest: response.data null or not object'); + else + return response.data; + }, function(error) { + $log.error('ManifestService.getManifest failed: ' + error.data); + return $q.reject(error.data); + }); + } + }; +}); diff --git a/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/messagerouter/mr-client-list-controller.js b/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/messagerouter/mr-client-list-controller.js new file mode 100644 index 0000000..e6b11f8 --- /dev/null +++ b/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/messagerouter/mr-client-list-controller.js @@ -0,0 +1,154 @@ +/*- + * ================================================================================ + * DCAE DMaaP Bus Controller Web Application + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +app.controller('mrClientListCtrl', function($scope, $log, $modal, modalService, MRClientService){ + + // populates the table of Message Router clients + 'use strict'; + + // this object holds all app data and functions + $scope.dbcapp = {}; + // models for controls on screen + $scope.dbcapp.tableData=[]; + $scope.dbcapp.currentPageNum=1; + $scope.dbcapp.totalPages=1; + $scope.dbcapp.viewPerPage = 100; + $scope.dbcapp.viewPerPageOptions = [ + { index : 0, value : 100 }, + { index : 1, value : 500 }, + { index : 2, value : 1000 }, + { index : 3, value : 2500 } + ]; + // other + $scope.dbcapp.errMsg=null; + $scope.dbcapp.isDataLoading=true; + $scope.dbcapp.isRequestFailed=false; + + /** + * Answers an array of the specified size - makes Angular iteration easy. + */ + $scope.dbcapp.buildArraySizeN = function(num) { + // $log.debug("buildArraySizeN: invoked with " + num); + return new Array(num); + } + + /** + * Loads the table of message router clients. + */ + $scope.dbcapp.loadTable = function() { + $scope.dbcapp.isDataLoading = true; + MRClientService.getClientsByPage($scope.dbcapp.currentPageNum,$scope.dbcapp.viewPerPage) + .then(function(jsonObj){ + if (jsonObj.error) { + $scope.dbcapp.isRequestFailed = true; + $scope.dbcapp.errMsg = jsonObj.error; + $scope.dbcapp.tableData = []; + } + else { + $scope.dbcapp.isRequestFailed = false; + $scope.dbcapp.errMsg = null; + $scope.dbcapp.profileName = jsonObj.profileName; + $scope.dbcapp.dmaapName = jsonObj.dmaapName; + $scope.dbcapp.dcaeLocations = jsonObj.dcaeLocations; + $scope.dbcapp.totalPages = jsonObj.totalPages; + $scope.dbcapp.tableData = jsonObj.data; + } + $scope.dbcapp.isDataLoading=false; + },function(error){ + $log.error("mrClientListCtrl.loadTable failed: " + error); + $scope.dbcapp.isRequestFailed = true; + $scope.dbcapp.errMsg = error; + $scope.dbcapp.tableData = []; + $scope.dbcapp.isDataLoading = false; + }); + }; + + /** + * Shows a modal pop-up to edit a client. + * Passes data in via an object named "message". + * Always updates the table, even on failure, to discard + * user-entered changes that were not persisted. + */ + $scope.dbcapp.editClientModalPopup = function(client) { + $scope.dbcapp.editClient = client; + var modalInstance = $modal.open({ + templateUrl : 'edit_client_popup.html', + controller : 'clientPopupCtrl', + resolve : { + message : function() { + var dataForPopup = { + client : $scope.dbcapp.editClient, + clientList : $scope.dbcapp.tableData, + dcaeList : $scope.dbcapp.dcaeLocations + }; + return dataForPopup; + } + } + }); + modalInstance.result.then(function(response) { + if (response == null) { + // $log.debug('editClientModalPopup: user closed dialog'); + } + else { + // $log.debug('editClientModalPopup: response: ' + JSON.stringify(response)); + if (response.error != null) + modalService.showFailure('Edit Failed', + 'Failed to edit client:\n' + response.error); + // refresh in all cases + $scope.dbcapp.loadTable(); + } + }); + }; + + /** + * Shows a modal pop-up to confirm deletion of a client. + * On successful completion, updates the table. + */ + $scope.dbcapp.deleteClientModalPopup = function(client) { + modalService.popupConfirmWin("Confirm", + "Delete the client:\n" + client.mrClientId + "\nContinue?", + function() { + // $log.debug('deleteClientModalPopup: ' + topic.fqtn); + MRClientService.deleteClient(client.mrClientId) + .then( + function(response) { + // $log.debug('deleteClientModalPopup: response: ' + JSON.stringify(response)); + if (response.error != null) { + modalService.showFailure('Delete Failed', + 'Failed to delete client ' + client.mrClientId + + '\n' + response.error); + } + else { + // success, get the updated list. + $scope.dbcapp.loadTable() + } + }, + function(error) { + modalService.showFailure('Delete Failed', + 'Request failed to delete client ' + client.mrClientId + '\n' + + JSON.stringify(error)); + } + ); + }) + }; + + // Populate the table on load. + $scope.dbcapp.loadTable(); + +}); diff --git a/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/messagerouter/mr-client-popup-controller.js b/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/messagerouter/mr-client-popup-controller.js new file mode 100644 index 0000000..d4bb40b --- /dev/null +++ b/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/messagerouter/mr-client-popup-controller.js @@ -0,0 +1,127 @@ +/*- + * ================================================================================ + * DCAE DMaaP Bus Controller Web Application + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +app.controller('clientPopupCtrl', function($scope, $log, $modalInstance, modalService, message, MRClientService) { + + 'use strict'; + + // this object holds all app data and functions + $scope.dbcapp = {}; + + // Set the label variable for the template + if (message.client == null || message.client.mrClientId == null) + $scope.dbcapp.label = 'Add Client'; + else + $scope.dbcapp.label = 'Edit Client'; + + // client object brings fqtn + $scope.dbcapp.editClient = message.client; + $scope.dbcapp.dcaeList = message.dcaeList; + + // Models for checkboxes + var PUB = 0; + var SUB = 1; + var VIEW = 2; + $scope.dbcapp.clientactionbox = []; + $scope.dbcapp.clientactionbox[PUB] = false; + $scope.dbcapp.clientactionbox[SUB] = false; + $scope.dbcapp.clientactionbox[VIEW] = false; + + // Morph the list of action strings into checks in boxes + for (var aidx in $scope.dbcapp.editClient.action) { + var action = $scope.dbcapp.editClient.action[aidx]; + // $log.debug('clientPopupCtrl: action idx ' + aidx + ', action ' + action); + if ("pub" == action) + $scope.dbcapp.clientactionbox[PUB] = true; + else if ("sub" == action) + $scope.dbcapp.clientactionbox[SUB] = true; + else if ("view" == action) + $scope.dbcapp.clientactionbox[VIEW] = true; + } + + /** + * Validates content of user-editable fields. + * Returns null if all is well, + * a descriptive error message otherwise. + */ + $scope.dbcapp.validateClient = function(client) { + if (client == null) + return "No data found.\nPlease enter some values."; + if (client.dcaeLocationName == null) + return "DCAE Location is required.\nPlease select a value."; + if (client.clientRole == null || client.clientRole.trim() == '') + return "Client role is required.\nPlease enter a value."; + // I don't like hardcoded strings, but what to do? + // IE does not support startsWith method + // $log.debug('validateClient: ' + client.clientRole.indexOf('com.openecomp.')); + if (client.clientRole.toLowerCase().indexOf('com.openecomp.') != 0) + return "Unexpected client role prefix.\nPlease enter a value starting with 'com.openecomp.'"; + if (client.action.length == 0) + return "An action is required.\nPlease select one or more actions."; + return null; + } + + $scope.dbcapp.saveClient = function(client) { + // Store list of action strings (if any) + var action_list = []; + for (var aidx in $scope.dbcapp.clientactionbox) { + if (aidx == PUB && $scope.dbcapp.clientactionbox[aidx]) + action_list.push('pub'); + else if (aidx == SUB && $scope.dbcapp.clientactionbox[aidx]) + action_list.push('sub'); + else if (aidx == VIEW && $scope.dbcapp.clientactionbox[aidx]) + action_list.push('view'); + } + $scope.dbcapp.editClient.action = action_list; + + var validateMsg = $scope.dbcapp.validateClient(client); + if (validateMsg != null) { + modalService.showFailure("Invalid Content", validateMsg); + return; + } + + if (client.mrClientId == null) { + // No id, so create a new one + MRClientService.addClient(client) + .then(function(response) { + $modalInstance.close(response); + }, + function (error) { + $log.error('clientPopupCtrl.saveClient: error while adding: ' + error); + } + ); + } + else { + // Has ID, so update an existing one + MRClientService.updateClient(client) + .then(function(response) { + $modalInstance.close(response); + }, + function (error) { + $log.error('clientPopupCtrl.saveClient: error while updating: ' + error); + } + ); + } + + }; // saveClient + + $scope.dbcapp.close = function() { + $modalInstance.close(); + }; +}); diff --git a/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/messagerouter/mr-client-service.js b/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/messagerouter/mr-client-service.js new file mode 100644 index 0000000..f5f8167 --- /dev/null +++ b/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/messagerouter/mr-client-service.js @@ -0,0 +1,105 @@ +/*- + * ================================================================================ + * DCAE DMaaP Bus Controller Web Application + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +app.factory('MRClientService', function ($http, $q, $log) { + return { + /** + * Gets one page of message router client objects. + * @param {Number} pageNum - page number; e.g., 1 + * @param {Number} viewPerPage - number of items per page; e.g., 25 + * @return {JSON} Response object from remote side + */ + getClientsByPage: function(pageNum,viewPerPage) { + // cache control for IE + var cc = "&cc=" + new Date().getTime().toString(); + return $http({ + method: 'GET', + url: 'mr_client?pageNum=' + pageNum + '&viewPerPage=' + viewPerPage + cc, + cache: false, + responseType: 'json' }) + .then(function(response) { + if (response.data == null || typeof response.data != 'object') + return $q.reject('MRClientService.getClientsByPage: response.data null or not object'); + else + return response.data; + }, + function(error) { + $log.error('MRClientService.getClientsByPage failed: ' + error); + return $q.reject(error.data); + }); + }, + + // Creates a new client. + addClient: function(client) { + return $http({ + method: 'POST', + url: 'mr_client', + data: client, + responseType: 'json' }) + .then(function(response) { + if (response.data == null || typeof response.data != 'object') + return $q.reject('MRClientService.addClient: response.data null or not object'); + else + return response.data; + }, + function(error) { + $log.error('MRClientService.addClient failed: ' + error); + return $q.reject(error.data); + }); + }, + + // Updates an existing client. + updateClient: function(client) { + return $http({ + method: 'PUT', + url: 'mr_client/' + client.mrClientId, + data: client, + responseType: 'json' }) + .then(function(response) { + if (response.data == null || typeof response.data != 'object') + return $q.reject('MRClientService.updateClient: response.data null or not object'); + else + return response.data; + }, + function(error) { + $log.error('MRClientService.updateClient failed: ' + JSON.stringify(error)); + return $q.reject(error.data); + }); + }, + + // Deletes the client with the specified ID + deleteClient: function(mrClientId) { + return $http({ + method: 'DELETE', + url: 'mr_client/' + mrClientId, + responseType: 'json' }) + .then(function(response) { + if (response.data == null || typeof response.data != 'object') + return $q.reject('MRClientService.deleteClient: response.data null or not object'); + else + return response.data; + }, + function(error) { + $log.error('MRClientService.deleteClient failed: ' + error); + return $q.reject(error.data); + }); + }, + + }; +}); diff --git a/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/messagerouter/mr-topic-client-list-popup-controller.js b/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/messagerouter/mr-topic-client-list-popup-controller.js new file mode 100644 index 0000000..4546ac9 --- /dev/null +++ b/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/messagerouter/mr-topic-client-list-popup-controller.js @@ -0,0 +1,36 @@ +/*- + * ================================================================================ + * DCAE DMaaP Bus Controller Web Application + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +app.controller('topicClientListPopupCtrl', function($scope, $log, $modalInstance, modalService, message) { + + 'use strict'; + + // this object holds all app data and functions + $scope.dbcapp = {}; + + // Set the label variable for the template + $scope.dbcapp.label = 'Clients of Topic ' + message.topic.topicName; + + // Source of data table + $scope.dbcapp.showTopic = message.topic; + + $scope.dbcapp.close = function() { + $modalInstance.close(); + }; +}); diff --git a/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/messagerouter/mr-topic-list-controller.js b/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/messagerouter/mr-topic-list-controller.js new file mode 100644 index 0000000..46e1951 --- /dev/null +++ b/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/messagerouter/mr-topic-list-controller.js @@ -0,0 +1,248 @@ +/*- + * ================================================================================ + * DCAE DMaaP Bus Controller Web Application + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +app.controller('mrTopicListCtrl', function($scope, $log, $modal, modalService, MRTopicService){ + + // populates the table of Message Router topics + 'use strict'; + + // this object holds all app data and functions + $scope.dbcapp = {}; + // models for controls on screen + $scope.dbcapp.tableData=[]; + $scope.dbcapp.currentPageNum=1; + $scope.dbcapp.totalPages=1; + $scope.dbcapp.viewPerPage = 100; + $scope.dbcapp.viewPerPageOptions = [ + { index : 0, value : 100 }, + { index : 1, value : 500 }, + { index : 2, value : 1000 }, + { index : 3, value : 2500 } + ]; + // other + $scope.dbcapp.errMsg=null; + $scope.dbcapp.isDataLoading=true; + $scope.dbcapp.isRequestFailed=false; + + /** + * Answers an array of the specified size - makes Angular iteration easy. + */ + $scope.dbcapp.buildArraySizeN = function(num) { + // $log.debug("buildArraySizeN: invoked with " + num); + return new Array(num); + } + + /** + * Loads the table of message router topics. + */ + $scope.dbcapp.loadTable = function() { + $scope.dbcapp.isDataLoading = true; + MRTopicService.getTopicsByPage($scope.dbcapp.currentPageNum, $scope.dbcapp.viewPerPage) + .then(function(jsonObj){ + // must match keys in java controller's method + if (jsonObj.error) { + $scope.dbcapp.isRequestFailed = true; + $scope.dbcapp.errMsg = jsonObj.error; + $scope.dbcapp.tableData = []; + } + else { + $scope.dbcapp.isRequestFailed = false; + $scope.dbcapp.errMsg = null; + $scope.dbcapp.profileName = jsonObj.profileName; + $scope.dbcapp.dmaapName = jsonObj.dmaapName; + $scope.dbcapp.dcaeLocations = jsonObj.dcaeLocations; + $scope.dbcapp.totalPages = jsonObj.totalPages; + $scope.dbcapp.tableData = jsonObj.data; + } + $scope.dbcapp.isDataLoading=false; + },function(error){ + $log.error("mrTopicListCtrl.loadTable failed: " + error); + $scope.dbcapp.isRequestFailed = true; + $scope.dbcapp.errMsg = error; + $scope.dbcapp.tableData = []; + $scope.dbcapp.isDataLoading = false; + }); + }; + + /** + * Shows a modal pop-up to add a topic. Passes data in via an object named + * "message". On successful completion, updates the table. + */ + $scope.dbcapp.addTopicModalPopup = function() { + $scope.dbcapp.editTopic = null; + var modalInstance = $modal.open({ + templateUrl : 'edit_topic_popup.html', + controller : 'topicPopupCtrl', + resolve : { + message : function() { + var dataForPopup = { + topic : $scope.dbcapp.editTopic, + topicList : $scope.dbcapp.tableData + }; + return dataForPopup; + } + } + }); + modalInstance.result.then(function(response) { + if (response == null) { + // $log.debug('addFeedModalPopup: user closed dialog'); + } + else { + if (response.error != null) + modalService.showFailure('Add Failed', + 'Failed to add topic:\n' + response.error); + else + // success, get the updated list. + $scope.dbcapp.loadTable(); + } + }); + }; + + /** + * Shows a modal pop-up to edit a topic. + * Passes data in via an object named "message". + * Always updates the table, even on failure, to discard + * user-entered changes that were not persisted. + */ + $scope.dbcapp.editTopicModalPopup = function(topic) { + $scope.dbcapp.editTopic = topic; + var modalInstance = $modal.open({ + templateUrl : 'edit_topic_popup.html', + controller : 'topicPopupCtrl', + resolve : { + message : function() { + var dataForPopup = { + topic : $scope.dbcapp.editTopic, + topicList : $scope.dbcapp.tableData + }; + return dataForPopup; + } + } + }); + modalInstance.result.then(function(response) { + if (response == null) { + // $log.debug('editTopicModalPopup: user closed dialog'); + } + else { + // $log.debug('editTopicModalPopup: response: ' + JSON.stringify(response)); + if (response.error != null) + modalService.showFailure('Edit Failed', + 'Failed to edit topic ' + topic.fqtn + + '\n' + response.error); + // refresh in all cases + $scope.dbcapp.loadTable(); + } + }); + }; + + /** + * Shows a modal pop-up to confirm deletion of a topic. On successful + * completion, updates the table. + */ + $scope.dbcapp.deleteTopicModalPopup = function(topic) { + modalService.popupConfirmWin("Confirm", + "Delete the topic:\n" + topic.fqtn + "\nContinue?", + function() { + // $log.debug('deleteTopicModalPopup: ' + topic.fqtn); + MRTopicService.deleteTopic(topic.fqtn) + .then( + function(response) { + // $log.debug('deleteTopicModalPopup: response: ' + JSON.stringify(response)); + if (response.error != null) { + $log.error('deleteTopicModalPopup: failed to delete: ' + response.error); + modalService.showFailure('Delete Failed', + 'Failed to delete topic ' + topic.fqtn + + '\n' + response.error); + } + else { + // success, get the updated list. + $scope.dbcapp.loadTable() + } + }, + function(error) { + modalService.showFailure('Delete Failed', + 'Request failed to delete topic ' + topic.fqtn + '\n' + + JSON.stringify(error)); + } + ); + }) + }; + + /** + * Shows a modal pop-up with all clients of a topic. + * Passes data in via an object named "message". + */ + $scope.dbcapp.showTopicClientsModalPopup = function(topic) { + var modalInstance = $modal.open({ + templateUrl : 'topic_client_list_popup.html', + controller : 'topicClientListPopupCtrl', + resolve : { + message : function() { + var dataForPopup = { + topic : topic + }; + return dataForPopup; + } + } + }); + modalInstance.result.then(function(response) { + // No response expected. + }); + }; + + /** + * Shows a modal pop-up to add a client to a topic + * Passes data in via an object named "message". + * On successful completion, updates the table. + */ + $scope.dbcapp.addTopicClientModalPopup = function(topic) { + $scope.dbcapp.editClient = { fqtn : topic.fqtn } + var modalInstance = $modal.open({ + templateUrl : 'edit_client_popup.html', + controller : 'clientPopupCtrl', + resolve : { + message : function() { + var dataForPopup = { + client : $scope.dbcapp.editClient, + clientList : [], // empty list + dcaeList : $scope.dbcapp.dcaeLocations + }; + return dataForPopup; + } + } + }); + modalInstance.result.then(function(response) { + if (response == null) { + // $log.debug('addTopicClientModalPopup: user closed dialog'); + } + else { + if (response.error != null) + modalService.showFailure('Add Client Failed', + 'Failed to add client to topic:\n' + response.error); + else + // success, get the updated list. + $scope.dbcapp.loadTable(); + } + }); + }; + + // Populate the table on load. + $scope.dbcapp.loadTable(); + +}); diff --git a/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/messagerouter/mr-topic-popup-controller.js b/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/messagerouter/mr-topic-popup-controller.js new file mode 100644 index 0000000..4d885c5 --- /dev/null +++ b/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/messagerouter/mr-topic-popup-controller.js @@ -0,0 +1,83 @@ +/*- + * ================================================================================ + * DCAE DMaaP Bus Controller Web Application + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +app.controller('topicPopupCtrl', function($scope, $log, $modalInstance, modalService, message, MRTopicService) { + 'use strict'; + + // this object holds all app data and functions + $scope.dbcapp = {}; + + // Set the label variable for the template + if (message.topic == null) + $scope.dbcapp.label = 'Add Topic'; + else + $scope.dbcapp.label = 'Edit Topic'; + $scope.dbcapp.editTopic = message.topic; + + /** + * Validates content of user-editable fields. + * Returns null if all is well, + * a descriptive error message otherwise. + */ + $scope.dbcapp.validateTopic = function(topic) { + if (topic == null) + return "No data found.\nPlease enter some values."; + if (topic.topicName == null || topic.topicName.trim() == '') + return "Name is required.\nPlease enter a value."; + if (topic.topicDescription == null || topic.topicDescription.trim() == '') + return "Description is required.\nPlease enter a value."; + return null; + } + + $scope.dbcapp.saveTopic = function(topic) { + var validateMsg = $scope.dbcapp.validateTopic(topic); + if (validateMsg != null) { + modalService.showFailure("Invalid Content", validateMsg); + return; + } + + if (topic.fqtn == null) { + // No fqtn, so create a new one + MRTopicService.addTopic(topic) + .then(function(response) { + $modalInstance.close(response); + }, + function (error) { + $log.error('topicPopupCtrl.saveTopic: error while adding: ' + error); + } + ); + } + else { + // Has fqtn, so update an existing one + MRTopicService.updateTopic(topic) + .then(function(response) { + $modalInstance.close(response); + }, + function (error) { + $log.error('topicPopupCtrl.saveTopic: error while updating: ' + error); + } + ); + } + + }; // saveTopic + + $scope.dbcapp.close = function() { + $modalInstance.close(); + }; +}); diff --git a/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/messagerouter/mr-topic-service.js b/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/messagerouter/mr-topic-service.js new file mode 100644 index 0000000..49642f7 --- /dev/null +++ b/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/messagerouter/mr-topic-service.js @@ -0,0 +1,105 @@ +/*- + * ================================================================================ + * DCAE DMaaP Bus Controller Web Application + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +app.factory('MRTopicService', function ($http, $q, $log) { + return { + /** + * Gets one page of message router topic objects. + * @param {Number} pageNum - page number; e.g., 1 + * @param {Number} viewPerPage - number of items per page; e.g., 25 + * @return {JSON} Response object from remote side + */ + getTopicsByPage: function(pageNum,viewPerPage) { + // cache control for IE + var cc = "&cc=" + new Date().getTime().toString(); + return $http({ + method: 'GET', + url: 'mr_topic?pageNum=' + pageNum + '&viewPerPage=' + viewPerPage + cc, + cache: false, + responseType: 'json' }) + .then(function(response) { + if (response.data == null || typeof response.data != 'object') + return $q.reject('MRTopicService.getTopicsByPage: response.data null or not object'); + else + return response.data; + }, + function(error) { + $log.error('MRTopicService.getTopicsByPage failed: ' + JSON.stringify(error)); + return $q.reject(error.data); + }); + }, + + // Creates a new topic. + addTopic: function(topic) { + return $http({ + method: 'POST', + url: 'mr_topic', + data: topic, + responseType: 'json' }) + .then(function(response) { + if (response.data == null || typeof response.data != 'object') + return $q.reject('MRTopicService.addTopic: response.data null or not object'); + else + return response.data; + }, + function(error) { + $log.error('MRTopicService.addTopic failed: ' + JSON.stringify(error)); + return $q.reject(error.data); + }); + }, + + // Updates an existing topic. + updateTopic: function(topic) { + return $http({ + method: 'PUT', + url: 'mr_topic/' + topic.fqtn, + data: topic, + responseType: 'json' }) + .then(function(response) { + if (response.data == null || typeof response.data != 'object') + return $q.reject('MRTopicService.updateTopic: response.data null or not object'); + else + return response.data; + }, + function(error) { + $log.error('MRTopicService.updateTopic failed: ' + JSON.stringify(error)); + return $q.reject(error.data); + }); + }, + + // Deletes the topic with the specified FQTN. + deleteTopic: function(fqtn) { + return $http({ + method: 'DELETE', + url: 'mr_topic/' + fqtn, + responseType: 'json' }) + .then(function(response) { + if (response.data == null || typeof response.data != 'object') + return $q.reject('MRTopicService.deleteTopic: response.data null or not object'); + else + return response.data; + }, + function(error) { + $log.error('MRTopicService.deleteTopic failed: ' + JSON.stringify(error)); + return $q.reject(error.data); + }); + }, + + }; +}); diff --git a/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/messagerouter/mr_client_list.html b/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/messagerouter/mr_client_list.html new file mode 100644 index 0000000..1dac153 --- /dev/null +++ b/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/messagerouter/mr_client_list.html @@ -0,0 +1,142 @@ +<!-- + ================================================================================ + DCAE DMaaP Bus Controller Web Application + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ================================================================================ + --> +<!-- controller is specified by route provider --> + +<div class="pageTitle"> + <h3 class="heading3" style="margin-top: 10px; margin-bottom: 10px;">Topic Clients</h3> +</div> + +<div id="button-search-row"> + <!-- NO "add" button on this page --> + <div style="float:right;"> + <div class="form-field form-field__small"> + <input class="fn-ebz-text.search" + type="text" + placeholder="Search clients" + ng-model="dbcapp.searchString"/> + <i class="ion-search" style="position:relative;line-height:10px;top:-25px;right:-190px"></i> + </div> + </div> + </div> + +<!-- show progress indicator --> +<div ng-show="dbcapp.isDataLoading"> + <div att-loading></div> +</div> + +<div ng-hide="dbcapp.isDataLoading"> + + <div ng-show="dbcapp.isRequestFailed"> + <span class="errorMessageText">{{dbcapp.errMsg}}</span> + </div> + + <div ng-hide="dbcapp.isRequestFailed"> + Access Profile <strong>{{dbcapp.profileName}}</strong>, DMaaP Name <strong>{{dbcapp.dmaapName}}</strong> + </div> + + <table att-table + id="clients-table" + table-data="dbcapp.tableData" + search-string="dbcapp.searchString" + view-per-page="dbcapp.viewPerPageIgnored" + current-page="dbcapp.currentPageIgnored" + total-page="dbcapp.totalPageIgnored"> + + <thead att-table-row type="header"> + <tr> + <th att-table-header sortable="true" key="mrClientId">MR Client ID</th> + <th att-table-header sortable="true" key="dcaeLocationName">DCAE Location Name</th> + <th att-table-header sortable="true" key="fqtn">Qualified Topic Name</th> + <th att-table-header sortable="true" key="action">Action</th> + <th att-table-header sortable="true" key="clientRole">Client Role</th> + <th att-table-header sortable="true" key="lastMod">Last Modified</th> + <th att-table-header sortable="true" key="status">Status</th> + <th att-table-header sortable="true" key="topicURL">Topic URL</th> + <th att-table-header sortable="false">Delete</th> + </tr> + </thead> + <tbody att-table-row type="body" row-repeat="rowData in dbcapp.tableData"> + <tr> + <td att-table-body + ng-bind="rowData.mrClientId" + ng-click="dbcapp.editClientModalPopup(rowData)"/> + <td att-table-body + ng-bind="rowData.dcaeLocationName" + ng-click="dbcapp.editClientModalPopup(rowData)"/> + <td att-table-body + ng-bind="rowData.fqtn" + ng-click="dbcapp.editClientModalPopup(rowData)"/> + <td att-table-body + ng-bind="rowData.action" + ng-click="dbcapp.editClientModalPopup(rowData)"/> + <td att-table-body + ng-bind="rowData.clientRole" + ng-click="dbcapp.editClientModalPopup(rowData)"/> + <td att-table-body + ng-bind="rowData.lastMod" + ng-click="dbcapp.editClientModalPopup(rowData)"/> + <td att-table-body + ng-bind="rowData.status" + ng-click="dbcapp.editClientModalPopup(rowData)"/> + <td att-table-body + ng-bind="rowData.topicURL" + ng-click="dbcapp.editClientModalPopup(rowData)"/> + <td att-table-body> + <div ng-click="dbcapp.deleteClientModalPopup(rowData);" style="font-size:20px;"> + <a href="" class="ion-trash-b"></a> + </div> + </td> + </tr> + </tbody> + </table> + + <div class="fn-ebz-container" > + Page Number: + <select class="fn-ebz-select dbcpageselect" + name="currentPageNumSelector" + ng-model="dbcapp.currentPageNum" + ng-change="dbcapp.loadTable()"> + <option ng-repeat="p in dbcapp.buildArraySizeN(dbcapp.totalPages) track by $index" + value="{{$index+1}}" + ng-selected="{{$index+1}}=={{dbcapp.currentPageNum}}"> + {{$index+1}} + </option> + </select> + Page Count: + <input class="fn-ebz-text dbcpagenum" + type="text" + ng-model="dbcapp.totalPages" + readonly="true"> + Rows per Page: + <select class="fn-ebz-select dbcpageselect" + name="viewPerPageSelector" + ng-model="dbcapp.viewPerPage" + ng-change="dbcapp.loadTable()" + style="height: 30px;"> + <option ng-repeat="v in dbcapp.viewPerPageOptions" + value="{{v.value}}" + ng-selected="{{v.value}}=={{dbcapp.viewPerPage}}"> + {{v.value}} + </option> + </select> + </div> + +</div> +<!-- loading --> diff --git a/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/messagerouter/mr_client_popup_template.html b/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/messagerouter/mr_client_popup_template.html new file mode 100644 index 0000000..8f45073 --- /dev/null +++ b/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/messagerouter/mr_client_popup_template.html @@ -0,0 +1,68 @@ +<!-- + ================================================================================ + DCAE DMaaP Bus Controller Web Application + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ================================================================================ + --> +<script type="text/ng-template" id="edit_client_popup.html"> + <div class="modal__informative font-showcase" style="width:400px;"> + <div class="modal__header"> + <h2 class="font-showcase-font-name" style="width: 500px;">{{dbcapp.label}}</h2> + </div> + <div class="divider-container"> + <hr> + </div> + <div class="modal__content"> + <div class="fn-ebz-container"> + DCAE Location:<sup><b>*</b></sup> + <br/> + <select class="fn-ebz-select dbcselect" ng-model="dbcapp.editClient.dcaeLocationName" ng-options="d for d in dbcapp.dcaeList"></select> + </div> + <br/> + <div class="fn-ebz-container" > + Client Role:<sup><b>*</b></sup> + <br/> + <input type="text" class="fn-ebz-text" ng-model="dbcapp.editClient.clientRole" /> + </div> + <br/> + <div class="fn-ebz-container" > + Action:<sup><b>*</b></sup> + <br/> + <span style="padding-left: 15px;"> Pub</span> + <input name="pub" type="checkbox" att-checkbox ng-model="dbcapp.clientactionbox[0]" /> + + <span style="padding-left: 15px;"> Sub</span> + <input name="sub" type="checkbox" att-checkbox ng-model="dbcapp.clientactionbox[1]" /> + + <span style="padding-left: 15px;"> View</span> + <input name="view" type="checkbox" att-checkbox ng-model="dbcapp.clientactionbox[2]" /> + </div> + </div> + + <div class="modal__footer"> + <button class="button button--primary button--small" + href="javascript:void(0)" + ng-click="dbcapp.saveClient(dbcapp.editClient);"> + Save + </button> + <button class="button button--primary button--small" + href="javascript:void(0)" + ng-click="dbcapp.close()"> + Close + </button> + </div> + </div> +</script> diff --git a/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/messagerouter/mr_topic_client_list_popup_template.html b/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/messagerouter/mr_topic_client_list_popup_template.html new file mode 100644 index 0000000..4976138 --- /dev/null +++ b/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/messagerouter/mr_topic_client_list_popup_template.html @@ -0,0 +1,74 @@ +<!-- + ================================================================================ + DCAE DMaaP Bus Controller Web Application + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ================================================================================ + --> +<script type="text/ng-template" id="topic_client_list_popup.html"> + <div class="modal__informative font-showcase" style="width:900px;"> + + <div class="modal__header"> + <h2 class="font-showcase-font-name" style="width: 900px;">{{dbcapp.label}}</h2> + </div> + <div class="divider-container"> + <hr> + </div> + <div class="modal__content"> + <div class="fn-ebz-container"> + + <table att-table + id="clients-table" + table-data="dbcapp.showTopic.clients" + search-string="dbcapp.searchString" + view-per-page="dbcapp.viewPerPageIgnored" + current-page="dbcapp.currentPageIgnored" + total-page="dbcapp.totalPageIgnored"> + + <thead att-table-row type="header"> + <tr> + <th att-table-header sortable="false">MR Client ID</th> + <th att-table-header sortable="false">DCAE Location Name</th> + <th att-table-header sortable="false">Action</th> + <th att-table-header sortable="false">Client Role</th> + <th att-table-header sortable="false">Last Modified</th> + <th att-table-header sortable="false">Status</th> + </tr> + </thead> + <tbody att-table-row type="body" row-repeat="rowData in dbcapp.showTopic.clients"> + <tr> + <td att-table-body ng-bind="rowData.mrClientId" /> + <td att-table-body ng-bind="rowData.dcaeLocationName" /> + <td att-table-body ng-bind="rowData.action"/> + <td att-table-body ng-bind="rowData.clientRole"/> + <td att-table-body ng-bind="rowData.lastMod" /> + <td att-table-body ng-bind="rowData.status" /> + </tr> + </tbody> + </table> + + </div> + + <div class="modal__footer"> + <button class="button button--primary button--small" + href="javascript:void(0)" + ng-click="dbcapp.close()"> + Close + </button> + </div> + + </div> + +</script> diff --git a/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/messagerouter/mr_topic_list.html b/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/messagerouter/mr_topic_list.html new file mode 100644 index 0000000..4ed4726 --- /dev/null +++ b/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/messagerouter/mr_topic_list.html @@ -0,0 +1,154 @@ +<!-- + ================================================================================ + DCAE DMaaP Bus Controller Web Application + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ================================================================================ + --> +<!-- controller is specified by route provider --> + +<div class="pageTitle"> + <h3 class="heading3" style="margin-top: 10px; margin-bottom: 10px;">Message Router Topics</h3> +</div> + +<div id="button-search-row"> + <button att-button + type="submit" + ng-click="dbcapp.addTopicModalPopup();" + btn-type="primary" + size="small"> + Add Topic... + </button> + <div style="float:right;"> + <div class="form-field form-field__small"> + <input class="fn-ebz-text.search" + type="text" + placeholder="Search topics" + ng-model="dbcapp.searchString"/> + <i class="ion-search" style="position:relative;line-height:10px;top:-25px;right:-190px"></i> + </div> + </div> + </div> + +<!-- show progress indicator --> +<div ng-show="dbcapp.isDataLoading"> + <div att-loading></div> +</div> + +<div ng-hide="dbcapp.isDataLoading"> + + <div ng-show="dbcapp.isRequestFailed"> + <span class="errorMessageText">{{dbcapp.errMsg}}</span> + </div> + + <div ng-hide="dbcapp.isRequestFailed"> + Access Profile <strong>{{dbcapp.profileName}}</strong>, DMaaP Name <strong>{{dbcapp.dmaapName}}</strong> + </div> + + <table att-table + id="topics-table" + table-data="dbcapp.tableData" + search-string="dbcapp.searchString" + view-per-page="dbcapp.viewPerPageIgnored" + current-page="dbcapp.currentPageIgnored" + total-page="dbcapp.totalPageIgnored"> + + <thead att-table-row type="header"> + <tr> + <th att-table-header sortable="true" key="fqtn">Qualified Name</th> + <th att-table-header sortable="true" key="topicName">Name</th> + <th att-table-header sortable="true" key="topicDescription">Description</th> + <!-- model differs from swagger + <th att-table-header sortable="true" key="tnxEnabled">Tnx</th> + --> + <th att-table-header sortable="true" key="owner">Owner</th> + <th att-table-header sortable="true" key="status">Status</th> + <th att-table-header sortable="false">Cl</th> + <th att-table-header sortable="false">Add</th> + <th att-table-header sortable="false">Delete</th> + </tr> + </thead> + <tbody att-table-row type="body" row-repeat="rowData in dbcapp.tableData"> + <tr> + <td att-table-body + ng-bind="rowData.fqtn"/> + <td att-table-body + ng-bind="rowData.topicName"/> + <td att-table-body + ng-bind="rowData.topicDescription"/> + <!-- model differs from swagger + <td att-table-body + ng-click="dbcapp.editTopicModalPopup(rowData)"/> + <input type="checkbox" att-checkbox + disabled="true" + ng-model="rowData.tnxEnabled" + ng-checked="rowData.tnxEnabled" + value="rowData.tnxEnabled"/> + --> + <td att-table-body + ng-bind="rowData.owner"/> + <td att-table-body + ng-bind="rowData.status"/> + <td att-table-body + ng-bind="rowData.clients.length" + ng-click="dbcapp.showTopicClientsModalPopup(rowData)"> + </td> + <td att-table-body> + <div ng-click="dbcapp.addTopicClientModalPopup(rowData);" style="font-size:20px;"> + <a href="" class="ion-plus"></a> + </div> + </td> + <td att-table-body> + <div ng-click="dbcapp.deleteTopicModalPopup(rowData);" style="font-size:20px;"> + <a href="" class="ion-trash-b"></a> + </div> + </td> + </tr> + </tbody> + </table> + + <div class="fn-ebz-container" > + Page Number: + <select class="fn-ebz-select dbcpageselect" + name="currentPageNumSelector" + ng-model="dbcapp.currentPageNum" + ng-change="dbcapp.loadTable()"> + <option ng-repeat="p in dbcapp.buildArraySizeN(dbcapp.totalPages) track by $index" + value="{{$index+1}}" + ng-selected="{{$index+1}}=={{dbcapp.currentPageNum}}"> + {{$index+1}} + </option> + </select> + Page Count: + <input class="fn-ebz-text dbcpagenum" + type="text" + ng-model="dbcapp.totalPages" + readonly="true"> + Rows per Page: + <select class="fn-ebz-select dbcpageselect" + name="viewPerPageSelector" + ng-model="dbcapp.viewPerPage" + ng-change="dbcapp.loadTable()" + style="height: 30px;"> + <option ng-repeat="v in dbcapp.viewPerPageOptions" + value="{{v.value}}" + ng-selected="{{v.value}}=={{dbcapp.viewPerPage}}"> + {{v.value}} + </option> + </select> + </div> + +</div> +<!-- loading --> diff --git a/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/messagerouter/mr_topic_popup_template.html b/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/messagerouter/mr_topic_popup_template.html new file mode 100644 index 0000000..b83c698 --- /dev/null +++ b/dcae_dmaapbc_webapp/src/main/webapp/app/dbcapp/messagerouter/mr_topic_popup_template.html @@ -0,0 +1,62 @@ +<!-- + ================================================================================ + DCAE DMaaP Bus Controller Web Application + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ================================================================================ + --> +<script type="text/ng-template" id="edit_topic_popup.html"> + <div class="modal__informative font-showcase" style="width:400px;"> + <div class="modal__header"> + <h2 class="font-showcase-font-name" style="width: 500px;">{{dbcapp.label}}</h2> + </div> + <div class="divider-container"> + <hr> + </div> + <div class="modal__content"> + <div class="fn-ebz-container" > + Name:<sup><b>*</b></sup> + <br/> + <input type="text" class="fn-ebz-text" ng-model="dbcapp.editTopic.topicName" /> + </div> + <br/> + <div class="fn-ebz-container" > + Description:<sup><b>*</b></sup> + <br/> + <input type="text" class="fn-ebz-text" ng-model="dbcapp.editTopic.topicDescription" /> + </div> + <!-- model differs from swagger + <br/> + <div class="fn-ebz-container" > + Tnx Enabled: + <br/> + <input type="checkbox" att-checkbox ng-model="dbcapp.editTopic.tnxEnabled" /> + </div> + --> + </div> + <div class="modal__footer"> + <button class="button button--primary button--small" + href="javascript:void(0)" + ng-click="dbcapp.saveTopic(dbcapp.editTopic);"> + Save + </button> + <button class="button button--primary button--small" + href="javascript:void(0)" + ng-click="dbcapp.close()"> + Close + </button> + </div> + </div> +</script> |