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

[DT-789] Add Access Type Icons #2728

Merged
merged 5 commits into from
Nov 20, 2024
Merged

Conversation

cinyecai
Copy link
Contributor

Addresses

https://broadworkbench.atlassian.net/browse/DT-789

Summary

Add icons to the Access Type column in the Dataset table in the Data Library
Tooltip appears when you hover over the icon

Screen.Recording.2024-11-15.at.4.25.14.PM.mov

Have you read Terra's Contributing Guide lately? If not, do that first.

  • Label PR with a Jira ticket number and include a link to the ticket
  • Label PR with a security risk modifier [no, low, medium, high]
  • PR describes scope of changes
  • Get a minimum of one thumbs worth of review, preferably two if enough team members are available
  • Get PO sign-off for all non-trivial UI or workflow changes
  • Verify all tests go green
  • Test this change deployed correctly and works on dev environment after deployment

@cinyecai cinyecai requested a review from a team as a code owner November 15, 2024 21:27
@cinyecai cinyecai requested review from pshapiro4broad and fboulnois and removed request for a team November 15, 2024 21:27
@rushtong
Copy link
Contributor

I think from the mocks, the same icons need to be in the filter panel as well:

Screenshot 2024-11-17 at 1 06 35 PM

Additionally, in the case where there are multiple access types, the column should show a "Mixed" value:

Screenshot 2024-11-17 at 1 08 13 PM

@cinyecai
Copy link
Contributor Author

Additionally, in the case where there are multiple access types, the column should show a "Mixed" value:

@rushtong Are there datasets that have multiple access types? I thought the "Mixed" value would only apply to studies with datasets that have different access types

@rushtong
Copy link
Contributor

Additionally, in the case where there are multiple access types, the column should show a "Mixed" value:

@rushtong Are there datasets that have multiple access types? I thought the "Mixed" value would only apply to studies with datasets that have different access types

@cinyecai - you are 100% correct, sorry about that!

@cinyecai
Copy link
Contributor Author

Added the icons to the filter list:
image
image

Copy link
Contributor

@fboulnois fboulnois left a comment

Choose a reason for hiding this comment

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

looks great 👍

Copy link
Member

@pshapiro4broad pshapiro4broad left a comment

Choose a reason for hiding this comment

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

The code looks OK, but I think it could be improved by refactoring the common code.

Comment on lines 62 to 63
{ filterName === 'Open' ? <div style={{display: 'flex', alignItems: 'center'}}>
<img src={openAccessIcon} style={{width: '10px', marginRight: 6}} /> {filterName} </div> :
Copy link
Member

Choose a reason for hiding this comment

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

Instead of using a nested ternary op, can this be done using a switch statement? Since all the other attributes are the same, the only thing that would change is the src attribute. The default case would either have to map to a placeholder icon (maybe a question mark since it's unexpected) or the external link icon.

Copy link
Contributor

Choose a reason for hiding this comment

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

The images could use alt tags here.

@@ -42,6 +45,38 @@ export const FilterItemList = (props) => {
);
};

export const AccessManagementFilterItemList = (props) => {
Copy link
Member

Choose a reason for hiding this comment

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

Instead of defining a new function, is there a way to combine this with FilterItemList? If an additional prop is an optional function that converts filterName to an image source, I think both cases could be handled in the same function, and the duplicate code can be avoided.

@@ -329,9 +350,12 @@ export const makeDatasetTableHeader = (datasets: DatasetTerm[], selected: number
cellStyle: makeHeaderStyle(cellWidths.accessType),
cellDataFn: (dataset: DatasetTerm) => ({
data: dataset.accessManagement === 'external' ?
'External to DUOS' :
tooltipIconDisplay(externalAccessIcon, 'external', 'External access request required') :
Copy link
Member

Choose a reason for hiding this comment

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

This looks like it's duplicating the logic that the filter list uses to map the access management name to the icon path. If the keys are the same in both cases, you could have a single object that maps a name to the icon, type and tooltip text. This code would use all the fields, and the list code would only use the icon path.

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
Copy link
Member

Choose a reason for hiding this comment

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

It's a minor thing but these svgs could be optimized. Running this file through https://github.com/svg/svgo (with prettify) I get

<svg width="16" height="16" xmlns="http://www.w3.org/2000/svg">
  <path d="M8 0c.147 0 .288.032.419.091l5.884 2.496c.688.292 1.203.97 1.197 1.76-.016 3.128-1.29 8.8-6.675 11.378a1.93 1.93 0 0 1-1.65 0C1.789 13.147.515 7.475.472 4.347c.024-.79.538-1.468 1.225-1.76L7.584.091A.993.993 0 0 1 8 0Zm0 13.9c4.284-2.087 5.472-6.71 5.5-9.481L8 2.087V13.9Z" fill="#354052" fill-rule="nonzero"/>
</svg>

This is the tool that terra-ui uses to optimize its svgs.

Comment on lines 268 to 269
disable={false}
scrollHide={true}
Copy link
Member

Choose a reason for hiding this comment

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

I believe these are the default settings and can be omitted.

Copy link
Contributor

@rushtong rushtong left a comment

Choose a reason for hiding this comment

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

👍🏽

Copy link
Member

@pshapiro4broad pshapiro4broad left a comment

Choose a reason for hiding this comment

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

Looks good!

@cinyecai cinyecai merged commit 1aa444c into develop Nov 20, 2024
9 checks passed
@cinyecai cinyecai deleted the cc-dt-789-access-type-icons branch November 20, 2024 14:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants