diff --git a/src/web/app/common/scripts/bytes-to-size.ts b/src/web/app/common/scripts/bytes-to-size.ts deleted file mode 100644 index 1d2b1e7ce3..0000000000 --- a/src/web/app/common/scripts/bytes-to-size.ts +++ /dev/null @@ -1,6 +0,0 @@ -export default (bytes, digits = 0) => { - const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB']; - if (bytes == 0) return '0Byte'; - const i = Math.floor(Math.log(bytes) / Math.log(1024)); - return (bytes / Math.pow(1024, i)).toFixed(digits).replace(/\.0+$/, '') + sizes[i]; -}; diff --git a/src/web/app/desktop/-tags/home-widgets/server.tag b/src/web/app/desktop/-tags/home-widgets/server.tag deleted file mode 100644 index 992517163a..0000000000 --- a/src/web/app/desktop/-tags/home-widgets/server.tag +++ /dev/null @@ -1,533 +0,0 @@ - - -

%fa:spinner .pulse .fw%%i18n:common.loading%

- - - - - - - - -
- - - - - - - - - - - - - - - - - CPU { cpuP }% - - - - - - - - - - - - - - - - MEM { memP }% - - - - - - - -
-

%fa:microchip%CPU

-

{ cores } Cores

-

{ model }

-
- - -
- - - -
-

%fa:flask%Memory

-

Total: { bytesToSize(total, 1) }

-

Used: { bytesToSize(used, 1) }

-

Free: { bytesToSize(free, 1) }

-
- - -
- - - -
-

%fa:R hdd%Storage

-

Total: { bytesToSize(total, 1) }

-

Available: { bytesToSize(available, 1) }

-

Used: { bytesToSize(used, 1) }

-
- - -
- - -

Uptimes

-

Process: { process ? process.toFixed(0) : '---' }s

-

OS: { os ? os.toFixed(0) : '---' }s

- - -
- - -

Maintainer: { meta.maintainer }

-

Machine: { meta.machine }

-

Node: { meta.node }

- - -
- - - - - - { (p * 100).toFixed(0) }% - - - - diff --git a/src/web/app/desktop/views/components/widgets/server.cpu-memory.vue b/src/web/app/desktop/views/components/widgets/server.cpu-memory.vue new file mode 100644 index 0000000000..00b3dc3af1 --- /dev/null +++ b/src/web/app/desktop/views/components/widgets/server.cpu-memory.vue @@ -0,0 +1,127 @@ + + + + + diff --git a/src/web/app/desktop/views/components/widgets/server.cpu.vue b/src/web/app/desktop/views/components/widgets/server.cpu.vue new file mode 100644 index 0000000000..337ff62cec --- /dev/null +++ b/src/web/app/desktop/views/components/widgets/server.cpu.vue @@ -0,0 +1,68 @@ + + + + + diff --git a/src/web/app/desktop/views/components/widgets/server.disk.vue b/src/web/app/desktop/views/components/widgets/server.disk.vue new file mode 100644 index 0000000000..c21c56290e --- /dev/null +++ b/src/web/app/desktop/views/components/widgets/server.disk.vue @@ -0,0 +1,76 @@ + + + + + diff --git a/src/web/app/desktop/views/components/widgets/server.info.vue b/src/web/app/desktop/views/components/widgets/server.info.vue new file mode 100644 index 0000000000..870baf1497 --- /dev/null +++ b/src/web/app/desktop/views/components/widgets/server.info.vue @@ -0,0 +1,25 @@ + + + + + diff --git a/src/web/app/desktop/views/components/widgets/server.memory.vue b/src/web/app/desktop/views/components/widgets/server.memory.vue new file mode 100644 index 0000000000..2afc627fd5 --- /dev/null +++ b/src/web/app/desktop/views/components/widgets/server.memory.vue @@ -0,0 +1,76 @@ + + + + + diff --git a/src/web/app/desktop/views/components/widgets/server.pie.vue b/src/web/app/desktop/views/components/widgets/server.pie.vue new file mode 100644 index 0000000000..45ca8101b7 --- /dev/null +++ b/src/web/app/desktop/views/components/widgets/server.pie.vue @@ -0,0 +1,61 @@ + + + + + diff --git a/src/web/app/desktop/views/components/widgets/server.uptimes.vue b/src/web/app/desktop/views/components/widgets/server.uptimes.vue new file mode 100644 index 0000000000..06713d83ce --- /dev/null +++ b/src/web/app/desktop/views/components/widgets/server.uptimes.vue @@ -0,0 +1,46 @@ + + + + + diff --git a/src/web/app/desktop/views/components/widgets/server.vue b/src/web/app/desktop/views/components/widgets/server.vue new file mode 100644 index 0000000000..5aa01fd4e8 --- /dev/null +++ b/src/web/app/desktop/views/components/widgets/server.vue @@ -0,0 +1,127 @@ + + + + + diff --git a/src/web/app/filters/bytes.ts b/src/web/app/filters/bytes.ts new file mode 100644 index 0000000000..3afb11e9ae --- /dev/null +++ b/src/web/app/filters/bytes.ts @@ -0,0 +1,8 @@ +import Vue from 'vue'; + +Vue.filter('bytes', (v, digits = 0) => { + const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB']; + if (v == 0) return '0Byte'; + const i = Math.floor(Math.log(v) / Math.log(1024)); + return (v / Math.pow(1024, i)).toFixed(digits).replace(/\.0+$/, '') + sizes[i]; +}); diff --git a/src/web/app/filters/index.ts b/src/web/app/filters/index.ts new file mode 100644 index 0000000000..16ff8c87a4 --- /dev/null +++ b/src/web/app/filters/index.ts @@ -0,0 +1 @@ +require('./bytes'); diff --git a/src/web/app/init.ts b/src/web/app/init.ts index 8abb7f7aa5..c3eede0d36 100644 --- a/src/web/app/init.ts +++ b/src/web/app/init.ts @@ -20,6 +20,9 @@ require('./common/views/directives'); // Register global components require('./common/views/components'); +// Register global filters +require('./filters'); + Vue.mixin({ destroyed(this: any) { if (this.$el.parentNode) {