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

Modularization/fix glossary associations #742

Merged
merged 18 commits into from
Sep 11, 2023
Merged
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
8 changes: 4 additions & 4 deletions backend/dataall/modules/catalog/api/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
resolve_link_node, resolve_link_target,

)
from dataall.modules.catalog.api.registry import GlossaryRegistry

GlossaryNode = gql.Union(
name='GlossaryNode',
Expand Down Expand Up @@ -250,10 +249,11 @@
],
)

GlossaryTermLinkTarget = gql.Union(
GlossaryTermLinkTarget = gql.ObjectType(
name='GlossaryTermLinkTarget',
type_registry=GlossaryRegistry,
resolver=target_union_resolver,
Copy link
Contributor

Choose a reason for hiding this comment

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

target_union_resolver import could be removed, the resolver method itself as well + maybe GlossaryRegistry.find_object_type as well

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks @dbalintx - will take this up as part of clean up task in the backlog #741

fields=[
gql.Field(name='label', type=gql.String)
],
)

GlossaryTermLink = gql.ObjectType(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,5 @@ def resolve_glossary_terms(
return None
with context.engine.scoped_session() as session:
return GlossaryRepository.get_glossary_terms_links(
session, source.locationUri, 'DatasetStorageLocation'
session, source.locationUri, 'Folder'
)
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,6 @@ def _create_glossary_links(session, location, terms):
session,
get_context().username,
location.locationUri,
'DatasetStorageLocation',
'Folder',
terms
)
26 changes: 12 additions & 14 deletions frontend/src/modules/Glossaries/components/GlossaryAssociations.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,65 +137,63 @@ export const GlossaryAssociations = ({ glossary }) => {
<TableCell>{item.term.label}</TableCell>
<TableCell>
{/* eslint-disable-next-line no-underscore-dangle */}
{item.target.__typename === 'Dataset' && (
{item.targetType === 'Dataset' && (
<span>Dataset</span>
)}
{/* eslint-disable-next-line no-underscore-dangle */}
{item.target.__typename === 'DatasetTable' && (
{item.targetType === 'DatasetTable' && (
<span>Table</span>
)}
{/* eslint-disable-next-line no-underscore-dangle */}
{item.target.__typename ===
'DatasetStorageLocation' && <span>Folder</span>}
{item.target.__typename === 'Dashboard' && (
{item.targetType === 'Folder' && <span>Folder</span>}
{item.targetType === 'Dashboard' && (
<span>Dashboard</span>
)}
</TableCell>
<TableCell>
{/* eslint-disable-next-line no-underscore-dangle */}
{item.target.__typename === 'Dataset' && (
{item.targetType === 'Dataset' && (
<Link
underline="hover"
color="textPrimary"
component={RouterLink}
to={`/datasets/${item.targetUri}`}
to={`/console/datasets/${item.targetUri}`}
variant="subtitle2"
>
{item.target.label}
</Link>
)}
{/* eslint-disable-next-line no-underscore-dangle */}
{item.target.__typename === 'DatasetTable' && (
{item.targetType === 'DatasetTable' && (
<Link
underline="hover"
color="textPrimary"
component={RouterLink}
to={`/datasets/table/${item.targetUri}`}
to={`/console/datasets/table/${item.targetUri}`}
variant="subtitle2"
>
{item.target.label}
</Link>
)}
{/* eslint-disable-next-line no-underscore-dangle */}
{item.target.__typename ===
'DatasetStorageLocation' && (
{item.targetType === 'Folder' && (
<Link
underline="hover"
color="textPrimary"
component={RouterLink}
to={`/datasets/folder/${item.targetUri}`}
to={`/console/datasets/folder/${item.targetUri}`}
variant="subtitle2"
>
{item.target.label}
</Link>
)}
{/* eslint-disable-next-line no-underscore-dangle */}
{item.target.__typename === 'Dashboard' && (
{item.targetType === 'Dashboard' && (
<Link
underline="hover"
color="textPrimary"
component={RouterLink}
to={`/dashboards/${item.targetUri}`}
to={`/console/dashboards/${item.targetUri}`}
variant="subtitle2"
>
{item.target.label}
Expand Down
21 changes: 0 additions & 21 deletions frontend/src/modules/Glossaries/services/getGlossary.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,27 +21,6 @@ export const getGlossary = (nodeUri) => ({
terms
associations
}
associations {
count
page
pages
hasNext
hasPrevious
nodes {
__typename
target {
... on Dataset {
label
}
... on DatasetTable {
label
}
... on DatasetStorageLocation {
label
}
}
}
}
}
}
`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,27 +36,7 @@ export const listGlossaryAssociations = ({ nodeUri, filter }) => ({
}
targetType
target {
__typename
... on Dataset {
datasetUri
name
label
}
... on DatasetTable {
tableUri
name
label
}
... on DatasetStorageLocation {
locationUri
name
label
}
... on Dashboard {
dashboardUri
name
label
}
label
}
}
}
Expand Down
Loading