Skip to content

Commit

Permalink
Merge branch 'main' into issue-1149-cl2
Browse files Browse the repository at this point in the history
  • Loading branch information
aniketkatkar97 authored Feb 10, 2025
2 parents 5e54053 + 5bb8c5c commit 60da1b9
Show file tree
Hide file tree
Showing 10 changed files with 154 additions and 39 deletions.
4 changes: 4 additions & 0 deletions ingestion/src/metadata/ingestion/ometa/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
from metadata.generated.schema.api.services.ingestionPipelines.createIngestionPipeline import (
CreateIngestionPipelineRequest,
)
from metadata.generated.schema.api.teams.createPersona import CreatePersonaRequest
from metadata.generated.schema.api.teams.createRole import CreateRoleRequest
from metadata.generated.schema.api.teams.createTeam import CreateTeamRequest
from metadata.generated.schema.api.teams.createUser import CreateUserRequest
Expand Down Expand Up @@ -157,6 +158,7 @@
from metadata.generated.schema.entity.services.pipelineService import PipelineService
from metadata.generated.schema.entity.services.searchService import SearchService
from metadata.generated.schema.entity.services.storageService import StorageService
from metadata.generated.schema.entity.teams.persona import Persona
from metadata.generated.schema.entity.teams.role import Role
from metadata.generated.schema.entity.teams.team import Team
from metadata.generated.schema.entity.teams.user import AuthenticationMechanism, User
Expand Down Expand Up @@ -217,6 +219,8 @@
CreateTeamRequest.__name__: "/teams",
User.__name__: "/users",
CreateUserRequest.__name__: "/users",
Persona.__name__: "/personas",
CreatePersonaRequest.__name__: "/personas",
AuthenticationMechanism.__name__: "/users/auth-mechanism",
Bot.__name__: "/bots",
CreateBot.__name__: "/bots",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ To extract metadata from Matillion, you need to create a user with the following

