Skip to content
This repository has been archived by the owner on Jun 10, 2024. It is now read-only.

Commit

Permalink
Merge pull request #343 from GinaIsaia/updated-print
Browse files Browse the repository at this point in the history
Updated lineage graph print and includeprocesses
  • Loading branch information
Ljupcho Palashevski authored May 31, 2023
2 parents ac316e3 + 8a36c05 commit 65bc525
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 15 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@lfai/egeria-ui-components",
"version": "4.3.1",
"version": "4.3.2",
"description": "Encapsulated reactjs components with business logic inside.",
"license": "Apache-2.0",
"repository": {
Expand Down
4 changes: 2 additions & 2 deletions src/components/Lineage/Graph/GraphActions/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
AiOutlinePrinter
} from 'react-icons/ai';
import { RequirePermissions } from '@lfai/egeria-ui-core';
import { VISIBLE_COMPONENTS } from '@lfai/egeria-js-commons';
import { LINEAGE_TYPES, VISIBLE_COMPONENTS } from '@lfai/egeria-js-commons';

import '@lfai/happi-graph/src/components/HappiGraph/happi-graph.scss';
import '../index.scss';
Expand Down Expand Up @@ -42,7 +42,7 @@ export function EgeriaLineageGraphActions (props: Props) {
<AiOutlinePrinter size={25}/>
</ActionIcon>
</Tooltip>} />
{ selectedNodeGroup !== 'Process' && <Tooltip label="Processes" position="right">
{ !(selectedNodeGroup === 'Process' || lineageType === LINEAGE_TYPES.VERTICAL_LINEAGE) && <Tooltip label="Processes" position="right">
<ActionIcon variant="subtle" size={35} onClick={() => onSwitchChange(lineageType, !includeProcess)}>
{ includeProcess ? <ToggleRight size={25} color="var(--happi-graph-primary-color)"/> : <ToggleLeft size={25} /> }
</ActionIcon>
Expand Down
9 changes: 6 additions & 3 deletions src/components/Lineage/Graph/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Modal, LoadingOverlay, Tabs } from '@mantine/core';
import { egeriaFetch, authHeader, getAssetLineagePrintPath, LINEAGE_TYPES, hasTab, VISIBLE_COMPONENTS } from '@lfai/egeria-js-commons';
import { egeriaFetch, authHeader, LINEAGE_TYPES, hasTab, VISIBLE_COMPONENTS } from '@lfai/egeria-js-commons';

import {
HappiGraph
Expand Down Expand Up @@ -42,7 +42,6 @@ export function EgeriaLineageGraph(props: Props) {
const [searchParams] = useSearchParams();
const includeProcess = !(searchParams.get('includeProcess') === 'false');
const initialData: IGraphData = {nodes: [], edges: []};

const [rawData, setRawData] = useState(initialData);
const [loading, setLoading] = useState(false);
const [opened, setOpened] = useState(false);
Expand All @@ -52,7 +51,11 @@ export function EgeriaLineageGraph(props: Props) {
// TODO: extract URL to URL Map
const uri = (lineageType: any, includeProcess:any) => `/api/lineage/entities/${guid}/${lineageType}?includeProcesses=${includeProcess}`;

const printUri = getAssetLineagePrintPath(guid, lineageType);
const getAssetLineagePrintPath = (guid: any, lineageType: any, includeProcess: any) => {
return `/asset-lineage/${ guid }/${ lineageType }/print?includeProcesses=${includeProcess}`;
};

const printUri = getAssetLineagePrintPath(guid, lineageType, includeProcess);

const fetchData = async (uri: string) => {
const res = await egeriaFetch(uri, 'GET', { ...authHeader() }, {});
Expand Down
20 changes: 13 additions & 7 deletions src/components/Lineage/Graph/print.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useParams } from 'react-router-dom';
import { useParams, useSearchParams } from 'react-router-dom';

import {
HappiGraph,
Expand All @@ -17,22 +17,28 @@ import { getApiDataUrl} from './index';
import { authHeader, egeriaFetch, getFormattedDate, LINEAGE_TYPES} from '@lfai/egeria-js-commons';

export function EgeriaLineageGraphPrint() {
const { guid, lineageType, includeProcess }: any = useParams();
const { guid, lineageType }: any = useParams();
const [ isLoading, setIsLoading ] = useState(true);
const [label, setLabel] = useState<any[]>([]);
const [group, setGroup] = useState<any[]>([]);

const [searchParams] = useSearchParams();
const includeProcess = searchParams.get('includeProcesses');

const [rawData, setRawData] = useState({nodes: [], edges: []});
const isVerticalLineage = lineageType == LINEAGE_TYPES.VERTICAL_LINEAGE;

const fetchData = async (uri: string) => {
const res = await egeriaFetch(uri, 'GET', { ...authHeader() }, {});
const data = await res.json();
if (res) {
const data = await res.json();

setRawData(data);
setIsLoading(false);

setRawData(data);
setIsLoading(false);
setLabel(data.nodes.filter((d: { [x: string]: any; }) => d['id'] == guid)[0]['label']);
setGroup(data.nodes.filter((d: { [x: string]: any; }) => d['id'] == guid)[0]['group']);
setLabel(data.nodes.filter((d: { [x: string]: any; }) => d['id'] == guid)[0]['label']);
setGroup(data.nodes.filter((d: { [x: string]: any; }) => d['id'] == guid)[0]['group']);
}
};

useEffect(() => {
Expand Down

0 comments on commit 65bc525

Please sign in to comment.