Skip to content

Commit

Permalink
feat(pci.ai.tools): last dashboard pr comment and notebook link fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Arthur Bullet <arthur.bullet@ovhcloud.com>
  • Loading branch information
abullet33 committed Jan 30, 2025
1 parent 1a686ac commit bc39614
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export function useDeleteNotebook({
onSuccess: () => {
// Invalidate notebooks list query to get the latest data
queryClient.invalidateQueries({
queryKey: [projectId, 'ai/notebook', { exact: true }],
queryKey: [projectId, 'ai/notebook'],
});
onDeleteSuccess();
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@ export function isRunningNotebook(currentState: ai.notebook.NotebookStateEnum) {
}

export function isStoppedNotebook(currentState: ai.notebook.NotebookStateEnum) {
return currentState === ai.notebook.NotebookStateEnum.STOPPED;
return (
currentState === ai.notebook.NotebookStateEnum.STOPPED ||
currentState === ai.notebook.NotebookStateEnum.ERROR ||
currentState === ai.notebook.NotebookStateEnum.FAILED ||
currentState === ai.notebook.NotebookStateEnum.SYNC_FAILED
);
}

export function isDeletingNotebook(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ const AddDatastore = () => {
<SelectValue />
</SelectTrigger>
<SelectContent>
{regionsQuery.data.map((region) => (
{regionsQuery.data?.map((region) => (
<SelectItem key={region.id} value={region.id}>
{tRegions(`region_${region.id}`)}
</SelectItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ const AddDocker = () => {
<SelectValue />
</SelectTrigger>
<SelectContent>
{regionQuery.data.map((region) => (
{regionQuery.data?.map((region) => (
<SelectItem key={region.id} value={region.id}>
{tRegions(`region_${region.id}`)}
</SelectItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ const AddGit = () => {
<SelectValue />
</SelectTrigger>
<SelectContent>
{regionsQuery.data.map((region) => (
{regionsQuery.data?.map((region) => (
<SelectItem key={region.id} value={region.id}>
{tRegions(`region_${region.id}`)}
</SelectItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ const AddToken = () => {
<SelectValue />
</SelectTrigger>
<SelectContent>
{regionsQuery.data.map((region) => (
{regionsQuery.data?.map((region) => (
<SelectItem key={region.id} value={region.id}>
{tRegions(`region_${region.id}`)}
</SelectItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const DeleteNotebookModal = () => {
const notebookQuery = useGetNotebook(projectId, notebookId);
return (
<DeleteNotebook
onSuccess={() => navigate('../..')}
onSuccess={() => navigate('../../notebooks')}
notebook={notebookQuery.data}
/>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,6 @@ describe('Order funnel page', () => {
await waitFor(() => {
expect(notebookApi.addNotebook).toHaveBeenCalled();
});
expect(mockedUsedNavigate).toHaveBeenCalledWith('../undefined');
expect(mockedUsedNavigate).toHaveBeenCalledWith('../notebooks/undefined');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ import A from '@/components/links/A.component';
import { useLocale } from '@/hooks/useLocale';
import OvhLink from '@/components/links/OvhLink.component';
import { GUIDES, getGuideUrl } from '@/configuration/guide';
import Link from '@/components/links/Link.component';

interface OrderFunnelProps {
regions: ai.capabilities.Region[];
Expand Down Expand Up @@ -111,7 +112,7 @@ const OrderFunnel = ({
title: t('successCreatingNotebookTitle'),
description: t('successCreatingNotebookDescription'),
});
navigate(`../${notebook.id}`);
navigate(`../notebooks/${notebook.id}`);
},
});

Expand Down Expand Up @@ -442,6 +443,13 @@ const OrderFunnel = ({
</FormLabel>
<p>
{t('fieldVolumeDescription1')}{' '}
<Link
className="mx-1"
to={'../dashboard/datastore'}
>
{t('fieldVolumeDashboardLink')}
</Link>
<OvhLink
application="public-cloud"
path={`#/pci/projects/${projectId}/ai/dashboard/datastore`}
Expand Down
6 changes: 3 additions & 3 deletions packages/manager/apps/pci-ai-notebooks/src/routes/routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,21 +42,21 @@ export default [
),
children: [
{
path: 'notebooks/start/:notebookId',
path: 'start/:notebookId',
id: 'notebooks.start',
...lazyRouteConfig(() =>
import('@/pages/notebooks/start/Start.modal'),
),
},
{
path: 'notebooks/stop/:notebookId',
path: 'stop/:notebookId',
id: 'notebooks.stop',
...lazyRouteConfig(() =>
import('@/pages/notebooks/stop/Stop.modal'),
),
},
{
path: 'notebooks/delete/:notebookId',
path: 'delete/:notebookId',
id: 'notebooks.delete',
...lazyRouteConfig(() =>
import('@/pages/notebooks/delete/Delete.modal'),
Expand Down

0 comments on commit bc39614

Please sign in to comment.