mirror of
https://github.com/m1k1o/neko-rooms.git
synced 2026-11-02 22:51:34 -06:00
show room resources.
This commit is contained in:
@@ -222,6 +222,37 @@ export enum RoomMountTypeEnum {
|
||||
public = 'public'
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
* @interface RoomResources
|
||||
*/
|
||||
export interface RoomResources {
|
||||
/**
|
||||
* relative weight vs. other containers
|
||||
* @type {number}
|
||||
* @memberof RoomResources
|
||||
*/
|
||||
'cpu_shares'?: number;
|
||||
/**
|
||||
* in units of 10^-9 CPUs
|
||||
* @type {number}
|
||||
* @memberof RoomResources
|
||||
*/
|
||||
'nano_cpus'?: number;
|
||||
/**
|
||||
* in bytes
|
||||
* @type {number}
|
||||
* @memberof RoomResources
|
||||
*/
|
||||
'shm_size'?: number;
|
||||
/**
|
||||
* in bytes
|
||||
* @type {number}
|
||||
* @memberof RoomResources
|
||||
*/
|
||||
'memory'?: number;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
@@ -330,6 +361,12 @@ export interface RoomSettings {
|
||||
* @memberof RoomSettings
|
||||
*/
|
||||
'mounts'?: Array<RoomMount>;
|
||||
/**
|
||||
*
|
||||
* @type {RoomResources}
|
||||
* @memberof RoomSettings
|
||||
*/
|
||||
'resources'?: RoomResources;
|
||||
/**
|
||||
*
|
||||
* @type {BrowserPolicy}
|
||||
|
||||
@@ -156,6 +156,18 @@
|
||||
</template>
|
||||
</v-simple-table>
|
||||
|
||||
<div class="my-3 headline">Resources</div>
|
||||
<v-simple-table>
|
||||
<template v-slot:default>
|
||||
<tbody>
|
||||
<tr><th style="width:50%;"> CPU Shares </th><td :title="settings.resources.cpu_shares"><span v-if="settings.resources.cpu_shares">{{ settings.resources.cpu_shares | bytes }}</span><i v-else>--unlimited--</i></td></tr>
|
||||
<tr><th> Nano CPUs </th><td :title="settings.resources.nano_cpus"><span v-if="settings.resources.nano_cpus">{{ settings.resources.nano_cpus | bytes }}</span><i v-else>--unlimited--</i></td></tr>
|
||||
<tr><th> Shm Size </th><td :title="settings.resources.shm_size">{{ settings.resources.shm_size | bytes }}</td></tr>
|
||||
<tr><th> Memory </th><td :title="settings.resources.memory"><span v-if="settings.resources.memory">{{ settings.resources.memory | bytes }}</span><i v-else>--unlimited--</i></td></tr>
|
||||
</tbody>
|
||||
</template>
|
||||
</v-simple-table>
|
||||
|
||||
<div class="my-3 headline">Browser policy</div>
|
||||
<v-simple-table v-if="settings.browser_policy">
|
||||
<template v-slot:default>
|
||||
|
||||
@@ -19,3 +19,22 @@ Vue.filter('timeago', function(value: any) {
|
||||
Vue.filter('percent', function(value: any) {
|
||||
return (Math.floor(value * 10000) / 100) + '%'
|
||||
})
|
||||
|
||||
// eslint-disable-next-line
|
||||
Vue.filter('bytes', function(value: any) {
|
||||
if (Math.abs(value) < 1000) {
|
||||
return value + ' B';
|
||||
}
|
||||
|
||||
const units = ['K', 'M', 'G']
|
||||
let u = -1;
|
||||
const r = 10**2;
|
||||
|
||||
do {
|
||||
value /= 1000;
|
||||
++u;
|
||||
} while (Math.round(Math.abs(value) * r) / r >= 1000 && u < units.length - 1);
|
||||
|
||||
|
||||
return value.toFixed(2) + units[u];
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user