Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
Rohit Yadav 2020-03-27 15:39:53 +05:30
parent 30b74f51be
commit b8c054bac2
5 changed files with 19 additions and 222 deletions

View File

@ -24,8 +24,8 @@
>
<a-form-item
v-for="(item, index) in dataResource"
v-if="checkExistFields(item.resourcetypename)"
:key="index"
v-if="item.resourcetypename !== 'project'"
:v-bind="item.resourcetypename"
:label="getFieldLabel(item.resourcetypename)">
<a-input-number
@ -40,7 +40,7 @@
v-if="!disabled"
:loading="formLoading"
type="primary"
@click="handleSubmit">{{ this.$t('apply') }}</a-button>
@click="handleSubmit">{{ $t('submit') }}</a-button>
</div>
</a-form>
</a-spin>
@ -50,7 +50,7 @@
import { api } from '@/api'
export default {
name: 'ResourcesTab',
name: 'ResourceLimitTab',
props: {
resource: {
type: Object,
@ -64,10 +64,6 @@ export default {
type: Object,
default: () => {}
},
fields: {
type: Array,
default: () => []
},
disabled: {
type: Boolean,
default: false
@ -177,21 +173,8 @@ export default {
})
})
},
checkExistFields (resourcetypename) {
const fieldExists = this.fields.filter((item) => item.field === resourcetypename)
if (fieldExists && fieldExists.length > 0) {
return true
}
return false
},
getFieldLabel (resourcetypename) {
const field = this.fields.filter((item) => item.field === resourcetypename)
if (field && field.length > 0) {
return this.$t(field[0].title)
}
return resourcetypename
return this.$t('max' + resourcetypename.replace('_', ''))
}
}
}
@ -199,8 +182,6 @@ export default {
<style lang="less" scoped>
.card-footer {
text-align: right;
button + button {
margin-left: 8px;
}

View File

@ -182,54 +182,8 @@ export const asyncRouterMap = [
params: {
projectid: 'id'
},
fields: [
{
field: 'network',
title: 'maxnetwork'
},
{
field: 'volume',
title: 'maxvolume'
},
{
field: 'public_ip',
title: 'maxpublic_ip'
},
{
field: 'template',
title: 'maxtemplate'
},
{
field: 'user_vm',
title: 'maxuser_vm'
},
{
field: 'snapshot',
title: 'maxsnapshot'
},
{
field: 'vpc',
title: 'maxvpc'
},
{
field: 'cpu',
title: 'maxcpu'
},
{
field: 'memory',
title: 'maxmemory'
},
{
field: 'primary_storage',
title: 'maxprimary_storage'
},
{
field: 'secondary_storage',
title: 'maxsecondary_storage'
}
],
show: (record, route, user) => { return ['Admin'].includes(user.roletype) },
component: () => import('@/components/view/ResourcesTab.vue')
component: () => import('@/components/view/ResourceLimitTab.vue')
}
]
},

View File

@ -109,54 +109,8 @@ export default {
account: 'name',
domainid: 'domainid'
},
fields: [
{
field: 'network',
title: 'networkLimit'
},
{
field: 'volume',
title: 'volumeLimit'
},
{
field: 'public_ip',
title: 'ipLimit'
},
{
field: 'template',
title: 'templateLimit'
},
{
field: 'user_vm',
title: 'vmLimit'
},
{
field: 'snapshot',
title: 'snapshotLimit'
},
{
field: 'vpc',
title: 'vpcLimit'
},
{
field: 'cpu',
title: 'cpuLimit'
},
{
field: 'memory',
title: 'memoryLimit'
},
{
field: 'primary_storage',
title: 'primaryStorageLimit'
},
{
field: 'secondary_storage',
title: 'secondaryStorageLimit'
}
],
show: (record, route, user) => { return ['Admin'].includes(user.roletype) },
component: () => import('@/components/view/ResourcesTab.vue')
component: () => import('@/components/view/ResourceLimitTab.vue')
}
],
actions: [
@ -298,54 +252,8 @@ export default {
params: {
domainid: 'id'
},
fields: [
{
field: 'network',
title: 'networkLimit'
},
{
field: 'volume',
title: 'volumeLimit'
},
{
field: 'public_ip',
title: 'ipLimit'
},
{
field: 'template',
title: 'templateLimit'
},
{
field: 'user_vm',
title: 'vmLimit'
},
{
field: 'snapshot',
title: 'snapshotLimit'
},
{
field: 'vpc',
title: 'vpcLimit'
},
{
field: 'cpu',
title: 'cpuLimit'
},
{
field: 'memory',
title: 'memoryLimit'
},
{
field: 'primary_storage',
title: 'primaryStorageLimit'
},
{
field: 'secondary_storage',
title: 'secondaryStorageLimit'
}
],
show: (record, route, user) => { return ['Admin'].includes(user.roletype) },
component: () => import('@/components/view/ResourcesTab.vue')
component: () => import('@/components/view/ResourceLimitTab.vue')
}
],
treeView: true,

View File

@ -38,54 +38,8 @@ export default {
params: {
projectid: 'id'
},
fields: [
{
field: 'network',
title: 'maxnetwork'
},
{
field: 'volume',
title: 'maxvolume'
},
{
field: 'public_ip',
title: 'maxpublic_ip'
},
{
field: 'template',
title: 'maxtemplate'
},
{
field: 'user_vm',
title: 'maxuser_vm'
},
{
field: 'snapshot',
title: 'maxsnapshot'
},
{
field: 'vpc',
title: 'maxvpc'
},
{
field: 'cpu',
title: 'maxcpu'
},
{
field: 'memory',
title: 'maxmemory'
},
{
field: 'primary_storage',
title: 'maxprimary_storage'
},
{
field: 'secondary_storage',
title: 'maxsecondary_storage'
}
],
show: (record, route, user) => { return ['Admin'].includes(user.roletype) },
component: () => import('@/components/view/ResourcesTab.vue')
component: () => import('@/components/view/ResourceLimitTab.vue')
}
],
actions: [

View File

@ -701,18 +701,18 @@
"managedstate": "Managed State",
"managementServers": "Number of Management Servers",
"masternodes": "Master nodes",
"maxuser_vm": "Max. user VMs",
"maxpublic_ip": "Max. public IPs",
"maxvolume": "Max. volumes",
"maxsnapshot": "Max. snapshots",
"maxtemplate": "Max. templates",
"maxproject": "Max. projects",
"maxnetwork": "Max. networks",
"maxuservm": "Max. User VMs",
"maxpublicip": "Max. Public IPs",
"maxvolume": "Max. Volumes",
"maxsnapshot": "Max. Snapshots",
"maxtemplate": "Max. Templates",
"maxproject": "Max. Projects",
"maxnetwork": "Max. Networks",
"maxvpc": "Max. VPCs",
"maxcpu": "Max. CPU cores",
"maxmemory": "Max. memory (MiB)",
"maxprimary_storage": "Max. primary (GiB)",
"maxsecondary_storage": "Max. secondary (GiB)",
"maxcpu": "Max. CPU Cores",
"maxmemory": "Max. Memory (MiB)",
"maxprimarystorage": "Max. Primary Storage (GiB)",
"maxsecondarystorage": "Max. Secondary Storage (GiB)",
"maxCPUNumber": "Max CPU Cores",
"maxInstance": "Max Instances",
"maxIops": "Max IOPS",