Skip to content

Commit b06e122

Browse files
authored
Merge branch 'datahub-project:master' into master
2 parents 5bf8ba9 + 0093aa8 commit b06e122

File tree

72 files changed

+3509
-230
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+3509
-230
lines changed

datahub-web-react/src/app/entityV2/shared/embed/UpstreamHealth/UpstreamEntitiesList.tsx

+9-4
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
import React from 'react';
22
import styled from 'styled-components';
3-
import { Dataset } from '@src/types.generated';
43
import { Divider } from 'antd';
54
import { EntityLinkList } from '@src/app/homeV2/reference/sections/EntityLinkList';
5+
import { GenericEntityProperties } from '@src/app/entity/shared/types';
66
import { ANTD_GRAY } from '../../constants';
77

88
type Props = {
9-
directEntities: Dataset[];
10-
indirectEntities: Dataset[];
9+
directEntities: GenericEntityProperties[];
10+
indirectEntities: GenericEntityProperties[];
1111
loadMoreDirectEntities: () => void;
1212
loadMoreIndirectEntities: () => void;
1313
remainingDirectEntities: number;
1414
remainingIndirectEntities: number;
15+
showHealthIcon?: boolean;
16+
showDeprecatedIcon?: boolean;
1517
};
1618

1719
const Container = styled.div`
@@ -47,6 +49,8 @@ const UpstreamEntitiesList = ({
4749
loadMoreIndirectEntities,
4850
remainingDirectEntities,
4951
remainingIndirectEntities,
52+
showHealthIcon,
53+
showDeprecatedIcon,
5054
}: Props) => {
5155
return (
5256
<Container>
@@ -63,7 +67,8 @@ const UpstreamEntitiesList = ({
6367
showMoreComponent={
6468
<ShowMoreWrapper>{`Show ${remainingDirectEntities} more`}</ShowMoreWrapper>
6569
}
66-
showHealthIcon
70+
showHealthIcon={showHealthIcon}
71+
showDeprecatedIcon={showDeprecatedIcon}
6772
/>
6873
</>
6974
)}

datahub-web-react/src/app/entityV2/shared/embed/UpstreamHealth/UpstreamHealth.tsx

+48-11
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,15 @@ import { Divider } from 'antd';
33
import React, { useEffect, useState } from 'react';
44
import styled from 'styled-components';
55
import { ErrorRounded } from '@mui/icons-material';
6-
import { isUnhealthy } from '@src/app/shared/health/healthUtils';
6+
import { isDeprecated, isUnhealthy } from '@src/app/shared/health/healthUtils';
7+
import { useEntityRegistry } from '@src/app/useEntityRegistry';
8+
import { GenericEntityProperties } from '@src/app/entity/shared/types';
79
import { useSearchAcrossLineageQuery } from '../../../../../graphql/search.generated';
8-
import { Dataset, EntityType, FilterOperator, LineageDirection } from '../../../../../types.generated';
10+
import { FilterOperator, LineageDirection } from '../../../../../types.generated';
911
import {
1012
HAS_ACTIVE_INCIDENTS_FILTER_NAME,
1113
HAS_FAILING_ASSERTIONS_FILTER_NAME,
14+
IS_DEPRECATED_FILTER_NAME,
1215
} from '../../../../search/utils/constants';
1316
import { useAppConfig } from '../../../../useAppConfig';
1417
import { useEntityData } from '../../../../entity/shared/EntityContext';
@@ -49,10 +52,11 @@ const Container = styled.div`
4952

