mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-11-11 08:23:40 +00:00
parent
30c1e5a14c
commit
9cf26a1933
@ -27,6 +27,7 @@ type Props = {
|
|||||||
joins: Array<ColumnJoins>;
|
joins: Array<ColumnJoins>;
|
||||||
onUpdate: (columns: Array<TableColumn>) => void;
|
onUpdate: (columns: Array<TableColumn>) => void;
|
||||||
sampleData: SampleData;
|
sampleData: SampleData;
|
||||||
|
columnName: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
const SchemaTab: FunctionComponent<Props> = ({
|
const SchemaTab: FunctionComponent<Props> = ({
|
||||||
@ -34,6 +35,7 @@ const SchemaTab: FunctionComponent<Props> = ({
|
|||||||
joins,
|
joins,
|
||||||
onUpdate,
|
onUpdate,
|
||||||
sampleData,
|
sampleData,
|
||||||
|
columnName,
|
||||||
}: Props) => {
|
}: Props) => {
|
||||||
const [searchText, setSearchText] = useState('');
|
const [searchText, setSearchText] = useState('');
|
||||||
const [checkedValue, setCheckedValue] = useState('schema');
|
const [checkedValue, setCheckedValue] = useState('schema');
|
||||||
@ -111,6 +113,7 @@ const SchemaTab: FunctionComponent<Props> = ({
|
|||||||
<div className="col-sm-12">
|
<div className="col-sm-12">
|
||||||
{checkedValue === 'schema' ? (
|
{checkedValue === 'schema' ? (
|
||||||
<SchemaTable
|
<SchemaTable
|
||||||
|
columnName={columnName}
|
||||||
columns={columns}
|
columns={columns}
|
||||||
joins={joins}
|
joins={joins}
|
||||||
searchText={lowerCase(searchText)}
|
searchText={lowerCase(searchText)}
|
||||||
|
|||||||
@ -47,6 +47,7 @@ type Props = {
|
|||||||
joins: Array<ColumnJoins>;
|
joins: Array<ColumnJoins>;
|
||||||
searchText?: string;
|
searchText?: string;
|
||||||
onUpdate: (columns: Array<TableColumn>) => void;
|
onUpdate: (columns: Array<TableColumn>) => void;
|
||||||
|
columnName: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
const SchemaTable: FunctionComponent<Props> = ({
|
const SchemaTable: FunctionComponent<Props> = ({
|
||||||
@ -54,6 +55,7 @@ const SchemaTable: FunctionComponent<Props> = ({
|
|||||||
joins,
|
joins,
|
||||||
searchText = '',
|
searchText = '',
|
||||||
onUpdate,
|
onUpdate,
|
||||||
|
columnName,
|
||||||
}: Props) => {
|
}: Props) => {
|
||||||
const [editColumn, setEditColumn] = useState<{
|
const [editColumn, setEditColumn] = useState<{
|
||||||
column: TableColumn;
|
column: TableColumn;
|
||||||
@ -99,16 +101,6 @@ const SchemaTable: FunctionComponent<Props> = ({
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleClick = () => {
|
|
||||||
if (rowRef.current) {
|
|
||||||
rowRef.current.scrollIntoView({
|
|
||||||
behavior: 'smooth',
|
|
||||||
inline: 'nearest',
|
|
||||||
block: 'nearest',
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const checkIfJoinsAvailable = (columnName: string): boolean => {
|
const checkIfJoinsAvailable = (columnName: string): boolean => {
|
||||||
return (
|
return (
|
||||||
joins &&
|
joins &&
|
||||||
@ -229,6 +221,16 @@ const SchemaTable: FunctionComponent<Props> = ({
|
|||||||
fetchTags();
|
fetchTags();
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (rowRef.current) {
|
||||||
|
rowRef.current.scrollIntoView({
|
||||||
|
behavior: 'smooth',
|
||||||
|
inline: 'center',
|
||||||
|
block: 'center',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, [columnName, rowRef.current]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="tw-table-responsive">
|
<div className="tw-table-responsive">
|
||||||
@ -247,12 +249,15 @@ const SchemaTable: FunctionComponent<Props> = ({
|
|||||||
<tr
|
<tr
|
||||||
className={classNames(
|
className={classNames(
|
||||||
'tableBody-row',
|
'tableBody-row',
|
||||||
!isEven(index + 1) ? 'odd-row' : null
|
!isEven(index + 1) ? 'odd-row' : null,
|
||||||
|
{
|
||||||
|
'column-highlight': columnName === column.name,
|
||||||
|
}
|
||||||
)}
|
)}
|
||||||
data-testid="column"
|
data-testid="column"
|
||||||
id={column.name}
|
id={column.name}
|
||||||
key={index}
|
key={index}
|
||||||
ref={rowRef}>
|
ref={columnName === column.name ? rowRef : null}>
|
||||||
<td className="tw-relative tableBody-cell">
|
<td className="tw-relative tableBody-cell">
|
||||||
{getConstraintIcon(column.columnConstraint)}
|
{getConstraintIcon(column.columnConstraint)}
|
||||||
<span>{column.name}</span>
|
<span>{column.name}</span>
|
||||||
@ -315,8 +320,7 @@ const SchemaTable: FunctionComponent<Props> = ({
|
|||||||
columnJoin.fullyQualifiedName,
|
columnJoin.fullyQualifiedName,
|
||||||
['column']
|
['column']
|
||||||
)
|
)
|
||||||
)}
|
)}>
|
||||||
onClick={handleClick}>
|
|
||||||
{getPartialNameFromFQN(
|
{getPartialNameFromFQN(
|
||||||
columnJoin.fullyQualifiedName,
|
columnJoin.fullyQualifiedName,
|
||||||
['database', 'table', 'column']
|
['database', 'table', 'column']
|
||||||
@ -343,8 +347,7 @@ const SchemaTable: FunctionComponent<Props> = ({
|
|||||||
columnJoin.fullyQualifiedName,
|
columnJoin.fullyQualifiedName,
|
||||||
['column']
|
['column']
|
||||||
)
|
)
|
||||||
)}
|
)}>
|
||||||
onClick={handleClick}>
|
|
||||||
{getPartialNameFromFQN(
|
{getPartialNameFromFQN(
|
||||||
columnJoin.fullyQualifiedName,
|
columnJoin.fullyQualifiedName,
|
||||||
['database', 'table', 'column']
|
['database', 'table', 'column']
|
||||||
|
|||||||
@ -133,7 +133,7 @@ export const getDatasetDetailsPath = (
|
|||||||
let path = ROUTES.DATASET_DETAILS;
|
let path = ROUTES.DATASET_DETAILS;
|
||||||
path = path.replace(PLACEHOLDER_ROUTE_DATASET_FQN, datasetFQN);
|
path = path.replace(PLACEHOLDER_ROUTE_DATASET_FQN, datasetFQN);
|
||||||
|
|
||||||
return `${path}${columnName ? `#${columnName}` : ''}`;
|
return `${path}${columnName ? `.${columnName}` : ''}`;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getServiceDetailsPath = (
|
export const getServiceDetailsPath = (
|
||||||
|
|||||||
@ -297,7 +297,7 @@ const MyDataDetailsPage = () => {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
getTableDetailsByFQN(
|
getTableDetailsByFQN(
|
||||||
tableFQN,
|
getPartialNameFromFQN(tableFQN, ['service', 'database', 'table'], '.'),
|
||||||
'columns, database, usageSummary, followers, joins, tags, owner,sampleData'
|
'columns, database, usageSummary, followers, joins, tags, owner,sampleData'
|
||||||
).then((res: AxiosResponse) => {
|
).then((res: AxiosResponse) => {
|
||||||
const {
|
const {
|
||||||
@ -426,6 +426,11 @@ const MyDataDetailsPage = () => {
|
|||||||
</div>
|
</div>
|
||||||
<div className="tw-col-span-full">
|
<div className="tw-col-span-full">
|
||||||
<SchemaTab
|
<SchemaTab
|
||||||
|
columnName={getPartialNameFromFQN(
|
||||||
|
tableFQN,
|
||||||
|
['column'],
|
||||||
|
'.'
|
||||||
|
)}
|
||||||
columns={columns}
|
columns={columns}
|
||||||
joins={tableJoinData.columnJoins}
|
joins={tableJoinData.columnJoins}
|
||||||
sampleData={sampleData}
|
sampleData={sampleData}
|
||||||
|
|||||||
@ -313,4 +313,17 @@
|
|||||||
.slick-dots li.slick-active button:before {
|
.slick-dots li.slick-active button:before {
|
||||||
@apply tw-text-primary tw-opacity-100 !important;
|
@apply tw-text-primary tw-opacity-100 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.column-highlight {
|
||||||
|
animation: highlight 3000ms ease-out;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes highlight {
|
||||||
|
0% {
|
||||||
|
@apply tw-bg-warning-lite;
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
@apply tw-bg-white;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -38,7 +38,8 @@ export const getTableFQNFromColumnFQN = (columnFQN: string): string => {
|
|||||||
|
|
||||||
export const getPartialNameFromFQN = (
|
export const getPartialNameFromFQN = (
|
||||||
fqn: string,
|
fqn: string,
|
||||||
arrTypes: Array<'service' | 'database' | 'table' | 'column'> = []
|
arrTypes: Array<'service' | 'database' | 'table' | 'column'> = [],
|
||||||
|
joinSeperator = '/'
|
||||||
): string => {
|
): string => {
|
||||||
const arrFqn = fqn.split('.');
|
const arrFqn = fqn.split('.');
|
||||||
const arrPartialName = [];
|
const arrPartialName = [];
|
||||||
@ -54,7 +55,7 @@ export const getPartialNameFromFQN = (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return arrPartialName.join('/');
|
return arrPartialName.join(joinSeperator);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getCurrentUserId = (): string => {
|
export const getCurrentUserId = (): string => {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user