-
Notifications
You must be signed in to change notification settings - Fork 1
✨ New job screen #77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
✨ New job screen #77
Conversation
….tsx Co-authored-by: Copilot <[email protected]>
* Removed header from NewResource component and put it each NewJob and NewSession component
…w reusable component
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a new job creation feature with a multi-step wizard interface, refactors shared components for reuse between compute sessions and jobs, and adds support for optional parameters in the GraphQL schema.
- Adds a new "New Job" page with a two-step wizard (domain/image selection, then command configuration)
- Refactors domain, image, and volume selection components into generic reusable components
- Adds a
nameparameter to job creation
Reviewed Changes
Copilot reviewed 24 out of 26 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| components/ui/web/theme.json | Updates theme colors from purple to blue palette |
| components/ui/web/src/graphql/typings.ts | Adds optional name field to CreateJobParams and QueryGetDomainsArgs |
| components/ui/web/src/graphql/domains.ts | Adds jobs parameter to GET_DOMAINS query and fetches additional domain fields |
| components/ui/web/pages/jobs/new.tsx | Creates new page for job creation |
| components/ui/web/pages/compute/new.tsx | Updates import path for refactored NewSession component |
| components/ui/web/components/content/newResource/*.tsx | Creates shared accordion components for resource selection |
| components/ui/web/components/content/jobs/new/*.tsx | Implements new job creation wizard with command form |
| components/ui/web/components/content/jobs/list/*.tsx | Adds "New Job" button to jobs list |
| components/ui/web/components/content/compute/sessionManagement/newSession.tsx | Refactors to use shared NewResource component |
| components/ui/web/.env.development | Updates default image name and adds job configuration defaults |
| components/ui/graphql/src/**/*.ts | Updates GraphQL schema and resolvers for jobs parameter |
Comments suppressed due to low confidence (2)
components/ui/web/components/content/newResource/singleChoiceAccordion.tsx:50
- Potential null pointer exception. The
choicevariable is optional (choice?: Choice) but is accessed with the non-null assertion operator!on line 50. This will throw an error ifchoiceis undefined when rendering the list. Add a null check:selected={choice?.id === ch.id}
components/ui/web/components/content/newResource/singleChoiceAccordion.tsx:55 - Missing key prop in mapped component. React requires a unique
keyprop when rendering lists. Add a key prop to InfoCard:<InfoCard key={ch.id} ...>
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
components/ui/web/components/content/newResource/workingDirectoryAccordion.tsx
Show resolved
Hide resolved
….tsx Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
amitschang
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A handful of inline comments, overall looks good
| # NEXT_PUBLIC_GRAPHQL_URL=http://localhost:4000/graphql | ||
| NEXT_PUBLIC_GRAPHQL_URL=https://apps.sciserver.org/graphql |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we remove the commented line and then from here on not modify these lines for typical PRs. local workflows should have a way to replace this without committing the changes (either by another file or by restoring after testing)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't usually modify it, but since I was going to make a change to this file, I decided to commit this one too. For local deployments, it's best to have this point to the apps.sciserver.org version of the GraphQL instead of the local version.
| import { GET_DOMAINS } from 'src/graphql/domains'; | ||
| import { LoadingAnimation } from 'components/common/loadingAnimation'; | ||
|
|
||
| import { NewResource, NewSessionType } from 'components/content/newResource/newResource'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mentioning here since it is the first place I see, but I think the name NewResource is probably too generic. Looks like this is a specification particular to compute. Could it rather be NewSession or NewSessionSpec or something - this would match some of the other naming better (session name, session type)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It used to be called NewSession when it was only used for creating new compute sessions, but since I now reuse it for jobs too, I wasn't sure if that's the correct name. I wanted to start this discussion. If sharing it between jobs and compute sessions makes sense for it to be called NewSession given the shared functionality, I'll call it that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think new session is fine for both, maybe even NewComputeSession
| const [createJob] = useMutation(CREATE_JOB, { | ||
| onError: () => Swal.fire({ | ||
| title: 'Unable to add docker job', | ||
| text: 'Please email <a href=\"mailto:[email protected]\">[email protected]</a> for more assistance.', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should be using environment variables for the mailto and other help/doc links.
| variables: { jobs: true }, | ||
| onError: (error: ApolloError) => { | ||
| if (error.message.includes('Unauthorized')) { | ||
| router.push('/login?callbackURL=/compute'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this be jobs specific page and not general compute page?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops yes lol
* Adjust redirect URL on unauthorized access
NEW FEATURE ✨ ❤️🔥
Jobs/screen click onNew Jobto create a new Job.Create Sessionconfig page, where the user can choose Domain, Image, DataVolumes and UserVolumes.🤕 Known issues that will be created as separate issues once this PR is approved, unless they need to be fixed before merge as per reviewers' requests:
jobs/screen. GraphQL is not forcing a reload, and the new job is not appearing in the list; a reload is needed. There also needs to be an additional feature to add a sort of subscription to the jobs to check when their status changes; right now, a reload is required to check status changes.displayNamefor UserVolumes to be able to reuse theDataVolumeChoiceAccordion,UserVolumeAccordion, andWorkingDirectoryAccordioncomponents.