Skip to content

Commit

Permalink
feat(admin-ui): little refactoring on feature Filter clients by organ…
Browse files Browse the repository at this point in the history
…ization #335
  • Loading branch information
syntrydy committed Aug 25, 2022
1 parent bade331 commit b4240d2
Showing 1 changed file with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,27 +73,28 @@ function ClientListPage({ clients, permissions, scopes, loading, dispatch }) {
let memoPattern = pattern

function addOrg(client) {
let org = '-'
if(client.hasOwnProperty("o")){
client['organization'] = client.o
return client
}
if (
client.hasOwnProperty('customAttributes') &&
Array.isArray(client.customAttributes)
) {
const results = client.customAttributes.filter(
(item) => item.name == 'o' || item.name == 'organization',
)
if (results.length === 0) {
client['organization'] = '-'
} else {
client['organization'] = results[0].values[0]
if (results.length !== 0) {
org = results[0].values[0]
}
} else {
client['organization'] = '-'
}

client['organization'] = org
return client
}

function shouldHideOrgColumn(clients) {
return clients.filter(client => client.organization != '-').length === 0 ? true:false
return !clients.some((client) => client.organization != '-')
}

const handler = () => {
Expand Down

0 comments on commit b4240d2

Please sign in to comment.