Skip to content

Commit bfe765e

Browse files
authored
Merge branch 'datahub-project:master' into master
2 parents 12a0cff + 2f07dc3 commit bfe765e

File tree

29 files changed

+259
-181
lines changed

29 files changed

+259
-181
lines changed

README.md

+6-5
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,12 @@ If you're looking to build & modify datahub please take a look at our [Developme
102102

103103
- [datahub-project/datahub](https://github.com/datahub-project/datahub): This repository contains the complete source code for DataHub's metadata model, metadata services, integration connectors and the web application.
104104
- [acryldata/datahub-actions](https://github.com/acryldata/datahub-actions): DataHub Actions is a framework for responding to changes to your DataHub Metadata Graph in real time.
105-
- [acryldata/datahub-helm](https://github.com/acryldata/datahub-helm): Repository of helm charts for deploying DataHub on a Kubernetes cluster
106-
- [acryldata/meta-world](https://github.com/acryldata/meta-world): A repository to store recipes, custom sources, transformations and other things to make your DataHub experience magical
107-
- [dbt-impact-action](https://github.com/acryldata/dbt-impact-action) : This repository contains a github action for commenting on your PRs with a summary of the impact of changes within a dbt project
108-
- [datahub-tools](https://github.com/makenotion/datahub-tools) : Additional python tools to interact with the DataHub GraphQL endpoints, built by Notion
109-
- [business-glossary-sync-action](https://github.com/acryldata/business-glossary-sync-action) : This repository contains a github action that opens PRs to update your business glossary yaml file.
105+
- [acryldata/datahub-helm](https://github.com/acryldata/datahub-helm): Helm charts for deploying DataHub on a Kubernetes cluster
106+
- [acryldata/meta-world](https://github.com/acryldata/meta-world): A repository to store recipes, custom sources, transformations and other things to make your DataHub experience magical.
107+
- [dbt-impact-action](https://github.com/acryldata/dbt-impact-action): A github action for commenting on your PRs with a summary of the impact of changes within a dbt project.
108+
- [datahub-tools](https://github.com/makenotion/datahub-tools): Additional python tools to interact with the DataHub GraphQL endpoints, built by Notion.
109+
- [business-glossary-sync-action](https://github.com/acryldata/business-glossary-sync-action): A github action that opens PRs to update your business glossary yaml file.
110+
- [mcp-server-datahub](https://github.com/acryldata/mcp-server-datahub): A [Model Context Protocol](https://modelcontextprotocol.io/) server implementation for DataHub.
110111

111112
## Releases
112113

datahub-web-react/src/alchemy-components/components/Table/Table.tsx

+9-1
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ export const Table = <T,>({
5151
}: TableProps<T>) => {
5252
const [sortColumn, setSortColumn] = useState<string | null>(null);
5353
const [sortOrder, setSortOrder] = useState<SortingState>(SortingState.ORIGINAL);
54+
const [focusedRowIndex, setFocusedRowIndex] = useState<number | null>(null);
5455

5556
const sortedData = getSortedData(columns, data, sortColumn, sortOrder);
5657
const isRowClickable = !!onRowClick;
@@ -65,6 +66,10 @@ export const Table = <T,>({
6566
// eslint-disable-next-line react-hooks/exhaustive-deps
6667
}, [sortOrder, sortColumn]);
6768

69+
useEffect(() => {
70+
setFocusedRowIndex(null);
71+
}, [data]);
72+
6873
if (isLoading) {
6974
return (
7075
<LoadingContainer>
@@ -183,6 +188,7 @@ export const Table = <T,>({
183188
key={key}
184189
canExpand={canExpand}
185190
onClick={() => {
191+
setFocusedRowIndex(index);
186192
if (canExpand) onExpand?.(row); // Handle row expansion
187193
onRowClick?.(row); // Handle row click
188194
}}
@@ -193,8 +199,10 @@ export const Table = <T,>({
193199
currentRefs[index] = el;
194200
}
195201
}}
202+
isFocused={focusedRowIndex === index}
196203
isRowClickable={isRowClickable}
197204
data-testId={rowDataTestId?.(row)}
205+
canHover
198206
>
199207
{/* Render each cell in the row */}
200208

@@ -241,7 +249,7 @@ export const Table = <T,>({
241249
</TableRow>
242250
{/* Render expanded content if row is expanded */}
243251
{isExpanded && expandable?.expandedRowRender && (
244-
<TableRow isRowClickable={isRowClickable}>
252+
<TableRow isRowClickable={isRowClickable} canHover={false}>
245253
<TableCell
246254
colSpan={columns.length + (expandable?.expandIconPosition ? 1 : 0)}
247255
style={{ padding: 0 }}

datahub-web-react/src/alchemy-components/components/Table/components.ts

+24-15
Original file line numberDiff line numberDiff line change
@@ -53,23 +53,32 @@ export const HeaderContainer = styled.div<{ alignment?: AlignmentOptions }>(({ a
5353
justifyContent: alignment,
5454
}));
5555

56-
export const TableRow = styled.tr<{ canExpand?: boolean; isRowClickable?: boolean }>(
57-
({ canExpand, isRowClickable }) => ({
58-
background: canExpand ? colors.gray[100] : 'transparent',
59-
cursor: isRowClickable ? 'pointer' : 'normal',
60-
'&:last-child': {
61-
'& td': {
62-
borderBottom: 'none',
63-
},
56+
export const TableRow = styled.tr<{
57+
canExpand?: boolean;
58+
isRowClickable?: boolean;
59+
isFocused?: boolean;
60+
canHover?: boolean;
61+
}>(({ canExpand, isRowClickable, isFocused, canHover }) => ({
62+
background: canExpand ? colors.gray[100] : 'transparent',
63+
...(isFocused
64+
? {
65+
background: `linear-gradient(180deg, rgba(83,63,209,0.04) -3.99%, rgba(112,94,228,0.04) 53.04%, rgba(112,94,228,0.04) 100%)`,
66+
}
67+
: {}),
68+
'&:hover': canHover ? { backgroundColor: colors.gray[1500] } : {},
69+
cursor: isRowClickable ? 'pointer' : 'normal',
70+
'&:last-child': {
71+
'& td': {
72+
borderBottom: 'none',
6473
},
74+
},
6575

66-
'& td:first-child': {
67-
fontWeight: typography.fontWeights.bold,
68-
color: colors.gray[600],
69-
fontSize: '12px',
70-
},
71-
}),
72-
);
76+
'& td:first-child': {
77+
fontWeight: typography.fontWeights.bold,
78+
color: colors.gray[600],
79+
fontSize: '12px',
80+
},
81+
}));
7382

7483
export const TableCell = styled.td<{
7584
width?: string;

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ type TimelineContentProps = {
1212
};
1313

1414
export default function IncidentActivityContent({ incidentActivities }: TimelineContentProps) {
15-
const { action, actor, time } = incidentActivities;
15+
const { action, actor, time, message } = incidentActivities;
1616
const getUserName = useGetUserName();
1717
const entityRegistry = useEntityRegistryV2();
1818

@@ -39,6 +39,7 @@ export default function IncidentActivityContent({ incidentActivities }: Timeline
3939
</ActivityStatusText>
4040
</Text>
4141
<Text style={{ color: colors.gray[1700] }}>{getTimeFromNow(time)}</Text>
42+
{message ? <Text style={{ color: colors.gray[1700] }}>{message}</Text> : null}
4243
</ContentRow>
4344
</Content>
4445
);

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

+1
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ export const IncidentEditor = ({
6868
assignees: cachedAssignees,
6969
linkedAssets: cachedLinkedAssets,
7070
entity,
71+
currentIncident: data,
7172
});
7273
const formValues = Form.useWatch([], form);
7374

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

+25-42
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
EntityType,
1414
IncidentSourceType,
1515
IncidentState,
16+
IncidentType,
1617
} from '@src/types.generated';
1718
import { Check, Warning } from '@phosphor-icons/react';
1819
import { IconLabel } from '@src/alchemy-components/components/IconLabel';
@@ -130,49 +131,27 @@ export const IncidentView = ({ incident }: { incident: IncidentTableRow }) => {
130131
};
131132

132133
const renderActivities = (() => {
133-
// TODO Amit: Move this into a separate utilities file.
134-
const { creator, lastUpdated } = incidentActivityActors;
135-
const isCreatedAndUpdatedBySameUser = creator === lastUpdated;
136-
137-
if (isCreatedAndUpdatedBySameUser) {
138-
if (incident?.state === IncidentState.Resolved) {
139-
return [
140-
{
141-
actor: incidentCreator,
142-
action: INCIDENT_STATE_TO_ACTIVITY.RAISED,
143-
time: incident?.creator?.time,
144-
},
145-
{
146-
actor: incidentResolver,
147-
action: INCIDENT_STATE_TO_ACTIVITY.RESOLVED,
148-
time: incident?.lastUpdated?.time,
149-
},
150-
];
151-
}
152-
153-
if (incident?.state === IncidentState.Active) {
154-
return [
155-
{
156-
actor: incidentCreator,
157-
action: INCIDENT_STATE_TO_ACTIVITY.RAISED,
158-
time: incident?.creator?.time,
159-
},
160-
];
161-
}
134+
const baseActivity = {
135+
actor: incidentCreator,
136+
action: INCIDENT_STATE_TO_ACTIVITY.RAISED,
137+
time: incident?.creator?.time,
138+
};
139+
140+
// Only add the resolved activity if the incident state is Resolved
141+
if (incident?.state === IncidentState.Resolved) {
142+
return [
143+
baseActivity,
144+
{
145+
actor: incidentResolver,
146+
action: INCIDENT_STATE_TO_ACTIVITY.RESOLVED,
147+
time: incident?.lastUpdated?.time,
148+
message: incident?.message,
149+
},
150+
];
162151
}
163152

164-
return [
165-
{
166-
actor: incidentCreator,
167-
action: INCIDENT_STATE_TO_ACTIVITY.RAISED,
168-
time: incident?.creator?.time,
169-
},
170-
{
171-
actor: incidentResolver,
172-
action: INCIDENT_STATE_TO_ACTIVITY.RESOLVED,
173-
time: incident?.lastUpdated?.time,
174-
},
175-
];
153+
// Otherwise just return the base activity
154+
return [baseActivity];
176155
})();
177156

178157
/** Assertion Related Logic. */
@@ -185,6 +164,10 @@ export const IncidentView = ({ incident }: { incident: IncidentTableRow }) => {
185164
assertionDescription = getPlainTextDescriptionFromAssertion(assertion.info as AssertionInfo);
186165
}
187166

167+
const categoryName = getCapitalizeWord(
168+
incident?.type === IncidentType.Custom ? incident.customType : incident.type,
169+
);
170+
188171
return (
189172
<Container>
190173
<DescriptionSection>
@@ -200,7 +183,7 @@ export const IncidentView = ({ incident }: { incident: IncidentTableRow }) => {
200183
</DescriptionSection>
201184
<DetailsSection>
202185
<DetailsLabel>Category</DetailsLabel>
203-
<CategoryText>{incident?.type && getCapitalizeWord(incident?.type)}</CategoryText>
186+
<CategoryText>{categoryName}</CategoryText>
204187
</DetailsSection>
205188
<DetailsSection>
206189
<DetailsLabel>Priority</DetailsLabel>

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

+12-2
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,24 @@ export const getCacheIncident = ({
6262

6363
priority: values.priority,
6464
created: {
65-
time: Date.now(),
65+
time: values.created || new Date(),
6666
actor: user?.urn,
6767
},
6868
assignees: values.assignees,
6969
};
7070
return newIncident;
7171
};
7272

73-
export const useIncidentHandler = ({ mode, onSubmit, incidentUrn, user, assignees, linkedAssets, entity }) => {
73+
export const useIncidentHandler = ({
74+
mode,
75+
onSubmit,
76+
incidentUrn,
77+
user,
78+
assignees,
79+
linkedAssets,
80+
entity,
81+
currentIncident,
82+
}) => {
7483
const [raiseIncidentMutation] = useRaiseIncidentMutation();
7584
const [updateIncidentMutation] = useUpdateIncidentMutation();
7685
const [form] = Form.useForm();
@@ -184,6 +193,7 @@ export const useIncidentHandler = ({ mode, onSubmit, incidentUrn, user, assignee
184193
priority: values.priority || null,
185194
assignees,
186195
linkedAssets,
196+
created: currentIncident.created,
187197
},
188198
user,
189199
incidentUrn,

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

-1
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,6 @@ export const ActivityStatusText = styled.div`
150150
export const Header = styled.div`
151151
display: flex;
152152
align-items: center;
153-
cursor: pointer;
154153
margin-bottom: 1rem;
155154
`;
156155

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export const IncidentFilterContainer: React.FC<IncidentAssigneeAvatarStack> = ({
4646
acc[selectedfilter.category].push(selectedfilter.name);
4747
return acc;
4848
},
49-
{ type: [], stage: [], priority: [], state: [] },
49+
{ category: [], stage: [], priority: [], state: [] },
5050
);
5151

5252
handleFilterChange({
@@ -57,14 +57,14 @@ export const IncidentFilterContainer: React.FC<IncidentAssigneeAvatarStack> = ({
5757

5858
const initialSelectedOptions = useMemo(() => {
5959
const recommendedFilters = originalFilterOptions?.recommendedFilters || [];
60-
const { stage, type, priority, state } =
60+
const { stage, category, priority, state } =
6161
selectedFilters.filterCriteria || INCIDENT_DEFAULT_FILTERS.filterCriteria;
6262

6363
const appliedRecommendedFilters = recommendedFilters.filter(
6464
(item) =>
6565
(state.includes(item.name) && item.category === 'state') ||
6666
(stage.includes(item.name) && item.category === 'stage') ||
67-
(type.includes(item.name) && item.category === 'type') ||
67+
(category.includes(item.name) && item.category === 'category') ||
6868
(priority.includes(item.name) && item.category === 'priority'),
6969
);
7070
return appliedRecommendedFilters?.map((filter) => ({

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export const IncidentList = () => {
2424
const [entity, setEntity] = useState<EntityStagedForIncident>();
2525
const [visibleIncidents, setVisibleIncidents] = useState<IncidentTable>({
2626
incidents: [],
27-
groupBy: { type: [], priority: [], stage: [], state: [] },
27+
groupBy: { category: [], priority: [], stage: [], state: [] },
2828
});
2929
const [allIncidentData, setAllIncidentData] = useState<Incident[]>([]);
3030

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ export const IncidentListTable = ({ incidentData, filter, refetch, privileges }:
3333
// get columns data from the custom hooks
3434
const incidentsTableCols = useIncidentsTableColumns(refetch, privileges);
3535
const [sortedOptions, setSortedOptions] = useState<{ sortColumn: string; sortOrder: SortingState }>({
36-
sortColumn: '',
37-
sortOrder: SortingState.ORIGINAL,
36+
sortColumn: 'created',
37+
sortOrder: SortingState.ASCENDING,
3838
});
3939

4040
const [focusIncidentUrn, setFocusIncidentUrn] = useState<string | null>(null);

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

+3-1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ export const IncidentResolutionPopup = ({ incident, refetch, handleClose }: Inci
3939
const { urn, entityType } = useEntityData();
4040
const [updateIncidentStatusMutation] = useUpdateIncidentStatusMutation();
4141
const [form] = Form.useForm();
42+
const formValues = Form.useWatch([], form);
4243

4344
const handleValuesChange = (changedValues: any) => {
4445
Object.keys(changedValues).forEach((fieldName) => form.setFields([{ name: fieldName, errors: [] }]));
@@ -73,6 +74,7 @@ export const IncidentResolutionPopup = ({ incident, refetch, handleClose }: Inci
7374
message: formData?.note,
7475
linkedAssets: incident.linkedAssets,
7576
assignees: incident.assignees,
77+
created: incident.created,
7678
};
7779

7880
const updatedIncident = getCacheIncident({
@@ -131,7 +133,7 @@ export const IncidentResolutionPopup = ({ incident, refetch, handleClose }: Inci
131133
showClear={false}
132134
width="100%"
133135
customStyle={{ flexDirection: 'column', alignItems: 'normal' }}
134-
value={form.getFieldValue(INCIDENT_OPTION_LABEL_MAPPING.stage.fieldName)}
136+
value={formValues?.[INCIDENT_OPTION_LABEL_MAPPING.stage.fieldName]}
135137
/>
136138
<FormItem
137139
name="note"

datahub-web-react/src/app/entityV2/shared/tabs/Incident/__tests__/utils.test.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ describe('Utility Functions', () => {
4242
priority: ['Low'],
4343
stage: [],
4444
state: [],
45-
type: [],
45+
category: [],
4646
},
4747
};
4848

datahub-web-react/src/app/entityV2/shared/tabs/Incident/constant.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ export const INCIDENT_DEFAULT_FILTERS = {
77
searchText: '',
88
priority: [],
99
stage: [],
10-
type: [],
10+
category: [],
1111
state: [IncidentState.Active],
1212
},
1313
};
1414

1515
export const INCIDENT_GROUP_BY_FILTER_OPTIONS = [
1616
{ label: 'Priority', value: 'priority' },
1717
{ label: 'Stage', value: 'stage' },
18-
{ label: 'Category', value: 'type' },
18+
{ label: 'Category', value: 'category' },
1919
{ label: 'State', value: 'state' },
2020
];
2121

0 commit comments

Comments
 (0)