From 548b11ae062e22f9a1a61801f0178ee8ec224d75 Mon Sep 17 00:00:00 2001 From: phix Date: Wed, 9 Aug 2023 15:53:08 -0700 Subject: [PATCH 1/6] Updating api for lineage events and restyling the lineage events page to fix a number of bugs and code duplication. --- .../java/marquez/api/OpenLineageResource.java | 14 +- .../main/java/marquez/db/OpenLineageDao.java | 16 +- spec/openapi.yml | 4 + web/src/routes/events/Events.tsx | 161 +++++++++--------- web/src/store/actionCreators/index.ts | 135 +++++++-------- web/src/store/reducers/events.ts | 22 ++- web/src/store/requests/events.ts | 14 +- web/src/store/sagas/index.ts | 33 +++- web/src/types/api.ts | 1 + 9 files changed, 228 insertions(+), 172 deletions(-) diff --git a/api/src/main/java/marquez/api/OpenLineageResource.java b/api/src/main/java/marquez/api/OpenLineageResource.java index 677044fea8..0408f27700 100644 --- a/api/src/main/java/marquez/api/OpenLineageResource.java +++ b/api/src/main/java/marquez/api/OpenLineageResource.java @@ -117,14 +117,16 @@ public Response getLineageEvents( @QueryParam("before") @DefaultValue("2030-01-01T00:00:00+00:00") ZonedDateTimeParam before, @QueryParam("after") @DefaultValue("1970-01-01T00:00:00+00:00") ZonedDateTimeParam after, @QueryParam("sortDirection") @DefaultValue("desc") SortDirection sortDirection, - @QueryParam("limit") @DefaultValue("100") @Min(value = 0) int limit) { + @QueryParam("limit") @DefaultValue("100") @Min(value = 0) int limit, + @QueryParam("offset") @DefaultValue("0") @Min(value = 0) int offset) { List events = Collections.emptyList(); switch (sortDirection) { case DESC -> events = - openLineageDao.getAllLineageEventsDesc(before.get(), after.get(), limit); - case ASC -> events = openLineageDao.getAllLineageEventsAsc(before.get(), after.get(), limit); + openLineageDao.getAllLineageEventsDesc(before.get(), after.get(), limit, offset); + case ASC -> events = openLineageDao.getAllLineageEventsAsc(before.get(), after.get(), limit, offset); } - return Response.ok(new Events(events)).build(); + int totalCount = openLineageDao.getAllLineageTotalCount(before.get(), after.get()); + return Response.ok(new Events(events, totalCount)).build(); } @Value @@ -132,5 +134,9 @@ static class Events { @NonNull @JsonProperty("events") List value; + + @NonNull + @JsonProperty("totalCount") + int count; } } diff --git a/api/src/main/java/marquez/db/OpenLineageDao.java b/api/src/main/java/marquez/db/OpenLineageDao.java index 72dba40d26..5d03e45022 100644 --- a/api/src/main/java/marquez/db/OpenLineageDao.java +++ b/api/src/main/java/marquez/db/OpenLineageDao.java @@ -103,8 +103,8 @@ void createLineageEvent( WHERE (le.event_time < :before AND le.event_time >= :after) ORDER BY le.event_time DESC - LIMIT :limit""") - List getAllLineageEventsDesc(ZonedDateTime before, ZonedDateTime after, int limit); + LIMIT :limit OFFSET :offset""") + List getAllLineageEventsDesc(ZonedDateTime before, ZonedDateTime after, int limit, int offset); @SqlQuery( """ @@ -113,8 +113,16 @@ void createLineageEvent( WHERE (le.event_time < :before AND le.event_time >= :after) ORDER BY le.event_time ASC - LIMIT :limit""") - List getAllLineageEventsAsc(ZonedDateTime before, ZonedDateTime after, int limit); + LIMIT :limit OFFSET :offset""") + List getAllLineageEventsAsc(ZonedDateTime before, ZonedDateTime after, int limit, int offset); + + @SqlQuery( + """ + SELECT count(*) + FROM lineage_events le + WHERE (le.event_time < :before + AND le.event_time >= :after)""") + int getAllLineageTotalCount(ZonedDateTime before, ZonedDateTime after); default UpdateLineageRow updateMarquezModel(LineageEvent event, ObjectMapper mapper) { UpdateLineageRow updateLineageRow = updateBaseMarquezModel(event, mapper); diff --git a/spec/openapi.yml b/spec/openapi.yml index 008791b92a..53e77fe1a4 100644 --- a/spec/openapi.yml +++ b/spec/openapi.yml @@ -91,6 +91,7 @@ paths: - $ref: '#/components/parameters/before' - $ref: '#/components/parameters/after' - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/offset' summary: List all received OpenLineage events. description: Returns a list of OpenLineage events, sorted in direction of passed sort parameter. By default it is desc. tags: @@ -945,6 +946,9 @@ components: type: array items: $ref: '#/components/schemas/LineageEvent' + totalCount: + type: number + description: The total number of events returned matching our conditions. CreatedSource: type: object diff --git a/web/src/routes/events/Events.tsx b/web/src/routes/events/Events.tsx index 045b81aa80..7fc8ae9ce0 100644 --- a/web/src/routes/events/Events.tsx +++ b/web/src/routes/events/Events.tsx @@ -2,8 +2,10 @@ // SPDX-License-Identifier: Apache-2.0 import * as Redux from 'redux' +import { Badge } from 'material-ui' import { Button, + Chip, Container, Table, TableBody, @@ -24,6 +26,7 @@ import { fetchEvents, resetEvents } from '../../store/actionCreators' import { fileSize, formatUpdatedAt } from '../../helpers' import { formatDateAPIQuery, formatDatePicker } from '../../helpers/time' import { saveAs } from 'file-saver' +import { useSearchParams } from 'react-router-dom' import { useTheme } from '@emotion/react' import Box from '@mui/material/Box' import IconButton from '@mui/material/IconButton' @@ -32,11 +35,12 @@ import MqEmpty from '../../components/core/empty/MqEmpty' import MqJsonView from '../../components/core/json-view/MqJsonView' import MqStatus from '../../components/core/status/MqStatus' import MqText from '../../components/core/text/MqText' -import React from 'react' +import React, { useEffect, useRef } from 'react' import moment from 'moment' interface StateProps { events: Event[] + totalCount: number isEventsLoading: boolean isEventsInit: boolean } @@ -47,7 +51,6 @@ interface EventsState { dateFrom: string dateTo: string page: number - pageIsLast: boolean } interface DispatchProps { @@ -59,29 +62,32 @@ type EventsProps = StateProps & DispatchProps const EVENTS_COLUMNS = ['ID', 'STATE', 'NAME', 'NAMESPACE', 'TIME'] +const PAGE_SIZE = 20 + const Events: React.FC = ({ events, + totalCount, isEventsLoading, isEventsInit, fetchEvents, resetEvents, }) => { - const pageSize = 20 + const [searchParams, setSearchParams] = useSearchParams() const [state, setState] = React.useState({ - page: 1, + page: 0, events: [], rowExpanded: null, - pageIsLast: false, - dateFrom: formatDateAPIQuery(moment().startOf('day').toString()), - dateTo: formatDateAPIQuery(moment().endOf('day').toString()), + dateFrom: + searchParams.get('dateFrom') || formatDateAPIQuery(moment().startOf('day').toString()), + dateTo: searchParams.get('dateTo') || formatDateAPIQuery(moment().endOf('day').toString()), }) - const mounted = React.useRef(false) + const mounted = useRef(false) - React.useEffect(() => { + useEffect(() => { if (!mounted.current) { // on mount - fetchEvents(state.dateFrom, state.dateTo, pageSize) + fetchEvents(state.dateFrom, state.dateTo, PAGE_SIZE, state.page * PAGE_SIZE) mounted.current = true } else { // on update @@ -89,31 +95,27 @@ const Events: React.FC = ({ setState({ ...state, events: events, - pageIsLast: events.length < state.page * pageSize, }) } } }) - React.useEffect(() => { + useEffect(() => { + if (!searchParams.get('dateFrom') && !searchParams.get('dateTo')) { + setSearchParams({ + dateFrom: formatDateAPIQuery(moment().startOf('day').toString()), + dateTo: formatDateAPIQuery(moment().endOf('day').toString()), + }) + } + }, []) + + useEffect(() => { return () => { // on unmount resetEvents() } }, []) - const getEvents = () => { - return state.events?.slice((state.page - 1) * pageSize, pageSize + (state.page - 1) * pageSize) - } - - const pageNavigation = () => { - const titlePos = - state.events?.length > 0 - ? `${pageSize * state.page - pageSize} - ${state.events.length}` - : null - return `${state.page} ${titlePos ? `(${titlePos})` : ''}` - } - const handleChangeDatepicker = (e: any, direction: 'from' | 'to') => { const isDirectionFrom = direction === 'from' const keyDate = isDirectionFrom ? 'dateFrom' : 'dateTo' @@ -121,10 +123,14 @@ const Events: React.FC = ({ fetchEvents( formatDateAPIQuery(isDirectionFrom ? e.toDate() : state.dateFrom), formatDateAPIQuery(isDirectionFrom ? state.dateTo : e.toDate()), - pageSize + PAGE_SIZE, + state.page * PAGE_SIZE ) - setState({ [keyDate]: formatDatePicker(e.toDate()), page: 1, rowExpanded: null } as any) + const params: { [key: string]: string } = {} + searchParams.forEach((value, key) => (params[key] = value)) + setSearchParams({ ...params, [keyDate]: formatDateAPIQuery(e.toDate()) }) + setState({ [keyDate]: formatDatePicker(e.toDate()), page: 0, rowExpanded: null } as any) } const handleClickPage = (direction: 'prev' | 'next') => { @@ -133,7 +139,8 @@ const Events: React.FC = ({ fetchEvents( formatDateAPIQuery(state.dateFrom), formatDateAPIQuery(state.dateTo), - pageSize * directionPage + PAGE_SIZE, + directionPage * PAGE_SIZE ) setState({ ...state, page: directionPage, rowExpanded: null }) } @@ -149,40 +156,21 @@ const Events: React.FC = ({ return ( - + <> - {i18next.t('events_route.title')} - Page: {pageNavigation()} - - {getEvents()?.length > 0 && ( - - - handleClickPage('prev')} - size='large' - > - - - - - handleClickPage('next')} - size='large' - > - - - + + {i18next.t('events_route.title')} + - )} + = ({ > - {/* {EVENTS_COLUMNS.map(field => { - return ( */} {i18next.t('events_columns.id')} @@ -236,12 +222,10 @@ const Events: React.FC = ({ {i18next.t('events_columns.time')} - {/* ) - })} */} - {getEvents()?.map((event, key: number) => { + {events.map((event, key: number) => { return ( = ({ }} > - {event.run.runId} + {event.run.runId} = ({ })} - + + + <> + {PAGE_SIZE * state.page + 1} -{' '} + {Math.min(PAGE_SIZE * (state.page + 1), totalCount)} of {totalCount} + + - handleClickPage('prev')} - size='large' - > - - + + handleClickPage('prev')} + size='large' + > + + + - handleClickPage('next')} - size='large' - > - - + + handleClickPage('next')} + size='large' + disabled={state.page === Math.ceil(totalCount / PAGE_SIZE) - 1} + > + + + @@ -342,6 +336,7 @@ const Events: React.FC = ({ const mapStateToProps = (state: IState) => ({ events: state.events?.result, + totalCount: state.events.totalCount, isEventsLoading: state.events?.isLoading, isEventsInit: state.events?.init, }) diff --git a/web/src/store/actionCreators/index.ts b/web/src/store/actionCreators/index.ts index 0220a81703..09564ceb27 100644 --- a/web/src/store/actionCreators/index.ts +++ b/web/src/store/actionCreators/index.ts @@ -6,215 +6,216 @@ import * as actionTypes from './actionTypes' import { Dataset, DatasetVersion, - Event, + Events, Facets, Job, LineageGraph, Namespace, Run, - Search + Search, } from '../../types/api' import { JobOrDataset } from '../../components/lineage/types' -export const fetchEvents = (after: string, before: string, limit: number) => ({ +export const fetchEvents = (after: string, before: string, limit: number, offset: number) => ({ type: actionTypes.FETCH_EVENTS, payload: { before, after, - limit - } + limit, + offset, + }, }) -export const fetchEventsSuccess = (events: Event[]) => ({ +export const fetchEventsSuccess = (events: Events) => ({ type: actionTypes.FETCH_EVENTS_SUCCESS, payload: { - events - } + events, + }, }) export const resetEvents = () => ({ - type: actionTypes.RESET_EVENTS + type: actionTypes.RESET_EVENTS, }) export const fetchDatasets = (namespace: string, limit: number) => ({ type: actionTypes.FETCH_DATASETS, payload: { namespace, - limit - } + limit, + }, }) export const fetchDatasetsSuccess = (datasets: Dataset[]) => ({ type: actionTypes.FETCH_DATASETS_SUCCESS, payload: { - datasets - } + datasets, + }, }) export const fetchDataset = (namespace: string, name: string) => ({ type: actionTypes.FETCH_DATASET, payload: { namespace, - name - } + name, + }, }) export const fetchDatasetSuccess = (dataset: Dataset) => ({ type: actionTypes.FETCH_DATASET_SUCCESS, payload: { - dataset - } + dataset, + }, }) export const fetchDatasetVersions = (namespace: string, name: string) => ({ type: actionTypes.FETCH_DATASET_VERSIONS, payload: { namespace, - name - } + name, + }, }) export const fetchDatasetVersionsSuccess = (versions: DatasetVersion[]) => ({ type: actionTypes.FETCH_DATASET_VERSIONS_SUCCESS, payload: { - versions - } + versions, + }, }) export const resetDatasetVersions = () => ({ - type: actionTypes.RESET_DATASET_VERSIONS + type: actionTypes.RESET_DATASET_VERSIONS, }) export const resetDataset = () => ({ - type: actionTypes.RESET_DATASET + type: actionTypes.RESET_DATASET, }) export const deleteDataset = (datasetName: string, namespace: string) => ({ type: actionTypes.DELETE_DATASET, payload: { datasetName, - namespace - } + namespace, + }, }) export const deleteDatasetSuccess = (datasetName: string) => ({ type: actionTypes.DELETE_DATASET_SUCCESS, payload: { - datasetName - } + datasetName, + }, }) export const resetDatasets = () => ({ - type: actionTypes.RESET_DATASETS + type: actionTypes.RESET_DATASETS, }) export const fetchJobs = (namespace: string) => ({ type: actionTypes.FETCH_JOBS, payload: { - namespace - } + namespace, + }, }) export const fetchJobsSuccess = (jobs: Job[]) => ({ type: actionTypes.FETCH_JOBS_SUCCESS, payload: { - jobs - } + jobs, + }, }) export const resetJobs = () => ({ - type: actionTypes.RESET_JOBS + type: actionTypes.RESET_JOBS, }) export const deleteJob = (jobName: string, namespace: string) => ({ type: actionTypes.DELETE_JOB, payload: { jobName, - namespace - } + namespace, + }, }) export const deleteJobSuccess = (jobName: string) => ({ type: actionTypes.DELETE_JOB_SUCCESS, payload: { - jobName - } + jobName, + }, }) export const fetchRuns = (jobName: string, namespace: string) => ({ type: actionTypes.FETCH_RUNS, payload: { jobName, - namespace - } + namespace, + }, }) export const fetchRunsSuccess = (jobName: string, jobRuns: Run[]) => ({ type: actionTypes.FETCH_RUNS_SUCCESS, payload: { jobName, - runs: jobRuns - } + runs: jobRuns, + }, }) export const fetchRunFacets = (runId: string) => ({ type: actionTypes.FETCH_RUN_FACETS, payload: { - runId - } + runId, + }, }) export const fetchJobFacets = (runId: string) => ({ type: actionTypes.FETCH_JOB_FACETS, payload: { - runId - } + runId, + }, }) export const fetchFacetsSuccess = (facets: Facets) => ({ type: actionTypes.FETCH_FACETS_SUCCESS, payload: { - facets: facets.facets - } + facets: facets.facets, + }, }) export const resetFacets = () => ({ - type: actionTypes.RESET_FACETS + type: actionTypes.RESET_FACETS, }) export const resetRuns = () => ({ - type: actionTypes.RESET_RUNS + type: actionTypes.RESET_RUNS, }) export const fetchNamespacesSuccess = (namespaces: Namespace[]) => ({ type: actionTypes.FETCH_NAMESPACES_SUCCESS, payload: { - namespaces - } + namespaces, + }, }) export const applicationError = (message: string) => ({ type: actionTypes.APPLICATION_ERROR, payload: { - message - } + message, + }, }) export const dialogToggle = (field: string) => ({ type: actionTypes.DIALOG_TOGGLE, payload: { - field - } + field, + }, }) export const setSelectedNode = (node: string) => ({ type: actionTypes.SET_SELECTED_NODE, - payload: node + payload: node, }) export const setBottomBarHeight = (height: number) => ({ type: actionTypes.SET_BOTTOM_BAR_HEIGHT, - payload: height + payload: height, }) export const fetchLineage = ( @@ -228,32 +229,32 @@ export const fetchLineage = ( nodeType, namespace, name, - depth - } + depth, + }, }) export const fetchLineageSuccess = (lineage: LineageGraph) => ({ type: actionTypes.FETCH_LINEAGE_SUCCESS, - payload: lineage + payload: lineage, }) export const resetLineage = () => ({ - type: actionTypes.RESET_LINEAGE + type: actionTypes.RESET_LINEAGE, }) export const setLineageGraphDepth = (depth: number) => ({ type: actionTypes.SET_LINEAGE_GRAPH_DEPTH, - payload: depth + payload: depth, }) export const setShowFullGraph = (showFullGraph: boolean) => ({ type: actionTypes.SET_SHOW_FULL_GRAPH, - payload: showFullGraph + payload: showFullGraph, }) export const selectNamespace = (namespace: string) => ({ type: actionTypes.SELECT_NAMESPACE, - payload: namespace + payload: namespace, }) export const fetchSearch = (q: string, filter: string, sort: string) => ({ @@ -261,11 +262,11 @@ export const fetchSearch = (q: string, filter: string, sort: string) => ({ payload: { q, filter, - sort - } + sort, + }, }) export const fetchSearchSuccess = (search: Search) => ({ type: actionTypes.FETCH_SEARCH_SUCCESS, - payload: search + payload: search, }) diff --git a/web/src/store/reducers/events.ts b/web/src/store/reducers/events.ts index 817ede0758..abd09e8dbe 100644 --- a/web/src/store/reducers/events.ts +++ b/web/src/store/reducers/events.ts @@ -5,9 +5,19 @@ import { Event } from '../../types/api' import { FETCH_EVENTS, FETCH_EVENTS_SUCCESS, RESET_EVENTS } from '../actionCreators/actionTypes' import { fetchEventsSuccess } from '../actionCreators' -export type IEventsState = { isLoading: boolean; result: Event[]; init: boolean } +export type IEventsState = { + isLoading: boolean + result: Event[] + totalCount: number + init: boolean +} -export const initialState: IEventsState = { isLoading: false, init: false, result: [] } +export const initialState: IEventsState = { + isLoading: false, + init: false, + totalCount: 0, + result: [], +} type IEventsAction = ReturnType @@ -18,7 +28,13 @@ export default (state: IEventsState = initialState, action: IEventsAction): IEve case FETCH_EVENTS: return { ...state, isLoading: true } case FETCH_EVENTS_SUCCESS: - return { ...state, isLoading: false, init: true, result: payload.events } + return { + ...state, + isLoading: false, + init: true, + result: payload.events.events, + totalCount: payload.events.totalCount, + } case RESET_EVENTS: return initialState default: diff --git a/web/src/store/requests/events.ts b/web/src/store/requests/events.ts index 8e344fb2bd..24af0ba441 100644 --- a/web/src/store/requests/events.ts +++ b/web/src/store/requests/events.ts @@ -5,9 +5,15 @@ import { API_URL } from '../../globals' import { Events } from '../../types/api' import { genericFetchWrapper } from './index' -export const getEvents = async (after = '', before = '', limit = 100, sortDirection = 'desc') => { - const url = `${API_URL}/events/lineage?limit=${limit}&before=${before}&after=${after}&sortDirection=${sortDirection}` - return genericFetchWrapper(url, { method: 'GET' }, 'fetchEvents').then((r: Events) => { - return r.events.map(d => ({ ...d })) +export const getEvents = async ( + after = '', + before = '', + limit = 100, + offset = 0, + sortDirection = 'desc' +) => { + const url = `${API_URL}/events/lineage?limit=${limit}&before=${before}&after=${after}&offset=${offset}&sortDirection=${sortDirection}` + return genericFetchWrapper(url, { method: 'GET' }, 'fetchEvents').then((events: Events) => { + return events }) } diff --git a/web/src/store/sagas/index.ts b/web/src/store/sagas/index.ts index 3e765d42ed..703341d55c 100644 --- a/web/src/store/sagas/index.ts +++ b/web/src/store/sagas/index.ts @@ -14,9 +14,17 @@ import { FETCH_LINEAGE, FETCH_RUNS, FETCH_RUN_FACETS, - FETCH_SEARCH + FETCH_SEARCH, } from '../actionCreators/actionTypes' -import { Dataset, DatasetVersion, Event, Facets, LineageGraph, Namespaces } from '../../types/api' +import { + Dataset, + DatasetVersion, + Event, + Events, + Facets, + LineageGraph, + Namespaces, +} from '../../types/api' import { all, put, take } from 'redux-saga/effects' const call: any = Effects.call @@ -36,7 +44,7 @@ import { fetchLineageSuccess, fetchNamespacesSuccess, fetchRunsSuccess, - fetchSearchSuccess + fetchSearchSuccess, } from '../actionCreators' import { deleteDataset, @@ -49,7 +57,7 @@ import { getJobs, getNamespaces, getRunFacets, - getRuns + getRuns, } from '../requests' import { getLineage } from '../requests/lineage' import { getSearch } from '../requests/search' @@ -146,7 +154,14 @@ export function* fetchEventsSaga() { while (true) { try { const { payload } = yield take(FETCH_EVENTS) - const events: Event[] = yield call(getEvents, payload.after, payload.before, payload.limit) + const events: Events = yield call( + getEvents, + payload.after, + payload.before, + payload.limit, + payload.offset + ) + console.log(events) yield put(fetchEventsSuccess(events)) } catch (e) { yield put(applicationError('Something went wrong while fetching event runs')) @@ -182,7 +197,11 @@ export function* fetchDatasetVersionsSaga() { while (true) { try { const { payload } = yield take(FETCH_DATASET_VERSIONS) - const datasets: DatasetVersion[] = yield call(getDatasetVersions, payload.namespace, payload.name) + const datasets: DatasetVersion[] = yield call( + getDatasetVersions, + payload.namespace, + payload.name + ) yield put(fetchDatasetVersionsSuccess(datasets)) } catch (e) { yield put(applicationError('Something went wrong while fetching dataset runs')) @@ -228,7 +247,7 @@ export default function* rootSaga(): Generator { fetchLineage(), fetchSearch(), deleteJobSaga(), - deleteDatasetSaga() + deleteDatasetSaga(), ] yield all([...sagasThatAreKickedOffImmediately, ...sagasThatWatchForAction]) diff --git a/web/src/types/api.ts b/web/src/types/api.ts index 9bdc92fcd0..96ff73b858 100644 --- a/web/src/types/api.ts +++ b/web/src/types/api.ts @@ -26,6 +26,7 @@ export interface Namespace { export interface Events { events: Event[] + totalCount: number } export type EventType = 'START' | 'RUNNING' | 'ABORT' | 'FAIL' | 'COMPLETE' From 483e18a3a22af650f7bdfee5eaa9740e8b9090eb Mon Sep 17 00:00:00 2001 From: phix Date: Thu, 10 Aug 2023 09:40:26 -0700 Subject: [PATCH 2/6] Update for loading indicator. --- web/src/routes/events/Events.tsx | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/web/src/routes/events/Events.tsx b/web/src/routes/events/Events.tsx index 7fc8ae9ce0..d360f8e7ab 100644 --- a/web/src/routes/events/Events.tsx +++ b/web/src/routes/events/Events.tsx @@ -2,7 +2,6 @@ // SPDX-License-Identifier: Apache-2.0 import * as Redux from 'redux' -import { Badge } from 'material-ui' import { Button, Chip, @@ -29,6 +28,7 @@ import { saveAs } from 'file-saver' import { useSearchParams } from 'react-router-dom' import { useTheme } from '@emotion/react' import Box from '@mui/material/Box' +import CircularProgress from '@mui/material/CircularProgress/CircularProgress' import IconButton from '@mui/material/IconButton' import MqDatePicker from '../../components/core/date-picker/MqDatePicker' import MqEmpty from '../../components/core/empty/MqEmpty' @@ -177,19 +177,24 @@ const Events: React.FC = ({ sx={{ display: 'flex', alignItems: 'center', + justifyContent: 'space-between', gap: theme.spacing(3), }} > - handleChangeDatepicker(e, 'from')} - /> - handleChangeDatepicker(e, 'to')} - /> + + handleChangeDatepicker(e, 'from')} + /> + + handleChangeDatepicker(e, 'to')} + /> + + {isEventsLoading && } {state.events?.length === 0 ? ( From 8257326b595cc60ce8f4d20b59c0171faec9216d Mon Sep 17 00:00:00 2001 From: phix Date: Thu, 10 Aug 2023 09:53:45 -0700 Subject: [PATCH 3/6] Fixing CI failures. --- api/src/main/java/marquez/api/OpenLineageResource.java | 3 ++- api/src/main/java/marquez/db/OpenLineageDao.java | 8 +++++--- web/src/store/sagas/index.ts | 10 +--------- 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/api/src/main/java/marquez/api/OpenLineageResource.java b/api/src/main/java/marquez/api/OpenLineageResource.java index 0408f27700..5eb3ad3949 100644 --- a/api/src/main/java/marquez/api/OpenLineageResource.java +++ b/api/src/main/java/marquez/api/OpenLineageResource.java @@ -123,7 +123,8 @@ public Response getLineageEvents( switch (sortDirection) { case DESC -> events = openLineageDao.getAllLineageEventsDesc(before.get(), after.get(), limit, offset); - case ASC -> events = openLineageDao.getAllLineageEventsAsc(before.get(), after.get(), limit, offset); + case ASC -> events = + openLineageDao.getAllLineageEventsAsc(before.get(), after.get(), limit, offset); } int totalCount = openLineageDao.getAllLineageTotalCount(before.get(), after.get()); return Response.ok(new Events(events, totalCount)).build(); diff --git a/api/src/main/java/marquez/db/OpenLineageDao.java b/api/src/main/java/marquez/db/OpenLineageDao.java index 5d03e45022..c6f7559cec 100644 --- a/api/src/main/java/marquez/db/OpenLineageDao.java +++ b/api/src/main/java/marquez/db/OpenLineageDao.java @@ -104,7 +104,8 @@ void createLineageEvent( AND le.event_time >= :after) ORDER BY le.event_time DESC LIMIT :limit OFFSET :offset""") - List getAllLineageEventsDesc(ZonedDateTime before, ZonedDateTime after, int limit, int offset); + List getAllLineageEventsDesc( + ZonedDateTime before, ZonedDateTime after, int limit, int offset); @SqlQuery( """ @@ -114,10 +115,11 @@ void createLineageEvent( AND le.event_time >= :after) ORDER BY le.event_time ASC LIMIT :limit OFFSET :offset""") - List getAllLineageEventsAsc(ZonedDateTime before, ZonedDateTime after, int limit, int offset); + List getAllLineageEventsAsc( + ZonedDateTime before, ZonedDateTime after, int limit, int offset); @SqlQuery( - """ + """ SELECT count(*) FROM lineage_events le WHERE (le.event_time < :before diff --git a/web/src/store/sagas/index.ts b/web/src/store/sagas/index.ts index 703341d55c..d8a47559ca 100644 --- a/web/src/store/sagas/index.ts +++ b/web/src/store/sagas/index.ts @@ -16,15 +16,7 @@ import { FETCH_RUN_FACETS, FETCH_SEARCH, } from '../actionCreators/actionTypes' -import { - Dataset, - DatasetVersion, - Event, - Events, - Facets, - LineageGraph, - Namespaces, -} from '../../types/api' +import { Dataset, DatasetVersion, Events, Facets, LineageGraph, Namespaces } from '../../types/api' import { all, put, take } from 'redux-saga/effects' const call: any = Effects.call From 320d24f968472a96c321e4e00799b084c7ea9de8 Mon Sep 17 00:00:00 2001 From: phix Date: Thu, 10 Aug 2023 10:05:21 -0700 Subject: [PATCH 4/6] Removing json property mapping. --- api/src/main/java/marquez/api/OpenLineageResource.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/api/src/main/java/marquez/api/OpenLineageResource.java b/api/src/main/java/marquez/api/OpenLineageResource.java index 5eb3ad3949..a64f5b188d 100644 --- a/api/src/main/java/marquez/api/OpenLineageResource.java +++ b/api/src/main/java/marquez/api/OpenLineageResource.java @@ -137,7 +137,6 @@ static class Events { List value; @NonNull - @JsonProperty("totalCount") - int count; + int totalCount; } } From 4686691f1418b9604960962b539fb20c417911d5 Mon Sep 17 00:00:00 2001 From: phix Date: Thu, 10 Aug 2023 10:18:20 -0700 Subject: [PATCH 5/6] Removing json property mapping. Signed-off-by: phix --- api/src/main/java/marquez/api/OpenLineageResource.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/api/src/main/java/marquez/api/OpenLineageResource.java b/api/src/main/java/marquez/api/OpenLineageResource.java index a64f5b188d..7d5266cf13 100644 --- a/api/src/main/java/marquez/api/OpenLineageResource.java +++ b/api/src/main/java/marquez/api/OpenLineageResource.java @@ -136,7 +136,6 @@ static class Events { @JsonProperty("events") List value; - @NonNull - int totalCount; + @NonNull int totalCount; } } From 577926262c5d9f3fd4983584f1477bf50cda3e3f Mon Sep 17 00:00:00 2001 From: phix Date: Thu, 10 Aug 2023 10:32:35 -0700 Subject: [PATCH 6/6] Removing wanted. --- api/src/main/java/marquez/api/OpenLineageResource.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/src/main/java/marquez/api/OpenLineageResource.java b/api/src/main/java/marquez/api/OpenLineageResource.java index 7d5266cf13..259a500a53 100644 --- a/api/src/main/java/marquez/api/OpenLineageResource.java +++ b/api/src/main/java/marquez/api/OpenLineageResource.java @@ -136,6 +136,6 @@ static class Events { @JsonProperty("events") List value; - @NonNull int totalCount; + int totalCount; } }