Skip to content

Commit 88ea786

Browse files
Merge branch 'master' into AsusWRT-Merlin
2 parents 36db392 + 2812afd commit 88ea786

22 files changed

+102
-54
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ A simple shell script designed to run on [AsusWRT-Merlin](https://asuswrt.lostre
2323
- `cd /mnt/<mounted_name>/`
2424
- `mkdir bwmon`
2525
- `cd bwmon`
26-
- `wget https://github.com/VREMSoftwareDevelopment/bwmon/releases/download/v2.4.2-Merlin/bwmon.tar.gz`
26+
- `wget https://github.com/VREMSoftwareDevelopment/bwmon/releases/download/v2.5.0-Merlin/bwmon.tar.gz`
2727
- `tar -xzvf bwmon.tar.gz`
2828
- `chmod +x install.sh`
2929
- `./install.sh`

app/common/chartType.Test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ describe('BWMonApp.ChartType module, chartType directive ', function() {
1414
template = angular.element('<chart-type ng-model="myType"></chart-type>');
1515

1616
scope = _$rootScope_.$new();
17+
scope.myType = chartTypes[0];
1718

1819
chartService = _chartService_;
1920
spyOn(chartService, 'getChartTypes').and.returnValue(chartTypes);

app/common/chartType.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,8 @@ angular.module('BWMonApp.ChartType', [])
2525
chartType: '=ngModel'
2626
},
2727
controller: function(chartService) {
28-
var chartTypes = chartService.getChartTypes();
2928
angular.extend(this, {
30-
chartTypes: chartTypes,
31-
chartType: chartTypes[0]
29+
chartTypes: chartService.getChartTypes()
3230
});
3331
},
3432
controllerAs: 'chartTypeCtrl'

app/common/selectMonth.Test.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,15 @@ describe('BWMonApp.SelectMonth module, selectMonth directive', function() {
1414
template = angular.element('<select-month ng-model="myMonth" year="myYear"></select-month></div>');
1515

1616
scope = _$rootScope_.$new();
17+
scope.myYear = data[0].year;
18+
scope.myMonth = data[0].months[0];
1719

1820
dataService = _dataService_;
1921
spyOn(dataService, 'getMonths').and.returnValue(data[0].months);
2022

2123
element = _$compile_(template)(scope);
2224
controller = template.controller('selectMonth');
2325

24-
scope.myYear = data[0].year;
2526
}));
2627

2728
it('should have element', function() {

app/common/selectYear.Test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ describe('BWMonApp.SelectYear module, selectYear directive ', function() {
1414
template = angular.element('<select-year ng-model="myYear"></select-year>');
1515

1616
scope = _$rootScope_.$new();
17+
scope.myYear = years[0];
1718

1819
dataService = _dataService_;
1920
spyOn(dataService, 'getYears').and.returnValue(years);

app/common/selectYear.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,8 @@ angular.module('BWMonApp.SelectYear', [])
2525
year: '=ngModel'
2626
},
2727
controller: function(dataService) {
28-
var years = dataService.getYears();
2928
angular.extend(this, {
30-
years: years,
31-
year: years[0]
29+
years: dataService.getYears()
3230
});
3331
},
3432
controllerAs: 'selectYearCtrl'

app/navigation/navigation.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ angular.module('BWMonApp.Navigation', [])
2222
'<div class="navbar navbar-default">',
2323
'<ul class="nav navbar-nav">',
2424
'<li ng-repeat="route in ::navigationCtrl.routes" ng-class="{active: navigationCtrl.isActive(\'{{::route.href}}\')}" >',
25-
'<a href="#{{::route.href}}">{{::route.name}}</a>',
25+
'<a href="#!{{::route.href}}">{{::route.name}}</a>',
2626
'</li>',
2727
'</ul>',
2828
'</div>'
@@ -34,13 +34,13 @@ angular.module('BWMonApp.Navigation', [])
3434
return viewLocation === $location.path();
3535
},
3636
routes: [{
37-
href: '/UsageByUser',
37+
href: 'UsageByUser',
3838
name: 'Usage By User'
3939
}, {
40-
href: '/UsageByMonth',
40+
href: 'UsageByMonth',
4141
name: 'Usage By Month'
4242
}, {
43-
href: '/UsageByYear',
43+
href: 'UsageByYear',
4444
name: 'Usage By Year'
4545
}]
4646
});

app/services/chartService.Test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ describe('BWMonApp.ChartService module, chartService factory ', function() {
88

99
it('should have all choices in chart types', function(){
1010
var expected = [
11-
['column'],
12-
['line', 'dot'],
13-
['line', 'dot', 'area']
11+
'column',
12+
'line',
13+
'area'
1414
];
1515
expect(chartService.getChartTypes()).toEqual(expected);
1616
});
@@ -33,7 +33,7 @@ describe('BWMonApp.ChartService module, chartService factory ', function() {
3333
color: '#3366CC',
3434
label: 'GBytes',
3535
grid: {x: false, y: true},
36-
type: ['column'],
36+
type: 'column',
3737
id: 'series00'
3838
}];
3939
expect(chartService.getChartOptions().series).toEqual(expected);

app/services/chartService.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ angular.module('BWMonApp.ChartService', [])
1717
.factory('chartService', function() {
1818
var _getChartTypes = function() {
1919
return [
20-
['column'],
21-
['line', 'dot'],
22-
['line', 'dot', 'area']
20+
'column',
21+
'line',
22+
'area'
2323
];
2424
},
2525
_getChartOptions = function(labelFn, tooltipFn) {

app/usagebymonth/usageByMonth.Test.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,21 @@ describe('BWMonApp.UsageByMonth module, ', function() {
2020

2121
describe('UsageByMonthController controller ', function() {
2222
var controller,
23+
years = ['2011', '2012'],
2324
usageData = {
2425
data: [
2526
{usage: 5, total: 10},
2627
{usage: 2, total: 11},
2728
{usage: 1, total: 12}
2829
]
2930
},
31+
chartTypes = [
32+
['type1'],
33+
['type2']
34+
],
3035
chartOptions = {
3136
series: [{
32-
type: 'type'
37+
type: chartTypes[0]
3338
}]
3439
},
3540
chartData = {
@@ -44,9 +49,11 @@ describe('BWMonApp.UsageByMonth module, ', function() {
4449

4550
beforeEach(inject(function(_$controller_, _dataService_, _chartService_){
4651
dataService = _dataService_;
52+
spyOn(dataService, 'getYears').and.returnValue(years);
4753
spyOn(dataService, 'getUsageByMonth').and.returnValue(usageData);
4854

4955
chartService = _chartService_;
56+
spyOn(chartService, 'getChartTypes').and.returnValue(chartTypes);
5057
spyOn(chartService, 'getChartOptions').and.returnValue(chartOptions);
5158
spyOn(chartService, 'getChartData').and.returnValue(chartData);
5259

@@ -59,6 +66,14 @@ describe('BWMonApp.UsageByMonth module, ', function() {
5966
scope.usageByMonthCtrl = controller;
6067
}));
6168

69+
it('should set selected year', function() {
70+
expect(controller.selected.year).toBe(years[0]);
71+
});
72+
73+
it('should set selected chart type', function() {
74+
expect(controller.selected.chartType).toBe(chartTypes[0]);
75+
});
76+
6277
it('should set predicate to id', function() {
6378
expect(controller.predicate).toEqual('id');
6479
});

0 commit comments

Comments
 (0)