@@ -3,9 +3,11 @@ import { useTranslation } from 'react-i18next';
33import { useNavigate , useParams } from 'react-router-dom' ;
44import { debounce } from 'lodash' ;
55import { ExpandableSection , Tabs } from '@cloudscape-design/components' ;
6+ import { ButtonProps } from '@cloudscape-design/components/button' ;
67import Wizard from '@cloudscape-design/components/wizard' ;
78
89import {
10+ Alert ,
911 Box ,
1012 Button ,
1113 ButtonWithConfirmation ,
@@ -22,7 +24,7 @@ import {
2224import { HotspotIds } from 'layouts/AppLayout/TutorialPanel/constants' ;
2325
2426import { useBreadcrumbs , useNotifications } from 'hooks' ;
25- import { riseRouterException } from 'libs' ;
27+ import { goToUrl , riseRouterException } from 'libs' ;
2628import { copyToClipboard } from 'libs' ;
2729import { ROUTES } from 'routes' ;
2830import { useGetProjectQuery , useUpdateProjectMembersMutation , useUpdateProjectMutation } from 'services/project' ;
@@ -35,6 +37,7 @@ import { useDeleteProject } from 'pages/Project/hooks/useDeleteProject';
3537import { ProjectMembers } from 'pages/Project/Members' ;
3638import { getProjectRoleByUserName } from 'pages/Project/utils' ;
3739
40+ import { useCheckingForFleetsInProjects } from '../../../../hooks/useCheckingForFleetsInProjectsOfMember' ;
3841import { useBackendsTable } from '../../Backends/hooks' ;
3942import { BackendsTable } from '../../Backends/Table' ;
4043import { GatewaysTable } from '../../Gateways' ;
@@ -60,6 +63,10 @@ export const ProjectSettings: React.FC = () => {
6063 const { deleteProject, isDeleting } = useDeleteProject ( ) ;
6164 const { data : currentUser } = useGetUserDataQuery ( { } ) ;
6265
66+ const projectNames = useMemo ( ( ) => [ paramProjectName ] , [ paramProjectName ] ) ;
67+
68+ const projectHavingFleetMap = useCheckingForFleetsInProjects ( { projectNames } ) ;
69+
6370 const { data, isLoading, error } = useGetProjectQuery ( { name : paramProjectName } ) ;
6471
6572 const { data : runsData } = useGetRunsQuery ( {
@@ -180,6 +187,13 @@ export const ProjectSettings: React.FC = () => {
180187
181188 const [ activeStepIndex , setActiveStepIndex ] = React . useState ( 0 ) ;
182189
190+ const projectDontHasFleet = ! projectHavingFleetMap ?. [ paramProjectName ] ;
191+
192+ const onCreateAFleet : ButtonProps [ 'onClick' ] = ( event ) => {
193+ event . preventDefault ( ) ;
194+ goToUrl ( 'https://dstack.ai/docs/quickstart/#create-a-fleet' , true ) ;
195+ } ;
196+
183197 if ( isLoadingPage )
184198 return (
185199 < Container >
@@ -191,6 +205,22 @@ export const ProjectSettings: React.FC = () => {
191205 < >
192206 { data && backendsData && gatewaysData && (
193207 < SpaceBetween size = "l" >
208+ { projectDontHasFleet && (
209+ < div className = { styles . alertBox } >
210+ < Alert
211+ header = { t ( 'fleets.no_alert.title' ) }
212+ type = "info"
213+ action = {
214+ < Button iconName = "external" formAction = "none" onClick = { onCreateAFleet } >
215+ { t ( 'fleets.no_alert.button_title' ) }
216+ </ Button >
217+ }
218+ >
219+ The project < code > { paramProjectName } </ code > has no fleets. Create one before submitting a run.
220+ </ Alert >
221+ </ div >
222+ ) }
223+
194224 { isProjectMember && (
195225 < ExpandableSection
196226 variant = "container"
0 commit comments