infra: host config tab

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
Rohit Yadav 2020-01-22 16:03:31 +05:30
parent 86a55ce30b
commit 291060afc3
6 changed files with 171 additions and 10 deletions

View File

@ -36,11 +36,7 @@ deleteVpnConnection
deleteVpnGateway
findStoragePoolsForMigration
listAffinityGroupTypes
listDedicatedClusters
listDedicatedGuestVlanRanges
listDedicatedHosts
listDedicatedPods
listDedicatedZones
listDeploymentPlanners
listHostTags
listInternalLoadBalancerElements
@ -49,7 +45,6 @@ listLBHealthCheckPolicies
listLoadBalancers
listNetworkACLs
listNetworkServiceProviders
listOsCategories
listPortableIpRanges
listRegisteredServicePackages
listStaticRoutes

View File

@ -30,8 +30,7 @@ export default {
columns: [
'name', 'state', 'instancename', 'ipaddress', 'cpunumber', 'cpuused', 'cputotal',
{
memoryused:
(record) => {
memoryused: (record) => {
return record.memorykbs && record.memoryintfreekbs ? parseFloat(100.0 * (record.memorykbs - record.memoryintfreekbs) / record.memorykbs).toFixed(2) + '%' : '0.0%'
}
},

View File

@ -23,7 +23,14 @@ export default {
resourceType: 'Host',
params: { type: 'routing' },
columns: ['name', 'state', 'resourcestate', 'powerstate', 'ipaddress', 'hypervisor', 'instances', 'cpunumber', 'cputotalghz', 'cpuusedghz', 'cpuallocatedghz', 'memorytotalgb', 'memoryusedgb', 'memoryallocatedgb', 'networkread', 'networkwrite', 'clustername', 'zonename'],
details: ['name', 'id', 'resourcestate', 'ipaddress', 'hypervisor', 'hypervisorversion', 'version', 'type', 'oscategoryname', 'hosttags', 'clustername', 'podname', 'zonename', 'created'],
details: ['name', 'id', 'resourcestate', 'ipaddress', 'hypervisor', 'type', 'clustername', 'podname', 'zonename', 'disconnected', 'created'],
tabs: [{
name: 'details',
component: () => import('@/components/view/DetailsTab.vue')
}, {
name: 'Config',
component: () => import('@/views/infra/HostInfoTab.vue')
}],
related: [{
name: 'vm',
title: 'Instances',
@ -42,7 +49,12 @@ export default {
icon: 'edit',
label: 'label.edit',
dataView: true,
args: ['hosttags', 'oscategoryid']
args: ['hosttags', 'oscategoryid'],
mapping: {
oscategoryid: {
api: 'listOsCategories'
}
}
},
{
api: 'provisionCertificate',

View File

@ -257,7 +257,7 @@
"hypervisorSnapshotReserve": "Hypervisor Snapshot Reserve",
"hypervisorsnapshotreserve": "Hypervisor Snapshot Reserve",
"hypervisortype": "Hypervisor",
"hypervisorversion": "Hypervisor version",
"hypervisorversion": "Hypervisor Version",
"hypervnetworklabel": "HyperV Traffic Label",
"icmp": "ICMP",
"icmpcode": "ICMP Code",

View File

@ -525,6 +525,9 @@ export default {
this.showAction = true
for (const param of this.currentAction.paramFields) {
if (param.type === 'list' && param.name === 'hosttags') {
param.type = 'string'
}
if (param.type === 'uuid' || param.type === 'list' || param.name === 'account' || (this.currentAction.mapping && param.name in this.currentAction.mapping)) {
this.listUuidOpts(param)
}

View File

@ -0,0 +1,152 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
<template>
<a-spin :spinning="fetchLoading">
<a-list size="small">
<a-list-item>
<div>
<strong>{{ $t('hypervisorversion') }}</strong>
<div v-if="host.details">
{{ host.hypervisor }}
{{ host.details['Host.OS'] + ' ' + host.details['Host.OS.Version'] }}
</div>
</div>
</a-list-item>
<a-list-item v-if="host.details && host.details.secured">
<div>
<strong>{{ $t('Secured') }}</strong>
<div>
{{ host.details.secured }}
</div>
</div>
</a-list-item>
<a-list-item>
<div>
<strong>{{ $t('hosttags') }}</strong>
<div>
{{ host.hosttags }}
</div>
</div>
</a-list-item>
<a-list-item>
<div>
<strong>{{ $t('oscategoryid') }}</strong>
<div>
{{ host.oscategoryname }}
</div>
</div>
</a-list-item>
<a-list-item v-if="host.outofbandmanagement">
<div>
<strong>{{ $t('OOBM') }}</strong>
<div>
{{ host.outofbandmanagement.enabled }}
</div>
</div>
</a-list-item>
<a-list-item v-if="host.outofbandmanagement">
<div>
<strong>{{ $t('powerstate') }}</strong>
<div>
{{ host.outofbandmanagement.powerstate }}
</div>
</div>
</a-list-item>
<a-list-item v-if="host.hostha">
<div>
<strong>{{ $t('haenable') }}</strong>
<div>
{{ host.hostha.haenable }}
</div>
</div>
</a-list-item>
<a-list-item v-if="host.hostha">
<div>
<strong>{{ $t('hastate') }}</strong>
<div>
{{ host.hostha.hastate }}
</div>
</div>
</a-list-item>
<a-list-item v-if="host.hostha">
<div>
<strong>{{ $t('haprovider') }}</strong>
<div>
{{ host.hostha.haprovider }}
</div>
</div>
</a-list-item>
</a-list>
</a-spin>
</template>
<script>
import { api } from '@/api'
export default {
name: 'HostInfoTab',
props: {
resource: {
type: Object,
required: true
},
loading: {
type: Boolean,
default: false
}
},
data () {
return {
host: {},
fetchLoading: false
}
},
mounted () {
this.fetchData()
},
watch: {
loading (newData, oldData) {
if (!newData && this.resource.id) {
this.fetchData()
}
}
},
methods: {
fetchData () {
this.dataSource = []
this.itemCount = 0
this.fetchLoading = true
api('listHosts', { id: this.resource.id }).then(json => {
this.host = json.listhostsresponse.host[0]
}).catch(error => {
this.$notification.error({
message: 'Request Failed',
description: error.response.headers['x-description']
})
}).finally(() => {
this.fetchLoading = false
})
}
}
}
</script>
<style lang="less" scoped>
</style>