Skip to content

Commit

Permalink
Fixing CI issues
Browse files Browse the repository at this point in the history
  • Loading branch information
John Joyce committed Jan 25, 2024
1 parent c8e2733 commit edb7de0
Show file tree
Hide file tree
Showing 9 changed files with 103 additions and 27 deletions.
2 changes: 1 addition & 1 deletion datahub-web-react/src/app/entity/dataset/DatasetEntity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import { getDataProduct } from '../shared/utils';
import AccessManagement from '../shared/tabs/Dataset/AccessManagement/AccessManagement';
import { matchedFieldPathsRenderer } from '../../search/matches/matchedFieldPathsRenderer';
import { getLastUpdatedMs } from './shared/utils';
import { IncidentTab } from '../../entity/shared/tabs/Incident/IncidentTab';
import { IncidentTab } from '../shared/tabs/Incident/IncidentTab';

const SUBTYPES = {
VIEW: 'view',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ export const IncidentTab = () => {
emptyText: (
<Empty
description={`No${
!!selectedIncidentState ? ` ${selectedIncidentState.toLocaleLowerCase()} ` : ''
selectedIncidentState ? ` ${selectedIncidentState.toLocaleLowerCase()} ` : ''
} incidents`}
image={Empty.PRESENTED_IMAGE_SIMPLE}
/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import React, { useState } from 'react';
import { message, Modal, Button, Form, Input, Typography, Select } from 'antd';
import { useApolloClient } from '@apollo/client';
import TextArea from 'antd/lib/input/TextArea';
import analytics, { EventType, EntityActionType } from '../../../../../analytics';
import { useEntityData, useRefetch } from '../../../EntityContext';
import { useEntityData } from '../../../EntityContext';
import { EntityType, IncidentSourceType, IncidentState, IncidentType } from '../../../../../../types.generated';
import { INCIDENT_DISPLAY_TYPES, PAGE_SIZE, addActiveIncidentToCache } from '../incidentUtils';
import { useRaiseIncidentMutation } from '../../../../../../graphql/mutations.generated';
Expand All @@ -29,6 +30,7 @@ export const AddIncidentModal = ({ visible, onClose, refetch }: AddIncidentProps
const handleClose = () => {
form.resetFields();
setIsOtherTypeSelected(false);
setSelectedIncidentType(IncidentType.Operational);
onClose?.();
};

Expand Down Expand Up @@ -147,7 +149,7 @@ export const AddIncidentModal = ({ visible, onClose, refetch }: AddIncidentProps
},
]}
>
<Input />
<Input placeholder="Freshness" />
</Form.Item>
)}
<Form.Item
Expand All @@ -160,7 +162,7 @@ export const AddIncidentModal = ({ visible, onClose, refetch }: AddIncidentProps
},
]}
>
<Input placeholder="A title for this incident" />
<Input placeholder="What went wrong?" />
</Form.Item>
<Form.Item
name="description"
Expand All @@ -172,7 +174,7 @@ export const AddIncidentModal = ({ visible, onClose, refetch }: AddIncidentProps
},
]}
>
<Input placeholder="A short description for this incident" />
<TextArea placeholder="Provide some additional details" />
</Form.Item>
</Form>
</Modal>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import styled from 'styled-components';
import { Button, Dropdown, List, Menu, message, Popover, Tag, Tooltip, Typography } from 'antd';
import { CheckCircleFilled, CheckOutlined, MoreOutlined, WarningFilled } from '@ant-design/icons';
import { Link } from 'react-router-dom';
import { useApolloClient } from '@apollo/client';
import { EntityType, IncidentState, IncidentType } from '../../../../../../types.generated';
import { FAILURE_COLOR_HEX, getNameFromType, SUCCESS_COLOR_HEX } from '../incidentUtils';
import { useGetUserQuery } from '../../../../../../graphql/user.generated';
Expand Down Expand Up @@ -145,8 +144,6 @@ export default function IncidentListItem({ incident, refetch }: Props) {
const [updateIncidentStatusMutation] = useUpdateIncidentStatusMutation();
const [isResolvedModalVisible, setIsResolvedModalVisible] = useState(false);

const client = useApolloClient();

// Fetching the most recent actor's data.
const { data: createdActor } = useGetUserQuery({
variables: { urn: incident.created.actor, groupsCount: 0 },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { CheckCircleFilled, WarningFilled, StopOutlined } from '@ant-design/icon
import { Typography } from 'antd';
import styled from 'styled-components';
import { ANTD_GRAY } from '../../../constants';
import { SUCCESS_COLOR_HEX, FAILURE_COLOR_HEX, PAGE_SIZE } from '../incidentUtils';
import { SUCCESS_COLOR_HEX, FAILURE_COLOR_HEX } from '../incidentUtils';

const SummaryHeader = styled.div`
width: 100%;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { GetEntityIncidentsDocument } from '../../../../../graphql/incident.generated';

import { IncidentType, IncidentState, Incident, EntityType } from '../../../../../types.generated';
import { IncidentType, IncidentState, Incident } from '../../../../../types.generated';

export const PAGE_SIZE = 100;

Expand Down Expand Up @@ -57,14 +57,6 @@ export const addOrUpdateIncidentInList = (existingIncidents, newIncidents) => {
return didUpdate ? updatedIncidents : [newIncidents, ...existingIncidents];
};

/**
* Add raised incident to cache
*/
export const addActiveIncidentToCache = (client, urn, incident, pageSize) => {
// Add to active and overall list
updateListIncidentsCache(client, urn, incident, pageSize);
};

/**
* Add an entry to the ListIncident cache.
*/
Expand Down Expand Up @@ -136,3 +128,11 @@ export const getIncidentsStatusSummary = (incidents: Array<Incident>) => {
});
return summary;
};

/**
* Add raised incident to cache
*/
export const addActiveIncidentToCache = (client, urn, incident, pageSize) => {
// Add to active and overall list
updateListIncidentsCache(client, urn, incident, pageSize);
};
2 changes: 1 addition & 1 deletion datahub-web-react/src/app/lineage/LineageEntityNode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ export default function LineageEntityNode({
health={health as any}
baseUrl={baseUrl as any}
fontSize={20}
tooltipPlacement="left"
tooltipPlacement="top"
/>
)}
</foreignObject>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
package com.linkedin.metadata.service;

import com.linkedin.data.template.GetMode;
import com.linkedin.incident.IncidentInfo;
import com.linkedin.metadata.utils.GenericRecordUtils;
import com.linkedin.mxe.GenericAspect;
import com.linkedin.mxe.MetadataChangeProposal;
import org.mockito.ArgumentMatcher;

public class IncidentInfoArgumentMatcher implements ArgumentMatcher<MetadataChangeProposal> {

private MetadataChangeProposal left;

public IncidentInfoArgumentMatcher(MetadataChangeProposal left) {
this.left = left;
}

@Override
public boolean matches(MetadataChangeProposal right) {
return left.getEntityType().equals(right.getEntityType())
&& left.getAspectName().equals(right.getAspectName())
&& left.getChangeType().equals(right.getChangeType())
&& incidentInfoMatches(left.getAspect(), right.getAspect());
}

private boolean incidentInfoMatches(GenericAspect left, GenericAspect right) {
IncidentInfo leftProps =
GenericRecordUtils.deserializeAspect(
left.getValue(), "application/json", IncidentInfo.class);

IncidentInfo rightProps =
GenericRecordUtils.deserializeAspect(
right.getValue(), "application/json", IncidentInfo.class);

// Verify optional fields.
if (leftProps.hasTitle()) {
if (!leftProps.getTitle().equals(rightProps.getTitle())) {
return false;
}
}

if (leftProps.hasDescription()) {
if (!leftProps.getDescription().equals(rightProps.getDescription())) {
return false;
}
}

if (leftProps.hasPriority()) {
if (!leftProps.getPriority().equals(rightProps.getPriority())) {
return false;
}
}

if (leftProps.hasCustomType()) {
if (!leftProps.getCustomType().equals(rightProps.getCustomType())) {
return false;
}
}

if (leftProps.hasSource()) {
if (!leftProps.getSource().equals(rightProps.getSource())) {
return false;
}
}

// Verify required fields.
return leftProps.getType().equals(rightProps.getType())
&& leftProps.getEntities(GetMode.NULL).equals(rightProps.getEntities(GetMode.NULL))
&& leftProps.getStatus().getState().equals(rightProps.getStatus().getState())
&& leftProps
.getStatus()
.getLastUpdated()
.getActor()
.equals(rightProps.getStatus().getLastUpdated().getActor())
&& leftProps.getCreated().getActor().equals(rightProps.getCreated().getActor());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ private void testRaiseIncidentRequiredFields() throws Exception {
final IncidentService service =
new IncidentService(mockClient, Mockito.mock(Authentication.class));
service.raiseIncident(
IncidentType.FRESHNESS,
IncidentType.OPERATIONAL,
null,
null,
null,
Expand All @@ -128,7 +128,7 @@ private void testRaiseIncidentRequiredFields() throws Exception {

final IncidentInfo expectedInfo =
new IncidentInfo()
.setType(IncidentType.FRESHNESS)
.setType(IncidentType.OPERATIONAL)
.setEntities(new UrnArray(ImmutableList.of(TEST_DATASET_URN)))
.setStatus(
new IncidentStatus()
Expand All @@ -152,19 +152,19 @@ private void testRaiseIncidentAllFields() throws Exception {
final IncidentService service =
new IncidentService(mockClient, Mockito.mock(Authentication.class));
service.raiseIncident(
IncidentType.FRESHNESS,
IncidentType.OPERATIONAL,
"custom type",
2,
"title",
"description",
ImmutableList.of(TEST_DATASET_URN),
new IncidentSource().setType(IncidentSourceType.ASSERTION_FAILURE),
new IncidentSource().setType(IncidentSourceType.MANUAL),
UrnUtils.getUrn(SYSTEM_ACTOR),
"message");

final IncidentInfo expectedInfo =
new IncidentInfo()
.setType(IncidentType.FRESHNESS)
.setType(IncidentType.OPERATIONAL)
.setCustomType("custom type")
.setPriority(2)
.setTitle("title")
Expand All @@ -175,7 +175,7 @@ private void testRaiseIncidentAllFields() throws Exception {
.setState(IncidentState.ACTIVE)
.setLastUpdated(new AuditStamp().setTime(0L).setActor(TEST_USER_URN))
.setMessage("message"))
.setSource(new IncidentSource().setType(IncidentSourceType.ASSERTION_FAILURE))
.setSource(new IncidentSource().setType(IncidentSourceType.MANUAL))
.setCreated(new AuditStamp().setTime(0L).setActor(TEST_USER_URN));

Mockito.verify(mockClient, Mockito.times(1))
Expand Down Expand Up @@ -299,7 +299,7 @@ private static EntityClient createMockEntityClient() throws Exception {

private static IncidentInfo mockIncidentInfo() throws Exception {
return new IncidentInfo()
.setType(IncidentType.FRESHNESS)
.setType(IncidentType.OPERATIONAL)
.setEntities(new UrnArray(ImmutableList.of(TEST_DATASET_URN)))
.setStatus(
new IncidentStatus()
Expand Down

0 comments on commit edb7de0

Please sign in to comment.