diff --git a/res/app/device-list/device-list.jade b/res/app/device-list/device-list.jade index 0f522292..8bbe69a8 100644 --- a/res/app/device-list/device-list.jade +++ b/res/app/device-list/device-list.jade @@ -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}} diff --git a/res/app/device-list/device-status/index.js b/res/app/device-list/device-status/index.js new file mode 100644 index 00000000..1f585e7c --- /dev/null +++ b/res/app/device-list/device-status/index.js @@ -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('-') + } + }) diff --git a/res/app/device-list/index.js b/res/app/device-list/index.js index 87d949dd..b01e63c0 100644 --- a/res/app/device-list/index.js +++ b/res/app/device-list/index.js @@ -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', { @@ -11,4 +12,4 @@ module.exports = angular.module('device-list', [ controller: 'DeviceListCtrl' }) }]) - .controller('DeviceListCtrl', require('./device-list-controller')) \ No newline at end of file + .controller('DeviceListCtrl', require('./device-list-controller'))