5053
export default function UpstreamHealth() {
5154
const { entityData } = useEntityData();
55+
const entityRegistry = useEntityRegistry();
5256

5357
const [isOpen, setIsOpen] = useState(false);
54-
const [directUpstreamEntities, setDirectUpstreamEntities] = useState<Dataset[]>([]);
55-
const [indirectUpstreamEntities, setIndirectUpstreamEntities] = useState<Dataset[]>([]);
58+
const [directUpstreamEntities, setDirectUpstreamEntities] = useState<GenericEntityProperties[]>([]);
59+
const [indirectUpstreamEntities, setIndirectUpstreamEntities] = useState<GenericEntityProperties[]>([]);
5660

5761
const [directUpstreamsDataStart, setDirectUpstreamsDataStart] = useState(0);
5862
const [indirectUpstreamsDataStart, setIndirectUpstreamsDataStart] = useState(0);
@@ -71,10 +75,13 @@ export default function UpstreamHealth() {
7175
skip: !lineageEnabled,
7276
variables: {
7377
input: {
78+
searchFlags: {
79+
skipCache: true,
80+
},
7481
urn,
7582
query: '*',
7683
startTimeMillis,
77-
types: [EntityType.Dataset],
84+
types: [],
7885
count: DATASET_COUNT,
7986
start,
8087
direction: LineageDirection.Upstream,
@@ -107,6 +114,20 @@ export default function UpstreamHealth() {
107114
},
108115
],
109116
},
117+
{
118+
and: [
119+
{
120+
field: 'degree',
121+
condition: FilterOperator.Equal,
122+
values: degree,
123+
},
124+
{
125+
field: IS_DEPRECATED_FILTER_NAME,
126+
condition: FilterOperator.Equal,
127+
values: ['true'],
128+
},
129+
],
130+
},
110131
],
111132
},
112133
includeAssertions: false,
@@ -126,27 +147,33 @@ export default function UpstreamHealth() {
126147
useEffect(() => {
127148
if (directUpstreamData?.searchAcrossLineage?.searchResults?.length && !directUpstreamEntities.length) {
128149
setDirectUpstreamEntities(
129-
directUpstreamData.searchAcrossLineage.searchResults.map((result) => result.entity as Dataset),
150+
directUpstreamData.searchAcrossLineage.searchResults
151+
.map((result) => entityRegistry.getGenericEntityProperties(result.entity.type, result.entity))
152+
.filter((e) => e !== null) as GenericEntityProperties[],
130153
);
131154
setDirectUpstreamsDataTotal(directUpstreamData.searchAcrossLineage.total);
132155
}
133156
}, [
134157
directUpstreamData?.searchAcrossLineage?.searchResults,
135158
directUpstreamEntities.length,
136159
directUpstreamData?.searchAcrossLineage?.total,
160+
entityRegistry,
137161
]);
138162

139163
useEffect(() => {
140164
if (indirectUpstreamData?.searchAcrossLineage?.searchResults?.length && !indirectUpstreamEntities.length) {
141165
setIndirectUpstreamEntities(
142-
indirectUpstreamData.searchAcrossLineage.searchResults.map((result) => result.entity as Dataset),
166+
indirectUpstreamData.searchAcrossLineage.searchResults
167+
.map((result) => entityRegistry.getGenericEntityProperties(result.entity.type, result.entity))
168+
.filter((e) => e !== null) as GenericEntityProperties[],
143169
);
144170
setIndirectUpstreamsDataTotal(indirectUpstreamData.searchAcrossLineage.total);
145171
}
146172
}, [
147173
indirectUpstreamData?.searchAcrossLineage?.searchResults,
148174
indirectUpstreamEntities.length,
149175
indirectUpstreamData?.searchAcrossLineage?.total,
176+
entityRegistry,
150177
]);
151178

152179
function loadMoreDirectUpstreamData() {
@@ -160,7 +187,9 @@ export default function UpstreamHealth() {
160187
if (result.data.searchAcrossLineage?.searchResults) {
161188
setDirectUpstreamEntities([
162189
...directUpstreamEntities,
163-
...result.data.searchAcrossLineage.searchResults.map((r) => r.entity as Dataset),
190+
...(result.data.searchAcrossLineage.searchResults
191+
.map((r) => entityRegistry.getGenericEntityProperties(r.entity.type, r.entity))
192+
.filter((e) => e !== null) as GenericEntityProperties[]),
164193
]);
165194
}
166195
});
@@ -178,15 +207,21 @@ export default function UpstreamHealth() {
178207
if (result.data.searchAcrossLineage?.searchResults) {
179208
setIndirectUpstreamEntities([
180209
...indirectUpstreamEntities,
181-
...result.data.searchAcrossLineage.searchResults.map((r) => r.entity as Dataset),
210+
...(result.data.searchAcrossLineage.searchResults
211+
.map((r) => entityRegistry.getGenericEntityProperties(r.entity.type, r.entity))
212+
.filter((e) => e !== null) as GenericEntityProperties[]),
182213
]);
183214
}
184215
});
185216
setIndirectUpstreamsDataStart(newStart);
186217
}
187218

