mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-11-09 23:40:05 +00:00
Fix partitioned keys (#13811)
* udpate design (cherry picked from commit 0cd57be9216471c96baaf0ec439201c365f1c8ad) * minor update (cherry picked from commit 3147959bc08c556477eeaa0279ffef1dddbf6c85) * address comments
This commit is contained in:
parent
d025e217d6
commit
d117a2c8ac
@ -29,6 +29,7 @@ const SchemaTab: FunctionComponent<Props> = ({
|
|||||||
isReadOnly = false,
|
isReadOnly = false,
|
||||||
entityFqn,
|
entityFqn,
|
||||||
tableConstraints,
|
tableConstraints,
|
||||||
|
tablePartitioned,
|
||||||
}: Props) => {
|
}: Props) => {
|
||||||
const [searchText, setSearchText] = useState('');
|
const [searchText, setSearchText] = useState('');
|
||||||
|
|
||||||
@ -58,6 +59,7 @@ const SchemaTab: FunctionComponent<Props> = ({
|
|||||||
searchText={lowerCase(searchText)}
|
searchText={lowerCase(searchText)}
|
||||||
tableColumns={columns}
|
tableColumns={columns}
|
||||||
tableConstraints={tableConstraints}
|
tableConstraints={tableConstraints}
|
||||||
|
tablePartitioned={tablePartitioned}
|
||||||
onThreadLinkSelect={onThreadLinkSelect}
|
onThreadLinkSelect={onThreadLinkSelect}
|
||||||
onUpdate={onUpdate}
|
onUpdate={onUpdate}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@ -16,6 +16,7 @@ import {
|
|||||||
ColumnJoins,
|
ColumnJoins,
|
||||||
Table,
|
Table,
|
||||||
TableData,
|
TableData,
|
||||||
|
TablePartition,
|
||||||
} from '../../generated/entity/data/table';
|
} from '../../generated/entity/data/table';
|
||||||
|
|
||||||
export type Props = {
|
export type Props = {
|
||||||
@ -28,6 +29,7 @@ export type Props = {
|
|||||||
hasTagEditAccess: boolean;
|
hasTagEditAccess: boolean;
|
||||||
isReadOnly?: boolean;
|
isReadOnly?: boolean;
|
||||||
entityFqn: string;
|
entityFqn: string;
|
||||||
|
tablePartitioned?: TablePartition;
|
||||||
onThreadLinkSelect: (value: string, threadType?: ThreadType) => void;
|
onThreadLinkSelect: (value: string, threadType?: ThreadType) => void;
|
||||||
onUpdate: (columns: Table['columns']) => Promise<void>;
|
onUpdate: (columns: Table['columns']) => Promise<void>;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -12,7 +12,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import Icon, { FilterOutlined } from '@ant-design/icons';
|
import Icon, { FilterOutlined } from '@ant-design/icons';
|
||||||
import { Table, Tooltip, Typography } from 'antd';
|
import { Tooltip, Typography } from 'antd';
|
||||||
import { ColumnsType } from 'antd/lib/table';
|
import { ColumnsType } from 'antd/lib/table';
|
||||||
import { ExpandableConfig } from 'antd/lib/table/interface';
|
import { ExpandableConfig } from 'antd/lib/table/interface';
|
||||||
import {
|
import {
|
||||||
@ -57,6 +57,7 @@ import {
|
|||||||
prepareConstraintIcon,
|
prepareConstraintIcon,
|
||||||
updateFieldTags,
|
updateFieldTags,
|
||||||
} from '../../utils/TableUtils';
|
} from '../../utils/TableUtils';
|
||||||
|
import Table from '../common/Table/Table';
|
||||||
import { ModalWithMarkdownEditor } from '../Modals/ModalWithMarkdownEditor/ModalWithMarkdownEditor';
|
import { ModalWithMarkdownEditor } from '../Modals/ModalWithMarkdownEditor/ModalWithMarkdownEditor';
|
||||||
import { SchemaTableProps, TableCellRendered } from './SchemaTable.interface';
|
import { SchemaTableProps, TableCellRendered } from './SchemaTable.interface';
|
||||||
|
|
||||||
@ -71,6 +72,7 @@ const SchemaTable = ({
|
|||||||
onThreadLinkSelect,
|
onThreadLinkSelect,
|
||||||
entityFqn,
|
entityFqn,
|
||||||
tableConstraints,
|
tableConstraints,
|
||||||
|
tablePartitioned,
|
||||||
}: SchemaTableProps) => {
|
}: SchemaTableProps) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
@ -357,6 +359,21 @@ const SchemaTable = ({
|
|||||||
width: 320,
|
width: 320,
|
||||||
render: renderDescription,
|
render: renderDescription,
|
||||||
},
|
},
|
||||||
|
...(tablePartitioned
|
||||||
|
? [
|
||||||
|
{
|
||||||
|
title: t('label.partitioned'),
|
||||||
|
dataIndex: 'name',
|
||||||
|
key: 'name',
|
||||||
|
accessor: 'name',
|
||||||
|
width: 120,
|
||||||
|
render: (columnName: string) =>
|
||||||
|
tablePartitioned?.columns?.includes(columnName)
|
||||||
|
? t('label.partitioned')
|
||||||
|
: t('label.non-partitioned'),
|
||||||
|
},
|
||||||
|
]
|
||||||
|
: []),
|
||||||
{
|
{
|
||||||
title: t('label.tag-plural'),
|
title: t('label.tag-plural'),
|
||||||
dataIndex: 'tags',
|
dataIndex: 'tags',
|
||||||
|
|||||||
@ -22,6 +22,7 @@ export interface SchemaTableProps {
|
|||||||
hasDescriptionEditAccess: boolean;
|
hasDescriptionEditAccess: boolean;
|
||||||
hasTagEditAccess: boolean;
|
hasTagEditAccess: boolean;
|
||||||
tableConstraints: Table['tableConstraints'];
|
tableConstraints: Table['tableConstraints'];
|
||||||
|
tablePartitioned: Table['tablePartition'];
|
||||||
searchText?: string;
|
searchText?: string;
|
||||||
isReadOnly?: boolean;
|
isReadOnly?: boolean;
|
||||||
entityFqn: string;
|
entityFqn: string;
|
||||||
|
|||||||
@ -15,7 +15,7 @@ import { render, screen } from '@testing-library/react';
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { MemoryRouter } from 'react-router-dom';
|
import { MemoryRouter } from 'react-router-dom';
|
||||||
import { Column } from '../../generated/entity/data/container';
|
import { Column } from '../../generated/entity/data/container';
|
||||||
import { Table } from '../../generated/entity/data/table';
|
import { Table, TablePartition } from '../../generated/entity/data/table';
|
||||||
import EntityTableV1 from './SchemaTable.component';
|
import EntityTableV1 from './SchemaTable.component';
|
||||||
|
|
||||||
const onEntityFieldSelect = jest.fn();
|
const onEntityFieldSelect = jest.fn();
|
||||||
@ -78,6 +78,7 @@ const mockEntityTableProp = {
|
|||||||
columnName: '',
|
columnName: '',
|
||||||
hasTagEditAccess: true,
|
hasTagEditAccess: true,
|
||||||
tableConstraints: mockTableConstraints,
|
tableConstraints: mockTableConstraints,
|
||||||
|
tablePartitioned: {} as TablePartition,
|
||||||
onEntityFieldSelect,
|
onEntityFieldSelect,
|
||||||
onThreadLinkSelect,
|
onThreadLinkSelect,
|
||||||
onUpdate,
|
onUpdate,
|
||||||
|
|||||||
@ -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 { Space, Typography } from 'antd';
|
import { Typography } from 'antd';
|
||||||
import { t } from 'i18next';
|
import { t } from 'i18next';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { TablePartition } from '../../../generated/entity/data/table';
|
import { TablePartition } from '../../../generated/entity/data/table';
|
||||||
@ -21,17 +21,11 @@ interface PartitionedKeysProps {
|
|||||||
|
|
||||||
export const PartitionedKeys = ({ tablePartition }: PartitionedKeysProps) => {
|
export const PartitionedKeys = ({ tablePartition }: PartitionedKeysProps) => {
|
||||||
return (
|
return (
|
||||||
<Space className="p-b-sm" direction="vertical">
|
<>
|
||||||
<Typography.Text className="right-panel-label">
|
<Typography.Text className="right-panel-label">
|
||||||
{t('label.table-partitioned')}
|
{t('label.table-partitioned')}
|
||||||
</Typography.Text>
|
</Typography.Text>
|
||||||
<Typography.Text>
|
<span>{` - ${tablePartition.intervalType}`}</span>
|
||||||
{`${t('label.interval')} - ${tablePartition.intervalType}`}
|
</>
|
||||||
</Typography.Text>
|
|
||||||
<Space>
|
|
||||||
{`${t('label.column-plural')} -
|
|
||||||
${tablePartition.columns?.map((column) => column)}`}
|
|
||||||
</Space>
|
|
||||||
</Space>
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@ -483,6 +483,7 @@ const TableDetailsPageV1 = () => {
|
|||||||
isReadOnly={tableDetails?.deleted}
|
isReadOnly={tableDetails?.deleted}
|
||||||
joins={tableDetails?.joins?.columnJoins || []}
|
joins={tableDetails?.joins?.columnJoins || []}
|
||||||
tableConstraints={tableDetails?.tableConstraints}
|
tableConstraints={tableDetails?.tableConstraints}
|
||||||
|
tablePartitioned={tableDetails?.tablePartition}
|
||||||
onThreadLinkSelect={onThreadLinkSelect}
|
onThreadLinkSelect={onThreadLinkSelect}
|
||||||
onUpdate={onColumnsUpdate}
|
onUpdate={onColumnsUpdate}
|
||||||
/>
|
/>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user