Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 14 additions & 13 deletions workspaces/frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions workspaces/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,9 @@
"dompurify": "^3.2.4",
"js-yaml": "^4.1.0",
"lodash-es": "^4.17.15",
"mod-arch-core": "^1.1.5",
"mod-arch-kubeflow": "^1.1.5",
"mod-arch-shared": "^1.1.5",
"mod-arch-core": "^1.2.0",
"mod-arch-kubeflow": "^1.2.0",
"mod-arch-shared": "^1.2.0",
"react": "^18",
"react-dom": "^18",
"react-router": "^7.5.2",
Expand Down
16 changes: 11 additions & 5 deletions workspaces/frontend/src/app/components/WorkspaceTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ import {
import { ExpandedWorkspaceRow } from '~/app/pages/Workspaces/ExpandedWorkspaceRow';
import CustomEmptyState from '~/shared/components/CustomEmptyState';
import { WorkspacesWorkspace, WorkspacesWorkspaceState } from '~/generated/data-contracts';
import { useWorkspaceActionsContext } from '~/app/context/WorkspaceActionsContext';

const {
fields: wsTableColumns,
Expand Down Expand Up @@ -128,6 +129,7 @@ const WorkspaceTable = React.forwardRef<WorkspaceTableRef, WorkspaceTableProps>(
},
ref,
) => {
const { isDrawerExpanded } = useWorkspaceActionsContext();
const [workspaceKinds] = useWorkspaceKinds();
const [expandedWorkspacesNames, setExpandedWorkspacesNames] = useState<string[]>([]);
const [filters, setFilters] = useState<Record<FilterKey, string>>({
Expand Down Expand Up @@ -518,6 +520,8 @@ const WorkspaceTable = React.forwardRef<WorkspaceTableRef, WorkspaceTableProps>(
data-testid="workspaces-table"
aria-label="Sortable table"
ouiaId="SortableTable"
variant="compact"
gridBreakPoint={isDrawerExpanded ? 'grid' : 'grid-lg'}
style={{ tableLayout: 'fixed' }}
>
<Thead>
Expand Down Expand Up @@ -570,15 +574,15 @@ const WorkspaceTable = React.forwardRef<WorkspaceTableRef, WorkspaceTableProps>(
{visibleColumnKeys.map((columnKey) => {
if (columnKey === 'connect') {
return (
<Td key="connect" isActionCell>
<Td key="connect" dataLabel={wsTableColumns[columnKey].label}>
<WorkspaceConnectAction workspace={workspace} />
</Td>
);
}

if (columnKey === 'actions') {
return (
<Td key="actions" isActionCell data-testid="action-column">
<Td key="actions" data-testid="action-column">
<ActionsColumn
items={rowActions(workspace).map((action) => ({
...action,
Expand Down Expand Up @@ -638,9 +642,11 @@ const WorkspaceTable = React.forwardRef<WorkspaceTableRef, WorkspaceTableProps>(
)}
{columnKey === 'namespace' && workspace.namespace}
{columnKey === 'state' && (
<Label color={extractStateColor(workspace.state)}>
{workspace.state}
</Label>
<div className="pf-v6-u-display-inline-block">
<Label color={extractStateColor(workspace.state)}>
{workspace.state}
</Label>
</div>
)}
{columnKey === 'gpu' && formatResourceFromWorkspace(workspace, 'gpu')}
{columnKey === 'idleGpu' && formatWorkspaceIdleState(workspace)}
Expand Down
13 changes: 12 additions & 1 deletion workspaces/frontend/src/app/context/WorkspaceActionsContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export type WorkspaceActionsContextType = {
requestStartAction: RequestAction;
requestRestartAction: RequestAction;
requestStopAction: RequestAction;
isDrawerExpanded: boolean;
};

export const WorkspaceActionsContext = React.createContext<WorkspaceActionsContextType | undefined>(
Expand Down Expand Up @@ -148,6 +149,8 @@ export const WorkspaceActionsContextProvider: React.FC<WorkspaceActionsContextPr
}
}, [activeWsAction, executeEditAction]);

const isDrawerExpanded = activeWsAction?.action === ActionType.ViewDetails;

const contextValue = useMemo(
() => ({
requestViewDetailsAction,
Expand All @@ -156,6 +159,7 @@ export const WorkspaceActionsContextProvider: React.FC<WorkspaceActionsContextPr
requestStartAction,
requestRestartAction,
requestStopAction,
isDrawerExpanded,
}),
[
requestViewDetailsAction,
Expand All @@ -164,12 +168,19 @@ export const WorkspaceActionsContextProvider: React.FC<WorkspaceActionsContextPr
requestStartAction,
requestRestartAction,
requestStopAction,
isDrawerExpanded,
],
);

return (
<WorkspaceActionsContext.Provider value={contextValue}>
<Drawer isInline isExpanded={activeWsAction?.action === ActionType.ViewDetails}>
<Drawer
isInline
isExpanded={isDrawerExpanded}
onExpand={() => {
/* drawer expanded */
}}
>
<DrawerContent panelContent={drawerContent}>
<DrawerContentBody>
{children}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ describe('useWorkspaceRowActions', () => {
requestStartAction: (args: RequestActionArgs) => void;
requestRestartAction: (args: RequestActionArgs) => void;
requestStopAction: (args: RequestActionArgs) => void;
isDrawerExpanded: boolean;
};

const contextValue: WorkspaceActionsContextLike = {
Expand All @@ -36,6 +37,7 @@ describe('useWorkspaceRowActions', () => {
requestStartAction: jest.fn(),
requestRestartAction: jest.fn(),
requestStopAction: jest.fn(),
isDrawerExpanded: false,
};

const wrapper: React.FC<React.PropsWithChildren> = ({ children }) => (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export const WorkspaceDetailsActions: React.FC<WorkspaceDetailsActionsProps> = (
toggle={(toggleRef) => (
<MenuToggle
variant="primary"
className="workspace-details-action-toggle"
ref={toggleRef}
onClick={() => setOpen(!isOpen)}
isExpanded={isOpen}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { WorkspaceFormImageDetails } from '~/app/pages/Workspaces/Form/image/Wor
import { WorkspaceFormPropertiesVolumes } from '~/app/pages/Workspaces/Form/properties/WorkspaceFormPropertiesVolumes';
import { WorkspacekindsImageConfigValue } from '~/generated/data-contracts';
import { WorkspaceFormProperties } from '~/app/types';
import ThemeAwareFormGroupWrapper from '~/shared/components/ThemeAwareFormGroupWrapper';
import { WorkspaceFormPropertiesSecrets } from './WorkspaceFormPropertiesSecrets';

interface WorkspaceFormPropertiesSelectionProps {
Expand All @@ -36,11 +37,11 @@ const WorkspaceFormPropertiesSelection: React.FunctionComponent<
<SplitItem isFilled>
<div className="pf-u-p-lg pf-u-max-width-xl">
<Form>
<FormGroup
<ThemeAwareFormGroupWrapper
label="Workspace Name"
isRequired
fieldId="workspace-name"
style={{ width: 520 }}
className="pf-u-width-520"
>
<TextInput
isRequired
Expand All @@ -49,7 +50,7 @@ const WorkspaceFormPropertiesSelection: React.FunctionComponent<
onChange={(_, value) => onSelect({ ...selectedProperties, workspaceName: value })}
id="workspace-name"
/>
</FormGroup>
</ThemeAwareFormGroupWrapper>
<FormGroup fieldId="defer-updates">
<Checkbox
label="Defer Updates"
Expand All @@ -73,10 +74,10 @@ const WorkspaceFormPropertiesSelection: React.FunctionComponent<
>
{isVolumesExpanded && (
<>
<FormGroup
<ThemeAwareFormGroupWrapper
label="Home Directory"
fieldId="home-directory"
style={{ width: 500 }}
className="pf-u-width-500"
>
<TextInput
value={selectedProperties.homeDirectory}
Expand All @@ -87,8 +88,10 @@ const WorkspaceFormPropertiesSelection: React.FunctionComponent<
});
}}
id="home-directory"
type="text"
name="home-directory"
/>
</FormGroup>
</ThemeAwareFormGroupWrapper>

<FormGroup fieldId="volumes-table" style={{ marginTop: '1rem' }}>
<WorkspaceFormPropertiesVolumes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {
} from '@patternfly/react-table/dist/esm/components/Table';
import { PlusCircleIcon } from '@patternfly/react-icons/dist/esm/icons/plus-circle-icon';
import { WorkspacesPodVolumeMount } from '~/generated/data-contracts';
import ThemeAwareFormGroupWrapper from '~/shared/components/ThemeAwareFormGroupWrapper';

interface WorkspaceFormPropertiesVolumesProps {
volumes: WorkspacesPodVolumeMount[];
Expand Down Expand Up @@ -149,7 +150,7 @@ export const WorkspaceFormPropertiesVolumes: React.FC<WorkspaceFormPropertiesVol
/>
<ModalBody>
<Form>
<FormGroup label="PVC Name" isRequired fieldId="pvc-name">
<ThemeAwareFormGroupWrapper label="PVC Name" isRequired fieldId="pvc-name">
<TextInput
name="pvcName"
isRequired
Expand All @@ -158,8 +159,8 @@ export const WorkspaceFormPropertiesVolumes: React.FC<WorkspaceFormPropertiesVol
onChange={(_, val) => setFormData({ ...formData, pvcName: val })}
id="pvc-name"
/>
</FormGroup>
<FormGroup label="Mount Path" isRequired fieldId="mount-path">
</ThemeAwareFormGroupWrapper>
<ThemeAwareFormGroupWrapper label="Mount Path" isRequired fieldId="mount-path">
<TextInput
name="mountPath"
isRequired
Expand All @@ -168,7 +169,7 @@ export const WorkspaceFormPropertiesVolumes: React.FC<WorkspaceFormPropertiesVol
onChange={(_, val) => setFormData({ ...formData, mountPath: val })}
id="mount-path"
/>
</FormGroup>
</ThemeAwareFormGroupWrapper>
<FormGroup fieldId="readonly-access">
<Switch
id="readonly-access-switch"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,47 +47,49 @@ export const WorkspaceConnectAction: React.FunctionComponent<WorkspaceConnectAct
};

return (
<Dropdown
isOpen={open}
onSelect={onSelect}
onOpenChange={(isOpen: boolean) => setIsOpen(isOpen)}
toggle={(toggleRef: React.Ref<MenuToggleElement>) => (
<MenuToggle
ref={toggleRef}
variant="secondary"
onClick={onToggleClick}
isExpanded={open}
isDisabled={workspace.state !== WorkspacesWorkspaceState.WorkspaceStateRunning}
splitButtonItems={[
<MenuToggleAction
id="connect-endpoint-button"
key="connect-endpoint-button"
onClick={onClickConnect}
className="connect-button-no-wrap"
>
Connect
</MenuToggleAction>,
]}
/>
)}
ouiaId="BasicDropdown"
shouldFocusToggleOnSelect
>
<DropdownList>
{workspace.services.map((service) => {
if (!service.httpService) {
return null;
}
return (
<DropdownItem
value={service.httpService.httpPath}
key={`${workspace.name}-${service.httpService.displayName}`}
>
{service.httpService.displayName}
</DropdownItem>
);
})}
</DropdownList>
</Dropdown>
<div className="workspace-connect-wrapper pf-v6-u-display-inline-block">
<Dropdown
isOpen={open}
onSelect={onSelect}
onOpenChange={(isOpen: boolean) => setIsOpen(isOpen)}
toggle={(toggleRef: React.Ref<MenuToggleElement>) => (
<MenuToggle
ref={toggleRef}
variant="secondary"
onClick={onToggleClick}
isExpanded={open}
isDisabled={workspace.state !== WorkspacesWorkspaceState.WorkspaceStateRunning}
splitButtonItems={[
<MenuToggleAction
id="connect-endpoint-button"
key="connect-endpoint-button"
onClick={onClickConnect}
className="connect-button-no-wrap"
>
Connect
</MenuToggleAction>,
]}
/>
)}
ouiaId="BasicDropdown"
shouldFocusToggleOnSelect
>
<DropdownList>
{workspace.services.map((service) => {
if (!service.httpService) {
return null;
}
return (
<DropdownItem
value={service.httpService.httpPath}
key={`${workspace.name}-${service.httpService.displayName}`}
>
{service.httpService.displayName}
</DropdownItem>
);
})}
</DropdownList>
</Dropdown>
</div>
);
};
Loading