From bcd3b055dd836d3ec69b3e1eda662c2be3421ca0 Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Sat, 2 Jun 2018 17:41:06 -0700 Subject: [PATCH] Break out the server box into a component --- .../components/dashboard/Dashboard.vue | 47 ++++------------- .../components/dashboard/ServerBox.vue | 50 +++++++++++++++++++ 2 files changed, 60 insertions(+), 37 deletions(-) create mode 100644 resources/assets/scripts/components/dashboard/ServerBox.vue diff --git a/resources/assets/scripts/components/dashboard/Dashboard.vue b/resources/assets/scripts/components/dashboard/Dashboard.vue index 54407544f..587d3dddb 100644 --- a/resources/assets/scripts/components/dashboard/Dashboard.vue +++ b/resources/assets/scripts/components/dashboard/Dashboard.vue @@ -15,42 +15,12 @@ -
- -
-
-
-
-
- {{ server.name }} -
-
-
-
-
{{ $t('dashboard.index.cpu_title') }}
-
-
-
{{ $t('dashboard.index.memory_title') }}
-
-
-
-
- --- - % -
-
- --- - Mb -
-
-
-
-

{{ server.node }}

-

{{ server.allocation.ip }}:{{ server.allocation.port }}

-
-
-
-
+
@@ -59,15 +29,17 @@ import { ServerCollection } from '../../models/server'; import _ from 'lodash'; import Flash from '../Flash'; + import ServerBox from './ServerBox'; export default { name: 'dashboard', - components: { Flash }, + components: { ServerBox, Flash }, data: function () { return { loading: true, search: '', servers: new ServerCollection, + resources: {}, } }, @@ -92,6 +64,7 @@ .then(response => { this.servers = new ServerCollection; response.data.data.forEach(obj => { + this.resources[obj.attributes.uuid] = { cpu: 0, memory: 0 }; this.servers.add(obj.attributes); }); diff --git a/resources/assets/scripts/components/dashboard/ServerBox.vue b/resources/assets/scripts/components/dashboard/ServerBox.vue new file mode 100644 index 000000000..a4f099849 --- /dev/null +++ b/resources/assets/scripts/components/dashboard/ServerBox.vue @@ -0,0 +1,50 @@ + + +