diff --git a/README.md b/README.md index e69de29..9588538 100644 --- a/README.md +++ b/README.md @@ -0,0 +1,77 @@ + + + Copyright © 2015-2016 [Open Baton](http://openbaton.org). + Licensed under [Apache v2 License](http://www.apache.org/licenses/LICENSE-2.0). + +# Dashboard +Dashboard is a component of the Openbaton NFVO, which adds the Web GUI to it. It works as web pages provided by the inbuilt server of the NFVO. + +# Technical Requirements +1. NFVO +2. Webbrowser capable of interpeting HTML, Javascript and CSS + +# How to install Dashboard + +The project iself does not require any installation. However, if you want to change the component inside your NFVO, you will need to copy the contents into the dashboard subfolder inside the NFVO folder or edit the one that you have already. After this, recompile NFVO in order for it to be built with the updated version. + +# How to use Dashboard + +In order to learn about GUI, please, refer to the [documentation][openbaton-doc-GUI] + + +# How to extend Dashboard + +You can add the pages to the GUI by simply adding them to the static resources folder of the component. + +# Issue tracker + +Issues and bug reports should be posted to the GitHub Issue Tracker of this project + +# What is Open Baton? + +OpenBaton is an open source project providing a comprehensive implementation of the ETSI Management and Orchestration (MANO) specification. + +Open Baton is a ETSI NFV MANO compliant framework. Open Baton was part of the OpenSDNCore (www.opensdncore.org) project started almost three years ago by Fraunhofer FOKUS with the objective of providing a compliant implementation of the ETSI NFV specification. + +Open Baton is easily extensible. It integrates with OpenStack, and provides a plugin mechanism for supporting additional VIM types. It supports Network Service management either using a generic VNFM or interoperating with VNF-specific VNFM. It uses different mechanisms (REST or PUB/SUB) for interoperating with the VNFMs. It integrates with additional components for the runtime management of a Network Service. For instance, it provides autoscaling and fault management based on monitoring information coming from the the monitoring system available at the NFVI level. + +# Source Code and documentation + +The Source Code of the other Open Baton projects can be found [here][openbaton-github] and the documentation can be found [here][openbaton-doc] . + +# News and Website + +Check the [Open Baton Website][openbaton] +Follow us on Twitter @[openbaton][openbaton-twitter]. + +# Licensing and distribution +Copyright [2015-2016] Open Baton project + +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. + +# Support +The Open Baton project provides community support through the Open Baton Public Mailing List and through StackOverflow using the tags openbaton. + +# Supported by + + +[fokus-logo]: https://raw.githubusercontent.com/openbaton/openbaton.github.io/master/images/fokus.png +[openbaton]: http://openbaton.org +[openbaton-doc]: http://openbaton.org/documentation +[openbaton-doc-GUI]: http://openbaton.github.io/documentation/nfvo-how-to-use-gui/ +[openbaton-github]: http://github.org/openbaton +[openbaton-logo]: https://raw.githubusercontent.com/openbaton/openbaton.github.io/master/images/openBaton.png +[openbaton-mail]: mailto:users@openbaton.org +[openbaton-twitter]: https://twitter.com/openbaton +[tub-logo]: https://raw.githubusercontent.com/openbaton/openbaton.github.io/master/images/tu.png diff --git a/src/main/java/org/openbaton/nfvo/gui/WebConfig.java b/src/main/java/org/openbaton/nfvo/gui/WebConfig.java index 9182038..2b7e999 100644 --- a/src/main/java/org/openbaton/nfvo/gui/WebConfig.java +++ b/src/main/java/org/openbaton/nfvo/gui/WebConfig.java @@ -2,9 +2,5 @@ import org.springframework.stereotype.Controller; - @Controller -class WebConfig { - - -} +class WebConfig {} diff --git a/src/main/resources/static/index.html b/src/main/resources/static/index.html index 56b2dfc..d9a46dd 100644 --- a/src/main/resources/static/index.html +++ b/src/main/resources/static/index.html @@ -54,4 +54,4 @@ - \ No newline at end of file + diff --git a/src/main/resources/static/js/app.js b/src/main/resources/static/js/app.js index 7190ba0..e296345 100644 --- a/src/main/resources/static/js/app.js +++ b/src/main/resources/static/js/app.js @@ -138,6 +138,10 @@ angular.module('app', ['ngRoute', 'ngSanitize', 'ui.bootstrap', 'ngCookies', 'an templateUrl: 'pages/copyright.html', controller: '' }). + when('/keypairs', { + templateUrl: 'pages/keypairs/keypairs.html', + controller: 'keyPairsCtrl' + }). otherwise({ // redirectTo: '/' }); @@ -180,4 +184,4 @@ angular.module('app').controller('MenuCtrl', function ($scope, http) { -}); \ No newline at end of file +}); diff --git a/src/main/resources/static/js/controllers/indexController.js b/src/main/resources/static/js/controllers/indexController.js index 06a228c..cf54080 100644 --- a/src/main/resources/static/js/controllers/indexController.js +++ b/src/main/resources/static/js/controllers/indexController.js @@ -9,7 +9,7 @@ var app = angular.module('app'); app.controller('LoginController', function ($scope, AuthService, Session, $rootScope, $location, $cookieStore, $http, $window) { $scope.currentUser = null; //$scope.URL = 'http://lore:8080'; - //$scope.URL = 'http://192.168.161.6:8080'; + $scope.URL = ''; $scope.credential = { "username": '', @@ -102,12 +102,23 @@ app.controller('LoginController', function ($scope, AuthService, Session, $rootS app.controller('IndexCtrl', function ($scope, $compile, $routeParams, serviceAPI, $interval, $cookieStore, $location, AuthService, http, $rootScope, $window) { $('#side-menu').metisMenu(); - + $scope.adminRole = "ADMIN"; + $scope.superProject = "*"; var url = $cookieStore.get('URL') + "/api/v1"; $scope.config = {}; - - + $scope.userLogged = {}; + function loadCurrentUser() { + http.get(url +'/users/current') + .success(function (response) { + console.log(response); + $scope.userLogged = response + }) + .error(function (response, status) { + showError(status, response); + }); + }; + loadCurrentUser(); function getConfig() { http.get(url + '/configurations/') @@ -161,6 +172,7 @@ app.controller('IndexCtrl', function ($scope, $compile, $routeParams, serviceAPI }); $scope.numberUnits = units; }); + } @@ -173,6 +185,7 @@ app.controller('IndexCtrl', function ($scope, $compile, $routeParams, serviceAPI $cookieStore.put('project', newValue); loadNumbers(); getConfig(); + loadCurrentUser(); } }); @@ -273,5 +286,16 @@ app.controller('IndexCtrl', function ($scope, $compile, $routeParams, serviceAPI }; + $scope.admin = function() { + //console.log($scope.userLogged); + + if($scope.userLogged.roles[0].project === $scope.superProject && $scope.userLogged.roles[0].role === $scope.adminRole) { + return true; + } else { + return false; + } + }; + + }); diff --git a/src/main/resources/static/js/controllers/keyPairsController.js b/src/main/resources/static/js/controllers/keyPairsController.js new file mode 100644 index 0000000..fb75dfc --- /dev/null +++ b/src/main/resources/static/js/controllers/keyPairsController.js @@ -0,0 +1,105 @@ +var app = angular.module('app'); +app.controller('keyPairsCtrl', function ($scope, serviceAPI, $routeParams, http, $cookieStore, AuthService, $window) { + + var url = $cookieStore.get('URL') + "/api/v1/keys/"; + var urlprojects = $cookieStore.get('URL') + "/api/v1/projects/"; + $scope.keyName = ""; + $scope.pubKey = ""; + $scope.keypairs = ""; + $scope.newKey = {name:"", publicKey:""}; + $scope.alerts = []; + loadTable(); + function loadTable() { + + //console.log($routeParams.userId); + http.get(url) + .success(function (response) { + $scope.keypairs = response; + //console.log($scope.users.length); + + console.log($scope.keypairs); + }) + .error(function (data, status) { + showError(data, status); + }); + + + } + $scope.closeAlert = function (index) { + $scope.alerts.splice(index, 1); + }; + + $scope.save = function () { + //console.log($scope.projectObj); + + $scope.newKey.name = $scope.keyName; + $scope.newKey.publicKey = $scope.pubKey; + console.log($scope.newKey); + http.post(url, $scope.newKey) + .success(function (response) { + showOk('Key pair: ' + $scope.keyName + ' saved.'); + setTimeout(loadTable(),250); + $scope.keyName = ""; + $scope.pubKey = ""; + //location.reload(); + }) + .error(function (response, status) { + showError(response, status); + }); + }; + $scope.delete = function (data) { + http.delete(url + data.id) + .success(function (response) { + showOk('Key with name: ' + data.name + ' deleted.'); + setTimeout(loadTable(), 250); + + }) + .error(function (response, status) { + showError(response, status); + }); + }; + $scope.createKeyName = ""; + $scope.createKey = function () { + //console.log($scope.projectObj); + + + + http.postPlain(url + 'generate', $scope.createKeyName) + .success(function (response) { + showOk('Key: ' + $scope.createKeyName + ' generated.'); + setTimeout(loadTable(),250); + //console.log(response); + var key = document.createElement("a"); + key.download = $scope.createKeyName + '.pem'; + key.href = 'data:application/x-pem-file,' + encodeURIComponent(response); + document.body.appendChild(key); + key.click() + document.body.removeChild(key); + delete key; + //document.location = 'title: key.pem, data:application/x-pem-file,' + + // encodeURIComponent(response); + //location.reload(); + }) + .error(function (response, status) { + showError(response, status); + }); + }; + + function showError(data, status) { + $scope.alerts.push({ + type: 'danger', + msg: 'ERROR: HTTP status: ' + status + ' response data : ' + JSON.stringify(data) + }); + $('.modal').modal('hide'); + if (status === 401) { + //console.log(status + ' Status unauthorized') + AuthService.logout(); + } + } + + function showOk(msg) { + $scope.alerts.push({type: 'success', msg: msg}); + loadTable(); + $('.modal').modal('hide'); + } +}); diff --git a/src/main/resources/static/js/controllers/nsdController.js b/src/main/resources/static/js/controllers/nsdController.js index 33eda26..49b85d8 100644 --- a/src/main/resources/static/js/controllers/nsdController.js +++ b/src/main/resources/static/js/controllers/nsdController.js @@ -8,6 +8,7 @@ var app = angular.module('app').controller('NsdCtrl', function ($scope, $compile var urlVNFD = baseURL + '/vnf-descriptors/'; loadTable(); + loadKeys(); $.fn.bootstrapSwitch.defaults.size = 'mini'; @@ -29,6 +30,32 @@ var app = angular.module('app').controller('NsdCtrl', function ($scope, $compile $scope.file = ''; $scope.alerts = []; $scope.vimInstances = []; + $scope.keys = {}; + $scope.launchKeys = []; + $scope.launchObj = {"keys":[]}; + function loadKeys() { + + //console.log($routeParams.userId); + http.get(baseURL + '/keys') + .success(function (response) { + $scope.keys = response; + //console.log($scope.users.length); + + console.log($scope.keys); + }) + .error(function (data, status) { + showError(data, status); + }); + + + } + + $scope.addLaunchKey = function() { + var key = ""; + $scope.launchKeys.push(key); + } + + http.get(urlVim) .success(function (response, status) { $scope.vimInstances = response; @@ -342,18 +369,37 @@ var app = angular.module('app').controller('NsdCtrl', function ($scope, $compile $scope.launchOption = function (data) { $scope.nsdToSend = data; //$('#madalLaunch').modal('show'); - $scope.launch(); + }; $scope.launch = function () { //console.log($scope.nsdToSend); - http.post(urlRecord + $scope.nsdToSend.id) + $scope.launchObj.keys = $scope.launchKeys; + console.log($scope.launchObj); + http.post(urlRecord + $scope.nsdToSend.id, $scope.launchObj) .success(function (response) { showOk("Created Network Service Record from Descriptor with id: \" + $scope.nsdToSend.id + "<\/a>"); }) .error(function (data, status) { showError(status, data); }); + $scope.launchKeys = []; + $scope.launchObj = {"keys":[]}; + }; + + $scope.launchWithoutkey = function () { + console.log("Launching without key"); + + + http.post(urlRecord + $scope.nsdToSend.id, empty = {}) + .success(function (response) { + showOk("Created Network Service Record from Descriptor with id: \" + $scope.nsdToSend.id + "<\/a>"); + }) + .error(function (data, status) { + showError(status, data); + }); + $scope.launchKeys = []; + $scope.launchObj = {"keys":[]}; }; $scope.Jsplumb = function () { @@ -489,4 +535,3 @@ var app = angular.module('app').controller('NsdCtrl', function ($scope, $compile } }); - diff --git a/src/main/resources/static/js/controllers/nsrController.js b/src/main/resources/static/js/controllers/nsrController.js index 8bb35a3..d5f7310 100644 --- a/src/main/resources/static/js/controllers/nsrController.js +++ b/src/main/resources/static/js/controllers/nsrController.js @@ -307,7 +307,7 @@ var app = angular.module('app').controller('NsrCtrl', function ($scope, $http, $ http.delete(url + data.id) .success(function (response) { showOk('Network Service Record deleted!'); - loadTable(); + window.setTimeout(loadTable, 250); }) .error(function (data, status) { showError(status, data); @@ -406,7 +406,7 @@ var app = angular.module('app').controller('NsrCtrl', function ($scope, $http, $ http.get(url) .success(function (response, status) { $scope.nsrecords = response; - //console.log(response); + console.log(response); }) .error(function (data, status) { showError(status, data); @@ -431,4 +431,3 @@ var app = angular.module('app').controller('NsrCtrl', function ($scope, $http, $ }); - diff --git a/src/main/resources/static/js/controllers/projectController.js b/src/main/resources/static/js/controllers/projectController.js index ff4a980..2763a8d 100644 --- a/src/main/resources/static/js/controllers/projectController.js +++ b/src/main/resources/static/js/controllers/projectController.js @@ -11,7 +11,8 @@ app.controller('ProjectCtrl', function ($scope, serviceAPI, $routeParams, http, loadTable(); $scope.projectObj = { - 'name': 'projectName' + 'name': '', + 'description': '' }; /* -- multiple delete functions Start -- */ @@ -40,6 +41,9 @@ app.controller('ProjectCtrl', function ($scope, serviceAPI, $routeParams, http, ////console.log(newValue.checkbox); ////console.log($scope.selection.ids); angular.forEach($scope.selection.ids, function (value, k) { + if (k === $scope.defaultID) { + return; + } $scope.selection.ids[k] = newValue.checkbox; }); //console.log($scope.selection.ids); @@ -71,11 +75,11 @@ app.controller('ProjectCtrl', function ($scope, serviceAPI, $routeParams, http, /* -- multiple delete functions END -- */ - $scope.types = ['REST', 'RABBIT', 'JMS']; + $scope.types = ['REST', 'RABBIT']; $scope.deleteEvent = function (data) { http.delete(url + data.id) .success(function (response) { - showOk('Event: ' + data.name + ' deleted.'); + showOk('Project: ' + data.name + ' deleted.'); loadTable(); location.reload(); }) @@ -95,17 +99,28 @@ app.controller('ProjectCtrl', function ($scope, serviceAPI, $routeParams, http, .success(function (response) { showOk('Project: ' + $scope.projectObj.name + ' saved.'); loadTable(); - location.reload(); + $scope.projectObj = { + 'name': '', + 'description': '' + }; + //location.reload(); }) .error(function (response, status) { showError(response, status); }); }; + $scope.defaultID = ""; function loadTable() { http.get(url) .success(function (response) { $scope.projects = response; //console.log(response); + for (i = 0; i < $scope.projects.length; i++) { + if ($scope.projects[i].name === 'default') { + $scope.defaultID = $scope.projects[i].id; + } + } + //console.log($scope.defaultID); }) .error(function (data, status) { showError(data, status); @@ -130,4 +145,13 @@ app.controller('ProjectCtrl', function ($scope, serviceAPI, $routeParams, http, $('.modal').modal('hide'); } + $scope.admin = function() { + //console.log($cookieStore.get('userName')); + if($cookieStore.get('userName') === 'admin') { + return true; + } else { + return false; + } + }; + }); diff --git a/src/main/resources/static/js/controllers/userController.js b/src/main/resources/static/js/controllers/userController.js index 5abfbe9..b7bb3a9 100644 --- a/src/main/resources/static/js/controllers/userController.js +++ b/src/main/resources/static/js/controllers/userController.js @@ -3,9 +3,7 @@ app.controller('UserCtrl', function ($scope, serviceAPI, $routeParams, http, $co var url = $cookieStore.get('URL') + "/api/v1/users/"; var urlprojects = $cookieStore.get('URL') + "/api/v1/projects/"; - //$scope.URL = 'http://lore:8080'; - //var url = "http://lore:8080/api/v1/users/"; - //var urlprojects = "http://lore:8080/api/v1/projects/"; + $scope.alerts = []; $scope.closeAlert = function (index) { $scope.alerts.splice(index, 1); @@ -13,28 +11,31 @@ app.controller('UserCtrl', function ($scope, serviceAPI, $routeParams, http, $co $scope.roles = [ 'GUEST', - 'ADMIN', - 'OB_ADMIN' + 'USER' ]; loadTable(); - - $scope.roleAdd = { - "role": "GUEST", - "project": "*" - }; + $scope.newpassword = ""; $scope.addRole = function() { var newRole = { - "role": "GUEST", - "project": "*" + "role": "USER", + "project": "" }; $scope.userObj.roles.push(newRole); }; + $scope.addRoleUpdate = function() { + var newRole = { + "role": "USER", + "project": "" + }; + $scope.userUpdate.roles.push(newRole); + }; + $scope.currentUser = {}; - $scope.loadCurrentUser = function(){ + loadCurrentUser = function(){ http.get(url +'current') .success(function (response) { - console.log(response); + //console.log(response); $scope.currentUser= response }) .error(function (response, status) { @@ -46,7 +47,7 @@ app.controller('UserCtrl', function ($scope, serviceAPI, $routeParams, http, $co .success(function (response) { //console.log(response); $scope.projects = response; - $scope.projects.push({name: '*'}); + //$scope.projects.push({name: '*'}); }) .error(function (response, status) { showError(response, status); @@ -54,17 +55,18 @@ app.controller('UserCtrl', function ($scope, serviceAPI, $routeParams, http, $co $scope.userObj = { - "username": "guest", + "username": "", "password": "", + "email": "", "enabled": true, "roles": [ - { - "role": "GUEST", - "project": "*" - } + ] }; - + $scope.adminRole = { + "role":"ADMIN", + "project":"*" + }; /* -- multiple delete functions Start -- */ $scope.multipleDeleteReq = function () { @@ -77,7 +79,7 @@ app.controller('UserCtrl', function ($scope, serviceAPI, $routeParams, http, $co //console.log(ids); http.post(url + 'multipledelete', ids) .success(function (response) { - showOk('user: ' + ids.toString() + ' deleted.'); + showOk('User: ' + ids.toString() + ' deleted.'); loadTable(); }) .error(function (response, status) { @@ -91,9 +93,11 @@ app.controller('UserCtrl', function ($scope, serviceAPI, $routeParams, http, $co ////console.log(newValue.checkbox); ////console.log($scope.selection.ids); angular.forEach($scope.selection.ids, function (value, k) { + if (k === $scope.currentUser.id) { + return; + } $scope.selection.ids[k] = newValue.checkbox; }); - //console.log($scope.selection.ids); }, true); $scope.$watch('selection', function (newValue, oldValue) { @@ -116,11 +120,13 @@ app.controller('UserCtrl', function ($scope, serviceAPI, $routeParams, http, $co }, true); $scope.multipleDelete = true; + $scope.userUpdate = ""; $scope.selection = {}; $scope.selection.ids = {}; - /* -- multiple delete functions END -- */ + /* -- multiple delete functions END -- */ + $scope.makeAdmin = false; $scope.deleteUser = function (data) { http.delete(url + data.id) @@ -138,17 +144,73 @@ app.controller('UserCtrl', function ($scope, serviceAPI, $routeParams, http, $co }; - $scope.save = function () { + $scope.save = function() { + //console.log("Saving"); + if ($scope.makeAdmin) { + $scope.saveAsAdmin(); + } else { + $scope.saveAsUser(); + } + $scope.makeAdmin = false; + }; + + $scope.updateSave = function() { + if ($scope.makeAdmin) { + updateAsAdmin(); + } else { + updateAsUser(); + } + $scope.makeAdmin = false; + }; + + + $scope.saveAsUser = function () { //console.log($scope.userObj); + if ($scope.userObj.password !== $scope.newpassword) { + alert("New passwords are not the same"); + return; + } http.post(url, $scope.userObj) .success(function (response) { - showOk('Project: ' + $scope.userObj.name + ' saved.'); + showOk('User: ' + $scope.userObj.username + ' saved.'); loadTable(); }) .error(function (response, status) { showError(response, status); }); }; + + $scope.update = function(data) { + $scope.userUpdate = JSON.parse(JSON.stringify(data));; + //console.log(data); + }; + + //Save as admin function + $scope.adminObj = {}; + $scope.saveAsAdmin = function() { + //console.log("Adding admin user"); + if ($scope.userObj.password !== $scope.newpassword) { + alert("New passwords are not the same"); + return; + } + $scope.adminObj.username = $scope.userObj.username; + $scope.adminObj.password = $scope.userObj.password; + $scope.adminObj.email = $scope.userObj.email; + $scope.adminObj.enabled = $scope.userObj.enabled; + $scope.adminObj.roles = []; + $scope.adminObj.roles.push($scope.adminRole); + + http.post(url, $scope.adminObj) + .success(function (response) { + showOk('User: ' + $scope.adminObj.username + ' saved.'); + loadTable(); + }) + .error(function (response, status) { + showError(response, status); + }); + $scope.adminObj = {}; + }; + function loadTable() { //console.log($routeParams.userId); if (!angular.isUndefined($routeParams.userId)) @@ -165,7 +227,14 @@ app.controller('UserCtrl', function ($scope, serviceAPI, $routeParams, http, $co http.get(url) .success(function (response) { $scope.users = response; - //console.log(response); + //console.log($scope.users.length); + for (i = 0; i < $scope.users.length; i++) { + if ($scope.users[i].username === 'admin') { + $scope.adminID = $scope.users[i].id; + } + } + loadCurrentUser(); + //console.log($scope.currentUser); }) .error(function (data, status) { showError(data, status); @@ -193,5 +262,70 @@ app.controller('UserCtrl', function ($scope, serviceAPI, $routeParams, http, $co loadTable(); $('.modal').modal('hide'); } + function updateAsUser() { + //console.log($scope.userUpdate); + /*if ($scope.userUpdate.password !== $scope.newpassword) { + alert("New passwords are not the same"); + return; + }*/ + updateObj = {}; + updateObj.username = $scope.userUpdate.username; + //updateObj.password = $scope.userUpdate.password; + updateObj.email = $scope.userUpdate.email; + updateObj.enabled = $scope.userUpdate.enabled; + updateObj.id = $scope.userUpdate.id; + updateObj.roles = []; + for (i = 0; i < $scope.userUpdate.roles.length; i++) { + var newRole = { + "id": $scope.userUpdate.roles[i].id, + "role": $scope.userUpdate.roles[i].role, + "project": $scope.userUpdate.roles[i].project + }; + updateObj.roles.push(newRole); + } + //console.log("Copied"); + //console.log(updateObj); + http.put(url + updateObj.username, updateObj) + .success(function (response) { + showOk('User: ' + $scope.userObj.username + ' updated.'); + loadTable(); + }) + .error(function (response, status) { + showError(response, status); + }); + delete updateObj; + delete $scope.userUpdate; + }; + function updateAsAdmin() { + //console.log($scope.userUpdate); + /*if ($scope.userUpdate.password !== $scope.newpassword) { + alert("New passwords are not the same"); + return; + }*/ + updateObj = {}; + updateObj.username = $scope.userUpdate.username; + updateObj.id = $scope.userUpdate.id; + //updateObj.password = $scope.userUpdate.password; + updateObj.email = $scope.userUpdate.email; + updateObj.enabled = $scope.userUpdate.enabled; + updateObj.roles = []; + updateObj.roles.push($scope.adminRole); + //console.log("Copied"); + //console.log(updateObj); + http.put(url + updateObj.username, updateObj) + .success(function (response) { + showOk('User: ' + $scope.userObj.username + ' updated.'); + loadTable(); + }) + .error(function (response, status) { + showError(response, status); + }); + delete updateObj; + delete $scope.userUpdate; + }; + $scope.update = function(data) { + $scope.userUpdate = JSON.parse(JSON.stringify(data));; + //console.log(data); + }; }); diff --git a/src/main/resources/static/js/main.js b/src/main/resources/static/js/main.js index 629c852..eb7942f 100644 --- a/src/main/resources/static/js/main.js +++ b/src/main/resources/static/js/main.js @@ -37,7 +37,8 @@ require({ indexController: "controllers/indexController", vnfcomponentController: "controllers/vnfcomponentController", vnfmanagerController: "controllers/vnfmanagerController", - vnfdController: "controllers/vnfdController" + vnfdController: "controllers/vnfdController", + keyPairsController: "controllers/keyPairsController" }, shim: { jquery: { @@ -150,8 +151,12 @@ require({ dropzone:{ deps: ['jquery'], exports: 'Dropzone' + }, + keyPairsController: { + deps: ['app', 'servicesServices', 'httpService', 'angular_cookies','authService'] } + } }), require([ 'require', @@ -172,7 +177,8 @@ require({ 'projectController', 'userController', 'nsrController', - 'vimInstanceController' + 'vimInstanceController', + 'keyPairsController' ], function (require) { return require(['bootstrap']); -}); \ No newline at end of file +}); diff --git a/src/main/resources/static/js/services/httpService.js b/src/main/resources/static/js/services/httpService.js index 3d79e5a..325a574 100644 --- a/src/main/resources/static/js/services/httpService.js +++ b/src/main/resources/static/js/services/httpService.js @@ -54,6 +54,20 @@ angular.module('app') headers: customHeaders }); + }; + http.postPlain = function (url, data) { + customHeaders['project-id'] = $cookieStore.get('project').id; + customHeaders['Accept'] = 'text/plain'; + customHeaders['Content-type'] = 'text/plain'; + //console.log(data); + $('#modalSend').modal('show'); + return $http({ + url: url, + method: 'POST', + data: data, + headers: customHeaders + }); + }; http.postLog = function (url) { customHeaders['project-id'] = $cookieStore.get('project').id; diff --git a/src/main/resources/static/menu.html b/src/main/resources/static/menu.html index 51f55f5..e072ff9 100644 --- a/src/main/resources/static/menu.html +++ b/src/main/resources/static/menu.html @@ -75,6 +75,9 @@
  • VNF Packages
  • +
  • + Key Pairs +
  • @@ -102,8 +105,8 @@ -
  • - Identity + Identity