UI: Add filter to list encrypted volumes (#9548)

This commit is contained in:
Pearl Dsilva 2024-08-20 10:34:37 -04:00 committed by GitHub
parent 296a44e932
commit 1ef0833e7a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 31 additions and 2 deletions

View File

@ -1166,6 +1166,7 @@
"label.isdedicated": "Dedicated",
"label.isdefault": "Is default",
"label.isdynamicallyscalable": "Dynamically scalable",
"label.isencrypted": "Encrypted",
"label.istagarule": "Tag as JS rule",
"label.isextractable": "Extractable",
"label.isfeatured": "Featured",

View File

@ -111,6 +111,10 @@
<tooltip-button :tooltip="$t('label.clear')" icon="close-outlined" size="small" @onClick="inputKey = inputValue = ''" />
</a-input-group>
</div>
<a-switch
v-else-if="field.type==='boolean'"
v-model:checked="form[field.name]"
/>
<a-auto-complete
v-else-if="field.type==='autocomplete'"
v-model:value="form[field.name]"
@ -294,7 +298,9 @@ export default {
if (item === 'usagetype' && !('listUsageTypes' in this.$store.getters.apis)) {
return true
}
if (item === 'isencrypted' && !('listVolumes' in this.$store.getters.apis)) {
return true
}
if (['zoneid', 'domainid', 'imagestoreid', 'storageid', 'state', 'account', 'hypervisor', 'level',
'clusterid', 'podid', 'groupid', 'entitytype', 'accounttype', 'systemvmtype', 'scope', 'provider',
'type', 'scope', 'managementserverid', 'serviceofferingid', 'diskofferingid', 'usagetype'].includes(item)
@ -304,6 +310,8 @@ export default {
type = 'tag'
} else if (item === 'resourcetype') {
type = 'autocomplete'
} else if (item === 'isencrypted') {
type = 'boolean'
}
this.fields.push({
@ -420,6 +428,7 @@ export default {
let serviceOfferingIndex = -1
let diskOfferingIndex = -1
let usageTypeIndex = -1
let volumeIndex = -1
if (arrayField.includes('type')) {
if (this.$route.path === '/alert') {
@ -511,6 +520,12 @@ export default {
promises.push(await this.fetchUsageTypes())
}
if (arrayField.includes('isencrypted')) {
volumeIndex = this.fields.findIndex(item => item.name === 'isencrypted')
this.fields[volumeIndex].loading = true
promises.push(await this.fetchVolumes(searchKeyword))
}
Promise.all(promises).then(response => {
if (typeIndex > -1) {
const types = response.filter(item => item.type === 'type')
@ -884,6 +899,19 @@ export default {
})
}
},
fetchVolumes (searchKeyword) {
return new Promise((resolve, reject) => {
api('listvolumes', { listAll: true, isencrypted: searchKeyword }).then(json => {
const volumes = json.listvolumesresponse.volume
resolve({
type: 'isencrypted',
data: volumes
})
}).catch(error => {
reject(error.response.headers['x-description'])
})
})
},
fetchManagementServers (searchKeyword) {
return new Promise((resolve, reject) => {
api('listManagementServers', { listAll: true, keyword: searchKeyword }).then(json => {

View File

@ -91,7 +91,7 @@ export default {
}
],
searchFilters: () => {
var filters = ['name', 'zoneid', 'domainid', 'account', 'state', 'tags', 'serviceofferingid', 'diskofferingid']
var filters = ['name', 'zoneid', 'domainid', 'account', 'state', 'tags', 'serviceofferingid', 'diskofferingid', 'isencrypted']
if (['Admin', 'DomainAdmin'].includes(store.getters.userInfo.roletype)) {
filters.push('storageid')
}