Skip to content

Commit be966c8

Browse files
committed
Hide entities with hidden flag and fix mocked objects accordingly
Signed-off-by: Charles Thao <[email protected]>
1 parent 027b59f commit be966c8

File tree

4 files changed

+90
-80
lines changed

4 files changed

+90
-80
lines changed

workspaces/frontend/src/app/pages/Workspaces/Form/image/WorkspaceFormImageList.tsx

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -100,28 +100,30 @@ export const WorkspaceFormImageList: React.FunctionComponent<WorkspaceFormImageL
100100
)}
101101
{filteredWorkspaceImages.length > 0 && (
102102
<Gallery hasGutter aria-label="Selectable card container">
103-
{filteredWorkspaceImages.map((image) => (
104-
<Card
105-
isCompact
106-
isSelectable
107-
key={image.id}
108-
id={image.id.replace(/ /g, '-')}
109-
isSelected={image.id === selectedImage?.id}
110-
>
111-
<CardHeader
112-
selectableActions={{
113-
selectableActionId: `selectable-actions-item-${image.id.replace(/ /g, '-')}`,
114-
selectableActionAriaLabelledby: image.displayName.replace(/ /g, '-'),
115-
name: image.displayName,
116-
variant: 'single',
117-
onChange,
118-
}}
103+
{filteredWorkspaceImages
104+
.filter((image) => !image.hidden)
105+
.map((image) => (
106+
<Card
107+
isCompact
108+
isSelectable
109+
key={image.id}
110+
id={image.id.replace(/ /g, '-')}
111+
isSelected={image.id === selectedImage?.id}
119112
>
120-
<CardTitle>{image.displayName}</CardTitle>
121-
<CardBody>{image.id}</CardBody>
122-
</CardHeader>
123-
</Card>
124-
))}
113+
<CardHeader
114+
selectableActions={{
115+
selectableActionId: `selectable-actions-item-${image.id.replace(/ /g, '-')}`,
116+
selectableActionAriaLabelledby: image.displayName.replace(/ /g, '-'),
117+
name: image.displayName,
118+
variant: 'single',
119+
onChange,
120+
}}
121+
>
122+
<CardTitle>{image.displayName}</CardTitle>
123+
<CardBody>{image.id}</CardBody>
124+
</CardHeader>
125+
</Card>
126+
))}
125127
</Gallery>
126128
)}
127129
</PageSection>

workspaces/frontend/src/app/pages/Workspaces/Form/kind/WorkspaceFormKindList.tsx

Lines changed: 41 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -95,43 +95,49 @@ export const WorkspaceFormKindList: React.FunctionComponent<WorkspaceFormKindLis
9595
)}
9696
{filteredWorkspaceKinds.length > 0 && (
9797
<Gallery hasGutter aria-label="Selectable card container">
98-
{filteredWorkspaceKinds.map((kind) => (
99-
<Card
100-
isCompact
101-
isSelectable
102-
key={kind.name}
103-
id={kind.name.replace(/ /g, '-')}
104-
isSelected={kind.name === selectedKind?.name}
105-
>
106-
<CardHeader
107-
selectableActions={{
108-
selectableActionId: `selectable-actions-item-${kind.name.replace(/ /g, '-')}`,
109-
selectableActionAriaLabelledby: kind.name.replace(/ /g, '-'),
110-
name: kind.name,
111-
variant: 'single',
112-
onChange,
113-
}}
98+
{filteredWorkspaceKinds
99+
.filter((kind) => !kind.hidden)
100+
.map((kind) => (
101+
<Card
102+
isCompact
103+
isSelectable
104+
key={kind.name}
105+
id={kind.name.replace(/ /g, '-')}
106+
isSelected={kind.name === selectedKind?.name}
114107
>
115-
<WithValidImage
116-
imageSrc={kind.logo.url}
117-
skeletonWidth="60px"
118-
fallback={
119-
<ImageFallback
120-
imageSrc={kind.logo.url}
121-
extended
122-
message="Cannot load logo image"
123-
/>
124-
}
108+
<CardHeader
109+
selectableActions={{
110+
selectableActionId: `selectable-actions-item-${kind.name.replace(/ /g, '-')}`,
111+
selectableActionAriaLabelledby: kind.name.replace(/ /g, '-'),
112+
name: kind.name,
113+
variant: 'single',
114+
onChange,
115+
}}
125116
>
126-
{(validSrc) => (
127-
<img src={validSrc} alt={`${kind.name} logo`} style={{ maxWidth: '60px' }} />
128-
)}
129-
</WithValidImage>
130-
</CardHeader>
131-
<CardTitle>{kind.displayName}</CardTitle>
132-
<CardBody>{kind.description}</CardBody>
133-
</Card>
134-
))}
117+
<WithValidImage
118+
imageSrc={kind.logo.url}
119+
skeletonWidth="60px"
120+
fallback={
121+
<ImageFallback
122+
imageSrc={kind.logo.url}
123+
extended
124+
message="Cannot load logo image"
125+
/>
126+
}
127+
>
128+
{(validSrc) => (
129+
<img
130+
src={validSrc}
131+
alt={`${kind.name} logo`}
132+
style={{ maxWidth: '60px' }}
133+
/>
134+
)}
135+
</WithValidImage>
136+
</CardHeader>
137+
<CardTitle>{kind.displayName}</CardTitle>
138+
<CardBody>{kind.description}</CardBody>
139+
</Card>
140+
))}
135141
</Gallery>
136142
)}
137143
</PageSection>

