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(notifications): fix wrong urls in ms teams notifications #102

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 4 additions & 0 deletions datahub-actions/src/datahub_actions/utils/datahub_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,7 @@ def make_datahub_url(urn: str, base_url: str) -> str:
entity_type = entity_type_from_urn(urn)
urn = urn.replace("/", "%2F")
return f"{base_url}/{ENTITY_TYPE_TO_URL_PATH_MAP[entity_type]}/{urn}/"

def make_entity_url(urn: str, entity_type: str, base_url: str) -> str:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We may want to do even more general-purpose URL encoding here! There should be an easy to use python method for this :)

urn = urn.replace("/", "%2F")
return f"{base_url}/{entity_type}/{urn}"
9 changes: 5 additions & 4 deletions datahub-actions/src/datahub_actions/utils/social_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from datahub.metadata.schema_classes import EntityChangeEventClass as EntityChangeEvent
from datahub.utilities.urns.urn import Urn

from datahub_actions.utils.datahub_util import make_entity_url
from datahub_actions.utils.name_resolver import (
get_entity_name_from_urn,
get_entity_qualifier_from_urn,
Expand Down Expand Up @@ -108,20 +109,20 @@ def get_message_from_entity_change_event(
parent_specialized_type = get_entity_qualifier_from_urn(
str(parent_entity_urn), datahub_graph
)
parent_entity_url = f"{datahub_base_url}/{parent_entity_urn.get_type()}/{parent_entity_urn}/Schema?schemaFilter={entity_name}"
parent_entity_url = f"{make_entity_url(str(parent_entity_urn), parent_entity_urn.get_type(), datahub_base_url)}/Schema?schemaFilter={entity_name}"
entity_message_trailer = f"{entity_name} of {parent_specialized_type} {make_url_with_title(title=parent_entity_name, url=parent_entity_url, channel=channel)}"
elif event.entityType == "dataFlow":
entity_url = f"{datahub_base_url}/pipelines/{event.entityUrn}"
entity_url = make_entity_url(event.entityUrn, "pipelines", datahub_base_url)
entity_message_trailer = make_url_with_title(
title=entity_name, url=entity_url, channel=channel
)
elif event.entityType == "dataJob":
entity_url = f"{datahub_base_url}/tasks/{event.entityUrn}"
entity_url = make_entity_url(event.entityUrn, "tasks", datahub_base_url)
entity_message_trailer = make_url_with_title(
title=entity_name, url=entity_url, channel=channel
)
else:
entity_url = f"{datahub_base_url}/{event.entityType}/{event.entityUrn}"
entity_url = make_entity_url(event.entityUrn, event.entityType, datahub_base_url)
entity_message_trailer = make_url_with_title(
title=entity_name, url=entity_url, channel=channel
)
Expand Down
Loading