Skip to content

Commit 71b051a

Browse files
vits-hugsVitor Hugo Homem Marzarotto
authored andcommitted
Add search bar on rules of roles (apache#10822)
Co-authored-by: Vitor Hugo Homem Marzarotto <[email protected]>
1 parent 357f013 commit 71b051a

File tree

3 files changed

+28
-2
lines changed

3 files changed

+28
-2
lines changed

ui/public/locales/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2025,6 +2025,7 @@
20252025
"label.rolename": "Role",
20262026
"label.roles": "Roles",
20272027
"label.roletype": "Role Type",
2028+
"label.rolepermissiontab.searchbar": "Search Rule",
20282029
"label.root.certificate": "Root certificate",
20292030
"label.root.disk.size": "Root disk size (GB)",
20302031
"label.rootdisk": "ROOT disk",

ui/public/locales/pt_BR.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1390,6 +1390,7 @@
13901390
"label.rolename": "Fun\u00e7\u00e3o",
13911391
"label.roles": "Fun\u00e7\u00f5es",
13921392
"label.roletype": "Tipo de fun\u00e7\u00e3o",
1393+
"label.rolepermissiontab.searchbar": "Pesquisa de regras",
13931394
"label.root.certificate": "Certificado ra\u00edz",
13941395
"label.root.disk.size": "Tamanho do disco ra\u00edz (GB)",
13951396
"label.rootdisk": "Disco ra\u00edz",

ui/src/views/iam/RolePermissionTab.vue

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,24 @@
1818
<template>
1919
<loading-outlined v-if="loadingTable" class="main-loading-spinner" />
2020
<div v-else>
21-
<div style="width: 100%; display: flex; margin-bottom: 10px">
21+
<div style="width: 100%; display: flex; margin-bottom: 20px">
2222
<a-button type="dashed" @click="exportRolePermissions" style="width: 100%">
2323
<template #icon><download-outlined /></template>
2424
{{ $t('label.export.rules') }}
2525
</a-button>
2626
</div>
27+
<a-input-search
28+
v-model:value="searchRule"
29+
:placeholder="$t('label.rolepermissiontab.searchbar')"
30+
background-color="gray"
31+
style="width: 100%; margin-bottom: 10px; display: inline-block"
32+
enter-button
33+
@search="searchRulePermission"
34+
/>
2735
<div v-if="updateTable" class="loading-overlay">
2836
<loading-outlined />
2937
</div>
38+
3039
<div
3140
class="rules-list ant-list ant-list-bordered"
3241
:class="{'rules-list--overflow-hidden' : updateTable}" >
@@ -137,7 +146,8 @@ export default {
137146
newRuleDescription: '',
138147
newRuleSelectError: false,
139148
drag: false,
140-
apis: []
149+
apis: [],
150+
searchRule: ''
141151
}
142152
},
143153
created () {
@@ -172,6 +182,7 @@ export default {
172182
if (!this.resource.id) return
173183
api('listRolePermissions', { roleid: this.resource.id }).then(response => {
174184
this.rules = response.listrolepermissionsresponse.rolepermission
185+
this.totalRules = this.rules
175186
}).catch(error => {
176187
this.$notifyError(error)
177188
}).finally(() => {
@@ -258,6 +269,19 @@ export default {
258269
hiddenElement.download = this.resource.name + '_' + this.resource.type + '.csv'
259270
hiddenElement.click()
260271
hiddenElement.remove()
272+
},
273+
searchRulePermission (searchValue) {
274+
searchValue = searchValue.toLowerCase()
275+
if (!searchValue) {
276+
this.rules = this.totalRules
277+
} else {
278+
this.updateTable = true
279+
const searchRules = this.totalRules.filter((rule) => rule.rule.toLowerCase().includes(searchValue))
280+
this.rules = searchRules
281+
setTimeout(() => {
282+
this.updateTable = false
283+
})
284+
}
261285
}
262286
}
263287
}

0 commit comments

Comments
 (0)