Skip to content

Commit

Permalink
fix(blame): make view blame prior to button work properly (datahub-pr…
Browse files Browse the repository at this point in the history
  • Loading branch information
Aditya Radhakrishnan authored and maggiehays committed Aug 1, 2022
1 parent cb8e058 commit 0c19386
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ private static SchemaFieldChange getLastSchemaFieldChange(ChangeEvent changeEven
String semanticVersion, String versionStamp) {
SchemaFieldChange schemaFieldChange = new SchemaFieldChange();
schemaFieldChange.setTimestampMillis(timestamp);
schemaFieldChange.setLastSemanticVersion(truncateSemanticVersion(semanticVersion));
schemaFieldChange.setChangeType(
ChangeOperationType.valueOf(ChangeOperationType.class, changeEvent.getOperation().toString()));
schemaFieldChange.setVersionStamp(versionStamp);
Expand Down
4 changes: 4 additions & 0 deletions datahub-graphql-core/src/main/resources/timeline.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,10 @@ type SchemaFieldChange {
"""
timestampMillis: Long!
"""
The last semantic version that this schema was changed in
"""
lastSemanticVersion: String!
"""
Version stamp of the change
"""
versionStamp: String!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ const StyledInfoCircleOutlined = styled(InfoCircleOutlined)`
&&& {
margin-top: 12px;
font-size: 20px;
color: ${ANTD_GRAY[6]};
}
`;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@ export const SchemaTab = ({ properties }: { properties?: any }) => {
usageStats={usageStats}
schemaFieldBlameList={schemaFieldBlameList}
showSchemaBlame={showSchemaBlame}
selectedVersion={selectedVersion}
/>
</SchemaEditableContext.Provider>
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ export type Props = {
usageStats?: UsageQueryResult | null;
schemaFieldBlameList?: Array<SchemaFieldBlame> | null;
showSchemaBlame: boolean;
selectedVersion: string;
};
export default function SchemaTable({
rows,
Expand All @@ -55,7 +54,6 @@ export default function SchemaTable({
editMode = true,
schemaFieldBlameList,
showSchemaBlame,
selectedVersion,
}: Props): JSX.Element {
const hasUsageStats = useMemo(() => (usageStats?.aggregations?.fields?.length || 0) > 0, [usageStats]);

Expand All @@ -74,7 +72,7 @@ export default function SchemaTable({
showTerms: true,
});
const schemaTitleRenderer = useSchemaTitleRenderer(schemaMetadata, setSelectedFkFieldPath);
const schemaBlameRenderer = useSchemaBlameRenderer(selectedVersion, schemaFieldBlameList);
const schemaBlameRenderer = useSchemaBlameRenderer(schemaFieldBlameList);

const onTagTermCell = (record: SchemaField, rowIndex: number | undefined) => ({
onMouseEnter: () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,7 @@ const SchemaBlameBlameButton = styled(Button)`
width: 30px;
`;

export default function useSchemaBlameRenderer(
selectedVersion: string,
schemaBlameList?: Array<SchemaFieldBlame> | null,
) {
export default function useSchemaBlameRenderer(schemaBlameList?: Array<SchemaFieldBlame> | null) {
const history = useHistory();
const location = useLocation();
const schemaBlameRenderer = (record: SchemaField) => {
Expand Down Expand Up @@ -77,7 +74,8 @@ export default function useSchemaBlameRenderer(
navigateToVersionedDatasetUrl({
location,
history,
datasetVersion: selectedVersion,
datasetVersion:
relevantSchemaFieldBlame.schemaFieldChange.lastSemanticVersion,
});
}}
size="small"
Expand Down
1 change: 1 addition & 0 deletions datahub-web-react/src/graphql/schemaBlame.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ query getSchemaBlame($input: GetSchemaBlameInput!) {
fieldPath
schemaFieldChange {
timestampMillis
lastSemanticVersion
lastSchemaFieldChange
versionStamp
}
Expand Down

0 comments on commit 0c19386

Please sign in to comment.