mirror of
https://github.com/openstf/stf
synced 2025-10-06 03:50:04 +02:00
Integrate device database.
This commit is contained in:
parent
7a2cdaf071
commit
d1b724ada0
4 changed files with 66 additions and 3 deletions
|
@ -16,6 +16,7 @@ var wire = require('../wire')
|
|||
var wireutil = require('../wire/util')
|
||||
var wirerouter = require('../wire/router')
|
||||
var dbapi = require('../db/api')
|
||||
var datautil = require('../util/datautil')
|
||||
|
||||
var auth = require('../middleware/auth')
|
||||
var webpack = require('../middleware/webpack')
|
||||
|
@ -42,6 +43,7 @@ module.exports = function(options) {
|
|||
|
||||
app.use('/static/bower_components', express.static(pathutil.resource('bower_components')))
|
||||
app.use('/static/data', express.static(pathutil.resource('data')))
|
||||
app.use('/static/devices', datautil.middleware())
|
||||
app.use('/static', express.static(pathutil.resource('app')))
|
||||
|
||||
if (!options.disableWatch) {
|
||||
|
@ -137,6 +139,7 @@ module.exports = function(options) {
|
|||
.then(function(cursor) {
|
||||
return Promise.promisify(cursor.toArray, cursor)()
|
||||
.then(function(list) {
|
||||
list.forEach(datautil.applyData)
|
||||
res.json({
|
||||
success: true
|
||||
, devices: list
|
||||
|
@ -157,7 +160,7 @@ module.exports = function(options) {
|
|||
if (device) {
|
||||
res.json({
|
||||
success: true
|
||||
, device: device
|
||||
, device: datautil.applyData(device)
|
||||
})
|
||||
}
|
||||
else {
|
||||
|
@ -267,7 +270,7 @@ module.exports = function(options) {
|
|||
socket.emit('device.change', message)
|
||||
})
|
||||
.on(wire.DeviceIdentityMessage, function(channel, message) {
|
||||
socket.emit('device.change', message)
|
||||
socket.emit('device.change', datautil.applyData(message))
|
||||
})
|
||||
.on(wire.TransactionProgressMessage, function(channel, message) {
|
||||
socket.emit('tx.progress', channel.toString(), message)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue