Skip to content

Commit

Permalink
fix: Experiment table, right-click context menu [WEB-1942] (#8756)
Browse files Browse the repository at this point in the history
* edit experiment confirm message to toast
* suggested code changes
  • Loading branch information
mapmeld authored Jan 25, 2024
1 parent 2ffc18f commit 90a57cb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
7 changes: 4 additions & 3 deletions webui/react/src/pages/F_ExpList/F_ExperimentList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Message from 'hew/Message';
import Pagination from 'hew/Pagination';
import Row from 'hew/Row';
import { useTheme } from 'hew/Theme';
import { notification } from 'hew/Toast';
import { useToast } from 'hew/Toast';
import { Loadable, Loaded, NotLoaded } from 'hew/utils/loadable';
import { observable, useObservable } from 'micro-observables';
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
Expand Down Expand Up @@ -130,6 +130,7 @@ const F_ExperimentList: React.FC<Props> = ({ project }) => {
Loaded: (formset: FilterFormSet) => formset.filterGroup.children,
});
const isMobile = useMobile();
const { openToast } = useToast();

const [selection, setSelection] = React.useState<GridSelection>({
columns: CompactSelection.empty(),
Expand Down Expand Up @@ -551,7 +552,7 @@ const F_ExperimentList: React.FC<Props> = ({ project }) => {
break;
case ExperimentAction.Edit:
if (data) updateExperiment(data);
notification.success({ message: 'Experiment updated successfully' });
openToast({ severity: 'Confirm', title: 'Experiment updated successfully' });
break;
case ExperimentAction.Move:
case ExperimentAction.Delete:
Expand All @@ -570,7 +571,7 @@ const F_ExperimentList: React.FC<Props> = ({ project }) => {
}
handleSelectionChange('remove-all', [0, selectedExperimentIds.size]);
},
[handleSelectionChange, selectedExperimentIds],
[handleSelectionChange, selectedExperimentIds, openToast],
);

const handleContextMenuComplete = useCallback(
Expand Down
4 changes: 1 addition & 3 deletions webui/react/src/pages/F_ExpList/glide-table/contextMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ function useOutsideClickHandler(ref: MutableRefObject<any>, handler: (event: Eve
if (
ref.current &&
!ref.current.contains(event.target) &&
!(event.target ? (event.target as Element) : null)?.classList?.contains(
'ant-dropdown-menu-title-content',
)
(!(event.target instanceof Element) || !event.target.className.includes('ant-dropdown'))
) {
handler(event);
}
Expand Down

0 comments on commit 90a57cb

Please sign in to comment.