Skip to content

Commit

Permalink
feat(admin-ui): handle edit scope
Browse files Browse the repository at this point in the history
  • Loading branch information
harryandriyan committed Aug 18, 2022
1 parent 9d65849 commit 9116ecc
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useState, useEffect } from 'react'
import Box from '@material-ui/core/Box'
import { Link } from 'react-router-dom'
import { Link, useHistory } from 'react-router-dom'
import {
Button,
Modal,
Expand All @@ -22,11 +22,13 @@ import { FormControlLabel, Radio, RadioGroup } from '@material-ui/core'
import GluuTypeAheadForDn from 'Routes/Apps/Gluu/GluuTypeAheadForDn'
import applicationStyle from 'Routes/Apps/Gluu/styles/applicationstyle'
import { deleteUMAResource } from 'Plugins/auth-server/redux/actions/UMAResourceActions'
import { setCurrentItem } from 'Plugins/auth-server/redux/actions/ScopeActions'
import GluuDialog from 'Routes/Apps/Gluu/GluuDialog'
const DOC_CATEGORY = 'openid_client'

function ClientCibaParUmaPanel({ client, dispatch, umaResources, scopes, scripts, formik }) {
const { t } = useTranslation()
const history = useHistory()
const claim_uri_id = 'claim_uri_id'
const cibaDeliveryModes = ['poll', 'push', 'ping']
const claimRedirectURI = []
Expand Down Expand Up @@ -76,6 +78,11 @@ function ClientCibaParUmaPanel({ client, dispatch, umaResources, scopes, scripts
setConfirmModal(false)
}

const handleScopeEdit = (scope) => {
dispatch(setCurrentItem(scope))
return history.push(`/auth-server/scope/edit:${scope.inum}`)
}

useEffect(() => {
if(!isEmpty(selectedUMA) && !isEmpty(selectedUMA.scopes) && selectedUMA.scopes?.length > 0) {
const list = selectedUMA.scopes.map(scope => {
Expand Down Expand Up @@ -276,9 +283,9 @@ function ClientCibaParUmaPanel({ client, dispatch, umaResources, scopes, scripts
return (
<Box key={key}>
<Box display="flex">
<Link to={`/auth-server/scope/edit:${scope.inum}`} className="common-link">
<a href="javascript:;" onClick={() => handleScopeEdit(scope)} className="common-link">
{scope.displayName}
</Link>
</a>
</Box>
</Box>
)
Expand Down Expand Up @@ -310,7 +317,7 @@ function ClientCibaParUmaPanel({ client, dispatch, umaResources, scopes, scripts
<Box key={key}>
<Box display="flex">
<Link to={`/auth-server/client/edit:${inum}`} className="common-link">
{client}
{inum}
</Link>
</Box>
</Box>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,8 @@ function ClientEditPage({
clientData.attributes = {}
}
scopes = scopes.map((item) => ({
dn: item.dn,
...item,
name: item.id,
inum: item.inum,
displayName: item.displayName
}))

function handleSubmit(data) {
Expand Down
1 change: 0 additions & 1 deletion admin-ui/plugins/auth-server/redux/api/UMAResourceApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export default class UMAResourceApi {
deteleUMAResource = async (id) => {
return new Promise((resolve, reject) => {
this.api.deleteOauthUmaResourcesById(id, (error, data) => {
console.log('delete uma')
this.handleResponse(error, reject, resolve, data)
})
})
Expand Down

0 comments on commit 9116ecc

Please sign in to comment.