Create support_logs (db & api)
This commit is contained in:
parent
b7d6f3f419
commit
62d606cc80
8 changed files with 279 additions and 58 deletions
22
lib/logs.js
22
lib/logs.js
|
|
@ -3,9 +3,7 @@ const _ = require('lodash/fp')
|
|||
const db = require('./db')
|
||||
const pgp = require('pg-promise')()
|
||||
|
||||
const settingsLoader = require('./settings-loader')
|
||||
const configManager = require('./config-manager')
|
||||
|
||||
const getMachineName = require('./machine-loader').getMachineName
|
||||
const NUM_RESULTS = 1000
|
||||
|
||||
/**
|
||||
|
|
@ -79,22 +77,4 @@ function getMachineLogs (deviceId) {
|
|||
}))
|
||||
}
|
||||
|
||||
/**
|
||||
* Given the machine id, get the machine name
|
||||
*
|
||||
* @name getMachineName
|
||||
* @function
|
||||
* @async
|
||||
*
|
||||
* @param {string} machineId machine id
|
||||
* @returns {string} machine name
|
||||
*/
|
||||
function getMachineName (machineId) {
|
||||
return settingsLoader.loadRecentConfig()
|
||||
.then(config => {
|
||||
const machineScoped = configManager.machineScoped(machineId, config)
|
||||
return machineScoped.machineName
|
||||
})
|
||||
}
|
||||
|
||||
module.exports = { getMachineLogs, update, getLastSeen }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue