-
Notifications
You must be signed in to change notification settings - Fork 4
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
Conversation
@@ -90,8 +90,10 @@ const DataRows = ({rowData, baseStyle, columnHeaders}) => { | |||
} | |||
return output; | |||
})); | |||
|
|||
return rowWrapper({renderedRow, rowData: row}); |
There was a problem hiding this comment.
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'; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
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'; | ||
} |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this 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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍🏽
There was a problem hiding this 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!
Addresses
https://broadworkbench.atlassian.net/browse/DUOS-2048
Have you read Terra's Contributing Guide lately? If not, do that first.