Skip to content

Commit eeeaf2f

Browse files
feat: add empty state in all apps list
1 parent fcc318a commit eeeaf2f

File tree

1 file changed

+31
-30
lines changed

1 file changed

+31
-30
lines changed

src/components/ApplicationGroup/CreateAppGroup.tsx

Lines changed: 31 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,7 @@ export default function CreateAppGroup({
242242
}
243243

244244
const renderAllApps = (): JSX.Element => {
245+
const filteredAllApps = appList.filter((app) => !allAppSearchText || app.appName.indexOf(allAppSearchText) >= 0)
245246
return (
246247
<div>
247248
<SearchBar
@@ -252,36 +253,36 @@ export default function CreateAppGroup({
252253
setSearchApplied={setAllAppSearchApplied}
253254
/>
254255
<div>
255-
{appList
256-
.filter((app) => !allAppSearchText || app.appName.indexOf(allAppSearchText) >= 0)
257-
.map((app) => (
258-
<ConditionalWrap
259-
condition={unAuthorizedApps.get(app.appName) === true}
260-
wrap={(children) => (
261-
<Tippy
262-
key={`selected-app-${app.id}`}
263-
data-testid="env-tippy"
264-
className="default-tt w-200"
265-
arrow={false}
266-
placement="bottom-start"
267-
content={`You don't have admin/manager pemission for this ${filterParentTypeMsg}.`}
268-
>
269-
<div>{children}</div>
270-
</Tippy>
271-
)}
272-
>
273-
<Checkbox
274-
key={`app-${app.id}`}
275-
rootClassName="fs-13 pt-8 pr-8 pb-8 mb-0-imp dc__hover-n50"
276-
isChecked={unAuthorizedApps.get(app.appName) ? false : selectedAppsMap[app.id]}
277-
value={CHECKBOX_VALUE.CHECKED}
278-
onChange={() => toggleAppSelection(app.id)}
279-
disabled={unAuthorizedApps.get(app.appName) ? true : false}
280-
>
281-
{app.appName}
282-
</Checkbox>
283-
</ConditionalWrap>
284-
))}
256+
{filteredAllApps.length <= 0
257+
? renderEmptyState('No matching results')
258+
: filteredAllApps.map((app) => (
259+
<ConditionalWrap
260+
condition={unAuthorizedApps.get(app.appName) === true}
261+
wrap={(children) => (
262+
<Tippy
263+
key={`selected-app-${app.id}`}
264+
data-testid="env-tippy"
265+
className="default-tt w-200"
266+
arrow={false}
267+
placement="bottom-start"
268+
content={`You don't have admin/manager pemission for this ${filterParentTypeMsg}.`}
269+
>
270+
<div>{children}</div>
271+
</Tippy>
272+
)}
273+
>
274+
<Checkbox
275+
key={`app-${app.id}`}
276+
rootClassName="fs-13 pt-8 pr-8 pb-8 mb-0-imp dc__hover-n50"
277+
isChecked={unAuthorizedApps.get(app.appName) ? false : selectedAppsMap[app.id]}
278+
value={CHECKBOX_VALUE.CHECKED}
279+
onChange={() => toggleAppSelection(app.id)}
280+
disabled={unAuthorizedApps.get(app.appName) ? true : false}
281+
>
282+
{app.appName}
283+
</Checkbox>
284+
</ConditionalWrap>
285+
))}
285286
</div>
286287
</div>
287288
)

0 commit comments

Comments
 (0)