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

[DUOS-2048][risk=no] Add DAR Dataset Dropdown Table #1863

Merged
merged 9 commits into from
Oct 31, 2022
Merged

Conversation

connorlbark
Copy link
Contributor

Addresses

https://broadworkbench.atlassian.net/browse/DUOS-2048


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

@@ -90,8 +90,10 @@ const DataRows = ({rowData, baseStyle, columnHeaders}) => {
}
return output;
}));

return rowWrapper({renderedRow, rowData: row});
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added the table here by adding a function which can inject HTML around a row. I considered a lot of different options, but this seemed the cleanest / least invasive way of achieving adding code inside of the outer DAR collection table itself.

@@ -1,6 +1,7 @@
import {includes, isEmpty, isNil, toLower} from 'lodash/fp';
import {formatDate} from '../../libs/utils';
import {h} from 'react-hyperscript-helpers';
import {h, div, p} from 'react-hyperscript-helpers';
import { ArrowDropUp, ArrowDropDown } from '@material-ui/icons';
Copy link
Contributor Author

@connorlbark connorlbark Oct 25, 2022

Choose a reason for hiding this comment

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

Are there standardized or better drop up / drop down icons ? I used these (as I did somewhere else) but I am not sure they are the most attractive. I couldn't find other usages of drop up/drop down icons in the codebase and struggled to find better ones.

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we do have something like that. Perhaps run it by Yvonne for her thoughts.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I found one, used in the code + looks like the mock.

Comment on lines 18 to 24
const dataAccess = elections?.find((election) => election.electionType === 'DataAccess');

let status = dataAccess?.status || 'N/A';

if (status === 'Closed') {
status = votes?.finalVotes?.some((v) => v.vote === true) ? 'Approved' : 'Denied';
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I believe it is, but I just want to check that this is sound logic for the status of a bucket.

Copy link
Contributor

Choose a reason for hiding this comment

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

There could be null vote values for votes that are still in progress. That would be neither approved or denied.

Copy link
Contributor

Choose a reason for hiding this comment

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

If any final vote is true, then it is definitely Approved. If any final vote is false, then it is definitely Denied

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So, would it just be 'In Progress' then?

Copy link
Contributor

Choose a reason for hiding this comment

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

Another possibility is Canceled where an election was closed with no final vote values. I think the logic should be something like this:

If any final votes are non-null && true -> Approved
If any final votes are non-null && false -> Denied
Else - there is no final vote status to report.

Copy link
Contributor

Choose a reason for hiding this comment

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

The above logic is a little too loose in that there's only Approved and Denied, but we do have that third case.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right now, I am displaying Canceled, Open, etc. as well since it's deriving the status from the original election status. In this table, do we prefer just showing Approved and Denied, or do we want to be more specific in the case neither is true, e.g. Open Canceled etc.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The above logic is a little too loose in that there's only Approved and Denied, but we do have that third case.

Oh okay, cool. Got it. I replied before this, I think this makes sense.

@connorlbark connorlbark changed the title [DUOS-2048][risk=no] WIP Add DAR Dataset Dropdown Table [DUOS-2048][risk=no] Add DAR Dataset Dropdown Table Oct 25, 2022
@connorlbark connorlbark marked this pull request as ready for review October 25, 2022 18:28
@connorlbark connorlbark requested a review from a team as a code owner October 25, 2022 18:28
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.

So far, this looks amazing! See comments inline. Still looking at the PR but wanted to get this out to you sooner.

@@ -106,6 +108,7 @@ export default function SimpleTable(props) {
rowData = [], //rowData -> {data, component, style, onClick}
isLoading,
styles, //styles -> baseStyle, columnStyle needed to determine sizing and color assignments
rowWrapper = ({renderedRow}) => renderedRow, // ({rowData, renderedRow}) => ... : allows injecting custom container to row
Copy link
Contributor

Choose a reason for hiding this comment

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

One thing that's jarring is the styling of the loading phase before the actual content is rendered. Not sure how that's defined, but I think we need to make that more of a spinner than a giant table that goes away within a second.

Copy link
Contributor Author

@connorlbark connorlbark Oct 26, 2022

Choose a reason for hiding this comment

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

I changed the table loading animation to be a spinner in the middle of the screen, and the table is simply empty until the data is fetched. This effects all tables, but I think it looks pretty good, even for the larger tables. If preferred, we could make it a flagged prop if you want the giant table loading animation on the, e.g., admin user page

Copy link
Contributor

Choose a reason for hiding this comment

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

This looks good, thanks for the change!

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
Contributor

@JVThomas JVThomas left a comment

Choose a reason for hiding this comment

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

The dataset tables look good!

@connorlbark connorlbark merged commit 82d3969 into develop Oct 31, 2022
@connorlbark connorlbark deleted the DUOS-2048 branch October 31, 2022 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.

3 participants