Skip to content

Commit

Permalink
feat(ws): Add Connect column to workspace table and popup with worksp…
Browse files Browse the repository at this point in the history
…ace endpoints

Signed-off-by: Yael <fishel.yael@gmail.com>
  • Loading branch information
Yael-F committed Dec 16, 2024
1 parent 346a74e commit 8e967e5
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 1 deletion.
45 changes: 44 additions & 1 deletion workspaces/frontend/src/app/pages/Workspaces/Workspaces.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ import {
Button,
PaginationVariant,
Pagination,
Popover,
List,
ListItem,
} from '@patternfly/react-core';
import {
Table,
Expand All @@ -34,7 +37,10 @@ import {
ActionsColumn,
IActions,
} from '@patternfly/react-table';
import { FilterIcon } from '@patternfly/react-icons';
import {
FilterIcon,
ExternalLinkAltIcon,
} from '@patternfly/react-icons';
import { Workspace, WorkspaceState } from '~/shared/types';

export const Workspaces: React.FunctionComponent = () => {
Expand Down Expand Up @@ -78,6 +84,7 @@ export const Workspaces: React.FunctionComponent = () => {
state: WorkspaceState.Paused,
stateMessage: 'It is paused.',
},
endpoints: ['endpoint1', 'endpoint2'],
},
{
name: 'My Other Jupyter Notebook',
Expand Down Expand Up @@ -117,6 +124,7 @@ export const Workspaces: React.FunctionComponent = () => {
state: WorkspaceState.Running,
stateMessage: 'It is running.',
},
endpoints: ['endpoint3', 'endpoint4'],
},
];

Expand All @@ -130,6 +138,7 @@ export const Workspaces: React.FunctionComponent = () => {
homeVol: 'Home Vol',
dataVol: 'Data Vol',
lastActivity: 'Last Activity',
connect: 'Connect',
};

// Filter
Expand Down Expand Up @@ -421,6 +430,36 @@ export const Workspaces: React.FunctionComponent = () => {
setPage(newPage);
};

interface EndpointPopoverProps {
endpoints: string[];
}

const EndpointPopover: React.FC<EndpointPopoverProps> = ({ endpoints }) => (
<Popover
headerContent={<b>Workspace endpoints</b>}
headerIcon={<ExternalLinkAltIcon />}
triggerAction="hover"
bodyContent={
<List isPlain>
{endpoints.map((endpoint, index) => (
<ListItem key={index}>
<a
style={{ textDecoration: "none" }}
href={endpoint}
target="_blank">
{endpoint}
</a>
</ListItem>
))}
</List>}
>
<a>
Connect
<ExternalLinkAltIcon style={{ marginLeft: "0.25rem" }}/>
</a>
</Popover>
);

return (
<PageSection>
<Title headingLevel="h1">Kubeflow Workspaces</Title>
Expand All @@ -437,6 +476,7 @@ export const Workspaces: React.FunctionComponent = () => {
<Th sort={getSortParams(5)}>{columnNames.homeVol}</Th>
<Th sort={getSortParams(6)}>{columnNames.dataVol}</Th>
<Th sort={getSortParams(7)}>{columnNames.lastActivity}</Th>
<Th sort={getSortParams(7)}>{columnNames.connect}</Th>
<Th screenReaderText="Primary action" />
</Tr>
</Thead>
Expand Down Expand Up @@ -464,6 +504,9 @@ export const Workspaces: React.FunctionComponent = () => {
1 hour ago
</Timestamp>
</Td>
<Td dataLabel={columnNames.connect}>
<EndpointPopover endpoints={workspace.endpoints}/>
</Td>
<Td isActionCell>
<ActionsColumn items={defaultActions(workspace)} />
</Td>
Expand Down
1 change: 1 addition & 0 deletions workspaces/frontend/src/shared/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,5 @@ export interface Workspace {
podConfig: string;
};
status: WorkspaceStatus;
endpoints: string[];
}

0 comments on commit 8e967e5

Please sign in to comment.