mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-08-26 18:06:03 +00:00
Fix 16805: pagination dropdown issue (#18611)
* fix: pagination dropdown * fix: remove handlePageChange dependency * fix: api url for database schema response --------- Co-authored-by: Shailesh Parmar <shailesh.parmar.webdev@gmail.com>
This commit is contained in:
parent
089fa785a8
commit
00357f68fc
@ -1235,7 +1235,7 @@ export const softDeleteEntity = async (
|
|||||||
if (endPoint === EntityTypeEndpoint.Table) {
|
if (endPoint === EntityTypeEndpoint.Table) {
|
||||||
await page.click('[data-testid="breadcrumb-link"]:last-child');
|
await page.click('[data-testid="breadcrumb-link"]:last-child');
|
||||||
const deletedTableResponse = page.waitForResponse(
|
const deletedTableResponse = page.waitForResponse(
|
||||||
'/api/v1/tables?databaseSchema=*'
|
'/api/v1/tables?*databaseSchema=*'
|
||||||
);
|
);
|
||||||
await page.click('[data-testid="show-deleted"]');
|
await page.click('[data-testid="show-deleted"]');
|
||||||
await deletedTableResponse;
|
await deletedTableResponse;
|
||||||
|
@ -15,7 +15,7 @@ import { Col, Row, Skeleton, Tabs, TabsProps } from 'antd';
|
|||||||
import { AxiosError } from 'axios';
|
import { AxiosError } from 'axios';
|
||||||
import { compare, Operation } from 'fast-json-patch';
|
import { compare, Operation } from 'fast-json-patch';
|
||||||
import { isEmpty, isUndefined } from 'lodash';
|
import { isEmpty, isUndefined } from 'lodash';
|
||||||
import { EntityTags, PagingResponse } from 'Models';
|
import { EntityTags } from 'Models';
|
||||||
import React, {
|
import React, {
|
||||||
FunctionComponent,
|
FunctionComponent,
|
||||||
useCallback,
|
useCallback,
|
||||||
@ -46,6 +46,7 @@ import {
|
|||||||
getEntityDetailsPath,
|
getEntityDetailsPath,
|
||||||
getVersionPath,
|
getVersionPath,
|
||||||
INITIAL_PAGING_VALUE,
|
INITIAL_PAGING_VALUE,
|
||||||
|
PAGE_SIZE,
|
||||||
ROUTES,
|
ROUTES,
|
||||||
} from '../../constants/constants';
|
} from '../../constants/constants';
|
||||||
import { FEED_COUNT_INITIAL_DATA } from '../../constants/entity.constants';
|
import { FEED_COUNT_INITIAL_DATA } from '../../constants/entity.constants';
|
||||||
@ -69,6 +70,7 @@ import { APIEndpoint } from '../../generated/entity/data/apiEndpoint';
|
|||||||
import { ThreadType } from '../../generated/entity/feed/thread';
|
import { ThreadType } from '../../generated/entity/feed/thread';
|
||||||
import { Include } from '../../generated/type/include';
|
import { Include } from '../../generated/type/include';
|
||||||
import { TagLabel } from '../../generated/type/tagLabel';
|
import { TagLabel } from '../../generated/type/tagLabel';
|
||||||
|
import { usePaging } from '../../hooks/paging/usePaging';
|
||||||
import { useFqn } from '../../hooks/useFqn';
|
import { useFqn } from '../../hooks/useFqn';
|
||||||
import { FeedCounts } from '../../interface/feed.interface';
|
import { FeedCounts } from '../../interface/feed.interface';
|
||||||
import {
|
import {
|
||||||
@ -99,6 +101,9 @@ const APICollectionPage: FunctionComponent = () => {
|
|||||||
const { postFeed, deleteFeed, updateFeed } = useActivityFeedProvider();
|
const { postFeed, deleteFeed, updateFeed } = useActivityFeedProvider();
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { getEntityPermissionByFqn } = usePermissionProvider();
|
const { getEntityPermissionByFqn } = usePermissionProvider();
|
||||||
|
const pagingInfo = usePaging(PAGE_SIZE);
|
||||||
|
|
||||||
|
const { paging, pageSize, handlePagingChange } = pagingInfo;
|
||||||
|
|
||||||
const { tab: activeTab = EntityTabs.API_ENDPOINT } =
|
const { tab: activeTab = EntityTabs.API_ENDPOINT } =
|
||||||
useParams<{ tab: EntityTabs }>();
|
useParams<{ tab: EntityTabs }>();
|
||||||
@ -112,12 +117,7 @@ const APICollectionPage: FunctionComponent = () => {
|
|||||||
const [apiCollection, setAPICollection] = useState<APICollection>(
|
const [apiCollection, setAPICollection] = useState<APICollection>(
|
||||||
{} as APICollection
|
{} as APICollection
|
||||||
);
|
);
|
||||||
const [apiEndpoints, setAPIEndpoints] = useState<
|
const [apiEndpoints, setAPIEndpoints] = useState<Array<APIEndpoint>>([]);
|
||||||
PagingResponse<APIEndpoint[]>
|
|
||||||
>({
|
|
||||||
data: [],
|
|
||||||
paging: { total: 0 },
|
|
||||||
});
|
|
||||||
const [apiEndpointsLoading, setAPIEndpointsLoading] = useState<boolean>(true);
|
const [apiEndpointsLoading, setAPIEndpointsLoading] = useState<boolean>(true);
|
||||||
const [isAPICollectionLoading, setIsAPICollectionLoading] =
|
const [isAPICollectionLoading, setIsAPICollectionLoading] =
|
||||||
useState<boolean>(true);
|
useState<boolean>(true);
|
||||||
@ -239,7 +239,8 @@ const APICollectionPage: FunctionComponent = () => {
|
|||||||
service: apiCollection?.service?.fullyQualifiedName ?? '',
|
service: apiCollection?.service?.fullyQualifiedName ?? '',
|
||||||
include: showDeletedEndpoints ? Include.Deleted : Include.NonDeleted,
|
include: showDeletedEndpoints ? Include.Deleted : Include.NonDeleted,
|
||||||
});
|
});
|
||||||
setAPIEndpoints(res);
|
setAPIEndpoints(res.data);
|
||||||
|
handlePagingChange(res.paging);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
showErrorToast(err as AxiosError);
|
showErrorToast(err as AxiosError);
|
||||||
} finally {
|
} finally {
|
||||||
@ -454,13 +455,13 @@ const APICollectionPage: FunctionComponent = () => {
|
|||||||
if (cursorType) {
|
if (cursorType) {
|
||||||
getAPICollectionEndpoints({
|
getAPICollectionEndpoints({
|
||||||
paging: {
|
paging: {
|
||||||
[cursorType]: apiEndpoints.paging[cursorType],
|
[cursorType]: paging[cursorType],
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
setCurrentEndpointsPage(currentPage);
|
setCurrentEndpointsPage(currentPage);
|
||||||
},
|
},
|
||||||
[apiEndpoints, getAPICollectionEndpoints]
|
[paging, getAPICollectionEndpoints]
|
||||||
);
|
);
|
||||||
|
|
||||||
const versionHandler = useCallback(() => {
|
const versionHandler = useCallback(() => {
|
||||||
@ -503,13 +504,16 @@ const APICollectionPage: FunctionComponent = () => {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (viewAPICollectionPermission && decodedAPICollectionFQN) {
|
if (viewAPICollectionPermission && decodedAPICollectionFQN) {
|
||||||
getAPICollectionEndpoints();
|
getAPICollectionEndpoints({
|
||||||
|
paging: { limit: pageSize },
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}, [
|
}, [
|
||||||
showDeletedEndpoints,
|
showDeletedEndpoints,
|
||||||
decodedAPICollectionFQN,
|
decodedAPICollectionFQN,
|
||||||
viewAPICollectionPermission,
|
viewAPICollectionPermission,
|
||||||
apiCollection,
|
apiCollection,
|
||||||
|
pageSize,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const {
|
const {
|
||||||
@ -556,7 +560,7 @@ const APICollectionPage: FunctionComponent = () => {
|
|||||||
{
|
{
|
||||||
label: (
|
label: (
|
||||||
<TabsLabel
|
<TabsLabel
|
||||||
count={apiEndpoints.paging.total}
|
count={paging.total}
|
||||||
id={EntityTabs.API_ENDPOINT}
|
id={EntityTabs.API_ENDPOINT}
|
||||||
isActive={activeTab === EntityTabs.API_ENDPOINT}
|
isActive={activeTab === EntityTabs.API_ENDPOINT}
|
||||||
name={t('label.endpoint-plural')}
|
name={t('label.endpoint-plural')}
|
||||||
@ -580,6 +584,7 @@ const APICollectionPage: FunctionComponent = () => {
|
|||||||
editDescriptionPermission={editDescriptionPermission}
|
editDescriptionPermission={editDescriptionPermission}
|
||||||
endpointPaginationHandler={endpointPaginationHandler}
|
endpointPaginationHandler={endpointPaginationHandler}
|
||||||
isEdit={isEdit}
|
isEdit={isEdit}
|
||||||
|
pagingInfo={pagingInfo}
|
||||||
showDeletedEndpoints={showDeletedEndpoints}
|
showDeletedEndpoints={showDeletedEndpoints}
|
||||||
onCancel={onEditCancel}
|
onCancel={onEditCancel}
|
||||||
onDescriptionEdit={onDescriptionEdit}
|
onDescriptionEdit={onDescriptionEdit}
|
||||||
|
@ -15,7 +15,6 @@ import { Col, Row, Space, Tabs } from 'antd';
|
|||||||
import { AxiosError } from 'axios';
|
import { AxiosError } from 'axios';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import { isEmpty, isUndefined, toString } from 'lodash';
|
import { isEmpty, isUndefined, toString } from 'lodash';
|
||||||
import { PagingResponse } from 'Models';
|
|
||||||
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { useHistory, useParams } from 'react-router-dom';
|
import { useHistory, useParams } from 'react-router-dom';
|
||||||
@ -34,6 +33,7 @@ import {
|
|||||||
getEntityDetailsPath,
|
getEntityDetailsPath,
|
||||||
getVersionPath,
|
getVersionPath,
|
||||||
INITIAL_PAGING_VALUE,
|
INITIAL_PAGING_VALUE,
|
||||||
|
PAGE_SIZE,
|
||||||
} from '../../constants/constants';
|
} from '../../constants/constants';
|
||||||
import { usePermissionProvider } from '../../context/PermissionProvider/PermissionProvider';
|
import { usePermissionProvider } from '../../context/PermissionProvider/PermissionProvider';
|
||||||
import {
|
import {
|
||||||
@ -52,6 +52,7 @@ import { ChangeDescription } from '../../generated/entity/type';
|
|||||||
import { EntityHistory } from '../../generated/type/entityHistory';
|
import { EntityHistory } from '../../generated/type/entityHistory';
|
||||||
import { Include } from '../../generated/type/include';
|
import { Include } from '../../generated/type/include';
|
||||||
import { TagSource } from '../../generated/type/tagLabel';
|
import { TagSource } from '../../generated/type/tagLabel';
|
||||||
|
import { usePaging } from '../../hooks/paging/usePaging';
|
||||||
import { useFqn } from '../../hooks/useFqn';
|
import { useFqn } from '../../hooks/useFqn';
|
||||||
import {
|
import {
|
||||||
getApiCollectionByFQN,
|
getApiCollectionByFQN,
|
||||||
@ -83,6 +84,10 @@ const APICollectionVersionPage = () => {
|
|||||||
|
|
||||||
const { fqn: decodedEntityFQN } = useFqn();
|
const { fqn: decodedEntityFQN } = useFqn();
|
||||||
|
|
||||||
|
const pagingInfo = usePaging(PAGE_SIZE);
|
||||||
|
|
||||||
|
const { paging, pageSize, handlePagingChange } = pagingInfo;
|
||||||
|
|
||||||
const [collectionPermissions, setCollectionPermissions] =
|
const [collectionPermissions, setCollectionPermissions] =
|
||||||
useState<OperationPermission>(DEFAULT_ENTITY_PERMISSION);
|
useState<OperationPermission>(DEFAULT_ENTITY_PERMISSION);
|
||||||
const [isLoading, setIsLoading] = useState<boolean>(true);
|
const [isLoading, setIsLoading] = useState<boolean>(true);
|
||||||
@ -99,12 +104,7 @@ const APICollectionVersionPage = () => {
|
|||||||
|
|
||||||
const [apiEndpointsLoading, setAPIEndpointsLoading] = useState<boolean>(true);
|
const [apiEndpointsLoading, setAPIEndpointsLoading] = useState<boolean>(true);
|
||||||
|
|
||||||
const [apiEndpoints, setAPIEndpoints] = useState<
|
const [apiEndpoints, setAPIEndpoints] = useState<Array<APIEndpoint>>([]);
|
||||||
PagingResponse<APIEndpoint[]>
|
|
||||||
>({
|
|
||||||
data: [],
|
|
||||||
paging: { total: 0 },
|
|
||||||
});
|
|
||||||
|
|
||||||
const [currentEndpointsPage, setCurrentEndpointsPage] =
|
const [currentEndpointsPage, setCurrentEndpointsPage] =
|
||||||
useState<number>(INITIAL_PAGING_VALUE);
|
useState<number>(INITIAL_PAGING_VALUE);
|
||||||
@ -182,7 +182,8 @@ const APICollectionVersionPage = () => {
|
|||||||
service: collection?.service?.fullyQualifiedName ?? '',
|
service: collection?.service?.fullyQualifiedName ?? '',
|
||||||
include: Include.All,
|
include: Include.All,
|
||||||
});
|
});
|
||||||
setAPIEndpoints(res);
|
setAPIEndpoints(res.data);
|
||||||
|
handlePagingChange(res.paging);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
showErrorToast(err as AxiosError);
|
showErrorToast(err as AxiosError);
|
||||||
} finally {
|
} finally {
|
||||||
@ -203,13 +204,15 @@ const APICollectionVersionPage = () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
setCurrentVersionData(response);
|
setCurrentVersionData(response);
|
||||||
await getAPICollectionEndpoints();
|
await getAPICollectionEndpoints({
|
||||||
|
paging: { limit: pageSize },
|
||||||
|
});
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
setIsVersionDataLoading(false);
|
setIsVersionDataLoading(false);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[viewVersionPermission, version, getAPICollectionEndpoints]
|
[viewVersionPermission, version, getAPICollectionEndpoints, pageSize]
|
||||||
);
|
);
|
||||||
|
|
||||||
const handleTabChange = (activeKey: string) => {
|
const handleTabChange = (activeKey: string) => {
|
||||||
@ -228,13 +231,13 @@ const APICollectionVersionPage = () => {
|
|||||||
if (cursorType) {
|
if (cursorType) {
|
||||||
getAPICollectionEndpoints({
|
getAPICollectionEndpoints({
|
||||||
paging: {
|
paging: {
|
||||||
[cursorType]: apiEndpoints.paging[cursorType],
|
[cursorType]: paging[cursorType],
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
setCurrentEndpointsPage(currentPage);
|
setCurrentEndpointsPage(currentPage);
|
||||||
},
|
},
|
||||||
[apiEndpoints, getAPICollectionEndpoints]
|
[paging, getAPICollectionEndpoints]
|
||||||
);
|
);
|
||||||
|
|
||||||
const { versionHandler, backHandler } = useMemo(
|
const { versionHandler, backHandler } = useMemo(
|
||||||
@ -268,7 +271,7 @@ const APICollectionVersionPage = () => {
|
|||||||
{
|
{
|
||||||
label: (
|
label: (
|
||||||
<TabsLabel
|
<TabsLabel
|
||||||
count={apiEndpoints.paging.total}
|
count={paging.total}
|
||||||
id={EntityTabs.API_ENDPOINT}
|
id={EntityTabs.API_ENDPOINT}
|
||||||
isActive={tab === EntityTabs.API_ENDPOINT}
|
isActive={tab === EntityTabs.API_ENDPOINT}
|
||||||
name={t('label.endpoint-plural')}
|
name={t('label.endpoint-plural')}
|
||||||
@ -286,6 +289,7 @@ const APICollectionVersionPage = () => {
|
|||||||
currentEndpointsPage={currentEndpointsPage}
|
currentEndpointsPage={currentEndpointsPage}
|
||||||
description={description}
|
description={description}
|
||||||
endpointPaginationHandler={endpointPaginationHandler}
|
endpointPaginationHandler={endpointPaginationHandler}
|
||||||
|
pagingInfo={pagingInfo}
|
||||||
/>
|
/>
|
||||||
</Col>
|
</Col>
|
||||||
<Col
|
<Col
|
||||||
@ -432,7 +436,7 @@ const APICollectionVersionPage = () => {
|
|||||||
if (!isUndefined(collection)) {
|
if (!isUndefined(collection)) {
|
||||||
fetchCurrentVersionData(collection);
|
fetchCurrentVersionData(collection);
|
||||||
}
|
}
|
||||||
}, [version, collection]);
|
}, [version, collection, pageSize]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<PageLayoutV1
|
<PageLayoutV1
|
||||||
|
@ -13,8 +13,7 @@
|
|||||||
|
|
||||||
import { Col, Row, Switch, Typography } from 'antd';
|
import { Col, Row, Switch, Typography } from 'antd';
|
||||||
import { ColumnsType } from 'antd/lib/table';
|
import { ColumnsType } from 'antd/lib/table';
|
||||||
import { isEmpty } from 'lodash';
|
import { isEmpty, isUndefined } from 'lodash';
|
||||||
import { PagingResponse } from 'Models';
|
|
||||||
import React, { useMemo } from 'react';
|
import React, { useMemo } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
@ -24,11 +23,12 @@ import NextPrevious from '../../components/common/NextPrevious/NextPrevious';
|
|||||||
import { NextPreviousProps } from '../../components/common/NextPrevious/NextPrevious.interface';
|
import { NextPreviousProps } from '../../components/common/NextPrevious/NextPrevious.interface';
|
||||||
import RichTextEditorPreviewer from '../../components/common/RichTextEditor/RichTextEditorPreviewer';
|
import RichTextEditorPreviewer from '../../components/common/RichTextEditor/RichTextEditorPreviewer';
|
||||||
import TableAntd from '../../components/common/Table/Table';
|
import TableAntd from '../../components/common/Table/Table';
|
||||||
import { NO_DATA, PAGE_SIZE } from '../../constants/constants';
|
import { NO_DATA } from '../../constants/constants';
|
||||||
import { ERROR_PLACEHOLDER_TYPE } from '../../enums/common.enum';
|
import { ERROR_PLACEHOLDER_TYPE } from '../../enums/common.enum';
|
||||||
import { EntityType } from '../../enums/entity.enum';
|
import { EntityType } from '../../enums/entity.enum';
|
||||||
import { APICollection } from '../../generated/entity/data/apiCollection';
|
import { APICollection } from '../../generated/entity/data/apiCollection';
|
||||||
import { APIEndpoint } from '../../generated/entity/data/apiEndpoint';
|
import { APIEndpoint } from '../../generated/entity/data/apiEndpoint';
|
||||||
|
import { UsePagingInterface } from '../../hooks/paging/usePaging';
|
||||||
import entityUtilClassBase from '../../utils/EntityUtilClassBase';
|
import entityUtilClassBase from '../../utils/EntityUtilClassBase';
|
||||||
import { getEntityName } from '../../utils/EntityUtils';
|
import { getEntityName } from '../../utils/EntityUtils';
|
||||||
|
|
||||||
@ -39,7 +39,7 @@ interface APIEndpointsTabProps {
|
|||||||
editDescriptionPermission?: boolean;
|
editDescriptionPermission?: boolean;
|
||||||
isEdit?: boolean;
|
isEdit?: boolean;
|
||||||
showDeletedEndpoints?: boolean;
|
showDeletedEndpoints?: boolean;
|
||||||
apiEndpoints: PagingResponse<APIEndpoint[]>;
|
apiEndpoints: APIEndpoint[];
|
||||||
currentEndpointsPage: number;
|
currentEndpointsPage: number;
|
||||||
endpointPaginationHandler: NextPreviousProps['pagingHandler'];
|
endpointPaginationHandler: NextPreviousProps['pagingHandler'];
|
||||||
onCancel?: () => void;
|
onCancel?: () => void;
|
||||||
@ -48,6 +48,7 @@ interface APIEndpointsTabProps {
|
|||||||
onThreadLinkSelect?: (link: string) => void;
|
onThreadLinkSelect?: (link: string) => void;
|
||||||
onShowDeletedEndpointsChange?: (value: boolean) => void;
|
onShowDeletedEndpointsChange?: (value: boolean) => void;
|
||||||
isVersionView?: boolean;
|
isVersionView?: boolean;
|
||||||
|
pagingInfo: UsePagingInterface;
|
||||||
}
|
}
|
||||||
|
|
||||||
function APIEndpointsTab({
|
function APIEndpointsTab({
|
||||||
@ -66,6 +67,7 @@ function APIEndpointsTab({
|
|||||||
showDeletedEndpoints = false,
|
showDeletedEndpoints = false,
|
||||||
onShowDeletedEndpointsChange,
|
onShowDeletedEndpointsChange,
|
||||||
isVersionView = false,
|
isVersionView = false,
|
||||||
|
pagingInfo,
|
||||||
}: Readonly<APIEndpointsTabProps>) {
|
}: Readonly<APIEndpointsTabProps>) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
@ -124,7 +126,7 @@ function APIEndpointsTab({
|
|||||||
description={description}
|
description={description}
|
||||||
entityFqn={apiCollectionDetails.fullyQualifiedName}
|
entityFqn={apiCollectionDetails.fullyQualifiedName}
|
||||||
entityType={EntityType.API_COLLECTION}
|
entityType={EntityType.API_COLLECTION}
|
||||||
isDescriptionExpanded={isEmpty(apiEndpoints.data)}
|
isDescriptionExpanded={isEmpty(apiEndpoints)}
|
||||||
showActions={false}
|
showActions={false}
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
@ -134,7 +136,7 @@ function APIEndpointsTab({
|
|||||||
entityName={getEntityName(apiCollectionDetails)}
|
entityName={getEntityName(apiCollectionDetails)}
|
||||||
entityType={EntityType.API_COLLECTION}
|
entityType={EntityType.API_COLLECTION}
|
||||||
hasEditAccess={editDescriptionPermission}
|
hasEditAccess={editDescriptionPermission}
|
||||||
isDescriptionExpanded={isEmpty(apiEndpoints.data)}
|
isDescriptionExpanded={isEmpty(apiEndpoints)}
|
||||||
isEdit={isEdit}
|
isEdit={isEdit}
|
||||||
showActions={!apiCollectionDetails.deleted}
|
showActions={!apiCollectionDetails.deleted}
|
||||||
onCancel={onCancel}
|
onCancel={onCancel}
|
||||||
@ -166,7 +168,7 @@ function APIEndpointsTab({
|
|||||||
bordered
|
bordered
|
||||||
columns={tableColumn}
|
columns={tableColumn}
|
||||||
data-testid="databaseSchema-tables"
|
data-testid="databaseSchema-tables"
|
||||||
dataSource={apiEndpoints.data}
|
dataSource={apiEndpoints}
|
||||||
loading={apiEndpointsLoading}
|
loading={apiEndpointsLoading}
|
||||||
locale={{
|
locale={{
|
||||||
emptyText: (
|
emptyText: (
|
||||||
@ -181,14 +183,15 @@ function APIEndpointsTab({
|
|||||||
size="small"
|
size="small"
|
||||||
/>
|
/>
|
||||||
</Col>
|
</Col>
|
||||||
{apiEndpoints.paging.total > PAGE_SIZE && apiEndpoints.data.length > 0 && (
|
{!isUndefined(pagingInfo) && pagingInfo.showPagination && (
|
||||||
<Col span={24}>
|
<Col span={24}>
|
||||||
<NextPrevious
|
<NextPrevious
|
||||||
currentPage={currentEndpointsPage}
|
currentPage={currentEndpointsPage}
|
||||||
isLoading={apiEndpointsLoading}
|
isLoading={apiEndpointsLoading}
|
||||||
pageSize={PAGE_SIZE}
|
pageSize={pagingInfo.pageSize}
|
||||||
paging={apiEndpoints.paging}
|
paging={pagingInfo.paging}
|
||||||
pagingHandler={endpointPaginationHandler}
|
pagingHandler={endpointPaginationHandler}
|
||||||
|
onShowSizeChange={pagingInfo.handlePageSizeChange}
|
||||||
/>
|
/>
|
||||||
</Col>
|
</Col>
|
||||||
)}
|
)}
|
||||||
|
@ -15,7 +15,7 @@ import { Col, Row, Skeleton, Tabs, TabsProps } from 'antd';
|
|||||||
import { AxiosError } from 'axios';
|
import { AxiosError } from 'axios';
|
||||||
import { compare, Operation } from 'fast-json-patch';
|
import { compare, Operation } from 'fast-json-patch';
|
||||||
import { isEmpty, isUndefined } from 'lodash';
|
import { isEmpty, isUndefined } from 'lodash';
|
||||||
import { EntityTags, PagingResponse } from 'Models';
|
import { EntityTags } from 'Models';
|
||||||
import React, {
|
import React, {
|
||||||
FunctionComponent,
|
FunctionComponent,
|
||||||
useCallback,
|
useCallback,
|
||||||
@ -40,6 +40,7 @@ import {
|
|||||||
getEntityDetailsPath,
|
getEntityDetailsPath,
|
||||||
getVersionPath,
|
getVersionPath,
|
||||||
INITIAL_PAGING_VALUE,
|
INITIAL_PAGING_VALUE,
|
||||||
|
PAGE_SIZE,
|
||||||
ROUTES,
|
ROUTES,
|
||||||
} from '../../constants/constants';
|
} from '../../constants/constants';
|
||||||
import { FEED_COUNT_INITIAL_DATA } from '../../constants/entity.constants';
|
import { FEED_COUNT_INITIAL_DATA } from '../../constants/entity.constants';
|
||||||
@ -62,6 +63,7 @@ import { Table } from '../../generated/entity/data/table';
|
|||||||
import { ThreadType } from '../../generated/entity/feed/thread';
|
import { ThreadType } from '../../generated/entity/feed/thread';
|
||||||
import { Include } from '../../generated/type/include';
|
import { Include } from '../../generated/type/include';
|
||||||
import { TagLabel } from '../../generated/type/tagLabel';
|
import { TagLabel } from '../../generated/type/tagLabel';
|
||||||
|
import { usePaging } from '../../hooks/paging/usePaging';
|
||||||
import { useFqn } from '../../hooks/useFqn';
|
import { useFqn } from '../../hooks/useFqn';
|
||||||
import { FeedCounts } from '../../interface/feed.interface';
|
import { FeedCounts } from '../../interface/feed.interface';
|
||||||
import {
|
import {
|
||||||
@ -90,6 +92,9 @@ const DatabaseSchemaPage: FunctionComponent = () => {
|
|||||||
const { postFeed, deleteFeed, updateFeed } = useActivityFeedProvider();
|
const { postFeed, deleteFeed, updateFeed } = useActivityFeedProvider();
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { getEntityPermissionByFqn } = usePermissionProvider();
|
const { getEntityPermissionByFqn } = usePermissionProvider();
|
||||||
|
const pagingInfo = usePaging(PAGE_SIZE);
|
||||||
|
|
||||||
|
const { paging, pageSize, handlePagingChange } = pagingInfo;
|
||||||
|
|
||||||
const { tab: activeTab = EntityTabs.TABLE } =
|
const { tab: activeTab = EntityTabs.TABLE } =
|
||||||
useParams<{ tab: EntityTabs }>();
|
useParams<{ tab: EntityTabs }>();
|
||||||
@ -103,10 +108,7 @@ const DatabaseSchemaPage: FunctionComponent = () => {
|
|||||||
const [databaseSchema, setDatabaseSchema] = useState<DatabaseSchema>(
|
const [databaseSchema, setDatabaseSchema] = useState<DatabaseSchema>(
|
||||||
{} as DatabaseSchema
|
{} as DatabaseSchema
|
||||||
);
|
);
|
||||||
const [tableData, setTableData] = useState<PagingResponse<Table[]>>({
|
const [tableData, setTableData] = useState<Array<Table>>([]);
|
||||||
data: [],
|
|
||||||
paging: { total: 0 },
|
|
||||||
});
|
|
||||||
const [tableDataLoading, setTableDataLoading] = useState<boolean>(true);
|
const [tableDataLoading, setTableDataLoading] = useState<boolean>(true);
|
||||||
const [isSchemaDetailsLoading, setIsSchemaDetailsLoading] =
|
const [isSchemaDetailsLoading, setIsSchemaDetailsLoading] =
|
||||||
useState<boolean>(true);
|
useState<boolean>(true);
|
||||||
@ -240,7 +242,8 @@ const DatabaseSchemaPage: FunctionComponent = () => {
|
|||||||
databaseSchema: decodedDatabaseSchemaFQN,
|
databaseSchema: decodedDatabaseSchemaFQN,
|
||||||
include: showDeletedTables ? Include.Deleted : Include.NonDeleted,
|
include: showDeletedTables ? Include.Deleted : Include.NonDeleted,
|
||||||
});
|
});
|
||||||
setTableData(res);
|
setTableData(res.data);
|
||||||
|
handlePagingChange(res.paging);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
showErrorToast(err as AxiosError);
|
showErrorToast(err as AxiosError);
|
||||||
} finally {
|
} finally {
|
||||||
@ -452,11 +455,11 @@ const DatabaseSchemaPage: FunctionComponent = () => {
|
|||||||
const tablePaginationHandler = useCallback(
|
const tablePaginationHandler = useCallback(
|
||||||
({ cursorType, currentPage }: PagingHandlerParams) => {
|
({ cursorType, currentPage }: PagingHandlerParams) => {
|
||||||
if (cursorType) {
|
if (cursorType) {
|
||||||
getSchemaTables({ [cursorType]: tableData.paging[cursorType] });
|
getSchemaTables({ [cursorType]: paging[cursorType] });
|
||||||
}
|
}
|
||||||
setCurrentTablesPage(currentPage);
|
setCurrentTablesPage(currentPage);
|
||||||
},
|
},
|
||||||
[tableData, getSchemaTables]
|
[paging, getSchemaTables]
|
||||||
);
|
);
|
||||||
|
|
||||||
const versionHandler = useCallback(() => {
|
const versionHandler = useCallback(() => {
|
||||||
@ -513,13 +516,14 @@ const DatabaseSchemaPage: FunctionComponent = () => {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (viewDatabaseSchemaPermission && decodedDatabaseSchemaFQN) {
|
if (viewDatabaseSchemaPermission && decodedDatabaseSchemaFQN) {
|
||||||
getSchemaTables();
|
getSchemaTables({ limit: pageSize });
|
||||||
}
|
}
|
||||||
}, [
|
}, [
|
||||||
showDeletedTables,
|
showDeletedTables,
|
||||||
decodedDatabaseSchemaFQN,
|
decodedDatabaseSchemaFQN,
|
||||||
viewDatabaseSchemaPermission,
|
viewDatabaseSchemaPermission,
|
||||||
deleted,
|
deleted,
|
||||||
|
pageSize,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const {
|
const {
|
||||||
@ -593,6 +597,7 @@ const DatabaseSchemaPage: FunctionComponent = () => {
|
|||||||
getEntityFeedCount,
|
getEntityFeedCount,
|
||||||
fetchDatabaseSchemaDetails,
|
fetchDatabaseSchemaDetails,
|
||||||
handleFeedCount,
|
handleFeedCount,
|
||||||
|
pagingInfo,
|
||||||
}),
|
}),
|
||||||
[
|
[
|
||||||
feedCount,
|
feedCount,
|
||||||
@ -622,6 +627,7 @@ const DatabaseSchemaPage: FunctionComponent = () => {
|
|||||||
getEntityFeedCount,
|
getEntityFeedCount,
|
||||||
fetchDatabaseSchemaDetails,
|
fetchDatabaseSchemaDetails,
|
||||||
handleFeedCount,
|
handleFeedCount,
|
||||||
|
pagingInfo,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -13,8 +13,7 @@
|
|||||||
|
|
||||||
import { Col, Row, Switch, Typography } from 'antd';
|
import { Col, Row, Switch, Typography } from 'antd';
|
||||||
import { ColumnsType } from 'antd/lib/table';
|
import { ColumnsType } from 'antd/lib/table';
|
||||||
import { isEmpty } from 'lodash';
|
import { isEmpty, isUndefined } from 'lodash';
|
||||||
import { PagingResponse } from 'Models';
|
|
||||||
import React, { useMemo } from 'react';
|
import React, { useMemo } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
@ -24,11 +23,11 @@ import NextPrevious from '../../components/common/NextPrevious/NextPrevious';
|
|||||||
import { NextPreviousProps } from '../../components/common/NextPrevious/NextPrevious.interface';
|
import { NextPreviousProps } from '../../components/common/NextPrevious/NextPrevious.interface';
|
||||||
import RichTextEditorPreviewer from '../../components/common/RichTextEditor/RichTextEditorPreviewer';
|
import RichTextEditorPreviewer from '../../components/common/RichTextEditor/RichTextEditorPreviewer';
|
||||||
import TableAntd from '../../components/common/Table/Table';
|
import TableAntd from '../../components/common/Table/Table';
|
||||||
import { PAGE_SIZE } from '../../constants/constants';
|
|
||||||
import { ERROR_PLACEHOLDER_TYPE } from '../../enums/common.enum';
|
import { ERROR_PLACEHOLDER_TYPE } from '../../enums/common.enum';
|
||||||
import { EntityType } from '../../enums/entity.enum';
|
import { EntityType } from '../../enums/entity.enum';
|
||||||
import { DatabaseSchema } from '../../generated/entity/data/databaseSchema';
|
import { DatabaseSchema } from '../../generated/entity/data/databaseSchema';
|
||||||
import { Table } from '../../generated/entity/data/table';
|
import { Table } from '../../generated/entity/data/table';
|
||||||
|
import { UsePagingInterface } from '../../hooks/paging/usePaging';
|
||||||
import entityUtilClassBase from '../../utils/EntityUtilClassBase';
|
import entityUtilClassBase from '../../utils/EntityUtilClassBase';
|
||||||
import { getEntityName } from '../../utils/EntityUtils';
|
import { getEntityName } from '../../utils/EntityUtils';
|
||||||
|
|
||||||
@ -39,7 +38,7 @@ interface SchemaTablesTabProps {
|
|||||||
editDescriptionPermission?: boolean;
|
editDescriptionPermission?: boolean;
|
||||||
isEdit?: boolean;
|
isEdit?: boolean;
|
||||||
showDeletedTables?: boolean;
|
showDeletedTables?: boolean;
|
||||||
tableData: PagingResponse<Table[]>;
|
tableData: Table[];
|
||||||
currentTablesPage: number;
|
currentTablesPage: number;
|
||||||
tablePaginationHandler: NextPreviousProps['pagingHandler'];
|
tablePaginationHandler: NextPreviousProps['pagingHandler'];
|
||||||
onCancel?: () => void;
|
onCancel?: () => void;
|
||||||
@ -48,6 +47,7 @@ interface SchemaTablesTabProps {
|
|||||||
onThreadLinkSelect?: (link: string) => void;
|
onThreadLinkSelect?: (link: string) => void;
|
||||||
onShowDeletedTablesChange?: (value: boolean) => void;
|
onShowDeletedTablesChange?: (value: boolean) => void;
|
||||||
isVersionView?: boolean;
|
isVersionView?: boolean;
|
||||||
|
pagingInfo: UsePagingInterface;
|
||||||
}
|
}
|
||||||
|
|
||||||
function SchemaTablesTab({
|
function SchemaTablesTab({
|
||||||
@ -66,6 +66,7 @@ function SchemaTablesTab({
|
|||||||
showDeletedTables = false,
|
showDeletedTables = false,
|
||||||
onShowDeletedTablesChange,
|
onShowDeletedTablesChange,
|
||||||
isVersionView = false,
|
isVersionView = false,
|
||||||
|
pagingInfo,
|
||||||
}: Readonly<SchemaTablesTabProps>) {
|
}: Readonly<SchemaTablesTabProps>) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
@ -115,7 +116,7 @@ function SchemaTablesTab({
|
|||||||
description={description}
|
description={description}
|
||||||
entityFqn={databaseSchemaDetails.fullyQualifiedName}
|
entityFqn={databaseSchemaDetails.fullyQualifiedName}
|
||||||
entityType={EntityType.DATABASE_SCHEMA}
|
entityType={EntityType.DATABASE_SCHEMA}
|
||||||
isDescriptionExpanded={isEmpty(tableData.data)}
|
isDescriptionExpanded={isEmpty(tableData)}
|
||||||
showActions={false}
|
showActions={false}
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
@ -125,7 +126,7 @@ function SchemaTablesTab({
|
|||||||
entityName={getEntityName(databaseSchemaDetails)}
|
entityName={getEntityName(databaseSchemaDetails)}
|
||||||
entityType={EntityType.DATABASE_SCHEMA}
|
entityType={EntityType.DATABASE_SCHEMA}
|
||||||
hasEditAccess={editDescriptionPermission}
|
hasEditAccess={editDescriptionPermission}
|
||||||
isDescriptionExpanded={isEmpty(tableData.data)}
|
isDescriptionExpanded={isEmpty(tableData)}
|
||||||
isEdit={isEdit}
|
isEdit={isEdit}
|
||||||
showActions={!databaseSchemaDetails.deleted}
|
showActions={!databaseSchemaDetails.deleted}
|
||||||
onCancel={onCancel}
|
onCancel={onCancel}
|
||||||
@ -157,7 +158,7 @@ function SchemaTablesTab({
|
|||||||
bordered
|
bordered
|
||||||
columns={tableColumn}
|
columns={tableColumn}
|
||||||
data-testid="databaseSchema-tables"
|
data-testid="databaseSchema-tables"
|
||||||
dataSource={tableData.data}
|
dataSource={tableData}
|
||||||
loading={tableDataLoading}
|
loading={tableDataLoading}
|
||||||
locale={{
|
locale={{
|
||||||
emptyText: (
|
emptyText: (
|
||||||
@ -172,14 +173,15 @@ function SchemaTablesTab({
|
|||||||
size="small"
|
size="small"
|
||||||
/>
|
/>
|
||||||
</Col>
|
</Col>
|
||||||
{tableData.paging.total > PAGE_SIZE && tableData.data.length > 0 && (
|
{!isUndefined(pagingInfo) && pagingInfo.showPagination && (
|
||||||
<Col span={24}>
|
<Col span={24}>
|
||||||
<NextPrevious
|
<NextPrevious
|
||||||
currentPage={currentTablesPage}
|
currentPage={currentTablesPage}
|
||||||
isLoading={tableDataLoading}
|
isLoading={tableDataLoading}
|
||||||
pageSize={PAGE_SIZE}
|
pageSize={pagingInfo.pageSize}
|
||||||
paging={tableData.paging}
|
paging={pagingInfo.paging}
|
||||||
pagingHandler={tablePaginationHandler}
|
pagingHandler={tablePaginationHandler}
|
||||||
|
onShowSizeChange={pagingInfo.handlePageSizeChange}
|
||||||
/>
|
/>
|
||||||
</Col>
|
</Col>
|
||||||
)}
|
)}
|
||||||
|
@ -14,7 +14,6 @@
|
|||||||
import { Col, Row, Space, Tabs, TabsProps } from 'antd';
|
import { Col, Row, Space, Tabs, TabsProps } from 'antd';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import { isEmpty, toString } from 'lodash';
|
import { isEmpty, toString } from 'lodash';
|
||||||
import { PagingResponse } from 'Models';
|
|
||||||
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { useHistory, useParams } from 'react-router-dom';
|
import { useHistory, useParams } from 'react-router-dom';
|
||||||
@ -33,6 +32,7 @@ import {
|
|||||||
getEntityDetailsPath,
|
getEntityDetailsPath,
|
||||||
getVersionPath,
|
getVersionPath,
|
||||||
INITIAL_PAGING_VALUE,
|
INITIAL_PAGING_VALUE,
|
||||||
|
PAGE_SIZE,
|
||||||
} from '../../constants/constants';
|
} from '../../constants/constants';
|
||||||
import { usePermissionProvider } from '../../context/PermissionProvider/PermissionProvider';
|
import { usePermissionProvider } from '../../context/PermissionProvider/PermissionProvider';
|
||||||
import {
|
import {
|
||||||
@ -47,6 +47,7 @@ import { ChangeDescription } from '../../generated/entity/type';
|
|||||||
import { EntityHistory } from '../../generated/type/entityHistory';
|
import { EntityHistory } from '../../generated/type/entityHistory';
|
||||||
import { Include } from '../../generated/type/include';
|
import { Include } from '../../generated/type/include';
|
||||||
import { TagSource } from '../../generated/type/tagLabel';
|
import { TagSource } from '../../generated/type/tagLabel';
|
||||||
|
import { usePaging } from '../../hooks/paging/usePaging';
|
||||||
import { useFqn } from '../../hooks/useFqn';
|
import { useFqn } from '../../hooks/useFqn';
|
||||||
import SchemaTablesTab from '../../pages/DatabaseSchemaPage/SchemaTablesTab';
|
import SchemaTablesTab from '../../pages/DatabaseSchemaPage/SchemaTablesTab';
|
||||||
import {
|
import {
|
||||||
@ -72,11 +73,13 @@ function DatabaseSchemaVersionPage() {
|
|||||||
tab: EntityTabs;
|
tab: EntityTabs;
|
||||||
}>();
|
}>();
|
||||||
const { fqn: decodedEntityFQN } = useFqn();
|
const { fqn: decodedEntityFQN } = useFqn();
|
||||||
|
|
||||||
|
const pagingInfo = usePaging(PAGE_SIZE);
|
||||||
|
|
||||||
|
const { paging, pageSize, handlePagingChange } = pagingInfo;
|
||||||
|
|
||||||
const [currentPage, setCurrentPage] = useState(INITIAL_PAGING_VALUE);
|
const [currentPage, setCurrentPage] = useState(INITIAL_PAGING_VALUE);
|
||||||
const [tableData, setTableData] = useState<PagingResponse<Table[]>>({
|
const [tableData, setTableData] = useState<Array<Table>>([]);
|
||||||
data: [],
|
|
||||||
paging: { total: 0 },
|
|
||||||
});
|
|
||||||
const [servicePermissions, setServicePermissions] =
|
const [servicePermissions, setServicePermissions] =
|
||||||
useState<OperationPermission>(DEFAULT_ENTITY_PERMISSION);
|
useState<OperationPermission>(DEFAULT_ENTITY_PERMISSION);
|
||||||
const [isLoading, setIsLoading] = useState<boolean>(true);
|
const [isLoading, setIsLoading] = useState<boolean>(true);
|
||||||
@ -173,7 +176,8 @@ function DatabaseSchemaVersionPage() {
|
|||||||
...params,
|
...params,
|
||||||
databaseSchema: decodedEntityFQN,
|
databaseSchema: decodedEntityFQN,
|
||||||
});
|
});
|
||||||
setTableData(res);
|
setTableData(res.data);
|
||||||
|
handlePagingChange(res.paging);
|
||||||
} finally {
|
} finally {
|
||||||
setIsTableDataLoading(false);
|
setIsTableDataLoading(false);
|
||||||
}
|
}
|
||||||
@ -189,11 +193,11 @@ function DatabaseSchemaVersionPage() {
|
|||||||
const tablePaginationHandler = useCallback(
|
const tablePaginationHandler = useCallback(
|
||||||
({ cursorType, currentPage }: PagingHandlerParams) => {
|
({ cursorType, currentPage }: PagingHandlerParams) => {
|
||||||
if (cursorType) {
|
if (cursorType) {
|
||||||
getSchemaTables({ [cursorType]: tableData.paging[cursorType] });
|
getSchemaTables({ [cursorType]: paging[cursorType] });
|
||||||
}
|
}
|
||||||
setCurrentPage(currentPage);
|
setCurrentPage(currentPage);
|
||||||
},
|
},
|
||||||
[tableData, getSchemaTables]
|
[paging, getSchemaTables]
|
||||||
);
|
);
|
||||||
|
|
||||||
const { versionHandler, backHandler } = useMemo(
|
const { versionHandler, backHandler } = useMemo(
|
||||||
@ -247,6 +251,7 @@ function DatabaseSchemaVersionPage() {
|
|||||||
currentTablesPage={currentPage}
|
currentTablesPage={currentPage}
|
||||||
databaseSchemaDetails={currentVersionData}
|
databaseSchemaDetails={currentVersionData}
|
||||||
description={description}
|
description={description}
|
||||||
|
pagingInfo={pagingInfo}
|
||||||
tableData={tableData}
|
tableData={tableData}
|
||||||
tableDataLoading={isTableDataLoading}
|
tableDataLoading={isTableDataLoading}
|
||||||
tablePaginationHandler={tablePaginationHandler}
|
tablePaginationHandler={tablePaginationHandler}
|
||||||
@ -401,9 +406,9 @@ function DatabaseSchemaVersionPage() {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!isEmpty(currentVersionData)) {
|
if (!isEmpty(currentVersionData)) {
|
||||||
getSchemaTables();
|
getSchemaTables({ limit: pageSize });
|
||||||
}
|
}
|
||||||
}, [currentVersionData]);
|
}, [currentVersionData, pageSize]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<PageLayoutV1
|
<PageLayoutV1
|
||||||
|
@ -179,8 +179,13 @@ const ServiceDetailsPage: FunctionComponent = () => {
|
|||||||
handlePagingChange: handleIngestionPagingChange,
|
handlePagingChange: handleIngestionPagingChange,
|
||||||
} = ingestionPagingInfo;
|
} = ingestionPagingInfo;
|
||||||
|
|
||||||
const { paging, currentPage, handlePageChange, handlePagingChange } =
|
const {
|
||||||
pagingInfo;
|
paging,
|
||||||
|
pageSize: databasePageSize,
|
||||||
|
currentPage,
|
||||||
|
handlePageChange,
|
||||||
|
handlePagingChange,
|
||||||
|
} = pagingInfo;
|
||||||
|
|
||||||
const [serviceDetails, setServiceDetails] = useState<ServicesType>(
|
const [serviceDetails, setServiceDetails] = useState<ServicesType>(
|
||||||
{} as ServicesType
|
{} as ServicesType
|
||||||
@ -848,8 +853,8 @@ const ServiceDetailsPage: FunctionComponent = () => {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
handlePageChange(INITIAL_PAGING_VALUE);
|
handlePageChange(INITIAL_PAGING_VALUE);
|
||||||
getOtherDetails();
|
getOtherDetails({ limit: databasePageSize });
|
||||||
}, [activeTab, showDeleted, deleted]);
|
}, [activeTab, showDeleted, deleted, databasePageSize]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// fetch count for data modal tab, its need only when its dashboard page and data modal tab is not active
|
// fetch count for data modal tab, its need only when its dashboard page and data modal tab is not active
|
||||||
@ -1014,6 +1019,7 @@ const ServiceDetailsPage: FunctionComponent = () => {
|
|||||||
isServiceLoading={isServiceLoading}
|
isServiceLoading={isServiceLoading}
|
||||||
paging={paging}
|
paging={paging}
|
||||||
pagingHandler={pagingHandler}
|
pagingHandler={pagingHandler}
|
||||||
|
pagingInfo={pagingInfo}
|
||||||
saveUpdatedServiceData={saveUpdatedServiceData}
|
saveUpdatedServiceData={saveUpdatedServiceData}
|
||||||
serviceDetails={serviceDetails}
|
serviceDetails={serviceDetails}
|
||||||
serviceName={serviceCategory}
|
serviceName={serviceCategory}
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
import { Col, Row, Space, Switch, Table, Typography } from 'antd';
|
import { Col, Row, Space, Switch, Table, Typography } from 'antd';
|
||||||
import { ColumnsType } from 'antd/lib/table';
|
import { ColumnsType } from 'antd/lib/table';
|
||||||
import { isEmpty, isNil } from 'lodash';
|
import { isUndefined } from 'lodash';
|
||||||
import { EntityTags, ServiceTypes } from 'Models';
|
import { EntityTags, ServiceTypes } from 'Models';
|
||||||
import React, { useCallback, useMemo, useState } from 'react';
|
import React, { useCallback, useMemo, useState } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
@ -25,12 +25,12 @@ import NextPrevious from '../../components/common/NextPrevious/NextPrevious';
|
|||||||
import { NextPreviousProps } from '../../components/common/NextPrevious/NextPrevious.interface';
|
import { NextPreviousProps } from '../../components/common/NextPrevious/NextPrevious.interface';
|
||||||
import ResizablePanels from '../../components/common/ResizablePanels/ResizablePanels';
|
import ResizablePanels from '../../components/common/ResizablePanels/ResizablePanels';
|
||||||
import EntityRightPanel from '../../components/Entity/EntityRightPanel/EntityRightPanel';
|
import EntityRightPanel from '../../components/Entity/EntityRightPanel/EntityRightPanel';
|
||||||
import { PAGE_SIZE } from '../../constants/constants';
|
|
||||||
import { COMMON_RESIZABLE_PANEL_CONFIG } from '../../constants/ResizablePanel.constants';
|
import { COMMON_RESIZABLE_PANEL_CONFIG } from '../../constants/ResizablePanel.constants';
|
||||||
import { OperationPermission } from '../../context/PermissionProvider/PermissionProvider.interface';
|
import { OperationPermission } from '../../context/PermissionProvider/PermissionProvider.interface';
|
||||||
import { EntityType } from '../../enums/entity.enum';
|
import { EntityType } from '../../enums/entity.enum';
|
||||||
import { DatabaseService } from '../../generated/entity/services/databaseService';
|
import { DatabaseService } from '../../generated/entity/services/databaseService';
|
||||||
import { Paging } from '../../generated/type/paging';
|
import { Paging } from '../../generated/type/paging';
|
||||||
|
import { UsePagingInterface } from '../../hooks/paging/usePaging';
|
||||||
import { useFqn } from '../../hooks/useFqn';
|
import { useFqn } from '../../hooks/useFqn';
|
||||||
import { ServicesType } from '../../interface/service.interface';
|
import { ServicesType } from '../../interface/service.interface';
|
||||||
import { getServiceMainTabColumns } from '../../utils/ServiceMainTabContentUtils';
|
import { getServiceMainTabColumns } from '../../utils/ServiceMainTabContentUtils';
|
||||||
@ -52,6 +52,7 @@ interface ServiceMainTabContentProps {
|
|||||||
currentPage: number;
|
currentPage: number;
|
||||||
pagingHandler: NextPreviousProps['pagingHandler'];
|
pagingHandler: NextPreviousProps['pagingHandler'];
|
||||||
saveUpdatedServiceData: (updatedData: ServicesType) => Promise<void>;
|
saveUpdatedServiceData: (updatedData: ServicesType) => Promise<void>;
|
||||||
|
pagingInfo: UsePagingInterface;
|
||||||
}
|
}
|
||||||
|
|
||||||
function ServiceMainTabContent({
|
function ServiceMainTabContent({
|
||||||
@ -67,6 +68,7 @@ function ServiceMainTabContent({
|
|||||||
currentPage,
|
currentPage,
|
||||||
serviceDetails,
|
serviceDetails,
|
||||||
saveUpdatedServiceData,
|
saveUpdatedServiceData,
|
||||||
|
pagingInfo,
|
||||||
}: Readonly<ServiceMainTabContentProps>) {
|
}: Readonly<ServiceMainTabContentProps>) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { serviceCategory } = useParams<{
|
const { serviceCategory } = useParams<{
|
||||||
@ -210,14 +212,15 @@ function ServiceMainTabContent({
|
|||||||
size="small"
|
size="small"
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{Boolean(!isNil(paging.after) || !isNil(paging.before)) &&
|
{!isUndefined(pagingInfo) &&
|
||||||
!isEmpty(data) && (
|
pagingInfo.showPagination && (
|
||||||
<NextPrevious
|
<NextPrevious
|
||||||
currentPage={currentPage}
|
currentPage={currentPage}
|
||||||
isLoading={isServiceLoading}
|
isLoading={isServiceLoading}
|
||||||
pageSize={PAGE_SIZE}
|
pageSize={pagingInfo.pageSize}
|
||||||
paging={paging}
|
paging={paging}
|
||||||
pagingHandler={pagingHandler}
|
pagingHandler={pagingHandler}
|
||||||
|
onShowSizeChange={pagingInfo.handlePageSizeChange}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</Space>
|
</Space>
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
import { EntityTags, PagingResponse } from 'Models';
|
import { EntityTags } from 'Models';
|
||||||
import { PagingHandlerParams } from '../components/common/NextPrevious/NextPrevious.interface';
|
import { PagingHandlerParams } from '../components/common/NextPrevious/NextPrevious.interface';
|
||||||
import { TabProps } from '../components/common/TabsLabel/TabsLabel.interface';
|
import { TabProps } from '../components/common/TabsLabel/TabsLabel.interface';
|
||||||
import { DetailPageWidgetKeys } from '../enums/CustomizeDetailPage.enum';
|
import { DetailPageWidgetKeys } from '../enums/CustomizeDetailPage.enum';
|
||||||
@ -18,12 +18,13 @@ import { EntityTabs } from '../enums/entity.enum';
|
|||||||
import { DatabaseSchema } from '../generated/entity/data/databaseSchema';
|
import { DatabaseSchema } from '../generated/entity/data/databaseSchema';
|
||||||
import { Table } from '../generated/entity/data/table';
|
import { Table } from '../generated/entity/data/table';
|
||||||
import { ThreadType } from '../generated/entity/feed/thread';
|
import { ThreadType } from '../generated/entity/feed/thread';
|
||||||
|
import { UsePagingInterface } from '../hooks/paging/usePaging';
|
||||||
import { FeedCounts } from '../interface/feed.interface';
|
import { FeedCounts } from '../interface/feed.interface';
|
||||||
import { getDataBaseSchemaPageBaseTabs } from './DatabaseSchemaDetailsUtils';
|
import { getDataBaseSchemaPageBaseTabs } from './DatabaseSchemaDetailsUtils';
|
||||||
|
|
||||||
export interface DatabaseSchemaPageTabProps {
|
export interface DatabaseSchemaPageTabProps {
|
||||||
feedCount: FeedCounts;
|
feedCount: FeedCounts;
|
||||||
tableData: PagingResponse<Table[]>;
|
tableData: Table[];
|
||||||
activeTab: EntityTabs;
|
activeTab: EntityTabs;
|
||||||
currentTablesPage: number;
|
currentTablesPage: number;
|
||||||
databaseSchema: DatabaseSchema;
|
databaseSchema: DatabaseSchema;
|
||||||
@ -52,6 +53,7 @@ export interface DatabaseSchemaPageTabProps {
|
|||||||
getEntityFeedCount: () => void;
|
getEntityFeedCount: () => void;
|
||||||
fetchDatabaseSchemaDetails: () => Promise<void>;
|
fetchDatabaseSchemaDetails: () => Promise<void>;
|
||||||
handleFeedCount: (data: FeedCounts) => void;
|
handleFeedCount: (data: FeedCounts) => void;
|
||||||
|
pagingInfo: UsePagingInterface;
|
||||||
}
|
}
|
||||||
|
|
||||||
class DatabaseSchemaClassBase {
|
class DatabaseSchemaClassBase {
|
||||||
|
@ -58,12 +58,13 @@ export const getDataBaseSchemaPageBaseTabs = ({
|
|||||||
getEntityFeedCount,
|
getEntityFeedCount,
|
||||||
fetchDatabaseSchemaDetails,
|
fetchDatabaseSchemaDetails,
|
||||||
handleFeedCount,
|
handleFeedCount,
|
||||||
|
pagingInfo,
|
||||||
}: DatabaseSchemaPageTabProps): TabProps[] => {
|
}: DatabaseSchemaPageTabProps): TabProps[] => {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
label: (
|
label: (
|
||||||
<TabsLabel
|
<TabsLabel
|
||||||
count={tableData.paging.total}
|
count={pagingInfo.paging.total}
|
||||||
id={EntityTabs.TABLE}
|
id={EntityTabs.TABLE}
|
||||||
isActive={activeTab === EntityTabs.TABLE}
|
isActive={activeTab === EntityTabs.TABLE}
|
||||||
name={t('label.table-plural')}
|
name={t('label.table-plural')}
|
||||||
@ -84,6 +85,7 @@ export const getDataBaseSchemaPageBaseTabs = ({
|
|||||||
description={description}
|
description={description}
|
||||||
editDescriptionPermission={editDescriptionPermission}
|
editDescriptionPermission={editDescriptionPermission}
|
||||||
isEdit={isEdit}
|
isEdit={isEdit}
|
||||||
|
pagingInfo={pagingInfo}
|
||||||
showDeletedTables={showDeletedTables}
|
showDeletedTables={showDeletedTables}
|
||||||
tableData={tableData}
|
tableData={tableData}
|
||||||
tableDataLoading={tableDataLoading}
|
tableDataLoading={tableDataLoading}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user