Skip to content

Commit

Permalink
fix: use selected checkpoints when registering (#8739)
Browse files Browse the repository at this point in the history
  • Loading branch information
erikwilson authored Jan 24, 2024
1 parent 6db8c06 commit 9f06d35
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion webui/react/src/components/RegisterCheckpointModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ const RegisterCheckpointModal: React.FC<ModalProps> = ({
} catch (e) {
handleError(e, {
publicSubject: `Unable to register ${pluralizer(checkpoints.length, 'checkpoint')}.`,
silent: true,
silent: false,
type: ErrorType.Api,
});
}
Expand Down
15 changes: 10 additions & 5 deletions webui/react/src/pages/ExperimentDetails/ExperimentCheckpoints.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ const ExperimentCheckpoints: React.FC<Props> = ({ experiment, pageRef }: Props)
const [isLoading, setIsLoading] = useState(true);
const [checkpoints, setCheckpoints] = useState<CoreApiGenericCheckpoint[]>();
const [models, setModels] = useState<Loadable<ModelItem[]>>(NotLoaded);
const [selectedCheckpoints, setSelectedCheckpoints] = useState<string[]>();
const [selectedModelName, setSelectedModelName] = useState<string>();
const [canceler] = useState(new AbortController());

Expand Down Expand Up @@ -145,9 +146,13 @@ const ExperimentCheckpoints: React.FC<Props> = ({ experiment, pageRef }: Props)
fetchModels();
}, [fetchModels]);

const handleRegisterCheckpoint = useCallback(() => {
registerModal.open();
}, [registerModal]);
const handleRegisterCheckpoint = useCallback(
(checkpoints: string[]) => {
setSelectedCheckpoints(checkpoints);
registerModal.open();
},
[registerModal],
);

const handleDelete = useCallback((checkpoints: string[]) => {
readStream(
Expand Down Expand Up @@ -183,7 +188,7 @@ const ExperimentCheckpoints: React.FC<Props> = ({ experiment, pageRef }: Props)
(checkpoints: string | string[]) => {
const checkpointsArr = ensureArray(checkpoints);
return {
[checkpointAction.Register]: () => handleRegisterCheckpoint(),
[checkpointAction.Register]: () => handleRegisterCheckpoint(checkpointsArr),
[checkpointAction.Delete]: () => handleDeleteCheckpoint(checkpointsArr),
};
},
Expand Down Expand Up @@ -405,7 +410,7 @@ const ExperimentCheckpoints: React.FC<Props> = ({ experiment, pageRef }: Props)
</Section>
<modelCreateModal.Component onClose={handleOnCloseCreateModel} />
<registerModal.Component
checkpoints={(checkpoints ?? []).map((c) => c.uuid)}
checkpoints={selectedCheckpoints ?? []}
closeModal={registerModal.close}
modelName={selectedModelName}
models={models}
Expand Down

0 comments on commit 9f06d35

Please sign in to comment.