Skip to content
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

rerender only the schedule which got toggled #3244

Merged
merged 1 commit into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import PipelineRecurringRunTableToolbar from './PipelineRecurringRunTableToolbar

type PipelineRecurringRunTableProps = {
recurringRuns: PipelineRecurringRunKFv2[];
refresh: () => void;
loading?: boolean;
totalSize: number;
page: number;
Expand All @@ -33,6 +34,7 @@ type PipelineRecurringRunTableProps = {

const PipelineRecurringRunTable: React.FC<PipelineRecurringRunTableProps> = ({
recurringRuns,
refresh,
loading,
totalSize,
page,
Expand Down Expand Up @@ -122,6 +124,7 @@ const PipelineRecurringRunTable: React.FC<PipelineRecurringRunTableProps> = ({
rowRenderer={(recurringRun) => (
<PipelineRecurringRunTableRow
key={recurringRun.recurring_run_id}
refresh={refresh}
isChecked={isSelected(recurringRun.recurring_run_id)}
onToggleCheck={() => toggleSelection(recurringRun.recurring_run_id)}
onDelete={() => setDeleteResources([recurringRun])}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,22 @@ import useExperimentById from '~/concepts/pipelines/apiHooks/useExperimentById';

type PipelineRecurringRunTableRowProps = {
isChecked: boolean;
refresh: () => void;
onToggleCheck: () => void;
onDelete: () => void;
recurringRun: PipelineRecurringRunKFv2;
};

const PipelineRecurringRunTableRow: React.FC<PipelineRecurringRunTableRowProps> = ({
isChecked,
refresh,
onToggleCheck,
onDelete,
recurringRun,
}) => {
const navigate = useNavigate();
const { experimentId, pipelineId, pipelineVersionId } = useParams();
const { namespace, api, refreshAllAPI } = usePipelinesAPI();
const { namespace, api } = usePipelinesAPI();
const { version, loaded, error } = usePipelineRunVersionInfo(recurringRun);
const isExperimentsAvailable = useIsAreaAvailable(SupportedArea.PIPELINE_EXPERIMENTS).status;
const isExperimentsContext = isExperimentsAvailable && experimentId;
Expand Down Expand Up @@ -98,7 +100,7 @@ const PipelineRecurringRunTableRow: React.FC<PipelineRecurringRunTableRowProps>
onToggle={(checked) =>
api
.updatePipelineRecurringRun({}, recurringRun.recurring_run_id, checked)
.then(refreshAllAPI)
.then(() => refresh())
}
/>
</Td>
Expand Down
7 changes: 5 additions & 2 deletions frontend/src/pages/pipelines/global/runs/ScheduledRuns.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ import PipelineRecurringRunTable from '~/concepts/pipelines/content/tables/pipel

const ScheduledRuns: React.FC = () => {
const { experimentId, pipelineVersionId } = useParams();
const [[{ items: recurringRuns, totalSize }, loaded, error], { initialLoaded, ...tableProps }] =
usePipelineRecurringRunsTable({ experimentId, pipelineVersionId });
const [
[{ items: recurringRuns, totalSize }, loaded, error, refresh],
{ initialLoaded, ...tableProps },
] = usePipelineRecurringRunsTable({ experimentId, pipelineVersionId });
const isExperimentArchived = useIsExperimentArchived();

if (error) {
Expand Down Expand Up @@ -73,6 +75,7 @@ const ScheduledRuns: React.FC = () => {

return (
<PipelineRecurringRunTable
refresh={refresh}
recurringRuns={recurringRuns}
loading={!loaded}
totalSize={totalSize}
Expand Down
Loading