-
Notifications
You must be signed in to change notification settings - Fork 356
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
feat: Use filtered resource pools when creating notebook #9045
Conversation
✅ Deploy Preview for determined-ui ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #9045 +/- ##
==========================================
- Coverage 47.81% 41.74% -6.07%
==========================================
Files 1161 841 -320
Lines 143646 104196 -39450
Branches 2373 2378 +5
==========================================
- Hits 68678 43496 -25182
+ Misses 74815 60547 -14268
Partials 153 153
Flags with carried forward coverage won't be shown. Click here to find out more.
|
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.
added some comments, otherwise it works as expected. LGTM
@@ -129,6 +129,8 @@ class WorkspaceStore extends PollingStore { | |||
public readonly boundResourcePools = (workspaceId: number) => | |||
this.#boundResourcePools.select((map) => map.get(workspaceId)?.toJS()); | |||
|
|||
public readonly boundResourcePoolsMap = () => this.#boundResourcePools.readOnly(); |
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.
Does that need to be a function?
why not like this?
public readonly boundResourcePoolsMap = () => this.#boundResourcePools.readOnly(); | |
public readonly boundResourcePoolsMap = this.#boundResourcePools.readOnly(); |
@@ -349,12 +349,23 @@ const JupyterLabForm: React.FC<{ | |||
}> = ({ form, formId, currentWorkspace, defaults, lockedWorkspace, setWorkspace, workspaces }) => { | |||
const [templates, setTemplates] = useState<Template[]>([]); | |||
|
|||
const resourcePools = Loadable.getOrElse([], useObservable(clusterStore.resourcePools)); | |||
const selectedWorkspace = Form.useWatch('workspaceId', form); |
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.
nit:
const selectedWorkspace = Form.useWatch('workspaceId', form); | |
const selectedWorkspaceId = Form.useWatch('workspaceId', form); |
<Select allowClear placeholder="Pick the best option"> | ||
{resourcePools.map((pool) => ( | ||
<Form.Item label="Resource Pool" name="pool"> | ||
<Select allowClear disabled={!selectedWorkspace} placeholder="Pick the best option"> |
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.
nit: i dont think workspace id would take 0
in the future, but as a convention, selectedWorkspaceId === undefined
can avoid a potential bug.
const boundResourcePoolsMap = useObservable(workspaceStore.boundResourcePoolsMap()); | ||
|
||
const boundResourcePools: ResourcePool[] = useMemo(() => { | ||
if (!Loadable.isLoaded(resourcePools) || !boundResourcePoolsMap || !selectedWorkspace) |
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.
what does !boundResourcePoolsMap
mean here? i dont think boundResourcePoolsMap
can be undefined
. and empty map still return true.
nit: selectedWorkspace === undefined
Description
Filter resource pools by selected workspace when creating notebook.
Test Plan
With and without rbac enabled, open the modal for creating Jupyter notebook.
Before selecting the workspace, the resource pool dropdown is disabled.
After selecting the workspace, verify that the resource pool dropdown only contains resource pools that are bound to that workspace (including shared resource pools)
Commentary (optional)
Checklist
docs/release-notes/
.See Release Note for details.
Ticket
MD-284