Skip to content

Commit

Permalink
fix (frontend): Partially fixes lineage issues and dataset API handli…
Browse files Browse the repository at this point in the history
…ng (#1874)

* Initial fix for lineage graph

* Fixes broken test by lineage fix commit and returns empty response instead of 500 for upstreams
  • Loading branch information
Charlie Tran authored Sep 15, 2020
1 parent 7c7de50 commit 84efa73
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
7 changes: 6 additions & 1 deletion datahub-frontend/app/controllers/api/v2/Dataset.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public Result getDataset(@Nonnull String datasetUrn) {
return internalServerError(ControllerUtil.errorResponse(e));
}

return ok(Json.newObject().set("dataset", Json.toJson(view)));
return ok(Json.toJson(view));
}

@Security.Authenticated(Secured.class)
Expand Down Expand Up @@ -249,6 +249,11 @@ public Result getDatasetUpstreams(@Nonnull String datasetUrn) {
try {
upstreams = _lineageDao.getUpstreamLineage(datasetUrn);
} catch (Exception e) {
if (ControllerUtil.checkErrorCode(e, 404)) {
int[] emptyUpstreams = new int[0];
return ok(Json.toJson(emptyUpstreams));
}

Logger.error("Fetch Dataset upstreams error", e);
return internalServerError(ControllerUtil.errorResponse(e));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,33 +148,33 @@ export class DatasetEntity extends BaseEntity<Com.Linkedin.Dataset.Dataset> {
/**
* Whether or not the dataset has been deprecated
*/
@alias('entity.dataset.deprecated')
@alias('entity.deprecated')
deprecated?: boolean;

/**
* Note attached to the deprecation process for this dataset
*/
@alias('entity.dataset.deprecationNote')
@alias('entity.deprecationNote')
deprecationNote?: string;

/**
* Timestamp for when the dataset was deprecated
*/
@alias('entity.dataset.decommissionTime')
@alias('entity.decommissionTime')
decommissionTime?: number;

/**
* Last timestamp for the modification of this dataset
*/
@oneWay('entity.dataset.modifiedTime')
@oneWay('entity.modifiedTime')
modifiedTime?: number;

/**
* Whether or not the entity has been removed.
* Note: This overrides the BaseEntity implementation since DatasetEntity has a different behavior than
* other entities
*/
@oneWay('entity.dataset.removed')
@oneWay('entity.removed')
removed!: boolean;

/**
Expand All @@ -187,7 +187,7 @@ export class DatasetEntity extends BaseEntity<Com.Linkedin.Dataset.Dataset> {
/**
* Description for the dataset that contains more information about the nature of the data or metadata
*/
@oneWay('entity.dataset.description')
@oneWay('entity.description')
description?: string;

/**
Expand All @@ -202,7 +202,7 @@ export class DatasetEntity extends BaseEntity<Com.Linkedin.Dataset.Dataset> {
/**
* Reference to the data entity, is the data platform to which the dataset belongs
*/
@computed('entity.dataset.platform', 'urn')
@computed('entity.platform', 'urn')
get platform(): DatasetPlatform | undefined {
const { urn, entity } = this;
const parts = getDatasetUrnParts(urn);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ module('Integration | Component | dynamic-components/entity/field', function(hoo

test('it renders', async function(assert) {
const fakeSeedInformation = {
dataset: {
description: `Pikachu's special dataset`
}
description: `Pikachu's special dataset`
};
const testUnderlyingDataset = new DatasetEntity(
'pikachu',
Expand Down

0 comments on commit 84efa73

Please sign in to comment.