workspaces/frontend/src/app/pages/Workspaces/Form/podConfig/WorkspaceFormPodConfigList.tsx

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -96,28 +96,30 @@ export const WorkspaceFormPodConfigList: React.FunctionComponent<
9696
)}
9797
{filteredWorkspacePodConfigs.length > 0 && (
9898
<Gallery hasGutter aria-label="Selectable card container">
99-
{filteredWorkspacePodConfigs.map((podConfig) => (
100-
<Card
101-
isCompact
102-
isSelectable
103-
key={podConfig.id}
104-
id={podConfig.id.replace(/ /g, '-')}
105-
isSelected={podConfig.id === selectedPodConfig?.id}
106-
>
107-
<CardHeader
108-
selectableActions={{
109-
selectableActionId: `selectable-actions-item-${podConfig.id.replace(/ /g, '-')}`,
110-
selectableActionAriaLabelledby: podConfig.displayName.replace(/ /g, '-'),
111-
name: podConfig.displayName,
112-
variant: 'single',
113-
onChange,
114-
}}
99+
{filteredWorkspacePodConfigs
100+
.filter((podConfig) => !podConfig.hidden)
101+
.map((podConfig) => (
102+
<Card
103+
isCompact
104+
isSelectable
105+
key={podConfig.id}
106+
id={podConfig.id.replace(/ /g, '-')}
107+
isSelected={podConfig.id === selectedPodConfig?.id}
115108
>
116-
<CardTitle>{podConfig.displayName}</CardTitle>
117-
<CardBody>{podConfig.id}</CardBody>
118-
</CardHeader>
119-
</Card>
120-
))}
109+
<CardHeader
110+
selectableActions={{
111+
selectableActionId: `selectable-actions-item-${podConfig.id.replace(/ /g, '-')}`,
112+
selectableActionAriaLabelledby: podConfig.displayName.replace(/ /g, '-'),
113+
name: podConfig.displayName,
114+
variant: 'single',
115+
onChange,
116+
}}
117+
>
118+
<CardTitle>{podConfig.displayName}</CardTitle>
119+
<CardBody>{podConfig.id}</CardBody>
120+
</CardHeader>
121+
</Card>
122+
))}
121123
</Gallery>
122124
)}
123125
</PageSection>

workspaces/frontend/src/shared/mock/mockBuilder.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ export const buildMockWorkspaceKind = (
217217
{ key: 'pythonVersion', value: '3.11' },
218218
{ key: 'jupyterlabVersion', value: '1.8.0' },
219219
],
220-
hidden: true,
220+
hidden: false,
221221
clusterMetrics: {
222222
workspacesCount: 0,
223223
},
@@ -257,7 +257,7 @@ export const buildMockWorkspaceKind = (
257257
{ key: 'pythonVersion', value: '3.12' },
258258
{ key: 'jupyterlabVersion', value: '2.0.0' },
259259
],
260-
hidden: true,
260+
hidden: false,
261261
redirect: {
262262
to: 'jupyterlab_scipy_210',
263263
message: {
@@ -318,7 +318,7 @@ export const buildMockWorkspaceKind = (
318318
id: 'large_cpu',
319319
displayName: 'Large CPU',
320320
description: 'Pod with 1 CPU, 1 Gb RAM',
321-
hidden: false,
321+
hidden: true,
322322
labels: [
323323
{ key: 'cpu', value: '1000m' },
324324
{ key: 'memory', value: '1Gi' },

0 commit comments

Comments
 (0)