Skip to content

Commit

Permalink
fix descriptions and undo changes from other branch
Browse files Browse the repository at this point in the history
  • Loading branch information
lmossman committed Sep 8, 2022
1 parent 6826787 commit d5a946c
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 19 deletions.
2 changes: 1 addition & 1 deletion airbyte-api/src/main/openapi/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Job> listJobsIncludingId(Set<JobConfig.ConfigType> configTypes, String connectionId, long targetJobId, int pagesize) throws IOException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -52,21 +51,15 @@ const StatusView: React.FC<StatusViewProps> = ({ connection }) => {
const [activeJob, setActiveJob] = useState<ActiveJob>();
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);
Expand All @@ -80,9 +73,6 @@ const StatusView: React.FC<StatusViewProps> = ({ 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();
Expand Down
7 changes: 3 additions & 4 deletions airbyte-webapp/src/services/job/JobService.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
JobDebugInfoRead,
JobInfoRead,
JobListRequestBody,
JobReadList,
JobWithAttemptsRead,
Pagination,
} from "../../core/request/AirbyteClient";
import { useSuspenseQuery } from "../connector/useSuspenseQuery";
Expand All @@ -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) => {
Expand Down

0 comments on commit d5a946c

Please sign in to comment.