Skip to content

Commit b4d1b65

Browse files
add UI support for filtering users by source
1 parent df680a5 commit b4d1b65

File tree

4 files changed

+66
-3
lines changed

4 files changed

+66
-3
lines changed

ui/public/locales/en.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1320,6 +1320,7 @@
13201320
"label.lbprovider": "Load balancer provider",
13211321
"label.lbruleid": "Load balancer ID",
13221322
"label.lbtype": "Load balancer type",
1323+
"label.ldap": "LDAP",
13231324
"label.ldap.configuration": "LDAP configuration",
13241325
"label.ldap.group.name": "LDAP group",
13251326
"label.level": "Level",
@@ -1487,6 +1488,7 @@
14871488
"label.name": "Name",
14881489
"label.name.optional": "Name (Optional)",
14891490
"label.nat": "BigSwitch BCF NAT enabled",
1491+
"label.native": "Native",
14901492
"label.ncc": "NCC",
14911493
"label.netmask": "Netmask",
14921494
"label.netscaler": "NetScaler",
@@ -1984,7 +1986,9 @@
19841986
"label.s3.secret.key": "Secret key",
19851987
"label.s3.socket.timeout": "Socket timeout",
19861988
"label.s3.use.https": "Use HTTPS",
1989+
"label.saml": "SAML",
19871990
"label.saml.disable": "SAML disable",
1991+
"label.saml.disabled": "SAML Disabled",
19881992
"label.saml.enable": "SAML enable",
19891993
"label.samlenable": "Authorize SAML SSO",
19901994
"label.samlentity": "Identity provider",

ui/src/components/view/DetailsTab.vue

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,9 @@
124124
</div>
125125
</div>
126126
</div>
127+
<div v-else-if="item === 'usersource'">
128+
{{ $t(getUserSourceLabel(dataResource[item])) }}
129+
</div>
127130
<div v-else>{{ dataResource[item] }}</div>
128131
</div>
129132
</a-list-item>
@@ -406,6 +409,15 @@ export default {
406409
})
407410
408411
return resources
412+
},
413+
getUserSourceLabel (source) {
414+
if (source === 'saml2') {
415+
source = 'saml'
416+
} else if (source === 'saml2disabled') {
417+
source = 'saml.disabled'
418+
}
419+
420+
return `label.${source}`
409421
}
410422
}
411423
}

ui/src/components/view/SearchView.vue

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,8 @@ export default {
306306
}
307307
if (['zoneid', 'domainid', 'imagestoreid', 'storageid', 'state', 'account', 'hypervisor', 'level',
308308
'clusterid', 'podid', 'groupid', 'entitytype', 'accounttype', 'systemvmtype', 'scope', 'provider',
309-
'type', 'scope', 'managementserverid', 'serviceofferingid', 'diskofferingid', 'networkid', 'usagetype', 'restartrequired', 'guestiptype'].includes(item)
309+
'type', 'scope', 'managementserverid', 'serviceofferingid', 'diskofferingid', 'networkid',
310+
'usagetype', 'restartrequired', 'guestiptype', 'usersource'].includes(item)
310311
) {
311312
type = 'list'
312313
} else if (item === 'tags') {
@@ -435,6 +436,13 @@ export default {
435436
]
436437
this.fields[apiKeyAccessIndex].loading = false
437438
}
439+
440+
if (arrayField.includes('usersource')) {
441+
const userSourceIndex = this.fields.findIndex(item => item.name === 'usersource')
442+
this.fields[userSourceIndex].loading = true
443+
this.fields[userSourceIndex].opts = this.fetchAvailableUserSourceTypes()
444+
this.fields[userSourceIndex].loading = false
445+
}
438446
},
439447
async fetchDynamicFieldData (arrayField, searchKeyword) {
440448
const promises = []
@@ -1294,6 +1302,26 @@ export default {
12941302
})
12951303
})
12961304
},
1305+
fetchAvailableUserSourceTypes () {
1306+
return [
1307+
{
1308+
id: 'native',
1309+
name: 'label.native'
1310+
},
1311+
{
1312+
id: 'saml2',
1313+
name: 'label.saml'
1314+
},
1315+
{
1316+
id: 'saml2disabled',
1317+
name: 'label.saml.disabled'
1318+
},
1319+
{
1320+
id: 'ldap',
1321+
name: 'label.ldap'
1322+
}
1323+
]
1324+
},
12971325
onSearch (value) {
12981326
this.paramsFilter = {}
12991327
this.searchQuery = value

ui/src/config/section/user.js

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
import { shallowRef, defineAsyncComponent } from 'vue'
1919
import store from '@/store'
20+
import { i18n } from '@/locales'
2021

2122
export default {
2223
name: 'accountuser',
@@ -26,13 +27,31 @@ export default {
2627
hidden: true,
2728
permission: ['listUsers'],
2829
searchFilters: () => {
29-
var filters = []
30+
const filters = ['usersource']
3031
if (store.getters.userInfo.roletype === 'Admin') {
3132
filters.push('apikeyaccess')
3233
}
3334
return filters
3435
},
35-
columns: ['username', 'state', 'firstname', 'lastname', 'email', 'account', 'domain'],
36+
columns: [
37+
'username', 'state', 'firstname', 'lastname',
38+
'email', 'account', 'domain',
39+
{
40+
field: 'userSource',
41+
customTitle: 'userSource',
42+
userSource: (record) => {
43+
let { usersource: source } = record
44+
45+
if (source === 'saml2') {
46+
source = 'saml'
47+
} else if (source === 'saml2disabled') {
48+
source = 'saml.disabled'
49+
}
50+
51+
return i18n.global.t(`label.${source}`)
52+
}
53+
}
54+
],
3655
details: ['username', 'id', 'firstname', 'lastname', 'email', 'usersource', 'timezone', 'rolename', 'roletype', 'is2faenabled', 'account', 'domain', 'created'],
3756
tabs: [
3857
{

0 commit comments

Comments
 (0)