Skip to content

Commit

Permalink
feat(ws): Notebooks 2.0 // Frontend // Workspaces table // Workspace …
Browse files Browse the repository at this point in the history
…Kind column kubeflow#148

Signed-off-by: Liav Weiss (EXT-Nokia) <liav.weiss.ext@nokia.com>
  • Loading branch information
Liav Weiss (EXT-Nokia) committed Jan 23, 2025
1 parent 6fceada commit d54ed38
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 23 deletions.
6 changes: 0 additions & 6 deletions node_modules/.package-lock.json

This file was deleted.

6 changes: 0 additions & 6 deletions package-lock.json

This file was deleted.

4 changes: 2 additions & 2 deletions workspaces/frontend/src/app/context/useNotebookAPIState.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { APIState } from '~/shared/api/types';
import { NotebookAPIs } from '~/app/types';
import { getNamespaces, getWorkspacekinds} from '~/shared/api/notebookService';
import { getNamespaces, getWorkspaceKinds} from '~/shared/api/notebookService';
import useAPIState from '~/shared/api/useAPIState';


Expand All @@ -13,7 +13,7 @@ const useNotebookAPIState = (
const createAPI = React.useCallback(
(path: string) => ({
getNamespaces: getNamespaces(path),
getWorkspacekinds: getWorkspacekinds(path),
getWorkspaceKinds: getWorkspaceKinds(path),
}),
[],
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@ import useFetchState, {
import { WorkspaceKind } from '~/shared/types';
import { useNotebookAPI } from '~/app/hooks/useNotebookAPI';

const useWorkspacekinds = (): FetchState<WorkspaceKind[]> => {
const useWorkspaceKinds = (): FetchState<WorkspaceKind[]> => {
const { api, apiAvailable } = useNotebookAPI();
const call = React.useCallback<FetchStateCallbackPromise<WorkspaceKind[]>>(
(opts) => {
if (!apiAvailable) {
return Promise.reject(new Error('API not yet available'));
}
return api.getWorkspacekinds(opts);
return api.getWorkspaceKinds(opts);
},
[api, apiAvailable],
);

return useFetchState(call, []);
};

export default useWorkspacekinds;
export default useWorkspaceKinds;
6 changes: 3 additions & 3 deletions workspaces/frontend/src/app/pages/Workspaces/Workspaces.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ import { WorkspaceDetails } from '~/app/pages/Workspaces/Details/WorkspaceDetail
import { ExpandedWorkspaceRow } from '~/app/pages/Workspaces/ExpandedWorkspaceRow';
import Filter, { FilteredColumn } from 'shared/components/Filter';
import { formatRam } from 'shared/utilities/WorkspaceResources';
import { buildKindLogoDictionary } from '~/app/actions/WorkspacekindsActions';
import useWorkspacekinds from '~/app/hooks/useWorkspacekinds';
import { buildKindLogoDictionary } from '~/app/actions/WorkspaceKindsActions';
import useWorkspaceKinds from '~/app/hooks/useWorkspaceKinds';

export const Workspaces: React.FunctionComponent = () => {
/* Mocked workspaces, to be removed after fetching info from backend */
Expand Down Expand Up @@ -135,7 +135,7 @@ export const Workspaces: React.FunctionComponent = () => {
},
];

const [workspaceKinds, loaded, loadError] = useWorkspacekinds();
const [workspaceKinds, loaded, loadError] = useWorkspaceKinds();
let kindLogoDict: Record<string, string> = {};

if (loaded && workspaceKinds) {
Expand Down
4 changes: 2 additions & 2 deletions workspaces/frontend/src/app/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ export type NamespacesList = Namespace[];

export type GetNamespaces = (opts: APIOptions) => Promise<NamespacesList>;

export type GetWorkspacekinds = (opts: APIOptions) => Promise<WorkspaceKind[]>;
export type GetWorkspaceKinds = (opts: APIOptions) => Promise<WorkspaceKind[]>;

export type NotebookAPIs = {
getNamespaces: GetNamespaces;
getWorkspacekinds: GetWorkspacekinds;
getWorkspaceKinds: GetWorkspaceKinds;
};
2 changes: 1 addition & 1 deletion workspaces/frontend/src/shared/api/notebookService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const getNamespaces =
throw new Error('Invalid response format');
});

export const getWorkspacekinds =
export const getWorkspaceKinds =
(hostPath: string) =>
(opts: APIOptions): Promise<WorkspaceKind[]> =>
handleRestFailures(restGET(hostPath, `/workspacekinds`, {}, opts)).then((response) => {
Expand Down

0 comments on commit d54ed38

Please sign in to comment.