From 559f85e6cc516a1022d9dae03b7ead35e8c8a920 Mon Sep 17 00:00:00 2001 From: Tejas Rajopadhye <71188245+TejasRGitHub@users.noreply.github.com> Date: Fri, 2 Feb 2024 08:12:54 -0600 Subject: [PATCH] Dataset Description on shares UI page (#1026) ### Feature or Bugfix - Feature ### Detail As described by the problem in this GH issue - https://github.com/data-dot-all/dataall/issues/1025 . This will add dataset description on the shares UI page. ### Testing 1. Created a share for a dataset 2. Shares Page now contains the dataset description in the UI ### Relates - https://github.com/data-dot-all/dataall/issues/1025 ### Security Please answer the questions below briefly where applicable, or write `N/A`. Based on [OWASP 10](https://owasp.org/Top10/en/). - Does this PR introduce or modify any input fields or queries - this includes fetching data from storage outside the application (e.g. a database, an S3 bucket)? No - Is the input sanitized? - What precautions are you taking before deserializing the data you consume? - Is injection prevented by parametrizing queries? - Have you ensured no `eval` or similar functions are used? - Does this PR introduce any functionality or component that requires authorization? No - How have you ensured it respects the existing AuthN/AuthZ mechanisms? - Are you logging failed auth attempts? - Are you using or adding any cryptographic features? No - Do you use a standard proven implementations? - Are the used keys controlled by the customer? Where are they stored? No - Are you introducing any new policies/roles/users? - Have you used the least-privilege principle? How? By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license. --- .../modules/dataset_sharing/api/resolvers.py | 1 + .../modules/dataset_sharing/api/types.py | 1 + frontend/src/design/components/ObjectBrief.js | 6 ++++- .../modules/Shares/services/getShareObject.js | 1 + .../src/modules/Shares/views/ShareView.js | 22 +++++++++++++++++++ 5 files changed, 30 insertions(+), 1 deletion(-) diff --git a/backend/dataall/modules/dataset_sharing/api/resolvers.py b/backend/dataall/modules/dataset_sharing/api/resolvers.py index a249592d9..e01c4478d 100644 --- a/backend/dataall/modules/dataset_sharing/api/resolvers.py +++ b/backend/dataall/modules/dataset_sharing/api/resolvers.py @@ -126,6 +126,7 @@ def resolve_dataset(context: Context, source: ShareObject, **kwargs): 'AwsAccountId': env.AwsAccountId if env else 'NotFound', 'region': env.region if env else 'NotFound', 'exists': True if ds else False, + 'description' : ds.description } diff --git a/backend/dataall/modules/dataset_sharing/api/types.py b/backend/dataall/modules/dataset_sharing/api/types.py index 41722352f..ed954962a 100644 --- a/backend/dataall/modules/dataset_sharing/api/types.py +++ b/backend/dataall/modules/dataset_sharing/api/types.py @@ -99,6 +99,7 @@ gql.Field(name='AwsAccountId', type=gql.String), gql.Field(name='region', type=gql.String), gql.Field(name='exists', type=gql.Boolean), + gql.Field(name='description', type=gql.String), ], ) diff --git a/frontend/src/design/components/ObjectBrief.js b/frontend/src/design/components/ObjectBrief.js index 19a7a1291..925310135 100644 --- a/frontend/src/design/components/ObjectBrief.js +++ b/frontend/src/design/components/ObjectBrief.js @@ -116,7 +116,11 @@ export const ObjectBrief = (props) => { Description - + {description} diff --git a/frontend/src/modules/Shares/services/getShareObject.js b/frontend/src/modules/Shares/services/getShareObject.js index 3075c3e85..61bcbed10 100644 --- a/frontend/src/modules/Shares/services/getShareObject.js +++ b/frontend/src/modules/Shares/services/getShareObject.js @@ -56,6 +56,7 @@ export const getShareObject = ({ shareUri, filter }) => ({ AwsAccountId region exists + description } } } diff --git a/frontend/src/modules/Shares/views/ShareView.js b/frontend/src/modules/Shares/views/ShareView.js index 1b06cd83a..50b048df8 100644 --- a/frontend/src/modules/Shares/views/ShareView.js +++ b/frontend/src/modules/Shares/views/ShareView.js @@ -728,6 +728,28 @@ const ShareView = () => { + + + + + + + + + + {share.dataset.description.trim().length !== 0 + ? share.dataset.description + : 'No dataset description'} + + + + +