Skip to content

Commit 291060a

Browse files
committed
infra: host config tab
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
1 parent 86a55ce commit 291060a

6 files changed

Lines changed: 171 additions & 10 deletions

File tree

ui/docs/api/apis.remaining

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,7 @@ deleteVpnConnection
3636
deleteVpnGateway
3737
findStoragePoolsForMigration
3838
listAffinityGroupTypes
39-
listDedicatedClusters
4039
listDedicatedGuestVlanRanges
41-
listDedicatedHosts
42-
listDedicatedPods
43-
listDedicatedZones
4440
listDeploymentPlanners
4541
listHostTags
4642
listInternalLoadBalancerElements
@@ -49,7 +45,6 @@ listLBHealthCheckPolicies
4945
listLoadBalancers
5046
listNetworkACLs
5147
listNetworkServiceProviders
52-
listOsCategories
5348
listPortableIpRanges
5449
listRegisteredServicePackages
5550
listStaticRoutes

ui/src/config/section/compute.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ export default {
3030
columns: [
3131
'name', 'state', 'instancename', 'ipaddress', 'cpunumber', 'cpuused', 'cputotal',
3232
{
33-
memoryused:
34-
(record) => {
33+
memoryused: (record) => {
3534
return record.memorykbs && record.memoryintfreekbs ? parseFloat(100.0 * (record.memorykbs - record.memoryintfreekbs) / record.memorykbs).toFixed(2) + '%' : '0.0%'
3635
}
3736
},

ui/src/config/section/infra/hosts.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,14 @@ export default {
2323
resourceType: 'Host',
2424
params: { type: 'routing' },
2525
columns: ['name', 'state', 'resourcestate', 'powerstate', 'ipaddress', 'hypervisor', 'instances', 'cpunumber', 'cputotalghz', 'cpuusedghz', 'cpuallocatedghz', 'memorytotalgb', 'memoryusedgb', 'memoryallocatedgb', 'networkread', 'networkwrite', 'clustername', 'zonename'],
26-
details: ['name', 'id', 'resourcestate', 'ipaddress', 'hypervisor', 'hypervisorversion', 'version', 'type', 'oscategoryname', 'hosttags', 'clustername', 'podname', 'zonename', 'created'],
26+
details: ['name', 'id', 'resourcestate', 'ipaddress', 'hypervisor', 'type', 'clustername', 'podname', 'zonename', 'disconnected', 'created'],
27+
tabs: [{
28+
name: 'details',
29+
component: () => import('@/components/view/DetailsTab.vue')
30+
}, {
31+
name: 'Config',
32+
component: () => import('@/views/infra/HostInfoTab.vue')
33+
}],
2734
related: [{
2835
name: 'vm',
2936
title: 'Instances',
@@ -42,7 +49,12 @@ export default {
4249
icon: 'edit',
4350
label: 'label.edit',
4451
dataView: true,
45-
args: ['hosttags', 'oscategoryid']
52+
args: ['hosttags', 'oscategoryid'],
53+
mapping: {
54+
oscategoryid: {
55+
api: 'listOsCategories'
56+
}
57+
}
4658
},
4759
{
4860
api: 'provisionCertificate',

ui/src/locales/en.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@
257257
"hypervisorSnapshotReserve": "Hypervisor Snapshot Reserve",
258258
"hypervisorsnapshotreserve": "Hypervisor Snapshot Reserve",
259259
"hypervisortype": "Hypervisor",
260-
"hypervisorversion": "Hypervisor version",
260+
"hypervisorversion": "Hypervisor Version",
261261
"hypervnetworklabel": "HyperV Traffic Label",
262262
"icmp": "ICMP",
263263
"icmpcode": "ICMP Code",

ui/src/views/AutogenView.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -525,6 +525,9 @@ export default {
525525
526526
this.showAction = true
527527
for (const param of this.currentAction.paramFields) {
528+
if (param.type === 'list' && param.name === 'hosttags') {
529+
param.type = 'string'
530+
}
528531
if (param.type === 'uuid' || param.type === 'list' || param.name === 'account' || (this.currentAction.mapping && param.name in this.currentAction.mapping)) {
529532
this.listUuidOpts(param)
530533
}

ui/src/views/infra/HostInfoTab.vue

Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
18+
<template>
19+
<a-spin :spinning="fetchLoading">
20+
<a-list size="small">
21+
<a-list-item>
22+
<div>
23+
<strong>{{ $t('hypervisorversion') }}</strong>
24+
<div v-if="host.details">
25+
{{ host.hypervisor }}
26+
{{ host.details['Host.OS'] + ' ' + host.details['Host.OS.Version'] }}
27+
</div>
28+
</div>
29+
</a-list-item>
30+
<a-list-item v-if="host.details && host.details.secured">
31+
<div>
32+
<strong>{{ $t('Secured') }}</strong>
33+
<div>
34+
{{ host.details.secured }}
35+
</div>
36+
</div>
37+
</a-list-item>
38+
<a-list-item>
39+
<div>
40+
<strong>{{ $t('hosttags') }}</strong>
41+
<div>
42+
{{ host.hosttags }}
43+
</div>
44+
</div>
45+
</a-list-item>
46+
<a-list-item>
47+
<div>
48+
<strong>{{ $t('oscategoryid') }}</strong>
49+
<div>
50+
{{ host.oscategoryname }}
51+
</div>
52+
</div>
53+
</a-list-item>
54+
<a-list-item v-if="host.outofbandmanagement">
55+
<div>
56+
<strong>{{ $t('OOBM') }}</strong>
57+
<div>
58+
{{ host.outofbandmanagement.enabled }}
59+
</div>
60+
</div>
61+
</a-list-item>
62+
<a-list-item v-if="host.outofbandmanagement">
63+
<div>
64+
<strong>{{ $t('powerstate') }}</strong>
65+
<div>
66+
{{ host.outofbandmanagement.powerstate }}
67+
</div>
68+
</div>
69+
</a-list-item>
70+
<a-list-item v-if="host.hostha">
71+
<div>
72+
<strong>{{ $t('haenable') }}</strong>
73+
<div>
74+
{{ host.hostha.haenable }}
75+
</div>
76+
</div>
77+
</a-list-item>
78+
<a-list-item v-if="host.hostha">
79+
<div>
80+
<strong>{{ $t('hastate') }}</strong>
81+
<div>
82+
{{ host.hostha.hastate }}
83+
</div>
84+
</div>
85+
</a-list-item>
86+
<a-list-item v-if="host.hostha">
87+
<div>
88+
<strong>{{ $t('haprovider') }}</strong>
89+
<div>
90+
{{ host.hostha.haprovider }}
91+
</div>
92+
</div>
93+
</a-list-item>
94+
95+
</a-list>
96+
</a-spin>
97+
</template>
98+
99+
<script>
100+
import { api } from '@/api'
101+
102+
export default {
103+
name: 'HostInfoTab',
104+
props: {
105+
resource: {
106+
type: Object,
107+
required: true
108+
},
109+
loading: {
110+
type: Boolean,
111+
default: false
112+
}
113+
},
114+
data () {
115+
return {
116+
host: {},
117+
fetchLoading: false
118+
}
119+
},
120+
mounted () {
121+
this.fetchData()
122+
},
123+
watch: {
124+
loading (newData, oldData) {
125+
if (!newData && this.resource.id) {
126+
this.fetchData()
127+
}
128+
}
129+
},
130+
methods: {
131+
fetchData () {
132+
this.dataSource = []
133+
this.itemCount = 0
134+
this.fetchLoading = true
135+
api('listHosts', { id: this.resource.id }).then(json => {
136+
this.host = json.listhostsresponse.host[0]
137+
}).catch(error => {
138+
this.$notification.error({
139+
message: 'Request Failed',
140+
description: error.response.headers['x-description']
141+
})
142+
}).finally(() => {
143+
this.fetchLoading = false
144+
})
145+
}
146+
}
147+
}
148+
</script>
149+
150+
<style lang="less" scoped>
151+
152+
</style>

0 commit comments

Comments
 (0)