-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Elay Aharoni (EXT-Nokia) <[email protected]>
- Loading branch information
Elay Aharoni (EXT-Nokia)
committed
Jan 9, 2025
1 parent
57fc8b1
commit d991379
Showing
4 changed files
with
163 additions
and
8 deletions.
There are no files selected for viewing
74 changes: 74 additions & 0 deletions
74
workspaces/frontend/src/app/pages/Workspaces/DataVolumesList.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
import { | ||
ClipboardCopy, | ||
ClipboardCopyVariant, | ||
Content, | ||
Flex, | ||
FlexItem, | ||
List, | ||
ListItem, | ||
Stack, | ||
StackItem, | ||
Tooltip, | ||
} from '@patternfly/react-core'; | ||
import { DatabaseIcon, LockedIcon } from '@patternfly/react-icons'; | ||
import * as React from 'react'; | ||
import { Workspace } from '~/shared/types'; | ||
|
||
interface ExpandedDataVolProps { | ||
workspace: Workspace; | ||
} | ||
|
||
export const DataVolumesList: React.FC<ExpandedDataVolProps> = ({ workspace }) => { | ||
const workspaceDataVol = workspace.podTemplate.volumes.data; | ||
|
||
const singleDataVolRenderer = (data: { | ||
pvcName: string; | ||
mountPath: string; | ||
readOnly: boolean; | ||
}) => ( | ||
<Flex | ||
gap={{ default: 'gapSm' }} | ||
alignItems={{ default: 'alignItemsFlexStart' }} | ||
flexWrap={{ default: 'nowrap' }} | ||
> | ||
<FlexItem> | ||
<DatabaseIcon /> | ||
</FlexItem> | ||
<FlexItem> | ||
<Content> | ||
{data.pvcName} | ||
{data.readOnly && ( | ||
<Tooltip content="Data is readonly"> | ||
<LockedIcon style={{ marginLeft: '5px' }} /> | ||
</Tooltip> | ||
)} | ||
</Content> | ||
<Stack> | ||
<StackItem> | ||
<Content component="small"> | ||
Mount path:{' '} | ||
<ClipboardCopy variant={ClipboardCopyVariant.inlineCompact}> | ||
{data.mountPath} | ||
</ClipboardCopy> | ||
</Content> | ||
</StackItem> | ||
</Stack> | ||
</FlexItem> | ||
</Flex> | ||
); | ||
|
||
return ( | ||
<Stack hasGutter> | ||
<StackItem> | ||
<strong data-testid="notebook-storage-bar-title">Cluster storage</strong> | ||
</StackItem> | ||
<StackItem> | ||
<List isPlain> | ||
{workspaceDataVol.map((data, index) => ( | ||
<ListItem key={`data-vol-${index}`}>{singleDataVolRenderer(data)}</ListItem> | ||
))} | ||
</List> | ||
</StackItem> | ||
</Stack> | ||
); | ||
}; |
37 changes: 37 additions & 0 deletions
37
workspaces/frontend/src/app/pages/Workspaces/ExpandedWorkspaceRow.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import * as React from 'react'; | ||
import { ExpandableRowContent, Td, Tr } from '@patternfly/react-table'; | ||
import { Workspace, WorkspacesColumnNames } from '~/shared/types'; | ||
import { DataVolumesList } from '~/app/pages/Workspaces/DataVolumesList'; | ||
|
||
interface ExpandedWorkspaceRowProps { | ||
workspace: Workspace; | ||
columnNames: WorkspacesColumnNames; | ||
} | ||
|
||
export const ExpandedWorkspaceRow: React.FC<ExpandedWorkspaceRowProps> = ({ | ||
workspace, | ||
columnNames, | ||
}) => { | ||
const renderExpandedData = () => | ||
Object.keys(columnNames).map((colName) => { | ||
switch (colName) { | ||
case 'name': | ||
return ( | ||
<Td noPadding colSpan={1}> | ||
<ExpandableRowContent> | ||
<DataVolumesList workspace={workspace} /> | ||
</ExpandableRowContent> | ||
</Td> | ||
); | ||
default: | ||
return <Td />; | ||
} | ||
}); | ||
|
||
return ( | ||
<Tr> | ||
<Td /> | ||
{renderExpandedData()} | ||
</Tr> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters