Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: scriptType dropdowns is not working perfectly in Script-List and Add Script page #155 #156

Merged
merged 1 commit into from
Mar 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion admin-ui/app/routes/Apps/Gluu/GluuCustomScriptSearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ function GluuCustomScriptSearch({
limitId,
typeId,
limit,
scriptType,
}) {
const { t } = useTranslation()
return (
Expand All @@ -27,7 +28,7 @@ function GluuCustomScriptSearch({
/>
 
<InputGroup style={{ width: '210px' }}>
<CustomInput type="select" data-testid={typeId} id={typeId} onChange={handler}>
<CustomInput type="select" data-testid={typeId} id={typeId} defaultValue={scriptType} onChange={handler}>
<option>PERSON_AUTHENTICATION</option>
<option>INTROSPECTION</option>
<option>RESOURCE_OWNER_PASSWORD_CREDENTIALS</option>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ import GluuCommitDialog from '../../../../app/routes/Apps/Gluu/GluuCommitDialog'
import GluuTooltip from '../../../../app/routes/Apps/Gluu/GluuTooltip'
import { SCRIPT } from '../../../../app/utils/ApiResources'
import { useTranslation } from 'react-i18next'
import items from './scriptTypes'

function CustomScriptForm({ item, scripts, handleSubmit }) {
const { t } = useTranslation()
const [init, setInit] = useState(false)
const [modal, setModal] = useState(false)
const [scriptTypeState, setScriptTypeState] = useState(item.scriptType)
const scriptTypes = [...new Set(scripts.map((anItem) => anItem.scriptType))]
const [scriptPath, setScriptPath] = useState(() =>
{
if (!item.moduleProperties) {
Expand Down Expand Up @@ -293,10 +293,8 @@ function CustomScriptForm({ item, scripts, handleSubmit }) {
}}
>
<option value="">{t('options.choose')}...</option>
{scriptTypes.map((itemCandidate, index) => (
<option key={index} value={itemCandidate}>
{itemCandidate}
</option>
{items.map((ele, item) => (
<option key={index} value={ele.name}>{ele.name}</option>
))}
</CustomInput>
</InputGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ function ScriptListTable({ scripts, loading, dispatch, permissions }) {
limit={limit}
typeId={TYPE_ID}
patternId={PATTERN_ID}
scriptType={type}
handler={handleOptionsChange}
/>
),
Expand Down
27 changes: 27 additions & 0 deletions admin-ui/plugins/admin/components/CustomScripts/scriptTypes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
export const items = [
{name: "PERSON_AUTHENTICATION"},
{name: "INTROSPECTION"},
{name: "RESOURCE_OWNER_PASSWORD_CREDENTIALS"},
{name: "APPLICATION_SESSION"},
{name: "CACHE_REFRESH"},
{name: "UPDATE_USER"},
{name: "USER_REGISTRATION"},
{name: "CLIENT_REGISTRATION"},
{name: "ID_GENERATOR"},
{name: "UMA_RPT_POLICY"},
{name: "UMA_RPT_CLAIMS"},
{name: "UMA_CLAIMS_GATHERING"},
{name: "CONSENT_GATHERING"},
{name: "DYNAMIC_SCOPE"},
{name: "SPONTANEOUS_SCOPE"},
{name: "END_SESSION"},
{name: "POST_AUTHN"},
{name: "SCIM"},
{name: "CIBA_END_USER_NOTIFICATION"},
{name: "REVOKE_TOKEN"},
{name: "PERSISTENCE_EXTENSION"},
{name: "IDP"},
{name: "UPDATE_TOKEN"},
];

export default items