});
};
- $scope.addProfile = new CpeuiDialogs.Dialog('AddProfile', {}, function(obj) {
- if (obj.default_cbs) {
- obj.cbs = Math.floor(obj.cir/10);
+ var profileDialogController = function($scope, $mdDialog) {
+
+ $scope.getDefualtCbs = function(cir) {
+ return Math.round(cir * 0.0125);
}
+
+ $scope.done = function() {
+ if ($scope.obj.default_cbs) {
+ $scope.obj.cbs = $scope.getDefualtCbs($scope.obj.cir);
+ }
+ if ($scope.projectForm.$valid) {
+ $scope.callback($scope.obj);
+ $mdDialog.hide();
+ }
+ };
+ };
+
+ $scope.addProfile = new CpeuiDialogs.Dialog('AddProfile', {}, function(obj) {
CpeuiSvc.addProfile(obj['bw-profile'], obj.cir, obj.cbs, function() {
$scope.updateProfilesView();
});
- });
+ }, profileDialogController);
$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});
+ }, profileDialogController).show(null,{edit:true, profileName:profileName, cbs:cbs, cir:cir});
};
$scope.deleteProfile = function(profileName) {
<thead>
<tr>
<th>Profile Name</th>
- <th>Committed Information Rate (KB/s)</th>
- <th>Committed Burst Size (bytes)</th>
+ <th>Committed Information Rate (kb/s)</th>
+ <th>Committed Burst Size (Bytes)</th>
<th></th>
</tr>
</thead>
'app/cpeui/tenant.controller',
'app/cpeui/tenantsTable.controller' ];
var services = ['app/cpeui/services/cpeui.services',
+ 'app/cpeui/services/utils',
'app/cpeui/services/cpeui.dialogs', ];
var directives = [];
var modules = [ 'app/cpeui/cpeui.module' ];
cpeui.controller('CpeuiCtrl', function($scope, $rootScope, $state, $mdDialog,$mdMedia) {
- $rootScope['section_logo'] = 'static/cpe.png'; // Add your topbar logo
- // location here such as
- // 'assets/images/logo_topology.gif'
-
$rootScope.section_logo = 'src/app/cpeui/static/logo_hpe.gif';
var mainTabIndexs = {
'app/cpeui/assets/angular-material.min',
'app/cpeui/assets/angular-animate.min',
'app/cpeui/assets/angular-aria.min',
- 'app/cpeui/assets/angular-messages.min', 'app/cpeui/utils' ], function(ng) {
+ 'app/cpeui/assets/angular-messages.min'], function(ng) {
var cpeui = angular.module('app.cpeui', [ 'app.core', 'ui.router.state','restangular', 'config', 'ngMaterial', 'ngMessages', 'ngAnimate' ]);
- cpeui.config(function($stateProvider, $compileProvider, $controllerProvider, $provide, NavHelperProvider, $translateProvider) {
+ cpeui.config(function($stateProvider, $compileProvider, $controllerProvider, $provide, NavHelperProvider, $translateProvider, $urlRouterProvider) {
cpeui.register = cpeui; // for adding services, controllers, directives etc.
// to angular module before bootstrap
service : $provide.service
};
+
+ $urlRouterProvider.otherwise("/cpeui/admin/");
NavHelperProvider.addControllerUrl('app/cpeui/cpeui.controller');
NavHelperProvider.addToMenu('cpe', {
<md-content layout-padding>
<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']" ng-disabled="params.edit">
+ <input name="profilename" required 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" ng-init="obj.cir = params.cir">
- <label>Committed Information Rate (KB/s)</label>
+ <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-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 name="" ng-model="obj.default_cbs" ng-init="obj.default_cbs = (!params.edit || getDefualtCbs(params.cir) == params.cbs)">
+ Use default Committed Burst Size {{obj.cir ? ('(' + getDefualtCbs(obj.cir) + ' 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>
+ <label>Committed Burst Size (Bytes)</label>
<input type="number" required name="cbs" ng-model="obj.cbs" min="0">
<div ng-messages="projectForm.cbs.$error">
<div ng-message="required">Number is required!</div>
this.dialogController = function($scope, $mdDialog, params) {
$scope.params = params;
+ $scope.callback = callback;
$scope.obj = {};
$scope.hide = function() {
};
$scope.done = function() {
if ($scope.projectForm.$valid) {
- callback($scope.obj);
+ $scope.callback($scope.obj);
$mdDialog.hide();
}
};
--- /dev/null
+define([ 'app/cpeui/cpeui.module' ], function(cpeui) {
+
+ Array.prototype.filterByField = function(field_name, value, to_filter_out) {
+ if (to_filter_out == undefined) {
+ to_filter_out = false;
+ }
+ return this.filter(function(item) {
+ return (item[field_name] == value) != to_filter_out;
+ });
+ };
+});
+++ /dev/null
-Array.prototype.filterByField = function(field_name, value, to_filter_out) {
- if (to_filter_out == undefined) {
- to_filter_out = false;
- }
- return this.filter(function(item) {
- return (item[field_name] == value) != to_filter_out;
- });
-};
\ No newline at end of file