Skip to content

Commit 21cebef

Browse files
committed
new events for charts
1 parent 0671f9f commit 21cebef

10 files changed

+48
-161
lines changed

conf.json

-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
11
{
2-
"mobileServerConfig": {
3-
"port": 8888,
4-
"host": "0.0.0.0"
5-
},
6-
72
"webServerConfig": {
83
"port": 8080,
94
"host": "0.0.0.0",

install.sh

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/bash
2+
cd src/main/webapp && npm install && bower install;

src/main/groovy/com/samantha/vertx/MobileServerVerticle.groovy

-147
This file was deleted.

src/main/webapp/partials/applications.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ <h1 flex>Samantha</h1>
7070
</div>
7171
</section>
7272

73-
<div ng-controller="DialogCtrl">
73+
<div ng-controller="ConnectionDialogCtrl">
7474
<polymer-dialog id="'modal-disconnected'" backdrop="'true'" layered="'true'" autoCloseDisabled="'true'" opened="opened" heading="'Device disconnected'" transition="'paper-dialog-transition-center'">
7575
Please connect your device to the server or you will be relocated to the device select screen in {{ countdown }} seconds.
7676
</polymer-dialog>

src/main/webapp/scripts/controllers/ApplicationsController.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -93,14 +93,14 @@ angular.module('samanthaApp')
9393
console.log("start receiving apps -> " + response.data.total);
9494
$scope.applications.length = 0;
9595
$scope.progressDialogOpened = true;
96-
$("#applicationLoadingProgressBar").get(0).max = response.data.total;
96+
//$("#applicationLoadingProgressBar").get(0).max = response.data.total;
9797
});
9898

9999

100100
vertxEventBusService.on(deviceId + '/android.apps.progress', function (response) {
101101
$scope.applications.push(response.data.application);
102102
console.log("receiving app -> " + response.data.progress);
103-
$("#applicationLoadingProgressBar").get(0).value = response.data.progress;
103+
//$("#applicationLoadingProgressBar").get(0).value = response.data.progress;
104104
});
105105

106106

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
'use strict';
2+
3+
angular.module('samanthaApp')
4+
.controller('ConnectionDialogCtrl', ['$scope', 'vertxEventBusService', '$routeParams', '$location', '$timeout',
5+
function ($scope, vertxEventBusService, $routeParams, $location, $timeout) {
6+
var counter = 60 * 5;
7+
$scope.countdown = counter;
8+
$scope.opened = false;
9+
var mytimeout;
10+
var deviceId = $routeParams['deviceId'];
11+
12+
var startCountDown = function () {
13+
$scope.countdown = counter;
14+
mytimeout = $timeout(startCountDown, 1000);
15+
counter--;
16+
if (counter < 0) {
17+
$scope.opened = false;
18+
$timeout.cancel(mytimeout);
19+
$location.path('/');
20+
}
21+
22+
}
23+
24+
vertxEventBusService.on('device.connect', function (device) {
25+
if (deviceId == device.id) {
26+
$scope.opened = false;
27+
$timeout.cancel(mytimeout);
28+
}
29+
});
30+
31+
vertxEventBusService.on('device.disconnect', function (device) {
32+
if (deviceId == device.id) {
33+
$scope.opened = true;
34+
startCountDown();
35+
}
36+
});
37+
}]);

src/main/webapp/scripts/controllers/DevicesController.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ angular.module('samanthaApp')
3333
};
3434

3535
$scope.retrieveIp = function() {
36-
$http.get('/ip').success(function(data) {
36+
$http.get('/config').success(function(data) {
3737
$scope.baseUrl = data.ip;
3838
});
3939
}

src/main/webapp/scripts/controllers/DialogController.js renamed to src/main/webapp/scripts/controllers/ProgressDialogController.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
22

33
angular.module('samanthaApp')
4-
.controller('DialogCtrl', ['$scope', 'vertxEventBusService', '$routeParams', '$location', '$timeout',
4+
.controller('ProgressDialogCtrl', ['$scope', 'vertxEventBusService', '$routeParams', '$location', '$timeout',
55
function ($scope, vertxEventBusService, $routeParams, $location, $timeout) {
66
var counter = 15;
77
$scope.countdown = counter;

src/main/webapp/scripts/controllers/monitoring/ChartCpuController.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ angular.module('samanthaApp')
1616
}
1717

1818
vertxEventBusService.on('vertx.monitoring.start', function (response) {
19-
if (response.deviceId == deviceId && packageName != response.packageName) {
19+
if (response.deviceId == deviceId) {
2020
packageName = response.packageName;
2121
resetSeries();
2222
}
2323
});
2424

25-
vertxEventBusService.on(deviceId + '/android.monitoring.progress', function (response) {
25+
vertxEventBusService.on(deviceId + '/android.monitoring.progress/monitoring', function (response) {
2626
var sysdump = response.data;
2727

2828
if (sysdump.cpuInfo) {

src/main/webapp/scripts/controllers/monitoring/ChartMemoryController.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ angular.module('samanthaApp')
1616
};
1717

1818
vertxEventBusService.on('vertx.monitoring.start', function (response) {
19-
if (response.deviceId == deviceId && packageName != response.packageName) {
19+
if (response.deviceId == deviceId) {
2020
packageName = response.packageName;
2121
resetSeries();
2222
}
2323
});
2424

25-
vertxEventBusService.on(deviceId + '/android.monitoring.progress', function (response) {
25+
vertxEventBusService.on(deviceId + '/android.monitoring.progress/monitoring', function (response) {
2626
var sysdump = response.data;
2727

2828
if (sysdump.memoryInfo) {

0 commit comments

Comments
 (0)