ui: show tags only for supported resources (#5798)

* ui: prevent incorrect tags displa for primary storage

Tags in info card of the UI are related to tags functionality(create/delete/lsitTags API)
UI was incorrectly showing storage tags as these tags in the UI.

Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>

* remove logging

Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>

* ui: show tags only for supported resources

Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
This commit is contained in:
Abhishek Kumar 2021-12-30 15:20:37 +05:30 committed by GitHub
parent 6728b696cd
commit d13057ace5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -651,7 +651,7 @@
</div>
</div>
<div class="account-center-tags" v-if="!isStatic && resourceType && 'listTags' in $store.getters.apis">
<div class="account-center-tags" v-if="!isStatic && resourceType && tagsSupportingResourceTypes.includes(this.resourceType) && 'listTags' in $store.getters.apis">
<a-divider/>
<a-spin :spinning="loadingTags">
<div class="title">{{ $t('label.tags') }}</div>
@ -772,10 +772,12 @@ export default {
this.showKeys = false
this.setData()
if ('tags' in this.resource) {
this.tags = this.resource.tags
} else if (this.resourceType) {
this.getTags()
if (this.tagsSupportingResourceTypes.includes(this.resourceType)) {
if ('tags' in this.resource) {
this.tags = this.resource.tags
} else if (this.resourceType) {
this.getTags()
}
}
if ('apikey' in this.resource) {
this.getUserKeys()
@ -794,6 +796,12 @@ export default {
await this.getIcons()
},
computed: {
tagsSupportingResourceTypes () {
return ['UserVm', 'Template', 'ISO', 'Volume', 'Snapshot', 'Backup', 'Network',
'LoadBalancer', 'PortForwardingRule', 'FirewallRule', 'SecurityGroup', 'SecurityGroupRule',
'PublicIpAddress', 'Project', 'Account', 'Vpc', 'NetworkACL', 'StaticRoute', 'VMSnapshot',
'RemoteAccessVpn', 'User', 'SnapshotPolicy', 'VpcOffering']
},
name () {
return this.resource.displayname || this.resource.displaytext || this.resource.name || this.resource.username ||
this.resource.ipaddress || this.resource.virtualmachinename || this.resource.templatetype