|
| 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