@@ -32,7 +32,7 @@ interface ApplicationResourcesListProps {
3232 isAuthorized : boolean
3333 ) => void ;
3434 disabledToggleClientIDs ?: string [ ] ;
35- onManageScopes : ( item : ApplicationResourceListItem ) => void ;
35+ onManageScopes ? : ( item : ApplicationResourceListItem ) => void ;
3636}
3737
3838export const ApplicationResourcesList : React . FC < ApplicationResourcesListProps > =
@@ -65,54 +65,57 @@ export const ApplicationResourcesList: React.FC<ApplicationResourcesListProps> =
6565 ) ;
6666
6767 const columns : IColumn [ ] = useMemo (
68- ( ) => [
69- {
70- key : "resources" ,
71- name : renderToString ( "ApplicationResourcesList.columns.resources" ) ,
72- minWidth : 200 ,
73- maxWidth : 400 ,
74- isResizable : true ,
75- onRender : ( item : ApplicationResourceListItem ) => {
76- return item . name || item . resourceURI ;
68+ ( ) =>
69+ [
70+ {
71+ key : "resources" ,
72+ name : renderToString ( "ApplicationResourcesList.columns.resources" ) ,
73+ minWidth : 200 ,
74+ maxWidth : 400 ,
75+ isResizable : true ,
76+ onRender : ( item : ApplicationResourceListItem ) => {
77+ return item . name || item . resourceURI ;
78+ } ,
7779 } ,
78- } ,
79- {
80- key : "authorized" ,
81- name : renderToString ( "ApplicationResourcesList.columns.authorized" ) ,
82- minWidth : 150 ,
83- isResizable : true ,
84- onRender : renderAuthorizedToggle ,
85- } ,
86- {
87- key : "actions" ,
88- name : "" ,
89- minWidth : 100 ,
90- maxWidth : 100 ,
91- isResizable : false ,
92- // eslint-disable-next-line react/no-unstable-nested-components
93- onRender : ( item : ApplicationResourceListItem ) => {
94- if ( ! item . isAuthorized ) {
95- return null ;
96- }
97- const handleClick = ( ) => {
98- onManageScopes ( item ) ;
99- } ;
100- return (
101- < ActionButton
102- text = { renderToString (
103- "ApplicationResourcesList.columns.manageScopes"
104- ) }
105- styles = { {
106- label : { fontWeight : 600 } ,
107- root : { height : "auto" } ,
108- } }
109- theme = { themes . actionButton }
110- onClick = { handleClick }
111- />
112- ) ;
80+ {
81+ key : "authorized" ,
82+ name : renderToString ( "ApplicationResourcesList.columns.authorized" ) ,
83+ minWidth : 150 ,
84+ isResizable : true ,
85+ onRender : renderAuthorizedToggle ,
11386 } ,
114- } ,
115- ] ,
87+ onManageScopes
88+ ? {
89+ key : "actions" ,
90+ name : "" ,
91+ minWidth : 100 ,
92+ maxWidth : 100 ,
93+ isResizable : false ,
94+ // eslint-disable-next-line react/no-unstable-nested-components
95+ onRender : ( item : ApplicationResourceListItem ) => {
96+ if ( ! item . isAuthorized ) {
97+ return null ;
98+ }
99+ const handleClick = ( ) => {
100+ onManageScopes ( item ) ;
101+ } ;
102+ return (
103+ < ActionButton
104+ text = { renderToString (
105+ "ApplicationResourcesList.columns.manageScopes"
106+ ) }
107+ styles = { {
108+ label : { fontWeight : 600 } ,
109+ root : { height : "auto" } ,
110+ } }
111+ theme = { themes . actionButton }
112+ onClick = { handleClick }
113+ />
114+ ) ;
115+ } ,
116+ }
117+ : null ,
118+ ] . filter ( ( it ) => ! ! it ) ,
116119 [
117120 renderToString ,
118121 renderAuthorizedToggle ,
0 commit comments