feat: admin UI fixes + SAML strategy + dashboard gql
This commit is contained in:
@@ -22,33 +22,77 @@ module.exports = {
|
||||
async system() { return {} }
|
||||
},
|
||||
SystemQuery: {
|
||||
async info(obj, args, context, info) {
|
||||
async info() { return {} }
|
||||
},
|
||||
SystemMutation: { },
|
||||
SystemInfo: {
|
||||
configFile() {
|
||||
return path.join(process.cwd(), 'config.yml')
|
||||
},
|
||||
currentVersion() {
|
||||
return WIKI.version
|
||||
},
|
||||
dbType() {
|
||||
return _.get(dbTypes, WIKI.config.db.type, 'Unknown DB')
|
||||
},
|
||||
dbVersion() {
|
||||
return _.get(WIKI.models, 'knex.client.version', 'Unknown version')
|
||||
},
|
||||
dbHost() {
|
||||
return WIKI.config.db.host
|
||||
},
|
||||
latestVersion() {
|
||||
return '2.0.0' // TODO
|
||||
},
|
||||
latestVersionReleaseDate() {
|
||||
return new Date() // TODO
|
||||
},
|
||||
async operatingSystem() {
|
||||
let osLabel = `${os.type()} (${os.platform()}) ${os.release()} ${os.arch()}`
|
||||
if (os.platform() === 'linux') {
|
||||
const osInfo = await getos()
|
||||
osLabel = `${os.type()} - ${osInfo.dist} (${osInfo.codename || os.platform()}) ${osInfo.release || os.release()} ${os.arch()}`
|
||||
}
|
||||
|
||||
return {
|
||||
configFile: path.join(process.cwd(), 'config.yml'),
|
||||
currentVersion: WIKI.version,
|
||||
dbType: _.get(dbTypes, WIKI.config.db.type, 'Unknown DB'),
|
||||
dbVersion: _.get(WIKI.models, 'knex.client.version', 'Unknown version'),
|
||||
dbHost: WIKI.config.db.host,
|
||||
latestVersion: WIKI.version, // TODO
|
||||
latestVersionReleaseDate: new Date(), // TODO
|
||||
operatingSystem: osLabel,
|
||||
hostname: os.hostname(),
|
||||
cpuCores: os.cpus().length,
|
||||
ramTotal: filesize(os.totalmem()),
|
||||
workingDirectory: process.cwd(),
|
||||
nodeVersion: process.version.substr(1),
|
||||
redisVersion: WIKI.redis.serverInfo.redis_version,
|
||||
redisUsedRAM: WIKI.redis.serverInfo.used_memory_human,
|
||||
redisTotalRAM: _.get(WIKI.redis.serverInfo, 'total_system_memory_human', 'N/A'),
|
||||
redisHost: WIKI.redis.options.host
|
||||
}
|
||||
return osLabel
|
||||
},
|
||||
hostname() {
|
||||
return os.hostname()
|
||||
},
|
||||
cpuCores() {
|
||||
return os.cpus().length
|
||||
},
|
||||
ramTotal() {
|
||||
return filesize(os.totalmem())
|
||||
},
|
||||
workingDirectory() {
|
||||
return process.cwd()
|
||||
},
|
||||
nodeVersion() {
|
||||
return process.version.substr(1)
|
||||
},
|
||||
redisVersion() {
|
||||
return WIKI.redis.serverInfo.redis_version
|
||||
},
|
||||
redisUsedRAM() {
|
||||
return WIKI.redis.serverInfo.used_memory_human
|
||||
},
|
||||
redisTotalRAM() {
|
||||
return _.get(WIKI.redis.serverInfo, 'total_system_memory_human', 'N/A')
|
||||
},
|
||||
redisHost() {
|
||||
return WIKI.redis.options.host
|
||||
},
|
||||
async groupsTotal() {
|
||||
const total = await WIKI.models.groups.query().count('* as total').first().pluck('total')
|
||||
return _.toSafeInteger(total)
|
||||
},
|
||||
async pagesTotal() {
|
||||
const total = await WIKI.models.pages.query().count('* as total').first().pluck('total')
|
||||
return _.toSafeInteger(total)
|
||||
},
|
||||
async usersTotal() {
|
||||
const total = await WIKI.models.users.query().count('* as total').first().pluck('total')
|
||||
return _.toSafeInteger(total)
|
||||
}
|
||||
},
|
||||
SystemMutation: { }
|
||||
}
|
||||
}
|
||||
|
@@ -37,15 +37,18 @@ type SystemInfo {
|
||||
dbHost: String
|
||||
dbType: String
|
||||
dbVersion: String
|
||||
groupsTotal: Int
|
||||
hostname: String
|
||||
latestVersion: String
|
||||
latestVersionReleaseDate: Date
|
||||
nodeVersion: String
|
||||
operatingSystem: String
|
||||
pagesTotal: Int
|
||||
ramTotal: String
|
||||
redisHost: String
|
||||
redisTotalRAM: String
|
||||
redisUsedRAM: String
|
||||
redisVersion: String
|
||||
usersTotal: Int
|
||||
workingDirectory: String
|
||||
}
|
||||
|
Reference in New Issue
Block a user