188-
const unhealthyDirectUpstreams = directUpstreamEntities.filter((e) => e.health && isUnhealthy(e.health));
189-
const unhealthyIndirectUpstreams = indirectUpstreamEntities.filter((e) => e.health && isUnhealthy(e.health));
219+
const unhealthyDirectUpstreams = directUpstreamEntities.filter(
220+
(e) => (e.health && isUnhealthy(e.health)) || isDeprecated(e),
221+
);
222+
const unhealthyIndirectUpstreams = indirectUpstreamEntities.filter(
223+
(e) => (e.health && isUnhealthy(e.health)) || isDeprecated(e),
224+
);
190225

191226
const hasUnhealthyUpstreams = unhealthyDirectUpstreams.length || unhealthyIndirectUpstreams.length;
192227

@@ -216,6 +251,8 @@ export default function UpstreamHealth() {
216251
indirectUpstreamsDataTotal - (indirectUpstreamsDataStart + DATASET_COUNT),
217252
0,
218253
)}
254+
showDeprecatedIcon
255+
showHealthIcon
219256
/>
220257
)}
221258
</CTAWrapper>

datahub-web-react/src/app/entityV2/shared/tabs/Incident/AcrylComponents/IncidentDetailDrawer.tsx

+5-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { Incident } from '@src/types.generated';
66
import { IncidentDrawerHeader } from './IncidentDrawerHeader';
77
import { IncidentView } from './IncidentView';
88
import { IncidentEditor } from './IncidentEditor';
9-
import { IncidentTableRow } from '../types';
9+
import { EntityStagedForIncident, IncidentTableRow } from '../types';
1010
import { IncidentAction } from '../constant';
1111

1212
const modalBodyStyle = { padding: 0, fontFamily: 'Mulish, sans-serif' };
@@ -17,9 +17,10 @@ type IncidentDetailDrawerProps = {
1717
incident?: IncidentTableRow;
1818
onCancel?: () => void;
1919
onSubmit?: (incident?: Incident) => void;
20+
entity?: EntityStagedForIncident;
2021
};
2122

