Skip to content

Commit 61c4593

Browse files
author
Yehudit Kerido
committed
feat(ws): Notebooks 2.0 // Frontend // Fetch workspaces
Signed-off-by: Yehudit Kerido <[email protected]>
1 parent b960322 commit 61c4593

File tree

4 files changed

+7
-43
lines changed

4 files changed

+7
-43
lines changed
Binary file not shown.

workspaces/frontend/src/__tests__/cypress/cypress/tests/mocked/workspace.mock.ts

Lines changed: 4 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import type { Workspace, WorkspaceKind } from '~/shared/types';
12
import { WorkspaceState } from '~/shared/types';
23

34
const generateMockWorkspace = (
@@ -10,52 +11,15 @@ const generateMockWorkspace = (
1011
podConfigId: string,
1112
podConfigDisplayName: string,
1213
pvcName: string,
13-
): {
14-
name: string;
15-
namespace: string;
16-
workspaceKind: { name: string };
17-
deferUpdates: boolean;
18-
paused: boolean;
19-
pausedTime: number;
20-
pendingRestart: boolean;
21-
state: WorkspaceState;
22-
stateMessage: string;
23-
podTemplate: {
24-
podMetadata: { labels: object; annotations: object };
25-
volumes: {
26-
home: { pvcName: string; mountPath: string; readOnly: boolean };
27-
data: { pvcName: string; mountPath: string; readOnly: boolean }[];
28-
};
29-
options: {
30-
imageConfig: {
31-
current: {
32-
id: string;
33-
displayName: string;
34-
description: string;
35-
labels: { key: string; value: string }[];
36-
};
37-
};
38-
podConfig: {
39-
current: {
40-
id: string;
41-
displayName: string;
42-
description: string;
43-
labels: ({ key: string; value: string } | { key: string; value: string })[];
44-
};
45-
};
46-
};
47-
};
48-
activity: { lastActivity: number; lastUpdate: number };
49-
services: { httpService: { displayName: string; httpPath: string } }[];
50-
} => {
14+
): Workspace => {
5115
const currentTime = Date.now();
5216
const lastActivityTime = currentTime - Math.floor(Math.random() * 1000000);
5317
const lastUpdateTime = currentTime - Math.floor(Math.random() * 100000);
5418

5519
return {
5620
name,
5721
namespace,
58-
workspaceKind: { name: 'jupyterlab' },
22+
workspaceKind: { name: 'jupyterlab' } as WorkspaceKind,
5923
deferUpdates: paused,
6024
paused,
6125
pausedTime: paused ? currentTime - Math.floor(Math.random() * 1000000) : 0,
@@ -92,7 +56,7 @@ const generateMockWorkspace = (
9256
id: imageConfigId,
9357
displayName: imageConfigDisplayName,
9458
description: 'JupyterLab environment',
95-
labels: [{ key: 'python_version', value: '3.11' }],
59+
labels: [{ key: 'python_version', value: 3.11 }],
9660
},
9761
},
9862
podConfig: {

workspaces/frontend/src/app/pages/Workspaces/Details/WorkspaceDetailsActivity.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ type WorkspaceDetailsActivityProps = {
1616
export const WorkspaceDetailsActivity: React.FunctionComponent<WorkspaceDetailsActivityProps> = ({
1717
workspace,
1818
}) => {
19-
const { activity, pausedTime: pauseTime, pendingRestart } = workspace;
19+
const { activity, pausedTime, pendingRestart } = workspace;
2020

2121
return (
2222
<DescriptionList isHorizontal>
@@ -37,7 +37,7 @@ export const WorkspaceDetailsActivity: React.FunctionComponent<WorkspaceDetailsA
3737
<DescriptionListGroup>
3838
<DescriptionListTerm>Pause Time</DescriptionListTerm>
3939
<DescriptionListDescription data-testid="pauseTime">
40-
{formatTimestamp(pauseTime)}
40+
{formatTimestamp(pausedTime)}
4141
</DescriptionListDescription>
4242
</DescriptionListGroup>
4343
<Divider />

workspaces/frontend/src/app/pages/Workspaces/Details/WorkspaceDetailsOverview.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export const WorkspaceDetailsOverview: React.FunctionComponent<WorkspaceDetailsO
4040
<DescriptionListGroup>
4141
<DescriptionListTerm>Pod config</DescriptionListTerm>
4242
<DescriptionListDescription>
43-
{JSON.stringify(workspace.podTemplate.options.podConfig, null, 2)}
43+
{workspace.podTemplate.options.podConfig.current.displayName}
4444
</DescriptionListDescription>
4545
</DescriptionListGroup>
4646
<Divider />

0 commit comments

Comments
 (0)