- `API` Permission ( While Creating the User, from Admin -> User )
- To retrieve lineage data, the user must be granted [Component-level permissions](https://docs.matillion.com/metl/docs/2932106/#component).
- To enable lineage tracking in Matillion, **Matillion Enterprise Mode** is required. For detailed setup instructions and further information, refer to the official documentation: [Matillion Lineage Documentation](https://docs.matillion.com/metl/docs/2881895/).

### Matillion Versions

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ To extract metadata from Matillion, you need to create a user with the following

- `API` Permission ( While Creating the User, from Admin -> User )
- To retrieve lineage data, the user must be granted [Component-level permissions](https://docs.matillion.com/metl/docs/2932106/#component).
- To enable lineage tracking in Matillion, **Matillion Enterprise Mode** is required. For detailed setup instructions and further information, refer to the official documentation: [Matillion Lineage Documentation](https://docs.matillion.com/metl/docs/2881895/).

### Matillion Versions

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { useTourProvider } from '../../context/TourProvider/TourProvider';
import { CurrentTourPageType } from '../../enums/tour.enum';
import { useApplicationStore } from '../../hooks/useApplicationStore';
import useCustomLocation from '../../hooks/useCustomLocation/useCustomLocation';
import TokenService from '../../utils/Auth/TokenService/TokenServiceUtil';
import {
extractDetailsFromToken,
isProtectedRoute,
Expand All @@ -38,8 +39,7 @@ const Appbar: React.FC = (): JSX.Element => {
const { isTourOpen, updateTourPage, updateTourSearch, tourSearchValue } =
useTourProvider();

const { isAuthenticated, searchCriteria, trySilentSignIn } =
useApplicationStore();
const { isAuthenticated, searchCriteria } = useApplicationStore();

const parsedQueryString = Qs.parse(
location.search.startsWith('?')
Expand Down Expand Up @@ -126,7 +126,7 @@ const Appbar: React.FC = (): JSX.Element => {
const { isExpired } = extractDetailsFromToken(getOidcToken());
if (!document.hidden && isExpired) {
// force logout
trySilentSignIn(true);
TokenService.getInstance().refreshToken();
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,9 @@ export const AuthProvider = ({

setApplicationLoading(false);

// Clear the refresh flag (used after refresh is complete)
tokenService.current.clearRefreshInProgress();

// Upon logout, redirect to the login page
history.push(ROUTES.SIGNIN);
}, [timeoutId]);
Expand Down Expand Up @@ -517,7 +520,9 @@ export const AuthProvider = ({
if (error.response) {
const { status } = error.response;
if (status === ClientErrors.UNAUTHORIZED) {
if (error.config.url === '/users/refresh') {
// For login or refresh we don't want to fire another refresh req
// Hence rejecting it
if (['/users/refresh', '/users/login'].includes(error.config.url)) {
return Promise.reject(error as Error);
}
handleStoreProtectedRedirectPath();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import Icon from '@ant-design/icons/lib/components/Icon';
import { Button, Tag } from 'antd';
import classNames from 'classnames';
import React, { Fragment, useCallback, useMemo } from 'react';
import { EdgeProps, getBezierPath } from 'reactflow';
import { EdgeProps } from 'reactflow';
import { ReactComponent as IconEditCircle } from '../../../assets/svg/ic-edit-circle.svg';
import { ReactComponent as FunctionIcon } from '../../../assets/svg/ic-function.svg';
import { ReactComponent as IconTimesCircle } from '../../../assets/svg/ic-times-circle.svg';
Expand All @@ -27,7 +27,10 @@ import { EntityType } from '../../../enums/entity.enum';
import { StatusType } from '../../../generated/entity/data/pipeline';
import { LineageLayer } from '../../../generated/settings/settings';
import { useApplicationStore } from '../../../hooks/useApplicationStore';
import { getColumnSourceTargetHandles } from '../../../utils/EntityLineageUtils';
import {
getColumnSourceTargetHandles,
getEdgePathData,
} from '../../../utils/EntityLineageUtils';
import { getEntityName } from '../../../utils/EntityUtils';
import EntityPopOverCard from '../../common/PopOverCard/EntityPopOverCard';
import { CustomEdgeData } from './EntityLineage.interface';
Expand Down Expand Up @@ -69,6 +72,8 @@ export const CustomEdge = ({
markerEnd,
data,
selected,
source,
target,
}: EdgeProps) => {
const {
edge,
Expand Down Expand Up @@ -96,6 +101,21 @@ export const CustomEdge = ({

const { theme } = useApplicationStore();

const {
edgePath,
edgeCenterX,
edgeCenterY,
invisibleEdgePath,
invisibleEdgePath1,
} = getEdgePathData(source, target, offset, {
sourceX,
sourceY,
targetX,
targetY,
sourcePosition,
targetPosition,
});

const showDqTracing = useMemo(() => {
return (
(activeLayer.includes(LineageLayer.DataObservability) &&
Expand All @@ -122,31 +142,6 @@ export const CustomEdge = ({
);
}, [isColumnLineage, tracedColumns, sourceHandle, targetHandle]);

const [edgePath, edgeCenterX, edgeCenterY] = getBezierPath({
sourceX,
sourceY,
sourcePosition,
targetX,
targetY,
targetPosition,
});
const [invisibleEdgePath] = getBezierPath({
sourceX: sourceX + offset,
sourceY: sourceY + offset,
sourcePosition,
targetX: targetX + offset,
targetY: targetY + offset,
targetPosition,
});
const [invisibleEdgePath1] = getBezierPath({
sourceX: sourceX - offset,
sourceY: sourceY - offset,
sourcePosition,
targetX: targetX - offset,
targetY: targetY - offset,
targetPosition,
});

const updatedStyle = useMemo(() => {
const isNodeTraced =
tracedNodes.includes(edge.fromEntity.id) &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ export interface ApplicationStore
entityDetails: EntityUnion;
}) => void;
updateSearchCriteria: (criteria: ExploreSearchIndex | '') => void;
trySilentSignIn: (forceLogout?: boolean) => void;
setApplicationsName: (applications: string[]) => void;
}

Expand Down
13 changes: 7 additions & 6 deletions openmetadata-ui/src/main/resources/ui/src/rest/LoginAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { HttpStatusCode } from 'axios';
import axiosClient from '.';
import { useApplicationStore } from '../hooks/useApplicationStore';

const BASE_URL = '/auth';

Expand All @@ -23,12 +25,11 @@ interface RenewTokenResponse {
}

export const renewToken = async () => {
const data = await axiosClient.get<RenewTokenResponse>(
`${BASE_URL}/refresh`,
// Need to invalidate other status codes
// which help is user to force logout
{ validateStatus: (status) => status === 200 }
);
const data = await axiosClient.get<RenewTokenResponse>(`${BASE_URL}/refresh`);

if (data.status === HttpStatusCode.Found) {
useApplicationStore.getState().onLoginHandler();
}

return data.data;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,6 @@ export const extractDetailsFromToken = (token: string) => {
return {
exp: 0,
isExpired: true,

timeoutExpiry: 0,
};
};
Expand Down
110 changes: 110 additions & 0 deletions openmetadata-ui/src/main/resources/ui/src/utils/EntityLineageUtils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import React, { MouseEvent as ReactMouseEvent } from 'react';
import {
Connection,
Edge,
getBezierPath,
getConnectedEdges,
getIncomers,
getOutgoers,
Expand Down Expand Up @@ -1451,3 +1452,112 @@ export const getColumnFunctionValue = (

return column?.function;
};

interface EdgeAlignmentPathDataProps {
sourceX: number;
sourceY: number;
targetX: number;
targetY: number;
sourcePosition: Position;
targetPosition: Position;
}

export const isSelfConnectingEdge = (source: string, target: string) => {
return source === target;
};

const getSelfConnectingEdgePath = ({
sourceX,
sourceY,
targetX,
targetY,
}: EdgeAlignmentPathDataProps) => {
const radiusX = (sourceX - targetX) * 0.6;
const radiusY = 50;

return `M ${sourceX - 5} ${sourceY} A ${radiusX} ${radiusY} 0 1 0 ${
targetX + 2
} ${targetY}`;
};

export const getEdgePathAlignmentData = (
source: string,
target: string,
edgePathData: {
sourceX: number;
sourceY: number;
targetX: number;
targetY: number;
}
) => {
if (isSelfConnectingEdge(source, target)) {
// modify the edge path data as per the self connecting edges behavior
return {
sourceX: edgePathData.sourceX - 5,
sourceY: edgePathData.sourceY - 80,
targetX: edgePathData.targetX + 2,
targetY: edgePathData.targetY - 80,
};
}

return edgePathData;
};

const getEdgePath = (
edgePath: string,
source: string,
target: string,
alignmentPathData: EdgeAlignmentPathDataProps
) => {
return isSelfConnectingEdge(source, target)
? getSelfConnectingEdgePath(alignmentPathData)
: edgePath;
};

export const getEdgePathData = (
source: string,
target: string,
offset: number,
edgePathData: EdgeAlignmentPathDataProps
) => {
const { sourceX, sourceY, targetX, targetY } = getEdgePathAlignmentData(
source,
target,
edgePathData
);
const { sourcePosition, targetPosition } = edgePathData;

const [edgePath, edgeCenterX, edgeCenterY] = getBezierPath({
sourceX,
sourceY,
sourcePosition,
targetX,
targetY,
targetPosition,
});

const [invisibleEdgePath] = getBezierPath({
sourceX: sourceX + offset,
sourceY: sourceY + offset,
sourcePosition,
targetX: targetX + offset,
targetY: targetY + offset,
targetPosition,
});
const [invisibleEdgePath1] = getBezierPath({
sourceX: sourceX - offset,
sourceY: sourceY - offset,
sourcePosition,
targetX: targetX - offset,
targetY: targetY - offset,
targetPosition,
});

return {
edgePath: getEdgePath(edgePath, source, target, edgePathData), // pass the initial data edgePathData, as edge modification will be done based on the initial data
edgeCenterX,
edgeCenterY,
invisibleEdgePath,
invisibleEdgePath1,
};
};

0 comments on commit 60da1b9

Please sign in to comment.