This is an automated email from the ASF dual-hosted git repository.
dahn pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudstack.git
The following commit(s) were added to refs/heads/main by this push:
new 1ef0833e7a3 UI: Add filter to list encrypted volumes (#9548)
1ef0833e7a3 is described below
commit 1ef0833e7a37d98927edb0195828417740c0db61
Author: Pearl Dsilva <[email protected]>
AuthorDate: Tue Aug 20 10:34:37 2024 -0400
UI: Add filter to list encrypted volumes (#9548)
---
ui/public/locales/en.json | 1 +
ui/src/components/view/SearchView.vue | 30 +++++++++++++++++++++++++++++-
ui/src/config/section/storage.js | 2 +-
3 files changed, 31 insertions(+), 2 deletions(-)
diff --git a/ui/public/locales/en.json b/ui/public/locales/en.json
index b42899fc631..cda4e34618a 100644
--- a/ui/public/locales/en.json
+++ b/ui/public/locales/en.json
@@ -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",
diff --git a/ui/src/components/view/SearchView.vue
b/ui/src/components/view/SearchView.vue
index 7883b162d66..07e2d14e8bc 100644
--- a/ui/src/components/view/SearchView.vue
+++ b/ui/src/components/view/SearchView.vue
@@ -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 => {
diff --git a/ui/src/config/section/storage.js b/ui/src/config/section/storage.js
index 28c451105a1..4c76ebf8db3 100644
--- a/ui/src/config/section/storage.js
+++ b/ui/src/config/section/storage.js
@@ -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')
}