Fixed up/down link speed bug
diff --git a/views/ngXosViews/diagnostic/src/css/diagnostic.css b/views/ngXosViews/diagnostic/src/css/diagnostic.css
index 19d64a7..d9d1470 100644
--- a/views/ngXosViews/diagnostic/src/css/diagnostic.css
+++ b/views/ngXosViews/diagnostic/src/css/diagnostic.css
@@ -4,6 +4,10 @@
position: relative;
}
+diagnostic-container .form-control.small-padding{
+ padding: 6px;
+}
+
diagnostic-container .half-height {
position: relative;
height: 50%;
diff --git a/views/ngXosViews/diagnostic/src/js/subscriber-modal.js b/views/ngXosViews/diagnostic/src/js/subscriber-modal.js
index 7870386..773be70 100644
--- a/views/ngXosViews/diagnostic/src/js/subscriber-modal.js
+++ b/views/ngXosViews/diagnostic/src/js/subscriber-modal.js
@@ -36,17 +36,21 @@
controllerAs: 'vm',
controller: function($log, $timeout, $scope, Subscribers){
+ const mb = 1000000;
+
$scope.$watch(() => this.open, () => {
this.success = null;
this.formError = null;
});
- $scope.$watch(() => this.subscriber, () => {
+ $scope.$watch(() => this.subscriber, (newVal, oldVal) => {
if(!this.subscriber){
return;
}
- this.subscriber.uplink_speed = parseInt(this.subscriber.uplink_speed, 10) / 1000000000;
- this.subscriber.downlink_speed = parseInt(this.subscriber.downlink_speed, 10) / 1000000000;
+ console.log(newVal, oldVal);
+ console.log('subscriber change', newVal === oldVal);
+ this.subscriber.uplink_speed = parseInt(this.subscriber.uplink_speed, 10) / mb;
+ this.subscriber.downlink_speed = parseInt(this.subscriber.downlink_speed, 10) / mb;
});
this.close = () => {
@@ -55,12 +59,16 @@
this.updateSubscriber = (subscriber) => {
- this.subscriber.uplink_speed = this.subscriber.uplink_speed * 1000000000;
- this.subscriber.downlink_speed = this.subscriber.downlink_speed * 1000000000;
+ // TODO Copy the subscriber, this will update the GUI also and we don't want
+ // TODO Change GBps to MBps
+ let body = angular.copy(subscriber, body);
- Subscribers.update(subscriber).$promise
- .then(() => {
+ body.uplink_speed = body.uplink_speed * mb;
+ body.downlink_speed = body.downlink_speed * mb;
+
+ Subscribers.update(body).$promise
+ .then((res) => {
this.success = 'Subscriber successfully updated!';
})
.catch((e) => {
diff --git a/views/ngXosViews/diagnostic/src/templates/subscriber-status-modal.tpl.html b/views/ngXosViews/diagnostic/src/templates/subscriber-status-modal.tpl.html
index ffc039f..83bb200 100644
--- a/views/ngXosViews/diagnostic/src/templates/subscriber-status-modal.tpl.html
+++ b/views/ngXosViews/diagnostic/src/templates/subscriber-status-modal.tpl.html
@@ -42,15 +42,15 @@
<div class="col-xs-6">
<label>Uplink Speed</label>
<div class="input-group">
- <input type="number" class="form-control" ng-model="vm.subscriber.uplink_speed"/>
- <span class="input-group-addon">Gb</span>
+ <input type="number" class="form-control small-padding" ng-model="vm.subscriber.uplink_speed"/>
+ <span class="input-group-addon">Mbps</span>
</div>
</div>
<div class="col-xs-6">
<label>Downlink Speed</label>
<div class="input-group">
- <input type="number" class="form-control" ng-model="vm.subscriber.downlink_speed"/>
- <span class="input-group-addon">Gb</span>
+ <input type="number" class="form-control small-padding" ng-model="vm.subscriber.downlink_speed"/>
+ <span class="input-group-addon">Mbps</span>
</div>
</div>
</div>