1
0
Fork 0
mirror of https://github.com/openstf/stf synced 2025-10-06 12:00:08 +02:00

Battery info.

This commit is contained in:
Gunther Brunner 2014-05-01 21:24:53 +09:00
parent e6be8491fa
commit a819fc980a
3 changed files with 60 additions and 7 deletions

View file

@ -30,7 +30,8 @@ div.stf-device-list
img(ng-src='{{device.image ? "/static/devices/" + device.image : "/static/bower_components/stf-graphics/devices/small/default.jpg" }}')
.device-name(title='{{device.serial}} - {{device.model}}') {{ device.name || device.model }}
//raphael-status-icon.device-status-button(status='{{ deviceStatus(device) }}', title="{{ deviceStatusText(device) }}", tooltip='{{ deviceStatusText(device)|translate }}')
button.btn.btn-default.btn-xs.device-status {{statusName(device)}}
//button.btn.btn-default.btn-xs.device-status {{statusName(device)}}
button.btn.btn-default.btn-xs.device-status {{device.state|statusName}}
.clear-fix
tab(active='activeTabs.details')
@ -62,7 +63,7 @@ div.stf-device-list
tr(ng-repeat='device in $data', ng-class='{ "device-not-usable": !device.usable }')
td(data-title="'Status'", sortable='"state"', filter="{ 'usable': 'select' }", filter-data="statusFilter($column)")
button(ng-class='{"btn-primary": device.state == "using", "btn-primary-outline": device.state == "available"}',
ng-click='device.usable && toggle(device)').btn.btn-xs.device-status {{statusName(device)}}
ng-click='device.usable && toggle(device)').btn.btn-xs.device-status {{device.state|statusName}}
td(data-title="'Model'|translate", sortable='"model"', filter='{"model": "text"}')
span {{device.model}}
td(data-title="'Product'|translate", sortable='"name"', filter='{"name": "text"}')
@ -92,9 +93,13 @@ div.stf-device-list
span {{device.phone.imei}}
td(ng-show='showAll', data-title="'Phone ICCID'", sortable='"phone.iccid"', filter='{"phone.iccid": "text"}')
span {{device.phone.iccid}}
//td(ng-show='showAll', data-title="'Browsers'")
span(ng-repeat='browsers in device.browser.apps')
span {{browsers.name}}
td(ng-show='showAll', data-title="'Battery Health'", sortable='"battery.health"', filter='{"battery.health": "text"}')
span {{device.battery.health | batteryHealth}}
td(ng-show='showAll', data-title="'Battery Source'", sortable='"battery.source"', filter='{"battery.source": "text"}')
span {{device.battery.source}}
td(data-title="'Location'|translate", sortable='"provider.name"', filter='{"provider.name": "text"}')
span {{device.provider.name}}

View file

@ -0,0 +1,47 @@
module.exports = angular.module('stf.device-status', [])
.filter('statusName', function (gettext) {
return function (text) {
return {
'absent': gettext('Absent'),
'present': gettext('Present'),
'offline': gettext('Offline'),
'unauthorized': gettext('Unauthorized'),
'preparing': gettext('Preparing'),
'ready': gettext('Ready'),
'using': gettext('Using'),
'busy': gettext('Busy'),
'available': gettext('Use')
}[text] || gettext('Unknown')
}
})
.filter('batteryHealth', function (gettext) {
return function (text) {
return {
'cold': gettext('Cold'),
'good': gettext('Good'),
'dead': gettext('Dead'),
'over_voltage': gettext('Over Voltage'),
'overheat': gettext('Overheat'),
'unspecified_failure': gettext('Unspecified Failure')
}[text] || gettext('-')
}
})
.filter('batterySource', function (gettext) {
return function (text) {
return {
'ac': gettext('AC'),
'usb': gettext('USB'),
'wireless': gettext('Wireless')
}[text] || gettext('-')
}
})
.filter('batteryStatus', function (gettext) {
return function (text) {
return {
'charging': gettext('Charging'),
'discharging': gettext('Discharging'),
'full': gettext('Full'),
'not_charging': gettext('Not Charging')
}[text] || gettext('-')
}
})

View file

@ -3,7 +3,8 @@ require('./device-list.css')
module.exports = angular.module('device-list', [
require('stf/device').name,
require('stf/user/group').name,
require('stf/common-ui').name
require('stf/common-ui').name,
require('./device-status').name
])
.config(['$routeProvider', function ($routeProvider) {
$routeProvider.when('/devices', {