Skip to content

Commit

Permalink
Merge pull request #10 from openbaton/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
ogozman committed Jul 18, 2016
2 parents e7b8ff5 + 7411ff2 commit d769770
Show file tree
Hide file tree
Showing 46 changed files with 4,132 additions and 1,461 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.project.openbaton.nfvo.gui;
package org.openbaton.nfvo.gui;

import org.springframework.stereotype.Controller;

Expand Down
38 changes: 5 additions & 33 deletions src/main/resources/static/descriptors/vnfd/vnfd.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,27 @@
"version":"0.1",
"name":"dummy1",
"type":"server",
"endpoint":"dummy",
"endpoint":"generic",
"vdu":[
{
"vm_image":[
"ubuntu-14.04-server-cloudimg-amd64-disk1"
],
"computation_requirement":"",
"virtual_memory_resource_element":"1024",
"virtual_network_bandwidth_resource":"1000000",
"scale_in_out":2,
"lifecycle_event":[
],
"vimInstanceName":"vim-instance",
"vdu_constraint":"",
"high_availability":"ACTIVE_PASSIVE",
"scale_in_out":3,
"vnfc":[
{
"connection_point":[
{
"floatingIp":"random",
"virtual_link_reference":"private"
}
]
}
],
"monitoring_parameter":[
"cpu_utilization"
"vimInstanceName":[
"vim-instance"
]
}
],
Expand All @@ -49,32 +44,9 @@
],
"deployment_flavour":[
{
"df_constraint":[
"constraint1",
"constraint2"
],
"costituent_vdu":[],
"flavour_key":"m1.small"
},{
"df_constraint":[
"constraint3",
"constraint4"
],
"costituent_vdu":[],
"flavour_key":"m1.nano"

}
],
"auto_scale_policy":[
],
"manifest_file":"",
"requires":[
"nfvo:ip-en5",
"database:ipB",
"database:ipC",
"database:ipD"
],
"provides":[
"ip"
]
}
7 changes: 7 additions & 0 deletions src/main/resources/static/dist/css/openbaton.css
Original file line number Diff line number Diff line change
Expand Up @@ -799,4 +799,11 @@ h4 > a, h4 > a:hover {
.upload-drop-zone.drop {
color: #222;
border-color: #222;
}

.dl-table dd{
margin-left: 60px;
}
.dl-table dt{
margin-left: -60px;
}
30 changes: 27 additions & 3 deletions src/main/resources/static/js/app.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
angular.module('app', ['ngRoute', 'ngSanitize', 'ui.bootstrap', 'ngCookies'])
.config(function ($routeProvider) {
angular.module('app', ['ngRoute', 'ngSanitize', 'ui.bootstrap', 'ngCookies', 'angular-clipboard'])
.config(function ($routeProvider, $locationProvider) {

$routeProvider.
when('/login', {
Expand All @@ -10,6 +10,18 @@ angular.module('app', ['ngRoute', 'ngSanitize', 'ui.bootstrap', 'ngCookies'])
templateUrl: 'pages/contents.html',
controller: 'IndexCtrl'
}).
when('/projects', {
templateUrl: 'pages/projects.html',
controller: 'ProjectCtrl'
}).
when('/users', {
templateUrl: 'pages/users/users.html',
controller: 'UserCtrl'
}).
when('/users/:userId', {
templateUrl: 'pages/users/userinfo.html',
controller: 'UserCtrl'
}).
when('/packages', {
templateUrl: 'pages/packages/packages.html',
controller: 'PackageCtrl'
Expand All @@ -18,6 +30,14 @@ angular.module('app', ['ngRoute', 'ngSanitize', 'ui.bootstrap', 'ngCookies'])
templateUrl: 'pages/packages/packageinfo.html',
controller: 'PackageCtrl'
}).
when('/events/:eventId', {
templateUrl: 'pages/events/eventinfo.html',
controller: 'EventCtrl'
}).
when('/events', {
templateUrl: 'pages/events/events.html',
controller: 'EventCtrl'
}).
when('/nsdescriptors', {
templateUrl: 'pages/nsdescriptors/nsdescriptors.html',
controller: 'NsdCtrl'
Expand Down Expand Up @@ -53,6 +73,10 @@ angular.module('app', ['ngRoute', 'ngSanitize', 'ui.bootstrap', 'ngCookies'])
.when('/nsrecords/:nsrecordId/vnfrecords/:vnfrecordId/vdus/:vduId', {
templateUrl: 'pages/nsrecords/vdu.html',
controller: 'NsrCtrl'
})
.when('/nsrecords/:nsrecordId/vnfrecords/:vnfrecordId/vdus/:vduId/vnfci/:vnfciId', {
templateUrl: 'pages/nsrecords/vnfci.html',
controller: 'NsrCtrl'
}).
when('/nsdescriptors/:nsdescriptorId/vnfdependencies/:vnfdependencyId', {
templateUrl: 'pages/nsdescriptors/vnfdependency.html',
Expand Down Expand Up @@ -117,7 +141,7 @@ angular.module('app', ['ngRoute', 'ngSanitize', 'ui.bootstrap', 'ngCookies'])
otherwise({
// redirectTo: '/'
});

$locationProvider.html5Mode(false);
});

/**
Expand Down
160 changes: 160 additions & 0 deletions src/main/resources/static/js/controllers/eventController.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
var app = angular.module('app');
app.controller('EventCtrl', function ($scope, serviceAPI, $routeParams, http, $cookieStore, AuthService) {

var url = $cookieStore.get('URL') + "/api/v1/events/";

$scope.alerts = [];
$scope.closeAlert = function (index) {
$scope.alerts.splice(index, 1);
};

loadTable();

$scope.eventObj = {
'name': 'event_name',
'networkServiceId': '',
'virtualNetworkFunctionId': '',
'type': 'REST',
'endpoint': 'localhost:8081/events',
'event': 'INSTANTIATE_FINISH'
};

/* -- multiple delete functions Start -- */

$scope.multipleDeleteReq = function(){
var ids = [];
angular.forEach($scope.selection.ids, function (value, k) {
if (value) {
ids.push(k);
}
});
//console.log(ids);
http.post(url + 'multipledelete', ids)
.success(function (response) {
showOk('Event: ' + ids.toString() + ' deleted.');
loadTable();
})
.error(function (response, status) {
showError(response, status);
});

};

$scope.main = {checkbox: false};
$scope.$watch('main', function (newValue, oldValue) {
////console.log(newValue.checkbox);
////console.log($scope.selection.ids);
angular.forEach($scope.selection.ids, function (value, k) {
$scope.selection.ids[k] = newValue.checkbox;
});
//console.log($scope.selection.ids);
}, true);

$scope.$watch('selection', function (newValue, oldValue) {
//console.log(newValue);
var keepGoing = true;
angular.forEach($scope.selection.ids, function (value, k) {
if (keepGoing) {
if ($scope.selection.ids[k]) {
$scope.multipleDelete = false;
keepGoing = false;
}
else {
$scope.multipleDelete = true;
}
}

});
if (keepGoing)
$scope.mainCheckbox = false;
}, true);

$scope.multipleDelete = true;

$scope.selection = {};
$scope.selection.ids = {};
/* -- multiple delete functions END -- */


$scope.types = ['REST', 'RABBIT', 'JMS'];
$scope.deleteEvent = function (data) {
http.delete(url + data.id)
.success(function (response) {
showOk('Event: ' + data.name + ' deleted.');
loadTable();
})
.error(function (response, status) {
showError(response, status);
});
};

$scope.closeAlert = function (index) {
$scope.alerts.splice(index, 1);
};


$scope.save = function () {
//console.log($scope.eventObj);
http.post(url, $scope.eventObj)
.success(function (response) {
showOk('Event: ' + $scope.eventObj.name + ' saved.');
loadTable();
})
.error(function (response, status) {
showError(response, status);
});
};
function loadTable() {
if (!angular.isUndefined($routeParams.eventId))
http.get(url + $routeParams.eventId)
.success(function (response, status) {
//console.log(response);
$scope.event = response;
$scope.eventJSON = JSON.stringify(response, undefined, 4);

}).error(function (data, status) {
showError(data, status);
});
else {
http.get(url)
.success(function (response) {
$scope.events = response;
//console.log(response);
})
.error(function (data, status) {
showError(data, status);
});

http.get(url + '/actions')
.success(function (response) {
$scope.actions = response;
})
.error(function (data, status) {
showError(data, status);
});
}

}

function showError(data, status) {
$scope.alerts.push({
type: 'danger',
msg: 'ERROR: <strong>HTTP status</strong>: ' + status + ' response <strong>data</strong> : ' + 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');
}

});



0 comments on commit d769770

Please sign in to comment.