1
0
mirror of https://github.com/misskey-dev/misskey synced 2024-12-02 16:58:49 +09:00
This commit is contained in:
syuilo 2017-06-12 02:05:23 +09:00
parent f2236c3c3b
commit d9c9a7f236
3 changed files with 50 additions and 9 deletions

View File

@ -44,12 +44,10 @@ module.exports = (params) => new Promise(async (res, rej) => {
version: version, version: version,
secure: config.https.enable, secure: config.https.enable,
machine: os.hostname(), machine: os.hostname(),
node: { os: os.platform(),
release: (process as any).release.name, node: process.version,
lts: (process as any).release.lts,
version: process.version
},
cpu: { cpu: {
model: os.cpus()[0].model,
cores: os.cpus().length cores: os.cpus().length
} }
}); });

View File

@ -18,7 +18,9 @@ export default function() {
total: os.totalmem(), total: os.totalmem(),
free: os.freemem() free: os.freemem()
}, },
disk disk,
os_uptime: os.uptime(),
process_uptime: process.uptime()
}); });
}); });
}, 1000); }, 1000);

View File

@ -6,7 +6,8 @@
<mk-server-home-widget-cpu if={ !initializing } show={ view == 1 } connection={ connection } meta={ meta }/> <mk-server-home-widget-cpu if={ !initializing } show={ view == 1 } connection={ connection } meta={ meta }/>
<mk-server-home-widget-memory if={ !initializing } show={ view == 2 } connection={ connection }/> <mk-server-home-widget-memory if={ !initializing } show={ view == 2 } connection={ connection }/>
<mk-server-home-widget-disk if={ !initializing } show={ view == 3 } connection={ connection }/> <mk-server-home-widget-disk if={ !initializing } show={ view == 3 } connection={ connection }/>
<mk-server-home-widget-info if={ !initializing } show={ view == 4 } connection={ connection } meta={ meta }/> <mk-server-home-widget-uptimes if={ !initializing } show={ view == 4 } connection={ connection }/>
<mk-server-home-widget-info if={ !initializing } show={ view == 5 } connection={ connection } meta={ meta }/>
<style> <style>
:scope :scope
display block display block
@ -76,7 +77,7 @@
this.toggle = () => { this.toggle = () => {
this.view++; this.view++;
if (this.view == 5) this.view = 0; if (this.view == 6) this.view = 0;
}; };
</script> </script>
</mk-server-home-widget> </mk-server-home-widget>
@ -213,6 +214,7 @@
<div> <div>
<p><i class="fa fa-microchip"></i>CPU</p> <p><i class="fa fa-microchip"></i>CPU</p>
<p>{ cores } Cores</p> <p>{ cores } Cores</p>
<p>{ model }</p>
</div> </div>
<style> <style>
:scope :scope
@ -247,6 +249,7 @@
</style> </style>
<script> <script>
this.cores = this.opts.meta.cpu.cores; this.cores = this.opts.meta.cpu.cores;
this.model = this.opts.meta.cpu.model;
this.connection = this.opts.connection; this.connection = this.opts.connection;
this.on('mount', () => { this.on('mount', () => {
@ -396,10 +399,48 @@
</script> </script>
</mk-server-home-widget-disk> </mk-server-home-widget-disk>
<mk-server-home-widget-uptimes>
<p>Uptimes</p>
<p>Process: { process.toFixed(0) }s</p>
<p>OS: { os.toFixed(0) }s</p>
<style>
:scope
display block
padding 10px 14px
> p
margin 0
font-size 12px
color #505050
&:first-child
font-weight bold
</style>
<script>
this.connection = this.opts.connection;
this.on('mount', () => {
this.connection.on('stats', this.onStats);
});
this.on('unmount', () => {
this.connection.off('stats', this.onStats);
});
this.onStats = stats => {
this.update({
process: stats.process_uptime,
os: stats.os_uptime
});
};
</script>
</mk-server-home-widget-uptimes>
<mk-server-home-widget-info> <mk-server-home-widget-info>
<p>Maintainer: <b>{ meta.maintainer }</b></p> <p>Maintainer: <b>{ meta.maintainer }</b></p>
<p>Machine: { meta.machine }</p> <p>Machine: { meta.machine }</p>
<p>Node: { meta.node.version }</p> <p>Node: { meta.node }</p>
<style> <style>
:scope :scope
display block display block