Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Charts Tasks for description update #14456

Merged
merged 2 commits into from
Dec 21, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import static org.openmetadata.common.utils.CommonUtil.listOrEmpty;
import static org.openmetadata.schema.type.Include.ALL;
import static org.openmetadata.service.Entity.DASHBOARD;
import static org.openmetadata.service.Entity.FIELD_DESCRIPTION;

import java.util.ArrayList;
import java.util.Collections;
Expand All @@ -29,7 +28,6 @@
import org.openmetadata.schema.type.EntityReference;
import org.openmetadata.schema.type.Include;
import org.openmetadata.schema.type.Relationship;
import org.openmetadata.schema.type.TaskType;
import org.openmetadata.service.Entity;
import org.openmetadata.service.exception.CatalogExceptionMessage;
import org.openmetadata.service.jdbi3.FeedRepository.TaskWorkflow;
Expand Down Expand Up @@ -67,12 +65,6 @@ public void setFullyQualifiedName(Dashboard dashboard) {
public TaskWorkflow getTaskWorkflow(ThreadContext threadContext) {
EntityLink entityLink = threadContext.getAbout();
if (entityLink.getFieldName().equals("charts")) {
TaskType taskType = threadContext.getThread().getTask().getType();
if (!entityLink.getFieldName().equals(FIELD_DESCRIPTION)) {
// Only description field can be updated
throw new IllegalArgumentException(
CatalogExceptionMessage.invalidFieldForTask(entityLink.getFieldName(), taskType));
}
return new ChartDescriptionTaskWorkflow(threadContext);
}
return super.getTaskWorkflow(threadContext);
Expand All @@ -93,6 +85,8 @@ static class ChartDescriptionTaskWorkflow extends DescriptionTaskWorkflow {
new IllegalArgumentException(
CatalogExceptionMessage.invalidFieldName("chart", chartName)));
Chart chart = Entity.getEntity(chartReference, "", ALL);
threadContext.setAbout(
new EntityLink(Entity.CHART, chart.getFullyQualifiedName(), "description", null, null));
threadContext.setAboutEntity(chart);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public int getNextTaskId() {

public static class ThreadContext {
@Getter protected final Thread thread;
@Getter protected final EntityLink about;
@Getter @Setter protected EntityLink about;
@Getter @Setter protected EntityInterface aboutEntity;
@Getter private final EntityReference createdBy;

Expand Down
Loading