diff --git a/admin-ui/app/routes/Apps/Gluu/GluuAdvancedSearch.js b/admin-ui/app/routes/Apps/Gluu/GluuAdvancedSearch.js index 730e14fe7..63d5bc4a8 100644 --- a/admin-ui/app/routes/Apps/Gluu/GluuAdvancedSearch.js +++ b/admin-ui/app/routes/Apps/Gluu/GluuAdvancedSearch.js @@ -2,7 +2,13 @@ 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 ( @@ -10,6 +16,7 @@ function GluuAdvancedSearch({ handler, patternId, limitId, limit }) { style={{ width: '100px' }} id={limitId} type="number" + name="limit" data-testid={limitId} defaultValue={limit} onChange={handler} @@ -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} /> diff --git a/admin-ui/plugins/auth-server/components/Clients/ClientListPage.js b/admin-ui/plugins/auth-server/components/Clients/ClientListPage.js index c045bff75..4ea41823f 100644 --- a/admin-ui/plugins/auth-server/components/Clients/ClientListPage.js +++ b/admin-ui/plugins/auth-server/components/Clients/ClientListPage.js @@ -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')}`, @@ -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)) @@ -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) { @@ -135,6 +145,7 @@ function ClientListPage({ clients, permissions, scopes, loading, dispatch }) { limitId={LIMIT_ID} patternId={PATTERN_ID} limit={limit} + pattern={pattern} handler={handleOptionsChange} /> ), @@ -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)) diff --git a/admin-ui/plugins/auth-server/components/Scopes/ScopeListPage.js b/admin-ui/plugins/auth-server/components/Scopes/ScopeListPage.js index 4b395e934..7ccc7c9ca 100644 --- a/admin-ui/plugins/auth-server/components/Scopes/ScopeListPage.js +++ b/admin-ui/plugins/auth-server/components/Scopes/ScopeListPage.js @@ -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' }, @@ -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 } } @@ -120,6 +128,7 @@ function ScopeListPage({ scopes, permissions, loading, dispatch }) { limitId={LIMIT_ID} patternId={PATTERN_ID} limit={limit} + pattern={pattern} handler={handleOptionsChange} /> ), diff --git a/admin-ui/plugins/schema/components/Person/AttributeListPage.js b/admin-ui/plugins/schema/components/Person/AttributeListPage.js index b04ce54ec..9ad7dd1ff 100644 --- a/admin-ui/plugins/schema/components/Person/AttributeListPage.js +++ b/admin-ui/plugins/schema/components/Person/AttributeListPage.js @@ -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' @@ -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))