22-
export const IncidentDetailDrawer = ({ mode, onCancel, onSubmit, incident }: IncidentDetailDrawerProps) => {
23+
export const IncidentDetailDrawer = ({ mode, onCancel, onSubmit, incident, entity }: IncidentDetailDrawerProps) => {
2324
const [isEditView, setIsEditView] = useState<boolean>(false);
2425
const showEditor = isEditView || mode === IncidentAction.CREATE;
2526
const modalClosePopup = () => {
@@ -55,6 +56,7 @@ export const IncidentDetailDrawer = ({ mode, onCancel, onSubmit, incident }: Inc
5556
isEditActive={isEditView}
5657
setIsEditActive={setIsEditView}
5758
data={incident}
59+
platform={entity?.platform}
5860
/>
5961
{showEditor ? (
6062
<IncidentEditor
@@ -63,6 +65,7 @@ export const IncidentDetailDrawer = ({ mode, onCancel, onSubmit, incident }: Inc
6365
mode={mode}
6466
incidentUrn={incident?.urn}
6567
onSubmit={onSubmit}
68+
entity={entity}
6669
/>
6770
) : (
6871
<IncidentView incident={incident as IncidentTableRow} />

datahub-web-react/src/app/entityV2/shared/tabs/Incident/AcrylComponents/IncidentDrawerHeader.tsx

+22-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
11
import React from 'react';
2-
import { Link as LinkIcon, PencilSimpleLine, X } from '@phosphor-icons/react';
32
import styled from 'styled-components';
3+
import { Link as LinkIcon, PencilSimpleLine, X } from '@phosphor-icons/react';
44
import { Tooltip2 } from '@src/alchemy-components/components/Tooltip2';
5+
import PlatformIcon from '@src/app/sharedV2/icons/PlatformIcon';
6+
import { capitalizeFirstLetter } from '@src/app/shared/textUtil';
7+
import { DataPlatform } from '@src/types.generated';
58
import { useIncidentURNCopyLink } from '../hooks';
69
import { IncidentAction } from '../constant';
710
import { IncidentTableRow } from '../types';
8-
import { StyledHeader, StyledHeaderActions, StyledTitle } from './styledComponents';
11+
import {
12+
ForPlatformWrapper,
13+
StyledHeader,
14+
StyledHeaderActions,
15+
StyledHeaderTitleContainer,
16+
StyledTitle,
17+
} from './styledComponents';
918

1019
const EditButton = styled(PencilSimpleLine)`
1120
:hover {
@@ -31,6 +40,7 @@ type IncidentDrawerHeaderProps = {
3140
isEditActive: boolean;
3241
setIsEditActive: React.Dispatch<React.SetStateAction<boolean>>;
3342
data?: IncidentTableRow;
43+
platform?: DataPlatform;
3444
};
3545

3646
export const IncidentDrawerHeader = ({
@@ -39,11 +49,20 @@ export const IncidentDrawerHeader = ({
3949
isEditActive,
4050
setIsEditActive,
4151
data,
52+
platform,
4253
}: IncidentDrawerHeaderProps) => {
4354
const handleIncidentLinkCopy = useIncidentURNCopyLink(data ? data?.urn : '');
4455
return (
4556
<StyledHeader>
46-
<StyledTitle>{mode === IncidentAction.CREATE ? 'Create New Incident' : data?.title}</StyledTitle>
57+
<StyledHeaderTitleContainer>
58+
<StyledTitle>{mode === IncidentAction.CREATE ? 'Create New Incident' : data?.title}</StyledTitle>
59+
{platform && (
60+
<ForPlatformWrapper>
61+
<PlatformIcon platform={platform} size={16} styles={{ marginRight: 4 }} />
62+
{capitalizeFirstLetter(platform.name)}
63+
</ForPlatformWrapper>
64+
)}
65+
</StyledHeaderTitleContainer>
4766
<StyledHeaderActions>
4867
{mode === IncidentAction.EDIT && isEditActive === false && (
4968
<>

datahub-web-react/src/app/entityV2/shared/tabs/Incident/AcrylComponents/IncidentEditor.tsx

+2
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export const IncidentEditor = ({
3636
data,
3737
onClose,
3838
mode = IncidentAction.CREATE,
39+
entity,
3940
}: IncidentEditorProps) => {
4041
const assigneeValues = data?.assignees && getAssigneeWithURN(data.assignees);
4142
const isFormValid = Boolean(
@@ -63,6 +64,7 @@ export const IncidentEditor = ({
6364
user,
6465
assignees: cachedAssignees,
6566
linkedAssets: cachedLinkedAssets,
67+
entity,
6668
});
6769
const formValues = Form.useWatch([], form);
6870

datahub-web-react/src/app/entityV2/shared/tabs/Incident/AcrylComponents/hooks/useIncidentHandler.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ export const getCacheIncident = ({
7070
return newIncident;
7171
};
7272

73-
export const useIncidentHandler = ({ mode, onSubmit, incidentUrn, onClose, user, assignees, linkedAssets }) => {
73+
export const useIncidentHandler = ({ mode, onSubmit, incidentUrn, onClose, user, assignees, linkedAssets, entity }) => {
7474
const [raiseIncidentMutation] = useRaiseIncidentMutation();
7575
const [updateIncidentMutation] = useUpdateIncidentMutation();
7676
const [form] = Form.useForm();
@@ -138,7 +138,7 @@ export const useIncidentHandler = ({ mode, onSubmit, incidentUrn, onClose, user,
138138
const values = form.getFieldsValue();
139139
const baseInput = {
140140
...values,
141-
resourceUrn: urn,
141+
resourceUrn: entity?.urn || urn,
142142
status: {
143143
stage: values.status,
144144
state: values.state || IncidentState.Active,

datahub-web-react/src/app/entityV2/shared/tabs/Incident/AcrylComponents/styledComponents.tsx

+15
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,11 @@ export const StyledHeader = styled.div`
292292
box-shadow: 0px 0px 6px 0px #5d668b33;
293293
`;
294294

295+
export const StyledHeaderTitleContainer = styled.div`
296+
display: flex;
297+
align-items: center;
298+
`;
299+
295300
export const StyledHeaderActions = styled.div`
296301
display: flex;
297302
gap: 20px;
@@ -325,3 +330,13 @@ export const StyledSpinner = styled.div`
325330
animation: ${spin} 0.8s linear infinite;
326331
display: inline-block;
327332
`;
333+
334+
export const ForPlatformWrapper = styled.div`
335+
display: flex;
336+
flex-direction: row;
337+
align-items: center;
338+
font-size: 0.75rem;
339+
margin-left: 12px;
340+
padding-left: 12px;
341+
border-left: 0.5px solid #ddd;
342+
`;

0 commit comments

Comments
 (0)