diff --git a/airbyte-api/src/main/openapi/config.yaml b/airbyte-api/src/main/openapi/config.yaml index de8c1f04a313..4f9ef8a046d4 100644 --- a/airbyte-api/src/main/openapi/config.yaml +++ b/airbyte-api/src/main/openapi/config.yaml @@ -3770,7 +3770,7 @@ components: configId: type: string includingJobId: - description: If the job with this ID exists for the specified connection, returns all jobs created after and including this job, or the full pagination pagesize if that list is smaller than a page. Otherwise, this field is ignored. + description: If the job with this ID exists for the specified connection, returns all jobs created after and including this job, or the full pagination pagesize if that list is smaller than a page. Returns an empty list if this job is specified and cannot be found in this connection. $ref: "#/components/schemas/JobId" pagination: $ref: "#/components/schemas/Pagination" diff --git a/airbyte-scheduler/scheduler-persistence/src/main/java/io/airbyte/scheduler/persistence/JobPersistence.java b/airbyte-scheduler/scheduler-persistence/src/main/java/io/airbyte/scheduler/persistence/JobPersistence.java index dcc58a4cfb58..694fbd54f564 100644 --- a/airbyte-scheduler/scheduler-persistence/src/main/java/io/airbyte/scheduler/persistence/JobPersistence.java +++ b/airbyte-scheduler/scheduler-persistence/src/main/java/io/airbyte/scheduler/persistence/JobPersistence.java @@ -170,8 +170,8 @@ public interface JobPersistence { * connection * @param pagesize - minimum size of the job list that should be returned * @return List of jobs created after and including the target job ID (or the `pagesize` most recent - * jobs, whichever is larger), if it exists in the connection. Otherwise, this acts as a - * normal listJobs request. + * jobs, whichever is larger), if it exists in the connection. Otherwise, an empty list is + * returned * @throws IOException */ List listJobsIncludingId(Set configTypes, String connectionId, long targetJobId, int pagesize) throws IOException; diff --git a/airbyte-webapp/src/pages/ConnectionPage/pages/ConnectionItemPage/components/StatusView.tsx b/airbyte-webapp/src/pages/ConnectionPage/pages/ConnectionItemPage/components/StatusView.tsx index f975407c1300..4b07bfa9fed7 100644 --- a/airbyte-webapp/src/pages/ConnectionPage/pages/ConnectionItemPage/components/StatusView.tsx +++ b/airbyte-webapp/src/pages/ConnectionPage/pages/ConnectionItemPage/components/StatusView.tsx @@ -7,7 +7,6 @@ import { Button, ContentCard, LoadingButton } from "components"; import { Tooltip } from "components/base/Tooltip"; import EmptyResource from "components/EmptyResourceBlock"; import { RotateIcon } from "components/icons/RotateIcon"; -import { useAttemptLink } from "components/JobItem/attemptLinkUtils"; import { getFrequencyType } from "config/utils"; import { Action, Namespace } from "core/analytics"; @@ -52,21 +51,15 @@ const StatusView: React.FC = ({ connection }) => { const [activeJob, setActiveJob] = useState(); const [jobPageSize, setJobPageSize] = useState(JOB_PAGE_SIZE_INCREMENT); const analyticsService = useAnalyticsService(); - const { jobId: linkedJobId } = useAttemptLink(); - const { - jobs, - totalJobCount, - isPreviousData: isJobPageLoading, - } = useListJobs({ + const { jobs, isPreviousData: isJobPageLoading } = useListJobs({ configId: connection.connectionId, configTypes: ["sync", "reset_connection"], - includingJobId: linkedJobId ? Number(linkedJobId) : undefined, pagination: { pageSize: jobPageSize, }, }); - const moreJobPagesAvailable = jobPageSize < totalJobCount; + const moreJobPagesAvailable = jobs.length === jobPageSize; useEffect(() => { const jobRunningOrPending = getJobRunningOrPending(jobs); @@ -80,9 +73,6 @@ const StatusView: React.FC = ({ connection }) => { // We need to disable button when job is canceled but the job list still has a running job } as ActiveJob) ); - - // necessary if a specific job ID was linked, causing us to get back more jobs than the current page size - setJobPageSize((prevJobPageSize) => Math.max(prevJobPageSize, jobs.length)); }, [jobs]); const { openConfirmationModal, closeConfirmationModal } = useConfirmationModalService(); diff --git a/airbyte-webapp/src/services/job/JobService.tsx b/airbyte-webapp/src/services/job/JobService.tsx index 94a054caec40..ac4d58e6d955 100644 --- a/airbyte-webapp/src/services/job/JobService.tsx +++ b/airbyte-webapp/src/services/job/JobService.tsx @@ -9,7 +9,7 @@ import { JobDebugInfoRead, JobInfoRead, JobListRequestBody, - JobReadList, + JobWithAttemptsRead, Pagination, } from "../../core/request/AirbyteClient"; import { useSuspenseQuery } from "../connector/useSuspenseQuery"; @@ -36,9 +36,8 @@ export const useListJobs = (listParams: JobListRequestBody) => { keepPreviousData: true, suspense: true, }); - // cast to JobReadList because (suspense: true) means we will never get undefined - const jobReadList: JobReadList = result.data as JobReadList; - return { jobs: jobReadList.jobs, totalJobCount: jobReadList.totalJobCount, isPreviousData: result.isPreviousData }; + // cast to JobWithAttemptsRead[] because (suspense: true) means we will never get undefined + return { jobs: result.data?.jobs as JobWithAttemptsRead[], isPreviousData: result.isPreviousData }; }; export const useGetJob = (id: number, enabled = true) => {