@@ -36,10 +36,6 @@ import {mainMenuItems} from "../utils/MenuItems.js";
3636import { TabHeader } from "../components/TabHeader.jsx" ;
3737import { InfoBlock } from "../components/InfoBlock.jsx" ;
3838import DOMPurify from "dompurify" ;
39- import { PolicyOverview } from "../policies/PolicyOverview.jsx" ;
40- import { PolicyForm } from "../policies/PolicyForm.jsx" ;
41- import { groupByValues , policyTemplateRegular , policyTemplateStepUp , policyTypes } from "../utils/Policy.js" ;
42- import PolicyChoiceDialog from "../policies/PolicyChoiceDialog.jsx" ;
4339
4440const confirmationModalOptions = {
4541 makeConnection : "makeConnection" ,
@@ -61,7 +57,7 @@ const ApplicationDetail = ({anonymous, refreshUser}) => {
6157 } ) ) ) ;
6258
6359 const navigate = useNavigate ( ) ;
64- const { manageType, manageId, tab = "access" , page , policyId } = useParams ( ) ;
60+ const { manageType, manageId, tab = "access" } = useParams ( ) ;
6561
6662 const [ tabNames , setTabNames ] = useState ( [ "access" , "information" ] ) ;
6763 const [ currentTab , setCurrentTab ] = useState ( tab ) ;
@@ -81,36 +77,6 @@ const ApplicationDetail = ({anonymous, refreshUser}) => {
8177 const [ readOnly , setReadOnly ] = useState ( true ) ;
8278 const [ pendingDisconnect , setPendingDisconnect ] = useState ( true ) ;
8379 const [ changeRequestTicketKey , setChangeRequestTicketKey ] = useState ( null ) ;
84- const [ showPolicyOverview , setShowPolicyOverview ] = useState ( false ) ;
85- const [ showPolicyDetails , setShowPolicyDetails ] = useState ( false ) ;
86- const [ currentPolicy , setCurrentPolicy ] = useState ( null ) ;
87- const [ showNewPolicyChoice , setShowNewPolicyChoice ] = useState ( false ) ;
88-
89- const toPolicyDetail = ( policyIdentifier , allPolicies = policies , policyType = null ) => {
90- let newCurrentPolicy ;
91- if ( policyIdentifier === "new" ) {
92- if ( isEmpty ( policyType ) ) {
93- setShowNewPolicyChoice ( true ) ;
94- return ;
95- } else {
96- newCurrentPolicy = policyType === policyTypes . step ?
97- policyTemplateStepUp ( user . identityProvider . data . entityid , serviceProvider . data . entityid ) :
98- policyTemplateRegular ( user . identityProvider . data . entityid , serviceProvider . data . entityid ) ;
99- }
100- } else {
101- newCurrentPolicy = allPolicies . find ( policy => policy . id === policyIdentifier ) ;
102- if ( isEmpty ( newCurrentPolicy ) ) {
103- navigate ( "/404" ) ;
104- return ;
105- }
106- newCurrentPolicy . data . attributes = groupByValues ( [ ...newCurrentPolicy . data . attributes ] ) ;
107- }
108- setShowNewPolicyChoice ( false ) ;
109- window . scrollTo ( { top : 0 , behavior : "smooth" } ) ;
110- setCurrentPolicy ( newCurrentPolicy ) ;
111- setShowPolicyDetails ( true ) ;
112- navigate ( `/application-detail/${ manageType } /${ manageId } /details/${ policyIdentifier } ` ) ;
113- }
11480
11581 useEffect ( ( ) => {
11682 publicServiceProviderByDetail ( manageType , manageId )
@@ -123,7 +89,12 @@ const ApplicationDetail = ({anonymous, refreshUser}) => {
12389 return ;
12490 }
12591 //See if this application is already connected
126- const { isAccessible, isReadOnly, isPendingDisconnect, ticketKey} = deriveAccess ( user , res . data . entityid ) ;
92+ const {
93+ isAccessible,
94+ isReadOnly,
95+ isPendingDisconnect,
96+ ticketKey
97+ } = deriveAccess ( user , res . data . entityid ) ;
12798 const adminUser = isAdmin ( user , authorities ) ;
12899 setAccessible ( isAccessible ) ;
129100 setIsAdminUser ( adminUser ) ;
@@ -154,12 +125,6 @@ const ApplicationDetail = ({anonymous, refreshUser}) => {
154125 res [ 0 ] . forEach ( policy => policy . originalName = policy . name ) ;
155126 setPolicies ( res [ 0 ] ) ;
156127 setAccessRoles ( res [ 1 ] ) ;
157- if ( page === "overview" ) {
158- setShowPolicyOverview ( true ) ;
159- }
160- if ( page === "details" && ! isEmpty ( policyId ) ) {
161- toPolicyDetail ( policyId , res [ 0 ] ) ;
162- }
163128 setLoading ( false ) ;
164129 } )
165130 }
@@ -181,18 +146,6 @@ const ApplicationDetail = ({anonymous, refreshUser}) => {
181146 return < Loader />
182147 }
183148
184- const refreshPolicies = ( ) => {
185- setLoading ( true ) ;
186- getPolicyByServiceProviderEntityId ( serviceProvider . data . entityid , currentOrganization . id )
187- . then ( res => {
188- setPolicies ( res ) ;
189- setShowPolicyOverview ( true ) ;
190- setShowPolicyDetails ( false ) ;
191- setLoading ( false ) ;
192- navigate ( `/application-detail/${ manageType } /${ manageId } /overview` ) ;
193- } )
194- }
195-
196149 const externalLink = ( link , metaData , index ) => {
197150 const attribute = link . languageProperty ?
198151 ( I18n . locale === "en" ? metaData [ `${ link . metaData } :en` ] : metaData [ `${ link . metaData } :nl` ] || metaData [ `${ link . metaData } :en` ] ) :
@@ -451,14 +404,6 @@ const ApplicationDetail = ({anonymous, refreshUser}) => {
451404 setCurrentTab ( name ) ;
452405 }
453406
454- const backToAccess = ( e , pageName ) => {
455- stopEvent ( e ) ;
456- const toOverview = pageName === "/overview" ;
457- setShowPolicyOverview ( toOverview ) ;
458- setShowPolicyDetails ( false ) ;
459- navigate ( `/application-detail/${ manageType } /${ manageId } ${ pageName } ` ) ;
460- }
461-
462407 const renderAccessApp = ( ) => {
463408 return (
464409 < >
@@ -475,25 +420,7 @@ const ApplicationDetail = ({anonymous, refreshUser}) => {
475420 message = { I18n . t ( "appAccess.requestedDisconnectNotification" , { ticketKey : changeRequestTicketKey } ) } />
476421 }
477422 < div className = { `app-access ${ readOnly ? "read-only" : "" } ` } onClick = { e => readOnly && stopEvent ( e ) } >
478- { showPolicyDetails &&
479- < PolicyForm policy = { currentPolicy }
480- setPolicy = { setCurrentPolicy }
481- currentOrganization = { currentOrganization }
482- isExistingPolicy = { ! isEmpty ( currentPolicy . id ) }
483- originalName = { currentPolicy . originalName }
484- refreshPolicies = { refreshPolicies }
485- />
486- }
487- { showPolicyOverview &&
488- < PolicyOverview
489- policies = { policies }
490- backToAccess = { e => backToAccess ( e , "" ) }
491- policyDetails = { toPolicyDetail }
492- currentOrganization = { currentOrganization }
493- refreshPolicies = { refreshPolicies }
494- />
495- }
496- { ( ! showPolicyOverview && ! showPolicyDetails ) && < >
423+ < >
497424 < div className = "app-access-central" >
498425 < h2 > { I18n . t ( "appAccess.title" ) } </ h2 >
499426 < InfoBlock className = "no-gap" >
@@ -504,8 +431,7 @@ const ApplicationDetail = ({anonymous, refreshUser}) => {
504431 </ div >
505432 < Button type = { ButtonType . Primary }
506433 onClick = { ( ) => {
507- setShowPolicyOverview ( true ) ;
508- navigate ( `/application-detail/${ manageType } /${ manageId } /overview` ) ;
434+ navigate ( `/policies?service=${ encodeURIComponent ( serviceProvider . data . entityid ) } ` ) ;
509435 } }
510436 txt = { I18n . t ( "appAccess.edit" ) } />
511437 </ div >
@@ -572,7 +498,7 @@ const ApplicationDetail = ({anonymous, refreshUser}) => {
572498 </ div >
573499 </ InfoBlock >
574500 </ div >
575- </ > }
501+ </ >
576502 </ div >
577503 </ >
578504 ) ;
@@ -838,13 +764,6 @@ const ApplicationDetail = ({anonymous, refreshUser}) => {
838764
839765 return (
840766 < div className = { `application-detail-container` } >
841- { showNewPolicyChoice &&
842- < PolicyChoiceDialog policies = { policies }
843- close = { ( ) => {
844- setShowNewPolicyChoice ( false ) ;
845- setShowPolicyOverview ( true ) ;
846- } }
847- confirm = { toPolicyDetail } /> }
848767 { open && < ConfirmationDialog confirm = { action }
849768 cancel = { cancel }
850769 isError = { isError }
0 commit comments