diff --git a/v2/src/app/appDev.js b/v2/src/app/appDev.js index 27caa01..c171001 100644 --- a/v2/src/app/appDev.js +++ b/v2/src/app/appDev.js @@ -290,23 +290,17 @@ compassAppDev.run(function($httpBackend, settings, $http) { var switches = [{ "id": 1, "ip": "172.29.8.40", - "filters": { - "ports": "1-10;20-51" - }, + "filters": "allow ports 1-10,20-51", "state": "under_mointoring" }, { "id": 2, "ip": "172.29.8.41", - "filters": { - "ports": "1-100" - }, + "filters": "deny ports 1-100", "state": "under_mointoring" }, { "id": 3, "ip": "172.29.8.42", - "filters": { - "ports": "1-100" - }, + "filters": "allow ports 1-50", "state": "under_mointoring" }]; return [200, switches, {}]; @@ -325,14 +319,18 @@ compassAppDev.run(function($httpBackend, settings, $http) { var sw = { "id": id, "ip": "172.29.8.40", - "filters": { - "ports": "1-10;20-51" - }, + "filters": "allow ports 1-10,20-51", "state": state }; return [200, sw, {}]; }); + $httpBackend.whenPUT(/\.*\/switches\/([0-9]|[1-9][0-9])$/).respond(function(method, url, data) { + console.log(method, url, data); + var sw = JSON.parse(data); + return [200, sw, {}]; + }); + $httpBackend.whenPOST(settings.apiUrlBase + '/switches').respond(function(method, url, data) { console.log(method, url, data); var switchData = JSON.parse(data); @@ -509,23 +507,23 @@ compassAppDev.run(function($httpBackend, settings, $http) { "user_id": 1, "action": "Created New User", "timestamp": "2012-12-30 12:22:00" - }, { + }, { "user_id": 1, "action": "Modified Admin Priviledges", "timestamp": "2013-03-25 09:10:00" - }, { + }, { "user_id": 3, "action": "Test Cluster", "timestamp": "2014-06-19 23:32:00" - }, { + }, { "user_id": 3, "action": "Deleted User", "timestamp": "2014-06-20 09:10:00" - }, { + }, { "user_id": 2, "action": "Deleted Cluster", "timestamp": "2014-07-26 16:22:00" - }, { + }, { "user_id": 2, "action": "Created New Cluster", "timestamp": "2014-08-22 14:22:00" @@ -1004,4 +1002,4 @@ compassAppDev.run(function($httpBackend, settings, $http) { var deleteHost = {}; return [200, deleteHost, {}]; }) -}); +}); \ No newline at end of file diff --git a/v2/src/app/server/server.js b/v2/src/app/server/server.js index 27cc493..dd47c0a 100644 --- a/v2/src/app/server/server.js +++ b/v2/src/app/server/server.js @@ -37,7 +37,7 @@ angular.module('compass.server', [ $scope.tableParams = new ngTableParams({ page: 1, // show first page - count: $scope.allservers.length // count per page + count: $scope.allservers.length + 1 // count per page }, { counts: [], // hide count-per-page box total: $scope.allservers.length, // length of data diff --git a/v2/src/app/services.js b/v2/src/app/services.js index 9b0cb4e..d229c3c 100644 --- a/v2/src/app/services.js +++ b/v2/src/app/services.js @@ -65,6 +65,11 @@ angular.module('compass.services', []) this.postSwitches = function(sw) { return $http.post(settings.apiUrlBase + '/switches', angular.toJson(sw)); }; + + this.putSwitches = function(id, sw) { + return $http.put(settings.apiUrlBase + '/switches/' + id, angular.toJson(sw)); + }; + /* this.postSwitchFilters = function(filters) { return $http.post(settings.apiUrlBase + '/switch-filters', angular.toJson(filters)); diff --git a/v2/src/common/findservers/find-new-servers.tpl.html b/v2/src/common/findservers/find-new-servers.tpl.html index 2438121..d851345 100644 --- a/v2/src/common/findservers/find-new-servers.tpl.html +++ b/v2/src/common/findservers/find-new-servers.tpl.html @@ -31,9 +31,9 @@