@@ -46,6 +46,7 @@ export default function CreateAppGroup({
4646 const [ unauthorizedAppList , setUnauthorizedAppList ] = useState < CreateTypeOfAppListType [ ] > ( [ ] )
4747 const [ authorizedAppList , setAuthorizedAppList ] = useState < CreateTypeOfAppListType [ ] > ( [ ] )
4848
49+ const filterParentTypeMsg = filterParentType === FilterParentType . app ? 'environment' : 'application'
4950 const outsideClickHandler = ( evt ) : void => {
5051 if (
5152 CreateGroupRef . current &&
@@ -148,6 +149,10 @@ export default function CreateAppGroup({
148149 ? _unauthorizedAppList . push ( { id : app . id , appName : app . appName } )
149150 : _authorizedAppList . push ( { id : app . id , appName : app . appName } )
150151 } )
152+ _unauthorizedAppList . filter (
153+ ( app ) =>
154+ selectedAppsMap [ app . id ] && ( ! selectedAppSearchText || app . appName . indexOf ( selectedAppSearchText ) >= 0 ) ,
155+ )
151156 setUnauthorizedAppList ( _unauthorizedAppList )
152157 setAuthorizedAppList ( _authorizedAppList )
153158 }
@@ -156,7 +161,7 @@ export default function CreateAppGroup({
156161 return (
157162 < div >
158163 < SearchBar
159- placeholder = " Search applications"
164+ placeholder = { ` Search ${ filterParentTypeMsg } 's` }
160165 searchText = { selectedAppSearchText }
161166 setSearchText = { setSelectedAppSearchText }
162167 searchApplied = { selectedAppSearchApplied }
@@ -188,30 +193,24 @@ export default function CreateAppGroup({
188193 You don't have admin/manager pemission for the following Application.
189194 </ div >
190195 ) }
191- { unauthorizedAppList
192- . filter (
193- ( app ) =>
194- selectedAppsMap [ app . id ] &&
195- ( ! selectedAppSearchText || app . appName . indexOf ( selectedAppSearchText ) >= 0 ) ,
196- )
197- . map ( ( app ) => {
198- return (
199- < Tippy
200- key = { `selected-app-${ app . id } ` }
201- className = "default-tt w-200"
202- arrow = { false }
203- placement = "bottom-start"
204- content = "You don't have admin/manager pemission for this app."
205- >
206- < div >
207- < div className = "flex left dc__hover-n50 p-8 fs-13 fw-4 cn-9 selected-app-row cursor" >
208- < Abort className = "mr-8" />
209- < span > { app . appName } </ span >
210- </ div >
196+ { unauthorizedAppList . map ( ( app ) => {
197+ return (
198+ < Tippy
199+ key = { `selected-app-${ app . id } ` }
200+ className = "default-tt w-200"
201+ arrow = { false }
202+ placement = "bottom-start"
203+ content = "You don't have admin/manager pemission for this app."
204+ >
205+ < div >
206+ < div className = "flex left dc__hover-n50 p-8 fs-13 fw-4 cn-9 selected-app-row cursor" >
207+ < Abort className = "mr-8" />
208+ < span > { app . appName } </ span >
211209 </ div >
212- </ Tippy >
213- )
214- } ) }
210+ </ div >
211+ </ Tippy >
212+ )
213+ } ) }
215214 </ div >
216215 </ div >
217216 )
@@ -221,7 +220,7 @@ export default function CreateAppGroup({
221220 return (
222221 < div >
223222 < SearchBar
224- placeholder = " Search applications"
223+ placeholder = { ` Search ${ filterParentTypeMsg } 's` }
225224 searchText = { allAppSearchText }
226225 setSearchText = { setAllAppSearchText }
227226 searchApplied = { allAppSearchApplied }
@@ -240,7 +239,7 @@ export default function CreateAppGroup({
240239 className = "default-tt w-200"
241240 arrow = { false }
242241 placement = "bottom-start"
243- content = " You don't have admin/manager pemission for this app."
242+ content = { ` You don't have admin/manager pemission for this ${ filterParentTypeMsg } .}` }
244243 >
245244 < div > { children } </ div >
246245 </ Tippy >
@@ -362,10 +361,11 @@ export default function CreateAppGroup({
362361 const handleSave = async ( e ) : Promise < void > => {
363362 e . preventDefault ( )
364363 if ( ! appGroupName || appGroupDescription ?. length > 50 ) {
364+ setShowErrorMsg ( true )
365365 return
366366 }
367367 if ( selectedAppsCount === 0 ) {
368- toast . error ( ' Please select apps to create group' )
368+ toast . error ( ` Please select ${ filterParentTypeMsg } to create group` )
369369 return
370370 }
371371 setLoading ( true )
0 commit comments