11import { Button , FlexBox , IllustratedMessage } from '@ui5/webcomponents-react' ;
2- import IllustratedError from '../../Shared/IllustratedError.tsx' ;
32import '@ui5/webcomponents-fiori/dist/illustrations/NoData.js' ;
43import '@ui5/webcomponents-fiori/dist/illustrations/EmptyList.js' ;
54import '@ui5/webcomponents-icons/dist/delete' ;
6- import Loading from '../../Shared/Loading.tsx' ;
75import ButtonDesign from '@ui5/webcomponents/dist/types/ButtonDesign.js' ;
86import { ControlPlaneListWorkspaceGridTile } from './ControlPlaneListWorkspaceGridTile.tsx' ;
9- import { useApiResource } from '../../../lib/api/useApiResource.ts' ;
10- import { ListWorkspaces } from '../../../lib/api/types/crate/listWorkspaces.ts' ;
7+ import { ListWorkspacesType } from '../../../lib/api/types/crate/listWorkspaces.ts' ;
118import { useLink } from '../../../lib/shared/useLink.ts' ;
129import { useTranslation } from 'react-i18next' ;
1310
1411interface Props {
1512 projectName : string ;
13+ workspaces : ListWorkspacesType [ ] ;
1614}
1715
18- export default function ControlPlaneListAllWorkspaces ( { projectName } : Props ) {
16+ export default function ControlPlaneListAllWorkspaces ( { projectName, workspaces } : Props ) {
1917 const { workspaceCreationGuide } = useLink ( ) ;
20- const { data : allWorkspaces , error } = useApiResource (
21- ListWorkspaces ( projectName ) ,
22- ) ;
2318
2419 const { t } = useTranslation ( ) ;
2520
26- if ( ! allWorkspaces ) {
27- return < Loading /> ;
28- }
29- if ( error ) {
30- return < IllustratedError details = { error . message } /> ;
31- }
32-
3321 return (
3422 < >
35- { allWorkspaces . length === 0 ? (
23+ { workspaces . length === 0 ? (
3624 < FlexBox direction = "Column" alignItems = "Center" >
3725 < IllustratedMessage
3826 name = "EmptyList"
3927 titleText = { t ( 'ControlPlaneListAllWorkspaces.emptyListTitleMessage' ) }
40- subtitleText = { t (
41- 'ControlPlaneListAllWorkspaces.emptyListSubtitleMessage' ,
42- ) }
28+ subtitleText = { t ( 'ControlPlaneListAllWorkspaces.emptyListSubtitleMessage' ) }
4329 />
4430 < Button
4531 design = { ButtonDesign . Emphasized }
@@ -52,7 +38,7 @@ export default function ControlPlaneListAllWorkspaces({ projectName }: Props) {
5238 </ Button >
5339 </ FlexBox >
5440 ) : (
55- allWorkspaces . map ( ( workspace ) => (
41+ workspaces . map ( ( workspace ) => (
5642 < ControlPlaneListWorkspaceGridTile
5743 key = { `${ projectName } -${ workspace . metadata . name } ` }
5844 projectName = { projectName }
0 commit comments