| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722 |
- <template>
- <div class="data-disk">
- <template v-if="dataDisks.length === 0 && (disabled || imageType === 'backup' || imageType === 'snapshot')"><span class="warning-color">{{$t('compute.text_128')}}</span></template>
- <template v-else>
- <div class="d-flex" v-for="(item, i) in dataDisks" :key="item.key">
- <disk
- :ref="'disks'"
- :diskKey="item.key"
- :max="max(i)"
- :min="item.min || min(i)"
- :form="form"
- :schedtagParams="getSchedtagParams()"
- :snapshots-params="getSnapshotsParams"
- :diskTypeLabel="getDiskTypeLabel(i, diskTypeLabel)"
- :decorator="genDecorator(item.key)"
- :hypervisor="hypervisor"
- :types-map="typesMap"
- :elements="elements"
- :disabled="getDisabled(item)"
- :size-disabled="item.sizeDisabled"
- :simplify="simplify"
- :storageParams="storageParams"
- :storageHostParams="storageHostParams"
- :isStorageShow="isStorageShow"
- :isIopsShow="isIopsShow"
- :isThroughputShow="isThroughputShow"
- :defaultIops="item.iops"
- :defaultThroughput="item.throughput"
- :iopsLimit="iopsLimit[item.key]"
- :isAutoResetShow="isAutoResetShow"
- :imageType="imageType"
- @snapshotChange="val => snapshotChange(item, val, i)"
- @diskTypeChange="val => diskTypeChange(item, val, i)"
- @storageHostChange="(val) => $emit('storageHostChange', val)" />
- <a-button v-if="!getDisabled(item, 'minus') && (dataDisks.length > 1 ? (i !== 0) : true) && isAddDiskShow" shape="circle" icon="minus" size="small" @click="decrease(item.key)" class="mt-2" />
- </div>
- <div class="d-flex align-items-center" v-if="diskRemain > 0 && !disabled && isAddDiskShow && imageType !== 'backup' && imageType !== 'snapshot'">
- <a-button type="primary" shape="circle" icon="plus" size="small" @click="add" />
- <a-button type="link" @click="add">{{$t('compute.text_129')}}</a-button>
- <span class="count-tips">{{$t('compute.text_130')}}<span class="remain-num">{{ diskRemain }}</span>{{$t('compute.text_131')}}</span>
- </div>
- </template>
- </div>
- </template>
- <script>
- import _ from 'lodash'
- import * as R from 'ramda'
- import Disk from '@Compute/sections/Disk'
- import { MEDIUM_MAP } from '@Compute/constants'
- import { STORAGE_TYPES } from '@/constants/compute'
- import { HYPERVISORS_MAP } from '@/constants'
- import { uuid, findAndUnshift, findAndPush } from '@/utils/utils'
- import { diskSupportTypeMedium, getOriginDiskKey } from '@/utils/common/hypervisor'
- // 磁盘最小值
- const DISK_MIN_SIZE = 10
- export default {
- name: 'dataDisk',
- components: {
- Disk,
- },
- props: {
- form: {
- type: Object,
- required: true,
- validator: val => val.fc,
- },
- type: {
- type: String,
- required: true,
- validator: val => ['idc', 'private', 'public'].includes(val),
- },
- hypervisor: {
- type: String,
- required: true,
- },
- sku: {
- type: Object,
- },
- simplify: {
- type: Boolean,
- default: false,
- },
- capabilityData: {
- type: Object,
- required: true,
- },
- decorator: {
- type: Object,
- required: true,
- validator: val => {
- const fields = ['type', 'size', 'schedtag', 'policy', 'snapshot', 'filetype', 'mountPath']
- return fields.every(f => R.is(Function, val[f]))
- },
- },
- disabled: {
- type: Boolean,
- default: false,
- },
- isHostImageType: {
- type: Boolean,
- default: false,
- },
- isSnapshotImageType: {
- type: Boolean,
- default: false,
- },
- domain: {
- type: String,
- default: 'default',
- },
- isWindows: {
- type: Boolean,
- default: false,
- },
- enableMointpoint: { // 允许支持挂载点(目前仅新建oncloud支持)
- type: Boolean,
- default: false, // 默认不支持挂载点
- },
- defaultType: {
- type: Object,
- },
- isStorageShow: {
- type: Boolean,
- default: false,
- },
- storageParams: {
- type: Object,
- },
- storageHostParams: Object,
- isIopsShow: {
- type: Boolean,
- default: false,
- },
- isThroughputShow: {
- type: Boolean,
- default: false,
- },
- isServertemplate: {
- type: Boolean,
- default: false,
- },
- isVminstanceContainer: {
- type: Boolean,
- default: false,
- },
- isAutoResetShow: {
- type: Boolean,
- default: false,
- },
- forceElements: {
- type: Array,
- },
- isAddDiskShow: {
- type: Boolean,
- default: true,
- },
- forceSizeDisabled: {
- type: Boolean,
- default: false,
- },
- imageType: {
- type: String,
- },
- isInitForm: {
- type: Boolean,
- default: false,
- },
- },
- data () {
- return {
- dataDisks: [],
- }
- },
- computed: {
- isPublic () {
- return this.type === 'public'
- },
- isPrivate () {
- return this.type === 'private'
- },
- isIDC () {
- return this.type === 'idc'
- },
- isAws () {
- return this.hypervisor === HYPERVISORS_MAP.aws.key
- },
- elements () {
- const ret = []
- if (this.forceElements) return this.forceElements
- if (this.isSnapshotImageType) return ret
- if (this.isHostImageType) return ['snapshot', 'schedtag']
- if (this.isVminstanceContainer) return ['storage', 'schedtag']
- if (this.enableMointpoint) {
- if (!this.isWindows) {
- if (this.hypervisor === HYPERVISORS_MAP.kvm.key) {
- ret.push('mount-point')
- }
- }
- }
- if (this.hypervisor === HYPERVISORS_MAP.kvm.key) {
- ret.push('snapshot')
- }
- if (this.form.fd.hypervisor === HYPERVISORS_MAP.esxi.key ||
- this.hypervisor === HYPERVISORS_MAP.esxi.key ||
- this.form.fd.hypervisor === HYPERVISORS_MAP.kvm.key ||
- this.hypervisor === HYPERVISORS_MAP.kvm.key) {
- ret.push('storage') // vmware,kvm支持指定存储
- }
- if (this.isIDC || this.isPrivate) {
- // if (this.isStorageShow) {
- // return ret // 指定块存储后,系统盘和数据盘均确定且不在支持设置调度标签
- // } else {
- ret.push('schedtag')
- // }
- }
- if (this.isAws && !this.isServertemplate) {
- if (this.currentTypeObj()?.key === 'gp3') {
- ret.push('iops', 'throughput')
- }
- if (this.currentTypeObj()?.key === 'io1') {
- ret.push('iops')
- }
- }
- return ret
- },
- iopsLimit () {
- const value = {}
- if (!this.isAws || this.isServertemplate) return value
- this.dataDisks.map(item => {
- const type = item.diskType?.key
- let ret = { min: 0 }
- // gp3 iops 不能超过磁盘500倍
- if (type === 'gp3') {
- ret = { min: 3000, max: 16000 }
- if (this.form.fd.dataDiskSizes?.[item.key]) {
- ret.max = this.form.fd.dataDiskSizes?.[item.key] * 500 < ret.max ? this.form.fd.dataDiskSizes?.[item.key] * 500 : ret.max
- }
- }
- // io1 iops 不能超过磁盘50倍
- if (type === 'io1') {
- ret = { min: 100, max: 64000 }
- if (this.form.fd.dataDiskSizes?.[item.key]) {
- ret.max = this.form.fd.dataDiskSizes?.[item.key] * 50 < ret.max ? this.form.fd.dataDiskSizes?.[item.key] * 50 : ret.max
- }
- }
- value[item.key] = ret
- })
- return value
- },
- typesMap () {
- const ret = {}
- const hyper = this.getHypervisor()
- const hypervisorDisks = { ...STORAGE_TYPES[hyper] } || {}
- if (!this.capabilityData || !this.capabilityData.data_storage_types2) return ret
- let currentTypes = this.capabilityData.data_storage_types2[hyper] || []
- if (!R.isNil(this.sku) && !R.isEmpty(this.sku)) {
- if (this.sku.data_disk_types) {
- const skuDiskTypes = this.sku.data_disk_types.split(',')
- if (skuDiskTypes && skuDiskTypes.length) {
- currentTypes = currentTypes.filter(val => {
- const type = val.split('/')[0]
- return skuDiskTypes.includes(type)
- })
- }
- } else {
- for (const obj in hypervisorDisks) {
- if (hypervisorDisks[obj].skuFamily && !hypervisorDisks[obj].skuFamily.includes(this.sku.instance_type_family)) {
- delete hypervisorDisks[obj]
- }
- }
- }
- } else {
- if (this.isPublic) {
- currentTypes = []
- }
- }
- if (hyper === HYPERVISORS_MAP.openstack.key) { // 前端特殊处理:openstack数据盘不支持 nova
- currentTypes = currentTypes.filter(val => {
- const types = val.split('/')
- if (types.length > 0) {
- return types[0] !== 'nova'
- }
- return true
- })
- }
- if (currentTypes.find(val => val.includes('local'))) {
- if (this.hypervisor === HYPERVISORS_MAP.google.key) {
- currentTypes = findAndPush(currentTypes, item => item.includes('local'))
- } else {
- currentTypes = findAndUnshift(currentTypes, item => item.includes('local'))
- }
- }
- for (let i = 0, len = currentTypes.length; i < len; i++) {
- const typeItemArr = currentTypes[i].split('/')
- const type = typeItemArr[0]
- const medium = typeItemArr[1]
- let opt = hypervisorDisks[type] || this.getExtraDiskOpt(type)
- // 磁盘区分介质
- if (diskSupportTypeMedium(hyper)) {
- opt = {
- ...opt,
- key: `${type}/${medium}`,
- label: `${opt.label}(${MEDIUM_MAP[medium]})`,
- }
- }
- if (opt) {
- const min = Math.max(DISK_MIN_SIZE, opt.min)
- let max = opt.max
- // 谷歌云共享核心磁盘最多为3072GB
- if (hyper === HYPERVISORS_MAP.google.key && this.sku && ['e2-micro', 'e2-small', 'e2-medium', 'f1-micro', 'g1-small'].includes(this.sku.name)) {
- max = 3072
- }
- if (opt) {
- ret[opt.key] = {
- ...opt,
- min,
- medium,
- max: max,
- }
- }
- }
- }
- // if (this.isIDC && this.hypervisor !== HYPERVISORS_MAP.kvm.key) {
- // ret[STORAGE_AUTO.key] = STORAGE_AUTO
- // }
- if (this.hypervisor === HYPERVISORS_MAP.qcloud.key) {
- delete ret.local_nvme
- delete ret.local_pro
- }
- return ret
- },
- diskRemain () {
- const remain = this.capabilityData.max_data_disk_count - this.dataDisks.length
- return Math.max(remain, 0)
- },
- diskTypeLabel () {
- return _.get(this.dataDisks, '[0].diskType.label')
- },
- getSnapshotsParams () {
- const staticParams = {
- with_meta: true,
- cloud_env: 'onpremise',
- limit: 0,
- disk_type: 'data',
- is_instance_snapshot: false,
- $t: uuid(),
- status: 'ready',
- os_arch: this.form.fd.os_arch,
- }
- const scopeParams = {}
- if (this.$store.getters.isAdminMode) {
- scopeParams.project_domain = this.domain
- } else {
- scopeParams.scope = this.$store.getters.scope
- }
- let diskTypeKey = _.get(this.dataDisks, '[0].diskType.key')
- const hypervisor = _.get(this.form.fd, 'hypervisor')
- if (diskTypeKey) {
- // 磁盘区分介质
- if (diskSupportTypeMedium(hypervisor)) {
- diskTypeKey = getOriginDiskKey(diskTypeKey)
- }
- staticParams['joint_filter.0'] = `storages.id(storage_id).storage_type.equals(${diskTypeKey})`
- }
- return {
- ...staticParams,
- ...scopeParams,
- }
- },
- },
- watch: {
- typesMap (v, oldV) {
- if (!R.equals(v, oldV)) {
- if (this.dataDisks && this.dataDisks.length) {
- this.dataDisks.forEach((disk, index) => {
- this.form.fc.setFieldsValue({
- [`dataDiskSizes[${disk.key}]`]: Math.max((disk.value || 0), this.min(index)),
- })
- if (this.isInitForm) return
- if (!disk.disabled) this.decrease(disk.key)
- })
- }
- }
- },
- defaultType (v, oldV) {
- // vmware系统盘改变清空数据盘,忽略调整配置初始化的情况
- if (this.getHypervisor() === HYPERVISORS_MAP.esxi.key && oldV && oldV.label) {
- this.dataDisks = []
- }
- },
- },
- methods: {
- currentTypeObj (index = 0) {
- // 非阿里云 数据盘仅第一块盘的磁盘类型可以修改
- const diskTypeKey = _.get(this.dataDisks, `[${index}].diskType.key`)
- if (diskTypeKey) {
- return this.typesMap[diskTypeKey]
- }
- if (!R.isNil(this.typesMap) && !R.isEmpty(this.typesMap)) {
- const firstKey = Object.keys(this.typesMap)[0]
- return this.typesMap[firstKey]
- }
- return {}
- },
- currentDiskCapability (index = 0) {
- if (this.hypervisor !== HYPERVISORS_MAP.kvm.key) return {}
- const instance_capabilities = this.capabilityData.instance_capabilities || []
- const storages = instance_capabilities.find(item => item.hypervisor === this.hypervisor)?.storages || {}
- const data_disk = storages.data_disk || []
- const currentDisk = data_disk.find(item => this.currentTypeObj(index).key?.startsWith(item.storage_type))
- return currentDisk
- },
- max (index = 0) {
- return this.currentDiskCapability(index)?.max_size_gb || this.currentTypeObj(index)?.max || DISK_MIN_SIZE
- },
- min (index = 0) {
- return this.currentDiskCapability(index)?.min_size_gb || this.currentTypeObj(index)?.min || DISK_MIN_SIZE
- },
- getDisabled (item, itemName) {
- if (item.disabled) return true
- if (itemName && item[`${itemName}Disabled`]) {
- return true // 这里目前仅针对 minus 按钮
- }
- return this.disabled
- },
- genDecorator (uid) {
- const ret = {}
- R.forEachObjIndexed((item, key) => {
- ret[key] = item(uid)
- }, this.decorator)
- return ret
- },
- decrease (key) {
- const index = this.dataDisks.findIndex(val => val.key === key)
- this.dataDisks.splice(index, 1)
- this.$nextTick(() => {
- if (index === 0 && this.dataDisks.length > 0) {
- const key = `dataDiskTypes[${this.dataDisks[0].key}]`
- const defaultKey = Object.keys(this.typesMap)[0]
- if (defaultKey) {
- const dataDiskTypes = {
- key: this.typesMap[defaultKey].key,
- label: this.typesMap[defaultKey].label,
- }
- this.form.fc.setFieldsValue({
- [key]: dataDiskTypes,
- })
- }
- }
- const formValue = this.form.fc.getFieldsValue()
- if (this.form.fd) { // 如果上层表单有fd时,需要在此同步数据(外层监听不到减少表单的情况)
- this.form.fd.dataDiskSizes = formValue.dataDiskSizes || {}
- }
- })
- },
- add ({ size, diskType, policy, schedtag, snapshot, filetype, mountPath, min, disabled = false, sizeDisabled = false, medium, preallocation, autoReset, ...ret } = {}) {
- const key = uuid()
- let newDiskType = diskType
- // 磁盘区分介质
- if (this.hypervisor && diskSupportTypeMedium(this.hypervisor) && medium) {
- newDiskType = `${diskType}/${medium}`
- }
- const typeObj = this.typesMap[newDiskType]
- const idx = this.dataDisks?.length || 0
- let dataDiskTypes = {
- key: _.get(this.dataDisks, '[0].diskType.key'),
- label: _.get(this.dataDisks, '[0].diskType.label'),
- index: idx,
- }
- if (R.is(Object, typeObj)) { // 传入diskType,回填
- dataDiskTypes = {
- key: typeObj.key || diskType,
- label: typeObj.label || diskType,
- index: idx,
- }
- } else if (!diskType && !_.get(this.dataDisks, '[0].diskType')) { // 表单中数据盘无第一项,需要 set 磁盘类型默认值
- const defaultKey = Object.keys(this.typesMap)[0]
- if (R.is(Object, this.defaultType) && this.defaultType.key && this.defaultType.label && this.typesMap[this.defaultType.key]) {
- dataDiskTypes = {
- ...this.defaultType,
- index: idx,
- }
- } else if (defaultKey) {
- dataDiskTypes = {
- key: this.typesMap[defaultKey].key,
- label: this.typesMap[defaultKey].label,
- index: idx,
- }
- }
- }
- const dataDiskItem = {
- key,
- disabled,
- sizeDisabled,
- diskType: dataDiskTypes,
- ...ret, // 目前仅用于 minus 按钮
- }
- if (min) {
- dataDiskItem.min = Math.max(min, this.min(idx), DISK_MIN_SIZE)
- }
- this.dataDisks.push(dataDiskItem)
- this.$nextTick(() => {
- const configs = {}
- const value = {
- [`dataDiskSizes[${key}]`]: R.is(Number, size) ? size : (min || this.min(idx)),
- }
- value[`dataDiskTypes[${key}]`] = dataDiskTypes
- if (schedtag) { // 磁盘调度标签
- configs.showAdvanced = true
- configs.showSchedtag = true
- value[`dataDiskSchedtags[${key}]`] = schedtag
- }
- if (policy) { // 磁盘调度策略
- value[`dataDiskPolicys[${key}]`] = policy
- configs.showAdvanced = true
- configs.showSchedtag = true
- }
- if (snapshot && (filetype || mountPath)) {
- console.error(this.$t('compute.text_132'))
- }
- if (snapshot) { // 磁盘快照
- value[`dataDiskSnapshots[${key}]`] = snapshot
- configs.showAdvanced = true
- configs.showSnapshot = true
- }
- if (filetype) { // 磁盘文件系统
- value[`dataDiskFiletypes[${key}]`] = filetype
- configs.showAdvanced = true
- configs.showMountpoint = true
- }
- if (mountPath) { // 磁盘挂载路径
- value[`dataDiskMountPaths[${key}]`] = mountPath
- configs.showAdvanced = true
- configs.showMountpoint = true
- }
- if (autoReset) {
- value[`dataDiskAutoReset[${key}]`] = autoReset
- configs.showAdvanced = true
- configs.isAutoResetShow = true
- }
- if (this.getHypervisor() === HYPERVISORS_MAP.esxi.key) {
- value[`dataDiskPreallocation[${key}]`] = preallocation
- configs.showAdvanced = true
- configs.showPreallocation = true
- }
- if (configs.showAdvanced) {
- setTimeout(() => {
- this.$refs.disks[this.dataDisks.findIndex(val => val.key === key)].setValues(configs)
- setTimeout(() => {
- this.form.fc.setFieldsValue(value)
- }, 1000)
- this.setDiskMedium(dataDiskTypes)
- }, 1000)
- } else {
- this.form.fc.setFieldsValue(value)
- this.setDiskMedium(dataDiskTypes)
- }
- })
- },
- getExtraDiskOpt (type) {
- // 腾讯云过滤掉local_basic和local_ssd类型的盘
- if (this.getHypervisor() === HYPERVISORS_MAP.qcloud.key) {
- if (['local_basic', 'local_ssd'].includes(type)) {
- return
- }
- }
- // VMware过滤掉rbd类型的盘
- if (this.getHypervisor() === HYPERVISORS_MAP.esxi.key) {
- if (['rbd'].includes(type)) {
- return
- }
- }
- return {
- label: `${type}`,
- key: `${type}`,
- min: 1,
- max: 3 * 1024,
- sysMin: 10,
- sysMax: 500,
- }
- },
- getHypervisor () {
- let ret = this.hypervisor
- if (this.isPublic) {
- if (this.sku && this.sku.provider) {
- ret = this.sku.provider.toLowerCase()
- }
- }
- return ret
- },
- getSchedtagParams () {
- const params = {
- with_meta: true,
- resource_type: 'storages',
- limit: 0,
- }
- const scopeParams = {}
- if (this.$store.getters.isAdminMode) {
- scopeParams.project_domain = this.domain
- } else {
- scopeParams.scope = this.$store.getters.scope
- }
- return {
- ...params,
- ...scopeParams,
- }
- },
- diskTypeChange (item, val) {
- if (!this.forceSizeDisabled) {
- item.sizeDisabled = false
- }
- // 非阿里云 仅第一块盘可以更改磁盘类型
- if (this.getHypervisor() !== HYPERVISORS_MAP.aliyun.key) {
- this.$nextTick(() => {
- if (!this.forceSizeDisabled) {
- const dataDiskItem = {
- ...item,
- diskType: val,
- }
- if (item.min) {
- dataDiskItem.min = Math.max(item.min, this.min(0))
- }
- this.$set(this.dataDisks, 0, dataDiskItem)
- this.form.fc.setFieldsValue({
- [`dataDiskSizes[${item.key}]`]: Math.max((dataDiskItem.min || 0), this.min(0)),
- })
- }
- // 数据盘更改类型
- if (val.key !== item.diskType?.key) {
- const { dataDiskSizes = {} } = this.form.fd
- for (const diskId in dataDiskSizes) {
- const curDiskType = this.form.fd[`dataDiskTypes[${diskId}]`]
- if (curDiskType) {
- this.form.fc.setFieldsValue({
- [`dataDiskTypes[${diskId}]`]: { ...val, index: curDiskType?.index },
- })
- }
- }
- }
- this.setDiskMedium(val)
- })
- } else {
- this.$nextTick(() => {
- if (!this.forceSizeDisabled) {
- const dataDiskItem = {
- ...item,
- diskType: val,
- }
- const index = this.dataDisks.findIndex(val => val.key === item.key)
- if (item.min) {
- dataDiskItem.min = Math.max(item.min, this.min(index))
- }
- this.$set(this.dataDisks, index || 0, dataDiskItem)
- this.form.fc.setFieldsValue({
- [`dataDiskSizes[${item.key}]`]: Math.max((dataDiskItem.min || 0), this.min(index)),
- })
- }
- // 数据盘更改类型
- if (val.key !== item.diskType?.key) {
- const { dataDiskSizes = {} } = this.form.fd
- for (const diskId in dataDiskSizes) {
- const curDiskType = this.form.fd[`dataDiskTypes[${diskId}]`]
- if (curDiskType && diskId === val.key) {
- this.form.fc.setFieldsValue({
- [`dataDiskTypes[${diskId}]`]: { ...val, index: curDiskType?.index },
- })
- }
- }
- }
- this.setDiskMedium(val)
- })
- }
- },
- snapshotChange (item, val, i) {
- this.form.fc.setFieldsValue({
- [`dataDiskSizes[${item.key}]`]: val,
- })
- item.sizeDisabled = true
- },
- setDiskMedium (v) {
- if (this.form.fi) {
- this.$set(this.form.fi, 'dataDiskMedium', _.get(this.typesMap, `[${v.key}].medium`))
- }
- },
- getDiskTypeLabel (i, diskTypeLabel) {
- if (this.getHypervisor() === HYPERVISORS_MAP.esxi.key) {
- return this.$te(`common.storage.${diskTypeLabel}`) ? this.$t(`common.storage.${diskTypeLabel}`) : diskTypeLabel
- }
- if (i === 0 || this.getHypervisor() === HYPERVISORS_MAP.aliyun.key) {
- return ''
- }
- if (this.$te(`common.storage.${diskTypeLabel}`)) {
- return this.$t(`common.storage.${diskTypeLabel}`)
- }
- if (_.get(this.typesMap, `[${diskTypeLabel}].label`)) {
- return _.get(this.typesMap, `[${diskTypeLabel}].label`)
- }
- return diskTypeLabel
- },
- isSomeLocal (types) {
- const localTypes = types.filter(item => item.indexOf('local') !== -1)
- return localTypes.length > 1
- },
- },
- }
- </script>
- <style lang="less" scoped>
- @import '~@/styles/less/theme';
- .data-disk {
- .count-tips {
- .remain-num {
- color: @primary-color;
- }
- }
- }
- </style>
|