diff --git a/resources/assets/scripts/components/dashboard/Dashboard.vue b/resources/assets/scripts/components/dashboard/Dashboard.vue index 54407544..587d3ddd 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 00000000..a4f09984 --- /dev/null +++ b/resources/assets/scripts/components/dashboard/ServerBox.vue @@ -0,0 +1,50 @@ + + + + + + + + + {{ server.name }} + + + + + {{ $t('dashboard.index.cpu_title') }} + + + {{ $t('dashboard.index.memory_title') }} + + + + + {{ resources.cpu > 0 ? resources.cpu : '—' }} + % + + + {{ resources.memory > 0 ? resources.memory : '—' }} + Mb + + + + + {{ server.node }} + {{ server.allocation.ip }}:{{ server.allocation.port }} + + + + + + +
{{ server.node }}
{{ server.allocation.ip }}:{{ server.allocation.port }}