feat: Host Information on System Info page
This commit is contained in:
parent
fc42fd21e5
commit
3752e95b92
@ -56,7 +56,7 @@ export default {
|
|||||||
},
|
},
|
||||||
upgradeStart() {
|
upgradeStart() {
|
||||||
this.$store.commit('modalUpgradeSystem/stepChange', 'running')
|
this.$store.commit('modalUpgradeSystem/stepChange', 'running')
|
||||||
this.$http.post('/admin/settings/install', {
|
this.$http.post('/admin/system/install', {
|
||||||
mode: this.mode
|
mode: this.mode
|
||||||
}).then(resp => {
|
}).then(resp => {
|
||||||
// todo
|
// todo
|
||||||
|
@ -10,6 +10,8 @@ const _ = require('lodash')
|
|||||||
const axios = require('axios')
|
const axios = require('axios')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
const fs = Promise.promisifyAll(require('fs-extra'))
|
const fs = Promise.promisifyAll(require('fs-extra'))
|
||||||
|
const os = require('os')
|
||||||
|
const filesize = require('filesize.js')
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Admin
|
* Admin
|
||||||
@ -238,6 +240,15 @@ router.get('/system', (req, res) => {
|
|||||||
return res.render('error-forbidden')
|
return res.render('error-forbidden')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let hostInfo = {
|
||||||
|
cpus: os.cpus(),
|
||||||
|
hostname: os.hostname(),
|
||||||
|
nodeversion: process.version,
|
||||||
|
os: `${os.type()} (${os.platform()}) ${os.release()} ${os.arch()}`,
|
||||||
|
totalmem: filesize(os.totalmem()),
|
||||||
|
cwd: process.cwd()
|
||||||
|
}
|
||||||
|
|
||||||
fs.readJsonAsync(path.join(ROOTPATH, 'package.json')).then(packageObj => {
|
fs.readJsonAsync(path.join(ROOTPATH, 'package.json')).then(packageObj => {
|
||||||
axios.get('https://api.github.com/repos/Requarks/wiki/releases/latest').then(resp => {
|
axios.get('https://api.github.com/repos/Requarks/wiki/releases/latest').then(resp => {
|
||||||
let sysversion = {
|
let sysversion = {
|
||||||
@ -246,10 +257,10 @@ router.get('/system', (req, res) => {
|
|||||||
latestPublishedAt: resp.data.published_at
|
latestPublishedAt: resp.data.published_at
|
||||||
}
|
}
|
||||||
|
|
||||||
res.render('pages/admin/system', { adminTab: 'system', sysversion })
|
res.render('pages/admin/system', { adminTab: 'system', hostInfo, sysversion })
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
winston.warn(err)
|
winston.warn(err)
|
||||||
res.render('pages/admin/system', { adminTab: 'system', sysversion: { current: 'v' + packageObj.version } })
|
res.render('pages/admin/system', { adminTab: 'system', hostInfo, sysversion: { current: 'v' + packageObj.version } })
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -23,7 +23,10 @@
|
|||||||
"users": "Users"
|
"users": "Users"
|
||||||
},
|
},
|
||||||
"settings": {
|
"settings": {
|
||||||
"subtitle": "Manage site configuration",
|
"subtitle": "Manage site configuration"
|
||||||
|
},
|
||||||
|
"system": {
|
||||||
|
"subtitle": "Information and utilities for your wiki",
|
||||||
"systemversion": "System Version",
|
"systemversion": "System Version",
|
||||||
"currentversion": "Current Version",
|
"currentversion": "Current Version",
|
||||||
"latestversion": "Latest Version",
|
"latestversion": "Latest Version",
|
||||||
@ -39,10 +42,14 @@
|
|||||||
"resetaccountsbtn": "Reset System Accounts",
|
"resetaccountsbtn": "Reset System Accounts",
|
||||||
"flushsessions": "Flush all active user sessions",
|
"flushsessions": "Flush all active user sessions",
|
||||||
"flushsessionstext": "All users will be logged out and forced to login again. Your current session will also be affected!",
|
"flushsessionstext": "All users will be logged out and forced to login again. Your current session will also be affected!",
|
||||||
"flushsessionsbtn": "Flush Sessions"
|
"flushsessionsbtn": "Flush Sessions",
|
||||||
},
|
"hostinfo": "Host Information",
|
||||||
"system": {
|
"os": "Operating System",
|
||||||
"subtitle": "Information and utilities for your wiki"
|
"nodeversion": "Node.js Version",
|
||||||
|
"hostname": "Hostname",
|
||||||
|
"cores": "CPU Cores",
|
||||||
|
"totalmem": "Total Memory",
|
||||||
|
"cwd": "Working Directory"
|
||||||
},
|
},
|
||||||
"theme": {
|
"theme": {
|
||||||
"subtitle": "Change the look and feel of your wiki",
|
"subtitle": "Change the look and feel of your wiki",
|
||||||
|
@ -9,30 +9,39 @@ block adminContent
|
|||||||
.form-sections
|
.form-sections
|
||||||
section
|
section
|
||||||
img(src='/images/logo.png', style={width:'200px', float:'right'})
|
img(src='/images/logo.png', style={width:'200px', float:'right'})
|
||||||
label.label= t('admin:settings.systemversion')
|
label.label= t('admin:system.systemversion')
|
||||||
.section-block
|
.section-block
|
||||||
p #{t('admin:settings.currentversion')}: #[strong= sysversion.current]
|
p #{t('admin:system.currentversion')}: #[strong= sysversion.current]
|
||||||
if sysversion.latest
|
if sysversion.latest
|
||||||
p #{t('admin:settings.latestversion')}: #[strong= sysversion.latest] #[em (Published #{moment(sysversion.latestPublishedAt).fromNow()})]
|
p #{t('admin:system.latestversion')}: #[strong= sysversion.latest] #[em (Published #{moment(sysversion.latestPublishedAt).fromNow()})]
|
||||||
p
|
p
|
||||||
if sysversion.current !== sysversion.latest
|
if sysversion.current !== sysversion.latest
|
||||||
button.button.is-deep-orange(@click='$store.dispatch("modalUpgradeSystem/open", { mode: "upgrade"})')= t('admin:settings.upgrade')
|
button.button.is-deep-orange(@click='$store.dispatch("modalUpgradeSystem/open", { mode: "upgrade"})')= t('admin:system.upgrade')
|
||||||
else
|
else
|
||||||
button.button.is-disabled= t('admin:settings.upgrade')
|
button.button.is-disabled= t('admin:system.upgrade')
|
||||||
button.button.is-deep-orange.is-outlined(@click='$store.dispatch("modalUpgradeSystem/open", { mode: "reinstall"})')= t('admin:settings.reinstall')
|
button.button.is-deep-orange.is-outlined(@click='$store.dispatch("modalUpgradeSystem/open", { mode: "reinstall"})')= t('admin:system.reinstall')
|
||||||
else
|
else
|
||||||
p: em= t('admin:settings.versioncheckfailed')
|
p: em= t('admin:system.versioncheckfailed')
|
||||||
section
|
section
|
||||||
label.label= t('admin:settings.administrativetools')
|
label.label= t('admin:system.hostinfo')
|
||||||
.section-block
|
.section-block
|
||||||
h6 #{t('admin:settings.flushcache')}:
|
p #{t('admin:system.os')}: #[strong= hostInfo.os]
|
||||||
p.is-small= t('admin:settings.flushcachetext')
|
p #{t('admin:system.nodeversion')}: #[strong= hostInfo.nodeversion]
|
||||||
p: button.button.is-teal.is-outlined(v-on:click='flushcache')= t('admin:settings.flushcachebtn')
|
p #{t('admin:system.hostname')}: #[strong= hostInfo.hostname]
|
||||||
h6 #{t('admin:settings.resetaccounts')}:
|
p #{t('admin:system.cores')}: #[strong= hostInfo.cpus.length]
|
||||||
p.is-small= t('admin:settings.resetaccountstext')
|
p #{t('admin:system.totalmem')}: #[strong= hostInfo.totalmem]
|
||||||
p: button.button.is-teal.is-outlined(v-on:click='resetaccounts')= t('admin:settings.resetaccountsbtn')
|
p #{t('admin:system.cwd')}: #[strong= hostInfo.cwd]
|
||||||
h6 #{t('admin:settings.flushsessions')}:
|
section
|
||||||
p.is-small= t('admin:settings.flushsessionstext')
|
label.label= t('admin:system.administrativetools')
|
||||||
p: button.button.is-teal.is-outlined(v-on:click='flushsessions')= t('admin:settings.flushsessionsbtn')
|
.section-block
|
||||||
|
h6 #{t('admin:system.flushcache')}:
|
||||||
|
p.is-small= t('admin:system.flushcachetext')
|
||||||
|
p: button.button.is-teal.is-outlined(v-on:click='flushcache')= t('admin:system.flushcachebtn')
|
||||||
|
h6 #{t('admin:system.resetaccounts')}:
|
||||||
|
p.is-small= t('admin:system.resetaccountstext')
|
||||||
|
p: button.button.is-teal.is-outlined(v-on:click='resetaccounts')= t('admin:system.resetaccountsbtn')
|
||||||
|
h6 #{t('admin:system.flushsessions')}:
|
||||||
|
p.is-small= t('admin:system.flushsessionstext')
|
||||||
|
p: button.button.is-teal.is-outlined(v-on:click='flushsessions')= t('admin:system.flushsessionsbtn')
|
||||||
|
|
||||||
modal-upgrade-system
|
modal-upgrade-system
|
||||||
|
Loading…
Reference in New Issue
Block a user