This commit is contained in:
Michele Marcucci 2021-07-02 15:37:27 +02:00
parent 3d3f283d20
commit ea9670225e
4 changed files with 31 additions and 3 deletions

View File

@ -0,0 +1,18 @@
module.exports.typeDefs = `
type McuActions {
version: McuAppVersionOutput!
}
type McuAppVersionOutput {
result: String
error: Error
}
`
module.exports.resolvers = {
McuActions: {
version (root, args, { dispatch }) {
return dispatch('api/mcu/version')
}
}
}

View File

@ -13,7 +13,6 @@ module.exports.typeDefs = `
}
type McuStats {
currentAppVersion: String,
timestamp: String!
hostname: String,
operatingSystem: String

View File

@ -0,0 +1,13 @@
const { join } = require('path')
const { exec } = require('child_process')
const axios = require('axios')
module.exports = ({ define }) => {
define('version', async (payload, { knex, errors, utils }) => {
const gitAppVersion = await axios.get('https://raw.githubusercontent.com/jstefanop/apolloui/production-BTC/package.json');
const currentAppVersion = (gitAppVersion && gitAppVersion.data) ? gitAppVersion.data.version : null;
return currentAppVersion
}, {
auth: true
})
}

View File

@ -5,8 +5,6 @@ const axios = require('axios')
module.exports = ({ define }) => {
define('stats', async (payload, { knex, errors, utils }) => {
const stats = await getOsStats()
const gitAppVersion = await axios.get('https://raw.githubusercontent.com/jstefanop/apolloui/production-BTC/package.json');
stats.currentAppVersion = (gitAppVersion && gitAppVersion.data) ? gitAppVersion.data.version : null;
stats.timestamp = new Date().toISOString()
return { stats }
}, {