Improve instance hardware view

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
Ritchie Vincent 2020-01-09 16:31:54 +00:00 committed by Rohit Yadav
parent 78bb15c77b
commit 78d36e3840
2 changed files with 176 additions and 116 deletions

View File

@ -768,6 +768,7 @@ export default {
margin-right: 20px; margin-right: 20px;
overflow: hidden; overflow: hidden;
border-radius: 50%; border-radius: 50%;
min-width: 50px;
img { img {
height: 100%; height: 100%;
@ -788,7 +789,8 @@ export default {
} }
} }
.resource-detail-item { .resource-detail-item {
margin-bottom: 30px; margin-bottom: 20px;
word-break: break-word;
&__details { &__details {
display: flex; display: flex;

View File

@ -17,7 +17,7 @@
<template> <template>
<div> <div>
<a-collapse v-model="activeKey" :bordered="false"> <a-collapse v-model="activeKey">
<a-collapse-panel :header="'ISO: ' + vm.isoname" v-if="vm.isoid" key="1"> <a-collapse-panel :header="'ISO: ' + vm.isoname" v-if="vm.isoid" key="1">
<a-list <a-list
@ -41,18 +41,19 @@
<a-collapse-panel :header="'Disks: ' + volumes.length" key="2"> <a-collapse-panel :header="'Disks: ' + volumes.length" key="2">
<a-list <a-list
size="small" size="small"
itemLayout="horizontal" itemLayout="vertical"
:dataSource="volumes" :dataSource="volumes"
> >
<a-list-item slot="renderItem" slot-scope="item"> <a-list-item slot="renderItem" slot-scope="item" class="list-item">
<a-list-item-meta> <a-list-item-meta>
<div slot="avatar"> <div slot="avatar">
<a-avatar> <a-avatar>
<a-icon type="hdd" /> <a-icon type="hdd" />
</a-avatar> </a-avatar>
</div> </div>
<div slot="title"> <div slot="title" class="title">
<router-link :to="{ path: '/volume/' + item.id }">{{ item.name }} </router-link> <router-link :to="{ path: '/volume/' + item.id }">{{ item.name }} </router-link>
<div class="tags">
<a-tag v-if="item.type"> <a-tag v-if="item.type">
{{ item.type }} {{ item.type }}
</a-tag> </a-tag>
@ -62,14 +63,27 @@
<a-tag v-if="item.provisioningtype"> <a-tag v-if="item.provisioningtype">
{{ item.provisioningtype }} {{ item.provisioningtype }}
</a-tag> </a-tag>
<br/> </div>
{{ $t('size') }}: {{ (item.size / (1024 * 1024 * 1024.0)).toFixed(2) }} GB<br/>
{{ $t('physicalsize') }}: {{ (item.physicalsize / (1024 * 1024 * 1024.0)).toFixed(4) }} GB<br/>
{{ $t('storagePool') }}: {{ item.storage }} ({{ item.storagetype }})<br/>
<a-icon type="barcode"/> {{ item.id }} <br/>
</div> </div>
</a-list-item-meta> </a-list-item-meta>
<div slot="actions" class="actions"> <div>
<a-divider class="divider-small" />
<div class="attribute">
<div class="label">{{ $t('size') }}</div>
<div>{{ (item.size / (1024 * 1024 * 1024.0)).toFixed(2) }} GB</div>
</div>
<div class="attribute">
<div class="label">{{ $t('physicalsize') }}</div>
<div>{{ (item.physicalsize / (1024 * 1024 * 1024.0)).toFixed(4) }} GB</div>
</div>
<div class="attribute">
<div class="label">{{ $t('storagePool') }}</div>
<div>{{ item.storage }} ({{ item.storagetype }})</div>
</div>
<div class="attribute">
<div class="label">{{ $t('id') }}</div>
<div><a-icon type="barcode"/> {{ item.id }}</div>
</div>
</div> </div>
</a-list-item> </a-list-item>
</a-list> </a-list>
@ -79,74 +93,24 @@
<a-button type="primary" @click="showAddModal" :loading="loadingNic"> <a-button type="primary" @click="showAddModal" :loading="loadingNic">
<a-icon type="plus"></a-icon> {{ $t('label.network.addVM') }} <a-icon type="plus"></a-icon> {{ $t('label.network.addVM') }}
</a-button> </a-button>
<a-divider class="divider-small" />
<a-list <a-list
size="small" size="small"
itemLayout="horizontal" itemLayout="vertical"
:dataSource="vm.nic" :dataSource="vm.nic"
class="list" class="list"
:loading="loadingNic" :loading="loadingNic"
> >
<a-list-item slot="renderItem" slot-scope="item" class="list__item"> <a-list-item slot="renderItem" slot-scope="item" class="list-item">
<a-list-item-meta> <a-list-item-meta>
<div slot="avatar"> <div slot="avatar">
<a-avatar slot="avatar"> <a-avatar slot="avatar">
<a-icon type="wifi" /> <a-icon type="wifi" />
</a-avatar> </a-avatar>
<br/>
<a-popconfirm
title="Please confirm that you would like to make this NIC the default for this VM."
@confirm="setAsDefault(item)"
okText="Yes"
cancelText="No"
>
<a-button
style="margin-top: 10px"
icon="arrow-right"
size="small"
shape="round" />
</a-popconfirm>
<br/>
<a-tooltip placement="right" v-if="item.type !== 'L2'">
<template slot="title">
{{ "Change IP Address" }}
</template>
<a-button
style="margin-top: 10px"
icon="swap"
size="small"
shape="round"
@click="editIpAddressNic = item.id; showUpdateIpModal = true" />
</a-tooltip>
<br/>
<a-tooltip placement="right" v-if="item.type !== 'L2'">
<template slot="title">
{{ "Manage Secondary IP Addresses" }}
</template>
<a-button
style="margin-top: 10px"
icon="environment"
size="small"
shape="round"
@click="fetchSecondaryIPs(item.id)" />
</a-tooltip>
<br/>
<a-popconfirm
:title="$t('message.network.removeNIC')"
@confirm="removeNIC(item)"
okText="Yes"
cancelText="No"
v-if="!item.isdefault"
>
<a-button
style="margin-top: 10px"
type="danger"
icon="delete"
size="small"
shape="round" />
</a-popconfirm>
</div> </div>
<div slot="title"> <div slot="title" class="title">
<router-link :to="{ path: '/guestnetwork/' + item.networkid }">{{ item.networkname }} </router-link> <router-link :to="{ path: '/guestnetwork/' + item.networkid }">{{ item.networkname }} </router-link>
<div class="tags">
<a-tag v-if="item.isdefault"> <a-tag v-if="item.isdefault">
{{ $t('default') }} {{ $t('default') }}
</a-tag> </a-tag>
@ -159,27 +123,82 @@
<a-tag v-if="item.isolationuri"> <a-tag v-if="item.isolationuri">
{{ item.isolationuri }} {{ item.isolationuri }}
</a-tag> </a-tag>
<br /> </div>
{{ $t('macaddress') }}: {{ item.macaddress }}<br/>
<span v-if="item.ipaddress">
{{ $t('IP Address') }}: {{ item.ipaddress }}
<br/>
</span>
<span v-if="item.secondaryip && item.type !== 'L2'">
{{ $t('Secondary IPs') }}: {{ item.secondaryip.map(x => x.ipaddress).join(', ') }}
<br/>
</span>
<span v-if="item.netmask">
{{ $t('netmask') }}: {{ item.netmask }}
<br/>
</span>
<span v-if="item.gateway">
{{ $t('gateway') }}: {{ item.gateway }}
<br/>
</span>
<a-icon type="barcode"/> {{ item.id }}
</div> </div>
</a-list-item-meta> </a-list-item-meta>
<div>
<a-divider class="divider-small" />
<div class="attribute">
<div class="label">{{ $t('macaddress') }}</div>
<div>{{ item.macaddress }}</div>
</div>
<div class="attribute" v-if="item.ipaddress">
<div class="label">{{ $t('IP Address') }}</div>
<div>{{ item.ipaddress }}</div>
</div>
<div class="attribute" v-if="item.secondaryip && item.type !== 'L2'">
<div class="label">{{ $t('Secondary IPs') }}</div>
<div>{{ item.secondaryip.map(x => x.ipaddress).join(', ') }}</div>
</div>
<div class="attribute" v-if="item.netmask">
<div class="label">{{ $t('netmask') }}</div>
<div>{{ item.netmask }}</div>
</div>
<div class="attribute" v-if="item.gateway">
<div class="label">{{ $t('gateway') }}</div>
<div>{{ item.gateway }}</div>
</div>
<div class="attribute">
<div class="label">{{ $t('id') }}</div>
<div><a-icon type="barcode"/> {{ item.id }}</div>
</div>
</div>
<div slot="actions" class="actions">
<a-popconfirm
title="Please confirm that you would like to make this NIC the default for this VM."
@confirm="setAsDefault(item)"
okText="Yes"
cancelText="No"
>
<a-button
icon="arrow-right"
size="small"
shape="round" />
</a-popconfirm>
<a-tooltip placement="right" v-if="item.type !== 'L2'">
<template slot="title">
{{ "Change IP Address" }}
</template>
<a-button
icon="swap"
size="small"
shape="round"
@click="editIpAddressNic = item.id; showUpdateIpModal = true" />
</a-tooltip>
<a-tooltip placement="right" v-if="item.type !== 'L2'">
<template slot="title">
{{ "Manage Secondary IP Addresses" }}
</template>
<a-button
icon="environment"
size="small"
shape="round"
@click="fetchSecondaryIPs(item.id)" />
</a-tooltip>
<a-popconfirm
:title="$t('message.network.removeNIC')"
@confirm="removeNIC(item)"
okText="Yes"
cancelText="No"
v-if="!item.isdefault"
>
<a-button
type="danger"
icon="delete"
size="small"
shape="round" />
</a-popconfirm>
</div>
</a-list-item> </a-list-item>
</a-list> </a-list>
</a-collapse-panel> </a-collapse-panel>
@ -643,25 +662,64 @@ export default {
.actions { .actions {
display: flex; display: flex;
margin-left: -24px;
button { button {
padding: 5px;
height: auto;
&:not(:last-child) { &:not(:last-child) {
margin-right: 10px; margin-right: 10px;
} }
} }
@media (min-width: 760px) { }
flex-direction: column;
margin-left: 24px;
button { .label {
&:not(:last-child) { font-weight: bold;
}
.attribute {
margin-bottom: 10px; margin-bottom: 10px;
margin-right: 0;
} }
.ant-tag {
padding: 4px 10px;
height: auto;
} }
.title {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
align-items: center;
a {
margin-right: 30px;
margin-bottom: 10px;
font-weight: bold;
} }
.ant-tag {
margin-bottom: 10px;
}
}
.ant-list-item-meta-title {
margin-bottom: -10px;
}
.divider-small {
margin-top: 20px;
margin-bottom: 20px;
}
.list-item {
&:not(:first-child) {
padding-top: 25px;
}
} }
</style> </style>