Skip to content

Commit

Permalink
fix: search pallets
Browse files Browse the repository at this point in the history
  • Loading branch information
mjatin-dev committed Feb 21, 2022
1 parent 4fc332e commit d22b09a
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 21 deletions.
11 changes: 10 additions & 1 deletion admin-ui/app/routes/Apps/Gluu/GluuAdvancedSearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,21 @@ import React from 'react'
import { Input, FormGroup } from './../../../components'
import { useTranslation } from 'react-i18next'

function GluuAdvancedSearch({ handler, patternId, limitId, limit }) {
function GluuAdvancedSearch({
handler,
patternId,
limitId,
limit,
pattern = '',
}) {
const { t } = useTranslation()
return (
<FormGroup row style={{ marginTop: '10px' }}>
<Input
style={{ width: '100px' }}
id={limitId}
type="number"
name="limit"
data-testid={limitId}
defaultValue={limit}
onChange={handler}
Expand All @@ -20,6 +27,8 @@ function GluuAdvancedSearch({ handler, patternId, limitId, limit }) {
id={patternId}
data-testid={patternId}
type="text"
name="pattern"
defaultValue={pattern}
placeholder={t('placeholders.search_pattern')}
onChange={handler}
/>
Expand Down
25 changes: 19 additions & 6 deletions admin-ui/plugins/auth-server/components/Clients/ClientListPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,16 @@ function ClientListPage({ clients, permissions, scopes, loading, dispatch }) {
const myActions = []
const history = useHistory()
const pageSize = localStorage.getItem('paggingSize') || 10

const [limit, setLimit] = useState(200)
const [pattern, setPattern] = useState(null)
const [item, setItem] = useState({})
const [modal, setModal] = useState(false)
const toggle = () => setModal(!modal)

let memoLimit = limit
let memoPattern = pattern

const tableColumns = [
{
title: `${t('fields.inum')}`,
Expand Down Expand Up @@ -86,9 +91,12 @@ function ClientListPage({ clients, permissions, scopes, loading, dispatch }) {
buildPayload(userAction, FETCHING_OIDC_CLIENTS, options)
dispatch(getOpenidClients(userAction))
}, [])
function handleOptionsChange() {
setLimit(document.getElementById(LIMIT_ID).value)
setPattern(document.getElementById(PATTERN_ID).value)
function handleOptionsChange(event) {
if (event.target.name == 'limit') {
memoLimit = event.target.value
} else if (event.target.name == 'pattern') {
memoPattern = event.target.value
}
}
function handleGoToClientEditPage(row, edition) {
dispatch(viewOnly(edition))
Expand All @@ -104,9 +112,11 @@ function ClientListPage({ clients, permissions, scopes, loading, dispatch }) {
toggle()
}
function makeOptions() {
options[LIMIT] = limit
if (pattern) {
options[PATTERN] = pattern
setLimit(memoLimit)
setPattern(memoPattern)
options[LIMIT] = memoLimit
if (memoPattern) {
options[PATTERN] = memoPattern
}
}
function onDeletionConfirmed(message) {
Expand Down Expand Up @@ -135,6 +145,7 @@ function ClientListPage({ clients, permissions, scopes, loading, dispatch }) {
limitId={LIMIT_ID}
patternId={PATTERN_ID}
limit={limit}
pattern={pattern}
handler={handleOptionsChange}
/>
),
Expand All @@ -151,6 +162,8 @@ function ClientListPage({ clients, permissions, scopes, loading, dispatch }) {
iconProps: { color: 'primary' },
isFreeAction: true,
onClick: () => {
// setLimit(memoLimit)
// setPattern(memoLimit)
makeOptions()
buildPayload(userAction, SEARCHING_OIDC_CLIENTS, options)
dispatch(searchClients(userAction))
Expand Down
21 changes: 15 additions & 6 deletions admin-ui/plugins/auth-server/components/Scopes/ScopeListPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ function ScopeListPage({ scopes, permissions, loading, dispatch }) {
const [pattern, setPattern] = useState(null)
const toggle = () => setModal(!modal)

let memoLimit = limit
let memoPattern = pattern

const tableColumns = [
{ title: `${t('fields.inum')}`, field: 'inum' },
{ title: `${t('fields.displayname')}`, field: 'displayName' },
Expand All @@ -67,15 +70,20 @@ function ScopeListPage({ scopes, permissions, loading, dispatch }) {
buildPayload(userAction, FETCHING_SCOPES, options)
dispatch(getScopes(userAction))
}, [])
function handleOptionsChange(i) {
setLimit(document.getElementById(LIMIT_ID).value)
setPattern(document.getElementById(PATTERN_ID).value)
function handleOptionsChange(event) {
if (event.target.name == 'limit') {
memoLimit = event.target.value
} else if (event.target.name == 'pattern') {
memoPattern = event.target.value
}
}

function makeOptions() {
options[LIMIT] = limit
if (pattern) {
options[PATTERN] = pattern
setLimit(memoLimit)
setPattern(memoPattern)
options[LIMIT] = memoLimit
if (memoPattern) {
options[PATTERN] = memoPattern
}
}

Expand Down Expand Up @@ -120,6 +128,7 @@ function ScopeListPage({ scopes, permissions, loading, dispatch }) {
limitId={LIMIT_ID}
patternId={PATTERN_ID}
limit={limit}
pattern={pattern}
handler={handleOptionsChange}
/>
),
Expand Down
26 changes: 18 additions & 8 deletions admin-ui/plugins/schema/components/Person/AttributeListPage.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useState, useEffect } from 'react'
import MaterialTable from '@material-table/core';
import MaterialTable from '@material-table/core'
import { useHistory } from 'react-router-dom'
import { Paper } from '@material-ui/core'
import { connect } from 'react-redux'
Expand Down Expand Up @@ -39,19 +39,29 @@ function AttributeListPage({ attributes, permissions, loading, dispatch }) {
const patternId = 'searchPattern'
const myActions = []

let memoLimit = limit
let memoPattern = pattern

const history = useHistory()
const [item, setItem] = useState({})
const [modal, setModal] = useState(false)
const toggle = () => setModal(!modal)
function makeOptions() {
options['limit'] = parseInt(limit)
if (pattern) {
options['pattern'] = pattern

function handleOptionsChange(event) {
if (event.target.name == 'limit') {
memoLimit = event.target.value
} else if (event.target.name == 'pattern') {
memoPattern = event.target.value
}
}
function handleOptionsChange(i) {
setLimit(document.getElementById(limitId).value)
setPattern(document.getElementById(patternId).value)

function makeOptions() {
setLimit(memoLimit)
setPattern(memoPattern)
options['limit'] = parseInt(memoLimit)
if (memoPattern) {
options['pattern'] = memoPattern
}
}
function handleGoToAttributeEditPage(row) {
dispatch(setCurrentItem(row))
Expand Down

0 comments on commit d22b09a

Please sign in to comment.