Skip to content

Commit

Permalink
fix: filter action experiments, old ExperimentList (#9325)
Browse files Browse the repository at this point in the history
(cherry picked from commit 3b167c7)
  • Loading branch information
johnkim-det authored and determined-ci committed May 7, 2024
1 parent 5ebb008 commit 0322dc7
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions webui/react/src/pages/ExperimentList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -714,39 +714,38 @@ const ExperimentList: React.FC<Props> = ({ project }) => {
const sendBatchActions = useCallback(
(action: Action): Promise<void[] | CommandTask | CommandResponse> | void => {
if (!settings.row) return;
const validExperimentIds = [...settings.row].filter((id) =>
canActionExperiment(action, experimentMap[id]),
);
if (action === Action.OpenTensorBoard) {
return openOrCreateTensorBoard({
experimentIds: settings.row,
experimentIds: validExperimentIds,
workspaceId: project.workspaceId,
});
}
if (action === Action.Move) {
if (!settings?.row?.length) return;
if (!validExperimentIds.length) return;
setBatchMovingExperimentIds(
settings.row.filter(
(id) =>
canActionExperiment(Action.Move, experimentMap[id]) &&
permissions.canMoveExperiment({ experiment: experimentMap[id] }),
validExperimentIds.filter((id) =>
permissions.canMoveExperiment({ experiment: experimentMap[id] }),
),
);
ExperimentMoveModal.open();
}
if (action === Action.RetainLogs) {
if ((settings?.row ?? []).length === 0) return;
if (!validExperimentIds.length) return;
setBatchRetainLogsExperimentIds(
settings.row.filter(
(id) =>
canActionExperiment(Action.RetainLogs, experimentMap[id]) &&
permissions.canModifyExperiment({
workspace: { id: experimentMap[id].workspaceId },
}),
validExperimentIds.filter((id) =>
permissions.canModifyExperiment({
workspace: { id: experimentMap[id].workspaceId },
}),
),
);
ExperimentRetainLogsModal.open();
}

return Promise.all(
(settings.row || []).map((experimentId) => {
(validExperimentIds || []).map((experimentId) => {
switch (action) {
case Action.Activate:
return activateExperiment({ experimentId });
Expand Down

0 comments on commit 0322dc7

Please sign in to comment.