@@ -7,15 +7,17 @@ import * as yup from 'yup';
77import { Box , Link , WizardProps } from '@cloudscape-design/components' ;
88import { CardsProps } from '@cloudscape-design/components/cards' ;
99
10- import type { TabsProps , ToggleProps } from 'components' ;
10+ import { TabsProps , ToggleProps } from 'components' ;
1111import { Container , FormCodeEditor , FormField , FormInput , FormSelect , SpaceBetween , Tabs , Toggle , Wizard } from 'components' ;
1212
1313import { useBreadcrumbs , useNotifications } from 'hooks' ;
14+ import { useCheckingForFleetsInProjects } from 'hooks/useCheckingForFleetsInProjectsOfMember' ;
1415import { getServerError } from 'libs' ;
1516import { ROUTES } from 'routes' ;
1617import { useApplyRunMutation } from 'services/run' ;
1718
1819import { OfferList } from 'pages/Offers/List' ;
20+ import { NoFleetProjectAlert } from 'pages/Project/components/NoFleetProjectAlert' ;
1921
2022import { useGenerateYaml } from './hooks/useGenerateYaml' ;
2123import { useGetRunSpecFromYaml } from './hooks/useGetRunSpecFromYaml' ;
@@ -117,6 +119,9 @@ export const CreateDevEnvironment: React.FC = () => {
117119
118120 const [ getRunSpecFromYaml ] = useGetRunSpecFromYaml ( { projectName : selectedProject ?? '' } ) ;
119121
122+ const projectHavingFleetMap = useCheckingForFleetsInProjects ( { projectNames : selectedProject ? [ selectedProject ] : [ ] } ) ;
123+ const projectDontHasFleets = ! ! selectedProject && ! projectHavingFleetMap [ selectedProject ] ;
124+
120125 const [ applyRun , { isLoading : isApplying } ] = useApplyRunMutation ( ) ;
121126
122127 const loading = isApplying ;
@@ -174,6 +179,10 @@ export const CreateDevEnvironment: React.FC = () => {
174179 const stepValidators = [ validateOffer , validateSecondStep , validateConfig ] ;
175180
176181 if ( reason === 'next' ) {
182+ if ( projectDontHasFleets ) {
183+ window . scrollTo ( 0 , 0 ) ;
184+ }
185+
177186 stepValidators [ activeStepIndex ] ?.( ) . then ( ( isValid ) => {
178187 if ( isValid ) {
179188 setActiveStepIndex ( requestedStepIndex ) ;
@@ -277,6 +286,12 @@ export const CreateDevEnvironment: React.FC = () => {
277286
278287 return (
279288 < form className = { cn ( { [ styles . wizardForm ] : activeStepIndex === 0 } ) } onSubmit = { handleSubmit ( onSubmit ) } >
289+ < NoFleetProjectAlert
290+ className = { styles . noFleetAlert }
291+ projectName = { selectedProject ?? '' }
292+ show = { projectDontHasFleets }
293+ />
294+
280295 < Wizard
281296 activeStepIndex = { activeStepIndex }
282297 onNavigate = { onNavigateHandler }
0 commit comments