forked from openstf/stf
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
420 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"directory": "res/bower_components" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
{ | ||
"name": "stf", | ||
"description": "Smartphone Test Farm", | ||
"keywords": [ | ||
"adb", | ||
"android", | ||
"stf", | ||
"test", | ||
"remote" | ||
], | ||
"version": "0.9.0", | ||
"license": "Apache-2.0", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/openstf/stf.git" | ||
}, | ||
"bin": { | ||
"stf": "./bin/stf" | ||
}, | ||
"scripts": { | ||
"test": "gulp test" | ||
}, | ||
"dependencies": { | ||
"adbkit": "^2.2.1", | ||
"adbkit-apkreader": "^1.0.0", | ||
"adbkit-monkey": "^1.0.1", | ||
"bluebird": "^2.9.14", | ||
"body-parser": "^1.12.2", | ||
"chalk": "^1.0.0", | ||
"commander": "^2.7.1", | ||
"compression": "^1.4.3", | ||
"cookie-session": "^1.1.0", | ||
"csurf": "^1.7.0", | ||
"eventemitter3": "^0.1.6", | ||
"express": "^4.12.3", | ||
"express-validator": "^2.8.0", | ||
"formidable": "^1.0.17", | ||
"gm": "^1.17.0", | ||
"hipchatter": "^0.2.0", | ||
"http-proxy": "^1.9.0", | ||
"jade": "^1.9.2", | ||
"jws": "^3.0.0", | ||
"ldapjs": "git+https://github.com/mcavage/node-ldapjs.git#acc1ca8f4314fd9d67561feabc8ce4c235076a5e", | ||
"lodash": "^3.5.0", | ||
"markdown-serve": "^0.3.2", | ||
"mime": "^1.3.4", | ||
"minimatch": "^2.0.4", | ||
"my-local-ip": "^1.0.0", | ||
"node-uuid": "^1.4.3", | ||
"passport": "^0.2.1", | ||
"passport-oauth2": "^1.1.2", | ||
"protobufjs": "^3.8.2", | ||
"proxy-addr": "^1.0.7", | ||
"request": "^2.53.0", | ||
"request-progress": "^0.3.1", | ||
"rethinkdb": "^1.15.0", | ||
"semver": "^4.3.1", | ||
"serve-favicon": "^2.2.0", | ||
"serve-static": "^1.9.2", | ||
"socket.io": "1.3.5", | ||
"split": "^0.3.3", | ||
"stf-appstore-db": "^1.0.0", | ||
"stf-browser-db": "^1.0.0", | ||
"stf-device-db": "^1.0.0", | ||
"stf-syrup": "^1.0.0", | ||
"stf-wiki": "^1.0.0", | ||
"temp": "^0.8.1", | ||
"ws": "^0.7.2", | ||
"zmq": "^2.10.0" | ||
}, | ||
"devDependencies": { | ||
"async": "^1.2.1", | ||
"bower": "^1.3.12", | ||
"chai": "^2.1.2", | ||
"css-loader": "^0.15.1", | ||
"del": "^1.2.0", | ||
"event-stream": "^3.3.0", | ||
"exports-loader": "^0.6.2", | ||
"extract-text-webpack-plugin": "^0.8.2", | ||
"file-loader": "^0.8.1", | ||
"gulp": "^3.8.11", | ||
"gulp-angular-gettext": "^2.1.0", | ||
"gulp-jade": "^1.0.0", | ||
"gulp-jscs": "^1.4.0", | ||
"gulp-jshint": "^1.9.4", | ||
"gulp-jsonlint": "^1.0.2", | ||
"gulp-protractor": "^0.0.12", | ||
"gulp-util": "^3.0.4", | ||
"html-loader": "^0.3.0", | ||
"imports-loader": "^0.6.3", | ||
"jasmine-core": "^2.3.4", | ||
"jasmine-reporters": "^2.0.5", | ||
"jshint": "^2.6.3", | ||
"jshint-loader": "^0.8.3", | ||
"jshint-stylish": "^2.0.0", | ||
"json-loader": "^0.5.1", | ||
"karma": "^0.12.32", | ||
"karma-chrome-launcher": "^0.2.0", | ||
"karma-firefox-launcher": "^0.1.4", | ||
"karma-ie-launcher": "^0.2.0", | ||
"karma-jasmine": "^0.3.5", | ||
"karma-junit-reporter": "^0.2.2", | ||
"karma-opera-launcher": "^0.1.0", | ||
"karma-phantomjs-launcher": "^0.2.0", | ||
"karma-safari-launcher": "^0.1.1", | ||
"karma-webpack": "^1.5.0", | ||
"less": "^2.4.0", | ||
"less-loader": "^2.1.0", | ||
"ng-annotate-webpack-plugin": "^0.1.2", | ||
"node-libs-browser": "^0.5.2", | ||
"node-sass": "^3.2.0", | ||
"phantomjs": "^1.9.17", | ||
"protractor": "^2.0.0", | ||
"protractor-html-screenshot-reporter": "0.0.19", | ||
"raw-loader": "^0.5.1", | ||
"run-sequence": "^1.0.2", | ||
"sass-loader": "^1.0.2", | ||
"script-loader": "^0.6.1", | ||
"sinon": "^1.14.1", | ||
"sinon-chai": "^2.7.0", | ||
"socket.io-client": "1.3.5", | ||
"style-loader": "^0.12.3", | ||
"template-html-loader": "^0.0.3", | ||
"url-loader": "^0.5.5", | ||
"webpack": "^1.10.0", | ||
"webpack-dev-server": "^1.7.0" | ||
}, | ||
"engines": { | ||
"node": ">= 0.10" | ||
}, | ||
"preferGlobal": true | ||
} |
93 changes: 93 additions & 0 deletions
93
res/app/components/stf/device/enhance-device/enhance-device-service.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
module.exports = function EnhanceDeviceServiceFactory($filter, AppState) { | ||
var service = {} | ||
|
||
function setState(data) { | ||
// For convenience, formulate an aggregate state property that covers | ||
// every possible state. | ||
data.state = 'absent' | ||
if (data.present) { | ||
data.state = 'present' | ||
switch (data.status) { | ||
case 1: | ||
data.state = 'offline' | ||
break | ||
case 2: | ||
data.state = 'unauthorized' | ||
break | ||
case 3: | ||
data.state = 'preparing' | ||
if (data.ready) { | ||
data.state = 'ready' | ||
if (data.using) { | ||
data.state = 'using' | ||
} | ||
else { | ||
if (data.owner) { | ||
data.state = 'busy' | ||
} | ||
else { | ||
data.state = 'available' | ||
} | ||
} | ||
} | ||
break | ||
} | ||
} | ||
} | ||
|
||
function enhanceDevice(device) { | ||
device.enhancedName = device.name || device.model || device.serial || 'Unknown' | ||
device.enhancedModel = device.model || 'Unknown' | ||
device.enhancedImage120 = '/static/app/devices/icon/x120/' + (device.image || '_default.jpg') | ||
device.enhancedImage24 = '/static/app/devices/icon/x24/' + (device.image || '_default.jpg') | ||
device.enhancedStateAction = $filter('statusNameAction')(device.state) | ||
device.enhancedStatePassive = $filter('statusNamePassive')(device.state) | ||
} | ||
|
||
function enhanceDeviceDetails(device) { | ||
if (device.battery) { | ||
device.enhancedBatteryPercentage = (device.battery.level / device.battery.scale * 100) + '%' | ||
device.enhancedBatteryHealth = $filter('batteryHealth')(device.battery.health) | ||
device.enhancedBatterySource = $filter('batterySource')(device.battery.source) | ||
device.enhancedBatteryStatus = $filter('batteryStatus')(device.battery.status) | ||
device.enhancedBatteryTemp = device.battery.temp + '°C' | ||
} | ||
|
||
if (device.owner) { | ||
device.enhancedUserProfileUrl = enhanceUserProfileUrl(device.owner.email) | ||
device.enhancedUserName = device.owner.name || "No name" | ||
} | ||
} | ||
|
||
function enhanceUserProfileUrl(email) { | ||
var url | ||
var userProfileUrl = (function () { | ||
if (AppState && AppState.config && AppState.config.userProfileUrl) { | ||
return AppState.config.userProfileUrl | ||
} | ||
return null | ||
})() | ||
|
||
if (userProfileUrl) { | ||
// Using RFC 6570 URI Template specification | ||
if (userProfileUrl && email) { | ||
url = userProfileUrl.indexOf('{user}') !== -1 ? | ||
userProfileUrl.replace('{user}', email) : | ||
userProfileUrl + email; | ||
} | ||
} else if (email.indexOf('@') !== -1) { | ||
url = 'mailto:' + email | ||
} else { | ||
url = '/!#/user/' + email | ||
} | ||
return url | ||
} | ||
|
||
service.enhance = function (device) { | ||
setState(device) | ||
enhanceDevice(device) | ||
enhanceDeviceDetails(device) | ||
} | ||
|
||
return service | ||
} |
Oops, something went wrong.