};
$scope.addProfile = new CpeuiDialogs.Dialog('AddProfile', {}, function(obj) {
- CpeuiSvc.addProfile(obj['bw-profile'], obj.cir, obj.cbs, function() {
- $scope.updateProfilesView();
- });
+ if (obj.default_cbs) {
+ obj.cbs = Math.floor(obj.cir/10);
+ }
+ CpeuiSvc.addProfile(obj['bw-profile'], obj.cir, obj.cbs, function() {
+ $scope.updateProfilesView();
+ });
});
+ $scope.editProfile = function(profileName, cbs, cir) {
+ new CpeuiDialogs.Dialog('AddProfile', {}, function(obj) {
+ if (obj.default_cbs) {
+ obj.cbs = Math.floor(obj.cir/10);
+ }
+ CpeuiSvc.editProfile(obj['bw-profile'], obj.cir, obj.cbs, function() {
+ $scope.updateProfilesView();
+ });
+ }).show(null,{edit:true, profileName:profileName, cbs:cbs, cir:cir});
+ };
+
$scope.deleteProfile = function(profileName) {
CpeuiDialogs.confirm(function() {
CpeuiSvc.deleteProfile(profileName, function() {
<thead>
<tr>
<th>Profile Name</th>
- <th>Committed Information Rate (Kb/s)</th>
+ <th>Committed Information Rate (KB/s)</th>
<th>Committed Burst Size (bytes)</th>
<th></th>
</tr>
<td class="minimal-width">{{ profile.cir }}</td>
<td class="minimal-width">{{ profile.cbs }}</td>
<td class="delete-tr">
+ <button class="btn btn-md btn-info" ng-click="editProfile(profile['bw-profile'],profile.cbs,profile.cir)">
+ <i class="icon-edit"></i>
+ <md-tooltip>Edit Profile</md-tooltip>
+ </button>
<button class="btn btn-md btn-danger" ng-click="deleteProfile(profile['bw-profile'])">
<i class="icon-trash"></i>
<md-tooltip>Delete Profile</md-tooltip>
<md-dialog class="cpe-dialog" aria-label="Create Profile" ng-cloak>
<md-toolbar>
<div class="md-toolbar-tools">
- <h2>Create Profile</h2>
+ <h2>{{params.edit ? 'Edit' : 'Create'}} Profile</h2>
<span flex></span>
<md-button class="md-icon-button" aria-label="Close dialog"
ng-click="cancel()"> <i class="icon-remove-sign"></i> </md-button>
<md-dialog-content>
<div layout="column" ng-cloak>
<md-content layout-padding>
- <md-input-container class="md-block">
+ <md-input-container class="md-block" ng-init="obj['bw-profile'] = params.profileName">
<label>Profile Name</label>
- <input name="profilename" ng-model="obj['bw-profile']">
+ <input name="profilename" ng-model="obj['bw-profile']" ng-disabled="params.edit">
<div ng-messages="projectForm.profilename.$error">
<div ng-message="required">This is required!</div>
</div>
</md-input-container>
- <md-input-container class="md-block">
- <label>Committed Information Rate (Kb/s)</label>
+ <md-input-container class="md-block" ng-init="obj.cir = params.cir">
+ <label>Committed Information Rate (KB/s)</label>
<input type="number" required name="cir" ng-model="obj.cir" min="0">
<div ng-messages="projectForm.cir.$error">
<div ng-message="required">Number is required!</div>
<div ng-message="min">Number must be positive!</div>
</div>
</md-input-container>
- <md-input-container class="md-block">
+ <md-checkbox name="" ng-model="obj.default_cbs" ng-init="obj.default_cbs = true">
+ Use default Committed Burst Size {{obj.cir ? '('+((obj.cir - (obj.cir % 10)) / 10) + ' bytes)': ''}}
+ </md-checkbox>
+ <md-input-container class="md-block" ng-if="!obj.default_cbs" ng-init="obj.cbs = params.cbs">
<label>Committed Burst Size (bytes)</label>
<input type="number" required name="cbs" ng-model="obj.cbs" min="0">
<div ng-messages="projectForm.cbs.$error">
locals : {
params : params
},
- // onComplete: function() {$('md-dialog').draggable();}
+ onComplete: function() {$('md-dialog').draggable();}
});
};
};
});
};
+ svc.editProfile = function(name, cir, cbs, callback){
+ $http({
+ method:'PUT',
+ url:"/restconf/config/mef-global:mef-global/profiles/ingress-bwp-flows/bwp-flow/"+name,
+ data: {"bwp-flow":{
+ "bw-profile": name,
+ cir: cir,
+ cbs:cbs
+ }}
+ }).then(function successCallback(response) {
+ if (callback != undefined) {
+ callback();
+ }
+ });
+ };
+
svc.deleteProfile = function(name, callback) {
$http({
method:'DELETE',